Skip to content

Commit

Permalink
Merge pull request #3 from DavidDurman/prompt-required-parameters
Browse files Browse the repository at this point in the history
Prompt for required parameters if not in query string: studioUrl and …
  • Loading branch information
DavidDurman authored Feb 20, 2024
2 parents c2d96f7 + fc78cbe commit e2c2b68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ <h2>2. Trigger the integration by sending an App Event</h2>
}

// 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');
Expand Down
5 changes: 4 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit e2c2b68

Please sign in to comment.