activitysmith 1.12.0 → 1.13.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/README.md CHANGED
@@ -38,6 +38,20 @@ await activitysmith.notifications.send({
38
38
  });
39
39
  ```
40
40
 
41
+ ### Custom Push Notification Icons
42
+
43
+ ![Push Notifications with custom icons](https://cdn.activitysmith.com/features/push-notifications-with-custom-icons.png)
44
+
45
+ Set `icon` to a publicly accessible HTTPS image URL to show an avatar or service logo alongside a smaller ActivitySmith app icon. With a custom icon, iOS may omit `subtitle` from the notification.
46
+
47
+ ```js
48
+ await activitysmith.notifications.send({
49
+ title: "MRR just crossed $10,000 🎉",
50
+ message: "Up 18% this month from 31 new subscriptions.",
51
+ icon: "https://cdn.activitysmith.com/integrations/icons/stripe.png",
52
+ });
53
+ ```
54
+
41
55
  ### Rich Push Notifications with Media
42
56
 
43
57
  ![Rich Push Notification with image](https://cdn.activitysmith.com/features/rich-push-notification-with-image.png)
@@ -128,23 +142,85 @@ await activitysmith.notifications.send({
128
142
  });
129
143
  ```
130
144
 
145
+ ### Push Notification Interruption Levels
146
+
147
+ ![Time Sensitive Push Notification](https://cdn.activitysmith.com/features/time-sensitive-push-notifications.png)
148
+
149
+ Use `interruption_level` to choose how urgently iOS presents a Push Notification. Omit it for normal delivery. Explicit `active` has the same behavior as the default.
150
+
151
+ | Value | Behavior |
152
+ | --- | --- |
153
+ | `passive` | Appears quietly in the notification list, without sound or waking the screen. |
154
+ | `active` | Normal delivery, subject to the device's notification settings and Focus. This is the default. |
155
+ | `time-sensitive` | Can bypass Scheduled Summary and Focus when the user allows Time Sensitive Notifications for ActivitySmith. |
156
+
157
+ See Apple's [interruption levels](https://developer.apple.com/documentation/usernotifications/unnotificationinterruptionlevel) for the system behavior.
158
+
159
+ The SDK also exports these values as `ActivitySmith.pushInterruptionLevels.passive`, `.active`, and `.timeSensitive`.
160
+
161
+ #### Passive
162
+
163
+ ```js
164
+ await activitysmith.notifications.send({
165
+ title: "Daily summary",
166
+ message: "All scheduled jobs completed successfully.",
167
+ interruption_level: "passive",
168
+ });
169
+ ```
170
+
171
+ #### Active (default)
172
+
173
+ ```js
174
+ await activitysmith.notifications.send({
175
+ title: "Deployment complete",
176
+ message: "Your latest changes are live.",
177
+ interruption_level: "active",
178
+ });
179
+ ```
180
+
181
+ Removing `interruption_level` from this example produces the same delivery behavior.
182
+
183
+ #### Time Sensitive
184
+
185
+ ```js
186
+ await activitysmith.notifications.send({
187
+ title: "🚨 checkout-api is down",
188
+ message: "500 errors on 62% of requests. Customers can't complete payments.",
189
+ interruption_level: "time-sensitive",
190
+ });
191
+ ```
192
+
131
193
  ## Live Activities
132
194
 
133
195
  Choose the Live Activity type that matches what you want to show:
134
196
 
135
- - ![Value Live Activity showing revenue with a growth badge](https://cdn.activitysmith.com/features/value-live-activity.png) **Value**: Show a single value on your Lock Screen, such as revenue, a queue count, or a temperature.
197
+ ![Value Live Activity showing revenue with a growth badge](https://cdn.activitysmith.com/features/value-live-activity.png)
198
+
199
+ **Value**: Show a single value on your Lock Screen, such as revenue, a queue count, or a temperature.
200
+
201
+ ![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png)
202
+
203
+ **Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
204
+
205
+ ![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png)
206
+
207
+ **Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
208
+
209
+ ![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png)
210
+
211
+ **Metrics**: Track two related values with segmented bars, such as CPU and memory.
136
212
 
137
- - ![Stats Live Activity with six labeled sales metrics](https://cdn.activitysmith.com/features/stats-live-activity.png) **Stats**: Show up to 8 labeled values on your Lock Screen, from revenue and orders to uptime and conversion.
213
+ ![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png)
138
214
 
139
- - ![Alert Live Activity showing a customer reactivation update](https://cdn.activitysmith.com/features/alert-live-activity.png) **Alert**: Show status updates with a clear message, badge, and icon. When you add an action button, `color` controls the button tint.
215
+ **Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
140
216
 
141
- - ![Metrics Live Activity with CPU and memory values](https://cdn.activitysmith.com/features/metrics-live-activity-start.png) **Metrics**: Track two related values with segmented bars, such as CPU and memory.
217
+ ![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png)
142
218
 
143
- - ![Segmented Progress Live Activity showing a workflow step](https://cdn.activitysmith.com/features/update-live-activity.png) **Segmented Progress**: Show progress through a known set of steps, like build, test, deploy, and verify.
219
+ **Progress**: Show percentage progress for jobs that move continuously toward completion.
144
220
 
145
- - ![Progress Live Activity showing percentage completion](https://cdn.activitysmith.com/features/progress-live-activity.png) **Progress**: Show percentage progress for jobs that move continuously toward completion.
221
+ ![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png)
146
222
 
147
- - ![Timer Live Activity showing a benchmark run countdown](https://cdn.activitysmith.com/features/timer-live-activity.png) **Timer**: Count down from a duration, or count up from 00:00 while a job runs.
223
+ **Timer**: Count down from a duration, or count up from 00:00 while a job runs.
148
224
 
149
225
  ### Start & Update Live Activity
150
226
 
@@ -19,12 +19,12 @@ export interface SendPushNotificationRequest {
19
19
  */
20
20
  export declare class PushNotificationsApi extends runtime.BaseAPI {
21
21
  /**
22
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional tags to organize and filter notification history.
22
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
23
23
  * Send a push notification
24
24
  */
25
25
  sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationResponse>>;
26
26
  /**
27
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional tags to organize and filter notification history.
27
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
28
28
  * Send a push notification
29
29
  */
30
30
  sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationResponse>;
@@ -20,7 +20,7 @@ const runtime = require("../runtime");
20
20
  */
21
21
  class PushNotificationsApi extends runtime.BaseAPI {
22
22
  /**
23
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional tags to organize and filter notification history.
23
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
24
24
  * Send a push notification
25
25
  */
26
26
  async sendPushNotificationRaw(requestParameters, initOverrides) {
@@ -47,7 +47,7 @@ class PushNotificationsApi extends runtime.BaseAPI {
47
47
  return new runtime.JSONApiResponse(response);
48
48
  }
49
49
  /**
50
- * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional tags to organize and filter notification history.
50
+ * Sends a push notification to devices matched by API key scope and optional target channels. Supports optional redirection URL, optional media preview or playback when the notification is expanded, and up to 4 interactive actions. `media` cannot be combined with `actions`. Optional `icon` shows a custom image, such as a service logo or avatar, next to a smaller app icon. Optional `interruption_level` sets how urgently iOS presents the notification. Optional tags to organize and filter notification history.
51
51
  * Send a push notification
52
52
  */
53
53
  async sendPushNotification(requestParameters, initOverrides) {
@@ -235,6 +235,65 @@ export interface BadRequestError {
235
235
  */
236
236
  message: string;
237
237
  }
238
+ /**
239
+ *
240
+ * @export
241
+ * @interface BillingBlockedError
242
+ */
243
+ export interface BillingBlockedError {
244
+ /**
245
+ *
246
+ * @type {string}
247
+ * @memberof BillingBlockedError
248
+ */
249
+ error: BillingBlockedErrorErrorEnum;
250
+ /**
251
+ *
252
+ * @type {string}
253
+ * @memberof BillingBlockedError
254
+ */
255
+ message: string;
256
+ /**
257
+ *
258
+ * @type {BillingBlockedErrorTrialPeriod}
259
+ * @memberof BillingBlockedError
260
+ */
261
+ trial_period?: BillingBlockedErrorTrialPeriod;
262
+ /**
263
+ *
264
+ * @type {string}
265
+ * @memberof BillingBlockedError
266
+ */
267
+ upgrade_url: string;
268
+ }
269
+ /**
270
+ * @export
271
+ */
272
+ export declare const BillingBlockedErrorErrorEnum: {
273
+ readonly TrialExpired: "trial_expired";
274
+ readonly TrialExhausted: "trial_exhausted";
275
+ readonly BillingOverageCapReached: "billing_overage_cap_reached";
276
+ };
277
+ export type BillingBlockedErrorErrorEnum = typeof BillingBlockedErrorErrorEnum[keyof typeof BillingBlockedErrorErrorEnum];
278
+ /**
279
+ *
280
+ * @export
281
+ * @interface BillingBlockedErrorTrialPeriod
282
+ */
283
+ export interface BillingBlockedErrorTrialPeriod {
284
+ /**
285
+ *
286
+ * @type {string}
287
+ * @memberof BillingBlockedErrorTrialPeriod
288
+ */
289
+ started_at: string;
290
+ /**
291
+ *
292
+ * @type {string}
293
+ * @memberof BillingBlockedErrorTrialPeriod
294
+ */
295
+ ends_at: string;
296
+ }
238
297
  /**
239
298
  *
240
299
  * @export
@@ -1574,6 +1633,16 @@ export interface NotFoundError {
1574
1633
  */
1575
1634
  message: string;
1576
1635
  }
1636
+ /**
1637
+ * How urgently iOS presents the notification. `passive` arrives quietly in the notification list without sound or lighting up the screen. `active` is normal delivery and the default when omitted. `time-sensitive` can break through Focus and Scheduled Summary when the user allows Time Sensitive Notifications for ActivitySmith.
1638
+ * @export
1639
+ */
1640
+ export declare const PushInterruptionLevel: {
1641
+ readonly Passive: "passive";
1642
+ readonly Active: "active";
1643
+ readonly TimeSensitive: "time-sensitive";
1644
+ };
1645
+ export type PushInterruptionLevel = typeof PushInterruptionLevel[keyof typeof PushInterruptionLevel];
1577
1646
  /**
1578
1647
  *
1579
1648
  * @export
@@ -1654,6 +1723,18 @@ export interface PushNotificationRequest {
1654
1723
  * @memberof PushNotificationRequest
1655
1724
  */
1656
1725
  subtitle?: string;
1726
+ /**
1727
+ * Optional HTTPS image URL without credentials for a custom notification icon. If the image cannot be loaded, the app icon is used. iOS may omit subtitle when displaying a custom icon.
1728
+ * @type {string}
1729
+ * @memberof PushNotificationRequest
1730
+ */
1731
+ icon?: string;
1732
+ /**
1733
+ * Optional. How urgently iOS presents the notification: `passive` (quiet, no sound or screen wake), `active` (default), or `time-sensitive` (can break through Focus and Scheduled Summary when allowed). Omit for normal delivery.
1734
+ * @type {PushInterruptionLevel}
1735
+ * @memberof PushNotificationRequest
1736
+ */
1737
+ interruption_level?: PushInterruptionLevel;
1657
1738
  /**
1658
1739
  * Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`.
1659
1740
  * @type {string}
@@ -1704,19 +1785,19 @@ export interface PushNotificationRequest {
1704
1785
  tags?: Array<string>;
1705
1786
  }
1706
1787
  /**
1707
- *
1788
+ * Apple APNs acceptance result. Acceptance does not confirm device delivery or presentation. Alerts remain eligible for APNs delivery retries for 24 hours; device settings and APNs storage policies still apply.
1708
1789
  * @export
1709
1790
  * @interface PushNotificationResponse
1710
1791
  */
1711
1792
  export interface PushNotificationResponse {
1712
1793
  /**
1713
- *
1794
+ * True when APNs accepts the notification for at least one targeted device.
1714
1795
  * @type {boolean}
1715
1796
  * @memberof PushNotificationResponse
1716
1797
  */
1717
1798
  success: boolean;
1718
1799
  /**
1719
- *
1800
+ * Number of device tokens for which APNs accepted the notification, without confirming on-device delivery.
1720
1801
  * @type {number}
1721
1802
  * @memberof PushNotificationResponse
1722
1803
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = exports.RateLimitErrorCodeEnum = exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.LiveActivityWebhookMethod = exports.LiveActivityStreamPutResponseOperationEnum = exports.LiveActivityStreamDeleteResponseOperationEnum = exports.LiveActivityColor = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorsEnum = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorsEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorsEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = exports.AppIconBadgeCountUpdateErrorCodeEnum = exports.ActivityMetricColorEnum = void 0;
3
+ exports.StreamContentStateStepColorsEnum = exports.StreamContentStateStepColorEnum = exports.StreamContentStateColorEnum = exports.StreamContentStateTypeEnum = exports.RateLimitErrorCodeEnum = exports.PushNotificationWebhookMethod = exports.PushNotificationActionType = exports.PushInterruptionLevel = exports.LiveActivityWebhookMethod = exports.LiveActivityStreamPutResponseOperationEnum = exports.LiveActivityStreamDeleteResponseOperationEnum = exports.LiveActivityColor = exports.LiveActivityActionType = exports.ContentStateUpdateStepColorsEnum = exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateUpdateTypeEnum = exports.ContentStateStartStepColorsEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorsEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = exports.ContentStateEndTypeEnum = exports.BillingBlockedErrorErrorEnum = exports.AppIconBadgeCountUpdateErrorCodeEnum = exports.ActivityMetricColorEnum = void 0;
4
4
  /**
5
5
  * @export
6
6
  */
@@ -23,6 +23,14 @@ exports.AppIconBadgeCountUpdateErrorCodeEnum = {
23
23
  DeviceDisconnected: 'badge_device_disconnected',
24
24
  UpdateFailed: 'badge_update_failed'
25
25
  };
26
+ /**
27
+ * @export
28
+ */
29
+ exports.BillingBlockedErrorErrorEnum = {
30
+ TrialExpired: 'trial_expired',
31
+ TrialExhausted: 'trial_exhausted',
32
+ BillingOverageCapReached: 'billing_overage_cap_reached'
33
+ };
26
34
  /**
27
35
  * @export
28
36
  */
@@ -242,6 +250,15 @@ exports.LiveActivityWebhookMethod = {
242
250
  Get: 'GET',
243
251
  Post: 'POST'
244
252
  };
253
+ /**
254
+ * How urgently iOS presents the notification. `passive` arrives quietly in the notification list without sound or lighting up the screen. `active` is normal delivery and the default when omitted. `time-sensitive` can break through Focus and Scheduled Summary when the user allows Time Sensitive Notifications for ActivitySmith.
255
+ * @export
256
+ */
257
+ exports.PushInterruptionLevel = {
258
+ Passive: 'passive',
259
+ Active: 'active',
260
+ TimeSensitive: 'time-sensitive'
261
+ };
245
262
  /**
246
263
  *
247
264
  * @export
@@ -140,6 +140,12 @@ export declare class ActivitySmith {
140
140
  static readonly contentState: typeof contentState;
141
141
  static readonly alertIcon: typeof alertIcon;
142
142
  static readonly alertBadge: typeof alertBadge;
143
+ /** Push Notification interruption levels. */
144
+ static readonly pushInterruptionLevels: {
145
+ readonly passive: "passive";
146
+ readonly active: "active";
147
+ readonly timeSensitive: "time-sensitive";
148
+ };
143
149
  readonly notifications: NotificationsResource;
144
150
  readonly liveActivities: LiveActivitiesResource;
145
151
  readonly metrics: MetricsResource;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActivitySmith = exports.MetricsResource = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
4
4
  const index_1 = require("../generated/index");
5
- const SDK_VERSION = "1.12.0";
5
+ const SDK_VERSION = "1.13.0";
6
6
  const SDK_HEADER_NAME = "X-ActivitySmith-SDK";
7
7
  const DEFAULT_SDK_NAME = "node";
8
8
  const SDK_HEADER_VALUE = `${DEFAULT_SDK_NAME}-v${SDK_VERSION}`;
@@ -65,7 +65,11 @@ function hasActionsValue(actions) {
65
65
  }
66
66
  return actions !== null && actions !== undefined;
67
67
  }
68
+ const PUSH_INTERRUPTION_LEVELS = Object.values(index_1.PushInterruptionLevel);
68
69
  function assertValidPushRequest(request) {
70
+ if (request.interruption_level !== undefined && !PUSH_INTERRUPTION_LEVELS.includes(request.interruption_level)) {
71
+ throw new Error("ActivitySmith: interruption_level must be passive, active, or time-sensitive");
72
+ }
69
73
  if (hasMediaValue(request.media) && hasActionsValue(request.actions)) {
70
74
  throw new Error("ActivitySmith: media cannot be combined with actions");
71
75
  }
@@ -218,3 +222,9 @@ ActivitySmith.liveActivityTypes = LiveActivityTypes;
218
222
  ActivitySmith.contentState = contentState;
219
223
  ActivitySmith.alertIcon = alertIcon;
220
224
  ActivitySmith.alertBadge = alertBadge;
225
+ /** Push Notification interruption levels. */
226
+ ActivitySmith.pushInterruptionLevels = {
227
+ passive: index_1.PushInterruptionLevel.Passive,
228
+ active: index_1.PushInterruptionLevel.Active,
229
+ timeSensitive: index_1.PushInterruptionLevel.TimeSensitive,
230
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",