lancer-shared 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/bundle.cjs.js +624 -645
  2. package/dist/constants/job-status.d.ts +1 -1
  3. package/dist/constants/routes.d.ts +8 -1
  4. package/dist/constants/upwork-accounts.d.ts +1 -2
  5. package/dist/index.d.ts +0 -1
  6. package/dist/schemas/account/account-status.d.ts +2 -1
  7. package/dist/schemas/account/bidder-account.d.ts +5 -0
  8. package/dist/schemas/account/index.d.ts +3 -3
  9. package/dist/schemas/account/scraper-account.d.ts +4 -1
  10. package/dist/schemas/bid/bid-result.d.ts +4 -1
  11. package/dist/schemas/bid/bid.d.ts +7 -0
  12. package/dist/schemas/campaign/campaign-analytics.d.ts +5 -0
  13. package/dist/schemas/campaign/campaign-expenses.d.ts +2 -1
  14. package/dist/schemas/campaign/campaign-insights.d.ts +4 -0
  15. package/dist/schemas/campaign/campaign-integrations.d.ts +5 -0
  16. package/dist/schemas/campaign/campaign.d.ts +15 -0
  17. package/dist/schemas/campaign/index.d.ts +6 -7
  18. package/dist/schemas/index.d.ts +1 -3
  19. package/dist/schemas/job/index.d.ts +889 -10
  20. package/dist/schemas/job/job-api.d.ts +87 -0
  21. package/dist/schemas/job/job-filters.d.ts +243 -0
  22. package/dist/schemas/job/nuxt.d.ts +1667 -0
  23. package/dist/schemas/lead/index.d.ts +1020 -1283
  24. package/dist/schemas/lead/lead-status.d.ts +2 -0
  25. package/dist/schemas/logger/log-event.d.ts +21 -7
  26. package/dist/schemas/organization/organization.d.ts +22 -118
  27. package/dist/schemas/scraper/scrape-payload.d.ts +9 -0
  28. package/dist/schemas/scraper/scrape-result.d.ts +7 -0
  29. package/dist/schemas/shared.d.ts +6 -0
  30. package/dist/schemas/time-filter/index.d.ts +1 -0
  31. package/dist/schemas/transaction/index.d.ts +2 -0
  32. package/dist/schemas/usage/index.d.ts +25 -20
  33. package/dist/schemas/user/index.d.ts +10 -0
  34. package/package.json +1 -1
  35. package/dist/constants/collections.js +0 -14
  36. package/dist/constants/common-questions.js +0 -57
  37. package/dist/constants/index.js +0 -18
  38. package/dist/constants/job-filter-options.js +0 -265
  39. package/dist/constants/job-status.js +0 -21
  40. package/dist/constants/mappings/countryMapping.js +0 -120
  41. package/dist/constants/mappings/regionMapping.js +0 -240
  42. package/dist/constants/routes.js +0 -116
  43. package/dist/constants/upwork-accounts.js +0 -18
  44. package/dist/index.js +0 -4
  45. package/dist/schemas/account/account-status.js +0 -8
  46. package/dist/schemas/account/bidder-account.js +0 -35
  47. package/dist/schemas/account/index.js +0 -3
  48. package/dist/schemas/account/scraper-account.js +0 -34
  49. package/dist/schemas/ai/ai-config.d.ts +0 -36
  50. package/dist/schemas/ai/ai-config.js +0 -9
  51. package/dist/schemas/ai/index.d.ts +0 -3
  52. package/dist/schemas/ai/index.js +0 -3
  53. package/dist/schemas/ai/proposal.d.ts +0 -82
  54. package/dist/schemas/ai/proposal.js +0 -13
  55. package/dist/schemas/ai/suitability.d.ts +0 -37
  56. package/dist/schemas/ai/suitability.js +0 -14
  57. package/dist/schemas/bid/bid-result.js +0 -11
  58. package/dist/schemas/bid/bid.js +0 -35
  59. package/dist/schemas/bid/index.js +0 -2
  60. package/dist/schemas/campaign/campaign-ai-metrics.js +0 -6
  61. package/dist/schemas/campaign/campaign-analytics.js +0 -42
  62. package/dist/schemas/campaign/campaign-expenses.js +0 -6
  63. package/dist/schemas/campaign/campaign-insights.js +0 -31
  64. package/dist/schemas/campaign/campaign-integrations.js +0 -13
  65. package/dist/schemas/campaign/campaign-job-count.js +0 -3
  66. package/dist/schemas/campaign/campaign.js +0 -41
  67. package/dist/schemas/campaign/index.js +0 -7
  68. package/dist/schemas/chat-message/chat-message.js +0 -10
  69. package/dist/schemas/chat-message/index.js +0 -1
  70. package/dist/schemas/config/agency-config.js +0 -7
  71. package/dist/schemas/config/index.js +0 -1
  72. package/dist/schemas/event/index.d.ts +0 -58
  73. package/dist/schemas/index.js +0 -17
  74. package/dist/schemas/job-filters/index.js +0 -1
  75. package/dist/schemas/job-filters/job-filters.js +0 -84
  76. package/dist/schemas/lead/index.js +0 -173
  77. package/dist/schemas/lead/lead-note.js +0 -27
  78. package/dist/schemas/lead/lead-status.js +0 -23
  79. package/dist/schemas/lead/nuxt.js +0 -287
  80. package/dist/schemas/logger/index.js +0 -1
  81. package/dist/schemas/logger/log-event.js +0 -117
  82. package/dist/schemas/organization/index.js +0 -70
  83. package/dist/schemas/organization/member.js +0 -7
  84. package/dist/schemas/organization/organization.js +0 -16
  85. package/dist/schemas/organization/subscription.js +0 -17
  86. package/dist/schemas/proxy/index.js +0 -3
  87. package/dist/schemas/proxy/proxy-available-replacements.js +0 -3
  88. package/dist/schemas/proxy/proxy-country.js +0 -249
  89. package/dist/schemas/proxy/proxy.js +0 -29
  90. package/dist/schemas/saved-search/index.js +0 -9
  91. package/dist/schemas/scraper/index.js +0 -2
  92. package/dist/schemas/scraper/scrape-payload.js +0 -21
  93. package/dist/schemas/scraper/scrape-result.js +0 -23
  94. package/dist/schemas/shared.js +0 -19
  95. package/dist/schemas/time-filter/index.js +0 -6
  96. package/dist/schemas/transaction/index.js +0 -17
  97. package/dist/schemas/usage/index.js +0 -18
  98. package/dist/schemas/user/index.js +0 -52
  99. package/dist/types/account/account-status.js +0 -1
  100. package/dist/types/account/bidder-account.js +0 -1
  101. package/dist/types/account/index.js +0 -3
  102. package/dist/types/account/scraper-account.js +0 -1
  103. package/dist/types/ai/ai-config.d.ts +0 -6
  104. package/dist/types/ai/ai-config.js +0 -1
  105. package/dist/types/ai/index.d.ts +0 -3
  106. package/dist/types/ai/index.js +0 -3
  107. package/dist/types/ai/proposal.d.ts +0 -10
  108. package/dist/types/ai/proposal.js +0 -1
  109. package/dist/types/ai/suitability.d.ts +0 -6
  110. package/dist/types/ai/suitability.js +0 -1
  111. package/dist/types/bid/bid-result.js +0 -1
  112. package/dist/types/bid/bid.js +0 -1
  113. package/dist/types/bid/index.js +0 -2
  114. package/dist/types/campaign/campaign-analytics.js +0 -1
  115. package/dist/types/campaign/campaign-expenses.js +0 -1
  116. package/dist/types/campaign/campaign-insights.js +0 -1
  117. package/dist/types/campaign/campaign-integrations.js +0 -1
  118. package/dist/types/campaign/campaign-job-count.js +0 -1
  119. package/dist/types/campaign/campaign.js +0 -1
  120. package/dist/types/campaign/index.js +0 -6
  121. package/dist/types/chat-message/chat-message.js +0 -1
  122. package/dist/types/chat-message/index.js +0 -1
  123. package/dist/types/config/agency-config.js +0 -1
  124. package/dist/types/config/index.js +0 -1
  125. package/dist/types/index.js +0 -15
  126. package/dist/types/job/index.js +0 -3
  127. package/dist/types/job/job-note.js +0 -1
  128. package/dist/types/job/job-status.js +0 -9
  129. package/dist/types/job/nuxt.js +0 -1
  130. package/dist/types/job-filters/index.js +0 -1
  131. package/dist/types/job-filters/job-filters.js +0 -1
  132. package/dist/types/logger/index.js +0 -1
  133. package/dist/types/logger/log-event.js +0 -1
  134. package/dist/types/saved-search/index.js +0 -1
  135. package/dist/types/scraper/index.js +0 -2
  136. package/dist/types/scraper/scrape-payload.js +0 -1
  137. package/dist/types/scraper/scrape-result.js +0 -1
  138. package/dist/types/shared.js +0 -1
  139. package/dist/types/time-filter/index.js +0 -1
  140. package/dist/types/transaction/index.js +0 -1
  141. package/dist/types/usage/index.js +0 -1
  142. package/dist/types/user/index.js +0 -1
  143. package/dist/utils/index.js +0 -1
  144. package/dist/utils/try-catch.js +0 -10
