@signalhouse-sms/sdk 1.7.0 → 1.8.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhouse-sms/sdk",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -122,7 +122,7 @@
122
122
  * @property {string} inboundText - The contact message the agent was answering.
123
123
  * @property {string} draftText - The reply as the agent wrote it.
124
124
  * @property {string|null} sentText - The text actually sent; differs from draftText when edited.
125
- * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback" or "guardrail", or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
125
+ * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback", "guardrail" or "quiet_hours" (an auto-pilot reply written between 9 pm and 9 am in the contact's time zone), or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
126
126
  * @property {string} status - "pending", "sending", "sent", "rejected" or "failed" (the send path accepted nothing, e.g. the contact opted out).
127
127
  * @property {string|null} decidedBy - The user who approved or rejected it.
128
128
  * @property {string|null} decidedAt - When it was approved or rejected.
@@ -322,7 +322,8 @@ export class Auth {
322
322
  * @async
323
323
  * @roles admin, developer, billing, user
324
324
  * @param {Object} params
325
- * @param {string} params.provider - "google", "microsoft", "apple" or "sso"; must be linked to the account
325
+ * @param {string} params.provider - "microsoft", "apple" or "sso"; must be linked to the account. Google is
326
+ * refused with a 400 because it can't confirm a fresh sign-in; confirm with a code instead
326
327
  * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
327
328
  * @returns {Promise<Object>} The response from the server ({ reauthTicket, reauthSecret, expiresInSeconds }). Keep
328
329
  * `reauthSecret` in the client that started the flow: it is returned only here, and confirmOAuthReauth needs it
@@ -367,7 +368,7 @@ export class Auth {
367
368
  }
368
369
 
369
370
  /**
370
- * Unlink a provider from the caller's account. Refused when it is the account's only way to sign in.
371
+ * Unlink a provider from the caller's account. Refused when it is the account's only way to sign in. With 2FA on and no password, the last linked Microsoft, Apple or SSO sign-in is refused (400) too.
371
372
  * Requires a fresh confirmTwoFactorIdentity from the same session.
372
373
  * @async
373
374
  * @roles admin, developer, billing, user
@@ -433,6 +433,22 @@ export class Campaigns {
433
433
  return this.client(`/campaign/throughput-limits${queryString}`, { method: 'GET', ...options });
434
434
  }
435
435
 
436
+ /**
437
+ * Get today's T-Mobile usage against the daily limit for every active campaign in a group that has one. The same limits and counter as getCampaignThroughputLimits, for the whole group in one call.
438
+ * @async
439
+ * @roles api, admin, developer, billing, user
440
+ * @param {Object} params - Parameters for reading group throughput usage
441
+ * @param {string} params.groupId - Group identifier
442
+ * @param {RequestOptions} [params.options] - Additional request options
443
+ * @throws {Error} Throws an error if the groupId parameter is missing
444
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `[{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt } } }]`. Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score.
445
+ */
446
+ async getGroupThroughputUsage({ groupId, options = {} }) {
447
+ this.client._require({ groupId });
448
+ const queryString = this.client._getQueryString({ groupId });
449
+ return this.client(`/campaign/throughput-usage${queryString}`, { method: 'GET', ...options });
450
+ }
451
+
436
452
  /**
437
453
  * Create a new campaign
438
454
  * @async
@@ -113,7 +113,7 @@
113
113
  * @property {string} inboundText - The contact message the agent was answering.
114
114
  * @property {string} draftText - The reply as the agent wrote it.
115
115
  * @property {string|null} sentText - The text actually sent; differs from draftText when edited.
116
- * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback" or "guardrail", or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
116
+ * @property {string} reason - Why it was held: "review_mode", "escalation", "fallback", "guardrail" or "quiet_hours" (an auto-pilot reply written between 9 pm and 9 am in the contact's time zone), or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
117
117
  * @property {string} status - "pending", "sending", "sent", "rejected" or "failed" (the send path accepted nothing, e.g. the contact opted out).
118
118
  * @property {string|null} decidedBy - The user who approved or rejected it.
119
119
  * @property {string|null} decidedAt - When it was approved or rejected.
@@ -1343,7 +1343,7 @@ export type AgentReplyDraft = {
1343
1343
  */
1344
1344
  sentText: string | null;
1345
1345
  /**
1346
- * - Why it was held: "review_mode", "escalation", "fallback" or "guardrail", or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
1346
+ * - Why it was held: "review_mode", "escalation", "fallback", "guardrail" or "quiet_hours" (an auto-pilot reply written between 9 pm and 9 am in the contact's time zone), or "autopilot" for a confident auto-pilot reply that its channel delivers without a person.
1347
1347
  */
1348
1348
  reason: string;
1349
1349
  /**
@@ -317,7 +317,8 @@ export class Auth {
317
317
  * @async
318
318
  * @roles admin, developer, billing, user
319
319
  * @param {Object} params
320
- * @param {string} params.provider - "google", "microsoft", "apple" or "sso"; must be linked to the account
320
+ * @param {string} params.provider - "microsoft", "apple" or "sso"; must be linked to the account. Google is
321
+ * refused with a 400 because it can't confirm a fresh sign-in; confirm with a code instead
321
322
  * @param {import('../SignalHouseSDK.js').RequestOptions} [params.options] - Additional options for the request
322
323
  * @returns {Promise<Object>} The response from the server ({ reauthTicket, reauthSecret, expiresInSeconds }). Keep
323
324
  * `reauthSecret` in the client that started the flow: it is returned only here, and confirmOAuthReauth needs it
@@ -360,7 +361,7 @@ export class Auth {
360
361
  options?: import("../SignalHouseSDK.js").RequestOptions;
361
362
  }): Promise<any>;
362
363
  /**
363
- * Unlink a provider from the caller's account. Refused when it is the account's only way to sign in.
364
+ * Unlink a provider from the caller's account. Refused when it is the account's only way to sign in. With 2FA on and no password, the last linked Microsoft, Apple or SSO sign-in is refused (400) too.
364
365
  * Requires a fresh confirmTwoFactorIdentity from the same session.
365
366
  * @async
366
367
  * @roles admin, developer, billing, user
@@ -382,6 +382,20 @@ export class Campaigns {
382
382
  campaignId: string;
383
383
  options?: RequestOptions;
384
384
  }): Promise<SdkResponse<any>>;
385
+ /**
386
+ * Get today's T-Mobile usage against the daily limit for every active campaign in a group that has one. The same limits and counter as getCampaignThroughputLimits, for the whole group in one call.
387
+ * @async
388
+ * @roles api, admin, developer, billing, user
389
+ * @param {Object} params - Parameters for reading group throughput usage
390
+ * @param {string} params.groupId - Group identifier
391
+ * @param {RequestOptions} [params.options] - Additional request options
392
+ * @throws {Error} Throws an error if the groupId parameter is missing
393
+ * @returns {Promise<SdkResponse<any>>} A promise that resolves to `[{ campaignId, brandId, brandName, usecase, tmobile: { tier, dailyLimit, usedToday: { date, segments, resetsAt } } }]`. Campaigns without a T-Mobile limit (unverified brand, GOVERNMENT entity, PUBLIC_SAFETY_RESTRICTED usecase) are left out. The counter is per brand EIN and UTC day, so every campaign of a brand shows the same usage; a LOW_VOLUME campaign's limit is 2,000 whatever the brand's score.
394
+ */
395
+ getGroupThroughputUsage({ groupId, options }: {
396
+ groupId: string;
397
+ options?: RequestOptions;
398
+ }): Promise<SdkResponse<any>>;
385
399
  /**
386
400
  * Create a new campaign
387
401
  * @async