@ave-id/embed 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +68 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,6 +10,8 @@ npm install @ave-id/embed
10
10
 
11
11
  ## Usage
12
12
 
13
+ ### Inline iframe
14
+
13
15
  ```js
14
16
  import { mountAveEmbed } from "@ave-id/embed";
15
17
 
@@ -24,3 +26,69 @@ const { iframe } = mountAveEmbed({
24
26
  onError: (payload) => console.error("Embed error", payload),
25
27
  });
26
28
  ```
29
+
30
+ ### Modal sheet (mobile-friendly)
31
+
32
+ ```js
33
+ import { openAveSheet } from "@ave-id/embed";
34
+
35
+ const sheet = openAveSheet({
36
+ clientId: "YOUR_CLIENT_ID",
37
+ redirectUri: "https://yourapp.com/callback",
38
+ scope: "openid profile email",
39
+ onSuccess: ({ redirectUrl }) => {
40
+ window.location.href = redirectUrl;
41
+ },
42
+ onError: (payload) => console.error("Sheet error", payload),
43
+ onClose: () => console.log("Sheet closed"),
44
+ });
45
+
46
+ // sheet?.close();
47
+ ```
48
+
49
+ ### Popup window (desktop)
50
+
51
+ ```js
52
+ import { openAvePopup } from "@ave-id/embed";
53
+
54
+ const popup = openAvePopup({
55
+ clientId: "YOUR_CLIENT_ID",
56
+ redirectUri: "https://yourapp.com/callback",
57
+ scope: "openid profile email",
58
+ onSuccess: ({ redirectUrl }) => {
59
+ window.location.href = redirectUrl;
60
+ },
61
+ onError: (payload) => console.error("Popup error", payload),
62
+ onClose: () => console.log("Popup closed"),
63
+ });
64
+
65
+ // popup?.close();
66
+ ```
67
+
68
+ ## Options
69
+
70
+ Common:
71
+
72
+ - `clientId` (string)
73
+ - `redirectUri` (string)
74
+ - `scope` (string, default `openid profile email`)
75
+ - `issuer` (string, default `https://aveid.net`)
76
+ - `onSuccess(payload)`
77
+ - `onError(payload)`
78
+ - `onClose()`
79
+
80
+ `mountAveEmbed`:
81
+
82
+ - `container` (HTMLElement)
83
+ - `theme` (string)
84
+ - `width` (string | number)
85
+ - `height` (string | number)
86
+
87
+ `openAveSheet`:
88
+
89
+ - `theme` (string)
90
+
91
+ `openAvePopup`:
92
+
93
+ - `width` (number)
94
+ - `height` (number)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ave-id/embed",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "dist/embed.js",
6
6
  "files": ["dist"],