@@ -4402,11 +4402,11 @@ var z = /*#__PURE__*/Object.freeze({
4402
4402
  });
4403
4403
 
4404
4404
  const accountStatusSchema = z.enum([
4405
- 'verification_required',
4406
- 'shadow_banned',
4407
- 'healthy',
4408
- 'banned',
4409
- 'suspended',
4405
+ "verification_required",
4406
+ "shadow_banned",
4407
+ "healthy",
4408
+ "banned",
4409
+ "suspended",
4410
4410
  ]);
4411
4411
 
4412
4412
  const bidderAccountProvider = z.enum([
@@ -4443,433 +4443,6 @@ const updateBidderAccountSchema = bidderAccountSchema
4443
4443
  })
4444
4444
  .partial();
4445
4445
 
4446
- const JOB_FILTER_OPTIONS = {
4447
- REGIONS: ["Worldwide", "UKOnly", "USOnly"],
4448
- PROJECT_DURATION: [
4449
- "Less than 1 month",
4450
- "1 to 3 months",
4451
- "3 to 6 months",
4452
- "More than 6 months",
4453
- "Unspecified",
4454
- ],
4455
- ENGAGEMENT_TYPE: [
4456
- "Less than 30 hrs/week",
4457
- "More than 30 hrs/week",
4458
- "Unspecified",
4459
- ],
4460
- VENDOR_TYPE: ["Independent", "Agency", "Unspecified"],
4461
- PAYMENT_TYPE: ["Fixed-price", "Hourly", "Unspecified"],
4462
- TALENT_TYPE: ["Agency", "Independent", "Unspecified"],
4463
- ENGLISH_LEVELS: [
4464
- "Fluent",
4465
- "Conversational",
4466
- "Native or Bilingual",
4467
- "Unspecified",
4468
- ],
4469
- EXPERIENCE_LEVELS: ["Entry level", "Intermediate", "Expert"],
4470
- REQUIRED_EARNINGS: [100, 1000, 10000],
4471
- REQUIRED_JSS: [">80%", ">90%", "100%", "RT"],
4472
- HIERARCHICAL_CATEGORIES: [
4473
- {
4474
- label: "Accounting & Consulting",
4475
- value: "accounting-consulting",
4476
- children: [
4477
- "Accounting & Bookkeeping",
4478
- "Financial Planning",
4479
- "Management Consulting & Analysis",
4480
- "Other - Accounting & Consulting",
4481
- "Personal & Professional Coaching",
4482
- "Recruiting & Human Resources",
4483
- ],
4484
- },
4485
- {
4486
- label: "Admin Support",
4487
- value: "admin-support",
4488
- children: [
4489
- "Data Entry & Transcription Services",
4490
- "Market Research & Product Reviews",
4491
- "Project Management",
4492
- "Virtual Assistance",
4493
- ],
4494
- },
4495
- {
4496
- label: "Customer Service",
4497
- value: "customer-service",
4498
- children: [
4499
- "Community Management & Tagging",
4500
- "Customer Service & Tech Support",
4501
- ],
4502
- },
4503
- {
4504
- label: "Data Science & Analytics",
4505
- value: "data-science-analytics",
4506
- children: [
4507
- "AI & Machine Learning",
4508
- "Data Analysis & Testing",
4509
- "Data Extraction/ETL",
4510
- "Data Mining & Management",
4511
- ],
4512
- },
4513
- {
4514
- label: "Design & Creative",
4515
- value: "design-creative",
4516
- children: [
4517
- "Art & Illustration",
4518
- "Audio & Music Production",
4519
- "Branding & Logo Design",
4520
- "Graphic, Editorial & Presentation Design",
4521
- "NFT, AR/VR & Game Art",
4522
- "Performing Arts",
4523
- "Photography",
4524
- "Product Design",
4525
- "Video & Animation",
4526
- ],
4527
- },
4528
- {
4529
- label: "Engineering & Architecture",
4530
- value: "engineering-architecture",
4531
- children: [
4532
- "3D Modeling & CAD",
4533
- "Building & Landscape Architecture",
4534
- "Chemical Engineering",
4535
- "Civil & Structural Engineering",
4536
- "Contract Manufacturing",
4537
- "Electrical & Electronic Engineering",
4538
- "Energy & Mechanical Engineering",
4539
- ],
4540
- },
4541
- {
4542
- label: "IT & Networking",
4543
- value: "it-networking",
4544
- children: [
4545
- "Database Management & Administration",
4546
- "DevOps & Solution Architecture",
4547
- "ERP/CRM Software",
4548
- "Information Security & Compliance",
4549
- "Network & System Administration",
4550
- ],
4551
- },
4552
- {
4553
- label: "Legal",
4554
- value: "legal",
4555
- children: [
4556
- "Corporate & Contract Law",
4557
- "Finance & Tax Law",
4558
- "International & Immigration Law",
4559
- "Public Law",
4560
- ],
4561
- },
4562
- {
4563
- label: "Sales & Marketing",
4564
- value: "sales-marketing",
4565
- children: [
4566
- "Digital Marketing",
4567
- "Lead Generation & Telemarketing",
4568
- "Marketing, PR & Brand Strategy",
4569
- ],
4570
- },
4571
- {
4572
- label: "Translation",
4573
- value: "translation",
4574
- children: [
4575
- "Language Tutoring & Interpretation",
4576
- "Translation & Localization Services",
4577
- ],
4578
- },
4579
- {
4580
- label: "Software Development",
4581
- value: "software-development",
4582
- children: [
4583
- "AI Apps & Integration",
4584
- "Blockchain, NFT & Cryptocurrency",
4585
- "Desktop Application Development",
4586
- "Ecommerce Development",
4587
- "Game Design & Development",
4588
- "Mobile Development",
4589
- "Other - Software Development",
4590
- "Product Management & Scrum",
4591
- "QA Testing",
4592
- "Scripts & Utilities",
4593
- "Web & Mobile Design",
4594
- "Web Development",
4595
- ],
4596
- },
4597
- {
4598
- label: "Writing",
4599
- value: "writing",
4600
- children: [
4601
- "Content Writing",
4602
- "Editing & Proofreading Services",
4603
- "Professional & Business Writing",
4604
- "Sales & Marketing Copywriting",
4605
- ],
4606
- },
4607
- ],
4608
- CATEGORIES: [
4609
- "Personal & Professional Coaching",
4610
- "Accounting & Bookkeeping",
4611
- "Financial Planning",
4612
- "Recruiting & Human Resources",
4613
- "Management Consulting & Analysis",
4614
- "Other - Accounting & Consulting",
4615
- "Data Entry & Transcription Services",
4616
- "Virtual Assistance",
4617
- "Project Management",
4618
- "Market Research & Product Reviews",
4619
- "Community Management & Tagging",
4620
- "Customer Service & Tech Support",
4621
- "Data Analysis & Testing",
4622
- "Data Extraction/ETL",
4623
- "Data Mining & Management",
4624
- "AI & Machine Learning",
4625
- "Art & Illustration",
4626
- "Audio & Music Production",
4627
- "Branding & Logo Design",
4628
- "NFT, AR/VR & Game Art",
4629
- "Graphic, Editorial & Presentation Design",
4630
- "Performing Arts",
4631
- "Photography",
4632
- "Product Design",
4633
- "Video & Animation",
4634
- "Building & Landscape Architecture",
4635
- "Chemical Engineering",
4636
- "Civil & Structural Engineering",
4637
- "Contract Manufacturing",
4638
- "Electrical & Electronic Engineering",
4639
- "Energy & Mechanical Engineering",
4640
- "3D Modeling & CAD",
4641
- "Database Management & Administration",
4642
- "ERP/CRM Software",
4643
- "Information Security & Compliance",
4644
- "Network & System Administration",
4645
- "DevOps & Solution Architecture",
4646
- "Corporate & Contract Law",
4647
- "International & Immigration Law",
4648
- "Finance & Tax Law",
4649
- "Public Law",
4650
- "Digital Marketing",
4651
- "Lead Generation & Telemarketing",
4652
- "Marketing, PR & Brand Strategy",
4653
- "Language Tutoring & Interpretation",
4654
- "Translation & Localization Services",
4655
- "Blockchain, NFT & Cryptocurrency",
4656
- "AI Apps & Integration",
4657
- "Desktop Application Development",
4658
- "Ecommerce Development",
4659
- "Game Design & Development",
4660
- "Mobile Development",
4661
- "Other - Software Development",
4662
- "Product Management & Scrum",
4663
- "QA Testing",
4664
- "Scripts & Utilities",
4665
- "Web & Mobile Design",
4666
- "Web Development",
4667
- "Sales & Marketing Copywriting",
4668
- "Content Writing",
4669
- "Editing & Proofreading Services",
4670
- "Professional & Business Writing",
4671
- ],
4672
- CLIENT_INDUSTRY: [
4673
- "Aerospace",
4674
- "Agriculture & Forestry",
4675
- "Art & Design",
4676
- "Automotive",
4677
- "Aviation",
4678
- "Education",
4679
- "Energy & Utilities",
4680
- "Engineering & Architecture",
4681
- "Fashion & Beauty",
4682
- "Finance & Accounting",
4683
- "Food & Beverage",
4684
- "Government & Public Sector",
4685
- "Health & Fitness",
4686
- "HR & Business Services",
4687
- "Legal",
4688
- "Manufacturing & Construction",
4689
- "Media & Entertainment",
4690
- "Military & Defense",
4691
- "Mining",
4692
- "Real Estate",
4693
- "Retail & Consumer Goods",
4694
- "Sales & Marketing",
4695
- "Science & Medicine",
4696
- "Sports & Recreation",
4697
- "Supply Chain & Logistics",
4698
- "Tech & IT",
4699
- "Transportation & Warehousing",
4700
- "Travel & Hospitality",
4701
- ],
4702
- CLIENT_SIZE: [
4703
- "Individual client",
4704
- "Small company (2-9 people)",
4705
- "Mid-sized company (10-99 people)",
4706
- "Large company (100-1,000 people)",
4707
- "Large company (1,000+ people)",
4708
- "Unspecified",
4709
- ],
4710
- };
4711
-
4712
- // Enum definitions for fixed options
4713
- const projectDurationEnum = z.enum(JOB_FILTER_OPTIONS.PROJECT_DURATION);
4714
- const engagementTypeEnum = z.enum(JOB_FILTER_OPTIONS.ENGAGEMENT_TYPE);
4715
- const vendorTypeEnum = z.enum(JOB_FILTER_OPTIONS.VENDOR_TYPE);
4716
- const paymentTypeEnum = z.enum(JOB_FILTER_OPTIONS.PAYMENT_TYPE);
4717
- const categoryEnum = z.enum(JOB_FILTER_OPTIONS.CATEGORIES);
4718
- const clientIndustryEnum = z.enum(JOB_FILTER_OPTIONS.CLIENT_INDUSTRY);
4719
- const clientSizeEnum = z.enum(JOB_FILTER_OPTIONS.CLIENT_SIZE);
4720
- const talentTypeEnum = z.enum(JOB_FILTER_OPTIONS.TALENT_TYPE);
4721
- const englishLevelEnum = z.enum(JOB_FILTER_OPTIONS.ENGLISH_LEVELS);
4722
- const experienceLevelEnum = z.enum(JOB_FILTER_OPTIONS.EXPERIENCE_LEVELS);
4723
- const regionEnum = z.enum(["all", "Worldwide", "UKOnly", "USOnly"]);
4724
- const requiredEarningsEnum = z.union([
4725
- z.literal(100),
4726
- z.literal(1000),
4727
- z.literal(10000),
4728
- ]);
4729
- const requiredJSSEnum = z.enum(JOB_FILTER_OPTIONS.REQUIRED_JSS);
4730
- // Main job filters schema
4731
- const jobFiltersSchema = z.object({
4732
- keywords: z
4733
- .object({
4734
- includes: z.string().nullable(),
4735
- excludes: z.string().nullable(),
4736
- })
4737
- .nullable(),
4738
- isFeatured: z.enum(["all", "true", "false"]).nullable(),
4739
- regions: z.array(regionEnum).nullable(),
4740
- categories: z
4741
- .object({
4742
- includes: z.array(categoryEnum).nullable(),
4743
- excludes: z.array(categoryEnum).nullable(),
4744
- })
4745
- .nullable(),
4746
- payment: z
4747
- .object({
4748
- paymentType: z.array(paymentTypeEnum).nullable(),
4749
- minFixedPrice: z.number().nullable(),
4750
- maxFixedPrice: z.number().nullable(),
4751
- minHourlyRate: z.number().nullable(),
4752
- maxHourlyRate: z.number().nullable(),
4753
- })
4754
- .nullable(),
4755
- projectDuration: z.array(projectDurationEnum).nullable(),
4756
- experienceLevel: z.array(experienceLevelEnum).nullable(),
4757
- questions: z
4758
- .object({
4759
- hasQuestions: z.enum(["all", "yes", "no"]).default("all"),
4760
- })
4761
- .nullable(),
4762
- engagementType: z.array(engagementTypeEnum).nullable(),
4763
- clientInfo: z
4764
- .object({
4765
- isPaymentVerified: z.enum(["all", "true", "false"]).default("all"),
4766
- isPhoneVerified: z.enum(["all", "true", "false"]).default("all"),
4767
- enterpriseClient: z.enum(["all", "true", "false"]).default("all"),
4768
- clientLocationIncludes: z.array(z.string()).nullable(),
4769
- clientLocationExcludes: z.array(z.string()).nullable(),
4770
- minReviewScore: z.number().min(0).max(5).nullable(),
4771
- minTotalSpent: z.number().nullable(),
4772
- minHireRate: z.number().min(0).max(100).nullable(),
4773
- clientIndustry: z.array(clientIndustryEnum).nullable(),
4774
- companySize: z.array(clientSizeEnum).nullable(),
4775
- minJobsPosted: z.number().nullable(),
4776
- minAvgHourlyRate: z.number().nullable(),
4777
- minNumReviews: z.number().nullable(),
4778
- memberSinceFrom: z.string().date().nullable(),
4779
- memberSinceTo: z.string().date().nullable(),
4780
- })
4781
- .nullable(),
4782
- vendorQualifications: z
4783
- .object({
4784
- locationIncludes: z.array(z.string()).nullable(),
4785
- locationExcludes: z.array(z.string()).nullable(),
4786
- talentTypes: z.array(talentTypeEnum).nullable(),
4787
- englishLevels: z.array(englishLevelEnum).nullable(),
4788
- includeRisingTalent: z.string().nullable(),
4789
- requiredEarnings: requiredEarningsEnum.nullable(),
4790
- requiredJSS: z.array(requiredJSSEnum).nullable(),
4791
- })
4792
- .nullable(),
4793
- });
4794
-
4795
- const scraperAccountSchema = z.object({
4796
- id: z.string(),
4797
- email: z.string().email(),
4798
- password: z.string(),
4799
- cookies: z.record(z.string(), z.string()),
4800
- proxy_credentials: z.string(),
4801
- region: regionEnum,
4802
- isActive: z.boolean(),
4803
- lastUsed: z.number(),
4804
- status: accountStatusSchema,
4805
- verified: z.boolean(),
4806
- errors: z.array(z.object({
4807
- errorMessage: z.string(),
4808
- timestamp: z.number(),
4809
- screenshotUrl: z.string(),
4810
- htmlUrl: z.string(),
4811
- })),
4812
- });
4813
- const createScraperAccountSchema = scraperAccountSchema.pick({
4814
- email: true,
4815
- password: true,
4816
- proxy_credentials: true,
4817
- region: true,
4818
- verified: true,
4819
- isActive: true,
4820
- });
4821
- const updateScraperAccountSchema = scraperAccountSchema
4822
- .omit({
4823
- id: true,
4824
- })
4825
- .partial();
4826
-
4827
- const bidPayloadProposalDataSchema = z.object({
4828
- coverLetter: z.string(),
4829
- questionAnswerPairs: z
4830
- .array(z.object({
4831
- question: z.string(),
4832
- answer: z.string(),
4833
- }))
4834
- .nullable(),
4835
- boostingEnabled: z.boolean(),
4836
- minimumBoost: z.number().nullable(),
4837
- maximumBoost: z.number().nullable(),
4838
- });
4839
- const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
4840
- const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
4841
- agencyName: z.string(),
4842
- contractorName: z.string(),
4843
- specializedProfile: z.string().nullable(),
4844
- });
4845
- const bidPayloadSchema = z.object({
4846
- jobUrl: z.string(),
4847
- username: z.string(),
4848
- password: z.string(),
4849
- });
4850
- const agencyBidPayloadSchema = bidPayloadSchema.extend({
4851
- proposalData: agencyBidProposalDataSchema,
4852
- });
4853
- const freelancerBidPayloadSchema = bidPayloadSchema.extend({
4854
- proposalData: freelancerBidProposalDataSchema,
4855
- });
4856
- const bidDtoSchema = z.object({
4857
- organizationId: z.string(),
4858
- campaignId: z.string(),
4859
- leadId: z.string(),
4860
- });
4861
-
4862
- const bidSuccessSchema = z.object({
4863
- status: z.literal('success'),
4864
- biddingAmount: z.number(),
4865
- boosted: z.boolean(),
4866
- boostingAmount: z.number(),
4867
- });
4868
- const bidFailedSchema = z.object({
4869
- status: z.literal('failed'),
4870
- errorMessage: z.string(),
4871
- });
4872
-
4873
4446
  const booleanSchema = z
