activitysmith 1.4.0 → 1.6.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
@@ -18,6 +18,8 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction)
18
18
  - [Start & Update Live Activity](#start--update-live-activity)
19
19
  - [End Live Activity](#end-live-activity)
20
20
  - [Live Activity Action](#live-activity-action)
21
+ - [Icons and Badges](#icons-and-badges)
22
+ - [Live Activity Colors](#live-activity-colors)
21
23
  - [Channels](#channels)
22
24
  - [Widgets](#widgets)
23
25
 
@@ -235,14 +237,6 @@ await activitysmith.liveActivities.stream("customer-ops", {
235
237
  });
236
238
  ```
237
239
 
238
- The `icon.symbol` value is an Apple SF Symbol name. Browse the catalog with one of these tools:
239
-
240
- - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
241
- - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
242
- - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
243
-
244
- `icon` and `badge` are optional. If you omit either one, that element is not shown in the Live Activity.
245
-
246
240
  ### End Live Activity
247
241
 
248
242
  Call `endStream(...)` with the same `streamKey` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `auto_dismiss_minutes` to choose a different dismissal time, including `0` for immediate dismissal.
@@ -316,6 +310,65 @@ await activitysmith.liveActivities.stream("search-reindex", {
316
310
  });
317
311
  ```
318
312
 
313
+ ### Icons and Badges
314
+
315
+ Add more context to Live Activities with icons and badges.
316
+
317
+ #### Icon
318
+
319
+ Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, and `alert`.
320
+
321
+ <p align="center">
322
+ <img src="https://cdn.activitysmith.com/features/metrics-live-activity-with-icon.png" alt="Metrics Live Activity with an SF Symbol icon on the iPhone Lock Screen" width="680" />
323
+ </p>
324
+
325
+ ```ts
326
+ await activitysmith.liveActivities.stream("prod-web-1", {
327
+ content_state: ActivitySmith.contentState({
328
+ title: "Server Health",
329
+ subtitle: "prod-web-1",
330
+ type: "metrics",
331
+ icon: ActivitySmith.alertIcon("server.rack", { color: "blue" }),
332
+ metrics: [
333
+ { label: "CPU", value: 18, unit: "%" },
334
+ { label: "MEM", value: 42, unit: "%" },
335
+ ],
336
+ }),
337
+ });
338
+ ```
339
+
340
+ The `icon.symbol` value is an Apple SF Symbol name. Browse the catalog with one of these tools:
341
+
342
+ - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
343
+ - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
344
+ - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
345
+
346
+ #### Badge
347
+
348
+ Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
349
+
350
+ <p align="center">
351
+ <img src="https://cdn.activitysmith.com/features/progress-live-activity-with-badge.png" alt="Progress Live Activity with a badge on the iPhone Lock Screen" width="680" />
352
+ </p>
353
+
354
+ ```ts
355
+ await activitysmith.liveActivities.stream("nightly-database-backup", {
356
+ content_state: ActivitySmith.contentState({
357
+ title: "Nightly Database Backup",
358
+ subtitle: "verify restore",
359
+ type: "progress",
360
+ badge: ActivitySmith.alertBadge("S3", { color: "cyan" }),
361
+ percentage: 62,
362
+ }),
363
+ });
364
+ ```
365
+
366
+ ### Live Activity Colors
367
+
368
+ Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
369
+
370
+ `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
371
+
319
372
  ## Channels
320
373
 
321
374
  Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
@@ -107,7 +107,7 @@ export interface ChannelTarget {
107
107
  channels: Array<string>;
108
108
  }
109
109
  /**
110
- * End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For alert include message, with optional icon and badge. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start.
110
+ * End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start.
111
111
  * @export
112
112
  * @interface ContentStateEnd
113
113
  */
@@ -132,7 +132,7 @@ export interface ContentStateEnd {
132
132
  */
133
133
  number_of_steps?: number;
134
134
  /**
135
- * Current step. Use for type=segmented_progress.
135
+ * Current completed step count. Use for type=segmented_progress. Must be less than or equal to number_of_steps when number_of_steps is provided.
136
136
  * @type {number}
137
137
  * @memberof ContentStateEnd
138
138
  */
@@ -168,13 +168,13 @@ export interface ContentStateEnd {
168
168
  */
169
169
  message?: string;
170
170
  /**
171
- * Optional SF Symbol icon for type=alert.
171
+ * Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
172
172
  * @type {LiveActivityAlertIcon}
173
173
  * @memberof ContentStateEnd
174
174
  */
175
175
  icon?: LiveActivityAlertIcon;
176
176
  /**
177
- * Optional badge for type=alert.
177
+ * Optional badge. Supported by alert, progress, and segmented_progress.
178
178
  * @type {LiveActivityAlertBadge}
179
179
  * @memberof ContentStateEnd
180
180
  */
@@ -270,7 +270,7 @@ export declare const ContentStateEndStepColorsEnum: {
270
270
  };
271
271
  export type ContentStateEndStepColorsEnum = typeof ContentStateEndStepColorsEnum[keyof typeof ContentStateEndStepColorsEnum];
272
272
  /**
273
- * Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For alert include message, with optional icon and badge. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
273
+ * Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
274
274
  * @export
275
275
  * @interface ContentStateStart
276
276
  */
@@ -295,7 +295,7 @@ export interface ContentStateStart {
295
295
  */
296
296
  number_of_steps?: number;
297
297
  /**
298
- * Current step. Use for type=segmented_progress.
298
+ * Current completed step count. Use for type=segmented_progress. Set 0 when the activity has started but no segment is complete yet. Must be less than or equal to number_of_steps.
299
299
  * @type {number}
300
300
  * @memberof ContentStateStart
301
301
  */
@@ -331,13 +331,13 @@ export interface ContentStateStart {
331
331
  */
332
332
  message?: string;
333
333
  /**
334
- * Optional SF Symbol icon for type=alert.
334
+ * Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
335
335
  * @type {LiveActivityAlertIcon}
336
336
  * @memberof ContentStateStart
337
337
  */
338
338
  icon?: LiveActivityAlertIcon;
339
339
  /**
340
- * Optional badge for type=alert.
340
+ * Optional badge. Supported by alert, progress, and segmented_progress.
341
341
  * @type {LiveActivityAlertBadge}
342
342
  * @memberof ContentStateStart
343
343
  */
@@ -427,7 +427,7 @@ export declare const ContentStateStartStepColorsEnum: {
427
427
  };
428
428
  export type ContentStateStartStepColorsEnum = typeof ContentStateStartStepColorsEnum[keyof typeof ContentStateStartStepColorsEnum];
429
429
  /**
430
- * Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For alert include message, with optional icon and badge. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates.
430
+ * Update payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates.
431
431
  * @export
432
432
  * @interface ContentStateUpdate
433
433
  */
@@ -452,7 +452,7 @@ export interface ContentStateUpdate {
452
452
  */
453
453
  number_of_steps?: number;
454
454
  /**
455
- * Current step. Use for type=segmented_progress.
455
+ * Current completed step count. Use for type=segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided.
456
456
  * @type {number}
457
457
  * @memberof ContentStateUpdate
458
458
  */
@@ -488,13 +488,13 @@ export interface ContentStateUpdate {
488
488
  */
489
489
  message?: string;
490
490
  /**
491
- * Optional SF Symbol icon for type=alert.
491
+ * Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
492
492
  * @type {LiveActivityAlertIcon}
493
493
  * @memberof ContentStateUpdate
494
494
  */
495
495
  icon?: LiveActivityAlertIcon;
496
496
  /**
497
- * Optional badge for type=alert.
497
+ * Optional badge. Supported by alert, progress, and segmented_progress.
498
498
  * @type {LiveActivityAlertBadge}
499
499
  * @memberof ContentStateUpdate
500
500
  */
@@ -623,7 +623,7 @@ export interface LiveActivityAction {
623
623
  */
624
624
  type: LiveActivityActionType;
625
625
  /**
626
- * HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.
626
+ * Action URL. For open_url, use an HTTPS or shortcuts:// URL. For webhook, use an HTTPS URL called by the ActivitySmith backend.
627
627
  * @type {string}
628
628
  * @memberof LiveActivityAction
629
629
  */
@@ -653,7 +653,7 @@ export declare const LiveActivityActionType: {
653
653
  };
654
654
  export type LiveActivityActionType = typeof LiveActivityActionType[keyof typeof LiveActivityActionType];
655
655
  /**
656
- * Optional badge for Alert Live Activities.
656
+ * Optional badge for Live Activities.
657
657
  * @export
658
658
  * @interface LiveActivityAlertBadge
659
659
  */
@@ -673,7 +673,7 @@ export interface LiveActivityAlertBadge {
673
673
  color?: LiveActivityColor;
674
674
  }
675
675
  /**
676
- * Optional SF Symbol icon for Alert Live Activities.
676
+ * Optional SF Symbol icon for Live Activities.
677
677
  * @export
678
678
  * @interface LiveActivityAlertIcon
679
679
  */
@@ -1280,7 +1280,7 @@ export interface PushNotificationAction {
1280
1280
  */
1281
1281
  type: PushNotificationActionType;
1282
1282
  /**
1283
- * HTTPS URL. For open_url it is opened in browser. For webhook it is called by ActivitySmith backend.
1283
+ * Action URL. For open_url, use an HTTPS or shortcuts:// URL. For webhook, use an HTTPS URL called by the ActivitySmith backend.
1284
1284
  * @type {string}
1285
1285
  * @memberof PushNotificationAction
1286
1286
  */
@@ -1341,7 +1341,7 @@ export interface PushNotificationRequest {
1341
1341
  */
1342
1342
  media?: string;
1343
1343
  /**
1344
- * Optional HTTPS URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided.
1344
+ * Optional HTTPS or shortcuts:// URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided.
1345
1345
  * @type {string}
1346
1346
  * @memberof PushNotificationRequest
1347
1347
  */
@@ -1478,7 +1478,7 @@ export interface StreamContentState {
1478
1478
  */
1479
1479
  number_of_steps?: number;
1480
1480
  /**
1481
- * Use for segmented_progress.
1481
+ * Use for segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided.
1482
1482
  * @type {number}
1483
1483
  * @memberof StreamContentState
1484
1484
  */
@@ -1538,13 +1538,13 @@ export interface StreamContentState {
1538
1538
  */
1539
1539
  message?: string;
1540
1540
  /**
1541
- * Optional SF Symbol icon for type=alert.
1541
+ * Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
1542
1542
  * @type {LiveActivityAlertIcon}
1543
1543
  * @memberof StreamContentState
1544
1544
  */
1545
1545
  icon?: LiveActivityAlertIcon;
1546
1546
  /**
1547
- * Optional badge for type=alert.
1547
+ * Optional badge. Supported by alert, progress, and segmented_progress.
1548
1548
  * @type {LiveActivityAlertBadge}
1549
1549
  * @memberof StreamContentState
1550
1550
  */
@@ -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.4.0";
5
+ const SDK_VERSION = "1.6.0";
6
6
  const SDK_HEADER_NAME = "X-ActivitySmith-SDK";
7
7
  const SDK_HEADER_VALUE = `node-v${SDK_VERSION}`;
8
8
  const LiveActivityTypes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activitysmith",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Official ActivitySmith Node.js SDK",
5
5
  "keywords": [
6
6
  "activitysmith",