diff --git a/src/helpers/FormioLoader/FormioLoader.js b/src/helpers/FormioLoader/FormioLoader.js index 5ed63d8a..db57dcb2 100644 --- a/src/helpers/FormioLoader/FormioLoader.js +++ b/src/helpers/FormioLoader/FormioLoader.js @@ -165,11 +165,11 @@ const defaultInitFormioAction = () => { ); }; -const initFormio = ({cdn = null}) => { +const initFormio = (cdn = null) => { // Init form Formio.icons = "fontawesome"; if (cdn) { - Formio.cdn.setOverrideUrl('grid', cdn); + Formio.cdn.setOverrideUrl("grid", cdn); } if (premium) Formio.use(premium); diff --git a/src/helpers/FormioScript/FormioScript.js b/src/helpers/FormioScript/FormioScript.js index 89cea6a9..99b384a7 100644 --- a/src/helpers/FormioScript/FormioScript.js +++ b/src/helpers/FormioScript/FormioScript.js @@ -31,52 +31,55 @@ export const createScripts = (scripts, i, mainResolve) => { } }; -export const getDefaultCdn = ({subdomain = "static", version = defaultVersion}) => { - return `https://${subdomain}.qgov.net.au/formio-qld/${version}` -} +export const getDefaultCdn = ( + subdomain = "static", + version = defaultVersion +) => { + return `https://${subdomain}.qgov.net.au/formio-qld/${version}`; +}; -export const getDefaultScripts = ({ base_url }) => { +export const getDefaultScripts = (baseUrl) => { return [ { type: "script", - src: `${base_url}/formio.full.js`, + src: `${baseUrl}/formio.full.js`, async: false, }, { type: "script", - src: `${base_url}/premium.min.js`, + src: `${baseUrl}/premium.min.js`, async: false, }, { type: "script", - src: `${base_url}/formio-qld.js`, + src: `${baseUrl}/formio-qld.js`, async: false, }, // note: formio-loader should always load last { type: "script", - src: `${base_url}/formio-loader.js`, + src: `${baseUrl}/formio-loader.js`, async: false, }, { type: "link", - href: `${base_url}/formio.full.min.css`, + href: `${baseUrl}/formio.full.min.css`, rel: "stylesheet", }, { type: "link", - href: `${base_url}/premium.css`, + href: `${baseUrl}/premium.css`, rel: "stylesheet", }, { type: "link", - href: `${base_url}/formio-qld.min.css`, + href: `${baseUrl}/formio-qld.min.css`, rel: "stylesheet", }, ]; }; -export const initScript = ({scripts, cdn = null}) => +export const initScript = (scripts, cdn = null) => new Promise((resolve) => { if (window.formioScriptLoaded) { if (typeof FormioLoader !== "undefined") diff --git a/src/helpers/FormioScript/index.dev.js b/src/helpers/FormioScript/index.dev.js index c5a21b94..a1482243 100644 --- a/src/helpers/FormioScript/index.dev.js +++ b/src/helpers/FormioScript/index.dev.js @@ -1,8 +1,6 @@ import { initScript, getDefaultCdn, getDefaultScripts } from "."; -let base_url = getDefaultCdn(subdomain="dev-static") -const scripts = getDefaultScripts({ - base_url: base_url, -}); +const baseUrl = getDefaultCdn("dev-static"); +const scripts = getDefaultScripts(baseUrl); -export const init = () => initScript(scripts, base_url); +export const init = () => initScript(scripts, baseUrl); diff --git a/src/helpers/FormioScript/index.gitbridge.js b/src/helpers/FormioScript/index.gitbridge.js index 9b70591b..7d7ebc4a 100644 --- a/src/helpers/FormioScript/index.gitbridge.js +++ b/src/helpers/FormioScript/index.gitbridge.js @@ -2,6 +2,6 @@ import { initScript, getDefaultCdn, getDefaultScripts } from "."; const version = window.formIOGitBridgeID || "248740"; -const scripts = getDefaultScripts(base_url = `/__data/assets/git_bridge/0025/${version}`); +const scripts = getDefaultScripts(`/__data/assets/git_bridge/0025/${version}`); export const init = () => initScript(scripts, getDefaultCdn()); diff --git a/src/helpers/FormioScript/index.prod.js b/src/helpers/FormioScript/index.prod.js index a5f9be56..b012e741 100644 --- a/src/helpers/FormioScript/index.prod.js +++ b/src/helpers/FormioScript/index.prod.js @@ -1,44 +1,44 @@ import { initScript, getDefaultCdn } from "."; -let base_url = getDefaultCdn() +const baseUrl = getDefaultCdn(); const scripts = [ { type: "script", - src: `${base_url}/formio.full.min.js`, + src: `${baseUrl}/formio.full.min.js`, async: false, }, { type: "script", - src: `${base_url}/premium.min.js`, + src: `${baseUrl}/premium.min.js`, async: false, }, { type: "script", - src: `${base_url}/formio-qld.min.js`, + src: `${baseUrl}/formio-qld.min.js`, async: false, }, // note: formio-loader should always load last { type: "script", - src: `${base_url}/formio-loader.min.js`, + src: `${baseUrl}/formio-loader.min.js`, async: false, }, { type: "link", - href: `${base_url}/formio.full.min.css`, + href: `${baseUrl}/formio.full.min.css`, rel: "stylesheet", }, { type: "link", - href: `${base_url}/premium.css`, + href: `${baseUrl}/premium.css`, rel: "stylesheet", }, { type: "link", - href: `${base_url}/formio-qld.min.css`, + href: `${baseUrl}/formio-qld.min.css`, rel: "stylesheet", }, ]; -export const init = () => initScript(scripts, base_url); +export const init = () => initScript(scripts, baseUrl); diff --git a/src/helpers/FormioScript/index.staging.js b/src/helpers/FormioScript/index.staging.js index 76182400..7bb8025e 100644 --- a/src/helpers/FormioScript/index.staging.js +++ b/src/helpers/FormioScript/index.staging.js @@ -1,8 +1,6 @@ import { initScript, getDefaultCdn, getDefaultScripts } from "."; -let base_url = getDefaultCdn(subdomain="beta-static") -const scripts = getDefaultScripts({ - base_url: base_url, -}); +const baseUrl = getDefaultCdn("beta-static"); +const scripts = getDefaultScripts(baseUrl); -export const init = () => initScript(scripts, base_url); +export const init = () => initScript(scripts, baseUrl); diff --git a/src/helpers/FormioScript/index.testing.js b/src/helpers/FormioScript/index.testing.js index 9f9537ca..9138a9d4 100644 --- a/src/helpers/FormioScript/index.testing.js +++ b/src/helpers/FormioScript/index.testing.js @@ -1,8 +1,6 @@ import { initScript, getDefaultCdn, getDefaultScripts } from "."; -let base_url = getDefaultCdn(subdomain="test-static") -const scripts = getDefaultScripts({ - base_url: base_url, -}); +const baseUrl = getDefaultCdn("test-static"); +const scripts = getDefaultScripts(baseUrl); -export const init = () => initScript(scripts, base_url); +export const init = () => initScript(scripts, baseUrl);