@timeax/digital-service-engine 0.2.8 → 0.2.9

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.
@@ -4313,6 +4313,10 @@ function filterServicesForVisibleGroup(input, deps) {
4313
4313
  (_h = (_g = context.ratePolicy) != null ? _g : explicitFallbackSettings == null ? void 0 : explicitFallbackSettings.ratePolicy) != null ? _h : builderOptions == null ? void 0 : builderOptions.ratePolicy
4314
4314
  );
4315
4315
  const policySource = (_j = (_i = context.policies) != null ? _i : builderOptions == null ? void 0 : builderOptions.policies) != null ? _j : [];
4316
+ const resolvedCustomPrimaryRate = resolveCustomPrimaryRate(
4317
+ context.rateContext,
4318
+ svcMap
4319
+ );
4316
4320
  const visibleServiceIds = context.selectedButtons === void 0 ? void 0 : collectVisibleServiceIds(
4317
4321
  deps.builder,
4318
4322
  context.tagId,
@@ -4339,7 +4343,11 @@ function filterServicesForVisibleGroup(input, deps) {
4339
4343
  cap.id,
4340
4344
  (_k = context.effectiveConstraints) != null ? _k : {}
4341
4345
  );
4342
- const passesRate2 = candidatePassesRateCoherence(
4346
+ const passesRate2 = resolvedCustomPrimaryRate != null ? passesRatePolicy(
4347
+ resolvedRatePolicy,
4348
+ resolvedCustomPrimaryRate,
4349
+ toFiniteNumber(cap.rate)
4350
+ ) : candidatePassesRateCoherence(
4343
4351
  deps.builder,
4344
4352
  svcMap,
4345
4353
  context.tagId,
@@ -4379,6 +4387,17 @@ function filterServicesForVisibleGroup(input, deps) {
4379
4387
  diagnostics: lastDiagnostics && lastDiagnostics.length ? lastDiagnostics : void 0
4380
4388
  };
4381
4389
  }
4390
+ function resolveCustomPrimaryRate(rateContext, serviceMap) {
4391
+ if (!rateContext || rateContext.mode !== "custom_primary_rate") {
4392
+ return void 0;
4393
+ }
4394
+ if (rateContext.source === "manual") {
4395
+ return toFiniteNumber(rateContext.primaryRate);
4396
+ }
4397
+ if (rateContext.primaryServiceId == null) return void 0;
4398
+ const cap = getServiceCapability(serviceMap, rateContext.primaryServiceId);
4399
+ return toFiniteNumber(cap == null ? void 0 : cap.rate);
4400
+ }
4382
4401
  function evaluatePoliciesRaw(raw, serviceIds, svcMap, tagId, visibleServiceIds) {
4383
4402
  const compiled = compilePolicies(raw);
4384
4403
  const evaluated = evaluateServicePolicies(