Splits a string into associated key value pairs of supported Google Maps
query params.
Legacy themes passed agency.preferences.google_maps_api_key directly to
a <script> tag to initialise google maps. Some agents suffixed the
google_maps_api_key with additional query params (eg. &channel=03) to
provide additional data, such as billing information, to google maps.
The react-google-mapsAPIProvider does not directly support this as it
url encodes the value passed to the apiKey prop, transforming values like
&channel=03 to %26channel%3D03 and breaking the map with an api key error.
This function allows support for passing a single api key as agency.preferences.google_maps_api_key
as well as additional params in a way that allows easy usage of these params
as props with the <APIProvider> provided by react-google-maps.
Eg.
const { apiKey, channel, region } = parseGoogleMapsParams(googleMapsKey);
Splits a string into associated key value pairs of supported Google Maps query params.
Legacy themes passed
agency.preferences.google_maps_api_keydirectly to a<script>tag to initialise google maps. Some agents suffixed thegoogle_maps_api_keywith additional query params (eg.&channel=03) to provide additional data, such as billing information, to google maps.The
react-google-mapsAPIProviderdoes not directly support this as it url encodes the value passed to theapiKeyprop, transforming values like&channel=03to%26channel%3D03and breaking the map with an api key error.This function allows support for passing a single api key as
agency.preferences.google_maps_api_keyas well as additional params in a way that allows easy usage of these params as props with the<APIProvider>provided byreact-google-maps.Eg.