@sonordev/contracts 2.25.0 → 2.27.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.
- package/CHANGELOG.md +12 -0
- package/README.md +67 -0
- package/dist/booking-intake-normalize.d.ts +152 -0
- package/dist/booking-intake.d.ts +68 -0
- package/dist/booking-intake.js +221 -0
- package/dist/booking-intake.mjs +203 -0
- package/dist/property-interest.d.ts +100 -0
- package/dist/property-interest.js +261 -0
- package/dist/property-interest.mjs +244 -0
- package/dist/quote-screen.d.ts +29 -0
- package/dist/quote-screen.js +194 -0
- package/dist/quote-screen.mjs +190 -0
- package/dist/quote-screen.vectors.d.ts +23 -0
- package/dist/resonance-confirmation.d.ts +238 -0
- package/dist/resonance-confirmation.js +163 -0
- package/dist/resonance-confirmation.mjs +131 -0
- package/dist/resonance.d.ts +266 -2
- package/dist/resonance.js +263 -6
- package/dist/resonance.mjs +246 -7
- package/dist/schema-placeholders.d.ts +2 -2
- package/dist/seo-pages.js +3 -3
- package/dist/seo-pages.mjs +3 -3
- package/dist/sites-normalize.d.ts +7 -0
- package/dist/sites.d.ts +1 -3
- package/dist/sites.js +3 -3
- package/dist/sites.mjs +3 -3
- package/package.json +22 -2
package/dist/resonance.mjs
CHANGED
|
@@ -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({
|
|
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
|
});
|
|
@@ -816,6 +833,10 @@ var RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA = googleConfigurati
|
|
|
816
833
|
var preparedManifestRef = object2({ id: uuid, digest, providerVersion: text2(30), revision });
|
|
817
834
|
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
835
|
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) });
|
|
836
|
+
function bookingTypesMatch(goalIds, witnessIds) {
|
|
837
|
+
const norm = (ids) => ids === void 0 ? null : [...ids].map((id) => id.toLowerCase()).sort();
|
|
838
|
+
return canonical(norm(goalIds)) === canonical(norm(witnessIds));
|
|
839
|
+
}
|
|
819
840
|
function parseResonancePreparedPlan(v) {
|
|
820
841
|
const r = prepared.read(v, "preparedPlan");
|
|
821
842
|
checkDefinition(r.definition);
|
|
@@ -825,7 +846,7 @@ function parseResonancePreparedPlan(v) {
|
|
|
825
846
|
if (goal.source.kind === "qualified_lead") {
|
|
826
847
|
if (!goal.qualificationRule || !goal.qualificationRuleRef || !witness) fail2("preparedPlan.resolvedQualificationRule", "qualified-lead preparation requires actual configured native witness");
|
|
827
848
|
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");
|
|
849
|
+
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
850
|
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
851
|
} else if (witness !== null) fail2("preparedPlan.resolvedQualificationRule", "nonqualified objectives require explicit null");
|
|
831
852
|
if (canonical(r.resolvedEvidencePolicy) !== canonical(r.definition.optimization.policy)) fail2("preparedPlan.resolvedEvidencePolicy", "policy snapshot mismatch");
|
|
@@ -884,7 +905,7 @@ function parseResonanceCommand(v, context) {
|
|
|
884
905
|
if (!channel2 || channel2.kind !== "google_search") fail2("command.channelIds", "requires one original Google channel");
|
|
885
906
|
const c = channel2;
|
|
886
907
|
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");
|
|
908
|
+
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
909
|
const account = plan.accounts.find((a) => a.id === c.accountBindingId);
|
|
889
910
|
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
911
|
const configuration = plan.channelPreviews.find((p) => p.channelId === c.id)?.googleConfiguration;
|
|
@@ -984,6 +1005,224 @@ function canonical(value) {
|
|
|
984
1005
|
var resonanceMandateDigestInput = (v) => canonical(parseResonanceMandateScope(v));
|
|
985
1006
|
var resonanceCommandDigestInput = (v) => canonical(parseResonanceCommand(v));
|
|
986
1007
|
var parseResonanceMandateTarget = (v) => mandateTarget.read(v, "target_ref");
|
|
1008
|
+
var positioningTarget = union2(
|
|
1009
|
+
object2({ kind: literal2("broadcast"), channelId: uuid }),
|
|
1010
|
+
object2({ kind: literal2("meta"), channelId: uuid, creativeId: uuid }),
|
|
1011
|
+
object2({ kind: literal2("google_search"), channelId: uuid, adGroupKey: text2(80), adKey: text2(80) })
|
|
1012
|
+
);
|
|
1013
|
+
var positioningRequest = object2({
|
|
1014
|
+
schemaVersion: literal2(1),
|
|
1015
|
+
expectedRevision: integer2(1),
|
|
1016
|
+
site,
|
|
1017
|
+
destination: optional2(object2({ kind: choice2("existing_page", "funnel"), id: uuid })),
|
|
1018
|
+
offerId: optional2(uuid),
|
|
1019
|
+
target: positioningTarget
|
|
1020
|
+
});
|
|
1021
|
+
var positioningWitnessFields = {
|
|
1022
|
+
id: operationKey,
|
|
1023
|
+
kind: choice2("page", "funnel", "offer", "brain", "buyer", "proof"),
|
|
1024
|
+
sourceId: text2(160),
|
|
1025
|
+
revision,
|
|
1026
|
+
observedAt: instant,
|
|
1027
|
+
expiresAt: instant,
|
|
1028
|
+
permission: choice2("private", "public"),
|
|
1029
|
+
certainty: choice2("verified", "reported", "conflicting")
|
|
1030
|
+
};
|
|
1031
|
+
var positioningWitness = refine2(object2(positioningWitnessFields), checkPositioningWitness);
|
|
1032
|
+
var positioningText = (max) => refine2(text2(max), (value, at) => {
|
|
1033
|
+
if (!value.trim() || /[\x00-\x08\x0b-\x1f\x7f]/.test(value)) fail2(at, "requires nonblank text without control characters");
|
|
1034
|
+
});
|
|
1035
|
+
var positioningEvidence = refine2(object2({ ...positioningWitnessFields, text: positioningText(1600) }), checkPositioningWitness);
|
|
1036
|
+
function checkPositioningWitness(value, at) {
|
|
1037
|
+
if (Date.parse(value.observedAt) >= Date.parse(value.expiresAt)) fail2(at, "requires a positive witness lifetime");
|
|
1038
|
+
}
|
|
1039
|
+
var positioningScopeFields = { schemaVersion: literal2(1), projectId: uuid, campaignId: uuid, request: positioningRequest, observedAt: instant, expiresAt: instant };
|
|
1040
|
+
function checkPositioningWindow(value, at) {
|
|
1041
|
+
if (Date.parse(value.observedAt) >= Date.parse(value.expiresAt)) fail2(at, "requires a positive review lifetime");
|
|
1042
|
+
unique(value.evidence.map((item) => item.id), at + ".evidence");
|
|
1043
|
+
if (value.evidence.some((item) => Date.parse(item.observedAt) > Date.parse(value.observedAt))) fail2(at + ".evidence", "witness observation postdates the preview");
|
|
1044
|
+
}
|
|
1045
|
+
var positioningContext = refine2(object2({
|
|
1046
|
+
...positioningScopeFields,
|
|
1047
|
+
orgId: uuid,
|
|
1048
|
+
evidence: list2(positioningEvidence, 32)
|
|
1049
|
+
}), (value, at) => {
|
|
1050
|
+
checkPositioningWindow(value, at);
|
|
1051
|
+
if (value.evidence.reduce((total, witness) => total + witness.text.length, 0) > 16e3) {
|
|
1052
|
+
fail2(at + ".evidence", "exceeds the combined source text budget");
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
var positioningEvidenceIds = uniqueList(operationKey, 8);
|
|
1056
|
+
var positioningSupportedText = object2({ text: positioningText(320), evidenceIds: positioningEvidenceIds });
|
|
1057
|
+
var positioningAlternative = refine2(object2({
|
|
1058
|
+
text: positioningText(320),
|
|
1059
|
+
kind: choice2("status_quo", "alternative"),
|
|
1060
|
+
basis: choice2("evidence", "hypothesis"),
|
|
1061
|
+
evidenceIds: positioningEvidenceIds
|
|
1062
|
+
}), (value, at) => {
|
|
1063
|
+
if (value.basis === "evidence" !== value.evidenceIds.length > 0) fail2(at, "requires evidence references exactly for evidenced alternatives");
|
|
1064
|
+
});
|
|
1065
|
+
var positioningClaim = object2({
|
|
1066
|
+
attribute: positioningText(320),
|
|
1067
|
+
value: positioningText(320),
|
|
1068
|
+
evidenceIds: uniqueList(operationKey, 8, 1),
|
|
1069
|
+
publicProofIds: positioningEvidenceIds
|
|
1070
|
+
});
|
|
1071
|
+
var positioningClaimIndexes = list2(integer2(0, 7), 8, 1);
|
|
1072
|
+
var positioningCopy = union2(
|
|
1073
|
+
object2({ kind: literal2("broadcast"), caption: positioningText(2200), claimIndexes: positioningClaimIndexes }),
|
|
1074
|
+
object2({
|
|
1075
|
+
kind: literal2("meta"),
|
|
1076
|
+
primaryText: positioningText(2200),
|
|
1077
|
+
headline: positioningText(160),
|
|
1078
|
+
body: positioningText(1e4),
|
|
1079
|
+
claimIndexes: positioningClaimIndexes
|
|
1080
|
+
}),
|
|
1081
|
+
object2({
|
|
1082
|
+
kind: literal2("google_search"),
|
|
1083
|
+
headlines: uniqueList(positioningText(30), 15, 3),
|
|
1084
|
+
descriptions: uniqueList(positioningText(90), 4, 2),
|
|
1085
|
+
claimIndexes: positioningClaimIndexes
|
|
1086
|
+
})
|
|
1087
|
+
);
|
|
1088
|
+
var positioningReasonCodes = choice2(
|
|
1089
|
+
"destination_missing",
|
|
1090
|
+
"destination_unverified",
|
|
1091
|
+
"offer_unverified",
|
|
1092
|
+
"offer_conflicting",
|
|
1093
|
+
"brain_unavailable",
|
|
1094
|
+
"buyer_evidence_sparse",
|
|
1095
|
+
"public_proof_unavailable",
|
|
1096
|
+
"fit_not_established",
|
|
1097
|
+
"status_quo_sufficient",
|
|
1098
|
+
"channel_mismatch",
|
|
1099
|
+
"source_stale",
|
|
1100
|
+
"evidence_conflicting",
|
|
1101
|
+
"generation_unavailable"
|
|
1102
|
+
);
|
|
1103
|
+
var RESONANCE_POSITIONING_METHOD_VERSION = "positioning_v1";
|
|
1104
|
+
var positioningResult = refine2(object2({
|
|
1105
|
+
methodVersion: literal2(RESONANCE_POSITIONING_METHOD_VERSION),
|
|
1106
|
+
state: choice2("ready", "provisional", "no_fit"),
|
|
1107
|
+
reasonCodes: uniqueList(positioningReasonCodes, 12),
|
|
1108
|
+
alternatives: list2(positioningAlternative, 8),
|
|
1109
|
+
claims: list2(positioningClaim, 8),
|
|
1110
|
+
bestFit: list2(positioningSupportedText, 8),
|
|
1111
|
+
category: nullable2(object2({ text: positioningText(160), style: choice2("existing_category", "focused_subcategory", "new_category"), evidenceIds: positioningEvidenceIds })),
|
|
1112
|
+
timelyContext: nullable2(positioningSupportedText),
|
|
1113
|
+
unknowns: list2(positioningText(320), 8),
|
|
1114
|
+
questions: list2(positioningText(320), 8),
|
|
1115
|
+
copy: nullable2(positioningCopy)
|
|
1116
|
+
}), (value, at) => {
|
|
1117
|
+
if (value.state !== "ready") {
|
|
1118
|
+
if (value.copy || !value.reasonCodes.length) fail2(at, "requires a reason and no draft copy when held");
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
const { copy, claims, category, bestFit, alternatives } = value;
|
|
1122
|
+
if (!copy || value.reasonCodes.length || !claims.length || !category || !bestFit.length || !alternatives.length) {
|
|
1123
|
+
return fail2(at, "requires a supported ready brief and channel draft");
|
|
1124
|
+
}
|
|
1125
|
+
unique(copy.claimIndexes.map(String), at + ".copy.claimIndexes");
|
|
1126
|
+
if (copy.claimIndexes.some((index) => index >= claims.length)) fail2(at + ".copy.claimIndexes", "requires an existing claim index");
|
|
1127
|
+
});
|
|
1128
|
+
function checkPositioningEvidence(result, context, at) {
|
|
1129
|
+
const evidence = new Map(context.evidence.map((witness) => [witness.id, witness]));
|
|
1130
|
+
const current = (witness) => witness.certainty === "verified" && Date.parse(witness.expiresAt) >= Date.parse(context.expiresAt);
|
|
1131
|
+
const cited = [
|
|
1132
|
+
...result.alternatives,
|
|
1133
|
+
...result.claims,
|
|
1134
|
+
...result.bestFit,
|
|
1135
|
+
...result.category ? [result.category] : [],
|
|
1136
|
+
...result.timelyContext ? [result.timelyContext] : []
|
|
1137
|
+
];
|
|
1138
|
+
if (cited.some((item) => item.evidenceIds.some((id) => !evidence.has(id)))) fail2(at, "references unknown evidence");
|
|
1139
|
+
for (const claim of result.claims) {
|
|
1140
|
+
for (const id of claim.publicProofIds) {
|
|
1141
|
+
const witness = evidence.get(id);
|
|
1142
|
+
if (!witness || witness.permission !== "public" || !current(witness)) fail2(at, "public proof requires a current permitted witness");
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
if (result.timelyContext && (!result.timelyContext.evidenceIds.length || result.timelyContext.evidenceIds.some((id) => {
|
|
1146
|
+
const witness = evidence.get(id);
|
|
1147
|
+
return !witness || !current(witness);
|
|
1148
|
+
}))) fail2(at, "timely context requires current verified evidence");
|
|
1149
|
+
if (!result.copy) return;
|
|
1150
|
+
if (result.copy.kind !== context.request.target.kind) fail2(at, "copy target differs from the request");
|
|
1151
|
+
const { destination: selected, offerId } = context.request;
|
|
1152
|
+
const owns = (kind, id) => {
|
|
1153
|
+
const witnesses = context.evidence.filter((w) => w.kind === kind && (!id || w.sourceId.toLowerCase() === id.toLowerCase()));
|
|
1154
|
+
return witnesses.some(current) && !witnesses.some((w) => w.certainty === "conflicting");
|
|
1155
|
+
};
|
|
1156
|
+
if (!selected || !owns(selected.kind === "existing_page" ? "page" : "funnel", selected.id) || !owns("brain") || offerId && !owns("offer", offerId)) {
|
|
1157
|
+
fail2(at, "ready copy requires current destination, Brain and selected offer witnesses");
|
|
1158
|
+
}
|
|
1159
|
+
for (const index of result.copy.claimIndexes) {
|
|
1160
|
+
const claim = result.claims[index];
|
|
1161
|
+
if (![...claim.evidenceIds, ...claim.publicProofIds].every((id) => {
|
|
1162
|
+
const witness = evidence.get(id);
|
|
1163
|
+
return witness && witness.permission === "public" && current(witness);
|
|
1164
|
+
})) fail2(at, "selected copy requires current verified public claim evidence");
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
var positioningApplicationToken = text2(32e3, /^[a-zA-Z0-9._-]+$/);
|
|
1168
|
+
var positioningPreview = refine2(object2({
|
|
1169
|
+
...positioningScopeFields,
|
|
1170
|
+
evidence: list2(positioningWitness, 32),
|
|
1171
|
+
result: positioningResult,
|
|
1172
|
+
applicationToken: nullable2(positioningApplicationToken)
|
|
1173
|
+
}), (value, at) => {
|
|
1174
|
+
checkPositioningWindow(value, at);
|
|
1175
|
+
checkPositioningEvidence(value.result, value, at + ".result");
|
|
1176
|
+
if (value.result.state === "ready" !== (value.applicationToken !== null)) fail2(at, "requires an application token exactly for ready copy");
|
|
1177
|
+
});
|
|
1178
|
+
var positioningApplyRequest = object2({ applicationToken: positioningApplicationToken });
|
|
1179
|
+
var parseResonancePositioningPreviewRequest = (value) => positioningRequest.read(value, "positioningPreviewRequest");
|
|
1180
|
+
var parseResonancePositioningContext = (value) => positioningContext.read(value, "positioningContext");
|
|
1181
|
+
function parseResonancePositioningResult(value, context) {
|
|
1182
|
+
const result = positioningResult.read(value, "positioningResult");
|
|
1183
|
+
if (context) checkPositioningEvidence(result, parseResonancePositioningContext(context), "positioningResult");
|
|
1184
|
+
return result;
|
|
1185
|
+
}
|
|
1186
|
+
var parseResonancePositioningPreview = (value) => positioningPreview.read(value, "positioningPreview");
|
|
1187
|
+
var parseResonancePositioningApplyRequest = (value) => positioningApplyRequest.read(value, "positioningApplyRequest");
|
|
1188
|
+
var resonancePositioningContextDigestInput = (value) => canonical(parseResonancePositioningContext(value));
|
|
1189
|
+
function resonancePositioningEvidenceDigestInput(value) {
|
|
1190
|
+
return positioningEvidenceDigestInput(parseResonancePositioningContext(value).evidence);
|
|
1191
|
+
}
|
|
1192
|
+
function positioningEvidenceDigestInput(evidence) {
|
|
1193
|
+
return canonical(evidence.map(({ observedAt: _observed, expiresAt: _expires, ...witness }) => witness).sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
1194
|
+
}
|
|
1195
|
+
var resonancePositioningResultDigestInput = (value) => canonical(parseResonancePositioningResult(value));
|
|
1196
|
+
var RESONANCE_POSITIONING_PREVIEW_REQUEST_JSON_SCHEMA = positioningRequest.schema;
|
|
1197
|
+
var RESONANCE_POSITIONING_CONTEXT_JSON_SCHEMA = positioningContext.schema;
|
|
1198
|
+
var RESONANCE_POSITIONING_RESULT_JSON_SCHEMA = positioningResult.schema;
|
|
1199
|
+
var RESONANCE_POSITIONING_PREVIEW_JSON_SCHEMA = positioningPreview.schema;
|
|
1200
|
+
var RESONANCE_POSITIONING_APPLY_REQUEST_JSON_SCHEMA = positioningApplyRequest.schema;
|
|
1201
|
+
function projectResonancePositioningConsistencyEvidence(value) {
|
|
1202
|
+
const context = parseResonancePositioningContext(value);
|
|
1203
|
+
const expiry = Date.parse(context.expiresAt);
|
|
1204
|
+
return context.evidence.filter((witness) => witness.permission === "public" && witness.certainty === "verified" && Date.parse(witness.expiresAt) >= expiry);
|
|
1205
|
+
}
|
|
1206
|
+
var resonancePositioningConsistencyEvidenceDigestInput = (value) => positioningEvidenceDigestInput(projectResonancePositioningConsistencyEvidence(value));
|
|
1207
|
+
var positioningConsistencyAssessment = object2({
|
|
1208
|
+
state: choice2("compatible", "conflicting", "unknown"),
|
|
1209
|
+
evidenceDigest: digest,
|
|
1210
|
+
coveredSourceIds: uniqueList(operationKey, 32)
|
|
1211
|
+
});
|
|
1212
|
+
function parseResonancePositioningConsistencyAssessment(value, expected) {
|
|
1213
|
+
const at = "positioningConsistencyAssessment";
|
|
1214
|
+
const assessment = positioningConsistencyAssessment.read(value, at);
|
|
1215
|
+
if (assessment.evidenceDigest !== digest.read(expected.evidenceDigest, at + ".expectedEvidenceDigest")) {
|
|
1216
|
+
fail2(at + ".evidenceDigest", "requires the exact current permitted evidence digest");
|
|
1217
|
+
}
|
|
1218
|
+
const eligibleIds = new Set(projectResonancePositioningConsistencyEvidence(expected.context).map((witness) => witness.id));
|
|
1219
|
+
const { state, coveredSourceIds } = assessment;
|
|
1220
|
+
if (coveredSourceIds.some((id) => !eligibleIds.has(id)) || state !== "unknown" && coveredSourceIds.length !== eligibleIds.size || state === "compatible" && coveredSourceIds.length < 1 || state === "conflicting" && coveredSourceIds.length < 2) {
|
|
1221
|
+
fail2(at + ".coveredSourceIds", "coverage does not support this consistency state");
|
|
1222
|
+
}
|
|
1223
|
+
return assessment;
|
|
1224
|
+
}
|
|
1225
|
+
var RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA = positioningConsistencyAssessment.schema;
|
|
987
1226
|
var prepareCommand = object2({ expectedRevision: integer2(1), idempotencyKey: operationKey });
|
|
988
1227
|
var parseResonancePrepareCommand = (v) => prepareCommand.read(v, "prepare");
|
|
989
1228
|
var parseResonanceCommandPrepareRequest = parseResonancePrepareCommand;
|
|
@@ -2446,4 +2685,4 @@ function deriveProviderRatios(items) {
|
|
|
2446
2685
|
return { frequency, costPerResult, reasonCodes: reasons };
|
|
2447
2686
|
}
|
|
2448
2687
|
|
|
2449
|
-
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_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, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceProviderReportingGrant, parseResonanceProviderReportingSelection, parseResonancePublicObservationMetric, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, parseResonanceWebsiteVisitSetupDeliveryCommand, parseResonanceWebsiteVisitSetupGrant, parseResonanceWebsiteVisitSetupGrantAcceptedVisits, parseResonanceWebsiteVisitSetupGrantProof, parseResonanceWebsiteVisitSetupGrantStatus, parseResonanceWebsiteVisitSetupOrigin, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, reportedCpqlMissingOutcomeBound, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaAudienceSetupDigestInput, resonanceMetaAudienceSetupReceiptDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceMetaDatasetSetupDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, resonanceWebsiteVisitSetupDeliveryDigestInput, resonanceWebsiteVisitSetupEventTime, splitBudget, subtractMoney, suggestPropertyWeights };
|
|
2688
|
+
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JSON-LD template placeholders: found once, dropped wherever
|
|
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`:
|
|
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);
|
package/dist/seo-pages.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();
|
|
@@ -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.
|
|
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,
|
|
3
|
+
"version": "2.27.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",
|
|
@@ -181,10 +181,30 @@
|
|
|
181
181
|
"import": "./dist/signal-experiments.mjs",
|
|
182
182
|
"require": "./dist/signal-experiments.js"
|
|
183
183
|
},
|
|
184
|
+
"./property-interest": {
|
|
185
|
+
"types": "./dist/property-interest.d.ts",
|
|
186
|
+
"import": "./dist/property-interest.mjs",
|
|
187
|
+
"require": "./dist/property-interest.js"
|
|
188
|
+
},
|
|
184
189
|
"./sales-call-prep": {
|
|
185
190
|
"types": "./dist/sales-call-prep.d.ts",
|
|
186
191
|
"import": "./dist/sales-call-prep.mjs",
|
|
187
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"
|
|
188
208
|
}
|
|
189
209
|
},
|
|
190
210
|
"typesVersions": {
|