@sonordev/contracts 2.21.0 → 2.23.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;
@@ -577,9 +612,16 @@ var websiteVisitFeed = object2({ profile: literal2(RESONANCE_WEBSITE_VISIT_PROFI
577
612
  }), 100, 1) });
578
613
  var RESONANCE_WEBSITE_VISIT_FEED_JSON_SCHEMA = websiteVisitFeed.schema;
579
614
  var providerReportingChannelIds = refine2(uniqueList(uuid, 100, 1), (ids, p) => unique(ids.map((id) => id.toLowerCase()), p));
580
- var providerReportingSelection = object2({ agentContactId: uuid, channelIds: providerReportingChannelIds });
581
- var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds }), (v, p) => {
615
+ var RESONANCE_META_QUERY_ATTRIBUTION_WINDOWS = ["1d_click", "7d_click", "1d_view"];
616
+ var metaReportingQuery = object2({ channelId: uuid, attributionWindow: choice2(...RESONANCE_META_QUERY_ATTRIBUTION_WINDOWS), actionReportTime: literal2("conversion"), basis: literal2("explicit_query") });
617
+ var providerReportingMetaQueries = refine2(list2(metaReportingQuery, 100, 1), (queries, p) => unique(queries.map((query) => query.channelId.toLowerCase()), p));
618
+ function checkReportingQuerySubset(v, p) {
619
+ if (v.metaQueries?.some((query) => !v.channelIds.some((id) => id.toLowerCase() === query.channelId.toLowerCase()))) fail2(p + ".metaQueries", "query channel must be selected");
620
+ }
621
+ var providerReportingSelection = refine2(object2({ agentContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries) }), checkReportingQuerySubset);
622
+ var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries) }), (v, p) => {
582
623
  if (v.agentContactId.toLowerCase() === v.principalContactId.toLowerCase()) fail2(p + ".principalContactId", "agent and human principal must remain distinct");
624
+ checkReportingQuerySubset(v, p);
583
625
  });
584
626
  var parseResonanceProviderReportingSelection = (v) => providerReportingSelection.read(v, "providerReportingSelection");
585
627
  var parseResonanceProviderReportingGrant = (v) => providerReportingGrant.read(v, "providerReportingGrant");
@@ -602,7 +644,7 @@ function parseResonanceMandateScope(v, preparedPlan) {
602
644
  if (r.projectId !== plan.projectId || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || canonical(r.goal) !== canonical(plan.definition.objective) || canonical(r.budget) !== canonical(plan.definition.budget)) fail2(p, "requires the exact original plan, review, goal and flight");
603
645
  if (r.sites.some((site2) => !plan.definition.sites.includes(site2)) || r.accountBindingIds.some((id) => !plan.accounts.some((account) => account.id === id))) fail2(p, "mandate sites and accounts must stay inside the original plan");
604
646
  for (const id of grant.channelIds) {
605
- const channel2 = plan.definition.channels.find((c) => c.id === id);
647
+ const channel2 = plan.definition.channels.find((c) => c.id.toLowerCase() === id.toLowerCase());
606
648
  if (!channel2 || !("provider" in channel2) || !r.sites.includes(channel2.site) || !r.accountBindingIds.includes(channel2.accountBindingId)) fail2(p + ".channelIds", "requires an explicit original paid channel inside mandate sites and accounts");
607
649
  }
608
650
  }
@@ -881,12 +923,13 @@ function parseResonanceCampaignView(v) {
881
923
  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
924
  if (v === "0") fail2(p, "zero denominator");
883
925
  }) }));
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) })) };
926
+ 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
927
  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
