From fc78cbe284201feadf52dfb1e5fae023edf505ed Mon Sep 17 00:00:00 2001 From: David Durman Date: Tue, 20 Feb 2024 10:18:01 +0100 Subject: [PATCH] Prompt for required parameters if not in query string: studioUrl and apiUrl --- index.html | 5 ++++- main.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 1668597..68a2c6f 100644 --- a/index.html +++ b/index.html @@ -62,7 +62,10 @@

2. Trigger the integration by sending an App Event

} // The Appmixer SDK is located at https://my.YOUR_TENANT.appmixer.cloud/appmixer/appmixer.js. - const APPMIXER_STUDIO_URL = (new URLSearchParams(window.location.search)).get('studioUrl'); + let APPMIXER_STUDIO_URL = (new URLSearchParams(window.location.search)).get('studioUrl'); + if (!APPMIXER_STUDIO_URL) { + APPMIXER_STUDIO_URL = prompt('Please provide your Appmixer Studio URL (https://my.YOUR_TENANT.appmixer.cloud).'); + } loadScript(APPMIXER_STUDIO_URL + '/appmixer/appmixer.js', () => { loadScript('./main.js'); diff --git a/main.js b/main.js index bf2da42..a4b5034 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,10 @@ const QUERY_PARAMS = new URLSearchParams(window.location.search); // This should have the pattern https://api.YOUR_TENANT.appmixer.cloud'; -const APPMIXER_API_URL = QUERY_PARAMS.get('apiUrl'); +let APPMIXER_API_URL = QUERY_PARAMS.get('apiUrl'); +if (!APPMIXER_API_URL) { + APPMIXER_API_URL = prompt('Please provide your Appmixer API URL (https://api.YOUR_TENANT.appmixer.cloud).'); +} let APPMIXER_VIRTUAL_USER_USERNAME = QUERY_PARAMS.get('username'); let APPMIXER_VIRTUAL_USER_TOKEN;