openfin-notifications 2.1.2 → 2.1.3-alpha-3131
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/dist/client/EventRouter.d.ts +1 -1
- package/dist/client/controls.d.ts +15 -1
- package/dist/client/forms/fields.d.ts +44 -2
- package/dist/client/forms/index.d.ts +16 -0
- package/dist/client/forms/widgets.d.ts +54 -2
- package/dist/client/indicator.d.ts +14 -1
- package/dist/client/internal.d.ts +12 -3
- package/dist/client/main.d.ts +129 -4
- package/dist/client/openfin-notifications.js +1 -1
- package/dist/client/templates/BaseNotificationOptions.d.ts +2 -2
- package/dist/client/templates/BaseUpdatableNotificationOptions.d.ts +1 -1
- package/dist/client/templates/templates.d.ts +124 -3
- package/dist/client/templates/update.d.ts +2 -1
- package/dist/client/without-auto-launch.js +1 -1
- package/package.json +3 -171
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Acts as a central point for routing all events received from the provider.
|
|
7
7
|
*/
|
|
8
8
|
import { EventEmitter } from 'events';
|
|
9
|
-
import { TransportMappings, TransportMemberMappings
|
|
9
|
+
import { Events, TransportMappings, TransportMemberMappings } from './internal';
|
|
10
10
|
export interface EventSpecification {
|
|
11
11
|
type: string;
|
|
12
12
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @hidden
|
|
12
12
|
*/
|
|
13
13
|
import { ActionDeclaration } from './actions';
|
|
14
|
-
import { ActionableTextTemplateFragment, ImageTemplateFragment, ContainerTemplateFragment } from '
|
|
14
|
+
import { ActionableTextTemplateFragment, ImageTemplateFragment, ContainerTemplateFragment } from './templates';
|
|
15
15
|
/**
|
|
16
16
|
* Helper to make the `type` field required on any type that defines it as being optional.
|
|
17
17
|
*/
|
|
@@ -87,5 +87,19 @@ export interface ButtonOptions {
|
|
|
87
87
|
* @hidden
|
|
88
88
|
*/
|
|
89
89
|
index?: number;
|
|
90
|
+
formOptions?: {
|
|
91
|
+
/**
|
|
92
|
+
* Title to display on a button when form is submitting.
|
|
93
|
+
*/
|
|
94
|
+
submittingTitle?: string | null;
|
|
95
|
+
/**
|
|
96
|
+
* Title to display on a button when form is in the error state.
|
|
97
|
+
*/
|
|
98
|
+
errorTitle?: string | null;
|
|
99
|
+
/**
|
|
100
|
+
* Title to display on a button when form is in the success state.
|
|
101
|
+
*/
|
|
102
|
+
successTitle?: string | null;
|
|
103
|
+
} | null;
|
|
90
104
|
}
|
|
91
105
|
export {};
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* imports.
|
|
10
10
|
*/
|
|
11
|
-
import { StringWidget, NumberWidget, BooleanWidget } from './widgets';
|
|
11
|
+
import { StringWidget, NumberWidget, BooleanWidget, DateWidget, RadioGroupWidget, CheckboxGroupWidget, TimeWidget } from './widgets';
|
|
12
|
+
import { MakePropertyRequired } from '../internal';
|
|
12
13
|
/**
|
|
13
14
|
* Data type of a fields. e.g. string, number
|
|
14
15
|
*/
|
|
@@ -16,6 +17,10 @@ export declare const FieldType: {
|
|
|
16
17
|
readonly string: "string";
|
|
17
18
|
readonly number: "number";
|
|
18
19
|
readonly boolean: "boolean";
|
|
20
|
+
readonly date: "date";
|
|
21
|
+
readonly checkboxGroup: "checkboxGroup";
|
|
22
|
+
readonly radioGroup: "radioGroup";
|
|
23
|
+
readonly time: "time";
|
|
19
24
|
};
|
|
20
25
|
/**
|
|
21
26
|
* An abstract validation entry.
|
|
@@ -54,6 +59,10 @@ export interface BaseField<T extends keyof typeof FieldType, D = unknown> {
|
|
|
54
59
|
* Input label.
|
|
55
60
|
*/
|
|
56
61
|
label?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Helper text.
|
|
64
|
+
*/
|
|
65
|
+
helperText?: string;
|
|
57
66
|
}
|
|
58
67
|
/**
|
|
59
68
|
* String field within a form.
|
|
@@ -126,12 +135,45 @@ export interface NumberField<W extends NumberWidget = NumberWidget> extends Base
|
|
|
126
135
|
export interface BooleanField<W extends BooleanWidget = BooleanWidget> extends BaseField<'boolean', boolean> {
|
|
127
136
|
widget: W;
|
|
128
137
|
}
|
|
138
|
+
export interface DateField<W extends DateWidget = DateWidget> extends BaseField<'date', Date> {
|
|
139
|
+
widget: W;
|
|
140
|
+
}
|
|
141
|
+
export declare type TimeFieldValue = {
|
|
142
|
+
hour?: number;
|
|
143
|
+
minute?: number;
|
|
144
|
+
};
|
|
145
|
+
export interface TimeField<W extends TimeWidget = TimeWidget> extends BaseField<'time', TimeFieldValue> {
|
|
146
|
+
widget: W;
|
|
147
|
+
}
|
|
148
|
+
export interface RadioGroupField<W extends RadioGroupWidget = RadioGroupWidget> extends BaseField<'radioGroup', string> {
|
|
149
|
+
widget: W;
|
|
150
|
+
}
|
|
151
|
+
export interface CheckboxGroupField<W extends CheckboxGroupWidget = CheckboxGroupWidget> extends BaseField<'checkboxGroup', Array<string>> {
|
|
152
|
+
widget: W;
|
|
153
|
+
}
|
|
129
154
|
/**
|
|
130
155
|
* A field in a form.
|
|
131
156
|
*/
|
|
132
|
-
export declare type FormField = StringField | NumberField | BooleanField;
|
|
157
|
+
export declare type FormField = StringField | NumberField | BooleanField | DateField | RadioGroupField | CheckboxGroupField | TimeField;
|
|
158
|
+
/**
|
|
159
|
+
* A field in a form.
|
|
160
|
+
*
|
|
161
|
+
* The difference with [[FormField]] is that the label property is required.
|
|
162
|
+
*/
|
|
163
|
+
export declare type FormFieldWithRequiredLabel = MakePropertyRequired<FormField, 'label'>;
|
|
164
|
+
/**
|
|
165
|
+
* A field in a form. Either [[FormField]] or [[FormFieldWithRequiredLabel]]
|
|
166
|
+
*/
|
|
167
|
+
export declare type AnyFormField = FormField | FormFieldWithRequiredLabel;
|
|
133
168
|
/**
|
|
134
169
|
* An ordered array of fields representing a form.
|
|
135
170
|
* When the form is displayed to the user the fields will appear in the same order they are in the array.
|
|
136
171
|
*/
|
|
137
172
|
export declare type NotificationFormData = ReadonlyArray<FormField>;
|
|
173
|
+
/**
|
|
174
|
+
* An ordered array of fields representing a form.
|
|
175
|
+
* When the form is displayed to the user the fields will appear in the same order they are in the array.
|
|
176
|
+
*
|
|
177
|
+
* The difference with [[NotificationFormData]] is that the label property is required for each field.
|
|
178
|
+
*/
|
|
179
|
+
export declare type NotificationFormDataWithRequiredLabel = ReadonlyArray<FormFieldWithRequiredLabel>;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
1
|
export * from './fields';
|
|
2
2
|
export * from './widgets';
|
|
3
|
+
export declare type FormStatus = 'not-submitted' | 'submitting' | 'submitted';
|
|
4
|
+
export interface FormStatusOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Controls form status,
|
|
7
|
+
*/
|
|
8
|
+
formStatus: FormStatus;
|
|
9
|
+
/**
|
|
10
|
+
* Sets error message at the top of the form.
|
|
11
|
+
*/
|
|
12
|
+
error?: string;
|
|
13
|
+
_notificationId: string;
|
|
14
|
+
}
|
|
15
|
+
export declare type CustomValidationError = {
|
|
16
|
+
fieldKey: string;
|
|
17
|
+
error: string;
|
|
18
|
+
};
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const StringWidgetType: {
|
|
10
10
|
readonly Text: "Text";
|
|
11
|
+
readonly Dropdown: "Dropdown";
|
|
11
12
|
};
|
|
12
13
|
export declare const NumberWidgetType: {
|
|
13
14
|
readonly Number: "Number";
|
|
@@ -16,16 +17,33 @@ export declare const BooleanWidgetType: {
|
|
|
16
17
|
readonly Toggle: "Toggle";
|
|
17
18
|
readonly Checkbox: "Checkbox";
|
|
18
19
|
};
|
|
20
|
+
export declare const CheckboxGroupWidgetType: {
|
|
21
|
+
readonly CheckboxGroup: "CheckboxGroup";
|
|
22
|
+
};
|
|
23
|
+
export declare const RadioGroupWidgetType: {
|
|
24
|
+
readonly RadioGroup: "RadioGroup";
|
|
25
|
+
};
|
|
26
|
+
export declare const DateWidgetType: {
|
|
27
|
+
readonly Date: "Date";
|
|
28
|
+
};
|
|
29
|
+
export declare const TimeWidgetType: {
|
|
30
|
+
readonly Time: "Time";
|
|
31
|
+
};
|
|
19
32
|
export declare const WidgetType: {
|
|
33
|
+
readonly Time: "Time";
|
|
34
|
+
readonly Date: "Date";
|
|
35
|
+
readonly RadioGroup: "RadioGroup";
|
|
36
|
+
readonly CheckboxGroup: "CheckboxGroup";
|
|
20
37
|
readonly Toggle: "Toggle";
|
|
21
38
|
readonly Checkbox: "Checkbox";
|
|
22
39
|
readonly Number: "Number";
|
|
23
40
|
readonly Text: "Text";
|
|
41
|
+
readonly Dropdown: "Dropdown";
|
|
24
42
|
};
|
|
25
43
|
/**
|
|
26
44
|
* All available widgets.
|
|
27
45
|
*/
|
|
28
|
-
export declare type Widget = StringWidget | NumberWidget | BooleanWidget;
|
|
46
|
+
export declare type Widget = StringWidget | NumberWidget | BooleanWidget | CheckboxGroupWidget | RadioGroupWidget | DateWidget;
|
|
29
47
|
export interface BaseWidgetSpec<T extends keyof typeof WidgetType> {
|
|
30
48
|
/**
|
|
31
49
|
* The type of widget to be used. Widgets can only be used with matching specific data types.
|
|
@@ -38,16 +56,50 @@ export interface BaseWidgetSpec<T extends keyof typeof WidgetType> {
|
|
|
38
56
|
*/
|
|
39
57
|
export interface TextWidgetSpec extends BaseWidgetSpec<typeof WidgetType['Text']> {
|
|
40
58
|
placeholder?: string;
|
|
59
|
+
multiline?: boolean;
|
|
60
|
+
rows?: number;
|
|
41
61
|
}
|
|
42
62
|
/**
|
|
43
63
|
* String field input widget.
|
|
44
64
|
*/
|
|
45
|
-
export declare type StringWidget = TextWidgetSpec;
|
|
65
|
+
export declare type StringWidget = TextWidgetSpec | DropdownWidgetSpec;
|
|
46
66
|
export interface NumberWidgetSpec extends BaseWidgetSpec<typeof WidgetType['Number']> {
|
|
47
67
|
placeholder?: string;
|
|
48
68
|
min?: number;
|
|
49
69
|
max?: number;
|
|
70
|
+
currencyChar?: string;
|
|
71
|
+
decimalPlaces?: number;
|
|
72
|
+
step?: number;
|
|
73
|
+
}
|
|
74
|
+
export interface CheckboxGroupWidgetSpec extends BaseWidgetSpec<typeof WidgetType['CheckboxGroup']> {
|
|
75
|
+
group: Array<{
|
|
76
|
+
value: string;
|
|
77
|
+
label: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
export declare type CheckboxGroupWidget = CheckboxGroupWidgetSpec;
|
|
81
|
+
export interface RadioGroupWidgetSpec extends BaseWidgetSpec<typeof WidgetType['RadioGroup']> {
|
|
82
|
+
group: Array<{
|
|
83
|
+
value: string;
|
|
84
|
+
label: string;
|
|
85
|
+
}>;
|
|
86
|
+
}
|
|
87
|
+
export declare type RadioGroupWidget = RadioGroupWidgetSpec;
|
|
88
|
+
export interface DateWidgetSpec extends BaseWidgetSpec<typeof WidgetType['Date']> {
|
|
89
|
+
minDate?: Date | null;
|
|
90
|
+
maxDate?: Date | null;
|
|
91
|
+
}
|
|
92
|
+
export declare type TimeWidgetSpec = BaseWidgetSpec<typeof WidgetType['Time']>;
|
|
93
|
+
export declare type DateWidget = DateWidgetSpec;
|
|
94
|
+
export declare type TimeWidget = TimeWidgetSpec;
|
|
95
|
+
export interface DropdownWidgetSpec extends BaseWidgetSpec<typeof WidgetType['Dropdown']> {
|
|
96
|
+
placeholder?: string;
|
|
97
|
+
options: Array<{
|
|
98
|
+
value: string;
|
|
99
|
+
label: string;
|
|
100
|
+
}>;
|
|
50
101
|
}
|
|
102
|
+
export declare type DropdownWidget = DropdownWidgetSpec;
|
|
51
103
|
/**
|
|
52
104
|
* Number field input widget.
|
|
53
105
|
*/
|
|
@@ -19,7 +19,10 @@ export declare enum IndicatorColor {
|
|
|
19
19
|
YELLOW = "yellow",
|
|
20
20
|
BLUE = "blue",
|
|
21
21
|
PURPLE = "purple",
|
|
22
|
-
GRAY = "gray"
|
|
22
|
+
GRAY = "gray",
|
|
23
|
+
ORANGE = "orange",
|
|
24
|
+
MAGENTA = "magenta",
|
|
25
|
+
TEAL = "teal"
|
|
23
26
|
}
|
|
24
27
|
export interface NotificationIndicator {
|
|
25
28
|
/**
|
|
@@ -46,3 +49,13 @@ export interface NotificationIndicator {
|
|
|
46
49
|
*/
|
|
47
50
|
text?: string;
|
|
48
51
|
}
|
|
52
|
+
export interface NotificationIndicatorWithCustomColor extends Omit<NotificationIndicator, 'color'> {
|
|
53
|
+
/**
|
|
54
|
+
* Custom color string for indicator banner. This string must be defined in `theme` during Workspace Platform initialization.
|
|
55
|
+
*/
|
|
56
|
+
color: string;
|
|
57
|
+
/**
|
|
58
|
+
* Fallback color if custom color could not be found in theme.
|
|
59
|
+
*/
|
|
60
|
+
fallback: IndicatorColor;
|
|
61
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { NotificationActionResult, ActionTrigger } from './actions';
|
|
11
11
|
import { ProviderStatus } from './provider';
|
|
12
12
|
import { NotificationSource } from './source';
|
|
13
|
-
import { NotificationOptions, Notification, NotificationActionEvent, NotificationClosedEvent, NotificationCreatedEvent, NotificationsCountChanged, NotificationFormSubmittedEvent, UpdatableNotification, UpdatableNotificationOptions, NotificationToastDismissedEvent, ShowOptions, NotificationReminderCreatedEvent, NotificationReminderRemovedEvent, ImageTemplateFragment, ContainerTemplateFragment, ActionableTextTemplateFragment, PlatformDeregisterPayload, PlatformRegisterPayload } from './main';
|
|
13
|
+
import { NotificationOptions, Notification, NotificationActionEvent, NotificationClosedEvent, NotificationCreatedEvent, NotificationsCountChanged, NotificationFormSubmittedEvent, UpdatableNotification, UpdatableNotificationOptions, NotificationToastDismissedEvent, ShowOptions, NotificationReminderCreatedEvent, NotificationReminderRemovedEvent, ImageTemplateFragment, ContainerTemplateFragment, ActionableTextTemplateFragment, PlatformDeregisterPayload, PlatformRegisterPayload, FormStatusOptions, NotificationFormValuesChangedEvent, CustomValidationError } from './main';
|
|
14
14
|
/**
|
|
15
15
|
* The identity of the main application window of the service provider
|
|
16
16
|
*/
|
|
@@ -36,7 +36,9 @@ export declare const enum APITopic {
|
|
|
36
36
|
SHOW_NOTIFICATION_CENTER = "show-notification-center",
|
|
37
37
|
HIDE_NOTIFICATION_CENTER = "hide-notification-center",
|
|
38
38
|
REGISTER_PLATFORM = "register-notifications-platform",
|
|
39
|
-
DEREGISTER_PLATFORM = "deregister-notifications-platform"
|
|
39
|
+
DEREGISTER_PLATFORM = "deregister-notifications-platform",
|
|
40
|
+
SET_FORM_STATUS_OPTIONS = "set-form-status-options",
|
|
41
|
+
SET_FORM_VALIDATION_ERRORS = "set-form-validation-errors"
|
|
40
42
|
}
|
|
41
43
|
export interface API {
|
|
42
44
|
[APITopic.CREATE_NOTIFICATION]: [CreatePayload, NotificationInternal];
|
|
@@ -56,8 +58,10 @@ export interface API {
|
|
|
56
58
|
Pick<RegistrationMetaInfo, 'notificationsVersion'> | undefined
|
|
57
59
|
];
|
|
58
60
|
[APITopic.DEREGISTER_PLATFORM]: [PlatformDeregisterPayload, void];
|
|
61
|
+
[APITopic.SET_FORM_STATUS_OPTIONS]: [FormStatusOptions, void];
|
|
62
|
+
[APITopic.SET_FORM_VALIDATION_ERRORS]: [SetFormValidationErrorsPayload, void];
|
|
59
63
|
}
|
|
60
|
-
export declare type Events = NotificationActionEvent | NotificationToastDismissedEvent | NotificationClosedEvent | NotificationCreatedEvent | NotificationsCountChanged | NotificationFormSubmittedEvent | NotificationReminderCreatedEvent | NotificationReminderRemovedEvent
|
|
64
|
+
export declare type Events = NotificationActionEvent | NotificationToastDismissedEvent | NotificationClosedEvent | NotificationCreatedEvent | NotificationsCountChanged | Omit<NotificationFormSubmittedEvent, 'setFormStatus' | 'preventDefault'> | NotificationReminderCreatedEvent | NotificationReminderRemovedEvent | Omit<NotificationFormValuesChangedEvent, 'setErrors'>;
|
|
61
65
|
export declare type TransportMappings<T> = T extends NotificationActionEvent ? NotificationActionEventTransport : never;
|
|
62
66
|
export declare type TransportMemberMappings<T> = T extends Notification ? NotificationInternal : T;
|
|
63
67
|
export declare type CreatePayload<T extends NotificationOptions = NotificationOptions> = DistributiveOmit<T, 'date' | 'expires'> & {
|
|
@@ -65,6 +69,10 @@ export declare type CreatePayload<T extends NotificationOptions = NotificationOp
|
|
|
65
69
|
expires?: number | null;
|
|
66
70
|
reminder?: number | null;
|
|
67
71
|
};
|
|
72
|
+
export declare type SetFormValidationErrorsPayload = {
|
|
73
|
+
errors: Array<CustomValidationError>;
|
|
74
|
+
notificationId: string;
|
|
75
|
+
};
|
|
68
76
|
export declare type UpdatePayload<T extends UpdatableNotificationOptions = UpdatableNotificationOptions> = T;
|
|
69
77
|
export declare type NotificationInternal<T extends NotificationOptions = NotificationOptions> = DistributiveOmit<Notification<T>, 'date' | 'expires'> & {
|
|
70
78
|
date: number;
|
|
@@ -108,3 +116,4 @@ export interface RegistrationMetaInfo {
|
|
|
108
116
|
*/
|
|
109
117
|
notificationsVersion: string;
|
|
110
118
|
}
|
|
119
|
+
export declare type MakePropertyRequired<T, Prop extends keyof T> = Omit<T, Prop> & Required<Pick<T, Prop>>;
|
package/dist/client/main.d.ts
CHANGED
|
@@ -12,10 +12,11 @@ import { ButtonOptions, ControlOptions } from './controls';
|
|
|
12
12
|
import { DistributiveOmit } from './internal';
|
|
13
13
|
import * as provider from './provider';
|
|
14
14
|
import { NotificationSource } from './source';
|
|
15
|
-
import { NotificationIndicator, IndicatorType, IndicatorColor } from './indicator';
|
|
15
|
+
import { NotificationIndicator, NotificationIndicatorWithCustomColor, IndicatorType, IndicatorColor } from './indicator';
|
|
16
16
|
import { NotificationOptions } from './templates/templates';
|
|
17
17
|
import { UpdatableNotificationOptions } from './templates/update';
|
|
18
18
|
import * as actions from './actions';
|
|
19
|
+
import { CustomValidationError, FormStatusOptions } from './forms';
|
|
19
20
|
export * from './actions';
|
|
20
21
|
export * from './controls';
|
|
21
22
|
export * from './source';
|
|
@@ -23,8 +24,8 @@ export * from './forms';
|
|
|
23
24
|
export * from './stream';
|
|
24
25
|
export * from './templates';
|
|
25
26
|
export { actions, provider, NotificationOptions };
|
|
26
|
-
export { NotificationIndicator, IndicatorColor, IndicatorType as NotificationIndicatorType };
|
|
27
|
-
export type { PlatformRegisterPayload, PlatformDeregisterPayload
|
|
27
|
+
export { NotificationIndicator, NotificationIndicatorWithCustomColor, IndicatorColor, IndicatorType as NotificationIndicatorType, };
|
|
28
|
+
export type { PlatformRegisterPayload, PlatformDeregisterPayload } from '../provider/model/Platform';
|
|
28
29
|
/**
|
|
29
30
|
* The Notification Client library's version in semver format.
|
|
30
31
|
*
|
|
@@ -215,16 +216,139 @@ export interface NotificationsCountChanged {
|
|
|
215
216
|
*/
|
|
216
217
|
count: number;
|
|
217
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Event fired whenever any of the notification form fields changes.
|
|
221
|
+
*
|
|
222
|
+
* @event "notification-form-value-changed"
|
|
223
|
+
*/
|
|
224
|
+
export interface NotificationFormValuesChangedEvent {
|
|
225
|
+
type: 'notification-form-values-changed';
|
|
226
|
+
notification: Notification;
|
|
227
|
+
form: Record<string, unknown>;
|
|
228
|
+
/**
|
|
229
|
+
* Allows to set validation errors for the form fields.
|
|
230
|
+
* If validation errors are set, the submit button will be disabled.
|
|
231
|
+
* @param validationErrors
|
|
232
|
+
* Array of objects with fieldKey and error properties.
|
|
233
|
+
* @returns
|
|
234
|
+
* Promise that resolves when the validation errors are set.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* addEventListener(
|
|
238
|
+
* 'notification-form-values-changed',
|
|
239
|
+
* async (formValueChanged: NotificationFormValuesChangedEvent) => {
|
|
240
|
+
* const errors = [];
|
|
241
|
+
*
|
|
242
|
+
* // Simpler regular expression to test for a valid HTTP or HTTPS URL
|
|
243
|
+
* const phonePattern = /^\(?([0-9]{3})\)?[- ]?([0-9]{3})[- ]?([0-9]{4})$/;
|
|
244
|
+
*
|
|
245
|
+
* // Simpler regular expression to test for a valid email address
|
|
246
|
+
* const emailPattern = /^\S+@\S+\.\S+$/;
|
|
247
|
+
*
|
|
248
|
+
* // Fields to validate
|
|
249
|
+
* const sourcePhone = formValueChanged.form.sourcePhone as string;
|
|
250
|
+
* const email = formValueChanged.form.sourceEmail as string;
|
|
251
|
+
*
|
|
252
|
+
* // Validate sourceUrl if it's not null or undefined
|
|
253
|
+
* if (sourcePhone && !phonePattern.test(sourcePhone)) {
|
|
254
|
+
* errors.push({
|
|
255
|
+
* fieldKey: 'sourcePhone',
|
|
256
|
+
* error: 'Invalid phone format'
|
|
257
|
+
* });
|
|
258
|
+
* }
|
|
259
|
+
*
|
|
260
|
+
* // Validate email if it's not null or undefined
|
|
261
|
+
* if (email && !emailPattern.test(email)) {
|
|
262
|
+
* errors.push({
|
|
263
|
+
* fieldKey: 'sourceEmail',
|
|
264
|
+
* error: 'Invalid email format'
|
|
265
|
+
* });
|
|
266
|
+
* }
|
|
267
|
+
*
|
|
268
|
+
* // If there are any errors, set them all at once
|
|
269
|
+
* if (errors.length > 0) {
|
|
270
|
+
* await formValueChanged.setErrors(errors);
|
|
271
|
+
* }
|
|
272
|
+
* }
|
|
273
|
+
* );
|
|
274
|
+
*/
|
|
275
|
+
setErrors: (validationErrors: Array<CustomValidationError>) => Promise<void>;
|
|
276
|
+
}
|
|
218
277
|
/**
|
|
219
278
|
* Event fired whenever submit button is clicked on a notification form.
|
|
220
279
|
*
|
|
221
|
-
* @event "
|
|
280
|
+
* @event "notification-form-submitted"
|
|
222
281
|
*/
|
|
223
282
|
export interface NotificationFormSubmittedEvent {
|
|
224
283
|
type: 'notification-form-submitted';
|
|
225
284
|
notification: Notification;
|
|
285
|
+
button: ButtonOptions;
|
|
226
286
|
form: Record<string, unknown>;
|
|
287
|
+
/**
|
|
288
|
+
* Prevents the default behaviour of notification form submit, where notification card gets dismissed right after submit.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* addEventListener('notification-form-submitted', async (event) => {
|
|
292
|
+
* // preventing the default submit behaviour
|
|
293
|
+
* event.preventDefault();
|
|
294
|
+
*
|
|
295
|
+
* // setting the form status to processing
|
|
296
|
+
* event.setFormStatus({
|
|
297
|
+
* formStatus: 'Processing'
|
|
298
|
+
* });
|
|
299
|
+
*
|
|
300
|
+
* const longOperationResult = await ...();
|
|
301
|
+
*
|
|
302
|
+
* if (longOperationResult.hasError) {
|
|
303
|
+
* // setting error if long-running operation has failed.
|
|
304
|
+
* event.setFormStatus({
|
|
305
|
+
* formStatus: 'not-submitted',
|
|
306
|
+
* error: longOperationResult.operationErrorMessage
|
|
307
|
+
* });
|
|
308
|
+
* } else {
|
|
309
|
+
* // setting form status to submitted
|
|
310
|
+
* event.setFormStatus({
|
|
311
|
+
* formStatus: 'submitted'
|
|
312
|
+
* });
|
|
313
|
+
* }
|
|
314
|
+
* });
|
|
315
|
+
*/
|
|
316
|
+
preventDefault: () => void;
|
|
317
|
+
/**
|
|
318
|
+
*
|
|
319
|
+
* @param formStatusOptions
|
|
320
|
+
* Allows to set the status of the form. The form status reflects the state of the submit button which includes its text.
|
|
321
|
+
* Submit button text for different statuses is defined using `formOptions` property for a submit button when creating a notification.
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* addEventListener('notification-form-submitted', async (event) => {
|
|
325
|
+
* // preventing the default submit behaviour
|
|
326
|
+
* event.preventDefault();
|
|
327
|
+
*
|
|
328
|
+
* // setting the form status to processing
|
|
329
|
+
* event.setFormStatus({
|
|
330
|
+
* formStatus: 'Processing'
|
|
331
|
+
* });
|
|
332
|
+
*
|
|
333
|
+
* const longOperationResult = await ...();
|
|
334
|
+
*
|
|
335
|
+
* if (longOperationResult.hasError) {
|
|
336
|
+
* // setting error if long-running operation has failed.
|
|
337
|
+
* event.setFormStatus({
|
|
338
|
+
* formStatus: 'not-submitted',
|
|
339
|
+
* error: longOperationResult.operationErrorMessage
|
|
340
|
+
* });
|
|
341
|
+
* } else {
|
|
342
|
+
* // setting form status to submitted
|
|
343
|
+
* event.setFormStatus({
|
|
344
|
+
* formStatus: 'submitted'
|
|
345
|
+
* });
|
|
346
|
+
* }
|
|
347
|
+
* });
|
|
348
|
+
*/
|
|
349
|
+
setFormStatus: (formStatusOptions: Omit<FormStatusOptions, '_notificationId'>) => Promise<void>;
|
|
227
350
|
}
|
|
351
|
+
export declare function addEventListener(eventType: 'notification-form-values-changed', listener: (event: NotificationFormValuesChangedEvent) => void): void;
|
|
228
352
|
export declare function addEventListener(eventType: 'notification-form-submitted', listener: (event: NotificationFormSubmittedEvent) => void): Promise<void>;
|
|
229
353
|
export declare function addEventListener(eventType: 'notification-action', listener: (event: NotificationActionEvent) => void): Promise<void>;
|
|
230
354
|
export declare function addEventListener(eventType: 'notification-created', listener: (event: NotificationCreatedEvent) => void): Promise<void>;
|
|
@@ -241,6 +365,7 @@ export declare function removeEventListener(eventType: 'notification-closed', li
|
|
|
241
365
|
export declare function removeEventListener(eventType: 'notifications-count-changed', listener: (event: NotificationsCountChanged) => void): Promise<void>;
|
|
242
366
|
export declare function removeEventListener(eventType: 'notification-reminder-created', listener: (event: NotificationReminderCreatedEvent) => void): Promise<void>;
|
|
243
367
|
export declare function removeEventListener(eventType: 'notification-reminder-removed', listener: (event: NotificationReminderRemovedEvent) => void): Promise<void>;
|
|
368
|
+
export declare function removeEventListener(eventType: 'notification-form-values-changed', listener: (event: NotificationFormValuesChangedEvent) => void): void;
|
|
244
369
|
/**
|
|
245
370
|
* Extended configuration options for the notification creation.
|
|
246
371
|
*/
|
|
@@ -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()}(this,(()=>{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))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(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 d(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 p(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 y(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 d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,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}},17385:function(e,t,n){"use strict";var i=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.getEventRouter=t.eventEmitter=t.EventRouter=void 0;const r=n(17187);class o{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:n}=e,r=i(e,["type","target"]);let o;if(!n)throw new Error("Invalid event, no target specified");if("default"===n)o=this._defaultEmitter;else{if(!this._emitterProviders[n.type])throw new Error(`Invalid target, no provider registered for '${n.type}'`);o=this._emitterProviders[n.type](n.id)}const s=Object.assign({type:t},r),a=this._deserializers[t];a?o.emit(t,a(s)):o.emit(t,s)}}let s;t.EventRouter=o,t.eventEmitter=new r.EventEmitter,t.getEventRouter=function(){return s||(s=new o(t.eventEmitter)),s}},19659:(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"},3448:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(12052);!function(){try{(0,i.connectToNotifications)()}catch(e){console.error(e)}}()},73670:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getChannelClient=t.clearAwaitedChannelClient=t.initAwaitedChannelClient=void 0;const i=n(76598),r=n(53117),o=async({wait:e})=>{await r.Log.info("Connecting to Notifications...");const t=await fin.InterApplicationBus.Channel.connect(i.SERVICE_CHANNEL,{wait:e,payload:{version:"2.1.2"}});return await r.Log.info("Successfully connected to Notifications."),t};let s,a;t.initAwaitedChannelClient=()=>s?{channelClientPromise:s,isInit:!1}:(s=o({wait:!0}),s.catch((e=>(0,t.clearAwaitedChannelClient)())),{channelClientPromise:s,isInit:!0}),t.clearAwaitedChannelClient=()=>{s=null},t.getChannelClient=async()=>s||(async()=>{if(!a){try{a=await o({wait:!1})}catch(e){throw await r.Log.error('Could not find channel provider. Did you call "notifications.register()"?'),e}a.onDisconnection((()=>{a=null}))}return a})()},12052:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tryServiceDispatch=t.getServicePromise=t.launchSystemApp=t.connectToNotifications=void 0;const i=n(95881),r=n(76598),o=n(17385),s=n(73670);let a;const c=new i.DeferredPromise;let u=!1;async function l(){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 f(){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===r.SERVICE_IDENTITY.uuid&&t===r.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=(0,s.initAwaitedChannelClient)().channelClientPromise.then((t=>{window.clearTimeout(e);const n=(0,o.getEventRouter)();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"),(0,s.clearAwaitedChannelClient)(),u=!0,a=null,l(),setTimeout((()=>{console.log("Attempting to reconnect to Notifications service"),f()}),300)})),u?console.log("Reconnected to Notifications service"):console.log("Connected to Notifications service"),t}))}}return a}t.connectToNotifications=function(){"undefined"!=typeof fin&&"undefined"!=typeof window?(l(),f(),"loading"!==document.readyState?c.resolve():(window.addEventListener("DOMContentLoaded",(()=>{c.resolve()})),document.addEventListener("DOMContentLoaded",(()=>{c.resolve()})))):console.warn("Could not connect to notifications, `fin` is not defined")},t.launchSystemApp=l,t.getServicePromise=f,t.tryServiceDispatch=async function(e,t){return(await(0,s.getChannelClient)()).dispatch(e,t)}},490:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},97490:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldType=void 0,t.FieldType={string:"string",number:"number",boolean:"boolean"}},8910: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(97490),t),r(n(7713),t)},7713:(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)},61995: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}),n(3448),r(n(7345),t),console.warn('Library "openfin-notifications" (https://www.npmjs.com/package/openfin-notifications) is deprecated. We will stop publishing updates to it after July 2024. Use "@openfin/workspace/notifications" (https://www.npmjs.com/package/@openfin/workspace) instead.')},5221:(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"},76598:(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.SHOW_NOTIFICATION_CENTER="show-notification-center",n.HIDE_NOTIFICATION_CENTER="hide-notification-center",n.REGISTER_PLATFORM="register-notifications-platform",n.DEREGISTER_PLATFORM="deregister-notifications-platform"},53117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Log=void 0;class n{static async error(e){try{const t=n.getPrefixedMessage(e);console.error(t),await fin.System.log("error",t)}catch(e){n.handleError(e,"Failed to log error")}}static async warn(e){try{const t=n.getPrefixedMessage(e);console.warn(t),await fin.System.log("warning",t)}catch(e){n.handleError(e,"Failed to log warning")}}static async info(e){try{const t=n.getPrefixedMessage(e);console.info(t),await fin.System.log("info",t)}catch(e){n.handleError(e,"Failed to log info")}}static getPrefixedMessage(e){return`${n.LOG_PREFIX} ${e}`}static handleError(e,t){e instanceof Error?console.error(`${t} - ${e.name}: ${e.message}`):console.error(`${t} - ${JSON.stringify(e)}`)}}t.Log=n,n.LOG_PREFIX="[openfin-notifications]"},7345: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=t.actions=void 0;const c=n(19659),u=n(12052),l=n(76598),f=n(17385),d=o(n(30207));t.provider=d;const p=n(72475),v=n(5221);Object.defineProperty(t,"NotificationIndicator",{enumerable:!0,get:function(){return v.NotificationIndicator}}),Object.defineProperty(t,"NotificationIndicatorType",{enumerable:!0,get:function(){return v.IndicatorType}}),Object.defineProperty(t,"IndicatorColor",{enumerable:!0,get:function(){return v.IndicatorColor}});const y=n(12908);Object.defineProperty(t,"NotificationOptions",{enumerable:!0,get:function(){return y.NotificationOptions}});const m=o(n(19659));t.actions=m,s(n(19659),t),s(n(490),t),s(n(55063),t),s(n(8910),t),s(n(87221),t),s(n(49757),t),t.VERSION="2.1.2";const h=(0,f.getEventRouter)();function g(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})})}h.registerDeserializer("notification-created",(e=>g(e))),h.registerDeserializer("notification-toast-dismissed",(e=>g(e))),h.registerDeserializer("notification-closed",(e=>g(e))),h.registerDeserializer("notification-action",(e=>{var t;const n=g(e),{controlSource:i,controlIndex:r}=n,o=a(n,["controlSource","controlIndex"]);return e.trigger===c.ActionTrigger.CONTROL?Object.assign(Object.assign({},o),{control:null===(t=e.notification[i])||void 0===t?void 0:t[r]}):o})),h.registerDeserializer("notifications-count-changed",(e=>e)),h.registerDeserializer("notification-reminder-created",(e=>{const t=g(e),{reminderDate:n}=t,i=a(t,["reminderDate"]);return Object.assign(Object.assign({},i),{reminderDate:new Date(n)})})),h.registerDeserializer("notification-reminder-removed",(e=>g(e))),t.addEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t);const n=f.eventEmitter.listenerCount(e);f.eventEmitter.addListener(e,t),0===n&&1===f.eventEmitter.listenerCount(e)&&await(0,u.tryServiceDispatch)(l.APITopic.ADD_EVENT_LISTENER,e)},t.removeEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t),1===f.eventEmitter.listenerCount(e)&&f.eventEmitter.listeners(e)[0]===t&&await(0,u.tryServiceDispatch)(l.APITopic.REMOVE_EVENT_LISTENER,e),f.eventEmitter.removeListener(e,t)},t.create=async function(e,t){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');if(t&&t.reminderDate){if(!1===e.allowReminder)throw new Error('You must not specify a reminder date for a notification with "allowReminder" option set to false.');if(!(t.reminderDate instanceof Date))throw new Error('Invalid argument passed to reminder Options: "date" must a valid Date object');if(e.expires&&e.expires.getTime()<t.reminderDate.getTime())throw new Error("Expiration date must not be earlier than reminder date.")}void 0!==e.category&&null!==e.category||(e.category="default");const n=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(),reminder:(null==t?void 0:t.reminderDate)&&t.reminderDate.valueOf()}));return Object.assign(Object.assign({},n),{date:new Date(n.date),expires:null!==n.expires?new Date(n.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)}},30207: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(12052),a=n(76598);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}},55063:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},87221:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},30600:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},23371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},49757: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(30600),t),r(n(23371),t),r(n(12908),t),r(n(48877),t)},12908:(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",actionableText:"actionableText"},t.TemplateFragmentNames=Object.assign(Object.assign({},t.ContainerTemplateFragmentNames),t.PresentationTemplateFragmentNames)},48877:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},72475:(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||"notification-reminder-created"===e||"notification-reminder-removed"===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}(61995);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()}(this,(()=>{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 d(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 p(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 d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,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}},17385:function(e,t,n){"use strict";var i=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.getEventRouter=t.eventEmitter=t.EventRouter=void 0;const r=n(17187),o=n(12052),s=n(76598);class a{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:n}=e,r=i(e,["type","target"]);let a;if(!n)throw new Error("Invalid event, no target specified");if("default"===n)a=this._defaultEmitter;else{if(!this._emitterProviders[n.type])throw new Error(`Invalid target, no provider registered for '${n.type}'`);a=this._emitterProviders[n.type](n.id)}const c=Object.assign({type:t},r),u=this._deserializers[t];u?a.emit(t,u(c)):"notification-form-submitted"===t?function(e,t){let n=!1;e.preventDefault=()=>n=!0,t.emit("notification-form-submitted",e),n||(0,o.tryServiceDispatch)(s.APITopic.SET_FORM_STATUS_OPTIONS,{formStatus:"submitted",_notificationId:e.notification.id})}(c,a):a.emit(t,c)}}let c;t.EventRouter=a,t.eventEmitter=new r.EventEmitter,t.getEventRouter=function(){return c||(c=new a(t.eventEmitter)),c}},19659:(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"},3448:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(12052);!function(){try{(0,i.connectToNotifications)()}catch(e){console.error(e)}}()},73670:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getChannelClient=t.clearAwaitedChannelClient=t.initAwaitedChannelClient=void 0;const i=n(76598),r=n(53117),o=async({wait:e})=>{await r.Log.info("Connecting to Notifications...");const t=await fin.InterApplicationBus.Channel.connect(i.SERVICE_CHANNEL,{wait:e,payload:{version:"2.1.3-alpha-3131"}});return await r.Log.info("Successfully connected to Notifications."),t};let s,a;t.initAwaitedChannelClient=()=>s?{channelClientPromise:s,isInit:!1}:(s=o({wait:!0}),s.catch((e=>(0,t.clearAwaitedChannelClient)())),{channelClientPromise:s,isInit:!0}),t.clearAwaitedChannelClient=()=>{s=null},t.getChannelClient=async()=>s||(async()=>{if(!a){try{a=await o({wait:!1})}catch(e){throw await r.Log.error('Could not find channel provider. Did you call "notifications.register()"?'),e}a.onDisconnection((()=>{a=null}))}return a})()},12052:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tryServiceDispatch=t.getServicePromise=t.launchSystemApp=t.connectToNotifications=void 0;const i=n(95881),r=n(76598),o=n(17385),s=n(73670);let a;const c=new i.DeferredPromise;let u=!1;async function l(){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 f(){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===r.SERVICE_IDENTITY.uuid&&t===r.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=(0,s.initAwaitedChannelClient)().channelClientPromise.then((t=>{window.clearTimeout(e);const n=(0,o.getEventRouter)();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"),(0,s.clearAwaitedChannelClient)(),u=!0,a=null,l(),setTimeout((()=>{console.log("Attempting to reconnect to Notifications service"),f()}),300)})),u?console.log("Reconnected to Notifications service"):console.log("Connected to Notifications service"),t}))}}return a}t.connectToNotifications=function(){"undefined"!=typeof fin&&"undefined"!=typeof window?(l(),f(),"loading"!==document.readyState?c.resolve():(window.addEventListener("DOMContentLoaded",(()=>{c.resolve()})),document.addEventListener("DOMContentLoaded",(()=>{c.resolve()})))):console.warn("Could not connect to notifications, `fin` is not defined")},t.launchSystemApp=l,t.getServicePromise=f,t.tryServiceDispatch=async function(e,t){return(await(0,s.getChannelClient)()).dispatch(e,t)}},490:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},97490:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldType=void 0,t.FieldType={string:"string",number:"number",boolean:"boolean",date:"date",checkboxGroup:"checkboxGroup",radioGroup:"radioGroup",time:"time"}},8910: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(97490),t),r(n(7713),t)},7713:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetType=t.TimeWidgetType=t.DateWidgetType=t.RadioGroupWidgetType=t.CheckboxGroupWidgetType=t.BooleanWidgetType=t.NumberWidgetType=t.StringWidgetType=void 0,t.StringWidgetType={Text:"Text",Dropdown:"Dropdown"},t.NumberWidgetType={Number:"Number"},t.BooleanWidgetType={Toggle:"Toggle",Checkbox:"Checkbox"},t.CheckboxGroupWidgetType={CheckboxGroup:"CheckboxGroup"},t.RadioGroupWidgetType={RadioGroup:"RadioGroup"},t.DateWidgetType={Date:"Date"},t.TimeWidgetType={Time:"Time"},t.WidgetType=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t.StringWidgetType),t.NumberWidgetType),t.BooleanWidgetType),t.CheckboxGroupWidgetType),t.RadioGroupWidgetType),t.DateWidgetType),t.TimeWidgetType)},61995: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}),n(3448),r(n(7345),t),console.warn('Library "openfin-notifications" (https://www.npmjs.com/package/openfin-notifications) is deprecated. We will stop publishing updates to it after July 2024. Use "@openfin/workspace/notifications" (https://www.npmjs.com/package/@openfin/workspace) instead.')},5221:(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",n.ORANGE="orange",n.MAGENTA="magenta",n.TEAL="teal"},76598:(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.SHOW_NOTIFICATION_CENTER="show-notification-center",n.HIDE_NOTIFICATION_CENTER="hide-notification-center",n.REGISTER_PLATFORM="register-notifications-platform",n.DEREGISTER_PLATFORM="deregister-notifications-platform",n.SET_FORM_STATUS_OPTIONS="set-form-status-options",n.SET_FORM_VALIDATION_ERRORS="set-form-validation-errors"},53117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Log=void 0;class n{static async error(e){try{const t=n.getPrefixedMessage(e);console.error(t),await fin.System.log("error",t)}catch(e){n.handleError(e,"Failed to log error")}}static async warn(e){try{const t=n.getPrefixedMessage(e);console.warn(t),await fin.System.log("warning",t)}catch(e){n.handleError(e,"Failed to log warning")}}static async info(e){try{const t=n.getPrefixedMessage(e);console.info(t),await fin.System.log("info",t)}catch(e){n.handleError(e,"Failed to log info")}}static getPrefixedMessage(e){return`${n.LOG_PREFIX} ${e}`}static handleError(e,t){e instanceof Error?console.error(`${t} - ${e.name}: ${e.message}`):console.error(`${t} - ${JSON.stringify(e)}`)}}t.Log=n,n.LOG_PREFIX="[openfin-notifications]"},7345: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.NotificationIndicatorWithCustomColor=t.NotificationIndicator=t.NotificationOptions=t.provider=t.actions=void 0;const c=n(19659),u=n(12052),l=n(76598),f=n(17385),d=o(n(30207));t.provider=d;const p=n(72475),v=n(5221);Object.defineProperty(t,"NotificationIndicator",{enumerable:!0,get:function(){return v.NotificationIndicator}}),Object.defineProperty(t,"NotificationIndicatorWithCustomColor",{enumerable:!0,get:function(){return v.NotificationIndicatorWithCustomColor}}),Object.defineProperty(t,"NotificationIndicatorType",{enumerable:!0,get:function(){return v.IndicatorType}}),Object.defineProperty(t,"IndicatorColor",{enumerable:!0,get:function(){return v.IndicatorColor}});const m=n(12908);Object.defineProperty(t,"NotificationOptions",{enumerable:!0,get:function(){return m.NotificationOptions}});const y=o(n(19659));t.actions=y,s(n(19659),t),s(n(490),t),s(n(55063),t),s(n(8910),t),s(n(87221),t),s(n(49757),t),t.VERSION="2.1.3-alpha-3131";const h=(0,f.getEventRouter)();function g(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})})}h.registerDeserializer("notification-created",(e=>g(e))),h.registerDeserializer("notification-toast-dismissed",(e=>g(e))),h.registerDeserializer("notification-closed",(e=>g(e))),h.registerDeserializer("notification-action",(e=>{var t;const n=g(e),{controlSource:i,controlIndex:r}=n,o=a(n,["controlSource","controlIndex"]);return e.trigger===c.ActionTrigger.CONTROL?Object.assign(Object.assign({},o),{control:null===(t=e.notification[i])||void 0===t?void 0:t[r]}):o})),h.registerDeserializer("notifications-count-changed",(e=>e)),h.registerDeserializer("notification-reminder-created",(e=>{const t=g(e),{reminderDate:n}=t,i=a(t,["reminderDate"]);return Object.assign(Object.assign({},i),{reminderDate:new Date(n)})})),h.registerDeserializer("notification-reminder-removed",(e=>g(e))),t.addEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t);const n=f.eventEmitter.listenerCount(e);"notification-form-submitted"===e&&(t=function(e){return t=>{const n=t.notification.id;t.setFormStatus=e=>(0,u.tryServiceDispatch)(l.APITopic.SET_FORM_STATUS_OPTIONS,Object.assign(Object.assign({},e),{_notificationId:n})),e(t)}}(t)),"notification-form-values-changed"===e&&(t=function(e){return t=>{t.setErrors=e=>(0,u.tryServiceDispatch)(l.APITopic.SET_FORM_VALIDATION_ERRORS,{errors:e,notificationId:t.notification.id}),e(t)}}(t)),f.eventEmitter.addListener(e,t),0===n&&1===f.eventEmitter.listenerCount(e)&&await(0,u.tryServiceDispatch)(l.APITopic.ADD_EVENT_LISTENER,e)},t.removeEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t),1===f.eventEmitter.listenerCount(e)&&f.eventEmitter.listeners(e)[0]===t&&await(0,u.tryServiceDispatch)(l.APITopic.REMOVE_EVENT_LISTENER,e),f.eventEmitter.removeListener(e,t)},t.create=async function(e,t){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');if(t&&t.reminderDate){if(!1===e.allowReminder)throw new Error('You must not specify a reminder date for a notification with "allowReminder" option set to false.');if(!(t.reminderDate instanceof Date))throw new Error('Invalid argument passed to reminder Options: "date" must a valid Date object');if(e.expires&&e.expires.getTime()<t.reminderDate.getTime())throw new Error("Expiration date must not be earlier than reminder date.")}void 0!==e.category&&null!==e.category||(e.category="default");const n=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(),reminder:(null==t?void 0:t.reminderDate)&&t.reminderDate.valueOf()}));return Object.assign(Object.assign({},n),{date:new Date(n.date),expires:null!==n.expires?new Date(n.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)}},30207: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(12052),a=n(76598);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}},55063:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},87221:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},30600:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},23371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},49757: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(30600),t),r(n(23371),t),r(n(12908),t),r(n(48877),t)},12908:(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",actionableText:"actionableText"},t.TemplateFragmentNames=Object.assign(Object.assign({},t.ContainerTemplateFragmentNames),t.PresentationTemplateFragmentNames)},48877:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},72475:(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||"notification-reminder-created"===e||"notification-reminder-removed"===e||"notification-form-values-changed"===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}(61995);var e,t}));
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* imports
|
|
8
8
|
*/
|
|
9
|
-
import { NotificationStream, NotificationIndicator, ButtonOptions, ActionDeclaration, ActionNoop, ActionBodyClick, CustomData } from '../main';
|
|
9
|
+
import { NotificationStream, NotificationIndicator, NotificationIndicatorWithCustomColor, ButtonOptions, ActionDeclaration, ActionNoop, ActionBodyClick, CustomData } from '../main';
|
|
10
10
|
import { TemplateNames } from './templates';
|
|
11
11
|
/**
|
|
12
12
|
* Configuration options for constructing a Notifications object, shared between all templates.
|
|
@@ -55,7 +55,7 @@ export interface BaseNotificationOptions<T extends keyof typeof TemplateNames> {
|
|
|
55
55
|
*
|
|
56
56
|
* This should not be treated as a priority.
|
|
57
57
|
*/
|
|
58
|
-
indicator?: NotificationIndicator | null;
|
|
58
|
+
indicator?: NotificationIndicator | NotificationIndicatorWithCustomColor | null;
|
|
59
59
|
/**
|
|
60
60
|
* URL of the icon to be displayed in the notification.
|
|
61
61
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomData } from '../main';
|
|
2
|
-
import { ButtonOptions } from '
|
|
2
|
+
import { ButtonOptions } from '../controls';
|
|
3
3
|
import { TemplateNames } from './templates';
|
|
4
4
|
/**
|
|
5
5
|
* Configuration options for constructing an updatable Notifications object, shared between all templates.
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* imports
|
|
8
8
|
*/
|
|
9
|
-
import { IndicatorColor } from '
|
|
10
|
-
import { NotificationFormData } from '
|
|
9
|
+
import { IndicatorColor } from '../indicator';
|
|
10
|
+
import { FormField, FormFieldWithRequiredLabel, NotificationFormData, NotificationFormDataWithRequiredLabel } from '../forms';
|
|
11
11
|
import { BaseNotificationOptions } from './BaseNotificationOptions';
|
|
12
12
|
import { ActionDeclaration } from '../main';
|
|
13
13
|
export declare type SectionAlignment = 'left' | 'center' | 'right';
|
|
@@ -270,7 +270,44 @@ export interface TemplateMarkdown extends Omit<BaseNotificationOptions<'markdown
|
|
|
270
270
|
* With the exception of links and code blocks, all basic syntax as documented [here](https://www.markdownguide.org/basic-syntax) is supported.
|
|
271
271
|
*/
|
|
272
272
|
body: string;
|
|
273
|
-
|
|
273
|
+
/**
|
|
274
|
+
* A collection of form fields or a form definition (Form<FormField>)
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* [
|
|
278
|
+
* {
|
|
279
|
+
* key: 'phone',
|
|
280
|
+
* type: 'string',
|
|
281
|
+
* label: 'Phone',
|
|
282
|
+
* helperText:
|
|
283
|
+
* 'Must be in the following formats 123-456-7890, 123 456 7890, (123) 456 7890 or 1234567890',
|
|
284
|
+
* widget: {
|
|
285
|
+
* type: 'Text'
|
|
286
|
+
* },
|
|
287
|
+
* validation: {
|
|
288
|
+
* required: {
|
|
289
|
+
* arg: true
|
|
290
|
+
* }
|
|
291
|
+
* }
|
|
292
|
+
* },
|
|
293
|
+
* {
|
|
294
|
+
* key: 'email',
|
|
295
|
+
* type: 'string',
|
|
296
|
+
* label: 'Email',
|
|
297
|
+
* helperText: 'We will use this email to send you the report after we crawl your website',
|
|
298
|
+
* widget: {
|
|
299
|
+
* type: 'Text'
|
|
300
|
+
* },
|
|
301
|
+
* validation: {
|
|
302
|
+
* required: {
|
|
303
|
+
* arg: true
|
|
304
|
+
* }
|
|
305
|
+
* }
|
|
306
|
+
* }
|
|
307
|
+
* ]
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
form?: NotificationFormData | Form<FormField> | null;
|
|
274
311
|
}
|
|
275
312
|
/**
|
|
276
313
|
* Simple template that can render a list of name-value pairs.
|
|
@@ -290,4 +327,88 @@ export interface TemplateCustom extends BaseNotificationOptions<'custom'> {
|
|
|
290
327
|
* Data associated with the custom notification template's presentation fragments.
|
|
291
328
|
*/
|
|
292
329
|
templateData: CustomTemplateData;
|
|
330
|
+
/**
|
|
331
|
+
* A collection of form fields or a form definition (Form<FormField>)
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* [
|
|
335
|
+
* {
|
|
336
|
+
* key: 'phone',
|
|
337
|
+
* type: 'string',
|
|
338
|
+
* label: 'Phone',
|
|
339
|
+
* helperText:
|
|
340
|
+
* 'Must be in the following formats 123-456-7890, 123 456 7890, (123) 456 7890 or 1234567890',
|
|
341
|
+
* widget: {
|
|
342
|
+
* type: 'Text'
|
|
343
|
+
* },
|
|
344
|
+
* validation: {
|
|
345
|
+
* required: {
|
|
346
|
+
* arg: true
|
|
347
|
+
* }
|
|
348
|
+
* }
|
|
349
|
+
* },
|
|
350
|
+
* {
|
|
351
|
+
* key: 'email',
|
|
352
|
+
* type: 'string',
|
|
353
|
+
* label: 'Email',
|
|
354
|
+
* helperText: 'We will use this email to send you the report after we crawl your website',
|
|
355
|
+
* widget: {
|
|
356
|
+
* type: 'Text'
|
|
357
|
+
* },
|
|
358
|
+
* validation: {
|
|
359
|
+
* required: {
|
|
360
|
+
* arg: true
|
|
361
|
+
* }
|
|
362
|
+
* }
|
|
363
|
+
* }
|
|
364
|
+
* ]
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
form?: NotificationFormDataWithRequiredLabel | Form<FormFieldWithRequiredLabel> | null;
|
|
368
|
+
}
|
|
369
|
+
export interface FormSettings {
|
|
370
|
+
/**
|
|
371
|
+
* Controls that display of (Required) or (Optional) labels next to form fields.
|
|
372
|
+
*/
|
|
373
|
+
displayFieldRequirementStatus?: boolean;
|
|
374
|
+
}
|
|
375
|
+
export interface Form<T extends FormField | FormFieldWithRequiredLabel> extends FormSettings {
|
|
376
|
+
/**
|
|
377
|
+
* A collection of form fields.
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* [
|
|
381
|
+
* {
|
|
382
|
+
* key: 'phone',
|
|
383
|
+
* type: 'string',
|
|
384
|
+
* label: 'Phone',
|
|
385
|
+
* helperText:
|
|
386
|
+
* 'Must be in the following formats 123-456-7890, 123 456 7890, (123) 456 7890 or 1234567890',
|
|
387
|
+
* widget: {
|
|
388
|
+
* type: 'Text'
|
|
389
|
+
* },
|
|
390
|
+
* validation: {
|
|
391
|
+
* required: {
|
|
392
|
+
* arg: true
|
|
393
|
+
* }
|
|
394
|
+
* }
|
|
395
|
+
* },
|
|
396
|
+
* {
|
|
397
|
+
* key: 'email',
|
|
398
|
+
* type: 'string',
|
|
399
|
+
* label: 'Email',
|
|
400
|
+
* helperText: 'We will use this email to send you the report after we crawl your website',
|
|
401
|
+
* widget: {
|
|
402
|
+
* type: 'Text'
|
|
403
|
+
* },
|
|
404
|
+
* validation: {
|
|
405
|
+
* required: {
|
|
406
|
+
* arg: true
|
|
407
|
+
* }
|
|
408
|
+
* }
|
|
409
|
+
* }
|
|
410
|
+
* ]
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
fields: ReadonlyArray<T>;
|
|
293
414
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CustomTemplateData } from '.';
|
|
2
|
-
import { NotificationFormData } from '
|
|
2
|
+
import { NotificationFormData } from '../forms';
|
|
3
3
|
import { BaseUpdatableNotificationOptions } from './BaseUpdatableNotificationOptions';
|
|
4
4
|
/**
|
|
5
5
|
* Default markdown template update.
|
|
@@ -28,5 +28,6 @@ export interface UpdatableNotificationTemplateCustom extends BaseUpdatableNotifi
|
|
|
28
28
|
* Data associated with the custom notification template's presentation fragments.
|
|
29
29
|
*/
|
|
30
30
|
templateData?: CustomTemplateData;
|
|
31
|
+
form?: NotificationFormData | null;
|
|
31
32
|
}
|
|
32
33
|
export declare type UpdatableNotificationOptions = UpdatableNotificationTemplateMarkdown | UpdatableNotificationTemplateList | UpdatableNotificationTemplateCustom;
|
|
@@ -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()}(this,(()=>{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))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(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 l(e,t,n,i){var r,o,s,l;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 u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){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=u.bind(i);return r.listener=n,i.wrapFn=r,r}function d(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 p(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 y(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 l=c.length,u=v(c,l);for(n=0;n<l;++n)i(u[n],this,t)}return!0},o.prototype.addListener=function(e,t){return l(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return l(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 d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,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}},17385:function(e,t,n){"use strict";var i=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.getEventRouter=t.eventEmitter=t.EventRouter=void 0;const r=n(17187);class o{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:n}=e,r=i(e,["type","target"]);let o;if(!n)throw new Error("Invalid event, no target specified");if("default"===n)o=this._defaultEmitter;else{if(!this._emitterProviders[n.type])throw new Error(`Invalid target, no provider registered for '${n.type}'`);o=this._emitterProviders[n.type](n.id)}const s=Object.assign({type:t},r),a=this._deserializers[t];a?o.emit(t,a(s)):o.emit(t,s)}}let s;t.EventRouter=o,t.eventEmitter=new r.EventEmitter,t.getEventRouter=function(){return s||(s=new o(t.eventEmitter)),s}},19659:(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"},73670:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getChannelClient=t.clearAwaitedChannelClient=t.initAwaitedChannelClient=void 0;const i=n(76598),r=n(53117),o=async({wait:e})=>{await r.Log.info("Connecting to Notifications...");const t=await fin.InterApplicationBus.Channel.connect(i.SERVICE_CHANNEL,{wait:e,payload:{version:"2.1.2"}});return await r.Log.info("Successfully connected to Notifications."),t};let s,a;t.initAwaitedChannelClient=()=>s?{channelClientPromise:s,isInit:!1}:(s=o({wait:!0}),s.catch((e=>(0,t.clearAwaitedChannelClient)())),{channelClientPromise:s,isInit:!0}),t.clearAwaitedChannelClient=()=>{s=null},t.getChannelClient=async()=>s||(async()=>{if(!a){try{a=await o({wait:!1})}catch(e){throw await r.Log.error('Could not find channel provider. Did you call "notifications.register()"?'),e}a.onDisconnection((()=>{a=null}))}return a})()},12052:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tryServiceDispatch=t.getServicePromise=t.launchSystemApp=t.connectToNotifications=void 0;const i=n(95881),r=n(76598),o=n(17385),s=n(73670);let a;const c=new i.DeferredPromise;let l=!1;async function u(){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 f(){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===r.SERVICE_IDENTITY.uuid&&t===r.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=(0,s.initAwaitedChannelClient)().channelClientPromise.then((t=>{window.clearTimeout(e);const n=(0,o.getEventRouter)();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"),(0,s.clearAwaitedChannelClient)(),l=!0,a=null,u(),setTimeout((()=>{console.log("Attempting to reconnect to Notifications service"),f()}),300)})),l?console.log("Reconnected to Notifications service"):console.log("Connected to Notifications service"),t}))}}return a}t.connectToNotifications=function(){"undefined"!=typeof fin&&"undefined"!=typeof window?(u(),f(),"loading"!==document.readyState?c.resolve():(window.addEventListener("DOMContentLoaded",(()=>{c.resolve()})),document.addEventListener("DOMContentLoaded",(()=>{c.resolve()})))):console.warn("Could not connect to notifications, `fin` is not defined")},t.launchSystemApp=u,t.getServicePromise=f,t.tryServiceDispatch=async function(e,t){return(await(0,s.getChannelClient)()).dispatch(e,t)}},490:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},97490:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldType=void 0,t.FieldType={string:"string",number:"number",boolean:"boolean"}},8910: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(97490),t),r(n(7713),t)},7713:(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)},5221:(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"},76598:(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.SHOW_NOTIFICATION_CENTER="show-notification-center",n.HIDE_NOTIFICATION_CENTER="hide-notification-center",n.REGISTER_PLATFORM="register-notifications-platform",n.DEREGISTER_PLATFORM="deregister-notifications-platform"},53117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Log=void 0;class n{static async error(e){try{const t=n.getPrefixedMessage(e);console.error(t),await fin.System.log("error",t)}catch(e){n.handleError(e,"Failed to log error")}}static async warn(e){try{const t=n.getPrefixedMessage(e);console.warn(t),await fin.System.log("warning",t)}catch(e){n.handleError(e,"Failed to log warning")}}static async info(e){try{const t=n.getPrefixedMessage(e);console.info(t),await fin.System.log("info",t)}catch(e){n.handleError(e,"Failed to log info")}}static getPrefixedMessage(e){return`${n.LOG_PREFIX} ${e}`}static handleError(e,t){e instanceof Error?console.error(`${t} - ${e.name}: ${e.message}`):console.error(`${t} - ${JSON.stringify(e)}`)}}t.Log=n,n.LOG_PREFIX="[openfin-notifications]"},7345: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=t.actions=void 0;const c=n(19659),l=n(12052),u=n(76598),f=n(17385),d=o(n(30207));t.provider=d;const p=n(72475),v=n(5221);Object.defineProperty(t,"NotificationIndicator",{enumerable:!0,get:function(){return v.NotificationIndicator}}),Object.defineProperty(t,"NotificationIndicatorType",{enumerable:!0,get:function(){return v.IndicatorType}}),Object.defineProperty(t,"IndicatorColor",{enumerable:!0,get:function(){return v.IndicatorColor}});const y=n(12908);Object.defineProperty(t,"NotificationOptions",{enumerable:!0,get:function(){return y.NotificationOptions}});const m=o(n(19659));t.actions=m,s(n(19659),t),s(n(490),t),s(n(55063),t),s(n(8910),t),s(n(87221),t),s(n(49757),t),t.VERSION="2.1.2";const h=(0,f.getEventRouter)();function g(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})})}h.registerDeserializer("notification-created",(e=>g(e))),h.registerDeserializer("notification-toast-dismissed",(e=>g(e))),h.registerDeserializer("notification-closed",(e=>g(e))),h.registerDeserializer("notification-action",(e=>{var t;const n=g(e),{controlSource:i,controlIndex:r}=n,o=a(n,["controlSource","controlIndex"]);return e.trigger===c.ActionTrigger.CONTROL?Object.assign(Object.assign({},o),{control:null===(t=e.notification[i])||void 0===t?void 0:t[r]}):o})),h.registerDeserializer("notifications-count-changed",(e=>e)),h.registerDeserializer("notification-reminder-created",(e=>{const t=g(e),{reminderDate:n}=t,i=a(t,["reminderDate"]);return Object.assign(Object.assign({},i),{reminderDate:new Date(n)})})),h.registerDeserializer("notification-reminder-removed",(e=>g(e))),t.addEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t);const n=f.eventEmitter.listenerCount(e);f.eventEmitter.addListener(e,t),0===n&&1===f.eventEmitter.listenerCount(e)&&await(0,l.tryServiceDispatch)(u.APITopic.ADD_EVENT_LISTENER,e)},t.removeEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t),1===f.eventEmitter.listenerCount(e)&&f.eventEmitter.listeners(e)[0]===t&&await(0,l.tryServiceDispatch)(u.APITopic.REMOVE_EVENT_LISTENER,e),f.eventEmitter.removeListener(e,t)},t.create=async function(e,t){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');if(t&&t.reminderDate){if(!1===e.allowReminder)throw new Error('You must not specify a reminder date for a notification with "allowReminder" option set to false.');if(!(t.reminderDate instanceof Date))throw new Error('Invalid argument passed to reminder Options: "date" must a valid Date object');if(e.expires&&e.expires.getTime()<t.reminderDate.getTime())throw new Error("Expiration date must not be earlier than reminder date.")}void 0!==e.category&&null!==e.category||(e.category="default");const n=await(0,l.tryServiceDispatch)(u.APITopic.CREATE_NOTIFICATION,Object.assign(Object.assign({},e),{date:e.date&&e.date.valueOf(),expires:e.expires&&e.expires.valueOf(),reminder:(null==t?void 0:t.reminderDate)&&t.reminderDate.valueOf()}));return Object.assign(Object.assign({},n),{date:new Date(n.date),expires:null!==n.expires?new Date(n.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,l.tryServiceDispatch)(u.APITopic.UPDATE_NOTIFICATION,Object.assign({},e));return Object.assign({},t)},t.clear=async function(e){return(0,l.tryServiceDispatch)(u.APITopic.CLEAR_NOTIFICATION,{id:e})},t.getAll=async function(){return(await(0,l.tryServiceDispatch)(u.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,l.tryServiceDispatch)(u.APITopic.CLEAR_APP_NOTIFICATIONS,void 0)},t.toggleNotificationCenter=async function(){return(0,l.tryServiceDispatch)(u.APITopic.TOGGLE_NOTIFICATION_CENTER,void 0)},t.show=async function(e){return(0,l.tryServiceDispatch)(u.APITopic.SHOW_NOTIFICATION_CENTER,e)},t.hide=async function(){return(0,l.tryServiceDispatch)(u.APITopic.HIDE_NOTIFICATION_CENTER,void 0)},t.getNotificationsCount=async function(){return(0,l.tryServiceDispatch)(u.APITopic.GET_NOTIFICATIONS_COUNT,void 0)}},30207: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(12052),a=n(76598);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}},36066:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.register=t.ChannelClientHandlers=void 0;const i=n(76598),r=n(17385),o=n(53117),s=n(73670),a=n(30207);class c{}t.ChannelClientHandlers=c,c.handleDefaultAction=()=>!1,c.handleEventAction=e=>{(0,r.getEventRouter)().dispatchEvent(e)},c.handleWarnAction=async e=>{await o.Log.warn(e)},c.handleDisconnection=async()=>{(0,s.getChannelClient)()&&(await o.Log.warn("Disconnected from Notifications. Reconnecting..."),(0,s.clearAwaitedChannelClient)(),await f(),await d())};let l=null;t.register=async()=>{if(l)return l;try{return l=u(),await l}finally{l=null}};const u=async()=>(await f(),await d(),{clientAPIVersion:"2.1.2",notificationsVersion:(await(0,a.getStatus)()).version||"unknown"}),f=async()=>{try{window.navigator.userAgent.toLowerCase().includes("windows")?(await o.Log.info("Launching Notifications via fin.System.launchManifest..."),await fin.System.launchManifest("fins://system-apps/notification-center",{noUi:!0})):(await o.Log.info("Launching Notifications via fin.System.openUrlWithBrowser..."),await fin.System.openUrlWithBrowser("fins://system-apps/notification-center"))}catch(e){throw e instanceof Error?await o.Log.error(`Failed to launch Notifications - ${e.name}: ${e.message}`):await o.Log.error(`Failed to launch Notifications - ${JSON.stringify(e)}`),e}},d=async()=>{try{const{channelClientPromise:e,isInit:t}=(0,s.initAwaitedChannelClient)(),n=await e;t&&(n.setDefaultAction(c.handleDefaultAction),n.register("event",c.handleEventAction),n.register("WARN",c.handleWarnAction),n.onDisconnection(c.handleDisconnection),fin.Window.wrapSync(i.SERVICE_IDENTITY).once("closed",c.handleDisconnection))}catch(e){throw e instanceof Error?await o.Log.error(`Failed to connect to Notifications - ${e.name}: ${e.message}`):await o.Log.error(`Failed to connect to Notifications - ${JSON.stringify(e)}`),e}}},55063:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},87221:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},30600:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},23371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},49757: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(30600),t),r(n(23371),t),r(n(12908),t),r(n(48877),t)},12908:(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",actionableText:"actionableText"},t.TemplateFragmentNames=Object.assign(Object.assign({},t.ContainerTemplateFragmentNames),t.PresentationTemplateFragmentNames)},48877:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},72475:(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||"notification-reminder-created"===e||"notification-reminder-removed"===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},16056: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}),t.NotificationsRegistration=t.register=void 0,r(n(7345),t);var o=n(36066);Object.defineProperty(t,"register",{enumerable:!0,get:function(){return o.register}}),Object.defineProperty(t,"NotificationsRegistration",{enumerable:!0,get:function(){return o.NotificationsRegistration}})}},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}(16056);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()}(this,(()=>{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))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(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 a=10;function s(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 l(e,t,n,i){var r,o,a,l;if(s(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),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=c(e))>0&&a.length>r&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){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=u.bind(i);return r.listener=n,i.wrapFn=r,r}function d(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 p(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 y(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 a},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+".");a=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 a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var l=c.length,u=v(c,l);for(n=0;n<l;++n)i(u[n],this,t)}return!0},o.prototype.addListener=function(e,t){return l(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return l(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,f(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,f(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,i,r,o,a;if(s(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){a=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,a||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 d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,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 a(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)})),s(r.promise)}function s(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 s(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():a(e,t,n)},t.untilSignal=a,t.allowReject=s},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]),a=Number(i[r]);if(o>a)return 1;if(a>o)return-1;if(!isNaN(o)&&isNaN(a))return 1;if(isNaN(o)&&!isNaN(a))return-1}return 0}},17385:function(e,t,n){"use strict";var i=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.getEventRouter=t.eventEmitter=t.EventRouter=void 0;const r=n(17187),o=n(12052),a=n(76598);class s{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:n}=e,r=i(e,["type","target"]);let s;if(!n)throw new Error("Invalid event, no target specified");if("default"===n)s=this._defaultEmitter;else{if(!this._emitterProviders[n.type])throw new Error(`Invalid target, no provider registered for '${n.type}'`);s=this._emitterProviders[n.type](n.id)}const c=Object.assign({type:t},r),l=this._deserializers[t];l?s.emit(t,l(c)):"notification-form-submitted"===t?function(e,t){let n=!1;e.preventDefault=()=>n=!0,t.emit("notification-form-submitted",e),n||(0,o.tryServiceDispatch)(a.APITopic.SET_FORM_STATUS_OPTIONS,{formStatus:"submitted",_notificationId:e.notification.id})}(c,s):s.emit(t,c)}}let c;t.EventRouter=s,t.eventEmitter=new r.EventEmitter,t.getEventRouter=function(){return c||(c=new s(t.eventEmitter)),c}},19659:(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"},73670:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getChannelClient=t.clearAwaitedChannelClient=t.initAwaitedChannelClient=void 0;const i=n(76598),r=n(53117),o=async({wait:e})=>{await r.Log.info("Connecting to Notifications...");const t=await fin.InterApplicationBus.Channel.connect(i.SERVICE_CHANNEL,{wait:e,payload:{version:"2.1.3-alpha-3131"}});return await r.Log.info("Successfully connected to Notifications."),t};let a,s;t.initAwaitedChannelClient=()=>a?{channelClientPromise:a,isInit:!1}:(a=o({wait:!0}),a.catch((e=>(0,t.clearAwaitedChannelClient)())),{channelClientPromise:a,isInit:!0}),t.clearAwaitedChannelClient=()=>{a=null},t.getChannelClient=async()=>a||(async()=>{if(!s){try{s=await o({wait:!1})}catch(e){throw await r.Log.error('Could not find channel provider. Did you call "notifications.register()"?'),e}s.onDisconnection((()=>{s=null}))}return s})()},12052:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tryServiceDispatch=t.getServicePromise=t.launchSystemApp=t.connectToNotifications=void 0;const i=n(95881),r=n(76598),o=n(17385),a=n(73670);let s;const c=new i.DeferredPromise;let l=!1;async function u(){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 f(){var e;if(await c.promise,!s){if("undefined"==typeof fin){const e="fin is not defined. The openfin-notifications module is only intended for use in an OpenFin application.";return s=Promise.reject(new Error(e)),s}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===r.SERVICE_IDENTITY.uuid&&t===r.SERVICE_IDENTITY.name)s=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);s=(0,a.initAwaitedChannelClient)().channelClientPromise.then((t=>{window.clearTimeout(e);const n=(0,o.getEventRouter)();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"),(0,a.clearAwaitedChannelClient)(),l=!0,s=null,u(),setTimeout((()=>{console.log("Attempting to reconnect to Notifications service"),f()}),300)})),l?console.log("Reconnected to Notifications service"):console.log("Connected to Notifications service"),t}))}}return s}t.connectToNotifications=function(){"undefined"!=typeof fin&&"undefined"!=typeof window?(u(),f(),"loading"!==document.readyState?c.resolve():(window.addEventListener("DOMContentLoaded",(()=>{c.resolve()})),document.addEventListener("DOMContentLoaded",(()=>{c.resolve()})))):console.warn("Could not connect to notifications, `fin` is not defined")},t.launchSystemApp=u,t.getServicePromise=f,t.tryServiceDispatch=async function(e,t){return(await(0,a.getChannelClient)()).dispatch(e,t)}},490:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},97490:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldType=void 0,t.FieldType={string:"string",number:"number",boolean:"boolean",date:"date",checkboxGroup:"checkboxGroup",radioGroup:"radioGroup",time:"time"}},8910: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(97490),t),r(n(7713),t)},7713:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetType=t.TimeWidgetType=t.DateWidgetType=t.RadioGroupWidgetType=t.CheckboxGroupWidgetType=t.BooleanWidgetType=t.NumberWidgetType=t.StringWidgetType=void 0,t.StringWidgetType={Text:"Text",Dropdown:"Dropdown"},t.NumberWidgetType={Number:"Number"},t.BooleanWidgetType={Toggle:"Toggle",Checkbox:"Checkbox"},t.CheckboxGroupWidgetType={CheckboxGroup:"CheckboxGroup"},t.RadioGroupWidgetType={RadioGroup:"RadioGroup"},t.DateWidgetType={Date:"Date"},t.TimeWidgetType={Time:"Time"},t.WidgetType=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t.StringWidgetType),t.NumberWidgetType),t.BooleanWidgetType),t.CheckboxGroupWidgetType),t.RadioGroupWidgetType),t.DateWidgetType),t.TimeWidgetType)},5221:(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",n.ORANGE="orange",n.MAGENTA="magenta",n.TEAL="teal"},76598:(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.SHOW_NOTIFICATION_CENTER="show-notification-center",n.HIDE_NOTIFICATION_CENTER="hide-notification-center",n.REGISTER_PLATFORM="register-notifications-platform",n.DEREGISTER_PLATFORM="deregister-notifications-platform",n.SET_FORM_STATUS_OPTIONS="set-form-status-options",n.SET_FORM_VALIDATION_ERRORS="set-form-validation-errors"},53117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Log=void 0;class n{static async error(e){try{const t=n.getPrefixedMessage(e);console.error(t),await fin.System.log("error",t)}catch(e){n.handleError(e,"Failed to log error")}}static async warn(e){try{const t=n.getPrefixedMessage(e);console.warn(t),await fin.System.log("warning",t)}catch(e){n.handleError(e,"Failed to log warning")}}static async info(e){try{const t=n.getPrefixedMessage(e);console.info(t),await fin.System.log("info",t)}catch(e){n.handleError(e,"Failed to log info")}}static getPrefixedMessage(e){return`${n.LOG_PREFIX} ${e}`}static handleError(e,t){e instanceof Error?console.error(`${t} - ${e.name}: ${e.message}`):console.error(`${t} - ${JSON.stringify(e)}`)}}t.Log=n,n.LOG_PREFIX="[openfin-notifications]"},7345: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},a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)},s=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.NotificationIndicatorWithCustomColor=t.NotificationIndicator=t.NotificationOptions=t.provider=t.actions=void 0;const c=n(19659),l=n(12052),u=n(76598),f=n(17385),d=o(n(30207));t.provider=d;const p=n(72475),v=n(5221);Object.defineProperty(t,"NotificationIndicator",{enumerable:!0,get:function(){return v.NotificationIndicator}}),Object.defineProperty(t,"NotificationIndicatorWithCustomColor",{enumerable:!0,get:function(){return v.NotificationIndicatorWithCustomColor}}),Object.defineProperty(t,"NotificationIndicatorType",{enumerable:!0,get:function(){return v.IndicatorType}}),Object.defineProperty(t,"IndicatorColor",{enumerable:!0,get:function(){return v.IndicatorColor}});const y=n(12908);Object.defineProperty(t,"NotificationOptions",{enumerable:!0,get:function(){return y.NotificationOptions}});const m=o(n(19659));t.actions=m,a(n(19659),t),a(n(490),t),a(n(55063),t),a(n(8910),t),a(n(87221),t),a(n(49757),t),t.VERSION="2.1.3-alpha-3131";const g=(0,f.getEventRouter)();function h(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})})}g.registerDeserializer("notification-created",(e=>h(e))),g.registerDeserializer("notification-toast-dismissed",(e=>h(e))),g.registerDeserializer("notification-closed",(e=>h(e))),g.registerDeserializer("notification-action",(e=>{var t;const n=h(e),{controlSource:i,controlIndex:r}=n,o=s(n,["controlSource","controlIndex"]);return e.trigger===c.ActionTrigger.CONTROL?Object.assign(Object.assign({},o),{control:null===(t=e.notification[i])||void 0===t?void 0:t[r]}):o})),g.registerDeserializer("notifications-count-changed",(e=>e)),g.registerDeserializer("notification-reminder-created",(e=>{const t=h(e),{reminderDate:n}=t,i=s(t,["reminderDate"]);return Object.assign(Object.assign({},i),{reminderDate:new Date(n)})})),g.registerDeserializer("notification-reminder-removed",(e=>h(e))),t.addEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t);const n=f.eventEmitter.listenerCount(e);"notification-form-submitted"===e&&(t=function(e){return t=>{const n=t.notification.id;t.setFormStatus=e=>(0,l.tryServiceDispatch)(u.APITopic.SET_FORM_STATUS_OPTIONS,Object.assign(Object.assign({},e),{_notificationId:n})),e(t)}}(t)),"notification-form-values-changed"===e&&(t=function(e){return t=>{t.setErrors=e=>(0,l.tryServiceDispatch)(u.APITopic.SET_FORM_VALIDATION_ERRORS,{errors:e,notificationId:t.notification.id}),e(t)}}(t)),f.eventEmitter.addListener(e,t),0===n&&1===f.eventEmitter.listenerCount(e)&&await(0,l.tryServiceDispatch)(u.APITopic.ADD_EVENT_LISTENER,e)},t.removeEventListener=async function(e,t){(0,p.validateEnvironment)(),e=(0,p.sanitizeEventType)(e),t=(0,p.sanitizeFunction)(t),1===f.eventEmitter.listenerCount(e)&&f.eventEmitter.listeners(e)[0]===t&&await(0,l.tryServiceDispatch)(u.APITopic.REMOVE_EVENT_LISTENER,e),f.eventEmitter.removeListener(e,t)},t.create=async function(e,t){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');if(t&&t.reminderDate){if(!1===e.allowReminder)throw new Error('You must not specify a reminder date for a notification with "allowReminder" option set to false.');if(!(t.reminderDate instanceof Date))throw new Error('Invalid argument passed to reminder Options: "date" must a valid Date object');if(e.expires&&e.expires.getTime()<t.reminderDate.getTime())throw new Error("Expiration date must not be earlier than reminder date.")}void 0!==e.category&&null!==e.category||(e.category="default");const n=await(0,l.tryServiceDispatch)(u.APITopic.CREATE_NOTIFICATION,Object.assign(Object.assign({},e),{date:e.date&&e.date.valueOf(),expires:e.expires&&e.expires.valueOf(),reminder:(null==t?void 0:t.reminderDate)&&t.reminderDate.valueOf()}));return Object.assign(Object.assign({},n),{date:new Date(n.date),expires:null!==n.expires?new Date(n.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,l.tryServiceDispatch)(u.APITopic.UPDATE_NOTIFICATION,Object.assign({},e));return Object.assign({},t)},t.clear=async function(e){return(0,l.tryServiceDispatch)(u.APITopic.CLEAR_NOTIFICATION,{id:e})},t.getAll=async function(){return(await(0,l.tryServiceDispatch)(u.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,l.tryServiceDispatch)(u.APITopic.CLEAR_APP_NOTIFICATIONS,void 0)},t.toggleNotificationCenter=async function(){return(0,l.tryServiceDispatch)(u.APITopic.TOGGLE_NOTIFICATION_CENTER,void 0)},t.show=async function(e){return(0,l.tryServiceDispatch)(u.APITopic.SHOW_NOTIFICATION_CENTER,e)},t.hide=async function(){return(0,l.tryServiceDispatch)(u.APITopic.HIDE_NOTIFICATION_CENTER,void 0)},t.getNotificationsCount=async function(){return(0,l.tryServiceDispatch)(u.APITopic.GET_NOTIFICATIONS_COUNT,void 0)}},30207: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),a=n(12052),s=n(76598);function c(){return(0,o.withStrictTimeout)(500,(0,a.tryServiceDispatch)(s.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}},36066:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.register=t.ChannelClientHandlers=void 0;const i=n(76598),r=n(17385),o=n(53117),a=n(73670),s=n(30207);class c{}t.ChannelClientHandlers=c,c.handleDefaultAction=()=>!1,c.handleEventAction=e=>{(0,r.getEventRouter)().dispatchEvent(e)},c.handleWarnAction=async e=>{await o.Log.warn(e)},c.handleDisconnection=async()=>{(0,a.getChannelClient)()&&(await o.Log.warn("Disconnected from Notifications. Reconnecting..."),(0,a.clearAwaitedChannelClient)(),await f(),await d())};let l=null;t.register=async()=>{if(l)return l;try{return l=u(),await l}finally{l=null}};const u=async()=>(await f(),await d(),{clientAPIVersion:"2.1.3-alpha-3131",notificationsVersion:(await(0,s.getStatus)()).version||"unknown"}),f=async()=>{try{window.navigator.userAgent.toLowerCase().includes("windows")?(await o.Log.info("Launching Notifications via fin.System.launchManifest..."),await fin.System.launchManifest("fins://system-apps/notification-center",{noUi:!0})):(await o.Log.info("Launching Notifications via fin.System.openUrlWithBrowser..."),await fin.System.openUrlWithBrowser("fins://system-apps/notification-center"))}catch(e){throw e instanceof Error?await o.Log.error(`Failed to launch Notifications - ${e.name}: ${e.message}`):await o.Log.error(`Failed to launch Notifications - ${JSON.stringify(e)}`),e}},d=async()=>{try{const{channelClientPromise:e,isInit:t}=(0,a.initAwaitedChannelClient)(),n=await e;t&&(n.setDefaultAction(c.handleDefaultAction),n.register("event",c.handleEventAction),n.register("WARN",c.handleWarnAction),n.onDisconnection(c.handleDisconnection),fin.Window.wrapSync(i.SERVICE_IDENTITY).once("closed",c.handleDisconnection))}catch(e){throw e instanceof Error?await o.Log.error(`Failed to connect to Notifications - ${e.name}: ${e.message}`):await o.Log.error(`Failed to connect to Notifications - ${JSON.stringify(e)}`),e}}},55063:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},87221:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},30600:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},23371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},49757: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(30600),t),r(n(23371),t),r(n(12908),t),r(n(48877),t)},12908:(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",actionableText:"actionableText"},t.TemplateFragmentNames=Object.assign(Object.assign({},t.ContainerTemplateFragmentNames),t.PresentationTemplateFragmentNames)},48877:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},72475:(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||"notification-reminder-created"===e||"notification-reminder-removed"===e||"notification-form-values-changed"===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},16056: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}),t.NotificationsRegistration=t.register=void 0,r(n(7345),t);var o=n(36066);Object.defineProperty(t,"register",{enumerable:!0,get:function(){return o.register}}),Object.defineProperty(t,"NotificationsRegistration",{enumerable:!0,get:function(){return o.NotificationsRegistration}})}},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}(16056);var e,t}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openfin-notifications",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3-alpha-3131",
|
|
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",
|
|
@@ -21,26 +21,6 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"dist/client/*"
|
|
23
23
|
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"branch-protect": "node scripts/branch-protect.js",
|
|
26
|
-
"build": "webpack build --mode production",
|
|
27
|
-
"build:dev": "webpack build --mode development",
|
|
28
|
-
"clean": "rimraf gen dist",
|
|
29
|
-
"docs": "typedoc --tsconfig \"./src/client/tsconfig.json\"",
|
|
30
|
-
"posttest": "npm run check",
|
|
31
|
-
"typecheck": "npx tsc",
|
|
32
|
-
"prepack": "tsc -p src/client/tsconfig.types.json",
|
|
33
|
-
"lint": "npm run lint:typescript && npm run lint:styles",
|
|
34
|
-
"lint:typescript": "eslint \"./src/**/*.{ts,tsx}\"",
|
|
35
|
-
"lint:styles": "stylelint \"./src/**/*.tsx\"",
|
|
36
|
-
"fix": "npm run lint:typescript -- --fix && npm run lint:styles -- --fix",
|
|
37
|
-
"test": "npm run test:unit && npm run test:int",
|
|
38
|
-
"test:int": "node scripts/run-integration-tests.js",
|
|
39
|
-
"test:unit": "jest",
|
|
40
|
-
"zip": "node scripts/create-provider-zip.js",
|
|
41
|
-
"start": "webpack serve --mode development",
|
|
42
|
-
"start:prod": "webpack serve --mode production"
|
|
43
|
-
},
|
|
44
24
|
"author": "Openfin",
|
|
45
25
|
"license": "SEE LICENSE IN LICENSE.MD",
|
|
46
26
|
"homepage": "https://developers.openfin.co/docs/notifications-api",
|
|
@@ -48,156 +28,8 @@
|
|
|
48
28
|
"@openfin/core": "33.77.11"
|
|
49
29
|
},
|
|
50
30
|
"dependencies": {
|
|
51
|
-
"@openfin/predux": "^1.0.0-alpha.1",
|
|
52
|
-
"acorn": "^8.8.1",
|
|
53
|
-
"ajv": "^8.11.0",
|
|
54
|
-
"date-fns": "^2.29.2",
|
|
55
|
-
"date-fns-tz": "^1.3.7",
|
|
56
|
-
"dexie": "^3.2.2",
|
|
57
|
-
"formik": "^2.2.5",
|
|
58
|
-
"framer-motion": "^4.1.5",
|
|
59
|
-
"fuse.js": "^6.4.6",
|
|
60
|
-
"history": "^4.10.1",
|
|
61
|
-
"inversify": "^5.0.1",
|
|
62
|
-
"lodash": "^4.17.21",
|
|
63
|
-
"markdown-it": "^13.0.1",
|
|
64
|
-
"meow": "^11.0.0",
|
|
65
|
-
"openfin-adapter": "^32.76.10",
|
|
66
31
|
"openfin-service-async": "^1.0.1",
|
|
67
32
|
"openfin-service-signal": "^1.0.0",
|
|
68
|
-
"
|
|
69
|
-
"react-dom": "^17.0.2",
|
|
70
|
-
"react-redux": "^7.0.2",
|
|
71
|
-
"react-router-dom": "^5.1.2",
|
|
72
|
-
"react-transition-group": "^4.2.2",
|
|
73
|
-
"redux": "^4.0.1",
|
|
74
|
-
"reflect-metadata": "^0.1.13",
|
|
75
|
-
"reselect": "^4.0.0",
|
|
76
|
-
"semver-compare": "^1.0.0",
|
|
77
|
-
"styled-components": "4.4.1",
|
|
78
|
-
"yup": "^0.32.9"
|
|
79
|
-
},
|
|
80
|
-
"devDependencies": {
|
|
81
|
-
"@actions/core": "^1.10.0",
|
|
82
|
-
"@openfin/ui-library": "^0.21.0",
|
|
83
|
-
"@testing-library/jest-dom": "^5.11.5",
|
|
84
|
-
"@testing-library/react": "^11.1.0",
|
|
85
|
-
"@types/jest": "^27.4.1",
|
|
86
|
-
"@types/jsdom": "^11.0.4",
|
|
87
|
-
"@types/lodash": "^4.14.168",
|
|
88
|
-
"@types/markdown-it": "^12.2.3",
|
|
89
|
-
"@types/mkdirp": "^0.5.2",
|
|
90
|
-
"@types/node": "^9.4.6",
|
|
91
|
-
"@types/node-fetch": "^2.6.2",
|
|
92
|
-
"@types/puppeteer-core": "^5.4.0",
|
|
93
|
-
"@types/react": "^17.0.11",
|
|
94
|
-
"@types/react-dom": "^17.0.7",
|
|
95
|
-
"@types/react-redux": "^7.0.8",
|
|
96
|
-
"@types/react-router-dom": "^5.1.3",
|
|
97
|
-
"@types/react-transition-group": "^4.2.4",
|
|
98
|
-
"@types/rimraf": "^3.0.2",
|
|
99
|
-
"@types/semver-compare": "^1.0.0",
|
|
100
|
-
"@types/styled-components": "^5.1.7",
|
|
101
|
-
"@types/testing-library__jest-dom": "^5.9.5",
|
|
102
|
-
"@types/yup": "^0.29.10",
|
|
103
|
-
"@typescript-eslint/eslint-plugin": "^5.19.0",
|
|
104
|
-
"@typescript-eslint/parser": "^5.32.0",
|
|
105
|
-
"archiver": "^5.3.0",
|
|
106
|
-
"babel-preset-const-enum": "^1.0.0",
|
|
107
|
-
"copy-webpack-plugin": "^10.2.4",
|
|
108
|
-
"dotenv": "^16.0.0",
|
|
109
|
-
"dotenv-defaults": "^5.0.0",
|
|
110
|
-
"dotenv-expand": "^8.0.3",
|
|
111
|
-
"eslint": "^7.25.0",
|
|
112
|
-
"eslint-plugin-jest": "^24.3.5",
|
|
113
|
-
"eslint-plugin-react": "^7.29.4",
|
|
114
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
115
|
-
"express": "4.18.1",
|
|
116
|
-
"fake-indexeddb": "^2.1.1",
|
|
117
|
-
"fork-ts-checker-webpack-plugin": "7.2.3",
|
|
118
|
-
"jest": "^27.5.1",
|
|
119
|
-
"jest-cli": "^27.5.1",
|
|
120
|
-
"jest-dom": "^4.0.0",
|
|
121
|
-
"jsdom": "^15.1.1",
|
|
122
|
-
"mkdirp": "^0.5.1",
|
|
123
|
-
"node-fetch": "^2.6.0",
|
|
124
|
-
"prettier": "^2.2.1",
|
|
125
|
-
"puppeteer-core": "^19.0.0",
|
|
126
|
-
"rimraf": "^3.0.2",
|
|
127
|
-
"stylelint": "^13.13.1",
|
|
128
|
-
"stylelint-config-recommended": "^4.0.0",
|
|
129
|
-
"stylelint-config-styled-components": "^0.1.1",
|
|
130
|
-
"stylelint-processor-styled-components": "^1.10.0",
|
|
131
|
-
"ts-jest": "^27.1.4",
|
|
132
|
-
"ts-loader": "^9.2.8",
|
|
133
|
-
"ts-node": "^9.0.0",
|
|
134
|
-
"typedoc": "^0.23.19",
|
|
135
|
-
"typescript": "^4.8.4",
|
|
136
|
-
"webpack": "^5.72.0",
|
|
137
|
-
"webpack-cli": "^4.9.2",
|
|
138
|
-
"webpack-dev-server": "^4.11.1",
|
|
139
|
-
"workbox-webpack-plugin": "^6.4.2"
|
|
140
|
-
},
|
|
141
|
-
"stylelint": {
|
|
142
|
-
"processors": [
|
|
143
|
-
"stylelint-processor-styled-components"
|
|
144
|
-
],
|
|
145
|
-
"extends": [
|
|
146
|
-
"stylelint-config-recommended",
|
|
147
|
-
"stylelint-config-styled-components"
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
"prettier": {
|
|
151
|
-
"endOfLine": "lf",
|
|
152
|
-
"semi": true,
|
|
153
|
-
"useTabs": false,
|
|
154
|
-
"singleQuote": true,
|
|
155
|
-
"tabWidth": 2,
|
|
156
|
-
"trailingComma": "es5",
|
|
157
|
-
"arrowParens": "always",
|
|
158
|
-
"printWidth": 100
|
|
159
|
-
},
|
|
160
|
-
"jest": {
|
|
161
|
-
"preset": "ts-jest",
|
|
162
|
-
"rootDir": "./",
|
|
163
|
-
"verbose": true,
|
|
164
|
-
"testURL": "http://localhost/",
|
|
165
|
-
"testEnvironment": "jsdom",
|
|
166
|
-
"globals": {
|
|
167
|
-
"ts-jest": {
|
|
168
|
-
"tsconfig": "<rootDir>/tsconfig.json"
|
|
169
|
-
},
|
|
170
|
-
"PACKAGE_VERSION": "0.0.0"
|
|
171
|
-
},
|
|
172
|
-
"transform": {
|
|
173
|
-
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest"
|
|
174
|
-
},
|
|
175
|
-
"testRunner": "jest-circus/runner",
|
|
176
|
-
"testRegex": "\\.spec\\.tsx?$",
|
|
177
|
-
"modulePaths": [
|
|
178
|
-
"<rootDir>/node_modules"
|
|
179
|
-
],
|
|
180
|
-
"roots": [
|
|
181
|
-
"<rootDir>"
|
|
182
|
-
],
|
|
183
|
-
"moduleFileExtensions": [
|
|
184
|
-
"ts",
|
|
185
|
-
"tsx",
|
|
186
|
-
"js",
|
|
187
|
-
"jsx",
|
|
188
|
-
"json",
|
|
189
|
-
"node"
|
|
190
|
-
],
|
|
191
|
-
"moduleNameMapper": {
|
|
192
|
-
"\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/testUtils/unit/assets.ts",
|
|
193
|
-
"\\.(scss|css)$": "<rootDir>/src/testUtils/unit/objectAsset.ts",
|
|
194
|
-
"^@testUtils/(.*)$": "<rootDir>/src/testUtils/$1",
|
|
195
|
-
"^@client/(.*)$": "<rootDir>/src/client/$1",
|
|
196
|
-
"^@studio/(.*)$": "<rootDir>/src/studio/$1",
|
|
197
|
-
"^@provider/(.*)$": "<rootDir>/src/provider/$1"
|
|
198
|
-
},
|
|
199
|
-
"reporters": [
|
|
200
|
-
"default"
|
|
201
|
-
]
|
|
33
|
+
"semver-compare": "^1.0.0"
|
|
202
34
|
}
|
|
203
|
-
}
|
|
35
|
+
}
|