@syncfy/authentication-widget 1.6.1 → 2.1.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/README.md +97 -65
- package/dist/mockServiceWorker.js +344 -344
- package/dist/syncfy-authentication-widget.cjs.js +6378 -128106
- package/dist/syncfy-authentication-widget.css +59 -6
- package/dist/syncfy-authentication-widget.esm.js +6190 -127918
- package/dist/syncfy-authentication-widget.umd.js +173 -151
- package/package.json +134 -131
- package/types/main.d.ts +306 -306
package/README.md
CHANGED
|
@@ -1,65 +1,97 @@
|
|
|
1
|
-
# Sync Widget
|
|
2
|
-
|
|
3
|
-
User friendly web interface to make use of Syncfy services.
|
|
4
|
-
|
|
5
|
-
# Quick Start
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
Syncfy authentication widget can be installed via npm. It is recommended to get Syncfy authentication widget this way.
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
npm install --save @syncfy/authentication-widget
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
**Note**: You'll need to have npm 2.7.0 or greater installed, since this library is hosted as a [scoped package](https://docs.npmjs.com/getting-started/scoped-packages).
|
|
16
|
-
|
|
17
|
-
## Integration
|
|
18
|
-
|
|
19
|
-
### Using bundlers (Webpack)
|
|
20
|
-
|
|
21
|
-
Import styles
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
import "@syncfy/authentication-widget/dist/syncfy-authentication-widget.css";
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Import SyncfyWidget class
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
import SyncfyWidget from "@syncfy/authentication-widget";
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Usage
|
|
34
|
-
|
|
35
|
-
### Creating an instance
|
|
36
|
-
|
|
37
|
-
To create an instance of SyncfyWidget, you need to create an element in the DOM with a unique selector. By default SyncfyWidget will search for "#widget". Here's an example.
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
<div id="widget"></div>
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Once you have the element, you're ready to instantiate a new SyncfyWidget with your desired configuration.
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
// Any of the following formats may be used
|
|
47
|
-
|
|
48
|
-
var syncfyWidget = new SyncfyWidget("syncfy_token");
|
|
49
|
-
|
|
50
|
-
var syncfyWidget = new SyncfyWidget({
|
|
51
|
-
token: "syncfy_token"
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
var syncfyWidget = new SyncfyWidget({
|
|
55
|
-
token: "syncfy_token",
|
|
56
|
-
element: "#widget",
|
|
57
|
-
config: {
|
|
58
|
-
locale: "es",
|
|
59
|
-
entrypoint: {
|
|
60
|
-
country: "MX"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
```
|
|
1
|
+
# Sync Widget
|
|
2
|
+
|
|
3
|
+
User friendly web interface to make use of Syncfy services.
|
|
4
|
+
|
|
5
|
+
# Quick Start
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Syncfy authentication widget can be installed via npm. It is recommended to get Syncfy authentication widget this way.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm install --save @syncfy/authentication-widget
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Note**: You'll need to have npm 2.7.0 or greater installed, since this library is hosted as a [scoped package](https://docs.npmjs.com/getting-started/scoped-packages).
|
|
16
|
+
|
|
17
|
+
## Integration
|
|
18
|
+
|
|
19
|
+
### Using bundlers (Webpack)
|
|
20
|
+
|
|
21
|
+
Import styles
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
import "@syncfy/authentication-widget/dist/syncfy-authentication-widget.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Import SyncfyWidget class
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
import SyncfyWidget from "@syncfy/authentication-widget";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Creating an instance
|
|
36
|
+
|
|
37
|
+
To create an instance of SyncfyWidget, you need to create an element in the DOM with a unique selector. By default SyncfyWidget will search for "#widget". Here's an example.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
<div id="widget"></div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Once you have the element, you're ready to instantiate a new SyncfyWidget with your desired configuration.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
// Any of the following formats may be used
|
|
47
|
+
|
|
48
|
+
var syncfyWidget = new SyncfyWidget("syncfy_token");
|
|
49
|
+
|
|
50
|
+
var syncfyWidget = new SyncfyWidget({
|
|
51
|
+
token: "syncfy_token"
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
var syncfyWidget = new SyncfyWidget({
|
|
55
|
+
token: "syncfy_token",
|
|
56
|
+
element: "#widget",
|
|
57
|
+
config: {
|
|
58
|
+
locale: "es",
|
|
59
|
+
entrypoint: {
|
|
60
|
+
country: "MX"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Consent checkbox
|
|
68
|
+
|
|
69
|
+
`config.navigation.requireConsent` is **off by default**, and the widget behaves exactly as it always has while it stays off.
|
|
70
|
+
|
|
71
|
+
Turn it on and the widget requests the consent declaration from the backend when the credential form is shown, renders it verbatim with links to the privacy notice and terms, and keeps the submit button disabled until the person ticks the box.
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
var syncfyWidget = new SyncfyWidget({
|
|
75
|
+
token: "syncfy_token",
|
|
76
|
+
config: {
|
|
77
|
+
navigation: {
|
|
78
|
+
requireConsent: true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Whether the consent is actually mandatory for a given integrator is decided by the backend from the contract. This option only controls whether the widget asks for it.
|
|
85
|
+
|
|
86
|
+
## ⚠️ Environment Compatibility
|
|
87
|
+
|
|
88
|
+
If you are using modern build tools (like Vite in Angular 16+ or Next.js), you may encounter a ReferenceError: global is not defined. This happens because modern environments do not include Node.js polyfills by default.
|
|
89
|
+
To resolve this, add the following shim to your project's entry point (e.g., polyfills.ts, main.ts, or layout.tsx):
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
// Fix for "global is not defined"
|
|
93
|
+
|
|
94
|
+
if (typeof global === 'undefined') {
|
|
95
|
+
(window as any).global = window;
|
|
96
|
+
}
|
|
97
|
+
```
|