@authsignal/browser 0.0.7 → 0.0.10

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/dist/index.d.ts CHANGED
@@ -1,9 +1,19 @@
1
- type Challenge = {
1
+ type ChallengeInput = {
2
2
  challengeUrl: string;
3
3
  mode?: "popup" | "redirect";
4
4
  };
5
- type Mfa = {
5
+ type MfaInput = {
6
6
  url: string;
7
+ mode?: "popup" | "redirect";
8
+ };
9
+ type LaunchOptions = {
10
+ /**
11
+ * How the Authsignal Prebuilt MFA page should launch.
12
+ * `popup` will cause it to open in a overlay, whilst `redirect`
13
+ * will trigger a full page redirect.
14
+ * If no value is supplied, mode defaults to `redirect`.
15
+ */
16
+ mode?: "popup" | "redirect";
7
17
  };
8
18
  type AuthsignalOptions = {
9
19
  publishableKey: string;
@@ -23,19 +33,52 @@ type AuthsignalOptions = {
23
33
  * Name of id cookie. __eventn_id by default
24
34
  */
25
35
  cookieName?: string;
36
+ /**
37
+ * A URL pointing to the Authsignal MFA page.
38
+ */
39
+ endpoint?: string;
26
40
  };
27
- declare class AuthsignalBrowser {
28
- private anonymousId;
29
- private cookieDomain;
30
- private anonymousIdCookieName;
31
- private publishableKey;
32
- constructor({ publishableKey, cookieDomain, cookieName }: AuthsignalOptions);
33
- mfa({ url }: Mfa): void;
41
+ declare class Authsignal {
42
+ anonymousId: string;
43
+ cookieDomain: string;
44
+ anonymousIdCookieName: string;
45
+ publishableKey: string;
46
+ endpoint: string;
47
+ constructor({ publishableKey, cookieDomain, cookieName, endpoint }: AuthsignalOptions);
48
+ /**
49
+ * @deprecated Use launch() instead.
50
+ */
51
+ /**
52
+ * @deprecated Use launch() instead.
53
+ */
54
+ mfa(challenge: {
55
+ mode?: "redirect";
56
+ } & MfaInput): undefined;
57
+ mfa(challenge: {
58
+ mode: "popup";
59
+ } & MfaInput): Promise<boolean>;
60
+ /**
61
+ * @deprecated Use launch() instead.
62
+ */
63
+ /**
64
+ * @deprecated Use launch() instead.
65
+ */
34
66
  challenge(challenge: {
35
67
  mode?: "redirect";
36
- } & Challenge): undefined;
68
+ } & ChallengeInput): undefined;
37
69
  challenge(challenge: {
38
70
  mode: "popup";
39
- } & Challenge): Promise<boolean>;
71
+ } & ChallengeInput): Promise<boolean>;
72
+ launch(url: string, options?: {
73
+ mode?: "redirect";
74
+ } & LaunchOptions): undefined;
75
+ launch(url: string, options?: {
76
+ mode: "popup";
77
+ } & LaunchOptions): Promise<boolean>;
78
+ }
79
+ /**
80
+ * @deprecated Use Authsignal
81
+ */
82
+ declare class AuthsignalBrowser extends Authsignal {
40
83
  }
41
- export { AuthsignalBrowser };
84
+ export { Authsignal, AuthsignalBrowser };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authsignal/browser",
3
3
  "type": "module",
4
- "version": "0.0.7",
4
+ "version": "0.0.10",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/index.d.ts",