@trycourier/courier-ui-toast 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/components/__tests__/courier-toast-item.test.d.ts +1 -0
- package/dist/components/__tests__/courier-toast.test.d.ts +1 -0
- package/dist/components/courier-toast-item.d.ts +95 -0
- package/dist/components/courier-toast.d.ts +167 -0
- package/dist/datastore/__tests__/toast-datastore.test.d.ts +1 -0
- package/dist/datastore/toast-datastore-events.d.ts +11 -0
- package/dist/datastore/toast-datastore-listener.d.ts +12 -0
- package/dist/datastore/toast-datastore.d.ts +81 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1080 -0
- package/dist/index.mjs.map +1 -0
- package/dist/jest.setup.d.ts +0 -0
- package/dist/types/courier-toast-theme-manager.d.ts +36 -0
- package/dist/types/courier-toast-theme.d.ts +42 -0
- package/dist/types/toast.d.ts +45 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @trycourier/courier-ui-toast
|
|
2
|
+
|
|
3
|
+
Toast notification components for the Courier web UI.
|
|
4
|
+
|
|
5
|
+
**Using React?** Use the [@trycourier/courier-react](../courier-react/) package.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @trycourier/courier-ui-toast
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Check out the [Courier documentation](https://www.courier.com/docs/sdk-libraries/courier-ui-toast-web) for a full guide to Courier Toast Web Components.
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### `courier-toast`
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<body>
|
|
23
|
+
|
|
24
|
+
<courier-toast id="toast"></courier-toast>
|
|
25
|
+
|
|
26
|
+
<script type="module">
|
|
27
|
+
import { Courier } from '@trycourier/courier-ui-toast';
|
|
28
|
+
|
|
29
|
+
// Generate a JWT for your user (do this on your backend server)
|
|
30
|
+
const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Replace with actual JWT
|
|
31
|
+
|
|
32
|
+
// Authenticate the user
|
|
33
|
+
Courier.shared.signIn({
|
|
34
|
+
userId: $YOUR_USER_ID,
|
|
35
|
+
jwt: jwt
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
</body>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Share feedback with Courier
|
|
43
|
+
|
|
44
|
+
Have an idea or feedback about our SDKs? Let us know!
|
|
45
|
+
|
|
46
|
+
Open an issue: [Courier Web Issues](https://github.com/trycourier/courier-web/issues)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { CourierBaseElement } from '@trycourier/courier-ui-core';
|
|
2
|
+
import { CourierToastThemeManager } from '../types/courier-toast-theme-manager';
|
|
3
|
+
import { CourierToastTheme } from '../types/courier-toast-theme';
|
|
4
|
+
import { InboxMessage } from '@trycourier/courier-js';
|
|
5
|
+
import { CourierToastItemActionClickEvent, CourierToastItemClickEvent, CourierToastItemFactoryProps } from '../types/toast';
|
|
6
|
+
/**
|
|
7
|
+
* Default implementation of a Toast item.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link CourierToast}
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class CourierToastItem extends CourierBaseElement {
|
|
13
|
+
/** The animation duration to fade out a dismissed toast before its element is removed. */
|
|
14
|
+
private static readonly dismissAnimationTimeoutMs;
|
|
15
|
+
private _themeManager;
|
|
16
|
+
private _themeSubscription;
|
|
17
|
+
private _message;
|
|
18
|
+
private _customToastItemContent?;
|
|
19
|
+
/** Whether this toast item is auto-dismissed. */
|
|
20
|
+
private readonly _autoDismiss;
|
|
21
|
+
/** The timeout before the toast item is auto-dismissed, applicable if _autoDismiss is true. */
|
|
22
|
+
private readonly _autoDismissTimeoutMs;
|
|
23
|
+
private _onItemDismissedCallback;
|
|
24
|
+
private _onToastItemClickCallback;
|
|
25
|
+
private _onToastItemActionClickCallback;
|
|
26
|
+
constructor(props: {
|
|
27
|
+
message: InboxMessage;
|
|
28
|
+
autoDismiss: boolean;
|
|
29
|
+
autoDismissTimeoutMs: number;
|
|
30
|
+
themeManager: CourierToastThemeManager;
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Registers a handler called when the item is dismissed.
|
|
34
|
+
*
|
|
35
|
+
* @param handler - A function to be called when the item is dismissed.
|
|
36
|
+
*/
|
|
37
|
+
onItemDismissed(handler: (props: {
|
|
38
|
+
message: InboxMessage;
|
|
39
|
+
}) => void): void;
|
|
40
|
+
/**
|
|
41
|
+
* Registers a handler for item click events.
|
|
42
|
+
*
|
|
43
|
+
* @param handler - A function to be called when the item is clicked.
|
|
44
|
+
*/
|
|
45
|
+
onToastItemClick(handler: (props: CourierToastItemClickEvent) => void): void;
|
|
46
|
+
/**
|
|
47
|
+
* Registers a handler for item click events.
|
|
48
|
+
*
|
|
49
|
+
* @param handler - A function to be called when the item is clicked.
|
|
50
|
+
*/
|
|
51
|
+
onToastItemActionClick(handler: (props: CourierToastItemActionClickEvent) => void): void;
|
|
52
|
+
/**
|
|
53
|
+
* Set a custom content element for the toast item, reusing the {@link CourierToastItem}
|
|
54
|
+
* container, which provides styling, animations, and event handling.
|
|
55
|
+
*
|
|
56
|
+
* @param factory - Function that returns an `HTMLElement` to render as the content.
|
|
57
|
+
*/
|
|
58
|
+
setToastItemContent(factory?: (props: CourierToastItemFactoryProps) => HTMLElement): void;
|
|
59
|
+
/**
|
|
60
|
+
* Dismiss the toast item.
|
|
61
|
+
*
|
|
62
|
+
* By default the toast fades out before it's removed. Set `timeoutMs` to
|
|
63
|
+
* `0` to remove the item immediately.
|
|
64
|
+
*
|
|
65
|
+
* @param timeoutMs - the animation duration to fade out the toast item
|
|
66
|
+
*/
|
|
67
|
+
dismiss(timeoutMs?: number): void;
|
|
68
|
+
/** @override */
|
|
69
|
+
protected onComponentMounted(): void;
|
|
70
|
+
/** @override */
|
|
71
|
+
protected onComponentUnmounted(): void;
|
|
72
|
+
get theme(): CourierToastTheme;
|
|
73
|
+
/**
|
|
74
|
+
* @override
|
|
75
|
+
*/
|
|
76
|
+
static get id(): string;
|
|
77
|
+
/**
|
|
78
|
+
* @override
|
|
79
|
+
*/
|
|
80
|
+
static get observedAttributes(): string[];
|
|
81
|
+
/**
|
|
82
|
+
* Render a toast item, either with default content or custom content if
|
|
83
|
+
* a content factory function is provided.
|
|
84
|
+
*
|
|
85
|
+
* Note: Styles for the toast item are set in {@link CourierToast} since
|
|
86
|
+
* toasts are ephemeral by nature and we want to avoid adding/removing/duplicating
|
|
87
|
+
* styles as {@link CourierToastItem}s enter/exit.
|
|
88
|
+
*/
|
|
89
|
+
private render;
|
|
90
|
+
/** Create the default content for this item. */
|
|
91
|
+
private createDefaultContent;
|
|
92
|
+
private get messageHasActions();
|
|
93
|
+
private createActionButton;
|
|
94
|
+
private onClick;
|
|
95
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { CourierBaseElement, CourierComponentThemeMode } from '@trycourier/courier-ui-core';
|
|
2
|
+
import { CourierToastThemeManager } from '../types/courier-toast-theme-manager';
|
|
3
|
+
import { CourierToastTheme } from '../types/courier-toast-theme';
|
|
4
|
+
import { CourierToastItemActionClickEvent, CourierToastItemClickEvent, CourierToastItemFactoryProps, CourierToastDismissButtonOption } from '../types/toast';
|
|
5
|
+
/**
|
|
6
|
+
* An embeddable and customizable toast component, fed by data from Courier Inbox.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* Embedding the default toast component on a webpage.
|
|
11
|
+
* ```
|
|
12
|
+
* <html>
|
|
13
|
+
* <body>
|
|
14
|
+
* <courier-toast></courier-toast>
|
|
15
|
+
*
|
|
16
|
+
* <script type="module">
|
|
17
|
+
* import { Courier } from "@trycourier/courier-ui-toast";
|
|
18
|
+
*
|
|
19
|
+
* // Authenticate the user
|
|
20
|
+
* Courier.shared.signIn({ userId, jwt });
|
|
21
|
+
* </script>
|
|
22
|
+
* </body>
|
|
23
|
+
* </html>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare class CourierToast extends CourierBaseElement {
|
|
29
|
+
private _themeManager;
|
|
30
|
+
private _themeSubscription;
|
|
31
|
+
private _toastStyle?;
|
|
32
|
+
private _authListener?;
|
|
33
|
+
private _datastoreListener;
|
|
34
|
+
private _autoDismiss;
|
|
35
|
+
private _autoDismissTimeoutMs;
|
|
36
|
+
private _dismissButtonOption;
|
|
37
|
+
private _customToastItem?;
|
|
38
|
+
private _customToastItemContent?;
|
|
39
|
+
private _onItemClick?;
|
|
40
|
+
private _onItemActionClick?;
|
|
41
|
+
/** Default layout props. */
|
|
42
|
+
private readonly _defaultLayoutProps;
|
|
43
|
+
/**
|
|
44
|
+
* The names of all attributes for which the web component needs change notifications.
|
|
45
|
+
*
|
|
46
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes
|
|
47
|
+
*/
|
|
48
|
+
static observedAttributes: string[];
|
|
49
|
+
constructor(props: {
|
|
50
|
+
themeManager?: CourierToastThemeManager;
|
|
51
|
+
});
|
|
52
|
+
/** Set the handler invoked when a toast item is clicked. */
|
|
53
|
+
onToastItemClick(handler?: (props: CourierToastItemClickEvent) => void): void;
|
|
54
|
+
/** Set the handler invoked when a toast item action button is clicked. */
|
|
55
|
+
onToastItemActionClick(handler?: (props: CourierToastItemActionClickEvent) => void): void;
|
|
56
|
+
/** Enable auto-dismiss for toast items. */
|
|
57
|
+
enableAutoDismiss(): void;
|
|
58
|
+
/** Disable auto-dismiss for toast items. */
|
|
59
|
+
disableAutoDismiss(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Set the timeout before auto-dismissing toasts.
|
|
62
|
+
* Only applicable if auto-dismiss is enabled.
|
|
63
|
+
* @param timeoutMs - The timeout in milliseconds before a toast is dismissed.
|
|
64
|
+
*/
|
|
65
|
+
setAutoDismissTimeoutMs(timeoutMs: number): void;
|
|
66
|
+
/**
|
|
67
|
+
* Set the light theme for the toast.
|
|
68
|
+
* @param theme - The light theme object to set.
|
|
69
|
+
*/
|
|
70
|
+
setLightTheme(theme: CourierToastTheme): void;
|
|
71
|
+
/**
|
|
72
|
+
* Set the dark theme for the toast.
|
|
73
|
+
* @param theme - The dark theme object to set.
|
|
74
|
+
*/
|
|
75
|
+
setDarkTheme(theme: CourierToastTheme): void;
|
|
76
|
+
/**
|
|
77
|
+
* Set the dismiss button display option.
|
|
78
|
+
*
|
|
79
|
+
* @param option - a value of {@link CourierToastDismissButtonOption}
|
|
80
|
+
*/
|
|
81
|
+
setDismissButton(option: CourierToastDismissButtonOption): void;
|
|
82
|
+
/**
|
|
83
|
+
* Set the theme mode.
|
|
84
|
+
*
|
|
85
|
+
* @param mode - The theme mode, one of "dark", "light", or "system".
|
|
86
|
+
*/
|
|
87
|
+
setMode(mode: CourierComponentThemeMode): void;
|
|
88
|
+
/**
|
|
89
|
+
* Set a factory function that renders a toast item.
|
|
90
|
+
*
|
|
91
|
+
* See {@link CourierToast.setToastItemContent} to set the content while preserving the toast item's
|
|
92
|
+
* container and stack styling.
|
|
93
|
+
*/
|
|
94
|
+
setToastItem(factory?: (props: CourierToastItemFactoryProps) => HTMLElement): void;
|
|
95
|
+
/**
|
|
96
|
+
* Set a factory function that renders a toast item's content.
|
|
97
|
+
*
|
|
98
|
+
* The toast item's container, including the stack, auto-dismiss timer, and dismiss button
|
|
99
|
+
* and all events are still present when custom content is set.
|
|
100
|
+
*
|
|
101
|
+
* See {@link CourierToast.setDismissButton} to customize the dismiss button's visibility and
|
|
102
|
+
* {@link CourierToast.setToastItem} to customize the entire toast item, including
|
|
103
|
+
* its container.
|
|
104
|
+
*/
|
|
105
|
+
setToastItemContent(factory?: (props: CourierToastItemFactoryProps) => HTMLElement): void;
|
|
106
|
+
/**
|
|
107
|
+
* Dismiss the toast item(s) associated with a particular {@link @trycourier/courier-js#InboxMessage}.
|
|
108
|
+
*
|
|
109
|
+
* Toast items are matched to messages by the field {@link @trycourier/courier-js#InboxMessage.messageId}.
|
|
110
|
+
* If the item is an instance of {@link CourierToastItem} it will be animated out
|
|
111
|
+
* before removal, otherwise custom items are removed immediately.
|
|
112
|
+
*
|
|
113
|
+
* If there are multiple toast items matching the message, all items will be dismissed.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* Using dismissToastForMessage with setToastItem to dismiss a custom element.
|
|
117
|
+
* ```ts
|
|
118
|
+
* // Get a reference to the toast component
|
|
119
|
+
* const toast = document.getElementById("my-toast");
|
|
120
|
+
*
|
|
121
|
+
* toast.setToastItem((props) => {
|
|
122
|
+
* const el = document.createElement("div");
|
|
123
|
+
* el.addEventListener("click", () => toast.dismissToastForMessage(props.message));
|
|
124
|
+
* return el;
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @param message - the {@link @trycourier/courier-js#InboxMessage} for which toast items should be dismissed
|
|
129
|
+
*/
|
|
130
|
+
private dismissToastForMessage;
|
|
131
|
+
/**
|
|
132
|
+
* @override
|
|
133
|
+
*/
|
|
134
|
+
protected onComponentMounted(): void;
|
|
135
|
+
/**
|
|
136
|
+
* @override
|
|
137
|
+
*/
|
|
138
|
+
protected onComponentUnmounted(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Lifecycle callback invoked when an observed attribute changes.
|
|
141
|
+
*
|
|
142
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes
|
|
143
|
+
*/
|
|
144
|
+
protected attributeChangedCallback(name: string, _: string, newValue: string): void;
|
|
145
|
+
private get theme();
|
|
146
|
+
/** Refresh the styles tag, if it exists, with the current theme. */
|
|
147
|
+
private refreshStyles;
|
|
148
|
+
private authChangedCallback;
|
|
149
|
+
private removeAllItems;
|
|
150
|
+
private addToastItem;
|
|
151
|
+
private createToastItem;
|
|
152
|
+
private createDefaultToastItem;
|
|
153
|
+
private createCustomToastItem;
|
|
154
|
+
private datastoreAddMessageListener;
|
|
155
|
+
private datastoreRemoveMessageListener;
|
|
156
|
+
private getStyles;
|
|
157
|
+
/** Get the top item's (i.e. the fully visible item's) height. */
|
|
158
|
+
private get topStackItemHeight();
|
|
159
|
+
private resizeContainerToHeight;
|
|
160
|
+
/** Whether the dismiss button should only be shown on hover. */
|
|
161
|
+
private get showDismissOnHover();
|
|
162
|
+
/** Whether to show the dismiss button. The button is visible (either always or on hover) if not explicitly disabled. */
|
|
163
|
+
private get showDismiss();
|
|
164
|
+
/** @override */
|
|
165
|
+
static get id(): string;
|
|
166
|
+
private static isDismissButtonOption;
|
|
167
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InboxMessage } from '@trycourier/courier-js';
|
|
2
|
+
/**
|
|
3
|
+
* The set of {@link CourierToastDatastore} events for which listeners can be added.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class CourierToastDatastoreEvents {
|
|
8
|
+
onMessageAdd?(_: InboxMessage): void;
|
|
9
|
+
onMessageRemove?(_: InboxMessage): void;
|
|
10
|
+
onError?(_: Error): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CourierToastDatastoreEvents } from './toast-datastore-events';
|
|
2
|
+
/**
|
|
3
|
+
* Listener containing callbacks for {@link CourierToastDatastore} events.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class CourierToastDatastoreListener {
|
|
8
|
+
readonly events: CourierToastDatastoreEvents;
|
|
9
|
+
constructor(events: CourierToastDatastoreEvents);
|
|
10
|
+
/** Remove this listener. Callbacks will no longer be invoked after remove is called. */
|
|
11
|
+
remove(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { InboxMessage } from '@trycourier/courier-js';
|
|
2
|
+
import { CourierToastDatastoreListener } from './toast-datastore-listener';
|
|
3
|
+
/**
|
|
4
|
+
* Shared datastore for Courier toasts.
|
|
5
|
+
*
|
|
6
|
+
* This datastore listens to and stores Courier Inbox messages.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class CourierToastDatastore {
|
|
11
|
+
/** Shared instance. Access via {@link CourierToastDatastore.shared}. */
|
|
12
|
+
private static instance;
|
|
13
|
+
/** FIFO stack of toast messages. The end of the array is index 0 of the stack. */
|
|
14
|
+
private _dataset;
|
|
15
|
+
/** Set of listeners whose handlers will be called when the datastore changes. */
|
|
16
|
+
private _datastoreListeners;
|
|
17
|
+
/** The shared instance of CourierToastDatastore, used to access all public methods. */
|
|
18
|
+
static get shared(): CourierToastDatastore;
|
|
19
|
+
/**
|
|
20
|
+
* Add a listener whose handlers are called when there are changes to the datastore.
|
|
21
|
+
*
|
|
22
|
+
* @param listener - an implementation of {@link CourierToastDatastoreListener}
|
|
23
|
+
*/
|
|
24
|
+
addDatastoreListener(listener: CourierToastDatastoreListener): void;
|
|
25
|
+
/**
|
|
26
|
+
* Remove a previously added listener.
|
|
27
|
+
*
|
|
28
|
+
* Note: the `listener` param is matched by object reference, so callers must pass
|
|
29
|
+
* the same object previously passed to {@link CourierToastDatastore.addDatastoreListener}.
|
|
30
|
+
*
|
|
31
|
+
* See also: {@link CourierToastDatastoreListener.remove}
|
|
32
|
+
*
|
|
33
|
+
* @param listener - a previously added listener implementation
|
|
34
|
+
*/
|
|
35
|
+
removeDatastoreListener(listener: CourierToastDatastoreListener): void;
|
|
36
|
+
/**
|
|
37
|
+
* Start listening for toast messages.
|
|
38
|
+
*
|
|
39
|
+
* Calling this method will open a WebSocket connection to the Courier backend if one
|
|
40
|
+
* is not already open.
|
|
41
|
+
*
|
|
42
|
+
* See also: {@link @trycourier/courier-js#Courier.shared.signIn} and {@link @trycourier/courier-js#Courier.shared.signOut}
|
|
43
|
+
*/
|
|
44
|
+
listenForMessages(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Find the position of an {@link @trycourier/courier-js#InboxMessage} in the toast stack.
|
|
47
|
+
*
|
|
48
|
+
* Notes:
|
|
49
|
+
* - Since the stack is an array, with the last item being the "top" of the stack,
|
|
50
|
+
* a toast's position in the underlying array is the inverse of its stack position.
|
|
51
|
+
* - `message` is matched by {@link @trycourier/courier-js#InboxMessage.messageId}, not by object reference.
|
|
52
|
+
*
|
|
53
|
+
* @param message - the {@link @trycourier/courier-js#InboxMessage} to find in the stack
|
|
54
|
+
*/
|
|
55
|
+
toastIndexOfMessage(message: InboxMessage): number;
|
|
56
|
+
/**
|
|
57
|
+
* Add an {@link @trycourier/courier-js#InboxMessage} toast item to the datastore.
|
|
58
|
+
*
|
|
59
|
+
* Calling this directly is useful to send test messages while developing with the Courier SDK.</p>
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```
|
|
63
|
+
* CourierToastDatastore.shared.addMessage({
|
|
64
|
+
* title: 'Lorem ipsum dolor sit',
|
|
65
|
+
* body: 'Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet',
|
|
66
|
+
* messageId: '1'
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param message - the message to add as a toast item.
|
|
71
|
+
*/
|
|
72
|
+
addMessage(message: InboxMessage): void;
|
|
73
|
+
/**
|
|
74
|
+
* Remove an {@link @trycourier/courier-js#InboxMessage} from the datastore.
|
|
75
|
+
*
|
|
76
|
+
* Note: `message` is matched by {@link @trycourier/courier-js#InboxMessage.messageId}, not by object reference
|
|
77
|
+
*/
|
|
78
|
+
removeMessage(message: InboxMessage): void;
|
|
79
|
+
/** Access the shared instance with {@link CourierToastDatastore.shared}. */
|
|
80
|
+
private constructor();
|
|
81
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Courier } from '@trycourier/courier-js';
|
|
2
|
+
export * from './components/courier-toast';
|
|
3
|
+
export * from './components/courier-toast-item';
|
|
4
|
+
export * from './types/courier-toast-theme';
|
|
5
|
+
export * from './types/courier-toast-theme-manager';
|
|
6
|
+
export * from './types/toast';
|
|
7
|
+
export * from './datastore/toast-datastore';
|
|
8
|
+
export * from './datastore/toast-datastore-listener';
|
|
9
|
+
export * from './datastore/toast-datastore-events';
|
|
10
|
+
export { Courier };
|
|
11
|
+
export type { CourierProps, CourierClientOptions, CourierBrand, CourierApiUrls, CourierUserPreferences, CourierUserPreferencesStatus, CourierUserPreferencesChannel, CourierUserPreferencesPaging, CourierUserPreferencesTopic, CourierUserPreferencesTopicResponse, CourierDevice, CourierToken, CourierGetInboxMessageResponse, CourierGetInboxMessagesResponse, InboxMessage, InboxAction, InboxMessageEventEnvelope, } from '@trycourier/courier-js';
|
|
12
|
+
export type { CourierComponentThemeMode } from '@trycourier/courier-ui-core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@trycourier/courier-ui-core"),require("@trycourier/courier-js")):"function"==typeof define&&define.amd?define(["exports","@trycourier/courier-ui-core","@trycourier/courier-js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CourierUIToast={},t.CourierUICore,t.CourierJS)}(this,(function(t,e,s){"use strict";var i=Object.defineProperty,o=(t,e,s)=>((t,e,s)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s)(t,"symbol"!=typeof e?e+"":e,s);const n={item:{backgroundColor:e.CourierColors.white[500],hoverBackgroundColor:e.CourierColors.gray[200],activeBackgroundColor:e.CourierColors.gray[500],shadow:`0px 4px 8px -2px ${e.CourierColors.black[50020]}`,border:`1px solid ${e.CourierColors.gray[500]}`,borderRadius:"8px",title:{size:"11pt",weight:"400",color:e.CourierColors.black[500]},body:{size:"11pt",weight:"400",color:e.CourierColors.gray[600]},icon:{color:e.CourierColors.black[500],svg:e.CourierIconSVGs.inbox},dismissIcon:{color:e.CourierColors.black[500],svg:e.CourierIconSVGs.remove},autoDismissBarColor:e.CourierColors.blue[400],actions:{backgroundColor:"transparent",hoverBackgroundColor:e.CourierColors.gray[200],activeBackgroundColor:e.CourierColors.gray[500],border:`1px solid ${e.CourierColors.gray[500]}`,borderRadius:"4px",shadow:"0px 1px 2px 0px rgba(0, 0, 0, 0.06)",font:{color:e.CourierColors.black[500],size:"14px"}}}},r={item:{backgroundColor:e.CourierColors.black[500],hoverBackgroundColor:e.CourierColors.gray[400],activeBackgroundColor:e.CourierColors.gray[600],shadow:`0px 4px 8px -2px ${e.CourierColors.gray[400]}`,border:`1px solid ${e.CourierColors.black[500]}`,borderRadius:"8px",title:{size:"11pt",weight:"400",color:e.CourierColors.white[500]},body:{size:"11pt",weight:"400",color:e.CourierColors.gray[500]},icon:{color:e.CourierColors.white[500],svg:e.CourierIconSVGs.inbox},dismissIcon:{color:e.CourierColors.white[500],svg:e.CourierIconSVGs.remove},autoDismissBarColor:e.CourierColors.blue[400],actions:{backgroundColor:e.CourierColors.black[400],hoverBackgroundColor:e.CourierColors.white[50010],activeBackgroundColor:e.CourierColors.white[50020],border:`1px solid ${e.CourierColors.gray[400]}`,borderRadius:"4px",shadow:`0px 1px 2px 0px ${e.CourierColors.white[50010]}`,font:{color:e.CourierColors.white[500],size:"14px"}}}},a=(t,e)=>{var s,i,o,a,l,d,h,c;const u="light"===t?n:r;return{item:{...u.item,...e.item,title:{...null==(s=u.item)?void 0:s.title,...null==(i=e.item)?void 0:i.title},body:{...null==(o=u.item)?void 0:o.body,...null==(a=e.item)?void 0:a.body},icon:{...null==(l=u.item)?void 0:l.icon,...null==(d=e.item)?void 0:d.icon},dismissIcon:{...null==(h=u.item)?void 0:h.dismissIcon,...null==(c=e.item)?void 0:c.dismissIcon}}}};class l extends e.CourierThemeManager{constructor(t){super(t),o(this,"THEME_CHANGE_EVENT","courier_toast_theme_change")}getDefaultLightTheme(){return n}getDefaultDarkTheme(){return r}mergeTheme(t,e){return a(t,e)}subscribe(t){return{...super.subscribe(t),manager:this}}}const d=class t extends e.CourierBaseElement{constructor(t){super(),o(this,"_themeManager"),o(this,"_themeSubscription"),o(this,"_message"),o(this,"_customToastItemContent"),o(this,"_autoDismiss"),o(this,"_autoDismissTimeoutMs"),o(this,"_onItemDismissedCallback",null),o(this,"_onToastItemClickCallback",null),o(this,"_onToastItemActionClickCallback",null),this._message=t.message,this._autoDismiss=t.autoDismiss,this._autoDismissTimeoutMs=t.autoDismissTimeoutMs,this._themeManager=t.themeManager,this._themeSubscription=this._themeManager.subscribe((t=>{this.render()}))}onItemDismissed(t){this._onItemDismissedCallback=t}onToastItemClick(t){this._onToastItemClickCallback=t,this.render()}onToastItemActionClick(t){this._onToastItemActionClickCallback=t,this.render()}setToastItemContent(t){this._customToastItemContent=t}dismiss(e=t.dismissAnimationTimeoutMs){this.classList.add("dismissing"),setTimeout((()=>{this.remove(),this._onItemDismissedCallback&&this._onItemDismissedCallback({message:this._message})}),e)}onComponentMounted(){this.render()}onComponentUnmounted(){this._themeSubscription.unsubscribe()}get theme(){return this._themeManager.getTheme()}static get id(){return"courier-toast-item"}static get observedAttributes(){return[]}render(){for(var t,s,i,o;this.firstChild;)this.removeChild(this.firstChild);this.removeEventListener("click",this.onClick);const n=document.createElement("div");if(n.classList.add("overflow-hidden-container"),this.appendChild(n),this._autoDismiss){const t=document.createElement("div");t.classList.add("auto-dismiss"),n.append(t)}this._customToastItemContent?n.appendChild(this._customToastItemContent({message:this._message,autoDismiss:this._autoDismiss,autoDismissTimeoutMs:this._autoDismissTimeoutMs})):n.appendChild(this.createDefaultContent()),this._onToastItemClickCallback&&this.classList.add("clickable"),this.addEventListener("click",this.onClick);const r=new e.CourierIcon(null==(s=null==(t=this.theme.item)?void 0:t.dismissIcon)?void 0:s.color,null==(o=null==(i=this.theme.item)?void 0:i.dismissIcon)?void 0:o.svg);r.classList.add("dismiss"),r.addEventListener("click",(t=>{t.stopPropagation(),this.remove(),this._onItemDismissedCallback&&this._onItemDismissedCallback({message:this._message})})),this.appendChild(r)}createDefaultContent(){var t,s,i,o,n;const r=document.createElement("div");r.classList.add("content"),this.append(r);const a=new e.CourierIcon(null==(s=null==(t=this.theme.item)?void 0:t.icon)?void 0:s.color,null==(o=null==(i=this.theme.item)?void 0:i.icon)?void 0:o.svg);a.classList.add("icon"),r.appendChild(a);const l=document.createElement("div");l.classList.add("text-content"),r.appendChild(l);const d=document.createElement("p");d.classList.add("title"),d.textContent=this._message.title??"",l.appendChild(d);const h=document.createElement("p");if(h.classList.add("body"),h.textContent=this._message.preview??this._message.body??"",l.appendChild(h),this.messageHasActions){const t=document.createElement("div");t.classList.add("actions-container"),l.appendChild(t),null==(n=this._message.actions)||n.forEach((e=>{const s=this.createActionButton(e);t.appendChild(s)}))}return r}get messageHasActions(){return this._message.actions&&this._message.actions.length>0}createActionButton(t){var s,i,o,n,r;const a=null==(s=this._themeManager.getTheme().item)?void 0:s.actions;return new e.CourierButton({mode:this._themeManager.mode,text:t.content,variant:"secondary",backgroundColor:null==a?void 0:a.backgroundColor,hoverBackgroundColor:null==a?void 0:a.hoverBackgroundColor,activeBackgroundColor:null==a?void 0:a.activeBackgroundColor,border:null==a?void 0:a.border,borderRadius:null==a?void 0:a.borderRadius,shadow:null==a?void 0:a.shadow,fontFamily:null==(i=null==a?void 0:a.font)?void 0:i.family,fontSize:null==(o=null==a?void 0:a.font)?void 0:o.size,fontWeight:null==(n=null==a?void 0:a.font)?void 0:n.weight,textColor:null==(r=null==a?void 0:a.font)?void 0:r.color,onClick:()=>{this._onToastItemActionClickCallback&&this._onToastItemActionClickCallback({message:this._message,action:t})}})}onClick(t){t.stopPropagation(),this._onToastItemClickCallback&&this._onToastItemClickCallback({message:this._message})}};o(d,"dismissAnimationTimeoutMs",300);let h=d;e.registerElement(h);const c=class t{constructor(){o(this,"_dataset",[]),o(this,"_datastoreListeners",[])}static get shared(){return t.instance||(t.instance=new t),t.instance}addDatastoreListener(t){this._datastoreListeners.push(t)}removeDatastoreListener(t){this._datastoreListeners=this._datastoreListeners.filter((e=>e!==t))}async listenForMessages(){var t,e,i,o,n,r,a;try{const a=null==(t=s.Courier.shared.client)?void 0:t.inbox.socket;if(!a)return void(null==(i=null==(e=s.Courier.shared.client)?void 0:e.options.logger)||i.info("CourierInbox socket not available"));if(a.addMessageEventListener((t=>{if(t.event===s.InboxMessageEvent.NewMessage){const e=t.data;this.addMessage(e)}})),a.isConnecting||a.isOpen)return void(null==(r=null==(o=s.Courier.shared.client)?void 0:o.options.logger)||r.info(`Inbox socket already connecting or open for client ID: [${null==(n=s.Courier.shared.client)?void 0:n.options.connectionId}]`));a.connect()}catch(l){null==(a=s.Courier.shared.client)||a.options.logger.error("Error listening for messages:",l),this._datastoreListeners.forEach((t=>{var e,s;null==(s=(e=t.events).onError)||s.call(e,l)}))}}toastIndexOfMessage(t){const e=this._dataset.findIndex((e=>e.messageId===t.messageId));return e<0?e:this._dataset.length-e-1}addMessage(t){this._dataset.push(t),this._datastoreListeners.forEach((e=>{e.events.onMessageAdd&&e.events.onMessageAdd(t)}))}removeMessage(t){const e=this._dataset.findIndex((e=>e.messageId===t.messageId));e<0||(this._dataset.splice(e,1),this._datastoreListeners.forEach((e=>{e.events.onMessageRemove&&e.events.onMessageRemove(t)})))}};o(c,"instance");let u=c;class m{constructor(t){this.events=t}remove(){u.shared.removeDatastoreListener(this)}}const g=class t extends e.CourierBaseElement{constructor(t){super(),o(this,"_themeManager"),o(this,"_themeSubscription"),o(this,"_toastStyle"),o(this,"_authListener"),o(this,"_datastoreListener"),o(this,"_autoDismiss",!1),o(this,"_autoDismissTimeoutMs",5e3),o(this,"_dismissButtonOption","auto"),o(this,"_customToastItem"),o(this,"_customToastItemContent"),o(this,"_onItemClick"),o(this,"_onItemActionClick"),o(this,"_defaultLayoutProps",{position:"fixed",width:"380px",top:"30px",right:"30px",zIndex:999}),this._themeManager=(null==t?void 0:t.themeManager)??new l(n),this._themeSubscription=this._themeManager.subscribe((t=>{this.refreshStyles()})),this._datastoreListener=new m({onMessageAdd:this.datastoreAddMessageListener.bind(this),onMessageRemove:this.datastoreRemoveMessageListener.bind(this)})}onToastItemClick(t){this._onItemClick=t}onToastItemActionClick(t){this._onItemActionClick=t}enableAutoDismiss(){this._autoDismiss=!0}disableAutoDismiss(){this._autoDismiss=!1}setAutoDismissTimeoutMs(t){this._autoDismissTimeoutMs=t}setLightTheme(t){this._themeManager.setLightTheme(t)}setDarkTheme(t){this._themeManager.setDarkTheme(t)}setDismissButton(t){this._dismissButtonOption=t,this.refreshStyles()}setMode(t){this._themeManager.setMode(t)}setToastItem(t){this._customToastItem=t}setToastItemContent(t){this._customToastItemContent=t}dismissToastForMessage(t){this.childNodes.forEach((e=>{e.dataset.courierMessageId===t.messageId&&(e instanceof h?e.dismiss():e.remove())}))}onComponentMounted(){this._toastStyle=e.injectGlobalStyle(t.id,this.getStyles(this.theme)),u.shared.addDatastoreListener(this._datastoreListener),s.Courier.shared.addAuthenticationListener(this.authChangedCallback.bind(this)),u.shared.listenForMessages()}onComponentUnmounted(){var t,e;this._datastoreListener.remove(),null==(t=this._authListener)||t.remove(),null==(e=this._toastStyle)||e.remove(),this._themeManager.cleanup(),this._themeSubscription.unsubscribe()}attributeChangedCallback(e,s,i){switch(e){case"auto-dismiss":"false"===i?this.disableAutoDismiss():this.enableAutoDismiss();break;case"auto-dismiss-timeout-ms":this.setAutoDismissTimeoutMs(parseInt(i,10));break;case"dismiss-button":i&&t.isDismissButtonOption(i)?this.setDismissButton(i):this.setDismissButton("auto");break;case"light-theme":i&&this.setLightTheme(JSON.parse(i));break;case"dark-theme":i&&this.setDarkTheme(JSON.parse(i));break;case"mode":this._themeManager.setMode(i)}}get theme(){return this._themeManager.getTheme()}refreshStyles(){this._toastStyle&&(this._toastStyle.textContent=this.getStyles(this.theme))}authChangedCallback(){this.removeAllItems(),u.shared.listenForMessages()}removeAllItems(){for(;this.firstChild;)this.removeChild(this.firstChild)}addToastItem(t){const e=this.createToastItem(t);return e.dataset.courierMessageId=t.messageId,this.appendChild(e),this.resizeContainerToHeight(this.topStackItemHeight),e}createToastItem(t){return this._customToastItem?this.createCustomToastItem(t):this.createDefaultToastItem(t)}createDefaultToastItem(t){const e=new h({message:t,autoDismiss:this._autoDismiss,autoDismissTimeoutMs:this._autoDismissTimeoutMs,themeManager:this._themeManager});return e.onItemDismissed((t=>{this.resizeContainerToHeight(this.topStackItemHeight)})),this._customToastItemContent&&e.setToastItemContent(this._customToastItemContent),this._onItemClick&&e.onToastItemClick(this._onItemClick),this._onItemActionClick&&e.onToastItemActionClick(this._onItemActionClick),this._autoDismiss&&setTimeout(e.dismiss.bind(e),this._autoDismissTimeoutMs),e}createCustomToastItem(t){if(!this._customToastItem)throw Error("Attempted to create customToastItem, but none is set");const e=this._customToastItem({message:t,autoDismiss:this._autoDismiss,autoDismissTimeoutMs:this._autoDismissTimeoutMs});return this._autoDismiss&&setTimeout((()=>{this.removeChild(e)}),this._autoDismissTimeoutMs),e.addEventListener("click",(()=>{this._onItemClick&&this._onItemClick({message:t})})),e}datastoreAddMessageListener(t){this.addToastItem(t)}datastoreRemoveMessageListener(t){this.dismissToastForMessage(t)}getStyles(e){var s,i,o,n,r,a;const l=e.item;return[`\n ${t.id} {\n position: ${this._defaultLayoutProps.position};\n z-index: ${this._defaultLayoutProps.zIndex};\n top: ${this._defaultLayoutProps.top};\n right: ${this._defaultLayoutProps.right};\n width: ${this._defaultLayoutProps.width};\n }\n `,`\n ${h.id}:last-child {\n top: 0;\n right: 0;\n }\n\n ${h.id}:nth-last-child(2) {\n top: 12px;\n bottom: -12px;\n --scale: 0.95\n }\n\n ${h.id}:nth-last-child(3) {\n top: 24px;\n bottom: -24px;\n --scale: 0.9;\n }\n\n ${h.id}:nth-last-child(n+4) {\n top: 24px;\n bottom: -24px;\n --scale: 0.9;\n visibility: hidden;\n }\n\n ${h.id}:nth-last-child(n+2) > .overflow-hidden-container {\n opacity: 0;\n }\n `,`\n ${h.id} {\n position: absolute;\n box-sizing: border-box;\n width: 100%;\n background-color: ${null==l?void 0:l.backgroundColor};\n box-shadow: ${null==l?void 0:l.shadow};\n border: ${null==l?void 0:l.border};\n border-radius: ${null==l?void 0:l.borderRadius};\n transition: 0.2s ease-in-out;\n cursor: default;\n\n opacity: 0;\n transform: translate(0, -10px) scaleX(var(--scale, 1));\n animation: show 0.3s ease-in-out forwards;\n }\n\n ${h.id} > .overflow-hidden-container {\n height: 100%;\n width: 100%;\n border-radius: ${null==l?void 0:l.borderRadius};\n overflow: hidden;\n }\n\n ${h.id}.dismissing {\n animation: hide 0.3s ease-in-out forwards;\n }\n\n @keyframes show {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n transform: scaleX(var(--scale, 1));\n }\n }\n\n @keyframes hide {\n 0% {\n opacity: 1;\n transform: scaleX(var(--scale, 1));\n }\n\n 100% {\n opacity: 0;\n transform: scaleX(var(--scale, 1));\n }\n }\n\n ${h.id}.clickable:last-child {\n cursor: pointer;\n }\n\n ${h.id}.clickable:last-child:hover {\n background-color: ${null==l?void 0:l.hoverBackgroundColor};\n }\n\n ${h.id}.clickable:last-child:active {\n background-color: ${null==l?void 0:l.activeBackgroundColor};\n }\n\n ${h.id}.clickable:nth-last-child(n+2) {\n pointer-events: none;\n }\n `,`\n ${h.id} > .dismiss {\n position: absolute;\n visibility: hidden;\n opacity: 0%;\n top: -10px;\n right: -10px;\n background-color: ${null==l?void 0:l.backgroundColor};\n border: ${null==l?void 0:l.border};\n padding: 3px;\n border-radius: 50%;\n font-size: 12pt;\n box-shadow: ${null==l?void 0:l.shadow};\n cursor: pointer;\n transition: 0.2s ease-in-out;\n }\n\n ${h.id} > .dismiss:hover {\n background-color: ${null==l?void 0:l.hoverBackgroundColor};\n }\n\n ${h.id} > .dismiss:active {\n background-color: ${null==l?void 0:l.activeBackgroundColor};\n }\n\n ${h.id}:last-child${this.showDismissOnHover?":hover":""} > .dismiss {\n visibility: ${this.showDismiss?"visible":"hidden"};\n opacity: 100%;\n transition: 0.2s ease-in-out;\n }\n `,`\n ${h.id} > .overflow-hidden-container > .auto-dismiss {\n width: 100%;\n height: 5px;\n background-color: ${null==l?void 0:l.autoDismissBarColor};\n animation: auto-dismiss ${this._autoDismissTimeoutMs}ms ease-in-out forwards;\n }\n\n @keyframes auto-dismiss {\n 100% {\n width: 0px;\n }\n }\n `,`\n ${h.id} > .overflow-hidden-container > .content {\n display: flex;\n gap: 12px;\n align-items: center;\n align-self: stretch;\n box-sizing: border-box;\n padding: 12px;\n }\n\n ${h.id} > .overflow-hidden-container > .content > .text-content {\n }\n\n ${h.id} > .overflow-hidden-container > .content > .icon {\n }\n\n ${h.id} > .overflow-hidden-container > .content > .text-content > .title {\n margin: 0;\n font-weight: ${null==(s=null==l?void 0:l.title)?void 0:s.weight};\n font-size: ${null==(i=null==l?void 0:l.title)?void 0:i.size};\n color: ${null==(o=null==l?void 0:l.title)?void 0:o.color};\n }\n\n ${h.id} > .overflow-hidden-container > .content > .text-content > .body {\n margin: 8px 0 0 0;\n font-weight: ${null==(n=null==l?void 0:l.body)?void 0:n.weight};\n font-size: ${null==(r=null==l?void 0:l.body)?void 0:r.size};\n line-height: 150%;\n color: ${null==(a=null==l?void 0:l.body)?void 0:a.color};\n }\n `,`\n ${h.id} > .overflow-hidden-container > .content > .text-content > .actions-container {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n }\n `].join("")}get topStackItemHeight(){if(this.lastChild){return`${this.lastChild.getBoundingClientRect().height}px`}return"0px"}resizeContainerToHeight(t){this.style.height=t}get showDismissOnHover(){return!(!this._autoDismiss||"auto"!==this._dismissButtonOption)||"hover"===this._dismissButtonOption}get showDismiss(){return"hidden"!==this._dismissButtonOption}static get id(){return"courier-toast"}static isDismissButtonOption(t){return["visible","hidden","hover","auto"].includes(t)}};o(g,"observedAttributes",["auto-dismiss","auto-dismiss-timeout-ms","dismiss-button","light-theme","dark-theme","mode"]);let C=g;e.registerElement(C);s.Courier.shared.courierUserAgentName="courier-ui-toast",s.Courier.shared.courierUserAgentVersion="1.0.0",Object.defineProperty(t,"Courier",{enumerable:!0,get:()=>s.Courier}),t.CourierToast=C,t.CourierToastDatastore=u,t.CourierToastDatastoreEvents=class{onMessageAdd(t){}onMessageRemove(t){}onError(t){}},t.CourierToastDatastoreListener=m,t.CourierToastItem=h,t.CourierToastThemeManager=l,t.defaultDarkTheme=r,t.defaultLightTheme=n,t.mergeTheme=a,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/types/courier-toast-theme.ts","../src/types/courier-toast-theme-manager.ts","../src/components/courier-toast-item.ts","../src/datastore/toast-datastore.ts","../src/datastore/toast-datastore-listener.ts","../src/components/courier-toast.ts","../src/index.ts","../src/datastore/toast-datastore-events.ts"],"sourcesContent":["import { CourierColors, CourierIconSVGs, SystemThemeMode, CourierFontTheme, CourierIconTheme } from \"@trycourier/courier-ui-core\";\r\n\r\n// Re-export common types from core for convenience\r\n\r\n/** @public */\r\nexport type CourierToastFontTheme = CourierFontTheme;\r\n\r\n/** @public */\r\nexport type CourierToastIconTheme = CourierIconTheme;\r\n\r\n/** @public */\r\nexport type CourierToastItemTheme = {\r\n backgroundColor?: string;\r\n hoverBackgroundColor?: string;\r\n activeBackgroundColor?: string;\r\n autoDismissBarColor?: string;\r\n title?: CourierToastFontTheme;\r\n body?: CourierToastFontTheme;\r\n icon?: CourierToastIconTheme;\r\n dismissIcon?: CourierToastIconTheme;\r\n shadow?: string;\r\n border?: string;\r\n borderRadius?: string;\r\n actions?: {\r\n backgroundColor?: string;\r\n hoverBackgroundColor?: string;\r\n activeBackgroundColor?: string;\r\n border?: string;\r\n borderRadius?: string;\r\n shadow?: string;\r\n font?: CourierToastFontTheme;\r\n }\r\n}\r\n\r\n/** @public */\r\nexport type CourierToastTheme = {\r\n item?: CourierToastItemTheme;\r\n};\r\n\r\n/** @public */\r\nexport const defaultLightTheme: CourierToastTheme = {\r\n item: {\r\n backgroundColor: CourierColors.white[500],\r\n hoverBackgroundColor: CourierColors.gray[200],\r\n activeBackgroundColor: CourierColors.gray[500],\r\n shadow: `0px 4px 8px -2px ${CourierColors.black[500_20]}`,\r\n border: `1px solid ${CourierColors.gray[500]}`,\r\n borderRadius: '8px',\r\n title: {\r\n size: '11pt',\r\n weight: '400',\r\n color: CourierColors.black[500],\r\n },\r\n body: {\r\n size: '11pt',\r\n weight: '400',\r\n color: CourierColors.gray[600],\r\n },\r\n icon: {\r\n color: CourierColors.black[500],\r\n svg: CourierIconSVGs.inbox,\r\n },\r\n dismissIcon: {\r\n color: CourierColors.black[500],\r\n svg: CourierIconSVGs.remove,\r\n },\r\n autoDismissBarColor: CourierColors.blue[400],\r\n actions: {\r\n backgroundColor: 'transparent',\r\n hoverBackgroundColor: CourierColors.gray[200],\r\n activeBackgroundColor: CourierColors.gray[500],\r\n border: `1px solid ${CourierColors.gray[500]}`,\r\n borderRadius: '4px',\r\n shadow: '0px 1px 2px 0px rgba(0, 0, 0, 0.06)',\r\n font: {\r\n color: CourierColors.black[500],\r\n size: '14px',\r\n }\r\n }\r\n }\r\n};\r\n\r\n/** @public */\r\nexport const defaultDarkTheme: CourierToastTheme = {\r\n item: {\r\n backgroundColor: CourierColors.black[500],\r\n hoverBackgroundColor: CourierColors.gray[400],\r\n activeBackgroundColor: CourierColors.gray[600],\r\n shadow: `0px 4px 8px -2px ${CourierColors.gray[400]}`,\r\n border: `1px solid ${CourierColors.black[500]}`,\r\n borderRadius: '8px',\r\n title: {\r\n size: '11pt',\r\n weight: '400',\r\n color: CourierColors.white[500],\r\n },\r\n body: {\r\n size: '11pt',\r\n weight: '400',\r\n color: CourierColors.gray[500],\r\n },\r\n icon: {\r\n color: CourierColors.white[500],\r\n svg: CourierIconSVGs.inbox,\r\n },\r\n dismissIcon: {\r\n color: CourierColors.white[500],\r\n svg: CourierIconSVGs.remove,\r\n },\r\n autoDismissBarColor: CourierColors.blue[400],\r\n actions: {\r\n backgroundColor: CourierColors.black[400],\r\n hoverBackgroundColor: CourierColors.white[500_10],\r\n activeBackgroundColor: CourierColors.white[500_20],\r\n border: `1px solid ${CourierColors.gray[400]}`,\r\n borderRadius: '4px',\r\n shadow: `0px 1px 2px 0px ${CourierColors.white[500_10]}`,\r\n font: {\r\n color: CourierColors.white[500],\r\n size: '14px'\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Deep merge themes, only overwriting non-optional properties.\r\n *\r\n * @public\r\n */\r\nexport const mergeTheme = (mode: SystemThemeMode, theme: CourierToastTheme): CourierToastTheme => {\r\n const defaultTheme = mode === 'light' ? defaultLightTheme : defaultDarkTheme;\r\n return {\r\n item: {\r\n ...defaultTheme.item,\r\n ...theme.item,\r\n title: {\r\n ...defaultTheme.item?.title,\r\n ...theme.item?.title\r\n },\r\n body: {\r\n ...defaultTheme.item?.body,\r\n ...theme.item?.body\r\n },\r\n icon: {\r\n ...defaultTheme.item?.icon,\r\n ...theme.item?.icon\r\n },\r\n dismissIcon: {\r\n ...defaultTheme.item?.dismissIcon,\r\n ...theme.item?.dismissIcon\r\n }\r\n }\r\n };\r\n};\r\n","import { CourierThemeManager, CourierThemeSubscription, SystemThemeMode } from \"@trycourier/courier-ui-core\";\r\nimport { CourierToastTheme, defaultDarkTheme, defaultLightTheme, mergeTheme } from \"./courier-toast-theme\";\r\n\r\n/**\r\n * @public\r\n */\r\nexport interface CourierToastThemeSubscription extends CourierThemeSubscription<CourierToastTheme> {\r\n manager: CourierToastThemeManager;\r\n}\r\n\r\n/**\r\n * Toast-specific theme manager that extends the abstract CourierThemeManager.\r\n * Provides toast theme management with light/dark mode support.\r\n *\r\n * @public\r\n */\r\nexport class CourierToastThemeManager extends CourierThemeManager<CourierToastTheme> {\r\n\r\n // Event ID for toast theme changes\r\n protected readonly THEME_CHANGE_EVENT: string = 'courier_toast_theme_change';\r\n\r\n constructor(initialTheme: CourierToastTheme) {\r\n super(initialTheme);\r\n }\r\n\r\n /**\r\n * Get the default light theme for toast\r\n */\r\n protected getDefaultLightTheme(): CourierToastTheme {\r\n return defaultLightTheme;\r\n }\r\n\r\n /**\r\n * Get the default dark theme for toast\r\n */\r\n protected getDefaultDarkTheme(): CourierToastTheme {\r\n return defaultDarkTheme;\r\n }\r\n\r\n /**\r\n * Merge the toast theme with defaults\r\n */\r\n protected mergeTheme(mode: SystemThemeMode, theme: CourierToastTheme): CourierToastTheme {\r\n return mergeTheme(mode, theme);\r\n }\r\n\r\n /**\r\n * Subscribe to toast theme changes\r\n * @param callback - Function to run when the theme changes\r\n * @returns Object with unsubscribe method to stop listening\r\n */\r\n public subscribe(callback: (theme: CourierToastTheme) => void): CourierToastThemeSubscription {\r\n const baseSubscription = super.subscribe(callback);\r\n return {\r\n ...baseSubscription,\r\n manager: this\r\n };\r\n }\r\n\r\n}\r\n","import { CourierBaseElement, CourierButton, CourierIcon, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierToastThemeManager, CourierToastThemeSubscription } from \"../types/courier-toast-theme-manager\";\nimport { CourierToastTheme } from \"../types/courier-toast-theme\";\nimport { InboxAction, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierToastItemActionClickEvent, CourierToastItemClickEvent, CourierToastItemFactoryProps } from \"../types/toast\";\n\n/**\n * Default implementation of a Toast item.\n *\n * @see {@link CourierToast}\n * @public\n */\nexport class CourierToastItem extends CourierBaseElement {\n /** The animation duration to fade out a dismissed toast before its element is removed. */\n private static readonly dismissAnimationTimeoutMs = 300;\n\n private _themeManager: CourierToastThemeManager;\n private _themeSubscription: CourierToastThemeSubscription;\n private _message: InboxMessage;\n private _customToastItemContent?: (props: CourierToastItemFactoryProps) => HTMLElement;\n\n /** Whether this toast item is auto-dismissed. */\n private readonly _autoDismiss: boolean;\n\n /** The timeout before the toast item is auto-dismissed, applicable if _autoDismiss is true. */\n private readonly _autoDismissTimeoutMs: number;\n\n // Callbacks\n private _onItemDismissedCallback: ((props: { message: InboxMessage }) => void) | null = null;\n private _onToastItemClickCallback: ((props: CourierToastItemClickEvent) => void) | null = null;\n private _onToastItemActionClickCallback: ((props: CourierToastItemActionClickEvent) => void) | null = null;\n\n constructor(props: {\n message: InboxMessage,\n autoDismiss: boolean,\n autoDismissTimeoutMs: number,\n themeManager: CourierToastThemeManager,\n }) {\n\n super();\n this._message = props.message;\n this._autoDismiss = props.autoDismiss;\n this._autoDismissTimeoutMs = props.autoDismissTimeoutMs;\n\n this._themeManager = props.themeManager;\n this._themeSubscription = this._themeManager.subscribe((_: CourierToastTheme) => {\n this.render();\n });\n }\n\n /**\n * Registers a handler called when the item is dismissed.\n *\n * @param handler - A function to be called when the item is dismissed.\n */\n public onItemDismissed(handler: (props: { message: InboxMessage }) => void): void {\n this._onItemDismissedCallback = handler;\n }\n\n /**\n * Registers a handler for item click events.\n *\n * @param handler - A function to be called when the item is clicked.\n */\n public onToastItemClick(handler: (props: CourierToastItemClickEvent) => void): void {\n this._onToastItemClickCallback = handler;\n\n // Re-render to set/un-set the .clickable class\n this.render();\n }\n\n /**\n * Registers a handler for item click events.\n *\n * @param handler - A function to be called when the item is clicked.\n */\n public onToastItemActionClick(handler: (props: CourierToastItemActionClickEvent) => void): void {\n this._onToastItemActionClickCallback = handler;\n\n // Re-render to set/un-set the .clickable class\n this.render();\n }\n\n\n /**\n * Set a custom content element for the toast item, reusing the {@link CourierToastItem}\n * container, which provides styling, animations, and event handling.\n *\n * @param factory - Function that returns an `HTMLElement` to render as the content.\n */\n public setToastItemContent(factory?: (props: CourierToastItemFactoryProps) => HTMLElement) {\n this._customToastItemContent = factory;\n }\n\n /**\n * Dismiss the toast item.\n *\n * By default the toast fades out before it's removed. Set `timeoutMs` to\n * `0` to remove the item immediately.\n *\n * @param timeoutMs - the animation duration to fade out the toast item\n */\n public dismiss(timeoutMs: number = CourierToastItem.dismissAnimationTimeoutMs) {\n this.classList.add('dismissing');\n\n setTimeout(() => {\n this.remove();\n\n if (this._onItemDismissedCallback) {\n this._onItemDismissedCallback({ message: this._message });\n }\n }, timeoutMs);\n }\n\n /** @override */\n protected onComponentMounted(): void {\n this.render();\n }\n\n /** @override */\n protected onComponentUnmounted(): void {\n this._themeSubscription.unsubscribe();\n }\n\n get theme(): CourierToastTheme {\n return this._themeManager.getTheme();\n }\n\n /**\n * @override\n */\n static get id(): string {\n return 'courier-toast-item';\n }\n\n /**\n * @override\n */\n static get observedAttributes(): string[] {\n return [];\n }\n\n /**\n * Render a toast item, either with default content or custom content if\n * a content factory function is provided.\n *\n * Note: Styles for the toast item are set in {@link CourierToast} since\n * toasts are ephemeral by nature and we want to avoid adding/removing/duplicating\n * styles as {@link CourierToastItem}s enter/exit.\n */\n private render(): void {\n // Reset existing content and top-level listeners\n while (this.firstChild) {\n this.removeChild(this.firstChild);\n }\n this.removeEventListener('click', this.onClick);\n\n // Content and the auto-dismiss bar are wrapped in a container that hides overflow.\n // The standard dismiss button overflows the toast.\n const overflowHiddenContainer = document.createElement('div');\n overflowHiddenContainer.classList.add('overflow-hidden-container');\n this.appendChild(overflowHiddenContainer);\n\n // Auto-dismiss\n if (this._autoDismiss) {\n const autoDismiss = document.createElement('div');\n autoDismiss.classList.add('auto-dismiss');\n overflowHiddenContainer.append(autoDismiss);\n }\n\n // Content\n if (this._customToastItemContent) {\n overflowHiddenContainer.appendChild(this._customToastItemContent({ message: this._message, autoDismiss: this._autoDismiss, autoDismissTimeoutMs: this._autoDismissTimeoutMs }));\n } else {\n overflowHiddenContainer.appendChild(this.createDefaultContent());\n }\n\n // Click-ability\n if (this._onToastItemClickCallback) {\n this.classList.add('clickable');\n }\n\n this.addEventListener('click', this.onClick);\n\n // Dismiss button\n const dismiss = new CourierIcon(\n this.theme.item?.dismissIcon?.color,\n this.theme.item?.dismissIcon?.svg,\n );\n dismiss.classList.add('dismiss');\n dismiss.addEventListener('click', (event) => {\n event.stopPropagation();\n this.remove();\n\n if (this._onItemDismissedCallback) {\n this._onItemDismissedCallback({ message: this._message });\n }\n });\n this.appendChild(dismiss);\n }\n\n /** Create the default content for this item. */\n private createDefaultContent(): HTMLElement {\n const content = document.createElement('div');\n content.classList.add('content');\n this.append(content);\n\n const icon = new CourierIcon(\n this.theme.item?.icon?.color,\n this.theme.item?.icon?.svg,\n );\n icon.classList.add('icon');\n content.appendChild(icon);\n\n const textContent = document.createElement('div');\n textContent.classList.add('text-content');\n content.appendChild(textContent);\n\n const title = document.createElement('p');\n title.classList.add('title');\n title.textContent = this._message.title ?? '';\n textContent.appendChild(title);\n\n const body = document.createElement('p');\n body.classList.add('body');\n body.textContent = this._message.preview ?? this._message.body ?? '';\n textContent.appendChild(body);\n\n if (this.messageHasActions) {\n const actionsContainer = document.createElement('div');\n actionsContainer.classList.add('actions-container');\n textContent.appendChild(actionsContainer);\n\n this._message.actions?.forEach(action => {\n const button = this.createActionButton(action);\n actionsContainer.appendChild(button);\n });\n }\n\n return content;\n }\n\n private get messageHasActions() {\n return this._message.actions && this._message.actions.length > 0;\n }\n\n private createActionButton(action: InboxAction): CourierButton {\n const actionsTheme = this._themeManager.getTheme().item?.actions;\n\n return new CourierButton({\n mode: this._themeManager.mode,\n text: action.content,\n variant: 'secondary',\n backgroundColor: actionsTheme?.backgroundColor,\n hoverBackgroundColor: actionsTheme?.hoverBackgroundColor,\n activeBackgroundColor: actionsTheme?.activeBackgroundColor,\n border: actionsTheme?.border,\n borderRadius: actionsTheme?.borderRadius,\n shadow: actionsTheme?.shadow,\n fontFamily: actionsTheme?.font?.family,\n fontSize: actionsTheme?.font?.size,\n fontWeight: actionsTheme?.font?.weight,\n textColor: actionsTheme?.font?.color,\n onClick: () => {\n if (this._onToastItemActionClickCallback) {\n this._onToastItemActionClickCallback({ message: this._message, action });\n }\n }\n });\n\n\n }\n\n private onClick(event: Event) {\n event.stopPropagation();\n if (this._onToastItemClickCallback) {\n this._onToastItemClickCallback({ message: this._message });\n }\n }\n}\n\nregisterElement(CourierToastItem);\n","import { Courier, InboxMessage, InboxMessageEvent, InboxMessageEventEnvelope } from \"@trycourier/courier-js\";\nimport { CourierToastDatastoreListener } from \"./toast-datastore-listener\";\n\n/**\n * Shared datastore for Courier toasts.\n *\n * This datastore listens to and stores Courier Inbox messages.\n *\n * @public\n */\nexport class CourierToastDatastore {\n /** Shared instance. Access via {@link CourierToastDatastore.shared}. */\n private static instance: CourierToastDatastore;\n\n /** FIFO stack of toast messages. The end of the array is index 0 of the stack. */\n private _dataset: InboxMessage[] = [];\n\n /** Set of listeners whose handlers will be called when the datastore changes. */\n private _datastoreListeners: CourierToastDatastoreListener[] = [];\n\n /** The shared instance of CourierToastDatastore, used to access all public methods. */\n public static get shared(): CourierToastDatastore {\n if (!CourierToastDatastore.instance) {\n CourierToastDatastore.instance = new CourierToastDatastore();\n }\n\n return CourierToastDatastore.instance;\n }\n\n /**\n * Add a listener whose handlers are called when there are changes to the datastore.\n *\n * @param listener - an implementation of {@link CourierToastDatastoreListener}\n */\n public addDatastoreListener(listener: CourierToastDatastoreListener) {\n this._datastoreListeners.push(listener);\n }\n\n /**\n * Remove a previously added listener.\n *\n * Note: the `listener` param is matched by object reference, so callers must pass\n * the same object previously passed to {@link CourierToastDatastore.addDatastoreListener}.\n *\n * See also: {@link CourierToastDatastoreListener.remove}\n *\n * @param listener - a previously added listener implementation\n */\n public removeDatastoreListener(listener: CourierToastDatastoreListener) {\n this._datastoreListeners = this._datastoreListeners.filter(l => l !== listener);\n }\n\n /**\n * Start listening for toast messages.\n *\n * Calling this method will open a WebSocket connection to the Courier backend if one\n * is not already open.\n *\n * See also: {@link @trycourier/courier-js#Courier.shared.signIn} and {@link @trycourier/courier-js#Courier.shared.signOut}\n */\n public async listenForMessages() {\n try {\n const socketClient = Courier.shared.client?.inbox.socket;\n\n if (!socketClient) {\n Courier.shared.client?.options.logger?.info('CourierInbox socket not available');\n return;\n }\n\n socketClient.addMessageEventListener((messageEvent: InboxMessageEventEnvelope) => {\n if (messageEvent.event === InboxMessageEvent.NewMessage) {\n const message: InboxMessage = messageEvent.data as InboxMessage;\n\n this.addMessage(message);\n }\n });\n\n // If the socket is already connecting or open, return early\n if (socketClient.isConnecting || socketClient.isOpen) {\n Courier.shared.client?.options.logger?.info(`Inbox socket already connecting or open for client ID: [${Courier.shared.client?.options.connectionId}]`);\n return;\n }\n\n socketClient.connect();\n } catch (error: unknown) {\n Courier.shared.client?.options.logger.error('Error listening for messages:', error);\n this._datastoreListeners.forEach(listener => {\n listener.events.onError?.(error as Error);\n });\n }\n }\n\n /**\n * Find the position of an {@link @trycourier/courier-js#InboxMessage} in the toast stack.\n *\n * Notes:\n * - Since the stack is an array, with the last item being the \"top\" of the stack,\n * a toast's position in the underlying array is the inverse of its stack position.\n * - `message` is matched by {@link @trycourier/courier-js#InboxMessage.messageId}, not by object reference.\n *\n * @param message - the {@link @trycourier/courier-js#InboxMessage} to find in the stack\n */\n public toastIndexOfMessage(message: InboxMessage) {\n const position = this._dataset.findIndex(m => m.messageId === message.messageId);\n\n // Message not found\n if (position < 0) {\n return position;\n }\n\n // Return index from end of array (top of stack)\n return this._dataset.length - position - 1;\n }\n\n /**\n * Add an {@link @trycourier/courier-js#InboxMessage} toast item to the datastore.\n *\n * Calling this directly is useful to send test messages while developing with the Courier SDK.</p>\n *\n * @example\n * ```\n * CourierToastDatastore.shared.addMessage({\n * title: 'Lorem ipsum dolor sit',\n * body: 'Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet',\n * messageId: '1'\n * });\n * ```\n *\n * @param message - the message to add as a toast item.\n */\n public addMessage(message: InboxMessage) {\n this._dataset.push(message);\n\n this._datastoreListeners.forEach(listener => {\n if (listener.events.onMessageAdd) {\n listener.events.onMessageAdd(message);\n }\n });\n }\n\n /**\n * Remove an {@link @trycourier/courier-js#InboxMessage} from the datastore.\n *\n * Note: `message` is matched by {@link @trycourier/courier-js#InboxMessage.messageId}, not by object reference\n */\n public removeMessage(message: InboxMessage) {\n const index = this._dataset.findIndex(m => m.messageId === message.messageId);\n if (index < 0) {\n return;\n }\n\n this._dataset.splice(index, /* deleteCount */ 1);\n\n this._datastoreListeners.forEach(listener => {\n if (listener.events.onMessageRemove) {\n listener.events.onMessageRemove(message);\n }\n });\n }\n\n /** Access the shared instance with {@link CourierToastDatastore.shared}. */\n // Prevent instantiation via constructor.\n private constructor() {}\n}\n","import { CourierToastDatastore } from \"./toast-datastore\";\nimport { CourierToastDatastoreEvents } from \"./toast-datastore-events\";\n\n/**\n * Listener containing callbacks for {@link CourierToastDatastore} events.\n *\n * @public\n */\nexport class CourierToastDatastoreListener {\n constructor(readonly events: CourierToastDatastoreEvents) {}\n\n /** Remove this listener. Callbacks will no longer be invoked after remove is called. */\n remove() {\n CourierToastDatastore.shared.removeDatastoreListener(this);\n }\n}\n","import { CourierBaseElement, CourierComponentThemeMode, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierToastThemeManager, CourierToastThemeSubscription } from \"../types/courier-toast-theme-manager\";\nimport { CourierToastTheme, defaultLightTheme } from \"../types/courier-toast-theme\";\nimport { AuthenticationListener, Courier, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierToastItem } from \"./courier-toast-item\";\nimport { CourierToastItemActionClickEvent, CourierToastItemClickEvent, CourierToastItemFactoryProps } from \"../types/toast\";\nimport { CourierToastDismissButtonOption } from \"../types/toast\";\nimport { CourierToastDatastoreListener } from \"../datastore/toast-datastore-listener\";\nimport { CourierToastDatastore } from \"../datastore/toast-datastore\";\n\n/** Default set of CSS properties used to layout CourierToast. */\ntype CourierToastLayoutProps = {\n position?: string;\n width?: string;\n top?: string;\n right?: string;\n zIndex?: number;\n}\n\n/**\n * An embeddable and customizable toast component, fed by data from Courier Inbox.\n *\n * @example\n *\n * Embedding the default toast component on a webpage.\n * ```\n * <html>\n * <body>\n * <courier-toast></courier-toast>\n *\n * <script type=\"module\">\n * import { Courier } from \"@trycourier/courier-ui-toast\";\n *\n * // Authenticate the user\n * Courier.shared.signIn({ userId, jwt });\n * </script>\n * </body>\n * </html>\n * ```\n *\n * @public\n */\nexport class CourierToast extends CourierBaseElement {\n\n // Internally-maintained state\n private _themeManager: CourierToastThemeManager;\n private _themeSubscription: CourierToastThemeSubscription;\n private _toastStyle?: HTMLStyleElement;\n private _authListener?: AuthenticationListener;\n private _datastoreListener: CourierToastDatastoreListener;\n\n // Consumer-provided options\n private _autoDismiss: boolean = false;\n private _autoDismissTimeoutMs: number = 5000;\n private _dismissButtonOption: CourierToastDismissButtonOption = 'auto';\n private _customToastItem?: (props: CourierToastItemFactoryProps) => HTMLElement;\n private _customToastItemContent?: (props: CourierToastItemFactoryProps) => HTMLElement;\n\n // Consumer-provided callbacks\n private _onItemClick?: ((props: CourierToastItemClickEvent) => void);\n private _onItemActionClick?: ((props: CourierToastItemActionClickEvent) => void);\n\n /** Default layout props. */\n private readonly _defaultLayoutProps: CourierToastLayoutProps = {\n position: 'fixed',\n width: '380px',\n top: '30px',\n right: '30px',\n zIndex: 999,\n };\n\n /**\n * The names of all attributes for which the web component needs change notifications.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes\n */\n static observedAttributes = [\n 'auto-dismiss',\n 'auto-dismiss-timeout-ms',\n 'dismiss-button',\n 'light-theme',\n 'dark-theme',\n 'mode',\n ];\n\n constructor(props: {\n themeManager?: CourierToastThemeManager\n }) {\n super();\n\n this._themeManager = props?.themeManager ?? new CourierToastThemeManager(defaultLightTheme);\n this._themeSubscription = this._themeManager.subscribe((_: CourierToastTheme) => {\n this.refreshStyles();\n });\n this._datastoreListener = new CourierToastDatastoreListener({\n onMessageAdd: this.datastoreAddMessageListener.bind(this),\n onMessageRemove: this.datastoreRemoveMessageListener.bind(this),\n });\n }\n\n /** Set the handler invoked when a toast item is clicked. */\n public onToastItemClick(handler?: (props: CourierToastItemClickEvent) => void): void {\n this._onItemClick = handler;\n }\n\n /** Set the handler invoked when a toast item action button is clicked. */\n public onToastItemActionClick(handler?: (props: CourierToastItemActionClickEvent) => void): void {\n this._onItemActionClick = handler;\n }\n\n /** Enable auto-dismiss for toast items. */\n public enableAutoDismiss() {\n this._autoDismiss = true;\n }\n\n /** Disable auto-dismiss for toast items. */\n public disableAutoDismiss() {\n this._autoDismiss = false;\n }\n\n /**\n * Set the timeout before auto-dismissing toasts.\n * Only applicable if auto-dismiss is enabled.\n * @param timeoutMs - The timeout in milliseconds before a toast is dismissed.\n */\n public setAutoDismissTimeoutMs(timeoutMs: number) {\n this._autoDismissTimeoutMs = timeoutMs;\n }\n\n /**\n * Set the light theme for the toast.\n * @param theme - The light theme object to set.\n */\n public setLightTheme(theme: CourierToastTheme) {\n this._themeManager.setLightTheme(theme);\n }\n\n /**\n * Set the dark theme for the toast.\n * @param theme - The dark theme object to set.\n */\n public setDarkTheme(theme: CourierToastTheme) {\n this._themeManager.setDarkTheme(theme);\n }\n\n /**\n * Set the dismiss button display option.\n *\n * @param option - a value of {@link CourierToastDismissButtonOption}\n */\n public setDismissButton(option: CourierToastDismissButtonOption) {\n this._dismissButtonOption = option;\n this.refreshStyles();\n }\n\n /**\n * Set the theme mode.\n *\n * @param mode - The theme mode, one of \"dark\", \"light\", or \"system\".\n */\n public setMode(mode: CourierComponentThemeMode) {\n this._themeManager.setMode(mode);\n }\n\n /**\n * Set a factory function that renders a toast item.\n *\n * See {@link CourierToast.setToastItemContent} to set the content while preserving the toast item's\n * container and stack styling.\n */\n public setToastItem(factory?: (props: CourierToastItemFactoryProps) => HTMLElement) {\n this._customToastItem = factory;\n }\n\n /**\n * Set a factory function that renders a toast item's content.\n *\n * The toast item's container, including the stack, auto-dismiss timer, and dismiss button\n * and all events are still present when custom content is set.\n *\n * See {@link CourierToast.setDismissButton} to customize the dismiss button's visibility and\n * {@link CourierToast.setToastItem} to customize the entire toast item, including\n * its container.\n */\n public setToastItemContent(factory?: (props: CourierToastItemFactoryProps) => HTMLElement) {\n this._customToastItemContent = factory;\n }\n\n /**\n * Dismiss the toast item(s) associated with a particular {@link @trycourier/courier-js#InboxMessage}.\n *\n * Toast items are matched to messages by the field {@link @trycourier/courier-js#InboxMessage.messageId}.\n * If the item is an instance of {@link CourierToastItem} it will be animated out\n * before removal, otherwise custom items are removed immediately.\n *\n * If there are multiple toast items matching the message, all items will be dismissed.\n *\n * @example\n * Using dismissToastForMessage with setToastItem to dismiss a custom element.\n * ```ts\n * // Get a reference to the toast component\n * const toast = document.getElementById(\"my-toast\");\n *\n * toast.setToastItem((props) => {\n * const el = document.createElement(\"div\");\n * el.addEventListener(\"click\", () => toast.dismissToastForMessage(props.message));\n * return el;\n * });\n * ```\n *\n * @param message - the {@link @trycourier/courier-js#InboxMessage} for which toast items should be dismissed\n */\n private dismissToastForMessage(message: InboxMessage) {\n this.childNodes.forEach(node => {\n const nodeMessageId = (node as HTMLElement).dataset.courierMessageId;\n\n if (nodeMessageId !== message.messageId) {\n return;\n }\n\n if (node instanceof CourierToastItem) {\n node.dismiss();\n } else {\n node.remove();\n }\n });\n }\n\n /**\n * @override\n */\n protected onComponentMounted(): void {\n this._toastStyle = injectGlobalStyle(CourierToast.id, this.getStyles(this.theme));\n\n CourierToastDatastore.shared.addDatastoreListener(this._datastoreListener);\n Courier.shared.addAuthenticationListener(this.authChangedCallback.bind(this));\n CourierToastDatastore.shared.listenForMessages();\n }\n\n /**\n * @override\n */\n protected onComponentUnmounted(): void {\n this._datastoreListener.remove();\n this._authListener?.remove();\n this._toastStyle?.remove();\n this._themeManager.cleanup();\n this._themeSubscription.unsubscribe();\n }\n\n /**\n * Lifecycle callback invoked when an observed attribute changes.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes\n */\n protected attributeChangedCallback(name: string, _: string, newValue: string) {\n switch (name) {\n case 'auto-dismiss':\n if (newValue === 'false') {\n this.disableAutoDismiss();\n } else {\n this.enableAutoDismiss();\n }\n break;\n case 'auto-dismiss-timeout-ms':\n this.setAutoDismissTimeoutMs(parseInt(newValue, /* base= */ 10));\n break;\n case 'dismiss-button':\n if (newValue && CourierToast.isDismissButtonOption(newValue)) {\n this.setDismissButton(newValue as CourierToastDismissButtonOption);\n } else {\n this.setDismissButton('auto');\n }\n break;\n case 'light-theme':\n if (newValue) {\n this.setLightTheme(JSON.parse(newValue));\n }\n break;\n case 'dark-theme':\n if (newValue) {\n this.setDarkTheme(JSON.parse(newValue));\n }\n break;\n case 'mode':\n this._themeManager.setMode(newValue as CourierComponentThemeMode);\n break;\n }\n }\n\n private get theme(): CourierToastTheme {\n return this._themeManager.getTheme();\n }\n\n /** Refresh the styles tag, if it exists, with the current theme. */\n private refreshStyles() {\n if (this._toastStyle) {\n this._toastStyle.textContent = this.getStyles(this.theme);\n }\n }\n\n private authChangedCallback() {\n this.removeAllItems();\n\n // If re-auth'ing logged the user out and closed the WebSocket connection,\n // we'll open a new connection. If one is already open, this is a no-op.\n CourierToastDatastore.shared.listenForMessages();\n }\n\n private removeAllItems(): void {\n while (this.firstChild) {\n this.removeChild(this.firstChild);\n }\n }\n\n private addToastItem(message: InboxMessage): CourierToastItem | HTMLElement {\n // Append the toast item and resize the toast container\n // so previous toast items can stack underneath at fixed offsets\n // from the top item.\n const toastItem = this.createToastItem(message);\n toastItem.dataset.courierMessageId = message.messageId;\n this.appendChild(toastItem);\n this.resizeContainerToHeight(this.topStackItemHeight);\n\n return toastItem;\n }\n\n private createToastItem(message: InboxMessage): CourierToastItem | HTMLElement {\n if (this._customToastItem) {\n return this.createCustomToastItem(message);\n }\n\n return this.createDefaultToastItem(message);\n }\n\n private createDefaultToastItem(message: InboxMessage) {\n const item = new CourierToastItem({\n message,\n autoDismiss: this._autoDismiss,\n autoDismissTimeoutMs: this._autoDismissTimeoutMs,\n themeManager: this._themeManager\n });\n\n item.onItemDismissed((_) => {\n this.resizeContainerToHeight(this.topStackItemHeight);\n });\n\n if (this._customToastItemContent) {\n item.setToastItemContent(this._customToastItemContent);\n }\n\n if (this._onItemClick) {\n item.onToastItemClick(this._onItemClick);\n }\n\n if (this._onItemActionClick) {\n item.onToastItemActionClick(this._onItemActionClick);\n }\n\n if (this._autoDismiss) {\n setTimeout(item.dismiss.bind(item), this._autoDismissTimeoutMs);\n }\n\n return item;\n }\n\n private createCustomToastItem(message: InboxMessage) {\n if (!this._customToastItem) {\n throw Error(\"Attempted to create customToastItem, but none is set\");\n }\n\n const customItem = this._customToastItem({\n message,\n autoDismiss: this._autoDismiss,\n autoDismissTimeoutMs: this._autoDismissTimeoutMs,\n });\n\n if (this._autoDismiss) {\n setTimeout(() => {\n this.removeChild(customItem);\n }, this._autoDismissTimeoutMs);\n }\n\n customItem.addEventListener('click', () => {\n if (this._onItemClick) {\n this._onItemClick({ message });\n }\n });\n\n return customItem;\n }\n\n private datastoreAddMessageListener(message: InboxMessage) {\n this.addToastItem(message);\n }\n\n private datastoreRemoveMessageListener(message: InboxMessage) {\n this.dismissToastForMessage(message);\n }\n\n private getStyles(theme: CourierToastTheme): string {\n const item = theme.item;\n\n // Styles for the top-level toast container.\n const toastStyles = `\n ${CourierToast.id} {\n position: ${this._defaultLayoutProps.position};\n z-index: ${this._defaultLayoutProps.zIndex};\n top: ${this._defaultLayoutProps.top};\n right: ${this._defaultLayoutProps.right};\n width: ${this._defaultLayoutProps.width};\n }\n `;\n\n // Stack the three most recently shown toast items and hide all others.\n // Content is transparent for all but the most recent (top) toast item\n // since it otherwise peeks out in the visible stack items.\n const toastStackStyles = `\n ${CourierToastItem.id}:last-child {\n top: 0;\n right: 0;\n }\n\n ${CourierToastItem.id}:nth-last-child(2) {\n top: 12px;\n bottom: -12px;\n --scale: 0.95\n }\n\n ${CourierToastItem.id}:nth-last-child(3) {\n top: 24px;\n bottom: -24px;\n --scale: 0.9;\n }\n\n ${CourierToastItem.id}:nth-last-child(n+4) {\n top: 24px;\n bottom: -24px;\n --scale: 0.9;\n visibility: hidden;\n }\n\n ${CourierToastItem.id}:nth-last-child(n+2) > .overflow-hidden-container {\n opacity: 0;\n }\n `;\n\n // Styles for the visible toast item.\n // `opacity` and `transform` are the initial states before\n // the keyframed `animation` show is applied.\n // The class `dismissing` is added to trigger the `animation` hide\n // before removing an item.\n // Only the top item is clickable.\n const toastItemStyles = `\n ${CourierToastItem.id} {\n position: absolute;\n box-sizing: border-box;\n width: 100%;\n background-color: ${item?.backgroundColor};\n box-shadow: ${item?.shadow};\n border: ${item?.border};\n border-radius: ${item?.borderRadius};\n transition: 0.2s ease-in-out;\n cursor: default;\n\n opacity: 0;\n transform: translate(0, -10px) scaleX(var(--scale, 1));\n animation: show 0.3s ease-in-out forwards;\n }\n\n ${CourierToastItem.id} > .overflow-hidden-container {\n height: 100%;\n width: 100%;\n border-radius: ${item?.borderRadius};\n overflow: hidden;\n }\n\n ${CourierToastItem.id}.dismissing {\n animation: hide 0.3s ease-in-out forwards;\n }\n\n @keyframes show {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n transform: scaleX(var(--scale, 1));\n }\n }\n\n @keyframes hide {\n 0% {\n opacity: 1;\n transform: scaleX(var(--scale, 1));\n }\n\n 100% {\n opacity: 0;\n transform: scaleX(var(--scale, 1));\n }\n }\n\n ${CourierToastItem.id}.clickable:last-child {\n cursor: pointer;\n }\n\n ${CourierToastItem.id}.clickable:last-child:hover {\n background-color: ${item?.hoverBackgroundColor};\n }\n\n ${CourierToastItem.id}.clickable:last-child:active {\n background-color: ${item?.activeBackgroundColor};\n }\n\n ${CourierToastItem.id}.clickable:nth-last-child(n+2) {\n pointer-events: none;\n }\n `;\n\n // A dismiss icon is visible when the top toast item is in the :hover state.\n // Auto-dismiss styles are added, but unused if the auto-dismiss progress\n // bar is not added in the courier-toast-item element\n // (i.e. when auto-dismiss is disabled).\n const dismissStyles = `\n ${CourierToastItem.id} > .dismiss {\n position: absolute;\n visibility: hidden;\n opacity: 0%;\n top: -10px;\n right: -10px;\n background-color: ${item?.backgroundColor};\n border: ${item?.border};\n padding: 3px;\n border-radius: 50%;\n font-size: 12pt;\n box-shadow: ${item?.shadow};\n cursor: pointer;\n transition: 0.2s ease-in-out;\n }\n\n ${CourierToastItem.id} > .dismiss:hover {\n background-color: ${item?.hoverBackgroundColor};\n }\n\n ${CourierToastItem.id} > .dismiss:active {\n background-color: ${item?.activeBackgroundColor};\n }\n\n ${CourierToastItem.id}:last-child${this.showDismissOnHover ? ':hover' : ''} > .dismiss {\n visibility: ${this.showDismiss ? 'visible' : 'hidden'};\n opacity: 100%;\n transition: 0.2s ease-in-out;\n }\n `;\n\n const autoDismissStyles = `\n ${CourierToastItem.id} > .overflow-hidden-container > .auto-dismiss {\n width: 100%;\n height: 5px;\n background-color: ${item?.autoDismissBarColor};\n animation: auto-dismiss ${this._autoDismissTimeoutMs}ms ease-in-out forwards;\n }\n\n @keyframes auto-dismiss {\n 100% {\n width: 0px;\n }\n }\n `;\n\n // Styles for the text and icon content.\n const contentStyles = `\n ${CourierToastItem.id} > .overflow-hidden-container > .content {\n display: flex;\n gap: 12px;\n align-items: center;\n align-self: stretch;\n box-sizing: border-box;\n padding: 12px;\n }\n\n ${CourierToastItem.id} > .overflow-hidden-container > .content > .text-content {\n }\n\n ${CourierToastItem.id} > .overflow-hidden-container > .content > .icon {\n }\n\n ${CourierToastItem.id} > .overflow-hidden-container > .content > .text-content > .title {\n margin: 0;\n font-weight: ${item?.title?.weight};\n font-size: ${item?.title?.size};\n color: ${item?.title?.color};\n }\n\n ${CourierToastItem.id} > .overflow-hidden-container > .content > .text-content > .body {\n margin: 8px 0 0 0;\n font-weight: ${item?.body?.weight};\n font-size: ${item?.body?.size};\n line-height: 150%;\n color: ${item?.body?.color};\n }\n `;\n\n const actionStyles = `\n ${CourierToastItem.id} > .overflow-hidden-container > .content > .text-content > .actions-container {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n }\n `;\n\n return [\n toastStyles,\n toastStackStyles,\n toastItemStyles,\n dismissStyles,\n autoDismissStyles,\n contentStyles,\n actionStyles,\n ].join('');\n }\n\n /** Get the top item's (i.e. the fully visible item's) height. */\n private get topStackItemHeight(): string {\n if (this.lastChild) {\n const height = (this.lastChild as HTMLDivElement).getBoundingClientRect().height;\n return `${height}px`;\n }\n\n return '0px';\n }\n\n private resizeContainerToHeight(height: string) {\n this.style.height = height;\n }\n\n /** Whether the dismiss button should only be shown on hover. */\n private get showDismissOnHover(): boolean {\n // Auto-dismiss is enabled and button is using 'auto' behavior (show w/o auto-dismiss, show on hover w/ auto-dismiss).\n if (this._autoDismiss && this._dismissButtonOption === 'auto') {\n return true;\n }\n\n // Explicitly set to show on hover\n if (this._dismissButtonOption === 'hover') {\n return true;\n }\n\n return false;\n }\n\n /** Whether to show the dismiss button. The button is visible (either always or on hover) if not explicitly disabled. */\n private get showDismiss(): boolean {\n return this._dismissButtonOption !== 'hidden';\n }\n\n /** @override */\n static get id() {\n return 'courier-toast';\n }\n\n private static isDismissButtonOption(value: string): value is CourierToastDismissButtonOption {\n const validOptions: CourierToastDismissButtonOption[] = ['visible', 'hidden', 'hover', 'auto'];\n return validOptions.includes(value as CourierToastDismissButtonOption);\n }\n}\n\nregisterElement(CourierToast);\n","export * from './components/courier-toast';\r\nexport * from './components/courier-toast-item';\r\nexport * from './types/courier-toast-theme';\r\nexport * from './types/courier-toast-theme-manager';\r\nexport * from './types/toast';\r\nexport * from './datastore/toast-datastore';\r\nexport * from './datastore/toast-datastore-listener';\r\nexport * from './datastore/toast-datastore-events';\r\n\r\nimport { Courier } from \"@trycourier/courier-js\";\r\n\r\nCourier.shared.courierUserAgentName = \"courier-ui-toast\";\r\nCourier.shared.courierUserAgentVersion = __PACKAGE_VERSION__;\r\n\r\n// Re-export Courier from courier-js for direct import\r\nexport { Courier };\r\n\r\n// Re-export types from courier-js\r\nexport type {\r\n CourierProps,\r\n CourierClientOptions,\r\n CourierBrand,\r\n CourierApiUrls,\r\n CourierUserPreferences,\r\n CourierUserPreferencesStatus,\r\n CourierUserPreferencesChannel,\r\n CourierUserPreferencesPaging,\r\n CourierUserPreferencesTopic,\r\n CourierUserPreferencesTopicResponse,\r\n CourierDevice,\r\n CourierToken,\r\n CourierGetInboxMessageResponse,\r\n CourierGetInboxMessagesResponse,\r\n InboxMessage,\r\n InboxAction,\r\n InboxMessageEventEnvelope,\r\n} from '@trycourier/courier-js';\r\n\r\n// Re-export types from courier-ui-core\r\nexport type {\r\n CourierComponentThemeMode\r\n} from '@trycourier/courier-ui-core'\r\n","import { InboxMessage } from \"@trycourier/courier-js\";\n\n/**\n * The set of {@link CourierToastDatastore} events for which listeners can be added.\n *\n * @public\n */\nexport class CourierToastDatastoreEvents {\n public onMessageAdd?(_: InboxMessage): void { }\n public onMessageRemove?(_: InboxMessage): void { }\n public onError?(_: Error): void { }\n}\n"],"names":["defaultLightTheme","item","backgroundColor","CourierColors","white","hoverBackgroundColor","gray","activeBackgroundColor","shadow","black","border","borderRadius","title","size","weight","color","body","icon","svg","CourierIconSVGs","inbox","dismissIcon","remove","autoDismissBarColor","blue","actions","font","defaultDarkTheme","mergeTheme","mode","theme","defaultTheme","_a","_b","_c","_d","_e","_f","_g","_h","CourierToastThemeManager","CourierThemeManager","constructor","initialTheme","super","__publicField","this","getDefaultLightTheme","getDefaultDarkTheme","subscribe","callback","manager","_CourierToastItem","CourierBaseElement","props","_message","message","_autoDismiss","autoDismiss","_autoDismissTimeoutMs","autoDismissTimeoutMs","_themeManager","themeManager","_themeSubscription","_","render","onItemDismissed","handler","_onItemDismissedCallback","onToastItemClick","_onToastItemClickCallback","onToastItemActionClick","_onToastItemActionClickCallback","setToastItemContent","factory","_customToastItemContent","dismiss","timeoutMs","dismissAnimationTimeoutMs","classList","add","setTimeout","onComponentMounted","onComponentUnmounted","unsubscribe","getTheme","id","observedAttributes","firstChild","removeChild","removeEventListener","onClick","overflowHiddenContainer","document","createElement","appendChild","append","createDefaultContent","addEventListener","CourierIcon","event","stopPropagation","content","textContent","preview","messageHasActions","actionsContainer","forEach","action","button","createActionButton","length","actionsTheme","CourierButton","text","variant","fontFamily","family","fontSize","fontWeight","textColor","CourierToastItem","registerElement","_CourierToastDatastore","shared","instance","addDatastoreListener","listener","_datastoreListeners","push","removeDatastoreListener","filter","l","listenForMessages","socketClient","Courier","client","socket","options","logger","info","addMessageEventListener","messageEvent","InboxMessageEvent","NewMessage","data","addMessage","isConnecting","isOpen","connectionId","connect","error","events","onError","call","toastIndexOfMessage","position","_dataset","findIndex","m","messageId","onMessageAdd","removeMessage","index","splice","onMessageRemove","CourierToastDatastore","CourierToastDatastoreListener","_CourierToast","width","top","right","zIndex","refreshStyles","_datastoreListener","datastoreAddMessageListener","bind","datastoreRemoveMessageListener","_onItemClick","_onItemActionClick","enableAutoDismiss","disableAutoDismiss","setAutoDismissTimeoutMs","setLightTheme","setDarkTheme","setDismissButton","option","_dismissButtonOption","setMode","setToastItem","_customToastItem","dismissToastForMessage","childNodes","node","dataset","courierMessageId","_toastStyle","injectGlobalStyle","getStyles","addAuthenticationListener","authChangedCallback","_authListener","cleanup","attributeChangedCallback","name","newValue","parseInt","isDismissButtonOption","JSON","parse","removeAllItems","addToastItem","toastItem","createToastItem","resizeContainerToHeight","topStackItemHeight","createCustomToastItem","createDefaultToastItem","Error","customItem","_defaultLayoutProps","showDismissOnHover","showDismiss","join","lastChild","getBoundingClientRect","height","style","value","includes","CourierToast","courierUserAgentName","courierUserAgentVersion"],"mappings":"gjBAwCO,MAAMA,EAAuC,CAClDC,KAAM,CACJC,gBAAiBC,EAAAA,cAAcC,MAAM,KACrCC,qBAAsBF,EAAAA,cAAcG,KAAK,KACzCC,sBAAuBJ,EAAAA,cAAcG,KAAK,KAC1CE,OAAQ,oBAAoBL,EAAAA,cAAcM,MAAM,SAChDC,OAAQ,aAAaP,EAAAA,cAAcG,KAAK,OACxCK,aAAc,MACdC,MAAO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