Skip to content

Commit

Permalink
ULMS-3400 Added app-config
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkonst committed Oct 14, 2024
1 parent aca8be4 commit 5ecb4a8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/api-clients",
"version": "7.22.0",
"version": "7.23.0",
"description": "JavaScript API clients for ULMS platform",
"keywords": [],
"homepage": "https://github.com/foxford/ulms-api-clients-js#readme",
Expand Down
43 changes: 43 additions & 0 deletions src/app-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import Debug from 'debug'

const debug = Debug('app-config')

const parameters = new URLSearchParams(window.location.search)

const AUDIENCE = parameters.get('audience')
const BRAND = parameters.get('brand')
const CONTEXT = parameters.get('context')
const EMBEDDED_ORIGIN = parameters.get('embedded_origin')
const EXTERNAL_ID = parameters.get('external_id')
const IS_AUTOTEST = Boolean(parameters.get('is_autotest'))
const LESSON_ID = parameters.get('lesson_id')
const SCOPE = parameters.get('scope')

// const BACKURL = parameters.get('backurl') // exists, but not used

const appConfig = {
AUDIENCE,
BRAND,
CONTEXT,
EMBEDDED_ORIGIN,
EXTERNAL_ID,
IS_AUTOTEST,
LESSON_ID,
SCOPE,
}

debug('available keys', [...parameters.entries()])
debug('config', appConfig)

export default appConfig

export {
AUDIENCE,
BRAND,
CONTEXT,
EMBEDDED_ORIGIN,
EXTERNAL_ID,
IS_AUTOTEST,
LESSON_ID,
SCOPE,
}

0 comments on commit 5ecb4a8

Please sign in to comment.