@openfin/remote-adapter 42.100.102 → 42.100.105

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.
@@ -17514,7 +17514,24 @@ var _NotificationManagerInstance_wire, _NotificationManagerInstance_handler, _No
17514
17514
  Object.defineProperty(instance, "__esModule", { value: true });
17515
17515
  instance.NotificationManagerInstance = void 0;
17516
17516
  const lazy_1 = lazy;
17517
+ /**
17518
+ * NotificationManagers allow all {@link https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API | HTML5 notifications} created in the application to be intercepted and dispatched.
17519
+ *
17520
+ * Please note, currently Notifications will only be intercepted if the following conditions are met:
17521
+ * - The source WebContents has the `notification` webAPI permission.
17522
+ * - The source WebContents is not a service worker.
17523
+ *
17524
+ * Service worker and push notifications are currently not supported.
17525
+ *
17526
+ * **See also** - {@link https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API | Notification API (MDN)}
17527
+ *
17528
+ * @experimental This API is subject to change in future releases.
17529
+ *
17530
+ */
17517
17531
  class NotificationManagerInstance {
17532
+ /**
17533
+ * @internal
17534
+ */
17518
17535
  constructor(wire, id) {
17519
17536
  _NotificationManagerInstance_wire.set(this, void 0);
17520
17537
  _NotificationManagerInstance_handler.set(this, void 0);
@@ -17544,13 +17561,60 @@ class NotificationManagerInstance {
17544
17561
  });
17545
17562
  return true;
17546
17563
  }));
17564
+ /**
17565
+ * Sets the current handler for notifications. The provided function will be invoked whenever a WebContents successfully raises a notification.
17566
+ *
17567
+ * **Note**, only one handler can be used at a time, calling `setNotificationHandler` will replace any existing registered handler.
17568
+ *
17569
+ * @param handler The notification handler callback which will be invoked whenever a notification is created.
17570
+ *
17571
+ * @example
17572
+ *
17573
+ * ```typescript
17574
+ * const notificationManager = await fin.NotificationManager.init();
17575
+ * const handler = (notification) => {
17576
+ * console.log("Received the following notification", info);
17577
+ * }
17578
+ * await notificationManager.setNotificationHandler(handler);
17579
+ * ```
17580
+ */
17547
17581
  this.setNotificationHandler = async (handler) => {
17548
17582
  await __classPrivateFieldGet(this, _NotificationManagerInstance_isReceivingNotifications, "f").getValue();
17549
17583
  __classPrivateFieldSet(this, _NotificationManagerInstance_handler, handler, "f");
17550
17584
  };
17585
+ /**
17586
+ * Destroys the current NotificationManagerInstance.
17587
+ *
17588
+ * @example
17589
+ * ```typescript
17590
+ * await notificationManager.destroy();
17591
+ * ```
17592
+ */
17551
17593
  this.destroy = async () => {
17552
17594
  await __classPrivateFieldGet(this, _NotificationManagerInstance_wire, "f").sendAction('destroy-notification-manager', { managerId: __classPrivateFieldGet(this, _NotificationManagerInstance_id, "f") });
17553
17595
  };
17596
+ /**
17597
+ * Dispatches a Notification lifecycle event ('close' | 'click' | 'show').
17598
+ *
17599
+ * @param event Identifies the type of event to emit, and which `notificationId` to emit it for.
17600
+ *
17601
+ * @example
17602
+ * ```typescript
17603
+ * notificationManager.setNotificationHandler((notification) => {
17604
+ * await mockNotificationUi.showNotification(notification);
17605
+ * await notificationManager.dispatchNotificationEvent({
17606
+ * notificationId: notification.notificationId,
17607
+ * type: 'show
17608
+ * })
17609
+ * })
17610
+ * ```
17611
+ *
17612
+ * **See Also** - {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/click_event | Notification Click Event (MDN)}
17613
+ *
17614
+ * **See Also** - {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/close_event | Notification Close Event (MDN)}
17615
+ *
17616
+ * **See Also** - {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/show_event | Notification Show Event (MDN)}
17617
+ */
17554
17618
  this.dispatch = async (event) => {
17555
17619
  const { notificationId, type } = event;
17556
17620
  await __classPrivateFieldGet(this, _NotificationManagerInstance_wire, "f").sendAction('dispatch-notification-event', {
@@ -17572,6 +17636,24 @@ const instance_1 = instance;
17572
17636
  class NotificationManagerModule extends base_1.Base {
17573
17637
  constructor() {
17574
17638
  super(...arguments);
17639
+ /**
17640
+ * Initializes a NotificationManager for the current application, which allows interception of HTML5 web notifications.
17641
+ *
17642
+ * Secured by default, must be called from a WebContents with the NotificationManager.init permission.
17643
+ *
17644
+ * Only one NotificationManager can be active at a time, calls to `init` will fail otherwise.
17645
+ *
17646
+ * If a WebContents with the NotificationManager active reloads or is closed, it will be possible to create a new one.
17647
+ *
17648
+ * @example
17649
+ *
17650
+ * ```js
17651
+ * // From Provider context
17652
+ * const notificationManager = await fin.NotificationManager.init();
17653
+ * // NotificationManager is now active and will intercept all incoming notifications.
17654
+ * ```
17655
+ * @experimental
17656
+ */
17575
17657
  this.init = async () => {
17576
17658
  const { payload: { data: { managerId } } } = await this.wire.sendAction('init-notification-manager');
17577
17659
  const manager = new instance_1.NotificationManagerInstance(this.wire, managerId);
@@ -17597,6 +17679,13 @@ factory.NotificationManagerModule = NotificationManagerModule;
17597
17679
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17598
17680
  };
17599
17681
  Object.defineProperty(exports, "__esModule", { value: true });
17682
+ /**
17683
+ * Entry point for the OpenFin `NotificationManager` API (`fin.NotificationManager`).
17684
+ *
17685
+ * * {@link NotificationManagerModule} contains static initialisation apis to create a {@link NotificationManagerInstance} instance.
17686
+ *
17687
+ * @packageDocumentation
17688
+ */
17600
17689
  __exportStar(factory, exports);
17601
17690
  __exportStar(instance, exports);
17602
17691
  } (notificationManager));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/remote-adapter",
3
- "version": "42.100.102",
3
+ "version": "42.100.105",
4
4
  "description": "Establish intermachine runtime connections using webRTC.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "private": false,
@@ -20,6 +20,6 @@
20
20
  "author": "OpenFin",
21
21
  "dependencies": {
22
22
  "lodash": "^4.17.21",
23
- "@openfin/core": "42.100.102"
23
+ "@openfin/core": "42.100.105"
24
24
  }
25
25
  }