openfin-notifications 1.18.0 → 1.19.0-alpha-1640

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/LICENSE.md ADDED
@@ -0,0 +1,3 @@
1
+ Learn more about OpenFin licensing at the links listed below or email us at support@openfin.co with questions.
2
+
3
+ - [Developer agreement](https://openfin.co/developer-agreement/)
@@ -2,6 +2,7 @@
2
2
  * @hidden
3
3
  */
4
4
  /// <reference types="node" />
5
+ /// <reference types="@openfin/core" />
5
6
  /**
6
7
  * File contains vars used to establish service connection between client and provider.
7
8
  *
@@ -12,14 +13,13 @@
12
13
  * This file is excluded from the public-facing TypeScript documentation.
13
14
  */
14
15
  import { EventEmitter } from 'events';
15
- import { ChannelClient } from 'openfin/_v2/api/interappbus/channel/client';
16
16
  import { APITopic, API, Events } from './internal';
17
17
  import { EventRouter } from './EventRouter';
18
18
  /**
19
19
  * The event emitter to emit events received from the service. All addEventListeners will tap into this.
20
20
  */
21
21
  export declare const eventEmitter: EventEmitter;
22
- export declare function getServicePromise(): Promise<ChannelClient>;
22
+ export declare function getServicePromise(): Promise<OpenFin.ChannelClient>;
23
23
  /**
24
24
  * Wrapper around service.dispatch to help with type checking
25
25
  * @param action Action type.
@@ -291,6 +291,34 @@ export declare function clearAll(): Promise<number>;
291
291
  * ```
292
292
  */
293
293
  export declare function toggleNotificationCenter(): Promise<void>;
294
+ /**
295
+ * Options to modify the Notification Center behaviour when show() API is called.
296
+ */
297
+ export interface ShowOptions {
298
+ navigateToAll?: boolean;
299
+ }
300
+ /**
301
+ * Sets the visibility of the Notification Center to true.
302
+ *
303
+ * ```ts
304
+ * import {show} from 'openfin-notifications';
305
+ *
306
+ * show({navigateToAll: false});
307
+ * ```
308
+ * @param showOptions
309
+ */
310
+ export declare function show(options?: ShowOptions): Promise<void>;
311
+ /**
312
+ * Sets the visibility of the Notification Center to false.
313
+ *
314
+ * ```ts
315
+ * import {hide} from 'openfin-notifications';
316
+ *
317
+ * hide();
318
+ * ```
319
+ * @param showOptions Options to modify the Notification Center behaviour when show() API is called
320
+ */
321
+ export declare function hide(): Promise<void>;
294
322
  /**
295
323
  * Get the total count of notifications from **all** applications.
296
324
  *
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @hidden
3
3
  */
4
+ /// <reference types="@openfin/core" />
4
5
  /**
5
6
  * File contains types used to communicate between client and provider.
6
7
  *
@@ -10,7 +11,7 @@
10
11
  import { NotificationActionResult, ActionTrigger } from './actions';
11
12
  import { ProviderStatus } from './provider';
12
13
  import { NotificationSource } from './source';
13
- import { NotificationOptions, Notification, NotificationActionEvent, NotificationClosedEvent, NotificationCreatedEvent, NotificationsCountChanged, NotificationFormSubmittedEvent, UpdatableNotification, NotificationPlatform, UpdatableNotificationOptions, NotificationToastDismissedEvent } from './index';
14
+ import { NotificationOptions, Notification, NotificationActionEvent, NotificationClosedEvent, NotificationCreatedEvent, NotificationsCountChanged, NotificationFormSubmittedEvent, UpdatableNotification, NotificationPlatform, UpdatableNotificationOptions, NotificationToastDismissedEvent, ShowOptions } from './index';
14
15
  /**
15
16
  * The identity of the main application window of the service provider
16
17
  */
@@ -34,7 +35,9 @@ export declare const enum APITopic {
34
35
  GET_PROVIDER_STATUS = "get-provider-status",
35
36
  GET_NOTIFICATIONS_COUNT = "get-notifications-count",
36
37
  REGISTER_PLATFORM = "register-notifications-platform",
37
- DEREGISTER_PLATFORM = "deregister-notifications-platform"
38
+ DEREGISTER_PLATFORM = "deregister-notifications-platform",
39
+ SHOW_NOTIFICATION_CENTER = "show-notification-center",
40
+ HIDE_NOTIFICATION_CENTER = "hide-notification-center"
38
41
  }
39
42
  export interface API {
40
43
  [APITopic.CREATE_NOTIFICATION]: [CreatePayload, NotificationInternal];
@@ -49,6 +52,8 @@ export interface API {
49
52
  [APITopic.GET_NOTIFICATIONS_COUNT]: [undefined, number];
50
53
  [APITopic.REGISTER_PLATFORM]: [PlatformRegisterPayload, void];
51
54
  [APITopic.DEREGISTER_PLATFORM]: [PlatformDeregisterPayload, void];
55
+ [APITopic.SHOW_NOTIFICATION_CENTER]: [ShowPayload | undefined, void];
56
+ [APITopic.HIDE_NOTIFICATION_CENTER]: [undefined, void];
52
57
  }
53
58
  export declare type Events = NotificationActionEvent | NotificationToastDismissedEvent | NotificationClosedEvent | NotificationCreatedEvent | NotificationsCountChanged | NotificationFormSubmittedEvent;
54
59
  export declare type TransportMappings<T> = T extends NotificationActionEvent ? NotificationActionEventTransport : never;
@@ -62,6 +67,9 @@ export declare type NotificationInternal<T extends NotificationOptions = Notific
62
67
  date: number;
63
68
  expires: number | null;
64
69
  };
70
+ export interface NotificationPlatformInternal extends NotificationPlatform {
71
+ platformIdentity: OpenFin.ApplicationIdentity;
72
+ }
65
73
  export declare type UpdatableNotificationInternal<T extends UpdatableNotificationOptions = UpdatableNotificationOptions> = UpdatableNotification<T> & {
66
74
  bodyText?: string;
67
75
  body?: string;
@@ -69,10 +77,12 @@ export declare type UpdatableNotificationInternal<T extends UpdatableNotificatio
69
77
  export interface ClearPayload {
70
78
  id: string;
71
79
  }
80
+ export declare type ShowPayload = ShowOptions;
72
81
  export declare type PlatformRegisterPayload<T extends NotificationPlatform = NotificationPlatform> = T;
73
82
  export interface PlatformDeregisterPayload {
74
83
  id: string;
75
84
  }
85
+ export declare type ColorSchemeOption = 'light' | 'dark' | 'system';
76
86
  export interface NotificationActionEventTransport {
77
87
  type: 'notification-action';
78
88
  notification: Readonly<NotificationInternal>;
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.notifications=t():e.notifications=t()}(self,(()=>{return e={17187:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,r)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var r,o,s,u;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(r=c(e))>0&&s.length>r&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=l.bind(i);return r.listener=n,i.wrapFn=r,r}function p(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):v(r,r.length)}function d(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function v(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function m(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){i.once&&e.removeEventListener(t,r),n(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=v(c,u);for(n=0;n<u;++n)i(l[n],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,f(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,f(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,i,r,o,s;if(a(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},54456:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeferredPromise=class{constructor(){const e=new Promise(((e,t)=>{this._resolve=e,this._reject=t}));this._promise=e}get promise(){return this._promise}get resolve(){return this._resolve}get reject(){return this._reject}}},16272:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(54456);async function r(e,t){let n=0;for(const i of e)await t(i,n,e),n++}async function o(e,t){await Promise.all(e.map(t))}function s(e,t,n){const r=new i.DeferredPromise,o=e.add(((...e)=>{t(...e)&&(o.remove(),r.resolve())}));return n&&n.catch((e=>{o.remove(),r.reject(e)})),a(r.promise)}function a(e){return e.catch((()=>{})),e}t.serialForEach=r,t.serialMap=async function(e,t){const n=[];return await r(e,(async(e,i,r)=>{n.push(await t(e,i,r))})),n},t.serialFilter=async function(e,t){const n=[];return await r(e,(async(e,i,r)=>{await t(e,i,r)&&n.push(e)})),n},t.parallelForEach=o,t.parallelMap=async function(e,t){const n=[];return await o(e,(async(e,i,r)=>{n[i]=await t(e,i,r)})),n},t.parallelFilter=async function(e,t){const n=[];return await o(e,(async(e,i,r)=>{n[i]=await t(e,i,r)})),e.filter(((e,t)=>n[t]))},t.withStrictTimeout=function(e,t,n){const i=new Promise(((t,i)=>setTimeout((()=>i(new Error(n))),e)));return a(Promise.race([i,t]))},t.withTimeout=function(e,t){const n=new Promise((t=>setTimeout((()=>t([!0,void 0])),e))),i=t.then((e=>[!1,e]));return Promise.race([n,i])},t.untilTrue=function(e,t,n){return t()?Promise.resolve():s(e,t,n)},t.untilSignal=s,t.allowReject=a},95881:(e,t,n)=>{"use strict";function i(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),i(n(16272)),i(n(54456))},29140:e=>{e.exports=function(e,t){for(var n=e.split("."),i=t.split("."),r=0;r<3;r++){var o=Number(n[r]),s=Number(i[r]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!isNaN(s))return-1}return 0}},47924:function(e,t){"use strict";var n=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.EventRouter=void 0,t.EventRouter=class{constructor(e){this._emitterProviders={},this._deserializers={},this._defaultEmitter=e}registerEmitterProvider(e,t){this._emitterProviders[e]=t}registerDeserializer(e,t){this._deserializers[e]=t}dispatchEvent(e){const{type:t,target:i}=e,r=n(e,["type","target"]);let o;if(!i)throw new Error("Invalid event, no target specified");if("default"===i)o=this._defaultEmitter;else{if(!this._emitterProviders[i.type])throw new Error(`Invalid target, no provider registered for '${i.type}'`);o=this._emitterProviders[i.type](i.id)}const s=Object.assign({type:t},r),a=this._deserializers[t];a?o.emit(t,a(s)):o.emit(t,s)}}},85400:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ActionBodyClickType=t.ActionNoopType=t.ActionTrigger=void 0,(n=t.ActionTrigger||(t.ActionTrigger={})).CONTROL="control",n.SELECT="select",n.CLOSE="close",n.EXPIRE="expire",n.PROGRAMMATIC="programmatic",(t.ActionNoopType||(t.ActionNoopType={})).EVENT_DISMISS="event_dismiss",(t.ActionBodyClickType||(t.ActionBodyClickType={})).DISMISS_EVENT="dismiss_event"},53595:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEventRouter=t.tryServiceDispatch=t.getServicePromise=t.eventEmitter=void 0;const i=n(17187),r=n(95881),o=n(84666),s=n(47924);let a;t.eventEmitter=new i.EventEmitter;const c=new r.DeferredPromise;let u,l=!1;async function f(){if(window.navigator.appVersion.includes("Windows"))try{const e=await fin.System.getRvmInfo();parseInt(e.version.split(".")[0])>=6&&(fin.System.launchManifest?fin.System.launchManifest("fins://system-apps/notification-center",{noUi:!0}).catch((e=>{console.error("Unable to launch the Notification Center as a system app",e)})):fin.System.openUrlWithBrowser("fins://system-apps/notification-center").catch((()=>{})))}catch(e){}else fin.System.openUrlWithBrowser("fins://system-apps/notification-center")}async function p(){var e,t;if(await c.promise,!a){if("undefined"==typeof fin){const e="fin is not defined. The openfin-notifications module is only intended for use in an OpenFin application.";return a=Promise.reject(new Error(e)),a}fin.System.getVersion().then((e=>{const t=parseInt(e.split(".")[2]);t<53&&console.warn(`API version ${t} of OpenFin version ${e} is less than 53. Please upgrade the runtime version.`)}));const{name:n,uuid:i}=null!==(t=null===(e=fin.me)||void 0===e?void 0:e.identity)&&void 0!==t?t:fin.Window.me;if(i===o.SERVICE_IDENTITY.uuid&&n===o.SERVICE_IDENTITY.name)a=Promise.reject(new Error("Trying to connect to provider from provider"));else{const e=window.setTimeout((()=>{console.warn("Taking a long time to connect to Notifications service. Is the Notifications service running?")}),5e3);a=fin.InterApplicationBus.Channel.connect(o.SERVICE_CHANNEL,{wait:!0,payload:{version:"1.18.0"}}).then((t=>{window.clearTimeout(e);const n=d();return t.register("WARN",(e=>console.warn(e))),t.register("event",(e=>{n.dispatchEvent(e)})),t.setDefaultAction((()=>!1)),t.onDisconnection((()=>{console.warn("Disconnected from Notifications service"),l=!0,a=null,f(),setTimeout((()=>{console.log("Attempting to reconnect to Notifications service"),p()}),300)})),l?console.log("Reconnected to Notifications service"):console.log("Connected to Notifications service"),t}))}}return a}function d(){return u||(u=new s.EventRouter(t.eventEmitter)),u}"undefined"!=typeof fin&&"undefined"!=typeof window&&(f(),p(),"loading"!==document.readyState?c.resolve():(window.addEventListener("DOMContentLoaded",(()=>{c.resolve()})),document.addEventListener("DOMContentLoaded",(()=>{c.resolve()})))),t.getServicePromise=p,t.tryServiceDispatch=async function(e,t){return(await p()).dispatch(e,t)},t.getEventRouter=d},4575:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},176:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldType=void 0,t.FieldType={string:"string",number:"number",boolean:"boolean"}},93407:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(176),t),r(n(49725),t)},49725:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetType=t.BooleanWidgetType=t.NumberWidgetType=t.StringWidgetType=void 0,t.StringWidgetType={Text:"Text"},t.NumberWidgetType={Number:"Number"},t.BooleanWidgetType={Toggle:"Toggle",Checkbox:"Checkbox"},t.WidgetType=Object.assign(Object.assign(Object.assign({},t.StringWidgetType),t.NumberWidgetType),t.BooleanWidgetType)},3771:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)},a=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.getNotificationsCount=t.toggleNotificationCenter=t.clearAll=t.getAll=t.clear=t.update=t.create=t.removeEventListener=t.addEventListener=t.VERSION=t.NotificationIndicatorType=t.IndicatorColor=t.NotificationIndicator=t.NotificationOptions=t.provider=void 0;const c=n(85400),u=n(53595),l=n(84666),f=o(n(14045));t.provider=f;const p=n(10314),d=n(43392);Object.defineProperty(t,"NotificationIndicator",{enumerable:!0,get:function(){return d.NotificationIndicator}}),Object.defineProperty(t,"NotificationIndicatorType",{enumerable:!0,get:function(){return d.IndicatorType}}),Object.defineProperty(t,"IndicatorColor",{enumerable:!0,get:function(){return d.IndicatorColor}});const v=n(69695);Object.defineProperty(t,"NotificationOptions",{enumerable:!0,get:function(){return v.NotificationOptions}}),s(n(85400),t),s(n(4575),t),s(n(69742),t),s(n(93407),t),s(n(78985),t),s(n(95482),t),s(n(23310),t),t.VERSION="1.18.0";const m=u.getEventRouter();function y(e){const{notification:t}=e;return Object.assign(Object.assign({},e),{notification:Object.assign(Object.assign({},t),{date:new Date(t.date),expires:null!==t.expires?new Date(t.expires):null})})}m.registerDeserializer("notification-created",(e=>y(e))),m.registerDeserializer("notification-toast-dismissed",(e=>y(e))),m.registerDeserializer("notification-closed",(e=>y(e))),m.registerDeserializer("notification-action",(e=>{const t=y(e),{controlSource:n,controlIndex:i}=t,r=a(t,["controlSource","controlIndex"]);if(e.trigger===c.ActionTrigger.CONTROL){const t=e.notification[n][i];return Object.assign(Object.assign({},r),{control:t})}return r})),m.registerDeserializer("notifications-count-changed",(e=>e)),t.addEventListener=function(e,t){p.validateEnvironment(),e=p.sanitizeEventType(e),t=p.sanitizeFunction(t);const n=u.eventEmitter.listenerCount(e);u.eventEmitter.addListener(e,t),0===n&&1===u.eventEmitter.listenerCount(e)&&u.tryServiceDispatch(l.APITopic.ADD_EVENT_LISTENER,e)},t.removeEventListener=function(e,t){p.validateEnvironment(),e=p.sanitizeEventType(e),t=p.sanitizeFunction(t);const n=u.eventEmitter.listenerCount(e);u.eventEmitter.removeListener(e,t),1===n&&0===u.eventEmitter.listenerCount(e)&&u.tryServiceDispatch(l.APITopic.REMOVE_EVENT_LISTENER,e)},t.create=async function(e){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to create: argument must be an object and must not be null");if(void 0!==e.date&&!(e.date instanceof Date))throw new Error('Invalid argument passed to create: "date" must be a valid Date object');if(void 0!==e.expires&&null!==e.expires&&!(e.expires instanceof Date))throw new Error('Invalid argument passed to create: "expires" must be null or a valid Date object');const t=await u.tryServiceDispatch(l.APITopic.CREATE_NOTIFICATION,Object.assign(Object.assign({},e),{date:e.date&&e.date.valueOf(),expires:e.expires&&e.expires.valueOf()}));return Object.assign(Object.assign({},t),{date:new Date(t.date),expires:null!==t.expires?new Date(t.expires):null})},t.update=async function(e){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to create: argument must be an object and must not be null");if(!e.id)throw new Error('Invalid argument passed to create: "id" must be Id of previously created Notification');const t=await u.tryServiceDispatch(l.APITopic.UPDATE_NOTIFICATION,Object.assign({},e));return Object.assign({},t)},t.clear=async function(e){return u.tryServiceDispatch(l.APITopic.CLEAR_NOTIFICATION,{id:e})},t.getAll=async function(){return(await u.tryServiceDispatch(l.APITopic.GET_APP_NOTIFICATIONS,void 0)).map((e=>Object.assign(Object.assign({},e),{indicator:e.indicator||null,date:new Date(e.date),expires:null!==e.expires?new Date(e.expires):null})))},t.clearAll=async function(){return u.tryServiceDispatch(l.APITopic.CLEAR_APP_NOTIFICATIONS,void 0)},t.toggleNotificationCenter=async function(){return u.tryServiceDispatch(l.APITopic.TOGGLE_NOTIFICATION_CENTER,void 0)},t.getNotificationsCount=async function(){return u.tryServiceDispatch(l.APITopic.GET_NOTIFICATIONS_COUNT,void 0)}},43392:(e,t)=>{"use strict";var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.IndicatorColor=t.IndicatorType=void 0,(i=t.IndicatorType||(t.IndicatorType={})).FAILURE="failure",i.WARNING="warning",i.SUCCESS="success",(n=t.IndicatorColor||(t.IndicatorColor={})).RED="red",n.GREEN="green",n.YELLOW="yellow",n.BLUE="blue",n.PURPLE="purple",n.GRAY="gray"},84666:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.APITopic=t.SERVICE_CHANNEL=t.SERVICE_IDENTITY=void 0,t.SERVICE_IDENTITY={uuid:"notifications-service",name:"notifications-service"},t.SERVICE_CHANNEL="of-notifications-service-v1",(n=t.APITopic||(t.APITopic={})).CREATE_NOTIFICATION="create-notification",n.UPDATE_NOTIFICATION="update-notification",n.CLEAR_NOTIFICATION="clear-notification",n.GET_APP_NOTIFICATIONS="fetch-app-notifications",n.CLEAR_APP_NOTIFICATIONS="clear-app-notifications",n.TOGGLE_NOTIFICATION_CENTER="toggle-notification-center",n.ADD_EVENT_LISTENER="add-event-listener",n.REMOVE_EVENT_LISTENER="remove-event-listener",n.GET_PROVIDER_STATUS="get-provider-status",n.GET_NOTIFICATIONS_COUNT="get-notifications-count",n.REGISTER_PLATFORM="register-notifications-platform",n.DEREGISTER_PLATFORM="deregister-notifications-platform"},23310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deregisterPlatform=t.registerPlatform=void 0;const i=n(53595),r=n(84666);t.registerPlatform=async function(e){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to registerPlatform: argument must be an object and must not be null");if(!e.id)throw new Error('Invalid argument passed to registerPlatform: "id" must be a non-empty string in platform info.');return i.tryServiceDispatch(r.APITopic.REGISTER_PLATFORM,Object.assign({},e))},t.deregisterPlatform=async function(e){if(!e)throw new Error('Invalid argument passed to deregisterPlatform: "id" must be a non-empty string.');return i.tryServiceDispatch(r.APITopic.DEREGISTER_PLATFORM,{id:e})}},14045:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isConnectedToAtLeast=t.getStatus=void 0;const r=i(n(29140)),o=n(95881),s=n(53595),a=n(84666);function c(){return o.withStrictTimeout(500,s.tryServiceDispatch(a.APITopic.GET_PROVIDER_STATUS,void 0),"").catch((()=>({connected:!1,version:null,templateAPIVersion:null})))}t.getStatus=c,t.isConnectedToAtLeast=async function(e){const t=await c();if(t.connected&&null!==t.version){const n=r.default(t.version,e);if(0===n||1===n)return!0}return!1}},69742:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},78985:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},69045:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},56242:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},95482:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(69045),t),r(n(56242),t),r(n(69695),t),r(n(81627),t)},69695:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateFragmentNames=t.PresentationTemplateFragmentNames=t.ContainerTemplateFragmentNames=t.TemplateNames=void 0,t.TemplateNames={markdown:"markdown",list:"list",custom:"custom"},t.ContainerTemplateFragmentNames={container:"container"},t.PresentationTemplateFragmentNames={text:"text",image:"image",list:"list"},t.TemplateFragmentNames=Object.assign(Object.assign({},t.ContainerTemplateFragmentNames),t.PresentationTemplateFragmentNames)},81627:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},10314:(e,t)=>{"use strict";function n(e,t){let n;try{n=JSON.stringify(e)}catch(e){n=t}return n}Object.defineProperty(t,"__esModule",{value:!0}),t.safeStringify=t.validateEnvironment=t.sanitizeEventType=t.sanitizeFunction=void 0,t.sanitizeFunction=function(e){if("function"!=typeof e)throw new Error(`Invalid argument passed: ${n(e,"The provided value")} is not a valid function`);return e},t.sanitizeEventType=function(e){if("notification-action"===e||"notification-created"===e||"notification-toast-dismissed"===e||"notification-closed"===e||"notifications-count-changed"===e||"notification-form-submitted"===e)return e;throw new Error(`Invalid argument passed: ${n(e,"The provided event type")} is not a valid Notifications event type`)},t.validateEnvironment=function(){if("undefined"==typeof fin)throw new Error("fin is not defined. The openfin-notifications module is only intended for use in an OpenFin application.")},t.safeStringify=n}},t={},function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}(3771);var e,t}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.notifications=t():e.notifications=t()}(self,(()=>{return e={17187:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,r)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var r,o,s,u;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(r=c(e))>0&&s.length>r&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=l.bind(i);return r.listener=n,i.wrapFn=r,r}function p(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):v(r,r.length)}function d(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function v(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function m(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){i.once&&e.removeEventListener(t,r),n(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=v(c,u);for(n=0;n<u;++n)i(l[n],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,f(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,f(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,i,r,o,s;if(a(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},54456:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeferredPromise=class{constructor(){const e=new Promise(((e,t)=>{this._resolve=e,this._reject=t}));this._promise=e}get promise(){return this._promise}get resolve(){return this._resolve}get reject(){return this._reject}}},16272:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(54456);async function r(e,t){let n=0;for(const i of e)await t(i,n,e),n++}async function o(e,t){await Promise.all(e.map(t))}function s(e,t,n){const r=new i.DeferredPromise,o=e.add(((...e)=>{t(...e)&&(o.remove(),r.resolve())}));return n&&n.catch((e=>{o.remove(),r.reject(e)})),a(r.promise)}function a(e){return e.catch((()=>{})),e}t.serialForEach=r,t.serialMap=async function(e,t){const n=[];return await r(e,(async(e,i,r)=>{n.push(await t(e,i,r))})),n},t.serialFilter=async function(e,t){const n=[];return await r(e,(async(e,i,r)=>{await t(e,i,r)&&n.push(e)})),n},t.parallelForEach=o,t.parallelMap=async function(e,t){const n=[];return await o(e,(async(e,i,r)=>{n[i]=await t(e,i,r)})),n},t.parallelFilter=async function(e,t){const n=[];return await o(e,(async(e,i,r)=>{n[i]=await t(e,i,r)})),e.filter(((e,t)=>n[t]))},t.withStrictTimeout=function(e,t,n){const i=new Promise(((t,i)=>setTimeout((()=>i(new Error(n))),e)));return a(Promise.race([i,t]))},t.withTimeout=function(e,t){const n=new Promise((t=>setTimeout((()=>t([!0,void 0])),e))),i=t.then((e=>[!1,e]));return Promise.race([n,i])},t.untilTrue=function(e,t,n){return t()?Promise.resolve():s(e,t,n)},t.untilSignal=s,t.allowReject=a},95881:(e,t,n)=>{"use strict";function i(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),i(n(16272)),i(n(54456))},29140:e=>{e.exports=function(e,t){for(var n=e.split("."),i=t.split("."),r=0;r<3;r++){var o=Number(n[r]),s=Number(i[r]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!isNaN(s))return-1}return 0}},47924:function(e,t){"use strict";var n=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.EventRouter=void 0,t.EventRouter=class{constructor(e){this._emitterProviders={},this._deserializers={},this._defaultEmitter=e}registerEmitterProvider(e,t){this._emitterProviders[e]=t}registerDeserializer(e,t){this._deserializers[e]=t}dispatchEvent(e){const{type:t,target:i}=e,r=n(e,["type","target"]);let o;if(!i)throw new Error("Invalid event, no target specified");if("default"===i)o=this._defaultEmitter;else{if(!this._emitterProviders[i.type])throw new Error(`Invalid target, no provider registered for '${i.type}'`);o=this._emitterProviders[i.type](i.id)}const s=Object.assign({type:t},r),a=this._deserializers[t];a?o.emit(t,a(s)):o.emit(t,s)}}},85400:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ActionBodyClickType=t.ActionNoopType=t.ActionTrigger=void 0,(n=t.ActionTrigger||(t.ActionTrigger={})).CONTROL="control",n.SELECT="select",n.CLOSE="close",n.EXPIRE="expire",n.PROGRAMMATIC="programmatic",(t.ActionNoopType||(t.ActionNoopType={})).EVENT_DISMISS="event_dismiss",(t.ActionBodyClickType||(t.ActionBodyClickType={})).DISMISS_EVENT="dismiss_event"},53595:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEventRouter=t.tryServiceDispatch=t.getServicePromise=t.eventEmitter=void 0;const i=n(17187),r=n(95881),o=n(84666),s=n(47924);let a;t.eventEmitter=new i.EventEmitter;const c=new r.DeferredPromise;let u,l=!1;async function f(){if(window.navigator.appVersion.includes("Windows"))try{const e=await fin.System.getRvmInfo();parseInt(e.version.split(".")[0])>=6&&(fin.System.launchManifest?fin.System.launchManifest("fins://system-apps/notification-center",{noUi:!0}).catch((e=>{console.error("Unable to launch the Notification Center as a system app",e)})):fin.System.openUrlWithBrowser("fins://system-apps/notification-center").catch((()=>{})))}catch(e){}else fin.System.openUrlWithBrowser("fins://system-apps/notification-center")}async function p(){var e;if(await c.promise,!a){if("undefined"==typeof fin){const e="fin is not defined. The openfin-notifications module is only intended for use in an OpenFin application.";return a=Promise.reject(new Error(e)),a}fin.System.getVersion().then((e=>{const t=parseInt(e.split(".")[2]);t<53&&console.warn(`API version ${t} of OpenFin version ${e} is less than 53. Please upgrade the runtime version.`)}));const{name:t,uuid:n}=null!==(e=fin.me.identity)&&void 0!==e?e:fin.Window.me;if(n===o.SERVICE_IDENTITY.uuid&&t===o.SERVICE_IDENTITY.name)a=Promise.reject(new Error("Trying to connect to provider from provider"));else{const e=window.setTimeout((()=>{console.warn("Taking a long time to connect to Notifications service. Is the Notifications service running?")}),5e3);a=fin.InterApplicationBus.Channel.connect(o.SERVICE_CHANNEL,{wait:!0,payload:{version:"1.19.0-alpha-1640"}}).then((t=>{window.clearTimeout(e);const n=d();return t.register("WARN",(e=>console.warn(e))),t.register("event",(e=>{n.dispatchEvent(e)})),t.setDefaultAction((()=>!1)),t.onDisconnection((()=>{console.warn("Disconnected from Notifications service"),l=!0,a=null,f(),setTimeout((()=>{console.log("Attempting to reconnect to Notifications service"),p()}),300)})),l?console.log("Reconnected to Notifications service"):console.log("Connected to Notifications service"),t}))}}return a}function d(){return u||(u=new s.EventRouter(t.eventEmitter)),u}"undefined"!=typeof fin&&"undefined"!=typeof window&&(f(),p(),"loading"!==document.readyState?c.resolve():(window.addEventListener("DOMContentLoaded",(()=>{c.resolve()})),document.addEventListener("DOMContentLoaded",(()=>{c.resolve()})))),t.getServicePromise=p,t.tryServiceDispatch=async function(e,t){return(await p()).dispatch(e,t)},t.getEventRouter=d},4575:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},176:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldType=void 0,t.FieldType={string:"string",number:"number",boolean:"boolean"}},93407:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(176),t),r(n(49725),t)},49725:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetType=t.BooleanWidgetType=t.NumberWidgetType=t.StringWidgetType=void 0,t.StringWidgetType={Text:"Text"},t.NumberWidgetType={Number:"Number"},t.BooleanWidgetType={Toggle:"Toggle",Checkbox:"Checkbox"},t.WidgetType=Object.assign(Object.assign(Object.assign({},t.StringWidgetType),t.NumberWidgetType),t.BooleanWidgetType)},3771:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)},a=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.getNotificationsCount=t.hide=t.show=t.toggleNotificationCenter=t.clearAll=t.getAll=t.clear=t.update=t.create=t.removeEventListener=t.addEventListener=t.VERSION=t.NotificationIndicatorType=t.IndicatorColor=t.NotificationIndicator=t.NotificationOptions=t.provider=void 0;const c=n(85400),u=n(53595),l=n(84666),f=o(n(14045));t.provider=f;const p=n(10314),d=n(43392);Object.defineProperty(t,"NotificationIndicator",{enumerable:!0,get:function(){return d.NotificationIndicator}}),Object.defineProperty(t,"NotificationIndicatorType",{enumerable:!0,get:function(){return d.IndicatorType}}),Object.defineProperty(t,"IndicatorColor",{enumerable:!0,get:function(){return d.IndicatorColor}});const v=n(69695);Object.defineProperty(t,"NotificationOptions",{enumerable:!0,get:function(){return v.NotificationOptions}}),s(n(85400),t),s(n(4575),t),s(n(69742),t),s(n(93407),t),s(n(78985),t),s(n(95482),t),s(n(23310),t),t.VERSION="1.19.0-alpha-1640";const m=(0,u.getEventRouter)();function y(e){const{notification:t}=e;return Object.assign(Object.assign({},e),{notification:Object.assign(Object.assign({},t),{date:new Date(t.date),expires:null!==t.expires?new Date(t.expires):null})})}m.registerDeserializer("notification-created",(e=>y(e))),m.registerDeserializer("notification-toast-dismissed",(e=>y(e))),m.registerDeserializer("notification-closed",(e=>y(e))),m.registerDeserializer("notification-action",(e=>{const t=y(e),{controlSource:n,controlIndex:i}=t,r=a(t,["controlSource","controlIndex"]);if(e.trigger===c.ActionTrigger.CONTROL){const t=e.notification[n][i];return Object.assign(Object.assign({},r),{control:t})}return r})),m.registerDeserializer("notifications-count-changed",(e=>e)),t.addEventListener=function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t);const n=u.eventEmitter.listenerCount(e);u.eventEmitter.addListener(e,t),0===n&&1===u.eventEmitter.listenerCount(e)&&(0,u.tryServiceDispatch)(l.APITopic.ADD_EVENT_LISTENER,e)},t.removeEventListener=function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t);const n=u.eventEmitter.listenerCount(e);u.eventEmitter.removeListener(e,t),1===n&&0===u.eventEmitter.listenerCount(e)&&(0,u.tryServiceDispatch)(l.APITopic.REMOVE_EVENT_LISTENER,e)},t.create=async function(e){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to create: argument must be an object and must not be null");if(void 0!==e.date&&!(e.date instanceof Date))throw new Error('Invalid argument passed to create: "date" must be a valid Date object');if(void 0!==e.expires&&null!==e.expires&&!(e.expires instanceof Date))throw new Error('Invalid argument passed to create: "expires" must be null or a valid Date object');const t=await(0,u.tryServiceDispatch)(l.APITopic.CREATE_NOTIFICATION,Object.assign(Object.assign({},e),{date:e.date&&e.date.valueOf(),expires:e.expires&&e.expires.valueOf()}));return Object.assign(Object.assign({},t),{date:new Date(t.date),expires:null!==t.expires?new Date(t.expires):null})},t.update=async function(e){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to create: argument must be an object and must not be null");if(!e.id)throw new Error('Invalid argument passed to create: "id" must be Id of previously created Notification');const t=await(0,u.tryServiceDispatch)(l.APITopic.UPDATE_NOTIFICATION,Object.assign({},e));return Object.assign({},t)},t.clear=async function(e){return(0,u.tryServiceDispatch)(l.APITopic.CLEAR_NOTIFICATION,{id:e})},t.getAll=async function(){return(await(0,u.tryServiceDispatch)(l.APITopic.GET_APP_NOTIFICATIONS,void 0)).map((e=>Object.assign(Object.assign({},e),{indicator:e.indicator||null,date:new Date(e.date),expires:null!==e.expires?new Date(e.expires):null})))},t.clearAll=async function(){return(0,u.tryServiceDispatch)(l.APITopic.CLEAR_APP_NOTIFICATIONS,void 0)},t.toggleNotificationCenter=async function(){return(0,u.tryServiceDispatch)(l.APITopic.TOGGLE_NOTIFICATION_CENTER,void 0)},t.show=async function(e){return(0,u.tryServiceDispatch)(l.APITopic.SHOW_NOTIFICATION_CENTER,e)},t.hide=async function(){return(0,u.tryServiceDispatch)(l.APITopic.HIDE_NOTIFICATION_CENTER,void 0)},t.getNotificationsCount=async function(){return(0,u.tryServiceDispatch)(l.APITopic.GET_NOTIFICATIONS_COUNT,void 0)}},43392:(e,t)=>{"use strict";var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.IndicatorColor=t.IndicatorType=void 0,(i=t.IndicatorType||(t.IndicatorType={})).FAILURE="failure",i.WARNING="warning",i.SUCCESS="success",(n=t.IndicatorColor||(t.IndicatorColor={})).RED="red",n.GREEN="green",n.YELLOW="yellow",n.BLUE="blue",n.PURPLE="purple",n.GRAY="gray"},84666:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.APITopic=t.SERVICE_CHANNEL=t.SERVICE_IDENTITY=void 0,t.SERVICE_IDENTITY={uuid:"notifications-service",name:"notifications-service"},t.SERVICE_CHANNEL="of-notifications-service-v1",(n=t.APITopic||(t.APITopic={})).CREATE_NOTIFICATION="create-notification",n.UPDATE_NOTIFICATION="update-notification",n.CLEAR_NOTIFICATION="clear-notification",n.GET_APP_NOTIFICATIONS="fetch-app-notifications",n.CLEAR_APP_NOTIFICATIONS="clear-app-notifications",n.TOGGLE_NOTIFICATION_CENTER="toggle-notification-center",n.ADD_EVENT_LISTENER="add-event-listener",n.REMOVE_EVENT_LISTENER="remove-event-listener",n.GET_PROVIDER_STATUS="get-provider-status",n.GET_NOTIFICATIONS_COUNT="get-notifications-count",n.REGISTER_PLATFORM="register-notifications-platform",n.DEREGISTER_PLATFORM="deregister-notifications-platform",n.SHOW_NOTIFICATION_CENTER="show-notification-center",n.HIDE_NOTIFICATION_CENTER="hide-notification-center"},23310:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deregisterPlatform=t.registerPlatform=void 0;const i=n(53595),r=n(84666);t.registerPlatform=async function(e){if("object"!=typeof e||null===e)throw new Error("Invalid argument passed to registerPlatform: argument must be an object and must not be null");if(!e.id)throw new Error('Invalid argument passed to registerPlatform: "id" must be a non-empty string in platform info.');return(0,i.tryServiceDispatch)(r.APITopic.REGISTER_PLATFORM,Object.assign({},e))},t.deregisterPlatform=async function(e){if(!e)throw new Error('Invalid argument passed to deregisterPlatform: "id" must be a non-empty string.');return(0,i.tryServiceDispatch)(r.APITopic.DEREGISTER_PLATFORM,{id:e})}},14045:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isConnectedToAtLeast=t.getStatus=void 0;const r=i(n(29140)),o=n(95881),s=n(53595),a=n(84666);function c(){return(0,o.withStrictTimeout)(500,(0,s.tryServiceDispatch)(a.APITopic.GET_PROVIDER_STATUS,void 0),"").catch((()=>({connected:!1,version:null,templateAPIVersion:null})))}t.getStatus=c,t.isConnectedToAtLeast=async function(e){const t=await c();if(t.connected&&null!==t.version){const n=(0,r.default)(t.version,e);if(0===n||1===n)return!0}return!1}},69742:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},78985:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},69045:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},56242:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},95482:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(69045),t),r(n(56242),t),r(n(69695),t),r(n(81627),t)},69695:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateFragmentNames=t.PresentationTemplateFragmentNames=t.ContainerTemplateFragmentNames=t.TemplateNames=void 0,t.TemplateNames={markdown:"markdown",list:"list",custom:"custom"},t.ContainerTemplateFragmentNames={container:"container"},t.PresentationTemplateFragmentNames={text:"text",image:"image",list:"list"},t.TemplateFragmentNames=Object.assign(Object.assign({},t.ContainerTemplateFragmentNames),t.PresentationTemplateFragmentNames)},81627:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},10314:(e,t)=>{"use strict";function n(e,t){let n;try{n=JSON.stringify(e)}catch(e){n=t}return n}Object.defineProperty(t,"__esModule",{value:!0}),t.safeStringify=t.validateEnvironment=t.sanitizeEventType=t.sanitizeFunction=void 0,t.sanitizeFunction=function(e){if("function"!=typeof e)throw new Error(`Invalid argument passed: ${n(e,"The provided value")} is not a valid function`);return e},t.sanitizeEventType=function(e){if("notification-action"===e||"notification-created"===e||"notification-toast-dismissed"===e||"notification-closed"===e||"notifications-count-changed"===e||"notification-form-submitted"===e)return e;throw new Error(`Invalid argument passed: ${n(e,"The provided event type")} is not a valid Notifications event type`)},t.validateEnvironment=function(){if("undefined"==typeof fin)throw new Error("fin is not defined. The openfin-notifications module is only intended for use in an OpenFin application.")},t.safeStringify=n}},t={},function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}(3771);var e,t}));
@@ -1,12 +1,9 @@
1
- /**
2
- * These are internal data structures and methods to facilitate the connection with the Workspace platforms.
3
- * They are not intended for direct use.
4
- */
1
+ /// <reference types="@openfin/core" />
2
+ import { ColorSchemeOption } from './internal';
5
3
  /**
6
4
  * Details of the notification platform.
7
5
  *
8
- * @ignore
9
- *
6
+ * Data structure to facilitate connection with Workspace platforms.
10
7
  */
11
8
  export interface NotificationPlatform {
12
9
  /**
@@ -26,16 +23,33 @@ export interface NotificationPlatform {
26
23
  */
27
24
  icon: string;
28
25
  /**
29
- * This is theme associated with this platform. The center will be themed accordingly
26
+ * This is the theme associated with this platform. The center will be themed accordingly
30
27
  * when the platform is selected.
31
28
  */
32
29
  theme?: any;
30
+ /**
31
+ * This is the scheme associated with this platform.
32
+ */
33
+ scheme?: ColorSchemeOption;
34
+ /**
35
+ * Workspace platform that registers this platform
36
+ */
37
+ workspacePlatform?: {
38
+ identity: OpenFin.ApplicationIdentity;
39
+ analytics: {
40
+ isSupported: boolean;
41
+ };
42
+ };
33
43
  }
34
44
  /**
35
- * @ignore
45
+ * Registers a workspace platform with Notification Center.
46
+ *
47
+ * Do not call directly. Instead, call via the Workspace SDK to register your Workspace platform.
36
48
  */
37
49
  export declare function registerPlatform<T extends NotificationPlatform>(platform: T): Promise<void>;
38
50
  /**
39
- * @ignore
51
+ * Deregisters a workspace platform.
52
+ *
53
+ * Do not call directly. Instead, call via the Workspace SDK to deregister your Workspace platform.
40
54
  */
41
55
  export declare function deregisterPlatform(id: string): Promise<void>;
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @hidden
3
3
  */
4
+ /// <reference types="@openfin/core" />
4
5
  /**
5
6
  * Need a comment block here so that the comment block above is interpreted as a file comment, and not a comment on the
6
7
  * import below.
7
8
  *
8
9
  * @hidden
9
10
  */
10
- import { Identity } from 'openfin/_v2/main';
11
11
  /**
12
12
  * For notifications that have originated from an application running on the same machine as the provider.
13
13
  */
@@ -20,7 +20,7 @@ export interface NotificationSourceDesktop {
20
20
  * could be have been raised by an instance of this application
21
21
  * running on a different machine.
22
22
  */
23
- identity: Identity;
23
+ identity: OpenFin.Identity;
24
24
  }
25
25
  /**
26
26
  * Union of all possible notification sources.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openfin-notifications",
3
- "version": "1.18.0",
3
+ "version": "1.19.0-alpha-1640",
4
4
  "description": "Client library for the Openfin Notifications Center",
5
5
  "main": "dist/client/openfin-notifications.js",
6
6
  "types": "dist/client/index.d.ts",
@@ -8,14 +8,13 @@
8
8
  "dist/client"
9
9
  ],
10
10
  "scripts": {
11
- "storybook": "start-storybook -p 6006",
12
- "storybook:build": "build-storybook",
13
11
  "build": "webpack build --mode production",
14
12
  "build:dev": "webpack build --mode development",
15
13
  "channels": "node scripts/create-runtime-channels.js",
16
14
  "clean": "rimraf gen dist",
17
15
  "docs": "typedoc --tsconfig \"./src/client/tsconfig.json\"",
18
16
  "posttest": "npm run check",
17
+ "typecheck": "npx tsc",
19
18
  "prepack": "tsc -p src/client/tsconfig.types.json",
20
19
  "lint": "npm run lint:typescript && npm run lint:styles",
21
20
  "lint:typescript": "eslint \"./src/**/*.{ts,tsx}\"",
@@ -29,20 +28,24 @@
29
28
  "start:prod": "webpack serve --mode production"
30
29
  },