928
  function parseResonanceMetricObservation(v) {
887
929
  const r = metric.read(v, "metric");
888
930
  if (["accepted_goals", "qualified_goals", "revenue", "conversion_rate"].includes(r.name) && r.goalRevision === null) fail2("metric.goalRevision", "goal measurement requires explicit revision");
889
931
  if (Date.parse(r.windowEnd) <= Date.parse(r.windowStart)) fail2("metric.window", "invalid window");
932
+ if (r.name === "reach" !== (r.countingUnit === "provider_unique_reach")) fail2("metric.countingUnit", "reach, and only reach, counts unique provider reach");
890
933
  if (r.state === "observed") {
891
934
  const expected = r.name === "spend" || r.name === "revenue" ? "money" : r.name === "conversion_rate" ? "ratio" : "count";
892
935
  if (r.value.kind !== expected) fail2("metric.value", "metric unit mismatch");
@@ -1227,8 +1270,8 @@ function parseResonanceOptimizationEvidence(v, preparedPlan) {
1227
1270
  parseResonanceMetricObservation(o);
1228
1271
  if (o.projectId !== r.projectId || o.campaignId !== r.campaignId || o.site !== c.site) fail2(p + ".candidates.ownMeasurement", "foreign candidate measurement scope");
1229
1272
  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");
1273
+ const aggregate = o.source === "provider" && RESONANCE_PROVIDER_METRIC_NAMES.includes(o.name);
1274
+ 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
1275
  }
1233
1276
  }
1234
1277
  return r;
@@ -1368,9 +1411,11 @@ function checkOptimizationDecisionEvidence(d, e) {
1368
1411
  }
1369
1412
  var RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA = optimizationEvidence.schema;
1370
1413
  var RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA = optimizationDecision.schema;
1414
+ var metaBrowserWitness = object2({ controlsRevision: text2(60, /^[A-Z][A-Z0-9_]*$/), policyRevision: revision, witnessId: uuid, assertedAt: instant });
1371
1415
  var publicDestination = union2(
1372
1416
  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]+$/) })
1417
+ // browserWitness and tagManagerAttested are optional so configurations from before the Meta loader keep parsing; absent means no Meta browser loading.
1418
+ object2({ provider: literal2("meta_ads"), id: uuid, pixelId: text2(40, /^[0-9]+$/), browserWitness: optional2(metaBrowserWitness), tagManagerAttested: optional2(bool) })
1374
1419
  );
1375
1420
  var interestResource = object2({ ...scope, type: choice2("page", "article", "product", "listing"), id: text2(160, /^[a-zA-Z0-9._:-]+$/), revision });
