HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/self/root/tmp/360live-tighten-revenue-gates.cjs
const fs = require('fs');
function mustReplace(src, from, to, label) {
  if (!src.includes(from)) throw new Error(`missing ${label}`);
  return src.replace(from, to);
}

const routePath = 'services/web/app/growth-status.json/route.ts';
let route = fs.readFileSync(routePath, 'utf8');
route = mustReplace(route,
`  const campaignExports = campaignKit?.channel_exports || {};
  const status = {`,
`  const campaignExports = campaignKit?.channel_exports || {};
  const activeEntitlementRows = Number(hostbillReconcile?.entitlement_table?.active_rows || 0);
  const hostbillMappedServices = Number(hostbillReconcile?.hostbill_api?.matched_services || 0);
  const hostbillActiveMappedServices = Number(hostbillReconcile?.hostbill_api?.active_matched_services || 0);
  const paidOrActiveValue = Object.values(hostbillReconcile?.hostbill_api?.by_product || {}).reduce((sum: number, item: any) => sum + Number(item?.paid_or_active_value || 0), 0);
  const paidRevenueProven = hostbillMappedServices > 0 || hostbillActiveMappedServices > 0 || activeEntitlementRows > 0 || paidOrActiveValue > 0;
  const activationInfrastructureReady = Boolean(hostbillReconcile?.entitlement_table?.ready && hostbillWebhookReadiness?.ok && hostbillApiProbe?.ok);
  const status = {`, 'route derived gates');
route = mustReplace(route,
`    checkout_readiness: {
      public_routes: {`,
`    monetization_proof: {
      generated_at: hostbillReconcile?.generated_at || null,
      paid_revenue_proven: paidRevenueProven,
      paid_or_active_value: paidOrActiveValue,
      hostbill_mapped_services: hostbillMappedServices,
      hostbill_active_mapped_services: hostbillActiveMappedServices,
      active_entitlement_rows: activeEntitlementRows,
      checkout_intents_7d: Number(revenueIntent?.summary?.checkout_intents_7d || 0),
      infrastructure_ready: activationInfrastructureReady,
      evidence: paidRevenueProven
        ? "HostBill API reconciliation found at least one mapped 360live paid/active service or entitlement."
        : "No HostBill service for product 875/876/877 is mapped yet; checkout is ready, but real paid revenue is still unproven.",
      next_action: paidRevenueProven
        ? "Monitor paid-service reconciliation daily and compare entitlements with webhook activations."
        : "Complete one real paid checkout or a clearly labeled HostBill test order, then rerun hostbill:reconcile before claiming profitability.",
    },
    checkout_readiness: {
      public_routes: {`, 'route monetization proof');
route = mustReplace(route,
`      paid_activation_gate: Boolean(hostbillReconcile?.entitlement_table?.ready && hostbillWebhookReadiness?.ok && hostbillApiProbe?.ok),
      api_reconciliation_gate: Boolean(hostbillApiProbe?.ok && hostbillReconcile?.hostbill_api?.accounts_query_ok),`,
`      paid_activation_gate: paidRevenueProven,
      activation_infrastructure_gate: activationInfrastructureReady,
      api_reconciliation_gate: Boolean(hostbillApiProbe?.ok && hostbillReconcile?.hostbill_api?.accounts_query_ok),`, 'route paid activation gate');
route = mustReplace(route,
`      entitlement_activation: hostbillReconcile?.entitlement_table?.ready && hostbillWebhookReadiness?.ok
        ? "hostbill_webhook_installed_and_can_activate_paid_services"
        : hostbillReconcile?.entitlement_table?.ready
          ? "entitlement_table_ready_but_hostbill_webhook_not_verified"
          : "checkout_intent_only_until_hostbill_reconcile_is_proven",`,
`      entitlement_activation: paidRevenueProven
        ? "paid_or_active_hostbill_service_mapped"
        : activationInfrastructureReady
          ? "infrastructure_ready_but_no_paid_service_mapped"
          : hostbillReconcile?.entitlement_table?.ready
            ? "entitlement_table_ready_but_hostbill_webhook_not_verified"
            : "checkout_intent_only_until_hostbill_reconcile_is_proven",`, 'route entitlement state');
