@descope/web-components-ui 1.0.368 → 1.0.369
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +10 -3
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-multi-selection-group-index-js.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-index-js.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js +1 -1
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-icon-index-js.js +1 -1
- package/dist/umd/descope-upload-file-index-js.js +1 -1
- package/dist/umd/descope-user-attribute-index-js.js +1 -1
- package/dist/umd/descope-user-auth-method-index-js.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-icon/helpers.js +10 -3
package/dist/index.esm.js
CHANGED
@@ -1401,7 +1401,9 @@ const getFileExtension = (path) => {
|
|
1401
1401
|
return match ? match[1] : null;
|
1402
1402
|
};
|
1403
1403
|
|
1404
|
-
const
|
1404
|
+
const base64Prefix = 'data:image/svg+xml;base64,';
|
1405
|
+
|
1406
|
+
const isBase64Svg = (src) => src.startsWith(base64Prefix);
|
1405
1407
|
|
1406
1408
|
const createImgEle = (src) => {
|
1407
1409
|
const ele = document.createElement('img');
|
@@ -1418,12 +1420,17 @@ const createSvgEle = (text) => {
|
|
1418
1420
|
const createIcon = async (src) => {
|
1419
1421
|
try {
|
1420
1422
|
let ele;
|
1421
|
-
|
1422
|
-
|
1423
|
+
if (isBase64Svg(src)) {
|
1424
|
+
// handle base64 source
|
1425
|
+
const svgXml = atob(src.slice(base64Prefix.length));
|
1426
|
+
ele = createSvgEle(svgXml);
|
1427
|
+
} else if (getFileExtension(src) === 'svg') {
|
1428
|
+
// handle urls
|
1423
1429
|
const fetchedSrc = await fetch(src);
|
1424
1430
|
const text = await fetchedSrc.text();
|
1425
1431
|
ele = createSvgEle(text);
|
1426
1432
|
} else {
|
1433
|
+
// handle binary
|
1427
1434
|
ele = createImgEle(src);
|
1428
1435
|
}
|
1429
1436
|
|