Skip to main content

QA: Set campaign status (non-production)

Purpose

On acceptance and sandbox environments, campaign lifecycle and job-board behaviour differ from production. Integrators and VONQ engineers often need to force a campaign’s status (for example online, offline, or in progress) to reproduce UI states, test list/detail behaviour, or validate integrations—without going through a full edit-and-save flow or waiting on backend processing.

This release adds a QA-only API on window.hapiQA.campaign that sends a PATCH to the same campaign edit path the product uses (/campaigns/{campaignId}/edit), with a partial body { status }. The backend is expected to honour this on non-production environments only.

When the request succeeds, the ATS runtime also updates in-memory campaign state: the matching entry in hapi.campaign.state.campaigns and, if open, hapi.campaign.state.campaignBeingEdited, so widgets and SDK readers see the new status without an extra getCampaigns / getCampaign round trip.

caution

Calling this on production throws an error by design. Do not rely on this API in production integration code.

Usage

JavaScript API

// Only when hapi.core.isProduction === false
await window.hapiQA.campaign.setCampaignStatusOnNonProductionEnvironments(
"your-campaign-uuid",
"online", // see allowed values below
);

Allowed status values (same as Campaign.status in the types package):

Value
in progress
offline
online
not processed

The function returns a Promise that resolves with the campaign payload returned by the API when present; otherwise a merged object is returned so callers still receive a usable result.

Debug panel

In the QA debug panel, open the Campaign tab. Use the Set campaign status (non-production only) section:

  1. Enter the campaign ID.
  2. Choose status from the dropdown.
  3. Click Set status.

This invokes the same QA function over the iframe ↔ parent event bridge used by other debug helpers.