31
30
  "author": "Openfin",
32
- "license": "ISC",
31
+ "license": "SEE LICENSE IN LICENSE.MD",
33
32
  "homepage": "https://developers.openfin.co/docs/notifications-api",
34
33
  "dependencies": {
34
+ "@openfin/core": "28.72.10",
35
35
  "@openfin/predux": "^1.0.0-alpha.1",
36
+ "acorn": "^8.8.1",
37
+ "ajv": "^8.11.0",
36
38
  "date-fns": "^2.29.2",
37
39
  "date-fns-tz": "^1.3.7",
38
- "dexie": "^2.0.4",
40
+ "dexie": "^3.2.2",
39
41
  "formik": "^2.2.5",
40
42
  "framer-motion": "^4.1.5",
41
43
  "fuse.js": "^6.4.6",
42
44
  "history": "^4.10.1",
43
45
  "inversify": "^5.0.1",
44
46
  "lodash": "^4.17.21",
45
- "markdown-it": "^9.1.0",
47
+ "markdown-it": "^13.0.1",
48
+ "meow": "^11.0.0",
46
49
  "openfin-service-async": "^1.0.1",
47
50
  "openfin-service-signal": "^1.0.0",
48
51
  "react": "^17.0.1",
@@ -59,12 +62,8 @@
59
62
  "yup": "^0.32.9"
60
63
  },
