@authid/web-component 1.3.0 → 1.4.0
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/CHANGELOG.txt +3 -0
- package/README.md +1 -1
- package/authid-web-component.js +8 -14
- package/example.html +5 -0
- package/package.json +1 -1
package/CHANGELOG.txt
ADDED
package/README.md
CHANGED
|
@@ -20,5 +20,5 @@ Please see `example.html` for full details.
|
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
22
|
<script src="path-to/authid-web-component.js"></script>
|
|
23
|
-
<authid-component data-url="https://id.
|
|
23
|
+
<authid-component data-url="https://id.authid.ai/?...."></authid-component>
|
|
24
24
|
```
|
package/authid-web-component.js
CHANGED
|
@@ -41,26 +41,13 @@ class AuthIDComponent extends HTMLElement {
|
|
|
41
41
|
'border: 0;' +
|
|
42
42
|
'padding: 0;' +
|
|
43
43
|
'margin: 0;' +
|
|
44
|
-
'}' +
|
|
45
|
-
'svg {' +
|
|
46
|
-
'position: fixed;' +
|
|
47
|
-
'top: 50%;' +
|
|
48
|
-
'left: 50%;' +
|
|
49
|
-
'transform: translate(-50%, -50%);' +
|
|
50
44
|
'}'
|
|
51
45
|
);
|
|
52
46
|
|
|
53
|
-
const loader = new DOMParser().parseFromString(
|
|
54
|
-
'<svg width="200" height="32" viewBox="0 0 198 32" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="15" fill="url(#waitGrdnt)" stroke="white" stroke-width="3"></circle><circle cx="58" cy="16" r="15" fill="url(#waitGrdnt)" stroke="white" stroke-width="3"></circle><circle cx="100" cy="16" r="15" fill="url(#waitGrdnt)" stroke="white" stroke-width="3"></circle><circle cx="142" cy="16" r="15" fill="url(#waitGrdnt)" stroke="white" stroke-width="3"></circle><circle cx="184" cy="16" r="15" fill="url(#waitGrdnt)" stroke="white" stroke-width="3"></circle><defs><linearGradient id="waitGrdnt" x1="0" y1="0" x2="100%" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#5B217D"><animate attributeName="stop-color" values="#0166B3;#5B217D;#0166B3" dur="2s" repeatCount="indefinite"></animate></stop><stop offset="1" stop-color="#0166B3"><animate attributeName="stop-color" values="#5B217D;#0166B3;#5B217D" dur="2s" repeatCount="indefinite"></animate></stop></linearGradient></defs></svg>',
|
|
55
|
-
'image/svg+xml'
|
|
56
|
-
);
|
|
57
|
-
|
|
58
47
|
const shadow = this.attachShadow({ mode: 'closed' });
|
|
59
48
|
shadow.appendChild(styleNode);
|
|
60
49
|
const container = document.createElement('div');
|
|
61
|
-
container.appendChild(container.ownerDocument.importNode(loader.documentElement, true));
|
|
62
50
|
shadow.appendChild(container);
|
|
63
|
-
shadow.appendChild(iframe);
|
|
64
51
|
|
|
65
52
|
const dataWebauth = this.getAttribute('data-webauth');
|
|
66
53
|
|
|
@@ -78,8 +65,15 @@ class AuthIDComponent extends HTMLElement {
|
|
|
78
65
|
shadow.appendChild(controlHandler);
|
|
79
66
|
}
|
|
80
67
|
|
|
68
|
+
shadow.appendChild(iframe);
|
|
69
|
+
|
|
81
70
|
iframe.addEventListener('load', () => {
|
|
82
|
-
|
|
71
|
+
shadow.removeChild(container);
|
|
72
|
+
|
|
73
|
+
shadow.dispatchEvent(new CustomEvent('load', {
|
|
74
|
+
composed: true,
|
|
75
|
+
bubbles: true,
|
|
76
|
+
}));
|
|
83
77
|
}, { capture: true, once: true });
|
|
84
78
|
|
|
85
79
|
if (window.getComputedStyle(this)['z-index'] === 'auto') {
|
package/example.html
CHANGED
|
@@ -11,5 +11,10 @@
|
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<authid-component data-url="https://id.authid.ai/?demo" data-webauth="true"></authid-component>
|
|
14
|
+
<script>
|
|
15
|
+
document.getElementsByTagName('authid-component')[0].addEventListener('load', function(){
|
|
16
|
+
console.log('Iframe has just loaded, the component is ready');
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
14
19
|
</body>
|
|
15
20
|
</html>
|