4874
4447
  .union([z.boolean(), z.literal("true"), z.literal("false")])
4875
4448
  .transform((value) => value === true || value === "true");
@@ -4889,56 +4462,6 @@ const regionSchema = z.union([
4889
4462
  z.literal("Worldwide"),
4890
4463
  ]);
4891
4464
 
4892
- const leadNoteSchema = z.object({
4893
- id: z.string(),
4894
- jobId: z.string(),
4895
- content: z.string(),
4896
- order: z.number(),
4897
- bgColor: z.string(),
4898
- createdAt: z.number(),
4899
- updatedAt: z.number(),
4900
- });
4901
- const createLeadNoteSchema = leadNoteSchema.pick({
4902
- id: true,
4903
- content: true,
4904
- order: true,
4905
- bgColor: true,
4906
- });
4907
- const updateLeadNoteSchema = leadNoteSchema
4908
- .pick({
4909
- id: true,
4910
- content: true,
4911
- order: true,
4912
- bgColor: true,
4913
- })
4914
- .partial({ content: true, order: true, bgColor: true });
4915
- const updateLeadNotesOrderSchema = z.object({
4916
- order: z.array(z.object({ id: z.string(), order: z.number() })),
4917
- });
4918
-
4919
- const agentStatusSchema = z.enum([
4920
- "suitabilityPending",
4921
- "suitabilityProcessing",
4922
- "suitabilityComplete",
4923
- "suitabilityFailed",
4924
- "proposalProcessing",
4925
- "proposalComplete",
4926
- "proposalFailed",
4927
- "biddingProcessing",
4928
- "biddingComplete",
4929
- "biddingFailed",
4930
- "jobArchived",
4931
- ]);
4932
- const leadStatusSchema = z.enum([
4933
- "leads",
4934
- "contacted",
4935
- "viewed",
4936
- "replied",
4937
- "negotiations",
4938
- "won",
4939
- "lost",
4940
- ]);
4941
-
4942
4465
  const segmentationDataSchema = objectType({
4943
4466
  customValue: stringType().nullable(),
4944
4467
  label: stringType(),
@@ -5176,54 +4699,416 @@ const authSchema = objectType({
5176
4699
  isInfographicTooltipAvailable: booleanType(),
5177
4700
  }),
5178
4701
  });
