@sonordev/contracts 2.26.0 → 2.28.0

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.
@@ -56,6 +56,9 @@ function createWireSchema(fail3, isValidationError) {
56
56
  }
57
57
 
58
58
  // src/contracts/sites-normalize.ts
59
+ function stripWww(host) {
60
+ return host.startsWith("www.") ? host.slice(4) : host;
61
+ }
59
62
  function normalizeSiteHost(site2) {
60
63
  if (!site2 || typeof site2 !== "string") return null;
61
64
  let s = site2.trim().toLowerCase();
@@ -70,9 +73,6 @@ function normalizeSiteHost(site2) {
70
73
  }
71
74
 
72
75
  // src/contracts/sites.ts
73
- function stripWww(host) {
74
- return host.startsWith("www.") ? host.slice(4) : host;
75
- }
76
76
  function sameSite(a, b) {
77
77
  if (!a || !b) return false;
78
78
  return stripWww(a) === stripWww(b);
@@ -366,13 +366,16 @@ var resolvedQualificationRule = refine2(object2({
366
366
  ref: resource,
367
367
  crmVariant: text2(128),
368
368
  ladderSnapshot: list2(object2({ id: nullable2(uuid), stage_key: revision, semantic_key: nullable2(revision), is_won: bool, is_lost: bool }), 500, 1),
369
+ // eligibleBookingTypeIds: Sync booking types whose confirmed bookings also count, beside the one form. Absent means forms only.
369
370
  eligibleFormIds: list2(uuid, 500, 1),
371
+ eligibleBookingTypeIds: optional2(list2(uuid, 100, 1)),
370
372
  attribution: object2({ model: literal2(RESONANCE_ATTRIBUTION_MODEL), resolverRevision: literal2(1) }),
371
373
  cohort: object2({ startAt: instant, endAt: instant, maturityDelaySeconds: integer2(0, 31536e3) })
372
374
  }), (v, p) => {
373
375
  checkQualificationPartitions(v, p);
374
376
  if (v.ref.module !== "crm" || v.ref.id !== v.ref.projectId) fail2(p + ".ref", "must reference the actual CRM project configuration");
375
377
  unique(v.eligibleFormIds, p + ".eligibleFormIds");
378
+ if (v.eligibleBookingTypeIds) unique(v.eligibleBookingTypeIds.map((x) => x.toLowerCase()), p + ".eligibleBookingTypeIds");
376
379
  unique(v.ladderSnapshot.flatMap((x) => x.id ? [x.id] : []), p + ".ladderSnapshot.id");
377
380
  unique(v.ladderSnapshot.map((x) => x.stage_key), p + ".ladderSnapshot.stage_key");
378
381
  const partitions = [...v.positiveStageKeys, ...v.finalNegativeStageKeys, ...v.pendingStageKeys], keys = new Set(v.ladderSnapshot.map((x) => x.stage_key));
@@ -381,7 +384,21 @@ var resolvedQualificationRule = refine2(object2({
381
384
  });
382
385
  var parseResonanceResolvedQualificationRule = (v) => resolvedQualificationRule.read(v, "resolvedQualificationRule");
383
386
  var RESONANCE_RESOLVED_QUALIFICATION_RULE_JSON_SCHEMA = resolvedQualificationRule.schema;
384
- var objective = refine2(object2({ source, measurementRevision: revision, countingUnit: objectiveCountingUnit, attributionWindowDays: integer2(1, 365), maturityDelaySeconds: integer2(0, 31536e3), qualificationRuleRef: nullable2(resource), qualificationRule: optional2(qualificationRule) }), (v, p) => {
387
+ var objective = refine2(object2({
388
+ source,
389
+ measurementRevision: revision,
390
+ countingUnit: objectiveCountingUnit,
391
+ attributionWindowDays: integer2(1, 365),
392
+ maturityDelaySeconds: integer2(0, 31536e3),
393
+ qualificationRuleRef: nullable2(resource),
394
+ qualificationRule: optional2(qualificationRule),
395
+ // Booking types a person reviewed as counting toward the qualified-lead goal, beside its one form. Absent keeps the goal forms-only and the serialization unchanged.
396
+ eligibleBookingTypeIds: optional2(list2(uuid, 100, 1))
397
+ }), (v, p) => {
398
+ if (v.eligibleBookingTypeIds) {
399
+ if (v.source.kind !== "qualified_lead") fail2(p + ".eligibleBookingTypeIds", "requires the native qualified-lead source");
400
+ unique(v.eligibleBookingTypeIds.map((x) => x.toLowerCase()), p + ".eligibleBookingTypeIds");
401
+ }
385
402
  if (v.qualificationRule && v.source.kind !== "qualified_lead") fail2(p + ".qualificationRule", "requires the native qualified-lead source");
386
403
  if (v.qualificationRule && v.qualificationRuleRef && (v.qualificationRuleRef.module !== "crm" || v.qualificationRuleRef.id !== v.source.projectId)) fail2(p + ".qualificationRuleRef", "must reference actual CRM project configuration");
387
404
  });
@@ -622,7 +639,7 @@ function checkReportingQuerySubset(v, p) {
622
639
  if (v.metaQueries?.some((query) => !v.channelIds.some((id) => id.toLowerCase() === query.channelId.toLowerCase()))) fail2(p + ".metaQueries", "query channel must be selected");
623
640
  }
624
641
  var providerReportingSelection = refine2(object2({ agentContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries) }), checkReportingQuerySubset);
625
- var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries) }), (v, p) => {
642
+ var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries), reportingUntil: optional2(instant) }), (v, p) => {
626
643
  if (v.agentContactId.toLowerCase() === v.principalContactId.toLowerCase()) fail2(p + ".principalContactId", "agent and human principal must remain distinct");
627
644
  checkReportingQuerySubset(v, p);
628
645
  });
@@ -630,7 +647,94 @@ var parseResonanceProviderReportingSelection = (v) => providerReportingSelection
630
647
  var parseResonanceProviderReportingGrant = (v) => providerReportingGrant.read(v, "providerReportingGrant");
631
648
  var RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA = providerReportingSelection.schema;
632
649
  var RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA = providerReportingGrant.schema;
