All People Groups: find its data when a partner page embeds the script
With no assetsBase in the profile-config, the map fell back to '/assets' and asked the host site for people-groups-slim.json. That is a 404 on any partner page, so a script embed drew a basemap with no groups on it. It now resolves the base through resolveAssetsBase(), the same path the other bundles use, which finds the asset pool inside the tree the script came from. Measured with the tree served under /plugin-assets/doxa-maps/ and a partner page on the same host: main requested /assets/... and got 404; this build requested /plugin-assets/doxa-maps/assets/... and got 200, drawing all 12,379 locations. The leaf page and the Research Gallery tab load on both builds.
This commit is contained in:
parent
7d4be4e86a
commit
6d09e4f8d6
5 changed files with 34 additions and 32 deletions
|
|
@ -32,6 +32,7 @@ import { useShadowStyles } from '@map/composables/useShadowStyles.js'
|
|||
import { DataSourceManager } from '@map/utils/DataSourceManager.js'
|
||||
import MapToolbar from '@map/components/map-controls/MapToolbar.vue'
|
||||
import ShareButton from '@map/components/map-controls/ShareButton.vue'
|
||||
import { resolveAssetsBase } from '@map/utils/embedBase.js'
|
||||
|
||||
useShadowStyles(`
|
||||
.apg-root { position:absolute;inset:0;overflow:hidden;
|
||||
|
|
@ -90,8 +91,9 @@ const isDark = computed(() => profileConfig.value?.isDark === true)
|
|||
const SHARE_EMBED_PATH = 'all-people-groups/all-people-groups/index.html'
|
||||
|
||||
const mapProvider = resolveMapProvider(profileConfig)
|
||||
const assetsBase = computed(() =>
|
||||
String(profileConfig?.value?.assetsBase || '/assets').replace(/\/+$/, ''))
|
||||
// Through the shared resolver, not a '/assets' fallback: that root path 404s whenever the tree
|
||||
// is served below the site root, and inside the Research Gallery no assetsBase is passed at all.
|
||||
const assetsBase = computed(() => resolveAssetsBase(profileConfig?.value || {}))
|
||||
|
||||
// ─── The four categories (the Driver's palette) ──────────────────────────────
|
||||
const CATS = [
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<script>window.MAP_APP_API_URL = "https://pray.doxa.life";</script>
|
||||
<!-- Bundle IIFE — registers the <all-people-groups> custom element. -->
|
||||
<script src="../all-people-groups.js" integrity="sha384-j2rnWAW0lVUG05WREAfkQZo0jtreSIebwV3nHCbUcXhAGzMfTESwA1PqTYy5M3QS" crossorigin="anonymous"></script>
|
||||
<script src="../all-people-groups.js" integrity="sha384-wDwlEPqFMo1DGCSAZQqHdBUM9OKTByNW1wSZPNu5auSubOuSBz4eHR4CIf0uvglf" crossorigin="anonymous"></script>
|
||||
|
||||
<script>
|
||||
// Mapbox token resolution — the A3 ladder, in precedence order:
|
||||
|
|
|
|||
2
public/doxa-maps/index.html
generated
2
public/doxa-maps/index.html
generated
File diff suppressed because one or more lines are too long
4
public/doxa-maps/manifest.json
generated
4
public/doxa-maps/manifest.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"bundle": "all-people-groups",
|
||||
"scriptUrl": "./all-people-groups/all-people-groups.js",
|
||||
"output": "doxa-maps/all-people-groups/all-people-groups.js",
|
||||
"integrity": "sha384-j2rnWAW0lVUG05WREAfkQZo0jtreSIebwV3nHCbUcXhAGzMfTESwA1PqTYy5M3QS",
|
||||
"integrity": "sha384-wDwlEPqFMo1DGCSAZQqHdBUM9OKTByNW1wSZPNu5auSubOuSBz4eHR4CIf0uvglf",
|
||||
"elements": [
|
||||
"all-people-groups"
|
||||
],
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
"scriptUrl": "./all-people-groups/all-people-groups.js",
|
||||
"embed": {
|
||||
"iframe": "<iframe src=\"./all-people-groups/all-people-groups/index.html?utm_source=YOUR_SOURCE\" width=\"100%\" height=\"600\" style=\"border:none;border-radius:12px;\" allowfullscreen></iframe>",
|
||||
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./all-people-groups/all-people-groups.js\" integrity=\"sha384-j2rnWAW0lVUG05WREAfkQZo0jtreSIebwV3nHCbUcXhAGzMfTESwA1PqTYy5M3QS\" crossorigin=\"anonymous\"></script>\n<all-people-groups profile-config='{\"profile\":\"all-people-groups\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></all-people-groups>"
|
||||
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./all-people-groups/all-people-groups.js\" integrity=\"sha384-wDwlEPqFMo1DGCSAZQqHdBUM9OKTByNW1wSZPNu5auSubOuSBz4eHR4CIf0uvglf\" crossorigin=\"anonymous\"></script>\n<all-people-groups profile-config='{\"profile\":\"all-people-groups\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></all-people-groups>"
|
||||
},
|
||||
"bundle": "all-people-groups"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue