@authsignal/browser 0.0.2 → 0.0.3

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,10 +1,9 @@
1
- type AuthsignalChallenge = {
2
- accessToken: string;
1
+ type Challenge = {
3
2
  challengeUrl: string;
3
+ mode?: "popup" | "redirect";
4
4
  };
5
- type AnnoymousId = {
6
- idCookie: string;
7
- generated: boolean;
5
+ type Mfa = {
6
+ url: string;
8
7
  };
9
8
  interface UserProps {
10
9
  id?: string;
@@ -15,23 +14,22 @@ type AuthsignalOptions = {
15
14
  * Cookie domain that will be used to identify
16
15
  * users. If not set, location.hostname will be used
17
16
  */
18
- cookie_domain?: string;
17
+ cookieDomain?: string;
19
18
  /**
20
19
  * Tracking host (where API calls will be sent). If not set,
21
20
  * we'd try to do the best to "guess" it. Last resort is t.authsignal.com.
22
21
  *
23
22
  * Though this parameter is not required, it's highly recommended to set is explicitly
24
23
  */
25
- tracking_host?: string;
24
+ trackingHost?: string;
26
25
  /**
27
26
  * Name of id cookie. __eventn_id by default
28
27
  */
29
- cookie_name?: string;
28
+ cookieName?: string;
30
29
  };
31
- declare function authsignalClient(publishableKey: string, options?: AuthsignalOptions): AuthsignalClient;
32
- declare class AuthsignalClient {
30
+ declare function authsignalBrowser(publishableKey: string, options?: AuthsignalOptions): AuthsignalBrowser;
31
+ declare class AuthsignalBrowser {
33
32
  private anonymousId;
34
- private initialized;
35
33
  private publishableKey;
36
34
  private cookieDomain;
37
35
  private idCookieName;
@@ -40,13 +38,18 @@ declare class AuthsignalClient {
40
38
  private deviceFingerprint?;
41
39
  init(publishableKey: string, options?: AuthsignalOptions): Promise<void>;
42
40
  identify(props: UserProps): Promise<void>;
43
- getAnonymousId(): AnnoymousId;
44
- challengeWithRedirect({ challengeUrl }: AuthsignalChallenge): void;
45
- challengeWithPopup({ challengeUrl }: AuthsignalChallenge): Promise<boolean>;
41
+ private getAnonymousId;
42
+ mfa({ url }: Mfa): void;
43
+ challenge(challenge: {
44
+ mode?: "redirect";
45
+ } & Challenge): undefined;
46
+ challenge(challenge: {
47
+ mode: "popup";
48
+ } & Challenge): Promise<boolean>;
46
49
  private registerIdentity;
47
50
  private registerAnonymousId;
48
51
  private buildRegisterAnonymousIdRequest;
49
52
  private sendJson;
50
53
  private xmlHttpReqTransport;
51
54
  }
52
- export { authsignalClient, AuthsignalClient };
55
+ export { authsignalBrowser, AuthsignalBrowser };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authsignal/browser",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/index.d.ts",