dash-button-web 0.0.22 → 0.0.23
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/dash-button.cjs.entry.js +32 -13
- package/dist/cjs/dash-button.cjs.entry.js.map +1 -1
- package/dist/collection/components/my-component/dash-button.js +30 -13
- package/dist/collection/components/my-component/dash-button.js.map +1 -1
- package/dist/collection/services/config.js +2 -0
- package/dist/collection/services/config.js.map +1 -1
- package/dist/components/dash-button.js +32 -13
- package/dist/components/dash-button.js.map +1 -1
- package/dist/esm/dash-button.entry.js +32 -13
- package/dist/esm/dash-button.entry.js.map +1 -1
- package/dist/types/services/config.d.ts +2 -0
- package/dist/web-compnont/p-2e8505f3.entry.js +10 -0
- package/dist/web-compnont/p-2e8505f3.entry.js.map +1 -0
- package/dist/web-compnont/web-compnont.esm.js +1 -1
- package/package.json +1 -1
- package/readme.md +3 -0
- package/dist/web-compnont/p-ad318f06.entry.js +0 -10
- package/dist/web-compnont/p-ad318f06.entry.js.map +0 -1
|
@@ -3895,6 +3895,8 @@ const DEFAULT_CONFIG = {
|
|
|
3895
3895
|
isLoading: true,
|
|
3896
3896
|
duration: 800
|
|
3897
3897
|
},
|
|
3898
|
+
allowedGlobalDomain: '',
|
|
3899
|
+
whitelistedUrls: ''
|
|
3898
3900
|
};
|
|
3899
3901
|
// Fetch config from API
|
|
3900
3902
|
class ConfigService {
|
|
@@ -4118,27 +4120,44 @@ const DashButtonComponent = class {
|
|
|
4118
4120
|
}
|
|
4119
4121
|
}
|
|
4120
4122
|
}
|
|
4123
|
+
// First, check global links
|
|
4124
|
+
// Then, check the token's organization URL
|
|
4125
|
+
// Finally, check against dashbutton configuration: allowedGlobalDomain and whitelistedUrls
|
|
4121
4126
|
validateAppAccessByUrl() {
|
|
4122
|
-
var _a, _b, _c, _d;
|
|
4123
|
-
const
|
|
4124
|
-
const
|
|
4127
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4128
|
+
const normalizeUrl = (url) => url.replace(/\/+$/, '');
|
|
4129
|
+
const currentUrl = normalizeUrl(window.location.href);
|
|
4130
|
+
const currentOrigin = normalizeUrl(window.location.origin);
|
|
4125
4131
|
const globalLinks = ((_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.menu) === null || _b === void 0 ? void 0 : _b.global) === null || _c === void 0 ? void 0 : _c.links) || [];
|
|
4126
|
-
|
|
4132
|
+
const allowedGlobalDomain = ((_d = this.config) === null || _d === void 0 ? void 0 : _d.allowedGlobalDomain) || '';
|
|
4133
|
+
const whitelistedUrls = ((_e = this.config) === null || _e === void 0 ? void 0 : _e.whitelistedUrls) || '';
|
|
4134
|
+
// First, check global links
|
|
4127
4135
|
const matchGlobal = globalLinks.some(link => {
|
|
4128
4136
|
try {
|
|
4129
|
-
const linkOrigin = new URL(link.url).origin;
|
|
4137
|
+
const linkOrigin = normalizeUrl(new URL(link.url).origin);
|
|
4130
4138
|
return currentOrigin === linkOrigin;
|
|
4131
4139
|
}
|
|
4132
4140
|
catch (_a) {
|
|
4133
4141
|
return false;
|
|
4134
4142
|
}
|
|
4135
4143
|
});
|
|
4136
|
-
//
|
|
4137
|
-
const tokenParsed = (
|
|
4144
|
+
// Then check the token organization URL
|
|
4145
|
+
const tokenParsed = (_f = this.keycloak) === null || _f === void 0 ? void 0 : _f.tokenParsed;
|
|
4138
4146
|
const allowedOrg = tokenParsed === null || tokenParsed === void 0 ? void 0 : tokenParsed.organizationUrl;
|
|
4139
|
-
const matchOrganization = allowedOrg && currentUrl.includes(allowedOrg);
|
|
4140
|
-
//
|
|
4141
|
-
const
|
|
4147
|
+
const matchOrganization = allowedOrg && currentUrl.includes(normalizeUrl(allowedOrg));
|
|
4148
|
+
// Check allowedGlobalDomain (single domain)
|
|
4149
|
+
const matchAllowedDomain = allowedGlobalDomain &&
|
|
4150
|
+
currentOrigin.includes(normalizeUrl(allowedGlobalDomain));
|
|
4151
|
+
// Check whitelistedUrls (comma-separated string)
|
|
4152
|
+
const whitelistedArray = whitelistedUrls
|
|
4153
|
+
? whitelistedUrls.split(',').map(url => normalizeUrl(url.trim()))
|
|
4154
|
+
: [];
|
|
4155
|
+
const matchWhitelisted = whitelistedArray.some(url => currentUrl.includes(url));
|
|
4156
|
+
// Final validation
|
|
4157
|
+
const isAllowed = matchGlobal ||
|
|
4158
|
+
matchOrganization ||
|
|
4159
|
+
matchAllowedDomain ||
|
|
4160
|
+
matchWhitelisted;
|
|
4142
4161
|
this.isRestricted = !isAllowed;
|
|
4143
4162
|
}
|
|
4144
4163
|
login() {
|
|
@@ -4160,7 +4179,7 @@ const DashButtonComponent = class {
|
|
|
4160
4179
|
}
|
|
4161
4180
|
render() {
|
|
4162
4181
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
4163
|
-
return h("div", { key: '
|
|
4182
|
+
return h("div", { key: '370786aa472fafd2bf9509a18bd62c87ac2893c7' }, h("div", { key: 'c0b091b19e7981ecc48e95c03c8d91e77e7a88df' }, (() => {
|
|
4164
4183
|
var _a, _b, _c, _d, _e, _f;
|
|
4165
4184
|
// GLOBAL LOADING SPINNER
|
|
4166
4185
|
if (this.isLoading) {
|
|
@@ -4187,7 +4206,7 @@ const DashButtonComponent = class {
|
|
|
4187
4206
|
else {
|
|
4188
4207
|
return (h("button", { style: { background: this.primaryColor != undefined ? this.primaryColor : "" }, onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { style: { color: this.accentColor != undefined ? this.accentColor : "" }, class: "button-text" }, "Login")));
|
|
4189
4208
|
}
|
|
4190
|
-
})()), h("div", { key: '
|
|
4209
|
+
})()), h("div", { key: 'f98304920ef08f842700c5d26fe62a51cbbade96', id: "appListModal", class: "modal" }, h("div", { key: '2c4024b83e3cd0d638f4482d0e8907687ac12dd0', class: "modal-content" }, h("span", { key: '42a44145a7d7c33cae95344f02229d8163cc9607', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("div", { key: 'ec3dbe646c76818ee90ec28e19671880670a2754', class: "box" }, h("input", { type: "radio", class: "tab-toggle", name: "tab-toggle", id: "tab1", checked: true }), h("ul", { key: 'c7dbcfd1b183bc6845cab0f17ef6f81dee30867f', class: "tab-list" }, h("li", { class: "tab-item" }, h("label", { class: "tab-trigger", htmlFor: "tab1" }, h("i", { class: "fa-solid fa-table-list menu-bar-icons" }), " ", this.config.menu.local.name))), h("div", { key: 'dc58df8e838c8babe3c679c6f1c498e286448cf3', class: "tab-container" }, h("div", { key: '486acbf570543ef0a92bd919e1c9c7973c87b3a7', class: "tab-content" }, h("div", { key: 'c9e093ce8d745097147405749e88ba35b1fc8679', class: "modal-body" }, !((_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.menu) === null || _b === void 0 ? void 0 : _b.local) === null || _c === void 0 ? void 0 : _c.enableCustomLocalMenu) ? (
|
|
4191
4210
|
// <div>{this.localMenuLinks}</div>
|
|
4192
4211
|
(_d = this.localMenuLinks) === null || _d === void 0 ? void 0 : _d.map((app, index) => {
|
|
4193
4212
|
const isDisabled = !app.url;
|
|
@@ -4195,7 +4214,7 @@ const DashButtonComponent = class {
|
|
|
4195
4214
|
})) : ((_e = this.config.menu.local.links) === null || _e === void 0 ? void 0 : _e.map((app, index) => (h("a", { key: index, class: "external-app-link", target: "_blank", rel: "noopener noreferrer", href: app.url }, h("div", { class: "modal-app" }, h("div", null, app.name)))))), !this.organizationUrl ? (h("div", null, h("h3", { class: "gray-text" }, "Organization Domain URL not set"), h("p", { class: "gray-text" }, "Please set your Organization Domain URL on the Portal profile page."))) : (((!((_h = (_g = (_f = this.config) === null || _f === void 0 ? void 0 : _f.menu) === null || _g === void 0 ? void 0 : _g.local) === null || _h === void 0 ? void 0 : _h.enableCustomLocalMenu) &&
|
|
4196
4215
|
((_k = (_j = this.localMenuLinks) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0) === 0) ||
|
|
4197
4216
|
(((_o = (_m = (_l = this.config) === null || _l === void 0 ? void 0 : _l.menu) === null || _m === void 0 ? void 0 : _m.local) === null || _o === void 0 ? void 0 : _o.enableCustomLocalMenu) &&
|
|
4198
|
-
((_t = (_s = (_r = (_q = (_p = this.config) === null || _p === void 0 ? void 0 : _p.menu) === null || _q === void 0 ? void 0 : _q.local) === null || _r === void 0 ? void 0 : _r.links) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0) === 0)) && (h("div", null, h("h3", { class: "gray-text" }, "No installed ", ((_w = (_v = (_u = this.config) === null || _u === void 0 ? void 0 : _u.menu) === null || _v === void 0 ? void 0 : _v.local) === null || _w === void 0 ? void 0 : _w.name) || "menu", " found."), h("p", { class: "gray-text" }, "Please contact administration.")))))))))), h("div", { key: '
|
|
4217
|
+
((_t = (_s = (_r = (_q = (_p = this.config) === null || _p === void 0 ? void 0 : _p.menu) === null || _q === void 0 ? void 0 : _q.local) === null || _r === void 0 ? void 0 : _r.links) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0) === 0)) && (h("div", null, h("h3", { class: "gray-text" }, "No installed ", ((_w = (_v = (_u = this.config) === null || _u === void 0 ? void 0 : _u.menu) === null || _v === void 0 ? void 0 : _v.local) === null || _w === void 0 ? void 0 : _w.name) || "menu", " found."), h("p", { class: "gray-text" }, "Please contact administration.")))))))))), h("div", { key: '349c7ff69d94c988a278677f497c0a9fef85c59c', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: '788004858cf2f55f4e79cce0c023895274bab9ab', class: "modal-content" }, h("img", { key: '57ea43b0a21086eeaebe0585b9501967099ec999', src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGD0lEQVR4nO2cbU8TWRTH/W5WEAmF4nNiieFFoeBjYhQUWzUWYkpbDfGFCR9CoolvQF9aWgG3kMCG8LACC1ikuCuUh7bH/M/MmW131S2ZqTDjPcmkd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32AxjXS06QFLgZKUH9aPct7O3RVFfXf+BlHj6kZG2tBq+j47tpGs5LoYKrNpGI9v74cfsDHNazg+/dvFl4sNzmprHz2x5g8l9LWMTuzsePli7bYkMBgqVMfb39l3CqpeXbm0g8XhF439xEgkGjOmN7GTOjA4XU2Be8zs6y4MFmnzzRpJLfXypjenrsK6Qnvd4SSQGxCyFtNbxiIb1+/74mpL1e+wrp7NISp1ElqZwuZZB2WQkPZqRyevz7Eg5zCc22qVxxMUGWMRL94sTfKnjYfd+dPq15261bpcWEq1fJvuWsoSEt/3W7tRZlNMolJylxWQEPJTGRP6lTpwz5YpSz3ryxcUE1nzcaSeieFTeArIKH3Fq8GSX9koJqc7O9C6owNL0lO5CKsZTfzS7bqTt3+LPxornxKu2Cz6Oj5IymUkTLCOB54iWAKOIaMRE7JXbS/zOMwYYhMQ9/gOLOnPxBZh8/dlhb06+Vs9B6FIi4cYmJInGgEyGIkbHgc8idkWHgHHRecVsTMU/mwuuY3tYcv3TJWW1NGJrdJY113WtkdxaJU84BqSK7rRFXdc/Dd+w5rbFeDHG8rc2IiQj2UmwQsY1iKFIxlKSg46AjARfnkGGISOZHO6JRnkNiHjzPsY92iGFZoultLNu6OtZs+3m4CCIZnxGpIjGvUsv2UAEUQ9NblrSUoNDDQP4KT+TH2/QWJT/eFgjwNaRnnGHI4x3NzRXZbQ89QBg0GsQ2Wo+SnZR1uFycYbBI3kdv2XEAiw35KqQMGkDoYaCeaDzi29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC" }), h("h2", { key: 'c7663fb1503a0f0713350ac2ff2e52708c5425f9', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '925b21fffdee5437664f690254821ffa63d736cb', class: "green-text" }, "Please contact the administration."), (this.config.defaultLink.url && this.showUnauthorizedModal) ?
|
|
4199
4218
|
h("div", null, h("h4", { class: "gray-text" }, "You will be automatically redirected to the portal."), h("div", { id: "countdown" }, h("div", { id: "countdown-number" }), h("svg", null, h("circle", { r: "18", cx: "20", cy: "20" }))))
|
|
4200
4219
|
: h("div", null))));
|
|
4201
4220
|
}
|