route = mustReplace(route,
`            hostbill_active_mapped_services: Number(hostbillReconcile.hostbill_api?.active_matched_services || 0),`,
`            hostbill_active_mapped_services: hostbillActiveMappedServices,
            paid_or_active_value: paidOrActiveValue,
            paid_revenue_proven: paidRevenueProven,`, 'route latest reconcile proof');
route = mustReplace(route,
`      evidence: hostbillReconcile?.generated_at
        ? "HostBill checkout redirects are smoke-tested; entitlement table and installed webhook readiness are verified."
        : "HostBill checkout redirects are smoke-tested; run hostbill:reconcile to prove entitlement table readiness.",`,
`      evidence: paidRevenueProven
        ? "HostBill checkout, webhook infrastructure and at least one mapped paid/active service are verified."
        : activationInfrastructureReady
          ? "HostBill checkout redirects, API reconciliation and webhook infrastructure are verified; no mapped paid 360live service exists yet."
          : "HostBill checkout redirects are smoke-tested; run hostbill:reconcile and webhook readiness before treating paid activation as available.",`, 'route evidence');
route = mustReplace(route,
`      hostbillWebhookReadiness?.ok && hostbillReconcile?.entitlement_table?.ready ? "HostBill webhook and API reconcile are installed; next proof is a real mapped paid service for product 875/876/877." : hostbillReconcile?.entitlement_table?.ready ? "Install/verify HostBill paid-service webhook before treating checkout as activated revenue." : "Run HostBill reconcile readiness and create entitlement table before treating checkout as activated revenue.",`,
`      paidRevenueProven ? "HostBill has at least one mapped paid/active 360live service; keep reconciliation and webhook monitoring active." : activationInfrastructureReady ? "Checkout and HostBill infrastructure are ready; next proof is one real mapped paid service for product 875/876/877." : hostbillReconcile?.entitlement_table?.ready ? "Install/verify HostBill paid-service webhook before treating checkout as activated revenue." : "Run HostBill reconcile readiness and create entitlement table before treating checkout as activated revenue.",`, 'route next action');
fs.writeFileSync(routePath, route, 'utf8');

const revPath = 'services/api/scripts/revenue-intent-report.mjs';
let rev = fs.readFileSync(revPath, 'utf8');
rev = mustReplace(rev,
`    const nextActions = [];
    if (total7d === 0)`,
`    const hostbillMappedServices = Number(hostbillReconcile?.hostbill_api?.matched_services || 0);
    const hostbillActiveMappedServices = Number(hostbillReconcile?.hostbill_api?.active_matched_services || 0);
    const activeEntitlementRows = Number(hostbillReconcile?.entitlement_table?.active_rows || 0);
    const paidOrActiveValue = Object.values(hostbillReconcile?.hostbill_api?.by_product || {}).reduce((sum, item) => sum + Number(item?.paid_or_active_value || 0), 0);
    const paidRevenueProven = hostbillMappedServices > 0 || hostbillActiveMappedServices > 0 || activeEntitlementRows > 0 || paidOrActiveValue > 0;

    const nextActions = [];
    if (total7d === 0)`, 'rev derived gates');
rev = mustReplace(rev,
`    if (hostbillMultisite && !hostbillMultisite.brand_ready) nextActions.push('Branded HostBill multisite is still not checkout-ready; keep branded 360live handoff pages until support.panomity.com maps product checkout correctly.');
    if (!nextActions.length) nextActions.push('Checkout intent is flowing across all revenue products; compare this report with HostBill paid-service rows daily.');`,
`    if (hostbillMultisite && !hostbillMultisite.brand_ready) nextActions.push('Branded HostBill multisite is still not checkout-ready; keep branded 360live handoff pages until support.panomity.com maps product checkout correctly.');
    if (!paidRevenueProven) nextActions.push('No HostBill service for product 875/876/877 is mapped yet; do not claim revenue success until a real paid checkout or clearly labeled test order appears in reconciliation.');
    if (!nextActions.length) nextActions.push('Checkout intent is flowing and HostBill has mapped paid/active 360live service evidence; monitor reconciliation daily.');`, 'rev next action');
