lancer-shared 1.2.189 → 1.2.190

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.
@@ -13073,7 +13073,26 @@ const biddingHourlyRateStrategyEnum = z.enum([
13073
13073
  'match_profile_rate',
13074
13074
  'fixed_rate',
13075
13075
  ]);
13076
+ const weekDaysEnum = z.enum([
13077
+ 'monday',
13078
+ 'tuesday',
13079
+ 'wednesday',
13080
+ 'thursday',
13081
+ 'friday',
13082
+ 'saturday',
13083
+ 'sunday',
13084
+ ]);
13076
13085
  const bidWithWarningEnum = z.enum(['bid', 'skip']);
13086
+ const timeBlockSchema = z.object({
13087
+ fromHour: z.number().min(0).max(23),
13088
+ toHour: z.number().min(0).max(23),
13089
+ });
13090
+ const workTimeSchema = z.object({
13091
+ enabled: z.boolean(),
13092
+ days: z.array(weekDaysEnum),
13093
+ timeBlocks: z.array(timeBlockSchema),
13094
+ timezone: z.string().nullable(),
13095
+ });
13077
13096
  const campaignSchema = z.object({
13078
13097
  id: z.string(),
13079
13098
  name: z.string(),
@@ -13093,10 +13112,6 @@ const campaignSchema = z.object({
13093
13112
  biddingFixedHourlyRate: z.number().nullable(),
13094
13113
  biddingHourlyRatePercentage: z.number().min(0).max(100).nullable(),
13095
13114
  bidWithWarning: bidWithWarningEnum,
13096
- sleepEnabled: z.boolean().nullable().default(false),
13097
- sleepStartAtHour: z.number().nullable().default(23),
13098
- sleepEndAtHour: z.number().nullable().default(7),
13099
- sleepTimezone: z.string().nullable(),
13100
13115
  leadCounts: z.record(leadStatusEnum, z.number()).nullable(),
13101
13116
  expenses: campaignExpensesSchema,
13102
13117
  notificationsEnabled: z.boolean().nullable(),
@@ -13112,6 +13127,7 @@ const campaignSchema = z.object({
13112
13127
  enabled: z.boolean(),
13113
13128
  windowAnchorAt: z.number().nullable(),
13114
13129
  }),
13130
+ workTime: workTimeSchema,
13115
13131
  });
13116
13132
  const upworkAccountConnectStatusSchema = z.union([
13117
13133
  z.literal('processing'),
@@ -13395,6 +13411,7 @@ const nodeEnums = z.enum([
13395
13411
  'clientSizeNode',
13396
13412
  'boostNode',
13397
13413
  'clientSpentNode',
13414
+ 'clientRatingNode',
13398
13415
  ]);
13399
13416
 
13400
13417
  const sizeOverlap = (size1, size2) => {
@@ -13418,7 +13435,7 @@ const createClientSizeFormSchema = (existingSizes) => z
13418
13435
  const addFromClientSizeNodeFormSchema = createClientSizeFormSchema([]);
13419
13436
 
13420
13437
  const INFINITY = 99999999999;
13421
- const rangesOverlap$3 = (range1, range2) => {
13438
+ const rangesOverlap$4 = (range1, range2) => {
13422
13439
  return range1.from < range2.to && range2.from < range1.to;
13423
13440
  };
13424
13441
  const createClientSpentFormSchema = (existingRanges) => z
@@ -13437,14 +13454,14 @@ const createClientSpentFormSchema = (existingRanges) => z
13437
13454
  })
13438
13455
  .refine((data) => {
13439
13456
  const newRange = { from: data.from, to: data.to };
13440
- return !existingRanges.some((existingRange) => rangesOverlap$3(newRange, existingRange));
13457
+ return !existingRanges.some((existingRange) => rangesOverlap$4(newRange, existingRange));
13441
13458
  }, {
13442
13459
  message: 'Range overlaps with existing range',
13443
13460
  path: ['from'],
13444
13461
  });
13445
13462
  const addFromClientSpentNodeFormSchema = createClientSpentFormSchema([]);
13446
13463
 
13447
- const rangesOverlap$2 = (range1, range2) => {
13464
+ const rangesOverlap$3 = (range1, range2) => {
13448
13465
  return range1.from < range2.to && range2.from < range1.to;
13449
13466
  };
13450
13467
  const createClientHireRateFormSchema = (existingRanges) => z
@@ -13463,14 +13480,14 @@ const createClientHireRateFormSchema = (existingRanges) => z
13463
13480
  })
13464
13481
  .refine((data) => {
13465
13482
  const newRange = { from: data.from, to: data.to };
13466
- return !existingRanges.some((existingRange) => rangesOverlap$2(newRange, existingRange));
13483
+ return !existingRanges.some((existingRange) => rangesOverlap$3(newRange, existingRange));
13467
13484
  }, {
13468
13485
  message: 'Range overlaps with existing range',
13469
13486
  path: ['from'],
13470
13487
  });
13471
13488
  const addFromClientHireRateNodeFormSchema = createClientHireRateFormSchema([]);
13472
13489
 
13473
- const rangesOverlap$1 = (range1, range2) => {
13490
+ const rangesOverlap$2 = (range1, range2) => {
13474
13491
  return range1.from < range2.to && range2.from < range1.to;
13475
13492
  };
13476
13493
  const createHourlyRateFormSchema = (existingRanges) => z
@@ -13489,7 +13506,7 @@ const createHourlyRateFormSchema = (existingRanges) => z
13489
13506
  })
13490
13507
  .refine((data) => {
13491
13508
  const newRange = { from: data.from, to: data.to };
13492
- return !existingRanges.some((existingRange) => rangesOverlap$1(newRange, existingRange));
13509
+ return !existingRanges.some((existingRange) => rangesOverlap$2(newRange, existingRange));
13493
13510
  }, {
13494
13511
  message: 'Range overlaps with existing range',
13495
13512
  path: ['from'],
@@ -13497,6 +13514,32 @@ const createHourlyRateFormSchema = (existingRanges) => z
13497
13514
  // Keep the original schema for backwards compatibility if needed
13498
13515
  const addFromHourlyRateNodeFormSchema = createHourlyRateFormSchema([]);
13499
13516
 
13517
+ const rangesOverlap$1 = (range1, range2) => {
13518
+ return range1.from < range2.to && range2.from < range1.to;
13519
+ };
13520
+ const createClientRatingFormSchema = (existingRanges) => z
13521
+ .object({
13522
+ from: z.number().min(0).max(5),
13523
+ to: z.number().min(0).max(5),
13524
+ action: nodeEnums,
13525
+ })
13526
+ .refine((data) => data.from < data.to, {
13527
+ message: 'From must be less than To',
13528
+ path: ['from'],
13529
+ })
13530
+ .refine((data) => data.to > data.from, {
13531
+ message: 'To must be greater than From',
13532
+ path: ['to'],
13533
+ })
13534
+ .refine((data) => {
13535
+ const newRange = { from: data.from, to: data.to };
13536
+ return !existingRanges.some((existingRange) => rangesOverlap$1(newRange, existingRange));
13537
+ }, {
13538
+ message: 'Range overlaps with existing range',
13539
+ path: ['from'],
13540
+ });
13541
+ const addFromClientRatingNodeFormSchema = createClientRatingFormSchema([]);
13542
+
13500
13543
  const rangesOverlap = (range1, range2) => {
13501
13544
  return range1.from < range2.to && range2.from < range1.to;
13502
13545
  };
@@ -23209,32 +23252,43 @@ const convertToUtc = (sleepTimezone, sleepStartAtHour, sleepEndAtHour) => {
23209
23252
  if (endHour <= startHour) {
23210
23253
  localEndDt = localEndDt.plus({ days: 1 });
23211
23254
  }
23255
+ if (!localStartDt.isValid || !localEndDt.isValid) {
23256
+ throw new Error('Invalid timezone conversion');
23257
+ }
23212
23258
  return {
23213
- sleepStartAt: localStartDt.toUTC().toISO(),
23214
- sleepEndAt: localEndDt.toUTC().toISO(),
23259
+ from: localStartDt.toUTC().toISO(),
23260
+ to: localEndDt.toUTC().toISO(),
23215
23261
  };
23216
23262
  };
23217
- const isSleepTime = (sleepTimezone, sleepStartAtHour, sleepEndAtHour) => {
23218
- const { sleepStartAt, sleepEndAt } = convertToUtc(sleepTimezone, sleepStartAtHour, sleepEndAtHour);
23219
- const now = DateTime.now().toUTC();
23220
- if (!sleepStartAt || !sleepEndAt) {
23263
+ const isWorkTime = (workTimezone, workTimeBlocks, workDays) => {
23264
+ const nowInWorkTz = DateTime.now().setZone(workTimezone);
23265
+ const getDayName = (weekday) => {
23266
+ const days = [
23267
+ 'monday',
23268
+ 'tuesday',
23269
+ 'wednesday',
23270
+ 'thursday',
23271
+ 'friday',
23272
+ 'saturday',
23273
+ 'sunday',
23274
+ ];
23275
+ return days[weekday - 1];
23276
+ };
23277
+ const currentDay = getDayName(nowInWorkTz.weekday);
23278
+ if (!workDays.includes(currentDay)) {
23221
23279
  return false;
23222
23280
  }
23223
- const startHour = Number(sleepStartAtHour);
23224
- const endHour = Number(sleepEndAtHour);
23225
- const sleepStart = DateTime.fromISO(sleepStartAt);
23226
- const sleepEnd = DateTime.fromISO(sleepEndAt);
23227
- if (endHour <= startHour) {
23228
- // Cross-midnight period: sleep from late evening to early morning
23229
- // We're in sleep time if:
23230
- // 1. Current time >= start time, OR
23231
- // 2. Current time <= end time AND we're on the same day as the end time
23232
- return (now >= sleepStart || (now <= sleepEnd && now.hasSame(sleepEnd, 'day')));
23233
- }
23234
- else {
23235
- // Same-day period: sleep from morning to evening
23236
- return now >= sleepStart && now <= sleepEnd;
23237
- }
23281
+ const currentHour = nowInWorkTz.hour;
23282
+ return workTimeBlocks.some((block) => {
23283
+ if (block.toHour <= block.fromHour) {
23284
+ // Cross-midnight period (e.g., 22:00 to 06:00)
23285
+ return currentHour >= block.fromHour || currentHour < block.toHour;
23286
+ }
23287
+ else {
23288
+ // Same-day period (e.g., 09:00 to 18:00)
23289
+ return currentHour >= block.fromHour && currentHour < block.toHour;
23290
+ }
23291
+ });
23238
23292
  };
23239
23293
 
23240
23294
  // Main wrapper function
@@ -23307,6 +23361,7 @@ exports.accountStatusDisplayMap = accountStatusDisplayMap;
23307
23361
  exports.accountStatusOrder = accountStatusOrder;
23308
23362
  exports.accountStatusSchema = accountStatusSchema;
23309
23363
  exports.addFromClientHireRateNodeFormSchema = addFromClientHireRateNodeFormSchema;
23364
+ exports.addFromClientRatingNodeFormSchema = addFromClientRatingNodeFormSchema;
23310
23365
  exports.addFromClientSizeNodeFormSchema = addFromClientSizeNodeFormSchema;
23311
23366
  exports.addFromClientSpentNodeFormSchema = addFromClientSpentNodeFormSchema;
23312
23367
  exports.addFromHourlyRateNodeFormSchema = addFromHourlyRateNodeFormSchema;
@@ -23378,6 +23433,7 @@ exports.createBidderAccountSchema = createBidderAccountSchema;
23378
23433
  exports.createCampaignSchema = createCampaignSchema;
23379
23434
  exports.createChatbotSchema = createChatbotSchema;
23380
23435
  exports.createClientHireRateFormSchema = createClientHireRateFormSchema;
23436
+ exports.createClientRatingFormSchema = createClientRatingFormSchema;
23381
23437
  exports.createClientSizeFormSchema = createClientSizeFormSchema;
23382
23438
  exports.createClientSpentFormSchema = createClientSpentFormSchema;
23383
23439
  exports.createCoverLetterTemplateSchema = createCoverLetterTemplateSchema;
@@ -23450,7 +23506,7 @@ exports.invoiceStripeMetadataSchema = invoiceStripeMetadataSchema;
23450
23506
  exports.isNumeric = isNumeric;
23451
23507
  exports.isPaymentVerifiedEnum = isPaymentVerifiedEnum;
23452
23508
  exports.isPhoneVerifiedEnum = isPhoneVerifiedEnum;
23453
- exports.isSleepTime = isSleepTime;
23509
+ exports.isWorkTime = isWorkTime;
23454
23510
  exports.jobActivityDeltaSchema = jobActivityDeltaSchema;
23455
23511
  exports.jobActivityOffsetEnum = jobActivityOffsetEnum;
23456
23512
  exports.jobActivityOffsetHourSchema = jobActivityOffsetHourSchema;
@@ -23583,6 +23639,7 @@ exports.syncProposalsStatusRequestPayloadSchema = syncProposalsStatusRequestPayl
23583
23639
  exports.systemPromptSchema = systemPromptSchema;
23584
23640
  exports.systemSchema = systemSchema;
23585
23641
  exports.talentTypeEnum = talentTypeEnum;
23642
+ exports.timeBlockSchema = timeBlockSchema;
23586
23643
  exports.trackUsageEventTypeEnum = trackUsageEventTypeEnum;
23587
23644
  exports.trackUsagePayloadSchema = trackUsagePayloadSchema;
23588
23645
  exports.transactionSchema = transactionSchema;
@@ -23617,4 +23674,6 @@ exports.vendorTypeEnum = vendorTypeEnum;
23617
23674
  exports.verifyBidderAccountCredentialsResponseSchema = verifyBidderAccountCredentialsResponseSchema;
23618
23675
  exports.verifyBidderAccountCredentialsSchema = verifyBidderAccountCredentialsSchema;
23619
23676
  exports.waitForFunctionTimeoutError = waitForFunctionTimeoutError;
23677
+ exports.weekDaysEnum = weekDaysEnum;
23678
+ exports.workTimeSchema = workTimeSchema;
23620
23679
  //# sourceMappingURL=bundle.cjs.js.map