5179
- const applicationContextSchema = objectType({
5180
- freelancerAllowed: booleanType(),
5181
- clientAllowed: booleanType(),
5182
- userIntentEvaluation: objectType({
5183
- isDeclined: booleanType(),
5184
- reason: stringType().nullable(),
5185
- }),
5186
- canApplyOnBehalfOfAgencyFreelancers: booleanType(),
5187
- canSubmitMoreProposals: booleanType(),
5188
- submittedProposals: anyType().nullable(),
4702
+ const applicationContextSchema = objectType({
4703
+ freelancerAllowed: booleanType(),
4704
+ clientAllowed: booleanType(),
4705
+ userIntentEvaluation: objectType({
4706
+ isDeclined: booleanType(),
4707
+ reason: stringType().nullable(),
4708
+ }),
4709
+ canApplyOnBehalfOfAgencyFreelancers: booleanType(),
4710
+ canSubmitMoreProposals: booleanType(),
4711
+ submittedProposals: anyType().nullable(),
4712
+ });
4713
+ const nuxtStateJobSchema = objectType({
4714
+ cache: booleanType(),
4715
+ job: jobSchema,
4716
+ buyer: buyerSchema,
4717
+ currentUserInfo: currentUserInfoSchema,
4718
+ isVisitor: booleanType(),
4719
+ openJobs: arrayType(anyType()),
4720
+ workHistory: workHistorySchema,
4721
+ similarJobs: arrayType(anyType()),
4722
+ sands: sandsSchema,
4723
+ auth: authSchema,
4724
+ applicants: objectType({
4725
+ applicantsBidsStats: anyType().nullable(),
4726
+ }),
4727
+ connects: connectsSchema.nullish(),
4728
+ enterpriseJobAdditionalInfo: recordType(anyType()),
4729
+ applicationContext: applicationContextSchema,
4730
+ profileMatchServiceUid: stringType(),
4731
+ seo: objectType({
4732
+ title: stringType(),
4733
+ description: stringType(),
4734
+ url: stringType(),
4735
+ }),
4736
+ teamUid: anyType().nullable(),
4737
+ proposalPermissions: objectType({
4738
+ freelancerAllowed: booleanType(),
4739
+ clientAllowed: booleanType(),
4740
+ }),
4741
+ jobSlug: anyType().nullable(),
4742
+ prefillWith: anyType().nullable(),
4743
+ isGroupOpportunity: booleanType(),
4744
+ workLocation: anyType().nullable(),
4745
+ isPhoneVerified: booleanType(),
4746
+ errorResponse: anyType().nullable(),
4747
+ isApplyBlocked: booleanType(),
4748
+ hasAiInterview: booleanType(),
4749
+ talentFeePromotion: booleanType().nullish(),
4750
+ });
4751
+
4752
+ const JOB_FILTER_OPTIONS = {
4753
+ REGIONS: ["Worldwide", "UKOnly", "USOnly"],
4754
+ PROJECT_DURATION: [
4755
+ "Less than 1 month",
4756
+ "1 to 3 months",
4757
+ "3 to 6 months",
4758
+ "More than 6 months",
4759
+ "Unspecified",
4760
+ ],
4761
+ ENGAGEMENT_TYPE: [
4762
+ "Less than 30 hrs/week",
4763
+ "More than 30 hrs/week",
4764
+ "Unspecified",
4765
+ ],
4766
+ VENDOR_TYPE: ["Independent", "Agency", "Unspecified"],
4767
+ PAYMENT_TYPE: ["Fixed-price", "Hourly", "Unspecified"],
4768
+ TALENT_TYPE: ["Agency", "Independent", "Unspecified"],
4769
+ ENGLISH_LEVELS: [
4770
+ "Fluent",
4771
+ "Conversational",
4772
+ "Native or Bilingual",
4773
+ "Unspecified",
4774
+ ],
4775
+ EXPERIENCE_LEVELS: ["Entry level", "Intermediate", "Expert"],
4776
+ REQUIRED_EARNINGS: [100, 1000, 10000],
4777
+ REQUIRED_JSS: [">80%", ">90%", "100%", "RT"],
4778
+ HIERARCHICAL_CATEGORIES: [
4779
+ {
4780
+ label: "Accounting & Consulting",
4781
+ value: "accounting-consulting",
4782
+ children: [
4783
+ "Accounting & Bookkeeping",
4784
+ "Financial Planning",
4785
+ "Management Consulting & Analysis",
4786
+ "Other - Accounting & Consulting",
4787
+ "Personal & Professional Coaching",
4788
+ "Recruiting & Human Resources",
4789
+ ],
4790
+ },
4791
+ {
4792
+ label: "Admin Support",
4793
+ value: "admin-support",
4794
+ children: [
4795
+ "Data Entry & Transcription Services",
4796
+ "Market Research & Product Reviews",
4797
+ "Project Management",
4798
+ "Virtual Assistance",
4799
+ ],
4800
+ },
4801
+ {
4802
+ label: "Customer Service",
4803
+ value: "customer-service",
4804
+ children: [
4805
+ "Community Management & Tagging",
4806
+ "Customer Service & Tech Support",
4807
+ ],
4808
+ },
4809
+ {
4810
+ label: "Data Science & Analytics",
4811
+ value: "data-science-analytics",
4812
+ children: [
4813
+ "AI & Machine Learning",
4814
+ "Data Analysis & Testing",
4815
+ "Data Extraction/ETL",
4816
+ "Data Mining & Management",
4817
+ ],
4818
+ },
4819
+ {
4820
+ label: "Design & Creative",
4821
+ value: "design-creative",
4822
+ children: [
4823
+ "Art & Illustration",
4824
+ "Audio & Music Production",
4825
+ "Branding & Logo Design",
4826
+ "Graphic, Editorial & Presentation Design",
4827
+ "NFT, AR/VR & Game Art",
4828
+ "Performing Arts",
4829
+ "Photography",
4830
+ "Product Design",
4831
+ "Video & Animation",
4832
+ ],
4833
+ },
4834
+ {
4835
+ label: "Engineering & Architecture",
4836
+ value: "engineering-architecture",
4837
+ children: [
4838
+ "3D Modeling & CAD",
4839
+ "Building & Landscape Architecture",
4840
+ "Chemical Engineering",
4841
+ "Civil & Structural Engineering",
4842
+ "Contract Manufacturing",
4843
+ "Electrical & Electronic Engineering",
4844
+ "Energy & Mechanical Engineering",
4845
+ ],
4846
+ },
4847
+ {
4848
+ label: "IT & Networking",
4849
+ value: "it-networking",
4850
+ children: [
4851
+ "Database Management & Administration",
4852
+ "DevOps & Solution Architecture",
4853
+ "ERP/CRM Software",
4854
+ "Information Security & Compliance",
4855
+ "Network & System Administration",
4856
+ ],
4857
+ },
4858
+ {
4859
+ label: "Legal",
4860
+ value: "legal",
4861
+ children: [
4862
+ "Corporate & Contract Law",
4863
+ "Finance & Tax Law",
4864
+ "International & Immigration Law",
4865
+ "Public Law",
4866
+ ],
4867
+ },
4868
+ {
4869
+ label: "Sales & Marketing",
4870
+ value: "sales-marketing",
4871
+ children: [
4872
+ "Digital Marketing",
4873
+ "Lead Generation & Telemarketing",
4874
+ "Marketing, PR & Brand Strategy",
4875
+ ],
4876
+ },
4877
+ {
4878
+ label: "Translation",
4879
+ value: "translation",
4880
+ children: [
4881
+ "Language Tutoring & Interpretation",
4882
+ "Translation & Localization Services",
4883
+ ],
4884
+ },
4885
+ {
4886
+ label: "Software Development",
4887
+ value: "software-development",
4888
+ children: [
4889
+ "AI Apps & Integration",
4890
+ "Blockchain, NFT & Cryptocurrency",
4891
+ "Desktop Application Development",
4892
+ "Ecommerce Development",
4893
+ "Game Design & Development",
4894
+ "Mobile Development",
4895
+ "Other - Software Development",
4896
+ "Product Management & Scrum",
4897
+ "QA Testing",
4898
+ "Scripts & Utilities",
4899
+ "Web & Mobile Design",
4900
+ "Web Development",
4901
+ ],
4902
+ },
4903
+ {
4904
+ label: "Writing",
4905
+ value: "writing",
4906
+ children: [
4907
+ "Content Writing",
4908
+ "Editing & Proofreading Services",
4909
+ "Professional & Business Writing",
4910
+ "Sales & Marketing Copywriting",
4911
+ ],
4912
+ },
4913
+ ],
4914
+ CATEGORIES: [
4915
+ "Personal & Professional Coaching",
4916
+ "Accounting & Bookkeeping",
4917
+ "Financial Planning",
4918
+ "Recruiting & Human Resources",
4919
+ "Management Consulting & Analysis",
4920
+ "Other - Accounting & Consulting",
4921
+ "Data Entry & Transcription Services",
4922
+ "Virtual Assistance",
4923
+ "Project Management",
4924
+ "Market Research & Product Reviews",
4925
+ "Community Management & Tagging",
4926
+ "Customer Service & Tech Support",
4927
+ "Data Analysis & Testing",
4928
+ "Data Extraction/ETL",
4929
+ "Data Mining & Management",
4930
+ "AI & Machine Learning",
4931
+ "Art & Illustration",
4932
+ "Audio & Music Production",
4933
+ "Branding & Logo Design",
4934
+ "NFT, AR/VR & Game Art",
4935
+ "Graphic, Editorial & Presentation Design",
4936
+ "Performing Arts",
4937
+ "Photography",
4938
+ "Product Design",
4939
+ "Video & Animation",
4940
+ "Building & Landscape Architecture",
4941
+ "Chemical Engineering",
4942
+ "Civil & Structural Engineering",
4943
+ "Contract Manufacturing",
4944
+ "Electrical & Electronic Engineering",
4945
+ "Energy & Mechanical Engineering",
4946
+ "3D Modeling & CAD",
4947
+ "Database Management & Administration",
4948
+ "ERP/CRM Software",
4949
+ "Information Security & Compliance",
4950
+ "Network & System Administration",
4951
+ "DevOps & Solution Architecture",
4952
+ "Corporate & Contract Law",
4953
+ "International & Immigration Law",
4954
+ "Finance & Tax Law",
4955
+ "Public Law",
4956
+ "Digital Marketing",
4957
+ "Lead Generation & Telemarketing",
4958
+ "Marketing, PR & Brand Strategy",
4959
+ "Language Tutoring & Interpretation",
4960
+ "Translation & Localization Services",
4961
+ "Blockchain, NFT & Cryptocurrency",
4962
+ "AI Apps & Integration",
4963
+ "Desktop Application Development",
4964
+ "Ecommerce Development",
4965
+ "Game Design & Development",
4966
+ "Mobile Development",
4967
+ "Other - Software Development",
4968
+ "Product Management & Scrum",
4969
+ "QA Testing",
4970
+ "Scripts & Utilities",
4971
+ "Web & Mobile Design",
4972
+ "Web Development",
4973
+ "Sales & Marketing Copywriting",
4974
+ "Content Writing",
4975
+ "Editing & Proofreading Services",
4976
+ "Professional & Business Writing",
4977
+ ],
4978
+ CLIENT_INDUSTRY: [
4979
+ "Aerospace",
4980
+ "Agriculture & Forestry",
4981
+ "Art & Design",
4982
+ "Automotive",
4983
+ "Aviation",
4984
+ "Education",
4985
+ "Energy & Utilities",
4986
+ "Engineering & Architecture",
4987
+ "Fashion & Beauty",
4988
+ "Finance & Accounting",
4989
+ "Food & Beverage",
4990
+ "Government & Public Sector",
4991
+ "Health & Fitness",
4992
+ "HR & Business Services",
4993
+ "Legal",
4994
+ "Manufacturing & Construction",
4995
+ "Media & Entertainment",
4996
+ "Military & Defense",
4997
+ "Mining",
4998
+ "Real Estate",
4999
+ "Retail & Consumer Goods",
5000
+ "Sales & Marketing",
5001
+ "Science & Medicine",
5002
+ "Sports & Recreation",
5003
+ "Supply Chain & Logistics",
5004
+ "Tech & IT",
5005
+ "Transportation & Warehousing",
5006
+ "Travel & Hospitality",
5007
+ ],
5008
+ CLIENT_SIZE: [
5009
+ "Individual client",
5010
+ "Small company (2-9 people)",
5011
+ "Mid-sized company (10-99 people)",
5012
+ "Large company (100-1,000 people)",
5013
+ "Large company (1,000+ people)",
5014
+ "Unspecified",
5015
+ ],
5016
+ };
5017
+
5018
+ // Enum definitions for fixed options
5019
+ const projectDurationEnum = z.enum(JOB_FILTER_OPTIONS.PROJECT_DURATION);
5020
+ const engagementTypeEnum = z.enum(JOB_FILTER_OPTIONS.ENGAGEMENT_TYPE);
5021
+ const vendorTypeEnum = z.enum(JOB_FILTER_OPTIONS.VENDOR_TYPE);
5022
+ const paymentTypeEnum = z.enum(JOB_FILTER_OPTIONS.PAYMENT_TYPE);
5023
+ const categoryEnum = z.enum(JOB_FILTER_OPTIONS.CATEGORIES);
5024
+ const clientIndustryEnum = z.enum(JOB_FILTER_OPTIONS.CLIENT_INDUSTRY);
5025
+ const clientSizeEnum = z.enum(JOB_FILTER_OPTIONS.CLIENT_SIZE);
5026
+ const talentTypeEnum = z.enum(JOB_FILTER_OPTIONS.TALENT_TYPE);
5027
+ const englishLevelEnum = z.enum(JOB_FILTER_OPTIONS.ENGLISH_LEVELS);
5028
+ const experienceLevelEnum = z.enum(JOB_FILTER_OPTIONS.EXPERIENCE_LEVELS);
5029
+ const regionEnum = z.enum(["all", "Worldwide", "UKOnly", "USOnly"]);
5030
+ const requiredEarningsEnum = z.union([
5031
+ z.literal(100),
5032
+ z.literal(1000),
5033
+ z.literal(10000),
5034
+ ]);
5035
+ const requiredJSSEnum = z.enum(JOB_FILTER_OPTIONS.REQUIRED_JSS);
5036
+ // Main job filters schema
5037
+ const jobFiltersSchema = z.object({
5038
+ keywords: z
5039
+ .object({
5040
+ includes: z.string().nullable(),
5041
+ excludes: z.string().nullable(),
5042
+ })
5043
+ .nullable(),
5044
+ isFeatured: z.enum(["all", "true", "false"]).nullable(),
5045
+ regions: z.array(regionEnum).nullable(),
5046
+ categories: z
5047
+ .object({
5048
+ includes: z.array(categoryEnum).nullable(),
5049
+ excludes: z.array(categoryEnum).nullable(),
5050
+ })
5051
+ .nullable(),
5052
+ payment: z
5053
+ .object({
5054
+ paymentType: z.array(paymentTypeEnum).nullable(),
5055
+ minFixedPrice: z.number().nullable(),
5056
+ maxFixedPrice: z.number().nullable(),
5057
+ minHourlyRate: z.number().nullable(),
5058
+ maxHourlyRate: z.number().nullable(),
5059
+ })
5060
+ .nullable(),
5061
+ projectDuration: z.array(projectDurationEnum).nullable(),
5062
+ experienceLevel: z.array(experienceLevelEnum).nullable(),
5063
+ questions: z
5064
+ .object({
5065
+ hasQuestions: z.enum(["all", "yes", "no"]).default("all"),
5066
+ })
5067
+ .nullable(),
5068
+ engagementType: z.array(engagementTypeEnum).nullable(),
5069
+ clientInfo: z
5070
+ .object({
5071
+ isPaymentVerified: z.enum(["all", "true", "false"]).default("all"),
5072
+ isPhoneVerified: z.enum(["all", "true", "false"]).default("all"),
5073
+ enterpriseClient: z.enum(["all", "true", "false"]).default("all"),
5074
+ clientLocationIncludes: z.array(z.string()).nullable(),
5075
+ clientLocationExcludes: z.array(z.string()).nullable(),
5076
+ minReviewScore: z.number().min(0).max(5).nullable(),
5077
+ minTotalSpent: z.number().nullable(),
5078
+ minHireRate: z.number().min(0).max(100).nullable(),
5079
+ clientIndustry: z.array(clientIndustryEnum).nullable(),
5080
+ companySize: z.array(clientSizeEnum).nullable(),
5081
+ minJobsPosted: z.number().nullable(),
5082
+ minAvgHourlyRate: z.number().nullable(),
5083
+ minNumReviews: z.number().nullable(),
5084
+ memberSinceFrom: z.string().date().nullable(),
5085
+ memberSinceTo: z.string().date().nullable(),
5086
+ })
5087
+ .nullable(),
5088
+ vendorQualifications: z
5089
+ .object({
5090
+ locationIncludes: z.array(z.string()).nullable(),
5091
+ locationExcludes: z.array(z.string()).nullable(),
5092
+ talentTypes: z.array(talentTypeEnum).nullable(),
5093
+ englishLevels: z.array(englishLevelEnum).nullable(),
5094
+ includeRisingTalent: z.string().nullable(),
5095
+ requiredEarnings: requiredEarningsEnum.nullable(),
5096
+ requiredJSS: z.array(requiredJSSEnum).nullable(),
5097
+ })
5098
+ .nullable(),
5099
+ });
5100
+
5101
+ // Filter Option Schema
5102
+ const filterOptionItemSchema = z.object({
5103
+ key: z.string(),
5104
+ count: z.number(),
5189
5105
  });
5190
- const nuxtStateJobSchema = objectType({
5191
- cache: booleanType(),
5192
- job: jobSchema,
5193
- buyer: buyerSchema,
5194
- currentUserInfo: currentUserInfoSchema,
5195
- isVisitor: booleanType(),
5196
- openJobs: arrayType(anyType()),
5197
- workHistory: workHistorySchema,
5198
- similarJobs: arrayType(anyType()),
5199
- sands: sandsSchema,
5200
- auth: authSchema,
5201
- applicants: objectType({
5202
- applicantsBidsStats: anyType().nullable(),
5203
- }),
5204
- connects: connectsSchema.nullish(),
5205
- enterpriseJobAdditionalInfo: recordType(anyType()),
5206
- applicationContext: applicationContextSchema,
5207
- profileMatchServiceUid: stringType(),
5208
- seo: objectType({
5209
- title: stringType(),
5210
- description: stringType(),
5211
- url: stringType(),
5212
- }),
5213
- teamUid: anyType().nullable(),
5214
- proposalPermissions: objectType({
5215
- freelancerAllowed: booleanType(),
5216
- clientAllowed: booleanType(),
5217
- }),
5218
- jobSlug: anyType().nullable(),
5219
- prefillWith: anyType().nullable(),
5220
- isGroupOpportunity: booleanType(),
5221
- workLocation: anyType().nullable(),
5222
- isPhoneVerified: booleanType(),
5223
- errorResponse: anyType().nullable(),
5224
- isApplyBlocked: booleanType(),
5225
- hasAiInterview: booleanType(),
5226
- talentFeePromotion: booleanType().nullish(),
5106
+ // Filter Options Response Schema
5107
+ const filterOptionsResponseSchema = z.object({
5108
+ locations: z.array(filterOptionItemSchema),
5109
+ englishLevels: z.array(filterOptionItemSchema),
5110
+ talentTypes: z.array(filterOptionItemSchema),
5111
+ experienceLevels: z.array(filterOptionItemSchema),
5227
5112
  });
5228
5113
 
5229
5114
  const jobSkillsSchema = objectType({
@@ -5340,6 +5225,130 @@ const upworkJobSchema = objectType({
5340
5225
  activity: recordType(jobActivityOffsetEnum, jobActivitySchema).nullish(),
5341
5226
  activityDelta: jobActivityDeltaSchema.nullish(),
5342
5227
  });
5228
+ const jobActivityOffsetHourSchema = custom((val) => jobActivityOffsetHours.includes(val));
5229
+ const jobActivityUpdateSchema = objectType({
5230
+ jobUrl: stringType(),
5231
+ data: jobActivitySchema,
5232
+ offsetHour: jobActivityOffsetHourSchema,
5233
+ scrapedAt: numberType(),
5234
+ });
5235
+ const jobActivitySnapshotSchema = objectType({
5236
+ jobUrl: stringType(),
5237
+ activity: jobActivitySchema,
5238
+ postedAt: numberType(),
5239
+ scrapedAt: numberType(),
5240
+ hoursSincePosted: numberType(),
5241
+ });
5242
+ const jobListingSchema = objectType({
5243
+ uid: stringType().nullable(),
5244
+ title: stringType().nullable(),
5245
+ jobUrl: stringType().nullable(),
5246
+ datetime: stringType().nullable(),
5247
+ isFeatured: booleanType().nullable(),
5248
+ region: regionSchema.nullable(),
5249
+ });
5250
+
5251
+ const scraperAccountSchema = z.object({
5252
+ id: z.string(),
5253
+ email: z.string().email(),
5254
+ password: z.string(),
5255
+ cookies: z.record(z.string(), z.string()),
5256
+ proxy_credentials: z.string(),
5257
+ region: regionEnum,
5258
+ isActive: z.boolean(),
5259
+ lastUsed: z.number(),
5260
+ status: accountStatusSchema,
5261
+ verified: z.boolean(),
5262
+ errors: z.array(z.object({
5263
+ errorMessage: z.string(),
5264
+ timestamp: z.number(),
5265
+ screenshotUrl: z.string(),
5266
+ htmlUrl: z.string(),
5267
+ })),
5268
+ });
5269
+ const createScraperAccountSchema = scraperAccountSchema.pick({
5270
+ email: true,
5271
+ password: true,
5272
+ proxy_credentials: true,
5273
+ region: true,
5274
+ verified: true,
5275
+ isActive: true,
5276
+ });
5277
+ const updateScraperAccountSchema = scraperAccountSchema
5278
+ .omit({
5279
+ id: true,
5280
+ })
5281
+ .partial();
5282
+
5283
+ const bidPayloadProposalDataSchema = z.object({
5284
+ coverLetter: z.string(),
5285
+ questionAnswerPairs: z
5286
+ .array(z.object({
5287
+ question: z.string(),
5288
+ answer: z.string(),
5289
+ }))
5290
+ .nullable(),
5291
+ boostingEnabled: z.boolean(),
5292
+ minimumBoost: z.number().nullable(),
5293
+ maximumBoost: z.number().nullable(),
5294
+ });
5295
+ const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
5296
+ const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
5297
+ agencyName: z.string(),
5298
+ contractorName: z.string(),
5299
+ specializedProfile: z.string().nullable(),
5300
+ });
5301
+ const bidPayloadSchema = z.object({
5302
+ jobUrl: z.string(),
5303
+ username: z.string(),
5304
+ password: z.string(),
5305
+ });
5306
+ const agencyBidPayloadSchema = bidPayloadSchema.extend({
5307
+ proposalData: agencyBidProposalDataSchema,
5308
+ });
5309
+ const freelancerBidPayloadSchema = bidPayloadSchema.extend({
5310
+ proposalData: freelancerBidProposalDataSchema,
5311
+ });
5312
+ const bidDtoSchema = z.object({
5313
+ organizationId: z.string(),
5314
+ campaignId: z.string(),
5315
+ leadId: z.string(),
5316
+ });
5317
+
5318
+ const bidSuccessSchema = z.object({
5319
+ status: z.literal("success"),
5320
+ biddingAmount: z.number(),
5321
+ boosted: z.boolean(),
5322
+ boostingAmount: z.number(),
5323
+ });
5324
+ const bidFailedSchema = z.object({
5325
+ status: z.literal("failed"),
5326
+ errorMessage: z.string(),
5327
+ });
5328
+
5329
+ const agentStatusSchema = z.enum([
5330
+ "suitabilityPending",
5331
+ "suitabilityProcessing",
5332
+ "suitabilityComplete",
5333
+ "suitabilityFailed",
5334
+ "proposalProcessing",
5335
+ "proposalComplete",
5336
+ "proposalFailed",
5337
+ "biddingProcessing",
5338
+ "biddingComplete",
5339
+ "biddingFailed",
5340
+ "jobArchived",
5341
+ ]);
5342
+ const leadStatusSchema = z.enum([
5343
+ "leads",
5344
+ "contacted",
5345
+ "viewed",
5346
+ "replied",
5347
+ "negotiations",
5348
+ "won",
5349
+ "lost",
5350
+ ]);
5351
+
5343
5352
  const questionAnswerPairSchema = z.object({
5344
5353
  question: z.string(),
5345
5354
  answer: z.string(),
@@ -5354,7 +5363,6 @@ const leadSchema = upworkJobSchema
5354
5363
  questionAnswerPairs: arrayType(questionAnswerPairSchema).nullable(),
5355
5364
  agentStatus: agentStatusSchema.nullable(),
5356
5365
  leadStatus: leadStatusSchema.nullable(),
5357
- notes: arrayType(leadNoteSchema).nullable(),
5358
5366
  biddingAmount: numberType().nullable(),
5359
5367
  boosted: booleanType().nullable(),
5360
5368
  boostingAmount: numberType().nullable(),
@@ -5370,27 +5378,20 @@ const leadResponseSchema = objectType({
5370
5378
  hasMore: booleanType(),
5371
5379
  leadCounts: numberType().nullable(),
5372
5380
  });
5373
- const jobListingSchema = objectType({
5374
- uid: stringType().nullable(),
5375
- title: stringType().nullable(),
5376
- jobUrl: stringType().nullable(),
5377
- datetime: stringType().nullable(),
5378
- isFeatured: booleanType().nullable(),
5379
- region: regionSchema.nullable(),
5380
- });
5381
- const jobActivityOffsetHourSchema = custom((val) => jobActivityOffsetHours.includes(val));
5382
- const jobActivityUpdateSchema = objectType({
5383
- jobUrl: stringType(),
5384
- data: jobActivitySchema,
5385
- offsetHour: jobActivityOffsetHourSchema,
5386
- scrapedAt: numberType(),
5381
+ // ============ // Api ============
5382
+ // Search Leads Schema
5383
+ const findLeadsRequestSchema = z.object({
5384
+ filters: z.custom().optional(),
5385
+ offset: z.number().default(0).optional(),
5386
+ limit: z.number().default(10).optional(),
5387
+ campaignId: z.string().optional(),
5387
5388
  });
5388
- const jobActivitySnapshotSchema = objectType({
5389
- jobUrl: stringType(),
5390
- activity: jobActivitySchema,
5391
- postedAt: numberType(),
5392
- scrapedAt: numberType(),
5393
- hoursSincePosted: numberType(),
5389
+ // Lead Search Response Schema
5390
+ const findLeadsResponseSchema = z.object({
5391
+ total: z.number(),
5392
+ jobs: z.array(upworkJobSchema),
5393
+ lastMonthTotal: z.number().optional(),
5394
+ error: z.string().optional(),
5394
5395
  });
5395
5396
 
5396
5397
  const campaignExpensesSchema = z.object({
@@ -5479,8 +5480,6 @@ const campaignInsightsSchema = z.object({
5479
5480
  suitabilityRange90to100: z.number(),
5480
5481
  });
5481
5482
 
5482
- const campaignJobCountSchema = z.record(leadStatusSchema, z.number());
5483
-
5484
5483
  const campaignAnalyticsStatsSchema = z.object({
5485
5484
  jobsAnalyzed: z.number(),
5486
5485
  totalStats: z.object({
@@ -5528,74 +5527,57 @@ const campaignAIMetricsSchema = z.object({
5528
5527
  connectsSaved: z.number(),
5529
5528
  });
5530
5529
 
5531
- const chatMessageSchema = z.object({
5532
- id: z.string(),
5533
- content: z.string(),
5534
- role: z.enum(['user', 'assistant']),
5535
- timestamp: z.string(),
5536
- });
5537
- const newChatMessageSchema = chatMessageSchema.omit({
5538
- id: true,
5539
- });
5540
-
5541
- const agencyConfigSchema = z.object({
5542
- agencyName: z.string(),
5543
- contractorName: z.string(),
5544
- specializedProfile: z.string().nullable(),
5545
- accountId: z.string(),
5546
- });
5547
-
5548
5530
  const LogEventTypeEnum = z.enum([
5549
5531
  // Scraper Events
5550
- 'scraperStarted',
5551
- 'scraperCompleted',
5552
- 'jobScraped',
5553
- 'jobScrapeFailed',
5554
- 'jobsIndexed',
5555
- 'jobDuplicateSkipped',
5556
- 'scraperFailed',
5557
- 'jobActivityScraped',
5558
- 'jobActivityScrapeFailed',
5532
+ "scraperStarted",
5533
+ "scraperCompleted",
5534
+ "jobScraped",
5535
+ "jobScrapeFailed",
5536
+ "jobsIndexed",
5537
+ "jobDuplicateSkipped",
5538
+ "scraperFailed",
5539
+ "jobActivityScraped",
5540
+ "jobActivityScrapeFailed",
5559
5541
  // Feed Scraper Events
5560
- 'feedScrapeStarted',
5561
- 'feedScrapeCompleted',
5562
- 'feedScrapeFailed',
5563
- 'jobListingScraped',
5542
+ "feedScrapeStarted",
5543
+ "feedScrapeCompleted",
5544
+ "feedScrapeFailed",
5545
+ "jobListingScraped",
5564
5546
  // Job Sync & Campaign Matching
5565
- 'jobSyncPublished',
5566
- 'jobSyncReceived',
5567
- 'leadsCreatedAndSynced',
5547
+ "jobSyncPublished",
5548
+ "jobSyncReceived",
5549
+ "leadsCreatedAndSynced",
5568
5550
  // Suitability Events
5569
- 'suitabilityPending',
5570
- 'suitabilityProcessing',
5571
- 'suitabilityComplete',
5572
- 'suitabilityFailed',
5573
- 'manualSuitabilityAnalyzed',
5551
+ "suitabilityPending",
5552
+ "suitabilityProcessing",
5553
+ "suitabilityComplete",
5554
+ "suitabilityFailed",
5555
+ "manualSuitabilityAnalyzed",
5574
5556
  // Proposal Events
5575
- 'proposalProcessing',
5576
- 'proposalComplete',
5577
- 'proposalFailed',
5578
- 'manualProposalGenerated',
5557
+ "proposalProcessing",
5558
+ "proposalComplete",
5559
+ "proposalFailed",
5560
+ "manualProposalGenerated",
5579
5561
  // Bidding Events
5580
- 'biddingProcessing',
5581
- 'biddingComplete',
5582
- 'biddingFailed',
5583
- 'biddingSkipped',
5584
- 'biddingPending',
5585
- 'biddingRetry',
5586
- 'biddingInsufficientConnects',
5587
- 'biddingWarningAlert',
5562
+ "biddingProcessing",
5563
+ "biddingComplete",
5564
+ "biddingFailed",
5565
+ "biddingSkipped",
5566
+ "biddingPending",
5567
+ "biddingRetry",
5568
+ "biddingInsufficientConnects",
5569
+ "biddingWarningAlert",
5588
5570
  // System/Generic Events
5589
- 'errorLogged',
5590
- 'cloudTaskRetry',
5591
- 'manualLeadEdited',
5592
- 'leadArchived',
5593
- 'auditTrailLogged',
5571
+ "errorLogged",
5572
+ "cloudTaskRetry",
5573
+ "manualLeadEdited",
5574
+ "leadArchived",
5575
+ "auditTrailLogged",
5594
5576
  // Knowledge Base Events
5595
- 'knowledgeBaseGenerationComplete',
5596
- 'knowledgeBaseGenerationFailed',
5577
+ "knowledgeBaseGenerationComplete",
5578
+ "knowledgeBaseGenerationFailed",
5597
5579
  // Model Chain Events
5598
- 'modelFailed',
5580
+ "modelFailed",
5599
5581
  ]);
5600
5582
  const logEventSchema = z.object({
5601
5583
  // The type of event (use a z.enum if possible)
@@ -5603,13 +5585,14 @@ const logEventSchema = z.object({
5603
5585
  // The service that triggered the event
5604
5586
  source: z.string(), // e.g. "lancer-agents", "lancer-bidding"
5605
5587
  // Optional: Allow logging non-lead events in the future
5606
- resourceType: z.string().default('lead'), // e.g. "lead", "campaign", "user"
5588
+ resourceType: z.string().default("lead"), // e.g. "lead", "campaign", "user"
5607
5589
  // ID of the resource (primary entity affected)
5608
5590
  resourceId: z.string().nullable(), // fallback if leadId is not applicable
5609
5591
  // Lead-level metadata
5610
- leadId: z.string().nullable(),
5611
- campaignId: z.string().nullable(),
5592
+ organizationId: z.string().nullable(),
5612
5593
  userId: z.string().nullable(),
5594
+ campaignId: z.string().nullable(),
5595
+ leadId: z.string().nullable(),
5613
5596
  // Reason or message for the event
5614
5597
  reason: z.string().nullable(),
5615
5598
  // Generic metadata (stacktrace, score, raw request, etc.)
@@ -6170,16 +6153,6 @@ const transactionSchema = objectType({
6170
6153
  timestamp: numberType(),
6171
6154
  });
6172
6155
 
6173
- const leadStatusDisplayMap = {
6174
- leads: "Leads",
6175
- contacted: "Contacted",
6176
- viewed: "Viewed",
6177
- replied: "Replied",
6178
- negotiations: "Negotiations",
6179
- won: "Won",
6180
- lost: "Lost",
6181
- };
6182
-
6183
6156
  // Base collection names
6184
6157
  const COLLECTIONS = {
6185
6158
  USERS: "users",
@@ -12453,7 +12426,9 @@ const ROUTES = {
12453
12426
  ORGANIZATIONS: {
12454
12427
  BASE: "organizations",
12455
12428
  BY_ID: (id) => `organizations/${id}`,
12456
- AI_CONFIG: (id) => `organizations/${id}/ai-config`,
12429
+ AI_CONFIG: (id) => `organizations/${id}/settings/ai-config`,
12430
+ KNOWLEDGE_BASE: (id) => `organizations/${id}/settings/knowledge-base`,
12431
+ NOTIFICATIONS: (id) => `organizations/${id}/settings/notifications`,
12457
12432
  SETTINGS: (id) => `organizations/${id}/settings`,
12458
12433
  CHARGES: (id) => `organizations/${id}/charges`,
12459
12434
  PAYMENT_METHODS: (id) => `organizations/${id}/payment-methods`,
@@ -12497,6 +12472,10 @@ const ROUTES = {
12497
12472
  },
12498
12473
  },
12499
12474
  },
12475
+ TRANSACTIONS: {
12476
+ BASE: "transactions",
12477
+ BY_ID: (id) => `transactions/${id}`,
12478
+ },
12500
12479
  AGENT: {
12501
12480
  BASE: "agent",
12502
12481
  TEST_RULES: "agent/test-rules",
@@ -12511,24 +12490,28 @@ const buildRoute = (route, params = {}) => {
12511
12490
  });
12512
12491
  return builtRoute;
12513
12492
  };
12493
+ // Helper function to get route without admin prefix
12494
+ const getRouteWithoutAdminPrefix = (route) => {
12495
+ return route.replace("admin/", "");
12496
+ };
12514
12497
 
12515
12498
  const accountStatusOrder = [
12516
- 'verification_required',
12517
- 'shadow_banned',
12518
- 'healthy',
12519
- 'banned',
12520
- 'suspended',
12499
+ "verification_required",
12500
+ "shadow_banned",
12501
+ "healthy",
12502
+ "banned",
12503
+ "suspended",
12521
12504
  ];
12522
12505
  const accountStatusDisplayMap = {
12523
- verification_required: 'Verification Required',
12524
- shadow_banned: 'Shadow Banned',
12525
- healthy: 'Healthy',
12526
- banned: 'Banned',
12527
- suspended: 'Suspended',
12506
+ verification_required: "Verification Required",
12507
+ shadow_banned: "Shadow Banned",
12508
+ healthy: "Healthy",
12509
+ banned: "Banned",
12510
+ suspended: "Suspended",
12528
12511
  };
12529
12512
  const bidderAccountProviderDisplayMap = {
12530
- 'lancer-provided': 'Lancer Provided',
12531
- 'user-provided': 'User Provided',
12513
+ "lancer-provided": "Lancer Provided",
12514
+ "user-provided": "User Provided",
12532
12515
  };
12533
12516
 
12534
12517
  const creditDeductionAmountMap = {
@@ -12814,7 +12797,6 @@ exports.accountStatusOrder = accountStatusOrder;
12814
12797
  exports.accountStatusSchema = accountStatusSchema;
12815
12798
  exports.agencyBidPayloadSchema = agencyBidPayloadSchema;
12816
12799
  exports.agencyBidProposalDataSchema = agencyBidProposalDataSchema;
12817
- exports.agencyConfigSchema = agencyConfigSchema;
12818
12800
  exports.agentStatusSchema = agentStatusSchema;
12819
12801
  exports.aiConfigOldSchema = aiConfigOldSchema;
12820
12802
  exports.aiConfigSchema = aiConfigSchema;
@@ -12844,12 +12826,10 @@ exports.campaignExpensesSchema = campaignExpensesSchema;
12844
12826
  exports.campaignInsightsSchema = campaignInsightsSchema;
12845
12827
  exports.campaignIntegrations = campaignIntegrations;
12846
12828
  exports.campaignIntegrationsSchema = campaignIntegrationsSchema;
12847
- exports.campaignJobCountSchema = campaignJobCountSchema;
12848
12829
  exports.campaignSchema = campaignSchema;
12849
12830
  exports.campaignStatusSchema = campaignStatusSchema;
12850
12831
  exports.capitalize = capitalize;
12851
12832
  exports.categoryEnum = categoryEnum;
12852
- exports.chatMessageSchema = chatMessageSchema;
12853
12833
  exports.clientIndustryEnum = clientIndustryEnum;
12854
12834
  exports.clientInfoSchema = clientInfoSchema;
12855
12835
  exports.clientReviewSchema = clientReviewSchema;
@@ -12858,7 +12838,6 @@ exports.commonQuestions = commonQuestions;
12858
12838
  exports.countryMapping = countryMapping;
12859
12839
  exports.createBidderAccountSchema = createBidderAccountSchema;
12860
12840
  exports.createCampaignSchema = createCampaignSchema;
12861
- exports.createLeadNoteSchema = createLeadNoteSchema;
12862
12841
  exports.createScraperAccountSchema = createScraperAccountSchema;
12863
12842
  exports.creditDeductionAmountMap = creditDeductionAmountMap;
12864
12843
  exports.creditDeductionEventTypeEnum = creditDeductionEventTypeEnum;
@@ -12871,11 +12850,16 @@ exports.experienceLevelEnum = experienceLevelEnum;
12871
12850
  exports.externalProxySchema = externalProxySchema;
12872
12851
  exports.feedScrapeCompletedEventMetadata = feedScrapeCompletedEventMetadata;
12873
12852
  exports.feedScrapeStartedEventMetadata = feedScrapeStartedEventMetadata;
12853
+ exports.filterOptionItemSchema = filterOptionItemSchema;
12854
+ exports.filterOptionsResponseSchema = filterOptionsResponseSchema;
12855
+ exports.findLeadsRequestSchema = findLeadsRequestSchema;
12856
+ exports.findLeadsResponseSchema = findLeadsResponseSchema;
12874
12857
  exports.formatCurrency = formatCurrency;
12875
12858
  exports.freelancerBidPayloadSchema = freelancerBidPayloadSchema;
12876
12859
  exports.freelancerBidProposalDataSchema = freelancerBidProposalDataSchema;
12877
12860
  exports.getNextStatus = getNextStatus;
12878
12861
  exports.getPreviousStatus = getPreviousStatus;
12862
+ exports.getRouteWithoutAdminPrefix = getRouteWithoutAdminPrefix;
12879
12863
  exports.isNumeric = isNumeric;
12880
12864
  exports.jobActivityDeltaSchema = jobActivityDeltaSchema;
12881
12865
  exports.jobActivityOffsetEnum = jobActivityOffsetEnum;
@@ -12891,16 +12875,13 @@ exports.jobListingSchema = jobListingSchema;
12891
12875
  exports.jobSkillsSchema = jobSkillsSchema;
12892
12876
  exports.jobStatusOrder = jobStatusOrder;
12893
12877
  exports.knowledgeBaseSchema = knowledgeBaseSchema;
12894
- exports.leadNoteSchema = leadNoteSchema;
12895
12878
  exports.leadResponseSchema = leadResponseSchema;
12896
12879
  exports.leadSchema = leadSchema;
12897
- exports.leadStatusDisplayMap = leadStatusDisplayMap;
12898
12880
  exports.leadStatusSchema = leadStatusSchema;
12899
12881
  exports.listingScrapedEventMetadata = listingScrapedEventMetadata;
12900
12882
  exports.logEventSchema = logEventSchema;
12901
12883
  exports.loginSchema = loginSchema;
12902
12884
  exports.metadataSchema = metadataSchema;
12903
- exports.newChatMessageSchema = newChatMessageSchema;
12904
12885
  exports.notificationConfigSchema = notificationConfigSchema;
12905
12886
  exports.nuxtStateJobSchema = nuxtStateJobSchema;
12906
12887
  exports.organizationBillingSchema = organizationBillingSchema;
@@ -12949,8 +12930,6 @@ exports.tryCatch = tryCatch;
12949
12930
  exports.updateBidderAccountSchema = updateBidderAccountSchema;
12950
12931
  exports.updateCampaignIntegrationsSchema = updateCampaignIntegrationsSchema;
12951
12932
  exports.updateCampaignSchema = updateCampaignSchema;
12952
- exports.updateLeadNoteSchema = updateLeadNoteSchema;
12953
- exports.updateLeadNotesOrderSchema = updateLeadNotesOrderSchema;
12954
12933
  exports.updateScraperAccountSchema = updateScraperAccountSchema;
12955
12934
  exports.upworkJobSchema = upworkJobSchema;
12956
12935
  exports.upworkProfileSchema = upworkProfileSchema;