@sonordev/contracts 2.21.0 → 2.22.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.
@@ -387,7 +387,7 @@ var destination = union2(
387
387
  object2({ kind: literal2("funnel"), id: uuid, ...scope, path, funnelRef: resource, formSlug: text2(80, /^[a-z0-9]+(?:-[a-z0-9]+)*$/), installationRevision: revision }),
388
388
  object2({ kind: literal2("existing_page"), id: uuid, ...scope, path, pageRevision: revision, evidenceDigest: digest })
389
389
  );
390
- var audience = object2({ ...scope, id: uuid, revision, policyRevision: revision, retentionDays: integer2(1, 540), exclusionRuleIds: list2(uuid, 50), consentPurpose: literal2("ad_personalization") });
390
+ var audience = object2({ ...scope, id: uuid, revision, policyRevision: revision, retentionDays: integer2(1, 540), exclusionRuleIds: list2(uuid, 50), minDaysSinceVisit: optional2(integer2(1, 179)), consentPurpose: literal2("ad_personalization") });
391
391
  var experiment = object2({ ...scope, id: uuid, revision: integer2(1), digest });
392
392
  var budget = refine2(object2({ total: money, dailyAllocationCeiling: nullable2(money), reserveMargin: money, startAt: instant, endAt: instant, timeZone, maxChange: money, maxChangeBasisPoints: integer2(0, 1e4), cooldownSeconds: integer2(0, 31536e3) }), (v, p) => {
393
393
  if (Date.parse(v.endAt) <= Date.parse(v.startAt)) fail2(p, "end must follow start");
@@ -474,7 +474,39 @@ var search = object2({ ...channelBase, localCampaignKey: text2(80), kind: litera
474
474
  var metaAgeConstraint = union2(refine2(object2({ mode: literal2("bounded"), min: integer2(1, 120), max: integer2(1, 120) }), (v, p) => {
475
475
  if (v.min > v.max) fail2(p, "minimum age exceeds maximum");
476
476
  }), object2({ mode: literal2("omitted") }), object2({ mode: literal2("provider_managed") }));
477
- var meta = object2({ ...channelBase, localCampaignKey: text2(80), kind: literal2("meta_retargeting"), provider: literal2("meta_ads"), accountBindingId: uuid, capabilityRevision: revision, allocation: money, budgetMode: choice2("lifetime", "daily"), audienceRuleRefs: list2(audience, 50, 1), objective: choice2("OUTCOME_LEADS", "OUTCOME_SALES", "OUTCOME_TRAFFIC"), pageRef: object2({ connectionId: uuid, externalId: text2(160), revision }), instagramRef: nullable2(object2({ connectionId: uuid, externalId: text2(160), revision })), datasetRef: object2({ id: text2(160), revision }), conversionGoalRef: resource, optimization: choice2("landing_page_views", "lead", "purchase"), billing: literal2("impressions"), bid: union2(object2({ strategy: literal2("lowest_cost") }), object2({ strategy: literal2("cost_cap"), cap: money })), localAdSetKey: text2(80), localAdKey: text2(80), budgetOwner: choice2("campaign", "adset"), specialCategories: list2(choice2("housing", "employment", "financial_products_services"), 3), countryCodes: list2(text2(2, /^[A-Z]{2}$/), 30, 1), placement: literal2("automatic"), ageConstraint: optional2(metaAgeConstraint) });
477
+ var propertyKey = object2({ key: text2(40, /^[a-z0-9]+(?:-[a-z0-9]+)*$/), label: text2(80) });
478
+ var meta = object2({
479
+ ...channelBase,
480
+ localCampaignKey: text2(80),
481
+ kind: literal2("meta_retargeting"),
482
+ provider: literal2("meta_ads"),
483
+ accountBindingId: uuid,
484
+ capabilityRevision: revision,
485
+ allocation: money,
486
+ budgetMode: choice2("lifetime", "daily"),
487
+ audienceRuleRefs: list2(audience, 50, 1),
488
+ objective: choice2("OUTCOME_LEADS", "OUTCOME_SALES", "OUTCOME_TRAFFIC"),
489
+ pageRef: object2({ connectionId: uuid, externalId: text2(160), revision }),
490
+ instagramRef: nullable2(object2({ connectionId: uuid, externalId: text2(160), revision })),
491
+ datasetRef: object2({ id: text2(160), revision }),
492
+ conversionGoalRef: resource,
493
+ optimization: choice2("landing_page_views", "lead", "purchase"),
494
+ billing: literal2("impressions"),
495
+ bid: union2(object2({ strategy: literal2("lowest_cost") }), object2({ strategy: literal2("cost_cap"), cap: money })),
496
+ localAdSetKey: text2(80),
497
+ localAdKey: text2(80),
498
+ budgetOwner: choice2("campaign", "adset"),
499
+ specialCategories: list2(choice2("housing", "employment", "financial_products_services"), 3),
500
+ countryCodes: list2(text2(2, /^[A-Z]{2}$/), 30, 1),
501
+ placement: literal2("automatic"),
502
+ ageConstraint: optional2(metaAgeConstraint),
503
+ // Property retargeting (one channel per property under one group). Every field is optional and omitted from the canonical form when absent, so no existing reviewed digest changes.
504
+ channelGroup: optional2(propertyKey),
505
+ property: optional2(propertyKey),
506
+ tier: optional2(object2({ label: text2(40) })),
507
+ primaryText: optional2(text2(2200)),
508
+ convertersAcknowledged: optional2(literal2(true))
509
+ });
478
510
  var owned = object2({ ...channelBase, kind: choice2("funnel", "broadcast", "outreach"), resourceRef: resource });
479
511
  var channel = union2(search, meta, owned);
480
512
  var definitionFields = { schemaVersion: literal2(1), projectId: uuid, name: text2(160), slug: refine2(text2(80), (v, p) => {
@@ -520,6 +552,9 @@ function checkDefinition(v) {
520
552
  if ("bidding" in c && "target" in c.bidding && c.bidding.target.currency !== v.budget.total.currency) fail2("campaign.channels.bidding", "currency mismatch");
521
553
  if ("allocation" in c && c.allocation.currency !== v.budget.total.currency) fail2("campaign.channels.allocation", "currency mismatch");
522
554
  }
555
+ checkChannelGroups(v.channels);
556
+ checkGroupedAllocations(v);
557
+ for (const c of v.channels) if (c.kind === "meta_retargeting") checkMetaAudienceBands(c, "campaign.channels.audienceRuleRefs");
523
558
  const policy = v.optimization.policy;
524
559
  if (policy.algorithm === "finite_meta_candidates_v1") {
525
560
  const guard = policy.measurementGuard, goal = v.objective;
@@ -881,12 +916,13 @@ function parseResonanceCampaignView(v) {
881
916
  var metricValue = union2(object2({ kind: literal2("count"), count: decimal }), object2({ kind: literal2("money"), money }), object2({ kind: literal2("ratio"), numerator: decimal, denominator: refine2(decimal, (v, p) => {
882
917
  if (v === "0") fail2(p, "zero denominator");
883
918
  }) }));
884
- var metricBase = { ...scope, campaignId: uuid, name: choice2("impressions", "clicks", "spend", "accepted_goals", "qualified_goals", "revenue", "conversion_rate"), source: choice2("first_party", "provider", "experiment"), sourceRef: revision, goalRevision: nullable2(revision), countingUnit: choice2("unique_source", "unique_qualified_contact", "net_order", "provider_aggregate"), windowStart: instant, windowEnd: instant, timeZone, attributionModel: nullable2(text2(100)), asOf: instant, dataThrough: nullable2(instant), maturityDelaySeconds: integer2(0), coverageBasisPoints: nullable2(integer2(0, 1e4)), eligibleExposures: nullable2(decimal), matureOutcomes: nullable2(decimal), native: nullable2(object2({ unit: text2(80), amount: decimal, currency: nullable2(currency), unitExponent: integer2(0, 9), providerVersion: text2(30) })) };
919
+ var metricBase = { ...scope, campaignId: uuid, name: choice2("impressions", "clicks", "spend", "accepted_goals", "qualified_goals", "revenue", "conversion_rate", "reach", "results"), source: choice2("first_party", "provider", "experiment"), sourceRef: revision, goalRevision: nullable2(revision), countingUnit: choice2("unique_source", "unique_qualified_contact", "net_order", "provider_aggregate", "provider_unique_reach"), windowStart: instant, windowEnd: instant, timeZone, attributionModel: nullable2(text2(100)), asOf: instant, dataThrough: nullable2(instant), maturityDelaySeconds: integer2(0), coverageBasisPoints: nullable2(integer2(0, 1e4)), eligibleExposures: nullable2(decimal), matureOutcomes: nullable2(decimal), native: nullable2(object2({ unit: text2(80), amount: decimal, currency: nullable2(currency), unitExponent: integer2(0, 9), providerVersion: text2(30) })) };
885
920
  var metric = union2(object2({ ...metricBase, state: literal2("observed"), value: metricValue }), object2({ ...metricBase, state: choice2("unknown", "insufficient", "delayed", "unavailable"), value: literal2(null), reasonCode: text2(80) }));
886
921
  function parseResonanceMetricObservation(v) {
887
922
  const r = metric.read(v, "metric");
888
923
  if (["accepted_goals", "qualified_goals", "revenue", "conversion_rate"].includes(r.name) && r.goalRevision === null) fail2("metric.goalRevision", "goal measurement requires explicit revision");
889
924
  if (Date.parse(r.windowEnd) <= Date.parse(r.windowStart)) fail2("metric.window", "invalid window");
925
+ if (r.name === "reach" !== (r.countingUnit === "provider_unique_reach")) fail2("metric.countingUnit", "reach, and only reach, counts unique provider reach");
890
926
  if (r.state === "observed") {
891
927
  const expected = r.name === "spend" || r.name === "revenue" ? "money" : r.name === "conversion_rate" ? "ratio" : "count";
892
928
  if (r.value.kind !== expected) fail2("metric.value", "metric unit mismatch");
@@ -1227,8 +1263,8 @@ function parseResonanceOptimizationEvidence(v, preparedPlan) {
1227
1263
  parseResonanceMetricObservation(o);
1228
1264
  if (o.projectId !== r.projectId || o.campaignId !== r.campaignId || o.site !== c.site) fail2(p + ".candidates.ownMeasurement", "foreign candidate measurement scope");
1229
1265
  if (Date.parse(o.asOf) > Date.parse(r.observedAt) || Date.parse(o.windowStart) < Date.parse(r.windowStart) || Date.parse(o.windowEnd) > Date.parse(r.windowEnd) || o.dataThrough !== null && Date.parse(o.dataThrough) > Date.parse(r.observedAt)) fail2(p + ".candidates.ownMeasurement", "outside the actual candidate evidence window");
1230
- const aggregate = o.source === "provider" && ["spend", "clicks", "impressions"].includes(o.name);
1231
- if (aggregate ? o.countingUnit !== "provider_aggregate" || o.attributionModel !== "provider_reported" || o.goalRevision !== null && o.goalRevision !== r.goalRevision : o.source !== "first_party" || o.goalRevision !== r.goalRevision || o.countingUnit !== r.objective.countingUnit || o.attributionModel !== policy.measurementGuard.attributionModel) fail2(p + ".candidates.ownMeasurement", "preserve actual provider aggregate versus first-party cohort provenance");
1266
+ const aggregate = o.source === "provider" && RESONANCE_PROVIDER_METRIC_NAMES.includes(o.name);
1267
+ if (aggregate ? o.countingUnit !== providerCountingUnit(o.name) || o.attributionModel !== "provider_reported" || o.goalRevision !== null && o.goalRevision !== r.goalRevision : o.source !== "first_party" || o.goalRevision !== r.goalRevision || o.countingUnit !== r.objective.countingUnit || o.attributionModel !== policy.measurementGuard.attributionModel) fail2(p + ".candidates.ownMeasurement", "preserve actual provider aggregate versus first-party cohort provenance");
1232
1268
  }
1233
1269
  }
1234
1270
  return r;
@@ -1368,9 +1404,11 @@ function checkOptimizationDecisionEvidence(d, e) {
1368
1404
  }
1369
1405
  var RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA = optimizationEvidence.schema;
1370
1406
  var RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA = optimizationDecision.schema;
1407
+ var metaBrowserWitness = object2({ controlsRevision: text2(60, /^[A-Z][A-Z0-9_]*$/), policyRevision: revision, witnessId: uuid, assertedAt: instant });
1371
1408
  var publicDestination = union2(
1372
1409
  object2({ provider: literal2("google_ads"), id: uuid, tagId: text2(40, /^AW-[0-9]+$/) }),
1373
- object2({ provider: literal2("meta_ads"), id: uuid, pixelId: text2(40, /^[0-9]+$/) })
1410
+ // browserWitness and tagManagerAttested are optional so configurations from before the Meta loader keep parsing; absent means no Meta browser loading.
1411
+ object2({ provider: literal2("meta_ads"), id: uuid, pixelId: text2(40, /^[0-9]+$/), browserWitness: optional2(metaBrowserWitness), tagManagerAttested: optional2(bool) })
1374
1412
  );
1375
1413
  var interestResource = object2({ ...scope, type: choice2("page", "article", "product", "listing"), id: text2(160, /^[a-zA-Z0-9._:-]+$/), revision });
1376
1414
  var measurementConfig = object2({
@@ -1382,7 +1420,8 @@ var measurementConfig = object2({
1382
1420
  enabled: bool,
1383
1421
  consentPolicy: object2({ mode: literal2("basic"), requiredPurposes: list2(purpose, 4, 1) }),
1384
1422
  destinations: list2(publicDestination, 10),
1385
- resourceRules: list2(object2({ id: uuid, revision, site, resource: interestResource, path, interestKey: text2(100, /^[a-zA-Z0-9._:-]+$/) }), 500)
1423
+ // metaEligible is set by a person with owner or admin standing; absent means false. The browser never decides it.
1424
+ resourceRules: list2(object2({ id: uuid, revision, site, resource: interestResource, path, interestKey: text2(100, /^[a-zA-Z0-9._:-]+$/), metaEligible: optional2(bool) }), 500)
1386
1425
  });
1387
1426
  function parseResonanceMeasurementConfig(v) {
1388
1427
  const r = measurementConfig.read(v, "measurementConfig");
@@ -1494,11 +1533,12 @@ var audienceDraft = object2({
1494
1533
  schemaVersion: literal2(1),
1495
1534
  expectedRevision: optional2(integer2(1)),
1496
1535
  idempotencyKey: operationKey,
1497
- definition: object2({ name: text2(160), site, accountBindingId: uuid, resourceRuleId: uuid, excludedResourceRuleIds: list2(uuid, 50), retentionDays: integer2(1, 540), policyRevision: revision, currentConsentPolicyRevision: revision })
1536
+ definition: object2({ name: text2(160), site, accountBindingId: uuid, resourceRuleId: uuid, excludedResourceRuleIds: list2(uuid, 50), retentionDays: integer2(1, 540), minDaysSinceVisit: optional2(integer2(1, 179)), policyRevision: revision, currentConsentPolicyRevision: revision })
1498
1537
  });
1499
1538
  function parseResonanceAudienceDraftSaveCommand(v) {
1500
1539
  const r = audienceDraft.read(v, "audienceDraftSave");
1501
1540
  unique(r.definition.excludedResourceRuleIds, "audienceDraftSave.definition.excludedResourceRuleIds");
1541
+ if (r.definition.minDaysSinceVisit !== void 0 && r.definition.minDaysSinceVisit >= r.definition.retentionDays) fail2("audienceDraftSave.definition.minDaysSinceVisit", "must be shorter than the retention window");
1502
1542
  return r;
1503
1543
  }
1504
1544
  var RESONANCE_AUDIENCE_DRAFT_SAVE_COMMAND_JSON_SCHEMA = audienceDraft.schema;
@@ -1667,6 +1707,7 @@ function checkMetaMaterial(v, p) {
1667
1707
  unique(v.audiences.map((a) => a.audienceRuleRef.id), p + ".audiences");
1668
1708
  unique(v.channel.audienceRuleRefs.map((a) => a.id), p + ".channel.audienceRuleRefs");
1669
1709
  if (v.audiences.length !== v.channel.audienceRuleRefs.length) fail2(p + ".audiences", "must cover exactly the original logical audiences");
1710
+ checkMetaAudienceBands(v.channel, p + ".channel.audienceRuleRefs");
1670
1711
  for (const a of v.audiences) {
1671
1712
  if (!v.channel.audienceRuleRefs.some((ref) => canonical(ref) === canonical(a.audienceRuleRef))) fail2(p + ".audiences", "original logical audience version mismatch");
1672
1713
  unique(a.excludedResourceRuleRefs.map((ref) => ref.id), p + ".audiences.excludedResourceRuleRefs");
@@ -1798,7 +1839,7 @@ function parseResonanceObservationSupport(v) {
1798
1839
  }
1799
1840
  return r;
1800
1841
  }
1801
- var observationsPage = object2({ items: list2(publicObservationMetric, 300), nextCursor: nullable2(uuid), observedAt: instant, support: list2(observationSupport, 300) });
1842
+ var observationsPage = object2({ items: list2(publicObservationMetric, 500), nextCursor: nullable2(uuid), observedAt: instant, support: list2(observationSupport, 500) });
1802
1843
  function parseResonanceObservationsPage(v) {
1803
1844
  const r = observationsPage.read(v, "observationsPage"), p = "observationsPage";
1804
1845
  if (r.items.length !== r.support.length) fail2(p + ".support", "requires one support entry for each metric item");
@@ -1822,7 +1863,7 @@ function parseResonanceObservationsPage(v) {
1822
1863
  rows.set(rowId, row);
1823
1864
  if (s.source === "provider") {
1824
1865
  if (item.state === "observed" && (s.coverage !== "complete" || s.coverageBasis !== "closed_query_snapshot" || s.reasonCode !== null)) fail2(p + ".support", "observed provider values require complete genuine closed-query support");
1825
- if (!["spend", "impressions", "clicks"].includes(item.name) || item.sourceRef !== item.observationId || item.countingUnit !== "provider_aggregate" || item.attributionModel !== "provider_reported") fail2(p + ".items", "provider metrics retain exact native observation and aggregate semantics");
1866
+ if (!RESONANCE_PROVIDER_METRIC_NAMES.includes(item.name) || item.sourceRef !== item.observationId || item.countingUnit !== providerCountingUnit(item.name) || item.attributionModel !== "provider_reported") fail2(p + ".items", "provider metrics retain exact native observation and aggregate semantics");
1826
1867
  if (s.readClock !== null && Date.parse(s.readClock.notBeforeAt) < Date.parse(item.windowEnd)) fail2(p + ".support.readClock", "SQL pre-read lower bound must follow the completed query window");
1827
1868
  } else {
1828
1869
  const d = s.denominators;
@@ -1840,5 +1881,203 @@ function parseResonanceObservationsPage(v) {
1840
1881
  var RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA = publicObservationMetric.schema;
1841
1882
  var RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA = observationSupport.schema;
1842
1883
  var RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA = observationsPage.schema;
1884
+ var META_WEBSITE_AUDIENCE_MAX_RETENTION_DAYS = 180;
1885
+ var META_AUDIENCE_RULE_LIMIT = 10;
1886
+ var META_SAC_CUSTOM_AUDIENCE_EXCLUSION_VERIFIED = false;
1887
+ var META_CALL_TO_ACTIONS = ["LEARN_MORE", "SIGN_UP", "SHOP_NOW", "APPLY_NOW", "BOOK_TRAVEL", "CONTACT_US", "GET_QUOTE"];
1888
+ var RESONANCE_MAX_CHANNELS_PER_GROUP = 20;
1889
+ var RESONANCE_PROVIDER_METRIC_NAMES = ["spend", "impressions", "clicks", "reach", "results"];
1890
+ var providerCountingUnit = (name) => name === "reach" ? "provider_unique_reach" : "provider_aggregate";
1891
+ var isMetaChannel = (c) => c.kind === "meta_retargeting";
1892
+ var usesPropertyModel = (c) => c.channelGroup !== void 0 || c.audienceRuleRefs.some((ref) => ref.minDaysSinceVisit !== void 0);
1893
+ function checkAudienceBand(ref, provider = "meta_ads", at = "audienceRuleRef") {
1894
+ const min = ref.minDaysSinceVisit;
1895
+ if (min !== void 0 && min >= ref.retentionDays) fail2(at + ".minDaysSinceVisit", "must be shorter than the retention window");
1896
+ if (provider === "google_ads") {
1897
+ if (min !== void 0) fail2(at + ".minDaysSinceVisit", "Google audiences have no recency band");
1898
+ return;
1899
+ }
1900
+ if (ref.retentionDays > META_WEBSITE_AUDIENCE_MAX_RETENTION_DAYS) fail2(at + ".retentionDays", `exceeds the ${META_WEBSITE_AUDIENCE_MAX_RETENTION_DAYS}-day Meta website audience maximum`);
1901
+ if (1 + ref.exclusionRuleIds.length + (min === void 0 ? 0 : 1) > META_AUDIENCE_RULE_LIMIT) fail2(at + ".exclusionRuleIds", `a Meta audience holds at most ${META_AUDIENCE_RULE_LIMIT} rules including the page and any recency band`);
1902
+ }
1903
+ function checkMetaAudienceBands(channel2, at) {
1904
+ if (!usesPropertyModel(channel2)) return;
1905
+ channel2.audienceRuleRefs.forEach((ref, index) => checkAudienceBand(ref, "meta_ads", `${at}[${index}]`));
1906
+ }
1907
+ var bandsOverlap = (a, b) => (a.minDaysSinceVisit ?? 0) < b.retentionDays && (b.minDaysSinceVisit ?? 0) < a.retentionDays;
1908
+ function checkChannelGroups(channels) {
1909
+ const groups = /* @__PURE__ */ new Map();
1910
+ for (const c of channels) if (isMetaChannel(c) && c.channelGroup) groups.set(c.channelGroup.key, [...groups.get(c.channelGroup.key) ?? [], c]);
1911
+ for (const [key, members] of groups) {
1912
+ const at = `campaign.channelGroup.${key}`;
1913
+ if (members.length > RESONANCE_MAX_CHANNELS_PER_GROUP) fail2(at, `at most ${RESONANCE_MAX_CHANNELS_PER_GROUP} channels per group`);
1914
+ const first = members[0];
1915
+ const shared = (c) => canonical([c.site, c.accountBindingId, c.datasetRef.id, c.pageRef, c.instagramRef, c.specialCategories, c.countryCodes, c.objective, c.optimization]);
1916
+ const identity = /* @__PURE__ */ new Set(), destinationOf = /* @__PURE__ */ new Map(), propertyOfDestination = /* @__PURE__ */ new Map();
1917
+ for (const c of members) {
1918
+ if (shared(c) !== shared(first)) fail2(at, "channels in one group must share site, account, dataset, Page, categories, countries, objective and optimization");
1919
+ if (c.specialCategories.length > 0 && c.ageConstraint?.mode !== "provider_managed") fail2(at + ".ageConstraint", "a special category requires provider-managed age");
1920
+ const pk = (c.property ?? fail2(at + ".property", "a grouped channel names its property")).key, tier = c.tier?.label ?? "", id = `${pk}|${tier}`;
1921
+ if (identity.has(id)) fail2(at + ".property", "two channels share one property and tier");
1922
+ identity.add(id);
1923
+ if (destinationOf.has(pk) && destinationOf.get(pk) !== c.destinationId) fail2(at + ".destinationId", "channels for one property share one destination");
1924
+ destinationOf.set(pk, c.destinationId);
1925
+ const other = propertyOfDestination.get(c.destinationId);
1926
+ if (other !== void 0 && other !== pk) fail2(at + ".destinationId", "channels for different properties have different destinations");
1927
+ propertyOfDestination.set(c.destinationId, pk);
1928
+ }
1929
+ for (let i = 0; i < members.length; i++) for (let j = i + 1; j < members.length; j++) {
1930
+ if (members[i].property?.key !== members[j].property?.key) continue;
1931
+ for (const a of members[i].audienceRuleRefs) for (const b of members[j].audienceRuleRefs) if (bandsOverlap(a, b)) fail2(at + ".audienceRuleRefs", "tiers of one property cannot overlap in time");
1932
+ }
1933
+ }
1934
+ }
1935
+ function checkGroupedAllocations(v) {
1936
+ if (!v.channels.some((c) => isMetaChannel(c) && c.channelGroup)) return;
1937
+ let sum = 0n;
1938
+ for (const c of v.channels) if ("allocation" in c) sum += BigInt(c.allocation.amountMicros);
1939
+ if (sum > BigInt(v.budget.total.amountMicros) - BigInt(v.budget.reserveMargin.amountMicros)) fail2("campaign.channels.allocation", "channel allocations exceed the campaign total less its reserve");
1940
+ }
1941
+ function splitBudget(total, weights, quantumMicros) {
1942
+ const t = parseMoney(total), at = "splitBudget";
1943
+ if (!/^[1-9][0-9]{0,29}$/.test(quantumMicros)) fail2(at + ".quantumMicros", "must be a positive whole number of micros");
1944
+ if (weights.length < 1 || weights.length > 100 || weights.some((w) => !Number.isSafeInteger(w) || w < 1)) fail2(at + ".weights", "one to 100 positive whole weights");
1945
+ const quantum = BigInt(quantumMicros), micros = BigInt(t.amountMicros);
1946
+ if (micros % quantum !== 0n) fail2(at + ".total", "must be a whole number of provider quanta");
1947
+ const units = micros / quantum, sum = weights.reduce((a, w) => a + BigInt(w), 0n);
1948
+ const parts = weights.map((w, index) => ({ index, floor: units * BigInt(w) / sum, rest: units * BigInt(w) % sum }));
1949
+ let left = units - parts.reduce((a, p) => a + p.floor, 0n);
1950
+ const order = [...parts].sort((a, b) => a.rest === b.rest ? a.index - b.index : a.rest > b.rest ? -1 : 1);
1951
+ const extra = /* @__PURE__ */ new Set();
1952
+ for (const p of order) {
1953
+ if (left === 0n) break;
1954
+ extra.add(p.index);
1955
+ left -= 1n;
1956
+ }
1957
+ return parts.map((p) => ({ currency: t.currency, amountMicros: ((p.floor + (extra.has(p.index) ? 1n : 0n)) * quantum).toString() }));
1958
+ }
1959
+ function suggestPropertyWeights(visitors, bounds = {}) {
1960
+ const floor = bounds.floorBasisPoints ?? 1e3, ceiling = bounds.ceilingBasisPoints ?? 4e3, n = visitors.length, at = "suggestPropertyWeights";
1961
+ if (n < 1 || n > 100 || visitors.some((v) => !Number.isSafeInteger(v) || v < 0)) fail2(at + ".visitors", "one to 100 whole, non-negative visitor counts");
1962
+ if (!Number.isInteger(floor) || !Number.isInteger(ceiling) || floor < 0 || ceiling > 1e4 || floor > ceiling || n * floor > 1e4 || n * ceiling < 1e4) fail2(at + ".bounds", "floor and ceiling cannot hold every share");
1963
+ const weight = visitors.map((v) => v + 1);
1964
+ const total = (lambda) => weight.reduce((a, w) => a + Math.min(ceiling, Math.max(floor, lambda * w)), 0);
1965
+ let low = 0, high = ceiling / Math.min(...weight) + 1;
1966
+ for (let i = 0; i < 200; i++) {
1967
+ const mid = (low + high) / 2;
1968
+ if (total(mid) < 1e4) low = mid;
1969
+ else high = mid;
1970
+ }
1971
+ const share = weight.map((w) => Math.min(ceiling, Math.max(floor, high * w)));
1972
+ const whole = share.map(Math.floor), rest = share.map((value, i) => ({ i, rest: value - whole[i] })).sort((a, b) => b.rest - a.rest || a.i - b.i);
1973
+ let left = 1e4 - whole.reduce((a, b) => a + b, 0);
1974
+ for (const r of rest) {
1975
+ if (left <= 0) break;
1976
+ whole[r.i] += 1;
1977
+ left -= 1;
1978
+ }
1979
+ return whole;
1980
+ }
1981
+ function deterministicUuid(seed) {
1982
+ const mask = (1n << 64n) - 1n, prime = 0x100000001b3n, bytes = new TextEncoder().encode(seed);
1983
+ const hash = (basis) => {
1984
+ let h = basis;
1985
+ for (const b of bytes) {
1986
+ h ^= BigInt(b);
1987
+ h = h * prime & mask;
1988
+ }
1989
+ return h.toString(16).padStart(16, "0");
1990
+ };
1991
+ const hex = hash(0xcbf29ce484222325n) + hash(0x84222325cbf29ce4n);
1992
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-5${hex.slice(13, 16)}-${"89ab"[parseInt(hex[16], 16) & 3]}${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
1993
+ }
1994
+ var PLACEHOLDER_CREATIVE_ID = "00000000-0000-4000-8000-000000000000";
1995
+ var clip = (value, max) => value.length <= max ? value : value.slice(0, max);
1996
+ function expandPropertyChannels(definition2, groupKey, additions, options) {
1997
+ const at = "expandPropertyChannels";
1998
+ const group = definition2.channels.filter((c) => isMetaChannel(c) && c.channelGroup?.key === groupKey);
1999
+ if (!group.length) fail2(at + ".group", "needs an existing property channel to use as the template");
2000
+ const template = group[0];
2001
+ const present = new Set(group.map((c) => c.property?.key));
2002
+ const keys = additions.map((a) => a.key);
2003
+ unique(keys, at + ".additions");
2004
+ const fresh = additions.filter((a) => !present.has(a.key));
2005
+ if (!fresh.length) return { channels: [], allocations: [], blockingReasons: [] };
2006
+ const weightOf = (key, own) => own ?? options.weights?.[key] ?? 1;
2007
+ const members = [...group.map((c) => ({ key: c.property.key, id: c.id, weight: weightOf(c.property.key) })), ...fresh.map((a) => ({ key: a.key, id: deterministicUuid(`${definition2.projectId}|${definition2.slug}|${groupKey}|${a.key}`), weight: weightOf(a.key, a.weight) }))];
2008
+ const total = group.reduce((a, c) => addMoney(a, c.allocation), { currency: template.allocation.currency, amountMicros: "0" });
2009
+ const split = splitBudget(total, members.map((m) => m.weight), options.quantumMicros);
2010
+ const allocations = members.map((m, i) => ({ channelId: m.id, allocation: split[i] }));
2011
+ const { tier: _tier, primaryText: _primary, convertersAcknowledged: _converters, ...rest } = template;
2012
+ const channels = fresh.map((a) => {
2013
+ const id = members.find((m) => m.key === a.key).id;
2014
+ const proposal = {
2015
+ ...rest,
2016
+ id,
2017
+ localCampaignKey: clip(`${groupKey}-${a.key}`, 80),
2018
+ localAdSetKey: clip(`${a.key}-visitors`, 80),
2019
+ localAdKey: clip(`${a.key}-1`, 80),
2020
+ property: { key: a.key, label: a.label },
2021
+ destinationId: a.destinationId,
2022
+ audienceRuleRefs: a.audienceRuleRefs,
2023
+ creativeIds: [],
2024
+ allocation: allocations.find((x) => x.channelId === id).allocation
2025
+ };
2026
+ meta.read({ ...proposal, creativeIds: [PLACEHOLDER_CREATIVE_ID] }, at + ".channel");
2027
+ return proposal;
2028
+ });
2029
+ const combined = [...definition2.channels, ...channels.map((c) => ({ ...c, creativeIds: [PLACEHOLDER_CREATIVE_ID] }))];
2030
+ unique(combined.map((c) => c.id), at + ".channels");
2031
+ checkChannelGroups(combined);
2032
+ const changed = group.some((c) => canonical(allocations.find((x) => x.channelId === c.id).allocation) !== canonical(c.allocation));
2033
+ return { channels, allocations, blockingReasons: [...fresh.map((a) => `property_creative_required:${a.key}`), ...changed ? ["rebalance_changes_running_allocations"] : []] };
2034
+ }
2035
+ function metaExclusionPolicy(channel2, use) {
2036
+ const special = channel2.specialCategories.length > 0;
2037
+ if (use.targetingLevel && special && !META_SAC_CUSTOM_AUDIENCE_EXCLUSION_VERIFIED) return { allowed: false, reason: "meta_exclusion_targeting_blocked_special_category", requiresEligibilityReadback: false };
2038
+ return { allowed: true, reason: null, requiresEligibilityReadback: special && (use.inRule || use.targetingLevel) };
2039
+ }
2040
+ function deriveProviderRatios(items) {
2041
+ const unknown = (reasonCode) => ({ frequency: { state: "unknown", reasonCode }, costPerResult: { state: "unknown", reasonCode }, reasonCodes: [reasonCode] });
2042
+ if (!items.length) return unknown("no_inputs");
2043
+ const first = items[0];
2044
+ if (items.some((i) => i.source !== "provider" || i.state !== "observed" || i.observationId === void 0 || i.observationId !== first.observationId || i.channelId !== first.channelId || i.windowStart !== first.windowStart || i.windowEnd !== first.windowEnd)) return unknown("mixed_inputs");
2045
+ const named = (name) => items.filter((i) => i.name === name);
2046
+ if (RESONANCE_PROVIDER_METRIC_NAMES.some((name) => named(name).length > 1)) return unknown("duplicate_metric");
2047
+ const count = (name) => {
2048
+ const i = named(name)[0];
2049
+ return i && i.state === "observed" && i.value?.kind === "count" ? BigInt(i.value.count) : null;
2050
+ };
2051
+ const spend = () => {
2052
+ const i = named("spend")[0];
2053
+ return i && i.state === "observed" && i.value?.kind === "money" ? i.value.money : null;
2054
+ };
2055
+ const reasons = [];
2056
+ let frequency;
2057
+ const impressions = count("impressions"), reach = count("reach");
2058
+ if (impressions === null || reach === null) {
2059
+ frequency = { state: "unknown", reasonCode: impressions === null ? "missing_impressions" : "missing_reach" };
2060
+ reasons.push(frequency.reasonCode);
2061
+ } else if (reach === 0n) {
2062
+ frequency = { state: "unknown", reasonCode: "no_reach" };
2063
+ reasons.push("no_reach");
2064
+ } else frequency = { state: "observed", value: { kind: "ratio", numerator: impressions.toString(), denominator: reach.toString() } };
2065
+ let costPerResult;
2066
+ const money2 = spend(), results = count("results");
2067
+ if (money2 === null || results === null) {
2068
+ costPerResult = { state: "unknown", reasonCode: money2 === null ? "missing_spend" : "missing_results" };
2069
+ reasons.push(costPerResult.reasonCode);
2070
+ } else if (results === 0n) {
2071
+ costPerResult = { state: "unknown", reasonCode: "no_results" };
2072
+ reasons.push("no_results");
2073
+ } else {
2074
+ const micros = BigInt(money2.amountMicros);
2075
+ let quotient = micros / results;
2076
+ const twice = 2n * (micros % results);
2077
+ if (twice > results || twice === results && quotient % 2n === 1n) quotient += 1n;
2078
+ costPerResult = { state: "observed", money: { currency: money2.currency, amountMicros: quotient.toString() } };
2079
+ }
2080
+ return { frequency, costPerResult, reasonCodes: reasons };
2081
+ }
1843
2082
 
1844
- export { MAX_MONEY_MICROS, 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_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_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_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_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, ResonanceValidationError, addMoney, compareMoney, cpqlMissingOutcomeBound, formatMoney, googleConversionActionSemantics, googleUploadClicksSetupSemantics, 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, parseResonanceMetaConfigurationSaveCommand, parseResonanceMetaConfigurationSaveResponse, parseResonanceMetaConfigurationSnapshot, parseResonanceMetaConfigurationView, parseResonanceMetricObservation, parseResonanceObservationSupport, parseResonanceObservationsPage, parseResonanceOccurrenceResponse, parseResonanceOptimizationDecision, parseResonanceOptimizationEvidence, parseResonanceOptimizationPolicy, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceProviderReportingGrant, parseResonanceProviderReportingSelection, parseResonancePublicObservationMetric, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, reportedCpqlMissingOutcomeBound, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, subtractMoney };
2083
+ 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_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_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, 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, parseResonanceMetaConfigurationSaveCommand, parseResonanceMetaConfigurationSaveResponse, parseResonanceMetaConfigurationSnapshot, parseResonanceMetaConfigurationView, parseResonanceMetricObservation, parseResonanceObservationSupport, parseResonanceObservationsPage, parseResonanceOccurrenceResponse, parseResonanceOptimizationDecision, parseResonanceOptimizationEvidence, parseResonanceOptimizationPolicy, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceProviderReportingGrant, parseResonanceProviderReportingSelection, parseResonancePublicObservationMetric, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, reportedCpqlMissingOutcomeBound, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, splitBudget, subtractMoney, suggestPropertyWeights };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonordev/contracts",
3
- "version": "2.21.0",
3
+ "version": "2.22.0",
4
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.",
5
5
  "license": "MIT",
6
6
  "repository": {