@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.
@@ -4679,6 +4679,10 @@ function filterServicesForVisibleGroup(input, deps) {
4679
4679
  (_h = (_g = context.ratePolicy) != null ? _g : explicitFallbackSettings == null ? void 0 : explicitFallbackSettings.ratePolicy) != null ? _h : builderOptions == null ? void 0 : builderOptions.ratePolicy
4680
4680
  );
4681
4681
  const policySource = (_j = (_i = context.policies) != null ? _i : builderOptions == null ? void 0 : builderOptions.policies) != null ? _j : [];
4682
+ const resolvedCustomPrimaryRate = resolveCustomPrimaryRate(
4683
+ context.rateContext,
4684
+ svcMap
4685
+ );
4682
4686
  const visibleServiceIds = context.selectedButtons === void 0 ? void 0 : collectVisibleServiceIds(
4683
4687
  deps.builder,
4684
4688
  context.tagId,
@@ -4705,7 +4709,11 @@ function filterServicesForVisibleGroup(input, deps) {
4705
4709
  cap.id,
4706
4710
  (_k = context.effectiveConstraints) != null ? _k : {}
4707
4711
  );
4708
- const passesRate2 = candidatePassesRateCoherence(
4712
+ const passesRate2 = resolvedCustomPrimaryRate != null ? passesRatePolicy(
4713
+ resolvedRatePolicy,
4714
+ resolvedCustomPrimaryRate,
4715
+ toFiniteNumber(cap.rate)
4716
+ ) : candidatePassesRateCoherence(
4709
4717
  deps.builder,
4710
4718
  svcMap,
4711
4719
  context.tagId,
@@ -4745,6 +4753,17 @@ function filterServicesForVisibleGroup(input, deps) {
4745
4753
  diagnostics: lastDiagnostics && lastDiagnostics.length ? lastDiagnostics : void 0
4746
4754
  };
4747
4755
  }
4756
+ function resolveCustomPrimaryRate(rateContext, serviceMap) {
4757
+ if (!rateContext || rateContext.mode !== "custom_primary_rate") {
4758
+ return void 0;
4759
+ }
4760
+ if (rateContext.source === "manual") {
4761
+ return toFiniteNumber(rateContext.primaryRate);
4762
+ }
4763
+ if (rateContext.primaryServiceId == null) return void 0;
4764
+ const cap = getServiceCapability(serviceMap, rateContext.primaryServiceId);
4765
+ return toFiniteNumber(cap == null ? void 0 : cap.rate);
4766
+ }
4748
4767
  function evaluatePoliciesRaw(raw, serviceIds, svcMap, tagId, visibleServiceIds) {
4749
4768
  const compiled = compilePolicies(raw);
4750
4769
  const evaluated = evaluateServicePolicies(
@@ -7736,7 +7755,8 @@ function filterServicesForVisibleGroup2(ctx, candidates, input) {
7736
7755
  policies: input.policies,
7737
7756
  ratePolicy: input.ratePolicy,
7738
7757
  fallbackSettings: input.fallbackSettings,
7739
- fallback: input.fallback
7758
+ fallback: input.fallback,
7759
+ rateContext: input.rateContext
7740
7760
  }
7741
7761
  };
7742
7762
  const result = filterServicesForVisibleGroup(coreInput, {