@authid/web-component 1.2.0 → 1.3.1

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/README.md CHANGED
@@ -12,6 +12,7 @@ This integration is the most universal one as it can be used with any frontend t
12
12
  - `data-target` - force selection of either `mobile` or `desktop` integration variant, `auto` is the default.
13
13
  *NOTE: this parameter is obsolete, and it has no effect at the moment.*
14
14
  - `data-webauth="true"` - enable automatic handling of Passkey features.
15
+ - `data-control="true"` - enable advanced control features.
15
16
 
16
17
  ## Example
17
18
 
@@ -19,5 +20,5 @@ Please see `example.html` for full details.
19
20
 
20
21
  ```html
21
22
  <script src="path-to/authid-web-component.js"></script>
22
- <authid-component data-url="https://id.ipsidy.net/?...."></authid-component>
23
+ <authid-component data-url="https://id.authid.ai/?...."></authid-component>
23
24
  ```
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2022 authID.ai (Ipsidy, Inc.)
2
+ * Copyright 2022-2023 authID.ai (Ipsidy, Inc.)
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -60,7 +60,6 @@ class AuthIDComponent extends HTMLElement {
60
60
  const container = document.createElement('div');
61
61
  container.appendChild(container.ownerDocument.importNode(loader.documentElement, true));
62
62
  shadow.appendChild(container);
63
- shadow.appendChild(iframe);
64
63
 
65
64
  const dataWebauth = this.getAttribute('data-webauth');
66
65
 
@@ -70,8 +69,23 @@ class AuthIDComponent extends HTMLElement {
70
69
  shadow.appendChild(webauthHandler);
71
70
  }
72
71
 
72
+ const dataControl = this.getAttribute('data-control');
73
+
74
+ if (dataControl && dataControl !== 'false' && dataControl !== 'no') {
75
+ const controlHandler = document.createElement('script');
76
+ controlHandler.setAttribute('src', dataUrl.replace('/?', '/controlhandler.js?'));
77
+ shadow.appendChild(controlHandler);
78
+ }
79
+
80
+ shadow.appendChild(iframe);
81
+
73
82
  iframe.addEventListener('load', () => {
74
- shadow.removeChild(container);
83
+ shadow.removeChild(container);
84
+
85
+ shadow.dispatchEvent(new CustomEvent('load', {
86
+ composed: true,
87
+ bubbles: true,
88
+ }));
75
89
  }, { capture: true, once: true });
76
90
 
77
91
  if (window.getComputedStyle(this)['z-index'] === 'auto') {
package/example.html CHANGED
@@ -10,6 +10,11 @@
10
10
  <script src="./authid-web-component.js"></script>
11
11
  </head>
12
12
  <body>
13
- <authid-component data-url="https://id-dev.ipsidy.net/?demo" data-webauth="true"></authid-component>
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>
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
- {
2
- "name": "@authid/web-component",
3
- "version": "1.2.0",
4
- "description": "authID integration as a Web Component",
5
- "main": "authid-web-component.js",
6
- "scripts": {
7
- "test": "eslint --ext .js ."
8
- },
9
- "keywords": [
10
- "authid",
11
- "identity",
12
- "authentication",
13
- "kyc"
14
- ],
15
- "author": "authID Team <team@authid.ai>",
16
- "license": "Apache-2.0",
17
- "devDependencies": {
18
- "eslint": "^8.23.1"
19
- }
20
- }
1
+ {
2
+ "name": "@authid/web-component",
3
+ "version": "1.3.1",
4
+ "description": "authID integration as a Web Component",
5
+ "main": "authid-web-component.js",
6
+ "scripts": {
7
+ "test": "eslint --ext .js ."
8
+ },
9
+ "keywords": [
10
+ "authid",
11
+ "identity",
12
+ "authentication",
13
+ "kyc"
14
+ ],
15
+ "author": "authID Team <team@authid.ai>",
16
+ "license": "Apache-2.0",
17
+ "devDependencies": {
18
+ "eslint": "^8.36.0"
19
+ }
20
+ }