doxa-maps/library/print/experimentalExports.js
Doxa Maps 8890377993 The Country Posters map's legend Packet export works, and the card deck rolls out behind one switch
- The legend's packet submenu emits 'packet:full' | 'packet:lightweight', and the country map compared
  against a bare 'packet', so its legend Packet export did nothing at all. It splits the kind first, as
  the UPG-100 map's handler does (the research map carries the same three lines; reported to its owner).
- The selection's rows come from the print standard's records provider by slug (full print fields,
  the reader's language); the rows mapped by hand put the country's NAME in country_code and carried no
  language, so every profile description ran short. They remain as the fallback. The live map's raster
  goes in through the mapImage seam, so page 1 is the map full page.
- The legend gains an OPT-IN Card Deck export (exportCards; provide('legendExportCards') for the mobile
  sheet), so a map that does not handle it never shows a dead item.
- library/print/experimentalExports.js is the ONE switch for rolling the standard's exports out on
  maps that are not production print surfaces (production: the UPG 100 list, the Regions dashboard's
  country posters, the Country Posters wall). This map's card deck sits behind it; off — per page, per
  visit (?exports=off), per site or everywhere — restores the menu it had before.
- The records provider returns coordinates (a generated map's pins), exposes the unselected set
  (recordsFor.all) and sorts in the reader's collation.
2026-09-29 05:26:27 +00:00

29 lines
1.7 KiB
JavaScript

/**
* experimentalExports.js — the ONE switch for the print standard's EXPERIMENTAL rollout on map legends.
*
* PRODUCTION (no flag, always on): the UPG 100 list and the Regions dashboard's country posters, and the
* Country Posters wall — those print through the standard unconditionally.
* EXPERIMENTAL (this flag): every OTHER map whose legend already has an Export menu gets the same
* reusable exports (the card deck; the prayer packet, full or lightweight) only while this is on, so the
* rollout can be tried in more places and switched off in one move if it misbehaves.
*
* Off, in order of reach:
* one page profile-config `experimentalExports: false`
* one visit ?exports=off in the URL
* one site window.DOXA_EXPERIMENTAL_EXPORTS = false before the maps load
* everywhere EXPERIMENTAL_EXPORTS_DEFAULT below
* A legend given `false` shows exactly the Export menu it had before the rollout.
*/
export const EXPERIMENTAL_EXPORTS_DEFAULT = true
export function experimentalExportsOn(profileConfig = null) {
const cfg = profileConfig && typeof profileConfig === 'object' && 'value' in profileConfig ? profileConfig.value : profileConfig
if (cfg && typeof cfg.experimentalExports === 'boolean') return cfg.experimentalExports
try {
const q = new URLSearchParams(globalThis.location?.search || '').get('exports')
if (q === 'off' || q === '0' || q === 'false') return false
if (q === 'on' || q === '1' || q === 'true') return true
} catch { /* no location (Node, a sandboxed frame): fall through */ }
if (typeof globalThis.DOXA_EXPERIMENTAL_EXPORTS === 'boolean') return globalThis.DOXA_EXPERIMENTAL_EXPORTS
return EXPERIMENTAL_EXPORTS_DEFAULT
}