61
64
  "devDependencies": {
62
- "@openfin/ui-library": "^0.1.40",
63
- "@storybook/addon-actions": "6.2.9",
64
- "@storybook/addon-essentials": "^6.2.9",
65
- "@storybook/node-logger": "^6.2.9",
66
- "@storybook/preset-typescript": "3.0.0",
67
- "@storybook/react": "6.2.9",
65
+ "@actions/core": "^1.10.0",
66
+ "@openfin/ui-library": "^0.8.0-alpha.1670834649",
68
67
  "@testing-library/jest-dom": "^5.11.5",
69
68
  "@testing-library/react": "^11.1.0",
70
69
  "@types/jest": "^27.4.1",
@@ -73,9 +72,8 @@
73
72
  "@types/markdown-it": "^12.2.3",
74
73
  "@types/mkdirp": "^0.5.2",
75
74
  "@types/node": "^9.4.6",
76
- "@types/node-fetch": "^2.3.4",
77
- "@types/openfin": "^51.0.0",
78
- "@types/puppeteer-core": "^2.0.0",
75
+ "@types/node-fetch": "^2.6.2",
76
+ "@types/puppeteer-core": "^5.4.0",
79
77
  "@types/react": "^17.0.11",
80
78
  "@types/react-dom": "^17.0.7",
81
79
  "@types/react-redux": "^7.0.8",
@@ -92,6 +90,7 @@
92
90
  "archiver": "^5.3.0",
93
91
  "babel-preset-const-enum": "^1.0.0",
94
92
  "copy-webpack-plugin": "^10.2.4",
93
+ "css-loader": "^6.7.1",
95
94
  "dotenv": "^16.0.0",
96
95
  "dotenv-defaults": "^5.0.0",
97
96
  "dotenv-expand": "^8.0.3",
@@ -109,9 +108,8 @@
109
108
  "mini-css-extract-plugin": "^2.6.0",
110
109
  "mkdirp": "^0.5.1",
111
110
  "node-fetch": "^2.6.0",
112
- "openfin-service-config": "^1.0.4",
113
111
  "prettier": "^2.2.1",
114
- "puppeteer-core": "~5.2.1",
112
+ "puppeteer-core": "^19.0.0",
115
113
  "rimraf": "^3.0.2",
116
114
  "sass": "^1.50.0",
117
115
  "sass-loader": "^12.6.0",
@@ -122,11 +120,11 @@
122
120
  "ts-jest": "^27.1.4",
123
121
  "ts-loader": "^9.2.8",
124
122
  "ts-node": "^9.0.0",
125
- "typedoc": "^0.20.36",
126
- "typescript": "^4.2.3",
123
+ "typedoc": "^0.23.19",
124
+ "typescript": "^4.8.4",
127
125
  "webpack": "^5.72.0",
128
126
  "webpack-cli": "^4.9.2",
129
- "webpack-dev-server": "^4.8.1",
127
+ "webpack-dev-server": "^4.11.1",
130
128
  "workbox-webpack-plugin": "^6.4.2"
131
129
  },
132
130
  "stylelint": {
package/LICENSE DELETED
@@ -1,13 +0,0 @@
1
- Copyright 2018 OpenFin Inc.
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.