@signalhousellc/sdk 1.0.50 → 1.0.51
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/package.json +1 -1
- package/src/domains/Auth.js +52 -0
- package/src/domains/Onboarding.js +2 -2
- package/src/domains/Users.js +12 -0
package/package.json
CHANGED
package/src/domains/Auth.js
CHANGED
|
@@ -18,6 +18,58 @@ export class Auth {
|
|
|
18
18
|
return this.client(`/auth`, { method: "POST", body: { email, password }, ...options });
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Register a new account (creates a group and its owner user) and receive a JWT Bearer token
|
|
23
|
+
* @async
|
|
24
|
+
* @roles public
|
|
25
|
+
* @param {Object} params
|
|
26
|
+
* @param {string} params.businessName - The business / group name
|
|
27
|
+
* @param {string} params.fullName - The owner's full name
|
|
28
|
+
* @param {string} params.email - The owner's work email
|
|
29
|
+
* @param {string} params.password - The owner's password (min 8 characters)
|
|
30
|
+
* @param {string} [params.phone] - National phone number
|
|
31
|
+
* @param {string} [params.dialCode] - Country dial code (e.g. "1")
|
|
32
|
+
* @param {string} [params.country] - Country ISO code (e.g. "US")
|
|
33
|
+
* @param {string} [params.volume] - Estimated monthly message volume
|
|
34
|
+
* @param {string[]} [params.products] - Products the account intends to integrate
|
|
35
|
+
* @param {boolean} [params.acceptedTermsOfService] - Whether the user accepted the Terms of Service
|
|
36
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
37
|
+
* @returns {Promise<Object>} The response from the server (contains the JWT token)
|
|
38
|
+
*/
|
|
39
|
+
async register({ businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService, options = {} }) {
|
|
40
|
+
return this.client(`/auth/register`, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
body: { businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService },
|
|
43
|
+
...options,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Verify an account email using the single-use token from the verification link
|
|
49
|
+
* @async
|
|
50
|
+
* @roles public
|
|
51
|
+
* @param {Object} params
|
|
52
|
+
* @param {string} params.token - The verification token from the email link
|
|
53
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
54
|
+
* @returns {Promise<Object>} The response from the server ({ verified: true })
|
|
55
|
+
*/
|
|
56
|
+
async verifyEmail({ token, options = {} }) {
|
|
57
|
+
this.client._require({ token });
|
|
58
|
+
return this.client(`/auth/verify-email`, { method: "POST", body: { token }, ...options });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Resend the account verification email to the authenticated caller
|
|
63
|
+
* @async
|
|
64
|
+
* @roles admin, developer, billing, user
|
|
65
|
+
* @param {Object} [params]
|
|
66
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
67
|
+
* @returns {Promise<Object>} The response from the server ({ sent: true })
|
|
68
|
+
*/
|
|
69
|
+
async sendVerificationEmail({ options = {} } = {}) {
|
|
70
|
+
return this.client(`/auth/send-verification-email`, { method: "POST", ...options });
|
|
71
|
+
}
|
|
72
|
+
|
|
21
73
|
/**
|
|
22
74
|
* Reset a user's password
|
|
23
75
|
* @async
|
|
@@ -39,11 +39,11 @@ export class Onboarding {
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Get the caller's own onboarding record (customer-safe projection).
|
|
42
|
-
* Returns `{ acceptedTermsOfService: boolean }`.
|
|
42
|
+
* Returns `{ acceptedTermsOfService: boolean, emailVerified: boolean }`.
|
|
43
43
|
* @async
|
|
44
44
|
* @param {Object} [params] - Optional parameters
|
|
45
45
|
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
46
|
-
* @returns {Promise<Object>} - `{ acceptedTermsOfService: boolean }`
|
|
46
|
+
* @returns {Promise<Object>} - `{ acceptedTermsOfService: boolean, emailVerified: boolean }`
|
|
47
47
|
*/
|
|
48
48
|
async getMyOnboarding({ options = {} } = {}) {
|
|
49
49
|
return this.client(`/group/onboarding/my`, { method: "GET", ...options });
|
package/src/domains/Users.js
CHANGED
|
@@ -171,6 +171,18 @@ export class Users {
|
|
|
171
171
|
return this.client(`/user/${safeId}`, { method: "DELETE", ...options });
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Accept the Terms of Service for the authenticated caller (self-service).
|
|
176
|
+
* @async
|
|
177
|
+
* @roles api, admin, developer, billing, user
|
|
178
|
+
* @param {Object} [params]
|
|
179
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
180
|
+
* @returns {Promise<Object>} The response from the server ({ acceptedTermsOfService: true })
|
|
181
|
+
*/
|
|
182
|
+
async acceptTermsOfService({ options = {} } = {}) {
|
|
183
|
+
return this.client(`/user/accept-terms`, { method: "PUT", body: { acceptedTermsOfService: true }, ...options });
|
|
184
|
+
}
|
|
185
|
+
|
|
174
186
|
/**
|
|
175
187
|
* Get notification preferences for a user
|
|
176
188
|
* @async
|