@descope/sdk-mixins
Advanced tools
Comparing version 0.3.2 to 0.4.0
@@ -296,6 +296,9 @@ 'use strict'; | ||
const DESCOPE_UI_FALLBACK_SCRIPT_ID = 'load-descope-ui-fallback-script'; | ||
const DESCOPE_UI_FALLBACK_2_SCRIPT_ID = 'load-descope-ui-fallback-script-2'; | ||
const UI_COMPONENTS_URL_KEY = 'base.ui.components.url'; | ||
const UI_COMPONENTS_URL = (IS_LOCAL_STORAGE && localStorage.getItem(UI_COMPONENTS_URL_KEY)) || | ||
'https://descopecdn.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js'; | ||
const UI_COMPONENTS_FALLBACK_URL = (IS_LOCAL_STORAGE && localStorage.getItem(UI_COMPONENTS_URL_KEY)) || | ||
'https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js'; | ||
const UI_COMPONENTS_FALLBACK_URL = (IS_LOCAL_STORAGE && localStorage.getItem(UI_COMPONENTS_URL_KEY)) || | ||
const UI_COMPONENTS_FALLBACK_2_URL = (IS_LOCAL_STORAGE && localStorage.getItem(UI_COMPONENTS_URL_KEY)) || | ||
'https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js'; | ||
@@ -374,5 +377,5 @@ const UI_COMPONENTS_URL_VERSION_PLACEHOLDER = '<version>'; | ||
}, | ||
_DescopeUiMixinClass_handleFallbackScript = async function _DescopeUiMixinClass_handleFallbackScript(errorCbs, loadCbs) { | ||
_DescopeUiMixinClass_handleFallbackScript = async function _DescopeUiMixinClass_handleFallbackScript(errorCbs, loadCbs, elemId, scriptUrl) { | ||
this.logger.debug('Trying to load DescopeUI from a fallback URL'); | ||
const fallbackScriptEle = setupScript(DESCOPE_UI_FALLBACK_SCRIPT_ID); | ||
const fallbackScriptEle = setupScript(elemId); | ||
document.body.append(fallbackScriptEle); | ||
@@ -385,3 +388,3 @@ fallbackScriptEle.addEventListener('error', () => { | ||
}); | ||
fallbackScriptEle.src = generateScriptUrl(UI_COMPONENTS_FALLBACK_URL, await tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_getComponentsVersion).call(this)); | ||
fallbackScriptEle.src = generateScriptUrl(scriptUrl, await tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_getComponentsVersion).call(this)); | ||
}, | ||
@@ -392,3 +395,7 @@ _DescopeUiMixinClass_registerEvents = function _DescopeUiMixinClass_registerEvents(scriptEle) { | ||
// in case we could not load DescopeUI from the main URL, we are trying to load it from a fallback URL | ||
tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_handleFallbackScript).call(this, scriptEle[tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_errorCbsSym, "f")], scriptEle[tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_loadCbsSym, "f")]); | ||
tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_handleFallbackScript).call(this, [ | ||
// we are adding a second fallback | ||
tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_handleFallbackScript).bind(this, scriptEle[tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_errorCbsSym, "f")], scriptEle[tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_loadCbsSym, "f")], DESCOPE_UI_FALLBACK_2_SCRIPT_ID, UI_COMPONENTS_FALLBACK_2_URL), | ||
...scriptEle[tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_errorCbsSym, "f")], | ||
], scriptEle[tslib.__classPrivateFieldGet(this, _DescopeUiMixinClass_loadCbsSym, "f")], DESCOPE_UI_FALLBACK_SCRIPT_ID, UI_COMPONENTS_FALLBACK_URL); | ||
}); | ||
@@ -395,0 +402,0 @@ scriptEle.addEventListener('load', () => { |
@@ -294,6 +294,9 @@ import { __classPrivateFieldGet, __classPrivateFieldSet } from 'tslib'; | ||
const DESCOPE_UI_FALLBACK_SCRIPT_ID = 'load-descope-ui-fallback-script'; | ||
const DESCOPE_UI_FALLBACK_2_SCRIPT_ID = 'load-descope-ui-fallback-script-2'; | ||
const UI_COMPONENTS_URL_KEY = 'base.ui.components.url'; | ||
const UI_COMPONENTS_URL = (IS_LOCAL_STORAGE && localStorage.getItem(UI_COMPONENTS_URL_KEY)) || | ||
'https://descopecdn.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js'; | ||
const UI_COMPONENTS_FALLBACK_URL = (IS_LOCAL_STORAGE && localStorage.getItem(UI_COMPONENTS_URL_KEY)) || | ||
'https://static.descope.com/npm/@descope/web-components-ui@<version>/dist/umd/index.js'; | ||
const UI_COMPONENTS_FALLBACK_URL = (IS_LOCAL_STORAGE && localStorage.getItem(UI_COMPONENTS_URL_KEY)) || | ||
const UI_COMPONENTS_FALLBACK_2_URL = (IS_LOCAL_STORAGE && localStorage.getItem(UI_COMPONENTS_URL_KEY)) || | ||
'https://cdn.jsdelivr.net/npm/@descope/web-components-ui@<version>/dist/umd/index.js'; | ||
@@ -372,5 +375,5 @@ const UI_COMPONENTS_URL_VERSION_PLACEHOLDER = '<version>'; | ||
}, | ||
_DescopeUiMixinClass_handleFallbackScript = async function _DescopeUiMixinClass_handleFallbackScript(errorCbs, loadCbs) { | ||
_DescopeUiMixinClass_handleFallbackScript = async function _DescopeUiMixinClass_handleFallbackScript(errorCbs, loadCbs, elemId, scriptUrl) { | ||
this.logger.debug('Trying to load DescopeUI from a fallback URL'); | ||
const fallbackScriptEle = setupScript(DESCOPE_UI_FALLBACK_SCRIPT_ID); | ||
const fallbackScriptEle = setupScript(elemId); | ||
document.body.append(fallbackScriptEle); | ||
@@ -383,3 +386,3 @@ fallbackScriptEle.addEventListener('error', () => { | ||
}); | ||
fallbackScriptEle.src = generateScriptUrl(UI_COMPONENTS_FALLBACK_URL, await __classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_getComponentsVersion).call(this)); | ||
fallbackScriptEle.src = generateScriptUrl(scriptUrl, await __classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_getComponentsVersion).call(this)); | ||
}, | ||
@@ -390,3 +393,7 @@ _DescopeUiMixinClass_registerEvents = function _DescopeUiMixinClass_registerEvents(scriptEle) { | ||
// in case we could not load DescopeUI from the main URL, we are trying to load it from a fallback URL | ||
__classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_handleFallbackScript).call(this, scriptEle[__classPrivateFieldGet(this, _DescopeUiMixinClass_errorCbsSym, "f")], scriptEle[__classPrivateFieldGet(this, _DescopeUiMixinClass_loadCbsSym, "f")]); | ||
__classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_handleFallbackScript).call(this, [ | ||
// we are adding a second fallback | ||
__classPrivateFieldGet(this, _DescopeUiMixinClass_instances, "m", _DescopeUiMixinClass_handleFallbackScript).bind(this, scriptEle[__classPrivateFieldGet(this, _DescopeUiMixinClass_errorCbsSym, "f")], scriptEle[__classPrivateFieldGet(this, _DescopeUiMixinClass_loadCbsSym, "f")], DESCOPE_UI_FALLBACK_2_SCRIPT_ID, UI_COMPONENTS_FALLBACK_2_URL), | ||
...scriptEle[__classPrivateFieldGet(this, _DescopeUiMixinClass_errorCbsSym, "f")], | ||
], scriptEle[__classPrivateFieldGet(this, _DescopeUiMixinClass_loadCbsSym, "f")], DESCOPE_UI_FALLBACK_SCRIPT_ID, UI_COMPONENTS_FALLBACK_URL); | ||
}); | ||
@@ -393,0 +400,0 @@ scriptEle.addEventListener('load', () => { |
{ | ||
"name": "@descope/sdk-mixins", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"author": "Descope Team <info@descope.com>", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/descope/sdk-mixins", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
665074
8331