@descope/web-components-ui 1.0.367 → 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 +539 -527
- 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/src/index.js +2 -0
package/dist/cjs/index.cjs.js
CHANGED
@@ -2622,7 +2622,9 @@ const getFileExtension = (path) => {
|
|
2622
2622
|
return match ? match[1] : null;
|
2623
2623
|
};
|
2624
2624
|
|
2625
|
-
const
|
2625
|
+
const base64Prefix = 'data:image/svg+xml;base64,';
|
2626
|
+
|
2627
|
+
const isBase64Svg = (src) => src.startsWith(base64Prefix);
|
2626
2628
|
|
2627
2629
|
const createImgEle = (src) => {
|
2628
2630
|
const ele = document.createElement('img');
|
@@ -2639,12 +2641,17 @@ const createSvgEle = (text) => {
|
|
2639
2641
|
const createIcon = async (src) => {
|
2640
2642
|
try {
|
2641
2643
|
let ele;
|
2642
|
-
|
2643
|
-
|
2644
|
+
if (isBase64Svg(src)) {
|
2645
|
+
// handle base64 source
|
2646
|
+
const svgXml = atob(src.slice(base64Prefix.length));
|
2647
|
+
ele = createSvgEle(svgXml);
|
2648
|
+
} else if (getFileExtension(src) === 'svg') {
|
2649
|
+
// handle urls
|
2644
2650
|
const fetchedSrc = await fetch(src);
|
2645
2651
|
const text = await fetchedSrc.text();
|
2646
2652
|
ele = createSvgEle(text);
|
2647
2653
|
} else {
|
2654
|
+
// handle binary
|
2648
2655
|
ele = createImgEle(src);
|
2649
2656
|
}
|
2650
2657
|
|