Skip to content

Implement Map Story widget loading functionality#69

Open
Rework-Digital wants to merge 2 commits intoSolcast:mainfrom
Rework-Digital:patch-1
Open

Implement Map Story widget loading functionality#69
Rework-Digital wants to merge 2 commits intoSolcast:mainfrom
Rework-Digital:patch-1

Conversation

@Rework-Digital
Copy link
Contributor

Added loadMapStoryWidget function to load the Map Story widget script dynamically, with handling for Mapbox token and data container attributes.

@alex-solcast

Added loadMapStoryWidget function to load the Map Story widget script dynamically, with handling for Mapbox token and data container attributes.
Refactor loadMapStoryWidget to cache script loading and improve error handling.

const dataContainer = container.getAttribute("component-data-container");

if (!mapboxToken || !dataContainer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The widget expects both to be present or it will reject.

if (!container) return resolve();

const src =
"https://static.solcast.com/2025-global-interactive-story/js/map-story-widget.iife.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GF-D6 @Rework-Digital this might work fine, but remember about the strict dynamic directive and how loading scripts needs a nonce:

j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments