@cstar.help/js 0.12.0 → 0.12.1

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.
@@ -40,22 +40,22 @@ var AuthClient = class {
40
40
  */
41
41
  async signup(params) {
42
42
  const response = await this.fetch(
43
- "/widget/api/auth/signup",
43
+ "/api/widget/auth/signup",
44
44
  {
45
45
  method: "POST",
46
46
  body: {
47
- team_id: this.teamSlug,
47
+ teamId: this.teamSlug,
48
48
  email: params.email,
49
49
  password: params.password,
50
50
  name: params.name
51
51
  }
52
52
  }
53
53
  );
54
- if ("access_token" in response && response.access_token && response.customer) {
54
+ if ("accessToken" in response && response.accessToken && response.customer) {
55
55
  this.session = {
56
56
  customer: response.customer,
57
- accessToken: response.access_token,
58
- refreshToken: response.refresh_token
57
+ accessToken: response.accessToken,
58
+ refreshToken: response.refreshToken
59
59
  };
60
60
  }
61
61
  return response;
@@ -69,19 +69,19 @@ var AuthClient = class {
69
69
  * @throws Error on invalid credentials, unconfirmed email, or server error
70
70
  */
71
71
  async login(params) {
72
- const response = await this.fetch("/widget/api/auth/login", {
72
+ const response = await this.fetch("/api/widget/auth/login", {
73
73
  method: "POST",
74
74
  body: {
75
- team_id: this.teamSlug,
75
+ teamId: this.teamSlug,
76
76
  email: params.email,
77
77
  password: params.password
78
78
  }
79
79
  });
80
- if (response.access_token && response.customer) {
80
+ if (response.accessToken && response.customer) {
81
81
  this.session = {
82
82
  customer: response.customer,
83
- accessToken: response.access_token,
84
- refreshToken: response.refresh_token
83
+ accessToken: response.accessToken,
84
+ refreshToken: response.refreshToken
85
85
  };
86
86
  }
87
87
  return response;
@@ -24,9 +24,9 @@ interface SignupParams {
24
24
  interface SignupResult {
25
25
  customer: AuthCustomer;
26
26
  /** Access token for authenticated requests. Null if email confirmation is required. */
27
- access_token: string | null;
27
+ accessToken: string | null;
28
28
  /** Refresh token for renewing the session. Null if email confirmation is required. */
29
- refresh_token: string | null;
29
+ refreshToken: string | null;
30
30
  }
31
31
  /** Response when email confirmation is required after signup. */
32
32
  interface SignupConfirmationResult {
@@ -45,9 +45,9 @@ interface LoginParams {
45
45
  interface LoginResult {
46
46
  customer: AuthCustomer;
47
47
  /** Access token for authenticated requests. */
48
- access_token: string | null;
48
+ accessToken: string | null;
49
49
  /** Refresh token for renewing the session. */
50
- refresh_token: string | null;
50
+ refreshToken: string | null;
51
51
  }
52
52
  /** Stored session with tokens and customer identity. */
53
53
  interface AuthSession {
@@ -24,9 +24,9 @@ interface SignupParams {
24
24
  interface SignupResult {
25
25
  customer: AuthCustomer;
26
26
  /** Access token for authenticated requests. Null if email confirmation is required. */
27
- access_token: string | null;
27
+ accessToken: string | null;
28
28
  /** Refresh token for renewing the session. Null if email confirmation is required. */
29
- refresh_token: string | null;
29
+ refreshToken: string | null;
30
30
  }
31
31
  /** Response when email confirmation is required after signup. */
32
32
  interface SignupConfirmationResult {
@@ -45,9 +45,9 @@ interface LoginParams {
45
45
  interface LoginResult {
46
46
  customer: AuthCustomer;
47
47
  /** Access token for authenticated requests. */
48
- access_token: string | null;
48
+ accessToken: string | null;
49
49
  /** Refresh token for renewing the session. */
50
- refresh_token: string | null;
50
+ refreshToken: string | null;
51
51
  }
52
52
  /** Stored session with tokens and customer identity. */
53
53
  interface AuthSession {
@@ -16,22 +16,22 @@ var AuthClient = class {
16
16
  */
17
17
  async signup(params) {
18
18
  const response = await this.fetch(
19
- "/widget/api/auth/signup",
19
+ "/api/widget/auth/signup",
20
20
  {
21
21
  method: "POST",
22
22
  body: {
23
- team_id: this.teamSlug,
23
+ teamId: this.teamSlug,
24
24
  email: params.email,
25
25
  password: params.password,
26
26
  name: params.name
27
27
  }
28
28
  }
29
29
  );
30
- if ("access_token" in response && response.access_token && response.customer) {
30
+ if ("accessToken" in response && response.accessToken && response.customer) {
31
31
  this.session = {
32
32
  customer: response.customer,
33
- accessToken: response.access_token,
34
- refreshToken: response.refresh_token
33
+ accessToken: response.accessToken,
34
+ refreshToken: response.refreshToken
35
35
  };
36
36
  }
37
37
  return response;
@@ -45,19 +45,19 @@ var AuthClient = class {
45
45
  * @throws Error on invalid credentials, unconfirmed email, or server error
46
46
  */
47
47
  async login(params) {
48
- const response = await this.fetch("/widget/api/auth/login", {
48
+ const response = await this.fetch("/api/widget/auth/login", {
49
49
  method: "POST",
50
50
  body: {
51
- team_id: this.teamSlug,
51
+ teamId: this.teamSlug,
52
52
  email: params.email,
53
53
  password: params.password
54
54
  }
55
55
  });
56
- if (response.access_token && response.customer) {
56
+ if (response.accessToken && response.customer) {
57
57
  this.session = {
58
58
  customer: response.customer,
59
- accessToken: response.access_token,
60
- refreshToken: response.refresh_token
59
+ accessToken: response.accessToken,
60
+ refreshToken: response.refreshToken
61
61
  };
62
62
  }
63
63
  return response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cstar.help/js",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Official TypeScript SDK for the cStar customer support platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",