@authsignal/browser 0.0.2 → 0.0.5

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,52 +1,41 @@
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
- interface UserProps {
10
- id?: string;
11
- email?: string;
12
- }
13
8
  type AuthsignalOptions = {
9
+ publishableKey: string;
14
10
  /**
15
11
  * Cookie domain that will be used to identify
16
12
  * users. If not set, location.hostname will be used
17
13
  */
18
- cookie_domain?: string;
14
+ cookieDomain?: string;
19
15
  /**
20
16
  * Tracking host (where API calls will be sent). If not set,
21
17
  * we'd try to do the best to "guess" it. Last resort is t.authsignal.com.
22
18
  *
23
19
  * Though this parameter is not required, it's highly recommended to set is explicitly
24
20
  */
25
- tracking_host?: string;
21
+ trackingHost?: string;
26
22
  /**
27
23
  * Name of id cookie. __eventn_id by default
28
24
  */
29
- cookie_name?: string;
25
+ cookieName?: string;
30
26
  };
31
- declare function authsignalClient(publishableKey: string, options?: AuthsignalOptions): AuthsignalClient;
32
- declare class AuthsignalClient {
27
+ declare class AuthsignalBrowser {
33
28
  private anonymousId;
34
- private initialized;
35
- private publishableKey;
36
29
  private cookieDomain;
37
- private idCookieName;
38
- private trackingHost;
39
- private fingerprintClient?;
40
- private deviceFingerprint?;
41
- init(publishableKey: string, options?: AuthsignalOptions): Promise<void>;
42
- identify(props: UserProps): Promise<void>;
43
- getAnonymousId(): AnnoymousId;
44
- challengeWithRedirect({ challengeUrl }: AuthsignalChallenge): void;
45
- challengeWithPopup({ challengeUrl }: AuthsignalChallenge): Promise<boolean>;
46
- private registerIdentity;
47
- private registerAnonymousId;
48
- private buildRegisterAnonymousIdRequest;
49
- private sendJson;
50
- private xmlHttpReqTransport;
30
+ private anonymousIdCookieName;
31
+ private publishableKey;
32
+ constructor({ publishableKey, cookieDomain, cookieName }: AuthsignalOptions);
33
+ mfa({ url }: Mfa): void;
34
+ challenge(challenge: {
35
+ mode?: "redirect";
36
+ } & Challenge): undefined;
37
+ challenge(challenge: {
38
+ mode: "popup";
39
+ } & Challenge): Promise<boolean>;
51
40
  }
52
- export { authsignalClient, AuthsignalClient };
41
+ export { AuthsignalBrowser };
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@authsignal/browser",
3
3
  "type": "module",
4
- "version": "0.0.2",
4
+ "version": "0.0.5",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/index.d.ts",
8
- "keywords": ["authsignal", "mfa", "2fa", "authentication"],
8
+ "keywords": [
9
+ "authsignal",
10
+ "mfa",
11
+ "2fa",
12
+ "authentication"
13
+ ],
9
14
  "license": "MIT",
10
15
  "repository": "git://github.com/authsignal/authsignal-browser.git",
11
16
  "sideEffects": false,
@@ -23,7 +28,6 @@
23
28
  "devDependencies": {
24
29
  "@rollup/plugin-commonjs": "^22.0.0",
25
30
  "@rollup/plugin-node-resolve": "^13.3.0",
26
- "@types/basiclightbox": "^5.0.1",
27
31
  "@types/uuid": "^8.3.4",
28
32
  "@typescript-eslint/eslint-plugin": "^5.25.0",
29
33
  "@typescript-eslint/parser": "^5.25.0",
@@ -36,7 +40,9 @@
36
40
  "tslib": "^2.4.0",
37
41
  "typescript": "^4.6.4"
38
42
  },
39
- "files": ["dist"],
43
+ "files": [
44
+ "dist"
45
+ ],
40
46
  "exports": {
41
47
  ".": {
42
48
  "import": "./dist/esm/index.js",