UNPKG

@descope/sdk-mixins

Version:
28 lines (24 loc) 1.27 kB
'use strict'; var sdkHelpers = require('@descope/sdk-helpers'); var configMixin = require('../configMixin/configMixin.js'); var widgetIdMixin = require('../widgetIdMixin.js'); const widgetConfigMixin = sdkHelpers.createSingletonMixin((superclass) => { const BaseClass = sdkHelpers.compose(configMixin.configMixin, widgetIdMixin.widgetIdMixin)(superclass); return class WidgetConfigMixinClass extends BaseClass { // Required: without this empty override, TS infers `init` on the composed // base as a property (intersection of identical signatures from multiple // mixin paths), and any downstream class declaring `async init()` as a // method fails TS2425. async init() { var _a; await ((_a = super.init) === null || _a === void 0 ? void 0 : _a.call(this)); } async getWidgetConfig() { var _a, _b; const config = await this.config; return (_b = (_a = config === null || config === void 0 ? void 0 : config.projectConfig) === null || _a === void 0 ? void 0 : _a.widgets) === null || _b === void 0 ? void 0 : _b[this.widgetId]; } }; }); exports.widgetConfigMixin = widgetConfigMixin; //# sourceMappingURL=widgetConfigMixin.js.map