<%

var cb = (d.conversionBasis) || null;
%>
<% if (cb) { %>
<div class="card card-p">
  <div class="row-between">
    <div class="rr-lbl">What counts as a conversion</div>
    <% if (cb.mode === 'single_action') { %>
      <span class="chip pos">1 action</span>
    <% } else if (cb.multiplePrimary) { %>
      <span class="chip warn"><%= cb.countedCount %> primaries</span>
    <% } else { %>
      <span class="chip pos">clean</span>
    <% } %>
  </div>

  <div style="display:flex;flex-direction:column;gap:2px;margin-top:12px">
    <% cb.actions.forEach(function(a){
         var isChosen = cb.mode === 'single_action' && a.name === cb.action;
         var inTotal  = cb.mode === 'single_action' ? isChosen : a.counted; %>
      <div class="skid" style="cursor:default;<%= inTotal ? '' : 'opacity:.6' %>">
        <span class="kn">
          <%= a.name %>

          <% if (a.category) { %><span class="muted" style="font-size:var(--fs-xs)">· <%= a.category %></span><% } %>
        </span>
        <span class="kv" style="<%= inTotal ? '' : 'font-weight:500;color:var(--muted)' %>">
          <%= Number(inTotal ? (a.conversions || 0) : (a.allConversions || 0)).toLocaleString('en-US', { maximumFractionDigits: 0 }) %>
        </span>
        <span style="flex:none;margin-left:8px">

          <% if (isChosen) { %><span class="chip pos" style="font-size:var(--fs-2xs)">counted</span>

          <% } else if (inTotal) { %><span class="chip teal" style="font-size:var(--fs-2xs)">counted</span>

          <% } else { %><span class="chip flat" style="font-size:var(--fs-2xs)">not counted</span><% } %>
        </span>
      </div>
    <% }) %>
  </div>

  <% if (cb.mode === 'single_action') { %>
    <% if (!cb.actionKnown) { %>
      <div class="subnote" style="margin-top:12px;border-color:var(--neg);color:var(--neg)">
        <b>“<%= cb.action %>” did not appear in the latest export.</b> Campaigns show 0 conversions until it is fixed.
        The action was either renamed in Google Ads or stopped firing. Our team is checking it.
      </div>
    <% } else { %>

      <div class="muted" style="font-size:var(--fs-xs);margin-top:12px;line-height:1.55">
        Conversion figures on these pages count <b style="color:var(--ink)"><%= cb.action %></b> only.
        Other actions are listed for reference.
      </div>
    <% } %>
  <% } else if (cb.multiplePrimary) { %>

    <div style="display:flex;gap:9px;padding:11px 12px;border:1px solid rgba(232,161,58,.35);background:var(--warn-tint);border-radius:var(--r);font-size:var(--fs-sm);color:#B5791E;line-height:1.55;margin-top:12px">
      <b style="flex:none">⚠</b>
      <div><b><%= cb.countedCount %> actions are all set to Primary in Google Ads</b>, so they are added together. If they measure different outcomes, conversions will read high and CPA low.
        See the recommendation below.</div>
    </div>
  <% } else { %>

    <div class="muted" style="font-size:var(--fs-xs);margin-top:12px;line-height:1.55">
      One action is set to Primary in Google Ads, so the totals here are that action alone.
      <% if (cb.secondaryTotal) { %> The <%= cb.secondaryTotal.toLocaleString('en-US') %> greyed conversions are secondary and left out of the totals.<% } %>
    </div>
  <% } %>
</div>
<% } %>
