@sonordev/contracts 2.26.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 +7 -0
- package/README.md +51 -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/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 +20 -2
- package/dist/resonance.js +27 -6
- package/dist/resonance.mjs +27 -6
- 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 +17 -2
package/dist/resonance.d.ts
CHANGED
|
@@ -85,7 +85,9 @@ declare const resolvedQualificationRule: Field<{
|
|
|
85
85
|
endAt: string;
|
|
86
86
|
maturityDelaySeconds: number;
|
|
87
87
|
} & {};
|
|
88
|
-
} & {
|
|
88
|
+
} & {
|
|
89
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
90
|
+
}>;
|
|
89
91
|
export type ResonanceResolvedQualificationRule = Value<typeof resolvedQualificationRule>;
|
|
90
92
|
/** Actual native snapshot shape only; the server verifies its source/config digest. */
|
|
91
93
|
export declare const parseResonanceResolvedQualificationRule: (v: unknown) => ResonanceResolvedQualificationRule;
|
|
@@ -120,6 +122,7 @@ declare const objective: Field<{
|
|
|
120
122
|
existingContactPolicy: "include_source_cohort";
|
|
121
123
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
122
124
|
} & {}) | undefined;
|
|
125
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
123
126
|
}>;
|
|
124
127
|
declare const destination: Field<({
|
|
125
128
|
projectId: string;
|
|
@@ -577,6 +580,7 @@ declare const definition: Field<{
|
|
|
577
580
|
existingContactPolicy: "include_source_cohort";
|
|
578
581
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
579
582
|
} & {}) | undefined;
|
|
583
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
580
584
|
};
|
|
581
585
|
brandRef: {
|
|
582
586
|
projectId: string;
|
|
@@ -978,6 +982,7 @@ declare const draft: Field<{
|
|
|
978
982
|
existingContactPolicy: "include_source_cohort";
|
|
979
983
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
980
984
|
} & {}) | undefined;
|
|
985
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
981
986
|
}) | undefined;
|
|
982
987
|
brandRef?: ({
|
|
983
988
|
projectId: string;
|
|
@@ -1556,6 +1561,7 @@ declare const mandateScope: Field<{
|
|
|
1556
1561
|
existingContactPolicy: "include_source_cohort";
|
|
1557
1562
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
1558
1563
|
} & {}) | undefined;
|
|
1564
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
1559
1565
|
};
|
|
1560
1566
|
allowedOperations: ("deliver_conversion" | "launch" | "optimize" | "resume" | "update")[];
|
|
1561
1567
|
allowedTransformationRef: ({
|
|
@@ -2307,6 +2313,7 @@ declare const prepared: Field<{
|
|
|
2307
2313
|
existingContactPolicy: "include_source_cohort";
|
|
2308
2314
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
2309
2315
|
} & {}) | undefined;
|
|
2316
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
2310
2317
|
};
|
|
2311
2318
|
brandRef: {
|
|
2312
2319
|
projectId: string;
|
|
@@ -2810,7 +2817,9 @@ declare const prepared: Field<{
|
|
|
2810
2817
|
endAt: string;
|
|
2811
2818
|
maturityDelaySeconds: number;
|
|
2812
2819
|
} & {};
|
|
2813
|
-
} & {
|
|
2820
|
+
} & {
|
|
2821
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
2822
|
+
}) | null;
|
|
2814
2823
|
accounts: ({
|
|
2815
2824
|
id: string;
|
|
2816
2825
|
projectId: string;
|
|
@@ -3177,6 +3186,7 @@ declare const view: Field<{
|
|
|
3177
3186
|
existingContactPolicy: "include_source_cohort";
|
|
3178
3187
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
3179
3188
|
} & {}) | undefined;
|
|
3189
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
3180
3190
|
}) | undefined;
|
|
3181
3191
|
brandRef?: ({
|
|
3182
3192
|
projectId: string;
|
|
@@ -3863,6 +3873,7 @@ declare const mandateApproval: Field<{
|
|
|
3863
3873
|
existingContactPolicy: "include_source_cohort";
|
|
3864
3874
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
3865
3875
|
} & {}) | undefined;
|
|
3876
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
3866
3877
|
};
|
|
3867
3878
|
allowedOperations: ("deliver_conversion" | "launch" | "optimize" | "resume" | "update")[];
|
|
3868
3879
|
allowedTransformationRef: ({
|
|
@@ -4326,6 +4337,7 @@ declare const saveCommand: Field<{
|
|
|
4326
4337
|
existingContactPolicy: "include_source_cohort";
|
|
4327
4338
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
4328
4339
|
} & {}) | undefined;
|
|
4340
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
4329
4341
|
}) | undefined;
|
|
4330
4342
|
brandRef?: ({
|
|
4331
4343
|
projectId: string;
|
|
@@ -4822,6 +4834,7 @@ declare const reportedOptimizationEvidence: Field<{
|
|
|
4822
4834
|
existingContactPolicy: "include_source_cohort";
|
|
4823
4835
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
4824
4836
|
} & {}) | undefined;
|
|
4837
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
4825
4838
|
};
|
|
4826
4839
|
policyDigest: string;
|
|
4827
4840
|
trackingState: "blocked" | "healthy" | "unknown";
|
|
@@ -5065,6 +5078,7 @@ declare const finiteOptimizationEvidence: Field<{
|
|
|
5065
5078
|
existingContactPolicy: "include_source_cohort";
|
|
5066
5079
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
5067
5080
|
} & {}) | undefined;
|
|
5081
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
5068
5082
|
};
|
|
5069
5083
|
policyDigest: string;
|
|
5070
5084
|
resolvedPolicy: {
|
|
@@ -5368,6 +5382,7 @@ declare const optimizationEvidence: Field<({
|
|
|
5368
5382
|
existingContactPolicy: "include_source_cohort";
|
|
5369
5383
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
5370
5384
|
} & {}) | undefined;
|
|
5385
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
5371
5386
|
};
|
|
5372
5387
|
policyDigest: string;
|
|
5373
5388
|
trackingState: "blocked" | "healthy" | "unknown";
|
|
@@ -5585,6 +5600,7 @@ declare const optimizationEvidence: Field<({
|
|
|
5585
5600
|
existingContactPolicy: "include_source_cohort";
|
|
5586
5601
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
5587
5602
|
} & {}) | undefined;
|
|
5603
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
5588
5604
|
};
|
|
5589
5605
|
policyDigest: string;
|
|
5590
5606
|
trackingState: "blocked" | "healthy" | "unknown";
|
|
@@ -5821,6 +5837,7 @@ declare const optimizationEvidence: Field<({
|
|
|
5821
5837
|
existingContactPolicy: "include_source_cohort";
|
|
5822
5838
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
5823
5839
|
} & {}) | undefined;
|
|
5840
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
5824
5841
|
};
|
|
5825
5842
|
policyDigest: string;
|
|
5826
5843
|
resolvedPolicy: {
|
|
@@ -9129,6 +9146,7 @@ declare const feedReview: Field<{
|
|
|
9129
9146
|
existingContactPolicy: "include_source_cohort";
|
|
9130
9147
|
attributionModel: "first_party_last_touch_marker_v1";
|
|
9131
9148
|
} & {}) | undefined;
|
|
9149
|
+
eligibleBookingTypeIds?: string[] | undefined;
|
|
9132
9150
|
};
|
|
9133
9151
|
allowedOperations: ("deliver_conversion" | "launch" | "optimize" | "resume" | "update")[];
|
|
9134
9152
|
allowedTransformationRef: ({
|
package/dist/resonance.js
CHANGED
|
@@ -58,6 +58,9 @@ function createWireSchema(fail3, isValidationError) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// src/contracts/sites-normalize.ts
|
|
61
|
+
function stripWww(host) {
|
|
62
|
+
return host.startsWith("www.") ? host.slice(4) : host;
|
|
63
|
+
}
|
|
61
64
|
function normalizeSiteHost(site2) {
|
|
62
65
|
if (!site2 || typeof site2 !== "string") return null;
|
|
63
66
|
let s = site2.trim().toLowerCase();
|
|
@@ -72,9 +75,6 @@ function normalizeSiteHost(site2) {
|
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
// src/contracts/sites.ts
|
|
75
|
-
function stripWww(host) {
|
|
76
|
-
return host.startsWith("www.") ? host.slice(4) : host;
|
|
77
|
-
}
|
|
78
78
|
function sameSite(a, b) {
|
|
79
79
|
if (!a || !b) return false;
|
|
80
80
|
return stripWww(a) === stripWww(b);
|
|
@@ -368,13 +368,16 @@ var resolvedQualificationRule = refine2(object2({
|
|
|
368
368
|
ref: resource,
|
|
369
369
|
crmVariant: text2(128),
|
|
370
370
|
ladderSnapshot: list2(object2({ id: nullable2(uuid), stage_key: revision, semantic_key: nullable2(revision), is_won: bool, is_lost: bool }), 500, 1),
|
|
371
|
+
// eligibleBookingTypeIds: Sync booking types whose confirmed bookings also count, beside the one form. Absent means forms only.
|
|
371
372
|
eligibleFormIds: list2(uuid, 500, 1),
|
|
373
|
+
eligibleBookingTypeIds: optional2(list2(uuid, 100, 1)),
|
|
372
374
|
attribution: object2({ model: literal2(RESONANCE_ATTRIBUTION_MODEL), resolverRevision: literal2(1) }),
|
|
373
375
|
cohort: object2({ startAt: instant, endAt: instant, maturityDelaySeconds: integer2(0, 31536e3) })
|
|
374
376
|
}), (v, p) => {
|
|
375
377
|
checkQualificationPartitions(v, p);
|
|
376
378
|
if (v.ref.module !== "crm" || v.ref.id !== v.ref.projectId) fail2(p + ".ref", "must reference the actual CRM project configuration");
|
|
377
379
|
unique(v.eligibleFormIds, p + ".eligibleFormIds");
|
|
380
|
+
if (v.eligibleBookingTypeIds) unique(v.eligibleBookingTypeIds.map((x) => x.toLowerCase()), p + ".eligibleBookingTypeIds");
|
|
378
381
|
unique(v.ladderSnapshot.flatMap((x) => x.id ? [x.id] : []), p + ".ladderSnapshot.id");
|
|
379
382
|
unique(v.ladderSnapshot.map((x) => x.stage_key), p + ".ladderSnapshot.stage_key");
|
|
380
383
|
const partitions = [...v.positiveStageKeys, ...v.finalNegativeStageKeys, ...v.pendingStageKeys], keys = new Set(v.ladderSnapshot.map((x) => x.stage_key));
|
|
@@ -383,7 +386,21 @@ var resolvedQualificationRule = refine2(object2({
|
|
|
383
386
|
});
|
|
384
387
|
var parseResonanceResolvedQualificationRule = (v) => resolvedQualificationRule.read(v, "resolvedQualificationRule");
|
|
385
388
|
var RESONANCE_RESOLVED_QUALIFICATION_RULE_JSON_SCHEMA = resolvedQualificationRule.schema;
|
|
386
|
-
var objective = refine2(object2({
|
|
389
|
+
var objective = refine2(object2({
|
|
390
|
+
source,
|
|
391
|
+
measurementRevision: revision,
|
|
392
|
+
countingUnit: objectiveCountingUnit,
|
|
393
|
+
attributionWindowDays: integer2(1, 365),
|
|
394
|
+
maturityDelaySeconds: integer2(0, 31536e3),
|
|
395
|
+
qualificationRuleRef: nullable2(resource),
|
|
396
|
+
qualificationRule: optional2(qualificationRule),
|
|
397
|
+
// 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.
|
|
398
|
+
eligibleBookingTypeIds: optional2(list2(uuid, 100, 1))
|
|
399
|
+
}), (v, p) => {
|
|
400
|
+
if (v.eligibleBookingTypeIds) {
|
|
401
|
+
if (v.source.kind !== "qualified_lead") fail2(p + ".eligibleBookingTypeIds", "requires the native qualified-lead source");
|
|
402
|
+
unique(v.eligibleBookingTypeIds.map((x) => x.toLowerCase()), p + ".eligibleBookingTypeIds");
|
|
403
|
+
}
|
|
387
404
|
if (v.qualificationRule && v.source.kind !== "qualified_lead") fail2(p + ".qualificationRule", "requires the native qualified-lead source");
|
|
388
405
|
if (v.qualificationRule && v.qualificationRuleRef && (v.qualificationRuleRef.module !== "crm" || v.qualificationRuleRef.id !== v.source.projectId)) fail2(p + ".qualificationRuleRef", "must reference actual CRM project configuration");
|
|
389
406
|
});
|
|
@@ -818,6 +835,10 @@ var RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA = googleConfigurati
|
|
|
818
835
|
var preparedManifestRef = object2({ id: uuid, digest, providerVersion: text2(30), revision });
|
|
819
836
|
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) });
|
|
820
837
|
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) });
|
|
838
|
+
function bookingTypesMatch(goalIds, witnessIds) {
|
|
839
|
+
const norm = (ids) => ids === void 0 ? null : [...ids].map((id) => id.toLowerCase()).sort();
|
|
840
|
+
return canonical(norm(goalIds)) === canonical(norm(witnessIds));
|
|
841
|
+
}
|
|
821
842
|
function parseResonancePreparedPlan(v) {
|
|
822
843
|
const r = prepared.read(v, "preparedPlan");
|
|
823
844
|
checkDefinition(r.definition);
|
|
@@ -827,7 +848,7 @@ function parseResonancePreparedPlan(v) {
|
|
|
827
848
|
if (goal.source.kind === "qualified_lead") {
|
|
828
849
|
if (!goal.qualificationRule || !goal.qualificationRuleRef || !witness) fail2("preparedPlan.resolvedQualificationRule", "qualified-lead preparation requires actual configured native witness");
|
|
829
850
|
const w = witness, selected = goal.qualificationRule;
|
|
830
|
-
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");
|
|
851
|
+
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");
|
|
831
852
|
for (const key of ["schemaVersion", "semantics", "positiveStageKeys", "finalNegativeStageKeys", "pendingStageKeys", "existingContactPolicy"]) if (canonical(w[key]) !== canonical(selected[key])) fail2("preparedPlan.resolvedQualificationRule", "selected qualification snapshot mismatch");
|
|
832
853
|
} else if (witness !== null) fail2("preparedPlan.resolvedQualificationRule", "nonqualified objectives require explicit null");
|
|
833
854
|
if (canonical(r.resolvedEvidencePolicy) !== canonical(r.definition.optimization.policy)) fail2("preparedPlan.resolvedEvidencePolicy", "policy snapshot mismatch");
|
|
@@ -886,7 +907,7 @@ function parseResonanceCommand(v, context) {
|
|
|
886
907
|
if (!channel2 || channel2.kind !== "google_search") fail2("command.channelIds", "requires one original Google channel");
|
|
887
908
|
const c = channel2;
|
|
888
909
|
const goal = plan.definition.objective, witness = plan.resolvedQualificationRule;
|
|
889
|
-
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");
|
|
910
|
+
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");
|
|
890
911
|
const account = plan.accounts.find((a) => a.id === c.accountBindingId);
|
|
891
912
|
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");
|
|
892
913
|
const configuration = plan.channelPreviews.find((p) => p.channelId === c.id)?.googleConfiguration;
|
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;
|
|
@@ -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",
|
|
@@ -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": {
|