rev = mustReplace(rev,
`        active_entitlement_rows: Number(hostbillReconcile?.entitlement_table?.active_rows || 0),`,
`        active_entitlement_rows: activeEntitlementRows,
        hostbill_mapped_services: hostbillMappedServices,
        hostbill_active_mapped_services: hostbillActiveMappedServices,
        paid_or_active_value: paidOrActiveValue,
        paid_revenue_proven: paidRevenueProven,`, 'rev readiness fields');
rev = mustReplace(rev,
"    `- Branded HostBill checkout ready: ${report.checkout_readiness.brand_multisite_ready ? 'yes' : 'no'}`,\n",
"    `- Branded HostBill checkout ready: ${report.checkout_readiness.brand_multisite_ready ? 'yes' : 'no'}`,\n    `- Paid revenue proven: ${report.checkout_readiness.paid_revenue_proven ? 'yes' : 'no'}`,\n    `- HostBill mapped services: ${report.checkout_readiness.hostbill_mapped_services}`,\n", 'rev markdown proof');
fs.writeFileSync(revPath, rev, 'utf8');

const smokePath = 'services/web/scripts/public-growth-smoke.mjs';
let smoke = fs.readFileSync(smokePath, 'utf8');
smoke = mustReplace(smoke,
`'"checkout_handoff"', '"checkout_readiness"', '"revenue_intent"',`,
`'"checkout_handoff"', '"checkout_readiness"', '"monetization_proof"', '"paid_revenue_proven"', '"revenue_intent"',`, 'smoke json monetization');
smoke = mustReplace(smoke,
`'"table_ready"', '"product_id":"875"',`,
`'"table_ready"', '"paid_revenue_proven"', '"hostbill_mapped_services"', '"product_id":"875"',`, 'smoke latest reconcile proof');
smoke = mustReplace(smoke,
`'"checkout_readiness"', '"supply_activation"', '"latest_activation"'],`,
`'"checkout_readiness"', '"monetization_proof"', '"paid_revenue_proven"', '"supply_activation"', '"latest_activation"'],`, 'smoke schema markers');
fs.writeFileSync(smokePath, smoke, 'utf8');

const schemaPath = 'services/web/public/schemas/growth-status.v1.json';
const schema = JSON.parse(fs.readFileSync(schemaPath, 'utf8'));
if (!schema.required.includes('monetization_proof')) schema.required.splice(schema.required.indexOf('checkout_readiness'), 0, 'monetization_proof');
schema.properties.monetization_proof = {
  type: 'object',
  required: ['paid_revenue_proven', 'hostbill_mapped_services', 'hostbill_active_mapped_services', 'active_entitlement_rows', 'infrastructure_ready', 'evidence', 'next_action'],
  properties: {
    generated_at: { type: ['string', 'null'] },
    paid_revenue_proven: { type: 'boolean' },
    paid_or_active_value: { type: 'number' },
    hostbill_mapped_services: { type: 'number' },
    hostbill_active_mapped_services: { type: 'number' },
    active_entitlement_rows: { type: 'number' },
    checkout_intents_7d: { type: 'number' },
    infrastructure_ready: { type: 'boolean' },
    evidence: { type: 'string' },
    next_action: { type: 'string' }
  }
};
schema.properties.checkout_readiness.properties.paid_activation_gate = { type: 'boolean' };
schema.properties.checkout_readiness.properties.activation_infrastructure_gate = { type: 'boolean' };
schema.properties.checkout_readiness.properties.api_reconciliation_gate = { type: 'boolean' };
fs.writeFileSync(schemaPath, `${JSON.stringify(schema, null, 2)}\n`, 'utf8');