1376
1421
  var measurementConfig = object2({
@@ -1382,7 +1427,8 @@ var measurementConfig = object2({
1382
1427
  enabled: bool,
1383
1428
  consentPolicy: object2({ mode: literal2("basic"), requiredPurposes: list2(purpose, 4, 1) }),
1384
1429
  destinations: list2(publicDestination, 10),
1385
- resourceRules: list2(object2({ id: uuid, revision, site, resource: interestResource, path, interestKey: text2(100, /^[a-zA-Z0-9._:-]+$/) }), 500)
1430
+ // metaEligible is set by a person with owner or admin standing; absent means false. The browser never decides it.
1431
+ resourceRules: list2(object2({ id: uuid, revision, site, resource: interestResource, path, interestKey: text2(100, /^[a-zA-Z0-9._:-]+$/), metaEligible: optional2(bool) }), 500)
1386
1432
  });
1387
1433
  function parseResonanceMeasurementConfig(v) {
1388
1434
  const r = measurementConfig.read(v, "measurementConfig");
@@ -1494,11 +1540,12 @@ var audienceDraft = object2({
1494
1540
  schemaVersion: literal2(1),
1495
1541
  expectedRevision: optional2(integer2(1)),
1496
1542
  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 })
1543
+ 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
1544
  });
1499
1545
  function parseResonanceAudienceDraftSaveCommand(v) {
1500
1546
  const r = audienceDraft.read(v, "audienceDraftSave");
1501
1547
  unique(r.definition.excludedResourceRuleIds, "audienceDraftSave.definition.excludedResourceRuleIds");
1548
+ if (r.definition.minDaysSinceVisit !== void 0 && r.definition.minDaysSinceVisit >= r.definition.retentionDays) fail2("audienceDraftSave.definition.minDaysSinceVisit", "must be shorter than the retention window");
1502
1549
  return r;
1503
1550
  }
1504
1551
  var RESONANCE_AUDIENCE_DRAFT_SAVE_COMMAND_JSON_SCHEMA = audienceDraft.schema;
@@ -1624,7 +1671,8 @@ var RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA = measurementSa
1624
1671
  var RESONANCE_MEASUREMENT_CONFIGURATION_CURRENT_JSON_SCHEMA = measurementCurrent.schema;
1625
1672
  var RESONANCE_MEASUREMENT_CONFIGURATION_SNAPSHOT_JSON_SCHEMA = measurementSnapshot.schema;
1626
1673
  var RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA = measurementSaveResponse.schema;
1627
- var nativeAudienceRef = object2({ externalId: text2(160, /^[0-9]+(?![\s\S])/), revision: digest });
1674
+ var nativeAudienceId = text2(160, /^[0-9]+(?![\s\S])/);
1675
+ var nativeAudienceRef = object2({ externalId: nativeAudienceId, revision: digest });
1628
1676
  var metaSave = refine2(object2({
1629
1677
  schemaVersion: literal2(1),
1630
1678
  expectedCampaignRevision: integer2(1),
@@ -1667,6 +1715,7 @@ function checkMetaMaterial(v, p) {
1667
1715
  unique(v.audiences.map((a) => a.audienceRuleRef.id), p + ".audiences");
1668
1716
  unique(v.channel.audienceRuleRefs.map((a) => a.id), p + ".channel.audienceRuleRefs");
1669
1717
  if (v.audiences.length !== v.channel.audienceRuleRefs.length) fail2(p + ".audiences", "must cover exactly the original logical audiences");
1718
+ checkMetaAudienceBands(v.channel, p + ".channel.audienceRuleRefs");
1670
1719
  for (const a of v.audiences) {
1671
1720
  if (!v.channel.audienceRuleRefs.some((ref) => canonical(ref) === canonical(a.audienceRuleRef))) fail2(p + ".audiences", "original logical audience version mismatch");
1672
1721
  unique(a.excludedResourceRuleRefs.map((ref) => ref.id), p + ".audiences.excludedResourceRuleRefs");
@@ -1712,6 +1761,63 @@ var metaView = refine2(union2(
1712
1761
  if (v.readyForReview !== metaReviewable(s, v)) fail2(p + ".readyForReview", "must reflect current review prerequisites only");
1713
1762
  });
1714
1763
  var parseResonanceMetaConfigurationView = (v) => metaView.read(v, "metaConfigurationView");
1764
+ var RESONANCE_META_AUDIENCE_VERDICTS = ["ready", "too_small", "blocked", "unknown"];
1765
+ var RESONANCE_META_AUDIENCE_REASONS = [
1766
+ "meta_audience_status_unreadable",
1767
+ "meta_audience_status_unrecognized",
1768
+ "meta_audience_integrity_flagged",
1769
+ "meta_audience_account_inactive",
1770
+ "meta_audience_pixel_problem",
1771
+ "meta_audience_error",
1772
+ "meta_audience_out_of_date",
1773
+ "meta_audience_too_small",
1774
+ "meta_audience_not_usable",
1775
+ "meta_audience_prefill_failed",
1776
+ "meta_audience_filling",
1777
+ "meta_audience_category_unknown",
1778
+ "meta_url_audience_unverified",
1779
+ "meta_core_setup_suspected",
1780
+ "meta_audience_fill_mismatch",
1781
+ "meta_core_setup_attestation_missing",
1782
+ "meta_flight_too_short_after_wait",
1783
+ "meta_terms_nondiscrimination_pending",
1784
+ "meta_terms_custom_audience_unconfirmed",
1785
+ "meta_terms_business_tools_pending",
1786
+ "meta_special_category_age_must_be_provider_managed",
1787
+ "meta_special_category_genders_not_allowed",
1788
+ "meta_audience_name_sensitive"
1789
+ ];
1790
+ var metaReadinessPage = object2({ resourceRuleRef: measurementRuleRef, path: observedPagePath, label: nullable2(friendlyName) });
1791
+ var metaAudienceSize = refine2(object2({ lower: integer2(0), upper: integer2(0) }), (v, p) => {
1792
+ if (v.upper < v.lower) fail2(p, "size bounds must be ordered");
1793
+ });
1794
+ var metaReadinessCheck = union2(
1795
+ object2({ state: literal2("not_checked"), reasonCode: choice2("configuration_unavailable", "native_mapping_unavailable") }),
1796
+ object2({ state: literal2("observed"), mappingSource: choice2("selected_external_audience", "current_materialized_audience"), verdict: choice2(...RESONANCE_META_AUDIENCE_VERDICTS), reasonCodes: uniqueList(choice2(...RESONANCE_META_AUDIENCE_REASONS), 50), size: nullable2(metaAudienceSize), observedAt: instant, expiresAt: nullable2(instant), sizeObservedAt: literal2(null), sizeExpiresAt: literal2(null) })
1797
+ );
1798
+ var metaReadinessAudience = object2({ audienceRuleRef: audience, name: friendlyName, includedPage: metaReadinessPage, excludedPages: list2(metaReadinessPage, 50), nativeAudienceId: nullable2(nativeAudienceId), check: metaReadinessCheck });
1799
+ var metaRetargetingReadiness = refine2(object2({ schemaVersion: literal2(1), projectId: uuid, campaignId: uuid, channelId: uuid, site, campaignRevision: integer2(1), accountBindingId: uuid, configuration: metaView, audiences: list2(metaReadinessAudience, 50) }), (v, p) => {
1800
+ const sameId = (a, b) => a.toLowerCase() === b.toLowerCase();
1801
+ const config = v.configuration;
1802
+ if (!sameId(config.projectId, v.projectId) || !sameId(config.campaignId, v.campaignId) || !sameId(config.channelId, v.channelId)) fail2(p + ".configuration", "configuration scope mismatch");
1803
+ if (config.kind === "configured" && (config.currentCampaignRevision !== v.campaignRevision || config.snapshot.site !== v.site || !sameId(config.snapshot.account.id, v.accountBindingId))) fail2(p + ".configuration", "current configuration revision, site or account mismatch");
1804
+ unique(v.audiences.map((row) => row.audienceRuleRef.id.toLowerCase()), p + ".audiences");
1805
+ for (const row of v.audiences) {
1806
+ if (!sameId(row.audienceRuleRef.projectId, v.projectId) || row.audienceRuleRef.site !== v.site) fail2(p + ".audiences", "audience scope mismatch");
1807
+ const excluded = row.excludedPages.map((page2) => page2.resourceRuleRef.id.toLowerCase());
1808
+ unique(excluded, p + ".audiences.excludedPages");
1809
+ const expected = row.audienceRuleRef.exclusionRuleIds.map((id) => id.toLowerCase());
1810
+ unique(expected, p + ".audiences.audienceRuleRef.exclusionRuleIds");
1811
+ if (excluded.includes(row.includedPage.resourceRuleRef.id.toLowerCase()) || excluded.length !== expected.length || expected.some((id) => !excluded.includes(id))) fail2(p + ".audiences.excludedPages", "exclusion rule scope mismatch");
1812
+ if (row.check.state === "observed" && (row.nativeAudienceId === null || config.kind !== "configured")) fail2(p + ".audiences.check", "observed check requires configured scope and actual native audience identity");
1813
+ if (config.kind === "configured" && config.currentDefinitionDigest === config.snapshot.reviewedDefinitionDigest) {
1814
+ const original = config.snapshot.audiences.find((a) => sameId(a.audienceRuleRef.id, row.audienceRuleRef.id));
1815
+ if (!original || canonical(original.audienceRuleRef) !== canonical(row.audienceRuleRef) || canonical(original.resourceRuleRef) !== canonical(row.includedPage.resourceRuleRef) || original.excludedResourceRuleRefs.length !== row.excludedPages.length || original.excludedResourceRuleRefs.some((ref) => !row.excludedPages.some((page2) => canonical(page2.resourceRuleRef) === canonical(ref)))) fail2(p + ".audiences", "original audience and page rule versions must match");
1816
+ }
1817
+ }
1818
+ });
1819
+ var parseResonanceMetaRetargetingReadiness = (v) => metaRetargetingReadiness.read(v, "metaRetargetingReadiness");
1820
+ var RESONANCE_META_RETARGETING_READINESS_JSON_SCHEMA = metaRetargetingReadiness.schema;
1715
1821
  var metaSaveResponse = object2({ schemaVersion: literal2(1), snapshot: metaSnapshot, replayed: bool });
1716
1822
  var parseResonanceMetaConfigurationSaveResponse = (v) => metaSaveResponse.read(v, "metaConfigurationSaveResponse");
1717
1823
  function projectResonanceMetaConfiguration(v, currentMetadata) {
@@ -1798,7 +1904,7 @@ function parseResonanceObservationSupport(v) {
1798
1904
  }
1799
1905
  return r;
1800
1906
  }
1801
- var observationsPage = object2({ items: list2(publicObservationMetric, 300), nextCursor: nullable2(uuid), observedAt: instant, support: list2(observationSupport, 300) });
1907
+ var observationsPage = object2({ items: list2(publicObservationMetric, 500), nextCursor: nullable2(uuid), observedAt: instant, support: list2(observationSupport, 500) });
1802
1908
  function parseResonanceObservationsPage(v) {
1803
1909
  const r = observationsPage.read(v, "observationsPage"), p = "observationsPage";
1804
1910
  if (r.items.length !== r.support.length) fail2(p + ".support", "requires one support entry for each metric item");
@@ -1822,7 +1928,7 @@ function parseResonanceObservationsPage(v) {
1822
1928
  rows.set(rowId, row);
1823
1929
  if (s.source === "provider") {
1824
1930
  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");
1931
+ 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
1932
  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
1933
  } else {
1828
1934
  const d = s.denominators;
@@ -1840,5 +1946,203 @@ function parseResonanceObservationsPage(v) {
1840
1946
  var RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA = publicObservationMetric.schema;
1841
1947
  var RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA = observationSupport.schema;
1842
1948
  var RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA = observationsPage.schema;
1949
+ var META_WEBSITE_AUDIENCE_MAX_RETENTION_DAYS = 180;
1950
+ var META_AUDIENCE_RULE_LIMIT = 10;
1951
+ var META_SAC_CUSTOM_AUDIENCE_EXCLUSION_VERIFIED = false;
1952
+ var META_CALL_TO_ACTIONS = ["LEARN_MORE", "SIGN_UP", "SHOP_NOW", "APPLY_NOW", "BOOK_TRAVEL", "CONTACT_US", "GET_QUOTE"];
1953
+ var RESONANCE_MAX_CHANNELS_PER_GROUP = 20;
1954
+ var RESONANCE_PROVIDER_METRIC_NAMES = ["spend", "impressions", "clicks", "reach", "results"];
1955
+ var providerCountingUnit = (name) => name === "reach" ? "provider_unique_reach" : "provider_aggregate";
1956
+ var isMetaChannel = (c) => c.kind === "meta_retargeting";
1957
+ var usesPropertyModel = (c) => c.channelGroup !== void 0 || c.audienceRuleRefs.some((ref) => ref.minDaysSinceVisit !== void 0);
1958
+ function checkAudienceBand(ref, provider = "meta_ads", at = "audienceRuleRef") {
1959
+ const min = ref.minDaysSinceVisit;
1960
+ if (min !== void 0 && min >= ref.retentionDays) fail2(at + ".minDaysSinceVisit", "must be shorter than the retention window");
1961
+ if (provider === "google_ads") {
1962
+ if (min !== void 0) fail2(at + ".minDaysSinceVisit", "Google audiences have no recency band");
1963
+ return;
1964
+ }
1965
+ 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`);
1966
+ 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`);
1967
+ }
1968
+ function checkMetaAudienceBands(channel2, at) {
1969
+ if (!usesPropertyModel(channel2)) return;
1970
+ channel2.audienceRuleRefs.forEach((ref, index) => checkAudienceBand(ref, "meta_ads", `${at}[${index}]`));
1971
+ }
1972
+ var bandsOverlap = (a, b) => (a.minDaysSinceVisit ?? 0) < b.retentionDays && (b.minDaysSinceVisit ?? 0) < a.retentionDays;
1973
+ function checkChannelGroups(channels) {
1974
+ const groups = /* @__PURE__ */ new Map();
1975
+ for (const c of channels) if (isMetaChannel(c) && c.channelGroup) groups.set(c.channelGroup.key, [...groups.get(c.channelGroup.key) ?? [], c]);
1976
+ for (const [key, members] of groups) {
1977
+ const at = `campaign.channelGroup.${key}`;
1978
+ if (members.length > RESONANCE_MAX_CHANNELS_PER_GROUP) fail2(at, `at most ${RESONANCE_MAX_CHANNELS_PER_GROUP} channels per group`);
1979
+ const first = members[0];
1980
+ const shared = (c) => canonical([c.site, c.accountBindingId, c.datasetRef.id, c.pageRef, c.instagramRef, c.specialCategories, c.countryCodes, c.objective, c.optimization]);
1981
+ const identity = /* @__PURE__ */ new Set(), destinationOf = /* @__PURE__ */ new Map(), propertyOfDestination = /* @__PURE__ */ new Map();
1982
+ for (const c of members) {
1983
+ if (shared(c) !== shared(first)) fail2(at, "channels in one group must share site, account, dataset, Page, categories, countries, objective and optimization");
1984
+ if (c.specialCategories.length > 0 && c.ageConstraint?.mode !== "provider_managed") fail2(at + ".ageConstraint", "a special category requires provider-managed age");
1985
+ const pk = (c.property ?? fail2(at + ".property", "a grouped channel names its property")).key, tier = c.tier?.label ?? "", id = `${pk}|${tier}`;
1986
+ if (identity.has(id)) fail2(at + ".property", "two channels share one property and tier");
1987
+ identity.add(id);
1988
+ if (destinationOf.has(pk) && destinationOf.get(pk) !== c.destinationId) fail2(at + ".destinationId", "channels for one property share one destination");
1989
+ destinationOf.set(pk, c.destinationId);
1990
+ const other = propertyOfDestination.get(c.destinationId);
1991
+ if (other !== void 0 && other !== pk) fail2(at + ".destinationId", "channels for different properties have different destinations");
1992
+ propertyOfDestination.set(c.destinationId, pk);
1993
+ }
1994
+ for (let i = 0; i < members.length; i++) for (let j = i + 1; j < members.length; j++) {
1995
+ if (members[i].property?.key !== members[j].property?.key) continue;
1996
+ 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");
1997
+ }
1998
+ }
1999
+ }
2000
+ function checkGroupedAllocations(v) {
2001
+ if (!v.channels.some((c) => isMetaChannel(c) && c.channelGroup)) return;
2002
+ let sum = 0n;
2003
+ for (const c of v.channels) if ("allocation" in c) sum += BigInt(c.allocation.amountMicros);
2004
+ 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");
2005
+ }
2006
+ function splitBudget(total, weights, quantumMicros) {
2007
+ const t = parseMoney(total), at = "splitBudget";
2008
+ if (!/^[1-9][0-9]{0,29}$/.test(quantumMicros)) fail2(at + ".quantumMicros", "must be a positive whole number of micros");
2009
+ if (weights.length < 1 || weights.length > 100 || weights.some((w) => !Number.isSafeInteger(w) || w < 1)) fail2(at + ".weights", "one to 100 positive whole weights");
2010
+ const quantum = BigInt(quantumMicros), micros = BigInt(t.amountMicros);
2011
+ if (micros % quantum !== 0n) fail2(at + ".total", "must be a whole number of provider quanta");
2012
+ const units = micros / quantum, sum = weights.reduce((a, w) => a + BigInt(w), 0n);
2013
+ const parts = weights.map((w, index) => ({ index, floor: units * BigInt(w) / sum, rest: units * BigInt(w) % sum }));
2014
+ let left = units - parts.reduce((a, p) => a + p.floor, 0n);
2015
+ const order = [...parts].sort((a, b) => a.rest === b.rest ? a.index - b.index : a.rest > b.rest ? -1 : 1);
2016
+ const extra = /* @__PURE__ */ new Set();
2017
+ for (const p of order) {
2018
+ if (left === 0n) break;
2019
+ extra.add(p.index);
2020
+ left -= 1n;
2021
+ }
2022
+ return parts.map((p) => ({ currency: t.currency, amountMicros: ((p.floor + (extra.has(p.index) ? 1n : 0n)) * quantum).toString() }));
2023
+ }
2024
+ function suggestPropertyWeights(visitors, bounds = {}) {
2025
+ const floor = bounds.floorBasisPoints ?? 1e3, ceiling = bounds.ceilingBasisPoints ?? 4e3, n = visitors.length, at = "suggestPropertyWeights";
2026
+ if (n < 1 || n > 100 || visitors.some((v) => !Number.isSafeInteger(v) || v < 0)) fail2(at + ".visitors", "one to 100 whole, non-negative visitor counts");
2027
+ 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");
2028
+ const weight = visitors.map((v) => v + 1);
2029
+ const total = (lambda) => weight.reduce((a, w) => a + Math.min(ceiling, Math.max(floor, lambda * w)), 0);
2030
+ let low = 0, high = ceiling / Math.min(...weight) + 1;
2031
+ for (let i = 0; i < 200; i++) {
2032
+ const mid = (low + high) / 2;
2033
+ if (total(mid) < 1e4) low = mid;
2034
+ else high = mid;
2035
+ }
2036
+ const share = weight.map((w) => Math.min(ceiling, Math.max(floor, high * w)));
2037
+ 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);
2038
+ let left = 1e4 - whole.reduce((a, b) => a + b, 0);
2039
+ for (const r of rest) {
2040
+ if (left <= 0) break;
2041
+ whole[r.i] += 1;
2042
+ left -= 1;
2043
+ }
2044
+ return whole;
2045
+ }
2046
+ function deterministicUuid(seed) {
2047
+ const mask = (1n << 64n) - 1n, prime = 0x100000001b3n, bytes = new TextEncoder().encode(seed);
2048
+ const hash = (basis) => {
2049
+ let h = basis;
2050
+ for (const b of bytes) {
2051
+ h ^= BigInt(b);
2052
+ h = h * prime & mask;
2053
+ }
2054
+ return h.toString(16).padStart(16, "0");
2055
+ };
2056
+ const hex = hash(0xcbf29ce484222325n) + hash(0x84222325cbf29ce4n);
2057
+ 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)}`;
2058
+ }
2059
+ var PLACEHOLDER_CREATIVE_ID = "00000000-0000-4000-8000-000000000000";
2060
+ var clip = (value, max) => value.length <= max ? value : value.slice(0, max);
2061
+ function expandPropertyChannels(definition2, groupKey, additions, options) {
2062
+ const at = "expandPropertyChannels";
2063
+ const group = definition2.channels.filter((c) => isMetaChannel(c) && c.channelGroup?.key === groupKey);
2064
+ if (!group.length) fail2(at + ".group", "needs an existing property channel to use as the template");
2065
+ const template = group[0];
2066
+ const present = new Set(group.map((c) => c.property?.key));
2067
+ const keys = additions.map((a) => a.key);
2068
+ unique(keys, at + ".additions");
2069
+ const fresh = additions.filter((a) => !present.has(a.key));
2070
+ if (!fresh.length) return { channels: [], allocations: [], blockingReasons: [] };
2071
+ const weightOf = (key, own) => own ?? options.weights?.[key] ?? 1;
2072
+ 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) }))];
2073
+ const total = group.reduce((a, c) => addMoney(a, c.allocation), { currency: template.allocation.currency, amountMicros: "0" });
2074
+ const split = splitBudget(total, members.map((m) => m.weight), options.quantumMicros);
2075
+ const allocations = members.map((m, i) => ({ channelId: m.id, allocation: split[i] }));
2076
+ const { tier: _tier, primaryText: _primary, convertersAcknowledged: _converters, ...rest } = template;
2077
+ const channels = fresh.map((a) => {
2078
+ const id = members.find((m) => m.key === a.key).id;
2079
+ const proposal = {
2080
+ ...rest,
2081
+ id,
2082
+ localCampaignKey: clip(`${groupKey}-${a.key}`, 80),
2083
+ localAdSetKey: clip(`${a.key}-visitors`, 80),
2084
+ localAdKey: clip(`${a.key}-1`, 80),
2085
+ property: { key: a.key, label: a.label },
2086
+ destinationId: a.destinationId,
2087
+ audienceRuleRefs: a.audienceRuleRefs,
2088
+ creativeIds: [],
2089
+ allocation: allocations.find((x) => x.channelId === id).allocation
2090
+ };
2091
+ meta.read({ ...proposal, creativeIds: [PLACEHOLDER_CREATIVE_ID] }, at + ".channel");
2092
+ return proposal;
2093
+ });
2094
+ const combined = [...definition2.channels, ...channels.map((c) => ({ ...c, creativeIds: [PLACEHOLDER_CREATIVE_ID] }))];
2095
+ unique(combined.map((c) => c.id), at + ".channels");
2096
+ checkChannelGroups(combined);
2097
+ const changed = group.some((c) => canonical(allocations.find((x) => x.channelId === c.id).allocation) !== canonical(c.allocation));
2098
+ return { channels, allocations, blockingReasons: [...fresh.map((a) => `property_creative_required:${a.key}`), ...changed ? ["rebalance_changes_running_allocations"] : []] };
2099
+ }
2100
+ function metaExclusionPolicy(channel2, use) {
2101
+ const special = channel2.specialCategories.length > 0;
2102
+ if (use.targetingLevel && special && !META_SAC_CUSTOM_AUDIENCE_EXCLUSION_VERIFIED) return { allowed: false, reason: "meta_exclusion_targeting_blocked_special_category", requiresEligibilityReadback: false };
2103
+ return { allowed: true, reason: null, requiresEligibilityReadback: special && (use.inRule || use.targetingLevel) };
2104
+ }
2105
+ function deriveProviderRatios(items) {
2106
+ const unknown = (reasonCode) => ({ frequency: { state: "unknown", reasonCode }, costPerResult: { state: "unknown", reasonCode }, reasonCodes: [reasonCode] });
2107
+ if (!items.length) return unknown("no_inputs");
2108
+ const first = items[0];
2109
+ 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");
2110
+ const named = (name) => items.filter((i) => i.name === name);
2111
+ if (RESONANCE_PROVIDER_METRIC_NAMES.some((name) => named(name).length > 1)) return unknown("duplicate_metric");
2112
+ const count = (name) => {
2113
+ const i = named(name)[0];
2114
+ return i && i.state === "observed" && i.value?.kind === "count" ? BigInt(i.value.count) : null;
2115
+ };
2116
+ const spend = () => {
2117
+ const i = named("spend")[0];
2118
+ return i && i.state === "observed" && i.value?.kind === "money" ? i.value.money : null;
2119
+ };
2120
+ const reasons = [];
2121
+ let frequency;
2122
+ const impressions = count("impressions"), reach = count("reach");
2123
+ if (impressions === null || reach === null) {
2124
+ frequency = { state: "unknown", reasonCode: impressions === null ? "missing_impressions" : "missing_reach" };
2125
+ reasons.push(frequency.reasonCode);
2126
+ } else if (reach === 0n) {
2127
+ frequency = { state: "unknown", reasonCode: "no_reach" };
2128
+ reasons.push("no_reach");
2129
+ } else frequency = { state: "observed", value: { kind: "ratio", numerator: impressions.toString(), denominator: reach.toString() } };
2130
+ let costPerResult;
2131
+ const money2 = spend(), results = count("results");
2132
+ if (money2 === null || results === null) {
2133
+ costPerResult = { state: "unknown", reasonCode: money2 === null ? "missing_spend" : "missing_results" };
2134
+ reasons.push(costPerResult.reasonCode);
2135
+ } else if (results === 0n) {
2136
+ costPerResult = { state: "unknown", reasonCode: "no_results" };
2137
+ reasons.push("no_results");
2138
+ } else {
2139
+ const micros = BigInt(money2.amountMicros);
2140
+ let quotient = micros / results;
2141
+ const twice = 2n * (micros % results);
2142
+ if (twice > results || twice === results && quotient % 2n === 1n) quotient += 1n;
2143
+ costPerResult = { state: "observed", money: { currency: money2.currency, amountMicros: quotient.toString() } };
2144
+ }
2145
+ return { frequency, costPerResult, reasonCodes: reasons };
2146
+ }
1843
2147
 
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 };
2148
+ 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_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_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, 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, parseResonanceMetaRetargetingReadiness, 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.23.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": {