@descope/sdk-mixins 0.2.42 → 0.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +38 -38
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +916 -632
- package/dist/index.esm.js +38 -38
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -5
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -26,9 +26,9 @@ const loggerMixin = sdkHelpers.createSingletonMixin((superclass) => { var _Logge
|
|
|
26
26
|
_LoggerMixinClass_wrapLogger = function _LoggerMixinClass_wrapLogger(logger) {
|
|
27
27
|
return logLevels.reduce((acc, logLevel) => {
|
|
28
28
|
acc[logLevel] = (...args) => {
|
|
29
|
-
var
|
|
29
|
+
var _b;
|
|
30
30
|
this.onLogEvent(logLevel, args);
|
|
31
|
-
(
|
|
31
|
+
(_b = logger[logLevel]) === null || _b === void 0 ? void 0 : _b.call(logger, ...args);
|
|
32
32
|
};
|
|
33
33
|
return acc;
|
|
34
34
|
}, {});
|
|
@@ -51,9 +51,9 @@ const initLifecycleMixin = sdkHelpers.createSingletonMixin((superclass) => { var
|
|
|
51
51
|
_InitLifecycleMixinClass_isInit.set(this, true);
|
|
52
52
|
}
|
|
53
53
|
connectedCallback() {
|
|
54
|
-
var
|
|
55
|
-
(
|
|
56
|
-
if ((
|
|
54
|
+
var _b, _c;
|
|
55
|
+
(_b = super.connectedCallback) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
56
|
+
if ((_c = this.shadowRoot) === null || _c === void 0 ? void 0 : _c.isConnected) {
|
|
57
57
|
// the init function is running once, on the first time the component is connected
|
|
58
58
|
if (tslib.__classPrivateFieldGet(this, _InitLifecycleMixinClass_isInit, "f")) {
|
|
59
59
|
tslib.__classPrivateFieldSet(this, _InitLifecycleMixinClass_isInit, false, "f");
|
|
@@ -89,11 +89,11 @@ const observeAttributesMixin = sdkHelpers.createSingletonMixin((superclass) => {
|
|
|
89
89
|
_ObserveAttributesMixinClass_observeMappings.set(this, {});
|
|
90
90
|
}
|
|
91
91
|
async init() {
|
|
92
|
-
var
|
|
93
|
-
await ((
|
|
92
|
+
var _b;
|
|
93
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
94
94
|
attributesObserver(this, (attrName) => {
|
|
95
|
-
var
|
|
96
|
-
(
|
|
95
|
+
var _b;
|
|
96
|
+
(_b = tslib.__classPrivateFieldGet(this, _ObserveAttributesMixinClass_observeMappings, "f")[attrName]) === null || _b === void 0 ? void 0 : _b.forEach((cb) => {
|
|
97
97
|
cb(attrName, this.getAttribute(attrName));
|
|
98
98
|
});
|
|
99
99
|
});
|
|
@@ -128,8 +128,8 @@ const createValidateAttributesMixin = (mappings) => (superclass) => {
|
|
|
128
128
|
this.observeAttributes(mappingsNames, tslib.__classPrivateFieldGet(this, _ValidateAttributesMixinClass_instances, "m", _ValidateAttributesMixinClass_handleError).bind(this));
|
|
129
129
|
}
|
|
130
130
|
async init() {
|
|
131
|
-
var
|
|
132
|
-
await ((
|
|
131
|
+
var _b;
|
|
132
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
133
133
|
// check attributes initial values
|
|
134
134
|
mappingsNames.forEach((attr) => tslib.__classPrivateFieldGet(this, _ValidateAttributesMixinClass_instances, "m", _ValidateAttributesMixinClass_handleError).call(this, attr, this.getAttribute(attr)));
|
|
135
135
|
}
|
|
@@ -233,8 +233,8 @@ const debuggerMixin = sdkHelpers.createSingletonMixin((superclass) => { var _Deb
|
|
|
233
233
|
_DebuggerMixinClass_instances.add(this);
|
|
234
234
|
_DebuggerMixinClass_debuggerEle.set(this, void 0);
|
|
235
235
|
this.attributeChangedCallback = (attrName, oldValue, newValue) => {
|
|
236
|
-
var
|
|
237
|
-
(
|
|
236
|
+
var _b;
|
|
237
|
+
(_b = super.attributeChangedCallback) === null || _b === void 0 ? void 0 : _b.call(this, attrName, oldValue, newValue);
|
|
238
238
|
if (attrName === 'debug') {
|
|
239
239
|
tslib.__classPrivateFieldGet(this, _DebuggerMixinClass_instances, "m", _DebuggerMixinClass_handleDebugMode).call(this);
|
|
240
240
|
}
|
|
@@ -244,23 +244,23 @@ const debuggerMixin = sdkHelpers.createSingletonMixin((superclass) => { var _Deb
|
|
|
244
244
|
return this.getAttribute('debug') === 'true';
|
|
245
245
|
}
|
|
246
246
|
onLogEvent(logLevel, args) {
|
|
247
|
-
var
|
|
248
|
-
(
|
|
247
|
+
var _b;
|
|
248
|
+
(_b = super.onLogEvent) === null || _b === void 0 ? void 0 : _b.call(this, logLevel, args);
|
|
249
249
|
if (logLevel === 'error') {
|
|
250
250
|
tslib.__classPrivateFieldGet(this, _DebuggerMixinClass_instances, "m", _DebuggerMixinClass_updateDebuggerMessages).call(this, args[0] || 'Error', args[1]);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
async init() {
|
|
254
|
-
var
|
|
255
|
-
await ((
|
|
254
|
+
var _b;
|
|
255
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
256
256
|
tslib.__classPrivateFieldGet(this, _DebuggerMixinClass_instances, "m", _DebuggerMixinClass_handleDebugMode).call(this);
|
|
257
257
|
}
|
|
258
258
|
},
|
|
259
259
|
_DebuggerMixinClass_debuggerEle = new WeakMap(),
|
|
260
260
|
_DebuggerMixinClass_instances = new WeakSet(),
|
|
261
261
|
_DebuggerMixinClass_disableDebugger = function _DebuggerMixinClass_disableDebugger() {
|
|
262
|
-
var
|
|
263
|
-
(
|
|
262
|
+
var _b;
|
|
263
|
+
(_b = tslib.__classPrivateFieldGet(this, _DebuggerMixinClass_debuggerEle, "f")) === null || _b === void 0 ? void 0 : _b.remove();
|
|
264
264
|
tslib.__classPrivateFieldSet(this, _DebuggerMixinClass_debuggerEle, null, "f");
|
|
265
265
|
},
|
|
266
266
|
_DebuggerMixinClass_enableDebugger = async function _DebuggerMixinClass_enableDebugger() {
|
|
@@ -285,9 +285,9 @@ const debuggerMixin = sdkHelpers.createSingletonMixin((superclass) => { var _Deb
|
|
|
285
285
|
tslib.__classPrivateFieldGet(this, _DebuggerMixinClass_instances, "m", _DebuggerMixinClass_disableDebugger).call(this);
|
|
286
286
|
},
|
|
287
287
|
_DebuggerMixinClass_updateDebuggerMessages = function _DebuggerMixinClass_updateDebuggerMessages(title, description) {
|
|
288
|
-
var
|
|
288
|
+
var _b;
|
|
289
289
|
if (title)
|
|
290
|
-
(
|
|
290
|
+
(_b = tslib.__classPrivateFieldGet(this, _DebuggerMixinClass_debuggerEle, "f")) === null || _b === void 0 ? void 0 : _b.updateData({ title, description });
|
|
291
291
|
},
|
|
292
292
|
_a; });
|
|
293
293
|
|
|
@@ -341,9 +341,9 @@ const descopeUiMixin = sdkHelpers.createSingletonMixin((superclass) => {
|
|
|
341
341
|
_DescopeUiMixinClass_getComponentsVersion =
|
|
342
342
|
// eslint-disable-next-line class-methods-use-this
|
|
343
343
|
async function _DescopeUiMixinClass_getComponentsVersion() {
|
|
344
|
-
var
|
|
344
|
+
var _b;
|
|
345
345
|
const config = await this.config;
|
|
346
|
-
const componentsVersion = (
|
|
346
|
+
const componentsVersion = (_b = config === null || config === void 0 ? void 0 : config.projectConfig) === null || _b === void 0 ? void 0 : _b.componentsVersion;
|
|
347
347
|
if (!componentsVersion) {
|
|
348
348
|
this.logger.error('Could not get components version');
|
|
349
349
|
}
|
|
@@ -522,9 +522,9 @@ const modalMixin = sdkHelpers.createSingletonMixin((superclass) => {
|
|
|
522
522
|
});
|
|
523
523
|
}
|
|
524
524
|
async init() {
|
|
525
|
-
var
|
|
525
|
+
var _b;
|
|
526
526
|
this.loadDescopeUiComponents([MODAL_ELE_TAG]);
|
|
527
|
-
await ((
|
|
527
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
528
528
|
}
|
|
529
529
|
},
|
|
530
530
|
_ModalMixinClass_ModalDriverWrapper = new WeakMap(),
|
|
@@ -569,8 +569,8 @@ const notificationsMixin = sdkHelpers.createSingletonMixin((superclass) => {
|
|
|
569
569
|
});
|
|
570
570
|
}
|
|
571
571
|
async init() {
|
|
572
|
-
var
|
|
573
|
-
await ((
|
|
572
|
+
var _b;
|
|
573
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
574
574
|
this.loadDescopeUiComponents([NOTIFICATION_ELE_TAG]);
|
|
575
575
|
}
|
|
576
576
|
},
|
|
@@ -622,18 +622,18 @@ const themeMixin = sdkHelpers.createSingletonMixin((superclass) => {
|
|
|
622
622
|
_ThemeMixinClass__themeResource.set(this, void 0);
|
|
623
623
|
}
|
|
624
624
|
get theme() {
|
|
625
|
-
var
|
|
625
|
+
var _b, _c;
|
|
626
626
|
const theme = this.getAttribute('theme');
|
|
627
627
|
if (theme === 'os') {
|
|
628
628
|
const isOsDark = window.matchMedia &&
|
|
629
|
-
((
|
|
629
|
+
((_c = (_b = window.matchMedia) === null || _b === void 0 ? void 0 : _b.call(window, '(prefers-color-scheme: dark)')) === null || _c === void 0 ? void 0 : _c.matches);
|
|
630
630
|
return isOsDark ? 'dark' : 'light';
|
|
631
631
|
}
|
|
632
632
|
return theme || 'light';
|
|
633
633
|
}
|
|
634
634
|
async init() {
|
|
635
|
-
var
|
|
636
|
-
await ((
|
|
635
|
+
var _b;
|
|
636
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
637
637
|
tslib.__classPrivateFieldGet(this, _ThemeMixinClass_instances, "m", _ThemeMixinClass_loadGlobalStyle).call(this);
|
|
638
638
|
tslib.__classPrivateFieldGet(this, _ThemeMixinClass_instances, "m", _ThemeMixinClass_loadComponentsStyle).call(this);
|
|
639
639
|
tslib.__classPrivateFieldGet(this, _ThemeMixinClass_instances, "m", _ThemeMixinClass_loadFonts).call(this);
|
|
@@ -685,32 +685,32 @@ const themeMixin = sdkHelpers.createSingletonMixin((superclass) => {
|
|
|
685
685
|
return tslib.__classPrivateFieldGet(this, _ThemeMixinClass__themeResource, "f");
|
|
686
686
|
},
|
|
687
687
|
_ThemeMixinClass_loadGlobalStyle = async function _ThemeMixinClass_loadGlobalStyle() {
|
|
688
|
-
var
|
|
688
|
+
var _b, _c;
|
|
689
689
|
const theme = await tslib.__classPrivateFieldGet(this, _ThemeMixinClass_instances, "a", _ThemeMixinClass_themeResource_get);
|
|
690
690
|
if (!theme)
|
|
691
691
|
return;
|
|
692
692
|
const styleEle = document.createElement('style');
|
|
693
693
|
styleEle.innerText =
|
|
694
|
-
(((
|
|
694
|
+
(((_b = theme === null || theme === void 0 ? void 0 : theme.light) === null || _b === void 0 ? void 0 : _b.globals) || '') + (((_c = theme === null || theme === void 0 ? void 0 : theme.dark) === null || _c === void 0 ? void 0 : _c.globals) || '');
|
|
695
695
|
this.shadowRoot.appendChild(styleEle);
|
|
696
696
|
},
|
|
697
697
|
_ThemeMixinClass_loadComponentsStyle = async function _ThemeMixinClass_loadComponentsStyle() {
|
|
698
|
-
var
|
|
698
|
+
var _b, _c;
|
|
699
699
|
const theme = Object.assign({}, (await tslib.__classPrivateFieldGet(this, _ThemeMixinClass_instances, "a", _ThemeMixinClass_themeResource_get)));
|
|
700
700
|
if (!theme)
|
|
701
701
|
return;
|
|
702
702
|
const descopeUi = await this.descopeUi;
|
|
703
703
|
if (descopeUi === null || descopeUi === void 0 ? void 0 : descopeUi.componentsThemeManager) {
|
|
704
704
|
descopeUi.componentsThemeManager.themes = {
|
|
705
|
-
light: (
|
|
706
|
-
dark: (
|
|
705
|
+
light: (_b = theme === null || theme === void 0 ? void 0 : theme.light) === null || _b === void 0 ? void 0 : _b.components,
|
|
706
|
+
dark: (_c = theme === null || theme === void 0 ? void 0 : theme.dark) === null || _c === void 0 ? void 0 : _c.components,
|
|
707
707
|
};
|
|
708
708
|
}
|
|
709
709
|
},
|
|
710
710
|
_ThemeMixinClass_loadFonts = async function _ThemeMixinClass_loadFonts() {
|
|
711
|
-
var
|
|
711
|
+
var _b, _c;
|
|
712
712
|
const { projectConfig } = await this.config;
|
|
713
|
-
const fonts = (
|
|
713
|
+
const fonts = (_c = (_b = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.cssTemplate) === null || _b === void 0 ? void 0 : _b[this.theme]) === null || _c === void 0 ? void 0 : _c.fonts;
|
|
714
714
|
if (fonts) {
|
|
715
715
|
Object.values(fonts).forEach((font) => {
|
|
716
716
|
if (font.url) {
|