633
- var mandateScope = object2({ projectId: uuid, campaignId: uuid, preparedPlanId: uuid, reviewDigest: digest, accountBindingIds: list2(uuid, 100), sites: list2(site, 50, 1), budget, creativeRefs: list2(creative, 100, 1), audienceRuleRefs: list2(audience, 100), goal: objective, allowedOperations: mandateAllowedOperations, allowedTransformationRef: nullable2(resource), expiresAt: instant, websiteVisitFeed: optional2(websiteVisitFeed), providerReporting: optional2(providerReportingGrant) });
650
+ var RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS = 92;
651
+ var googleContentTarget = { channelId: uuid, adGroupLocalKey: text2(80), adLocalKey: text2(80) };
652
+ var normalizeResonanceGoogleCriterionText = (value) => value.trim().replace(/\s+/gu, " ").toLowerCase().normalize("NFC");
653
+ var googleCriterionText = text2(80, /^(?! +$)[^\x00-\x1f\x7f]+$/);
654
+ var googleExactText = text2(80, /^(?! +$)[^\x00-\x1f\x7f\\\[\]"]+$/);
655
+ var googleContentKeywords = (criterion) => refine2(list2(criterion, 20), (items, p) => {
656
+ const normalized = items.map(normalizeResonanceGoogleCriterionText);
657
+ if (normalized.some((value) => !value || value.length > 80)) fail2(p, "requires nonempty bounded criterion text");
658
+ unique(normalized, p);
659
+ items.splice(0, items.length, ...normalized.sort());
660
+ });
661
+ var rsaAsset = (length) => refine2(text2(length, /^[^\x00-\x1f\x7f]+$/), (asset, p) => {
662
+ if (!asset.trim() || asset.trim() !== asset) fail2(p, "requires trimmed, nonempty asset text");
663
+ });
664
+ var googleContentRsa = object2({
665
+ creativeRef: resource,
666
+ headlines: uniqueList(rsaAsset(30), 15, 3),
667
+ descriptions: uniqueList(rsaAsset(90), 4, 2)
668
+ });
669
+ var googleContentMaterial = {
670
+ negativeRemovals: googleContentKeywords(googleCriterionText),
671
+ exactAdditions: googleContentKeywords(googleExactText),
672
+ rsa: nullable2(googleContentRsa)
673
+ };
674
+ var googleContentEntry = refine2(object2({ ...googleContentTarget, ...googleContentMaterial }), (entry, p) => {
675
+ if (!entry.negativeRemovals.length && !entry.exactAdditions.length && !entry.rsa) fail2(p, "must select at least one bounded content effect");
676
+ });
677
+ var googleSearchContent = refine2(list2(googleContentEntry, 100), (entries, p) => {
678
+ const identity = (entry) => JSON.stringify([entry.channelId.toLowerCase(), entry.adGroupLocalKey, entry.adLocalKey]);
679
+ unique(entries.map(identity), p);
680
+ entries.sort((a, b) => identity(a) < identity(b) ? -1 : identity(a) > identity(b) ? 1 : 0);
681
+ });
682
+ var operatingPolicyFields = {
683
+ schemaVersion: literal2(1),
684
+ agentContactId: uuid,
685
+ googleSearchContent,
686
+ cooldownSeconds: integer2(3600, 2592e3)
687
+ };
688
+ var operatingPolicySelection = object2(operatingPolicyFields);
689
+ var operatingPolicy = refine2(object2({ ...operatingPolicyFields, principalContactId: uuid }), (policy, p) => {
690
+ if (policy.agentContactId.toLowerCase() === policy.principalContactId.toLowerCase()) {
691
+ fail2(p + ".principalContactId", "agent and human principal must remain distinct");
692
+ }
693
+ });
694
+ var operatingPolicyRef = object2({ ledgerActionId: uuid, receiptId: uuid, digest });
695
+ var operatingPolicyBase = object2({
696
+ ledgerActionId: uuid,
697
+ acceptanceReceiptId: uuid,
698
+ expectedKillRevision: integer2(0),
699
+ previousOperatingPolicyRef: nullable2(operatingPolicyRef)
700
+ });
701
+ var operatingPolicyActionIdentity = object2({ mandateDigest: digest, operatingPolicyBase });
702
+ var googleContentUpdateSelection = object2(googleContentTarget);
703
+ var googleContentUpdate = refine2(object2({ ...googleContentTarget, ...googleContentMaterial, policyRef: operatingPolicyRef, beforeDigest: digest }), (update2, p) => {
704
+ if (!update2.negativeRemovals.length && !update2.exactAdditions.length && !update2.rsa) fail2(p, "must select at least one bounded content effect");
705
+ });
706
+ var parseResonanceOperatingPolicy = (v) => operatingPolicy.read(v, "operatingPolicy");
707
+ var parseResonanceOperatingPolicySelection = (v) => operatingPolicySelection.read(v, "operatingPolicySelection");
708
+ var parseResonanceOperatingPolicyBase = (v) => operatingPolicyBase.read(v, "operatingPolicyBase");
709
+ var parseResonanceOperatingPolicyRef = (v) => operatingPolicyRef.read(v, "operatingPolicyRef");
710
+ var parseResonanceGoogleContentUpdateSelection = (v) => googleContentUpdateSelection.read(v, "googleContentUpdateSelection");
711
+ var parseResonanceGoogleContentUpdate = (v) => googleContentUpdate.read(v, "googleContentUpdate");
712
+ var resonanceOperatingPolicyDigestInput = (v) => canonical(parseResonanceOperatingPolicy(v));
713
+ function resonanceOperatingPolicyActionDigestInput(v) {
714
+ const { mandateDigest, operatingPolicyBase: base } = operatingPolicyActionIdentity.read(v, "operatingPolicyActionIdentity");
715
+ const previous = base.previousOperatingPolicyRef;
716
+ return canonical({
717
+ kind: "resonance_operating_policy_activation_v1",
718
+ mandateDigest,
719
+ operatingPolicyBase: {
720
+ ...base,
721
+ ledgerActionId: base.ledgerActionId.toLowerCase(),
722
+ acceptanceReceiptId: base.acceptanceReceiptId.toLowerCase(),
723
+ previousOperatingPolicyRef: previous && {
724
+ ...previous,
725
+ ledgerActionId: previous.ledgerActionId.toLowerCase(),
726
+ receiptId: previous.receiptId.toLowerCase()
727
+ }
728
+ }
729
+ });
730
+ }
731
+ var RESONANCE_OPERATING_POLICY_JSON_SCHEMA = operatingPolicy.schema;
732
+ var RESONANCE_OPERATING_POLICY_SELECTION_JSON_SCHEMA = operatingPolicySelection.schema;
733
+ var RESONANCE_OPERATING_POLICY_BASE_JSON_SCHEMA = operatingPolicyBase.schema;
734
+ var RESONANCE_OPERATING_POLICY_REF_JSON_SCHEMA = operatingPolicyRef.schema;
735
+ var RESONANCE_GOOGLE_CONTENT_UPDATE_SELECTION_JSON_SCHEMA = googleContentUpdateSelection.schema;
736
+ var RESONANCE_GOOGLE_CONTENT_UPDATE_JSON_SCHEMA = googleContentUpdate.schema;
737
+ var mandateScope = object2({ projectId: uuid, campaignId: uuid, preparedPlanId: uuid, reviewDigest: digest, accountBindingIds: list2(uuid, 100), sites: list2(site, 50, 1), budget, creativeRefs: list2(creative, 100, 1), audienceRuleRefs: list2(audience, 100), goal: objective, allowedOperations: mandateAllowedOperations, allowedTransformationRef: nullable2(resource), expiresAt: instant, websiteVisitFeed: optional2(websiteVisitFeed), providerReporting: optional2(providerReportingGrant), operatingPolicy: optional2(operatingPolicy) });
634
738
  function parseResonanceMandateScope(v, preparedPlan) {
635
739
  const r = mandateScope.read(v, "mandateScope");
636
740
  scoped(r, r.projectId, r.sites, "mandateScope");
@@ -638,10 +742,36 @@ function parseResonanceMandateScope(v, preparedPlan) {
638
742
  unique(r.websiteVisitFeed.channels.map((c) => c.channelId), "mandateScope.websiteVisitFeed.channels");
639
743
  for (const c of r.websiteVisitFeed.channels) unique(c.resourceRuleRefs.map((rule) => rule.id), "mandateScope.websiteVisitFeed.resourceRuleRefs");
640
744
  }
745
+ if (r.operatingPolicy) {
746
+ const p = "mandateScope.operatingPolicy";
747
+ if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > Date.parse(r.budget.endAt)) {
748
+ fail2(p, "operating policy remains inside the original mandate flight and expiry");
749
+ }
750
+ if (r.operatingPolicy.googleSearchContent.length && !r.allowedOperations.includes("update")) {
751
+ fail2(p, "Google content requires the update operation");
752
+ }
753
+ if (preparedPlan !== void 0) {
754
+ const plan = parseResonancePreparedPlan(preparedPlan);
755
+ if (r.projectId !== plan.projectId || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || canonical(r.goal) !== canonical(plan.definition.objective) || canonical(r.budget) !== canonical(plan.definition.budget)) fail2(p, "requires the exact original plan, review, goal and flight");
756
+ for (const entry of r.operatingPolicy.googleSearchContent) {
757
+ const channel2 = plan.definition.channels.find((item) => item.id.toLowerCase() === entry.channelId.toLowerCase());
758
+ if (channel2?.kind !== "google_search") return fail2(p, "requires an original Google Search channel");
759
+ const group = channel2.adGroups.find((item) => item.localKey === entry.adGroupLocalKey);
760
+ if (!r.sites.includes(channel2.site) || !r.accountBindingIds.includes(channel2.accountBindingId) || !group?.ads.some((ad) => ad.localKey === entry.adLocalKey) || entry.rsa && entry.rsa.creativeRef.site !== channel2.site) fail2(p, "requires the original account, site, ad group and ad");
761
+ }
762
+ }
763
+ }
641
764
  if (r.providerReporting) {
642
765
  const grant = r.providerReporting, p = "mandateScope.providerReporting";
643
766
  if (grant.projectId !== r.projectId) fail2(p + ".projectId", "must match the original mandate project");
644
- if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > Date.parse(r.budget.endAt)) fail2(p, "reporting remains inside the original mandate flight and expiry");
767
+ const flightEnd = Date.parse(r.budget.endAt);
768
+ if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > flightEnd) fail2(p, "mandate expiry remains inside the original flight");
769
+ if (grant.reportingUntil !== void 0) {
770
+ const deadline = Date.parse(grant.reportingUntil);
771
+ if (deadline <= flightEnd || deadline > flightEnd + RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS * 864e5) {
772
+ fail2(p + ".reportingUntil", "must follow the original flight by no more than 92 elapsed days");
773
+ }
774
+ }
645
775
  if (preparedPlan !== void 0) {
646
776
  const plan = parseResonancePreparedPlan(preparedPlan);
647
777
  if (r.projectId !== plan.projectId || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || canonical(r.goal) !== canonical(plan.definition.objective) || canonical(r.budget) !== canonical(plan.definition.budget)) fail2(p, "requires the exact original plan, review, goal and flight");
@@ -816,6 +946,10 @@ var RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA = googleConfigurati
816
946
  var preparedManifestRef = object2({ id: uuid, digest, providerVersion: text2(30), revision });
817
947
  var preview = object2({ channelId: uuid, site, accountBindingId: nullable2(uuid), accountName: text2(200), accountTimeZone: timeZone, destinationUrl: text2(4096), attributionMarker: optional2(object2({ parameter: literal2(RESONANCE_SOURCE_MARKER_PARAMETER), value: sourceMarker })), orderedCreatives: list2(creative, 50, 1), audienceRuleRefs: list2(audience, 100), allocation: nullable2(money), capabilityRevision: revision, snapshotDigest: digest, manifestRef: preparedManifestRef, conversionRevision: revision, policyRevision: revision, googleConfiguration: nullable2(googleConfigurationReview) });
818
948
  var prepared = object2({ schemaVersion: literal2(1), id: uuid, campaignId: uuid, projectId: uuid, expectedRevision: integer2(1), definitionDigest: digest, reviewDigest: digest, definition, resolvedEvidencePolicy: optimizationPolicy, resolvedQualificationRule: nullable2(resolvedQualificationRule), accounts: list2(capability, 100), channelPreviews: list2(preview, 100, 1), preparedAt: instant, expiresAt: instant, blockingReasons: list2(text2(200), 100) });
949
+ function bookingTypesMatch(goalIds, witnessIds) {
950
+ const norm = (ids) => ids === void 0 ? null : [...ids].map((id) => id.toLowerCase()).sort();
951
+ return canonical(norm(goalIds)) === canonical(norm(witnessIds));
952
+ }
819
953
  function parseResonancePreparedPlan(v) {
820
954
  const r = prepared.read(v, "preparedPlan");
821
955
  checkDefinition(r.definition);
@@ -825,7 +959,7 @@ function parseResonancePreparedPlan(v) {
825
959
  if (goal.source.kind === "qualified_lead") {
826
960
  if (!goal.qualificationRule || !goal.qualificationRuleRef || !witness) fail2("preparedPlan.resolvedQualificationRule", "qualified-lead preparation requires actual configured native witness");
827
961
  const w = witness, selected = goal.qualificationRule;
828
- if (goal.countingUnit !== "unique_qualified_contact" || canonical(w.ref) !== canonical(goal.qualificationRuleRef) || w.eligibleFormIds.length !== 1 || w.eligibleFormIds[0] !== goal.source.id || w.cohort.maturityDelaySeconds !== goal.maturityDelaySeconds) fail2("preparedPlan.resolvedQualificationRule", "source, counting unit, reference or maturity mismatch");
962
+ if (goal.countingUnit !== "unique_qualified_contact" || canonical(w.ref) !== canonical(goal.qualificationRuleRef) || w.eligibleFormIds.length !== 1 || w.eligibleFormIds[0] !== goal.source.id || !bookingTypesMatch(goal.eligibleBookingTypeIds, w.eligibleBookingTypeIds) || w.cohort.maturityDelaySeconds !== goal.maturityDelaySeconds) fail2("preparedPlan.resolvedQualificationRule", "source, counting unit, reference or maturity mismatch");
829
963
  for (const key of ["schemaVersion", "semantics", "positiveStageKeys", "finalNegativeStageKeys", "pendingStageKeys", "existingContactPolicy"]) if (canonical(w[key]) !== canonical(selected[key])) fail2("preparedPlan.resolvedQualificationRule", "selected qualification snapshot mismatch");
830
964
  } else if (witness !== null) fail2("preparedPlan.resolvedQualificationRule", "nonqualified objectives require explicit null");
831
965
  if (canonical(r.resolvedEvidencePolicy) !== canonical(r.definition.optimization.policy)) fail2("preparedPlan.resolvedEvidencePolicy", "policy snapshot mismatch");
@@ -863,15 +997,43 @@ function parseResonancePreparedPlan(v) {
863
997
  }
864
998
  var commandBase = { schemaVersion: literal2(1), campaignId: uuid, expectedRevision: integer2(1), idempotencyKey: operationKey, channelIds: list2(uuid, 100) };
865
999
  var effect = object2({ ...commandBase, operation: choice2("launch", "update", "resume"), preparedPlanId: uuid, reviewDigest: digest, mandateRef, expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 100) });
1000
+ var googleContentEffect = refine2(object2({
1001
+ ...commandBase,
1002
+ operation: literal2("update"),
1003
+ preparedPlanId: uuid,
1004
+ reviewDigest: digest,
1005
+ mandateRef,
1006
+ channelIds: list2(uuid, 1, 1),
1007
+ expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 1, 1),
1008
+ googleContentUpdate
1009
+ }), (command2, p) => {
1010
+ const update2 = command2.googleContentUpdate, remote = command2.expectedRemoteSnapshots[0];
1011
+ if (command2.channelIds[0] !== update2.channelId || remote.channelId !== update2.channelId || remote.digest !== update2.beforeDigest) {
1012
+ fail2(p + ".googleContentUpdate", "requires the same single channel and before snapshot");
1013
+ }
1014
+ });
866
1015
  var optimize = object2({ ...commandBase, operation: literal2("optimize"), preparedPlanId: uuid, reviewDigest: digest, mandateRef, decisionRef: object2({ id: uuid, revision, evidenceDigest: digest }), expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 100) });
867
1016
  var safety = object2({ ...commandBase, operation: choice2("pause", "finish", "reconcile") });
868
1017
  var deliverConversion = object2({ ...commandBase, operation: literal2("deliver_conversion"), channelIds: list2(uuid, 1, 1), preparedPlanId: uuid, reviewDigest: digest, mandateRef, conversionId: uuid });
869
1018
  var deliverWebsiteVisit = object2({ ...commandBase, operation: literal2("deliver_website_visit"), channelIds: list2(uuid, 1, 1), preparedPlanId: uuid, reviewDigest: digest, mandateRef, occurrenceId: uuid });
870
- var command = union2(effect, optimize, safety, deliverConversion, deliverWebsiteVisit);
1019
+ var command = union2(effect, googleContentEffect, optimize, safety, deliverConversion, deliverWebsiteVisit);
871
1020
  function parseResonanceCommand(v, context) {
872
1021
  const r = command.read(v, "command");
873
1022
  unique(r.channelIds, "command.channelIds");
874
1023
  if ("mandateRef" in r && (r.mandateRef.campaignId !== r.campaignId || r.mandateRef.preparedPlanId !== r.preparedPlanId || r.mandateRef.reviewDigest !== r.reviewDigest)) fail2("command.mandateRef", "snapshot mismatch");
1024
+ if ("googleContentUpdate" in r && context) {
1025
+ const p = "command.googleContentUpdate", update2 = r.googleContentUpdate;
1026
+ const plan = parseResonancePreparedPlan(context.preparedPlan);
1027
+ const grant = parseResonanceMandateScope(context.mandate, plan);
1028
+ const now = Date.parse(instant.read(context.now, "command.context.now"));
1029
+ if (r.expectedRevision !== plan.expectedRevision || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || grant.projectId !== plan.projectId || grant.campaignId !== plan.campaignId || grant.preparedPlanId !== plan.id || grant.reviewDigest !== plan.reviewDigest || !grant.allowedOperations.includes("update") || canonical(grant.goal) !== canonical(plan.definition.objective) || canonical(grant.budget) !== canonical(plan.definition.budget) || now < Date.parse(grant.budget.startAt) || now >= Date.parse(grant.budget.endAt) || now >= Date.parse(grant.expiresAt)) {
1030
+ fail2(p, "requires the current original Google mandate and flight");
1031
+ }
1032
+ const channel2 = plan.definition.channels.find((item) => item.id === update2.channelId);
1033
+ if (channel2?.kind !== "google_search" || !grant.sites.includes(channel2.site) || !grant.accountBindingIds.includes(channel2.accountBindingId) || !channel2.adGroups.some((group) => group.localKey === update2.adGroupLocalKey && group.ads.some((ad) => ad.localKey === update2.adLocalKey))) {
1034
+ fail2(p, "requires an original Google Search group and ad in scope");
1035
+ } else if (update2.rsa) scoped(update2.rsa, plan.projectId, [channel2.site], p + ".rsa");
1036
+ }
875
1037
  if ((r.operation === "deliver_conversion" || r.operation === "deliver_website_visit") && context) {
876
1038
  const plan = parseResonancePreparedPlan(context.preparedPlan), grant = parseResonanceMandateScope(context.mandate);
877
1039
  const now = Date.parse(instant.read(context.now, "command.context.now"));
@@ -884,7 +1046,7 @@ function parseResonanceCommand(v, context) {
884
1046
  if (!channel2 || channel2.kind !== "google_search") fail2("command.channelIds", "requires one original Google channel");
885
1047
  const c = channel2;
886
1048
  const goal = plan.definition.objective, witness = plan.resolvedQualificationRule;
887
- if (goal.source.kind !== "qualified_lead" || goal.countingUnit !== "unique_qualified_contact" || !witness || witness.eligibleFormIds.length !== 1 || witness.eligibleFormIds[0] !== goal.source.id || goal.source.site !== c.site) fail2("command.context.goal", "requires the original single managed-form qualified source");
1049
+ if (goal.source.kind !== "qualified_lead" || goal.countingUnit !== "unique_qualified_contact" || !witness || witness.eligibleFormIds.length !== 1 || witness.eligibleFormIds[0] !== goal.source.id || !bookingTypesMatch(goal.eligibleBookingTypeIds, witness.eligibleBookingTypeIds) || goal.source.site !== c.site) fail2("command.context.goal", "requires the original single managed-form qualified source");
888
1050
  const account = plan.accounts.find((a) => a.id === c.accountBindingId);
889
1051
  if (!account || account.provider !== "google_ads" || !grant.accountBindingIds.includes(c.accountBindingId) || !grant.sites.includes(c.site)) fail2("command.context.account", "requires the original granted Google account and site");
890
1052
  const configuration = plan.channelPreviews.find((p) => p.channelId === c.id)?.googleConfiguration;
@@ -966,13 +1128,16 @@ var RESONANCE_METRIC_JSON_SCHEMA = metric.schema;
966
1128
  var RESONANCE_CONSENT_JSON_SCHEMA = consent.schema;
967
1129
  var parseResonanceExperimentExposure = (v) => exposure.read(v, "exposure");
968
1130
  var mandateTarget = object2({ project_id: uuid, campaign_id: uuid });
969
- var mandateApproval = object2({ schemaVersion: literal2(1), expectedRevision: integer2(1), preparedPlanId: uuid, reviewDigest: digest, mandateDigest: digest, mandate: mandateScope });
1131
+ var mandateApproval = object2({ schemaVersion: literal2(1), expectedRevision: integer2(1), preparedPlanId: uuid, reviewDigest: digest, mandateDigest: digest, mandate: mandateScope, operatingPolicyBase: optional2(operatingPolicyBase) });
970
1132
  var RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA = mandateApproval.schema;
971
1133
  var RESONANCE_MANDATE_TARGET_JSON_SCHEMA = mandateTarget.schema;
972
1134
  var RESONANCE_MANDATE_ACTION_KIND = "resonance_mandate";
973
1135
  function parseResonanceMandateApprovalPayload(v, target) {
974
1136
  const r = mandateApproval.read(v, "mandateApproval"), t = mandateTarget.read(target, "target_ref");
975
1137
  parseResonanceMandateScope(r.mandate);
1138
+ if (r.operatingPolicyBase && !r.mandate.operatingPolicy && !r.mandate.providerReporting) {
1139
+ fail2("mandateApproval.operatingPolicyBase", "requires explicit prospective operating or reporting scope");
1140
+ }
976
1141
  if (r.mandate.projectId !== t.project_id || r.mandate.campaignId !== t.campaign_id || r.preparedPlanId !== r.mandate.preparedPlanId || r.reviewDigest !== r.mandate.reviewDigest) fail2("mandateApproval", "target or snapshot mismatch");
977
1142
  return r;
978
1143
  }
@@ -1202,7 +1367,7 @@ function parseResonancePositioningConsistencyAssessment(value, expected) {
1202
1367
  return assessment;
1203
1368
  }
1204
1369
  var RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA = positioningConsistencyAssessment.schema;
1205
- var prepareCommand = object2({ expectedRevision: integer2(1), idempotencyKey: operationKey });
1370
+ var prepareCommand = object2({ expectedRevision: integer2(1), idempotencyKey: operationKey, googleContentUpdate: optional2(googleContentUpdateSelection) });
1206
1371
  var parseResonancePrepareCommand = (v) => prepareCommand.read(v, "prepare");
1207
1372
  var parseResonanceCommandPrepareRequest = parseResonancePrepareCommand;
1208
1373
  var commandPreparation = object2({ command: nullable2(command), covered: bool, approvalRequirement: nullable2(choice2("existing_mandate", "current_owner")), reasonCodes: list2(text2(200), 100) });
@@ -2354,7 +2519,7 @@ var feedSelection = refine2(object2({ channels: list2(object2({ channelId: uuid,
2354
2519
  unique(v.channels.map((c) => c.channelId), p + ".channels");
2355
2520
  for (const c of v.channels) unique(c.resourceRuleRefs.map((ref) => ref.id), p + ".resourceRuleRefs");
2356
2521
  });
2357
- var mandateDraftRequest = object2({ expectedRevision: integer2(1), allowedOperations: mandateAllowedOperations, expiresAt: instant, websiteVisitFeedSelection: optional2(feedSelection), providerReporting: optional2(providerReportingSelection) });
2522
+ var mandateDraftRequest = object2({ expectedRevision: integer2(1), allowedOperations: mandateAllowedOperations, expiresAt: instant, websiteVisitFeedSelection: optional2(feedSelection), providerReporting: optional2(providerReportingSelection), operatingPolicySelection: optional2(operatingPolicySelection), activation: optional2(literal2("operating_policy")) });
2358
2523
  var parseResonanceMandateDraftRequest = (v) => mandateDraftRequest.read(v, "mandateDraftRequest");
2359
2524
  var RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA = mandateDraftRequest.schema;
2360
2525
  var feedReview = object2({ schemaVersion: literal2(1), approval: mandateApproval, mandateRef, configurations: list2(metaSnapshot, 100), current: object2({ state: choice2("not_enabled", "eligible", "invalidated", "unavailable"), checkedAt: instant, expiresAt: nullable2(instant), reasonCodes: uniqueList(text2(200), 100) }) });
@@ -2664,4 +2829,4 @@ function deriveProviderRatios(items) {
2664
2829
  return { frequency, costPerResult, reasonCodes: reasons };
2665
2830
  }
2666
2831
 
2667
- export { MAX_MONEY_MICROS, META_AUDIENCE_RULE_LIMIT, META_CALL_TO_ACTIONS, META_SAC_CUSTOM_AUDIENCE_EXCLUSION_VERIFIED, META_WEBSITE_AUDIENCE_MAX_RETENTION_DAYS, MONEY_EXPONENT, MONEY_JSON_SCHEMA, RESONANCE_ACCEPT_COMMAND_JSON_SCHEMA, RESONANCE_ACCOUNT_CAPABILITY_JSON_SCHEMA, RESONANCE_ATTRIBUTION_MODEL, RESONANCE_AUDIENCE_DRAFT_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_AUDIENCE_RULE_REF_JSON_SCHEMA, RESONANCE_BINDING_COMMAND_JSON_SCHEMA, RESONANCE_CAMPAIGN_DEFINITION_JSON_SCHEMA, RESONANCE_CAMPAIGN_DRAFT_JSON_SCHEMA, RESONANCE_CAMPAIGN_VIEW_JSON_SCHEMA, RESONANCE_CLICK_IDENTIFIERS_JSON_SCHEMA, RESONANCE_COMMAND_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_JSON_SCHEMA, RESONANCE_CONSENT_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_UPDATE_JSON_SCHEMA, RESONANCE_CONVERSION_JSON_SCHEMA, RESONANCE_CPQL_UNCERTAINTY_METHOD, RESONANCE_CURRENCIES, RESONANCE_EXPERIMENT_COMPLETE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_CREATE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LIFECYCLE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LINK_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_REF_JSON_SCHEMA, RESONANCE_EXPERIMENT_UPDATE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_REVIEW_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_GOOGLE_SETUP_SPEC_JSON_SCHEMA, RESONANCE_GOOGLE_SIGNAL_SEMANTICS, RESONANCE_GOOGLE_SOURCE_CATEGORIES, RESONANCE_MANDATE_ACTION_KIND, RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA, RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA, RESONANCE_MANDATE_REF_JSON_SCHEMA, RESONANCE_MANDATE_SCOPE_JSON_SCHEMA, RESONANCE_MANDATE_TARGET_JSON_SCHEMA, RESONANCE_MAX_CHANNELS_PER_GROUP, RESONANCE_MEASUREMENT_CONFIGURATION_CURRENT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIG_JSON_SCHEMA, RESONANCE_MEASUREMENT_OCCURRENCE_JSON_SCHEMA, RESONANCE_META_AUDIENCE_REASONS, RESONANCE_META_AUDIENCE_SETUP_LIST_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_READINESS_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_RECEIPT_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_REVIEW_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_STATUS_JSON_SCHEMA, RESONANCE_META_AUDIENCE_VERDICTS, RESONANCE_META_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_META_DATASET_NAME_MAX_LENGTH, RESONANCE_META_DATASET_SELECTION_REQUEST_JSON_SCHEMA, RESONANCE_META_DATASET_SELECTION_WITNESS_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_RECEIPT_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_REVIEW_JSON_SCHEMA, RESONANCE_META_QUERY_ATTRIBUTION_WINDOWS, RESONANCE_META_RETARGETING_READINESS_JSON_SCHEMA, RESONANCE_METRIC_JSON_SCHEMA, RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA, RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA, RESONANCE_OCCURRENCE_RESPONSE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA, RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_POLICY_JSON_SCHEMA, RESONANCE_POSITIONING_APPLY_REQUEST_JSON_SCHEMA, RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA, RESONANCE_POSITIONING_CONTEXT_JSON_SCHEMA, RESONANCE_POSITIONING_METHOD_VERSION, RESONANCE_POSITIONING_PREVIEW_JSON_SCHEMA, RESONANCE_POSITIONING_PREVIEW_REQUEST_JSON_SCHEMA, RESONANCE_POSITIONING_RESULT_JSON_SCHEMA, RESONANCE_PREPARED_PLAN_JSON_SCHEMA, RESONANCE_PROVIDER_METRIC_NAMES, RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA, RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA, RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA, RESONANCE_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RECEIPT_JSON_SCHEMA, RESONANCE_RESOLVED_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RESOURCE_REF_JSON_SCHEMA, RESONANCE_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_SCHEMA_VERSION, RESONANCE_SOURCE_MARKER_JSON_SCHEMA, RESONANCE_SOURCE_MARKER_PARAMETER, RESONANCE_SUBJECT_HEADER, RESONANCE_SUBJECT_RENEW_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_REVIEW_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_PROFILE, RESONANCE_WEBSITE_VISIT_SETUP_DELIVERY_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_ACCEPTED_VISITS_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_PROOF_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_STATUS_JSON_SCHEMA, ResonanceValidationError, addMoney, checkAudienceBand, checkChannelGroups, compareMoney, cpqlMissingOutcomeBound, deriveProviderRatios, expandPropertyChannels, formatMoney, googleConversionActionSemantics, googleUploadClicksSetupSemantics, metaExclusionPolicy, moneyFromProviderUnits, moneyToProviderUnits, parseMoney, parseResonanceAcceptCommand, parseResonanceAccountCapability, parseResonanceAudienceDraftSaveCommand, parseResonanceAudienceRuleRef, parseResonanceBindingCommand, parseResonanceCampaignDefinition, parseResonanceCampaignDraft, parseResonanceCampaignSaveCommand, parseResonanceCampaignView, parseResonanceClickIdentifiers, parseResonanceCommand, parseResonanceCommandPrepareRequest, parseResonanceCommandPrepareResponse, parseResonanceConsentResponse, parseResonanceConsentSnapshot, parseResonanceConsentUpdate, parseResonanceConversionEnvelope, parseResonanceExperimentCompleteCommand, parseResonanceExperimentCreateCommand, parseResonanceExperimentExposure, parseResonanceExperimentLifecycleCommand, parseResonanceExperimentLinkCommand, parseResonanceExperimentRef, parseResonanceExperimentUpdateCommand, parseResonanceGoogleConfigurationReview, parseResonanceGoogleConfigurationSaveCommand, parseResonanceGoogleConfigurationSaveResponse, parseResonanceGoogleConfigurationSnapshot, parseResonanceGoogleConfigurationView, parseResonanceGoogleUploadClicksCustomGoalSpec, parseResonanceMandateApprovalPayload, parseResonanceMandateDraftRequest, parseResonanceMandateRef, parseResonanceMandateScope, parseResonanceMandateTarget, parseResonanceMeasurementConfig, parseResonanceMeasurementConfigurationCurrent, parseResonanceMeasurementConfigurationSaveCommand, parseResonanceMeasurementConfigurationSaveResponse, parseResonanceMeasurementConfigurationSnapshot, parseResonanceMeasurementOccurrence, parseResonanceMetaAudienceSetupIntent, parseResonanceMetaAudienceSetupList, parseResonanceMetaAudienceSetupPrepareRequest, parseResonanceMetaAudienceSetupReadiness, parseResonanceMetaAudienceSetupReceipt, parseResonanceMetaAudienceSetupReview, parseResonanceMetaAudienceSetupStatus, parseResonanceMetaConfigurationSaveCommand, parseResonanceMetaConfigurationSaveResponse, parseResonanceMetaConfigurationSnapshot, parseResonanceMetaConfigurationView, parseResonanceMetaDatasetName, parseResonanceMetaDatasetSelectionRequest, parseResonanceMetaDatasetSelectionWitness, parseResonanceMetaDatasetSetupIntent, parseResonanceMetaDatasetSetupPrepareRequest, parseResonanceMetaDatasetSetupReceipt, parseResonanceMetaDatasetSetupReview, parseResonanceMetaRetargetingReadiness, parseResonanceMetricObservation, parseResonanceObservationSupport, parseResonanceObservationsPage, parseResonanceOccurrenceResponse, parseResonanceOptimizationDecision, parseResonanceOptimizationEvidence, parseResonanceOptimizationPolicy, parseResonancePositioningApplyRequest, parseResonancePositioningConsistencyAssessment, parseResonancePositioningContext, parseResonancePositioningPreview, parseResonancePositioningPreviewRequest, parseResonancePositioningResult, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceProviderReportingGrant, parseResonanceProviderReportingSelection, parseResonancePublicObservationMetric, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, parseResonanceWebsiteVisitSetupDeliveryCommand, parseResonanceWebsiteVisitSetupGrant, parseResonanceWebsiteVisitSetupGrantAcceptedVisits, parseResonanceWebsiteVisitSetupGrantProof, parseResonanceWebsiteVisitSetupGrantStatus, parseResonanceWebsiteVisitSetupOrigin, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, projectResonancePositioningConsistencyEvidence, reportedCpqlMissingOutcomeBound, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaAudienceSetupDigestInput, resonanceMetaAudienceSetupReceiptDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceMetaDatasetSetupDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonancePositioningConsistencyEvidenceDigestInput, resonancePositioningContextDigestInput, resonancePositioningEvidenceDigestInput, resonancePositioningResultDigestInput, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, resonanceWebsiteVisitSetupDeliveryDigestInput, resonanceWebsiteVisitSetupEventTime, splitBudget, subtractMoney, suggestPropertyWeights };
2832
+ export { MAX_MONEY_MICROS, META_AUDIENCE_RULE_LIMIT, META_CALL_TO_ACTIONS, META_SAC_CUSTOM_AUDIENCE_EXCLUSION_VERIFIED, META_WEBSITE_AUDIENCE_MAX_RETENTION_DAYS, MONEY_EXPONENT, MONEY_JSON_SCHEMA, RESONANCE_ACCEPT_COMMAND_JSON_SCHEMA, RESONANCE_ACCOUNT_CAPABILITY_JSON_SCHEMA, RESONANCE_ATTRIBUTION_MODEL, RESONANCE_AUDIENCE_DRAFT_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_AUDIENCE_RULE_REF_JSON_SCHEMA, RESONANCE_BINDING_COMMAND_JSON_SCHEMA, RESONANCE_CAMPAIGN_DEFINITION_JSON_SCHEMA, RESONANCE_CAMPAIGN_DRAFT_JSON_SCHEMA, RESONANCE_CAMPAIGN_VIEW_JSON_SCHEMA, RESONANCE_CLICK_IDENTIFIERS_JSON_SCHEMA, RESONANCE_COMMAND_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_JSON_SCHEMA, RESONANCE_CONSENT_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_UPDATE_JSON_SCHEMA, RESONANCE_CONVERSION_JSON_SCHEMA, RESONANCE_CPQL_UNCERTAINTY_METHOD, RESONANCE_CURRENCIES, RESONANCE_EXPERIMENT_COMPLETE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_CREATE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LIFECYCLE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LINK_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_REF_JSON_SCHEMA, RESONANCE_EXPERIMENT_UPDATE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_REVIEW_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_GOOGLE_CONTENT_UPDATE_JSON_SCHEMA, RESONANCE_GOOGLE_CONTENT_UPDATE_SELECTION_JSON_SCHEMA, RESONANCE_GOOGLE_SETUP_SPEC_JSON_SCHEMA, RESONANCE_GOOGLE_SIGNAL_SEMANTICS, RESONANCE_GOOGLE_SOURCE_CATEGORIES, RESONANCE_MANDATE_ACTION_KIND, RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA, RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA, RESONANCE_MANDATE_REF_JSON_SCHEMA, RESONANCE_MANDATE_SCOPE_JSON_SCHEMA, RESONANCE_MANDATE_TARGET_JSON_SCHEMA, RESONANCE_MAX_CHANNELS_PER_GROUP, RESONANCE_MEASUREMENT_CONFIGURATION_CURRENT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIG_JSON_SCHEMA, RESONANCE_MEASUREMENT_OCCURRENCE_JSON_SCHEMA, RESONANCE_META_AUDIENCE_REASONS, RESONANCE_META_AUDIENCE_SETUP_LIST_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_READINESS_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_RECEIPT_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_REVIEW_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_STATUS_JSON_SCHEMA, RESONANCE_META_AUDIENCE_VERDICTS, RESONANCE_META_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_META_DATASET_NAME_MAX_LENGTH, RESONANCE_META_DATASET_SELECTION_REQUEST_JSON_SCHEMA, RESONANCE_META_DATASET_SELECTION_WITNESS_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_RECEIPT_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_REVIEW_JSON_SCHEMA, RESONANCE_META_QUERY_ATTRIBUTION_WINDOWS, RESONANCE_META_RETARGETING_READINESS_JSON_SCHEMA, RESONANCE_METRIC_JSON_SCHEMA, RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA, RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA, RESONANCE_OCCURRENCE_RESPONSE_JSON_SCHEMA, RESONANCE_OPERATING_POLICY_BASE_JSON_SCHEMA, RESONANCE_OPERATING_POLICY_JSON_SCHEMA, RESONANCE_OPERATING_POLICY_REF_JSON_SCHEMA, RESONANCE_OPERATING_POLICY_SELECTION_JSON_SCHEMA, RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA, RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_POLICY_JSON_SCHEMA, RESONANCE_POSITIONING_APPLY_REQUEST_JSON_SCHEMA, RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA, RESONANCE_POSITIONING_CONTEXT_JSON_SCHEMA, RESONANCE_POSITIONING_METHOD_VERSION, RESONANCE_POSITIONING_PREVIEW_JSON_SCHEMA, RESONANCE_POSITIONING_PREVIEW_REQUEST_JSON_SCHEMA, RESONANCE_POSITIONING_RESULT_JSON_SCHEMA, RESONANCE_PREPARED_PLAN_JSON_SCHEMA, RESONANCE_PROVIDER_METRIC_NAMES, RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA, RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS, RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA, RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA, RESONANCE_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RECEIPT_JSON_SCHEMA, RESONANCE_RESOLVED_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RESOURCE_REF_JSON_SCHEMA, RESONANCE_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_SCHEMA_VERSION, RESONANCE_SOURCE_MARKER_JSON_SCHEMA, RESONANCE_SOURCE_MARKER_PARAMETER, RESONANCE_SUBJECT_HEADER, RESONANCE_SUBJECT_RENEW_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_REVIEW_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_PROFILE, RESONANCE_WEBSITE_VISIT_SETUP_DELIVERY_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_ACCEPTED_VISITS_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_PROOF_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_STATUS_JSON_SCHEMA, ResonanceValidationError, addMoney, checkAudienceBand, checkChannelGroups, compareMoney, cpqlMissingOutcomeBound, deriveProviderRatios, expandPropertyChannels, formatMoney, googleConversionActionSemantics, googleUploadClicksSetupSemantics, metaExclusionPolicy, moneyFromProviderUnits, moneyToProviderUnits, normalizeResonanceGoogleCriterionText, parseMoney, parseResonanceAcceptCommand, parseResonanceAccountCapability, parseResonanceAudienceDraftSaveCommand, parseResonanceAudienceRuleRef, parseResonanceBindingCommand, parseResonanceCampaignDefinition, parseResonanceCampaignDraft, parseResonanceCampaignSaveCommand, parseResonanceCampaignView, parseResonanceClickIdentifiers, parseResonanceCommand, parseResonanceCommandPrepareRequest, parseResonanceCommandPrepareResponse, parseResonanceConsentResponse, parseResonanceConsentSnapshot, parseResonanceConsentUpdate, parseResonanceConversionEnvelope, parseResonanceExperimentCompleteCommand, parseResonanceExperimentCreateCommand, parseResonanceExperimentExposure, parseResonanceExperimentLifecycleCommand, parseResonanceExperimentLinkCommand, parseResonanceExperimentRef, parseResonanceExperimentUpdateCommand, parseResonanceGoogleConfigurationReview, parseResonanceGoogleConfigurationSaveCommand, parseResonanceGoogleConfigurationSaveResponse, parseResonanceGoogleConfigurationSnapshot, parseResonanceGoogleConfigurationView, parseResonanceGoogleContentUpdate, parseResonanceGoogleContentUpdateSelection, parseResonanceGoogleUploadClicksCustomGoalSpec, parseResonanceMandateApprovalPayload, parseResonanceMandateDraftRequest, parseResonanceMandateRef, parseResonanceMandateScope, parseResonanceMandateTarget, parseResonanceMeasurementConfig, parseResonanceMeasurementConfigurationCurrent, parseResonanceMeasurementConfigurationSaveCommand, parseResonanceMeasurementConfigurationSaveResponse, parseResonanceMeasurementConfigurationSnapshot, parseResonanceMeasurementOccurrence, parseResonanceMetaAudienceSetupIntent, parseResonanceMetaAudienceSetupList, parseResonanceMetaAudienceSetupPrepareRequest, parseResonanceMetaAudienceSetupReadiness, parseResonanceMetaAudienceSetupReceipt, parseResonanceMetaAudienceSetupReview, parseResonanceMetaAudienceSetupStatus, parseResonanceMetaConfigurationSaveCommand, parseResonanceMetaConfigurationSaveResponse, parseResonanceMetaConfigurationSnapshot, parseResonanceMetaConfigurationView, parseResonanceMetaDatasetName, parseResonanceMetaDatasetSelectionRequest, parseResonanceMetaDatasetSelectionWitness, parseResonanceMetaDatasetSetupIntent, parseResonanceMetaDatasetSetupPrepareRequest, parseResonanceMetaDatasetSetupReceipt, parseResonanceMetaDatasetSetupReview, parseResonanceMetaRetargetingReadiness, parseResonanceMetricObservation, parseResonanceObservationSupport, parseResonanceObservationsPage, parseResonanceOccurrenceResponse, parseResonanceOperatingPolicy, parseResonanceOperatingPolicyBase, parseResonanceOperatingPolicyRef, parseResonanceOperatingPolicySelection, parseResonanceOptimizationDecision, parseResonanceOptimizationEvidence, parseResonanceOptimizationPolicy, parseResonancePositioningApplyRequest, parseResonancePositioningConsistencyAssessment, parseResonancePositioningContext, parseResonancePositioningPreview, parseResonancePositioningPreviewRequest, parseResonancePositioningResult, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceProviderReportingGrant, parseResonanceProviderReportingSelection, parseResonancePublicObservationMetric, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, parseResonanceWebsiteVisitSetupDeliveryCommand, parseResonanceWebsiteVisitSetupGrant, parseResonanceWebsiteVisitSetupGrantAcceptedVisits, parseResonanceWebsiteVisitSetupGrantProof, parseResonanceWebsiteVisitSetupGrantStatus, parseResonanceWebsiteVisitSetupOrigin, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, projectResonancePositioningConsistencyEvidence, reportedCpqlMissingOutcomeBound, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaAudienceSetupDigestInput, resonanceMetaAudienceSetupReceiptDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceMetaDatasetSetupDigestInput, resonanceOperatingPolicyActionDigestInput, resonanceOperatingPolicyDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonancePositioningConsistencyEvidenceDigestInput, resonancePositioningContextDigestInput, resonancePositioningEvidenceDigestInput, resonancePositioningResultDigestInput, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, resonanceWebsiteVisitSetupDeliveryDigestInput, resonanceWebsiteVisitSetupEventTime, splitBudget, subtractMoney, suggestPropertyWeights };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * JSON-LD template placeholders: found once, dropped wherever sonor-api serves
2
+ * JSON-LD template placeholders: found once, dropped wherever Sonor serves
3
3
  * stored schema to a site, and never stored as implemented by register-schema.
4
4
  *
5
5
  * Stored JSON-LD (seo_schema_markup.schema_json, seo_pages.managed_schema) can
@@ -44,7 +44,7 @@
44
44
  * the site falls back to what it generates itself.
45
45
  *
46
46
  * Single source of truth for "is this stored schema a placeholder", published
47
- * as `@sonordev/contracts/schema-placeholders`: sonor-api's public schema reads
47
+ * as `@sonordev/contracts/schema-placeholders`: Sonor's public schema reads
48
48
  * and register-schema, and site-kit's ManagedSchema and LLMSchema (so a site
49
49
  * drops a placeholder whichever Sonor source served it) all call it. Add new
50
50
  * shapes here, with a test, never in a caller.
package/dist/seo-pages.js CHANGED
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  // src/contracts/sites-normalize.ts
4
+ function stripWww(host) {
5
+ return host.startsWith("www.") ? host.slice(4) : host;
6
+ }
4
7
  function normalizeSiteHost(site) {
5
8
  if (!site || typeof site !== "string") return null;
6
9
  let s = site.trim().toLowerCase();
@@ -15,9 +18,6 @@ function normalizeSiteHost(site) {
15
18
  }
16
19
 
17
20
  // src/contracts/sites.ts
18
- function stripWww(host) {
19
- return host.startsWith("www.") ? host.slice(4) : host;
20
- }
21
21
  function sameSite(a, b) {
22
22
  if (!a || !b) return false;
23
23
  return stripWww(a) === stripWww(b);
@@ -1,4 +1,7 @@
1
1
  // src/contracts/sites-normalize.ts
2
+ function stripWww(host) {
3
+ return host.startsWith("www.") ? host.slice(4) : host;
4
+ }
2
5
  function normalizeSiteHost(site) {
3
6
  if (!site || typeof site !== "string") return null;
4
7
  let s = site.trim().toLowerCase();
@@ -13,9 +16,6 @@ function normalizeSiteHost(site) {
13
16
  }
14
17
 
15
18
  // src/contracts/sites.ts
16
- function stripWww(host) {
17
- return host.startsWith("www.") ? host.slice(4) : host;
18
- }
19
19
  function sameSite(a, b) {
20
20
  if (!a || !b) return false;
21
21
  return stripWww(a) === stripWww(b);
@@ -18,6 +18,13 @@
18
18
  *
19
19
  * Pure string logic only (no Node built-ins) so it is safe in the browser.
20
20
  */
21
+ /**
22
+ * Strip a leading `www.` from a host ("www.example.com" → "example.com"). Lives in this
23
+ * leaf, with `normalizeSiteHost`, so the booking widget can compare and display
24
+ * a host without pulling `./sites` (and its JSON schema) into the client
25
+ * bundle. `./sites` re-exports it, so its public surface is unchanged.
26
+ */
27
+ export declare function stripWww(host: string): string;
21
28
  /**
22
29
  * normalizeSiteHost — canonical normalizer for a sub-site host value before it
23
30
  * is persisted or used as a filter.
package/dist/sites.d.ts CHANGED
@@ -16,9 +16,7 @@ export declare const SITE_HOST_CONTRACT_VERSION: 1;
16
16
  * — JSON schema included — into client bundles. Re-exported here so the public
17
17
  * contract surface is unchanged.
18
18
  */
19
- export { normalizeSiteHost } from './sites-normalize';
20
- /** Strip a leading `www.` from a host ("www.tps.com" → "tps.com"). */
21
- export declare function stripWww(host: string): string;
19
+ export { normalizeSiteHost, stripWww } from './sites-normalize';
22
20
  /**
23
21
  * www-insensitive sub-site host equality — `www.a.com` and `a.com` are the
24
22
  * same site. Operands are expected already-normalized (lowercase host);
package/dist/sites.js CHANGED
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  // src/contracts/sites-normalize.ts
4
+ function stripWww(host) {
5
+ return host.startsWith("www.") ? host.slice(4) : host;
6
+ }
4
7
  function normalizeSiteHost(site) {
5
8
  if (!site || typeof site !== "string") return null;
6
9
  let s = site.trim().toLowerCase();
@@ -16,9 +19,6 @@ function normalizeSiteHost(site) {
16
19
 
17
20
  // src/contracts/sites.ts
18
21
  var SITE_HOST_CONTRACT_VERSION = 1;
19
- function stripWww(host) {
20
- return host.startsWith("www.") ? host.slice(4) : host;
21
- }
22
22
  function sameSite(a, b) {
23
23
  if (!a || !b) return false;
24
24
  return stripWww(a) === stripWww(b);
package/dist/sites.mjs CHANGED
@@ -1,4 +1,7 @@
1
1
  // src/contracts/sites-normalize.ts
2
+ function stripWww(host) {
3
+ return host.startsWith("www.") ? host.slice(4) : host;
4
+ }
2
5
  function normalizeSiteHost(site) {
3
6
  if (!site || typeof site !== "string") return null;
4
7
  let s = site.trim().toLowerCase();
@@ -14,9 +17,6 @@ function normalizeSiteHost(site) {
14
17
 
15
18
  // src/contracts/sites.ts
16
19
  var SITE_HOST_CONTRACT_VERSION = 1;
17
- function stripWww(host) {
18
- return host.startsWith("www.") ? host.slice(4) : host;
19
- }
20
20
  function sameSite(a, b) {
21
21
  if (!a || !b) return false;
22
22
  return stripWww(a) === stripWww(b);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sonordev/contracts",
3
- "version": "2.26.0",
4
- "description": "The rules Sonor's sites, APIs and dashboard share: popup blocks and site design tokens, site hosts, SEO page identity, title quality, llms.txt sanitizers, shared form validation, fleet heartbeats, slot content and signing, site cache tags, portfolio metrics, the house voice's contraction rule, how a proposal's site plan counts its pages, what separates an error page from a page's content, which stored JSON-LD is a template's unfilled placeholder, where prose splits into sentences, which Sonor records Signal reads into a project's knowledge and the address each one is stored under, what outbound email and text may claim about a business and whether a sent email arrived intact, what a segment of outreach is and who may turn one on, a page's own name taken from its title or its slug, which Broadcast card layouts and review compositions are drawn and what a retired one draws as, what a publication's branding may hold, which literal hosts are refused as public fetch destinations, which inbox cards are decisions a bulk action leaves alone, what a rep's call outcome (positive, negative or left voicemail) changes on a prospect, and which buying role a job title says (owner, decision maker, influencer or gatekeeper). Pure functions, no dependencies.",
3
+ "version": "2.28.0",
4
+ "description": "The rules Sonor's sites, APIs and dashboard share: popup blocks and site design tokens, site hosts, SEO page identity, title quality, llms.txt sanitizers, shared form validation, fleet heartbeats, slot content and signing, site cache tags, portfolio metrics, the house voice's contraction rule, how a proposal's site plan counts its pages, what separates an error page from a page's content, which stored JSON-LD is a template's unfilled placeholder, where prose splits into sentences, which Sonor records Signal reads into a project's knowledge and the address each one is stored under, what outbound email and text may claim about a business and whether a sent email arrived intact, what a segment of outreach is and who may turn one on, a page's own name taken from its title or its slug, which Broadcast card layouts and review compositions are drawn and what a retired one draws as, what a publication's branding may hold, which literal hosts are refused as public fetch destinations, which inbox cards are decisions a bulk action leaves alone, what a rep's call outcome (positive, negative or left voicemail) changes on a prospect, which buying role a job title says (owner, decision maker, influencer or gatekeeper), and what a booking may ask a guest about their business. Pure functions, no dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -190,6 +190,21 @@
190
190
  "types": "./dist/sales-call-prep.d.ts",
191
191
  "import": "./dist/sales-call-prep.mjs",
192
192
  "require": "./dist/sales-call-prep.js"
193
+ },
194
+ "./quote-screen": {
195
+ "types": "./dist/quote-screen.d.ts",
196
+ "import": "./dist/quote-screen.mjs",
197
+ "require": "./dist/quote-screen.js"
198
+ },
199
+ "./resonance-confirmation": {
200
+ "types": "./dist/resonance-confirmation.d.ts",
201
+ "import": "./dist/resonance-confirmation.mjs",
202
+ "require": "./dist/resonance-confirmation.js"
203
+ },
204
+ "./booking-intake": {
205
+ "types": "./dist/booking-intake.d.ts",
206
+ "import": "./dist/booking-intake.mjs",
207
+ "require": "./dist/booking-intake.js"
193
208
  }
194
209
  },
195
210
  "typesVersions": {