@trycourier/courier-ui-inbox 1.0.2-beta → 1.0.4-beta

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/index.es.js DELETED
@@ -1,3439 +0,0 @@
1
- var Lo = Object.defineProperty;
2
- var To = (g, i, e) => i in g ? Lo(g, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[i] = e;
3
- var a = (g, i, e) => To(g, typeof i != "symbol" ? i + "" : i, e);
4
- import { Courier as C } from "@trycourier/courier-js";
5
- var Bo = Object.defineProperty, Ao = (g, i, e) => i in g ? Bo(g, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[i] = e, L = (g, i, e) => Ao(g, typeof i != "symbol" ? i + "" : i, e);
6
- const r = {
7
- black: {
8
- 500: "#171717",
9
- 50010: "#1717171A",
10
- 50020: "#17171733"
11
- },
12
- gray: {
13
- 200: "#F5F5F5",
14
- 400: "#3A3A3A",
15
- 500: "#E5E5E5",
16
- 600: "#737373"
17
- },
18
- white: {
19
- 500: "#FFFFFF",
20
- 50010: "#FFFFFF1A",
21
- 50020: "#FFFFFF33"
22
- },
23
- blue: {
24
- 400: "#60A5FA",
25
- 500: "#2563EB"
26
- }
27
- }, G = {
28
- light: {
29
- colors: {
30
- primary: r.black[500],
31
- secondary: r.white[500],
32
- border: r.gray[500],
33
- link: r.blue[500],
34
- icon: r.black[500]
35
- },
36
- button: {
37
- cornerRadius: "4px"
38
- }
39
- },
40
- dark: {
41
- colors: {
42
- primary: r.white[500],
43
- secondary: r.black[500],
44
- border: r.gray[400],
45
- link: r.blue[400],
46
- icon: r.white[500]
47
- },
48
- button: {
49
- cornerRadius: "4px"
50
- }
51
- }
52
- }, go = () => typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", mo = (g) => {
53
- if (typeof window > "u")
54
- return () => {
55
- };
56
- const i = window.matchMedia("(prefers-color-scheme: dark)"), e = (t) => {
57
- g(t.matches ? "dark" : "light");
58
- };
59
- return i.addEventListener("change", e), () => {
60
- i.removeEventListener("change", e);
61
- };
62
- };
63
- class bo extends HTMLElement {
64
- constructor() {
65
- super(), L(this, "_currentSystemTheme"), L(this, "_systemThemeCleanup"), this._currentSystemTheme = go(), this._systemThemeCleanup = mo((i) => {
66
- this._currentSystemTheme = i, this.onSystemThemeChange(i);
67
- });
68
- }
69
- get currentSystemTheme() {
70
- return this._currentSystemTheme;
71
- }
72
- disconnectedCallback() {
73
- this._systemThemeCleanup && this._systemThemeCleanup();
74
- }
75
- onSystemThemeChange(i) {
76
- }
77
- }
78
- const Te = {
79
- borderRadius: "4px",
80
- fontSize: "14px"
81
- }, ee = {
82
- primary: (g) => ({
83
- ...Te,
84
- backgroundColor: G[g].colors.primary,
85
- textColor: G[g].colors.secondary,
86
- fontWeight: "500",
87
- shadow: "none"
88
- }),
89
- secondary: (g) => ({
90
- ...Te,
91
- backgroundColor: G[g].colors.secondary,
92
- textColor: G[g].colors.primary,
93
- fontWeight: "500",
94
- border: `1px solid ${G[g].colors.border}`,
95
- shadow: g === "light" ? "0px 1px 2px 0px rgba(0, 0, 0, 0.06)" : "0px 1px 2px 0px rgba(255, 255, 255, 0.1)"
96
- }),
97
- tertiary: (g) => ({
98
- ...Te,
99
- backgroundColor: G[g].colors.border,
100
- textColor: G[g].colors.primary,
101
- fontWeight: "500",
102
- border: "none",
103
- shadow: "none"
104
- })
105
- };
106
- class Ie extends bo {
107
- constructor(i) {
108
- super(), L(this, "_button"), L(this, "_style");
109
- const e = this.attachShadow({ mode: "open" });
110
- this._button = document.createElement("button"), this._button.setAttribute("part", "button"), this._style = document.createElement("style"), this._style.textContent = this.getStyles(i), e.appendChild(this._style), e.appendChild(this._button), this.updateButton(i), this._button.addEventListener("click", (t) => {
111
- t.preventDefault(), t.stopPropagation(), i.onClick && i.onClick();
112
- });
113
- }
114
- getStyles(i) {
115
- const e = () => ee.secondary(this.currentSystemTheme).textColor, t = () => ee.secondary(this.currentSystemTheme).backgroundColor, s = () => ee.secondary(this.currentSystemTheme).border, o = () => ee.secondary(this.currentSystemTheme).shadow, n = () => ee.secondary(this.currentSystemTheme).borderRadius, h = () => ee.secondary(this.currentSystemTheme).fontSize, d = () => ee.secondary(this.currentSystemTheme).fontWeight;
116
- return `
117
- :host {
118
- display: inline-block;
119
- }
120
-
121
- button {
122
- border: none;
123
- border-radius: ${i.borderRadius ?? n()};
124
- font-weight: ${i.fontWeight ?? d()};
125
- font-family: ${i.fontFamily ?? "inherit"};
126
- font-size: ${i.fontSize ?? h()};
127
- padding: 6px 10px;
128
- cursor: pointer;
129
- width: 100%;
130
- height: 100%;
131
- background-color: ${i.backgroundColor ?? t()};
132
- color: ${i.textColor ?? e()};
133
- border: ${i.border ?? s()};
134
- box-shadow: ${i.shadow ?? o()};
135
- touch-action: manipulation;
136
- }
137
-
138
- button:hover {
139
- ${i.hoverBackgroundColor ? `background-color: ${i.hoverBackgroundColor};` : "filter: brightness(0.9);"}
140
- }
141
-
142
- button:active {
143
- ${i.activeBackgroundColor ? `background-color: ${i.activeBackgroundColor};` : "filter: brightness(0.8);"}
144
- }
145
-
146
- button:disabled {
147
- opacity: 0.5;
148
- cursor: not-allowed;
149
- }
150
- `;
151
- }
152
- updateButton(i) {
153
- i.text && (this._button.textContent = i.text), this._style.textContent = this.getStyles(i);
154
- }
155
- }
156
- customElements.get("courier-button") || customElements.define("courier-button", Ie);
157
- const f = {
158
- inbox: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
159
- <path d="M5.5 14.5V17C5.5 17.2812 5.71875 17.5 6 17.5H18C18.25 17.5 18.5 17.2812 18.5 17V14.5H15.9375L15.2812 15.8125C15.0938 16.25 14.6562 16.5 14.1875 16.5H9.78125C9.3125 16.5 8.875 16.25 8.6875 15.8125L8.03125 14.5H5.5ZM18.1875 13L16.6562 6.90625C16.5938 6.65625 16.4062 6.5 16.1875 6.5H7.8125C7.5625 6.5 7.375 6.65625 7.3125 6.90625L5.78125 13H8.1875C8.65625 13 9.09375 13.2812 9.3125 13.7188L9.9375 15H14.0312L14.6875 13.7188C14.875 13.2812 15.3125 13 15.7812 13H18.1875ZM4 14.25C4 14.0938 4 13.9375 4.03125 13.7812L5.84375 6.53125C6.09375 5.625 6.875 5 7.8125 5H16.1875C17.0938 5 17.9062 5.625 18.125 6.53125L19.9375 13.7812C19.9688 13.9375 20 14.0938 20 14.25V17C20 18.125 19.0938 19 18 19H6C4.875 19 4 18.125 4 17V14.25Z" fill="currentColor"/>
160
- </svg>`,
161
- archive: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
162
- <path d="M5.5 6.5V8H18.5V6.5H5.5ZM5 5H19C19.5312 5 20 5.46875 20 6V8.5C20 9.0625 19.5312 9.5 19 9.5H5C4.4375 9.5 4 9.0625 4 8.5V6C4 5.46875 4.4375 5 5 5ZM9 11.75C9 11.3438 9.3125 11 9.75 11H14.25C14.6562 11 15 11.3438 15 11.75C15 12.1875 14.6562 12.5 14.25 12.5H9.75C9.3125 12.5 9 12.1875 9 11.75ZM5 17V10.5H6.5V17C6.5 17.2812 6.71875 17.5 7 17.5H17C17.25 17.5 17.5 17.2812 17.5 17V10.5H19V17C19 18.125 18.0938 19 17 19H7C5.875 19 5 18.125 5 17Z" fill="currentColor"/>
163
- </svg>`,
164
- check: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
165
- <path d="M18.793 7.33203C19.0742 7.64453 19.0742 8.11328 18.793 8.39453L10.543 16.6445C10.2305 16.957 9.76172 16.957 9.48047 16.6445L5.23047 12.3945C4.91797 12.1133 4.91797 11.6445 5.23047 11.3633C5.51172 11.0508 5.98047 11.0508 6.26172 11.3633L9.98047 15.082L17.7305 7.33203C18.0117 7.05078 18.4805 7.05078 18.7617 7.33203H18.793Z" fill="currentColor"/>
166
- </svg>`,
167
- filter: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
168
- <path d="M5 7C5 6.59375 5.3125 6.25 5.75 6.25H18.25C18.6562 6.25 19 6.59375 19 7C19 7.4375 18.6562 7.75 18.25 7.75H5.75C5.3125 7.75 5 7.4375 5 7ZM7 12C7 11.5938 7.3125 11.25 7.75 11.25H16.25C16.6562 11.25 17 11.5938 17 12C17 12.4375 16.6562 12.75 16.25 12.75H7.75C7.3125 12.75 7 12.4375 7 12ZM14 17C14 17.4375 13.6562 17.75 13.25 17.75H10.75C10.3125 17.75 10 17.4375 10 17C10 16.5938 10.3125 16.25 10.75 16.25H13.25C13.6562 16.25 14 16.5938 14 17Z" fill="currentColor"/>
169
- </svg>`,
170
- overflow: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
171
- <path d="M18.5117 11.9883C18.5117 12.5508 18.1992 13.0195 17.7617 13.3008C17.293 13.582 16.6992 13.582 16.2617 13.3008C15.793 13.0195 15.5117 12.5508 15.5117 11.9883C15.5117 11.457 15.793 10.9883 16.2617 10.707C16.6992 10.4258 17.293 10.4258 17.7617 10.707C18.1992 10.9883 18.5117 11.457 18.5117 11.9883ZM13.5117 11.9883C13.5117 12.5508 13.1992 13.0195 12.7617 13.3008C12.293 13.582 11.6992 13.582 11.2617 13.3008C10.793 13.0195 10.5117 12.5508 10.5117 11.9883C10.5117 11.457 10.793 10.9883 11.2617 10.707C11.6992 10.4258 12.293 10.4258 12.7617 10.707C13.1992 10.9883 13.5117 11.457 13.5117 11.9883ZM7.01172 13.4883C6.44922 13.4883 5.98047 13.207 5.69922 12.7383C5.41797 12.3008 5.41797 11.707 5.69922 11.2383C5.98047 10.8008 6.44922 10.4883 7.01172 10.4883C7.54297 10.4883 8.01172 10.8008 8.29297 11.2383C8.57422 11.707 8.57422 12.3008 8.29297 12.7383C8.01172 13.207 7.54297 13.4883 7.01172 13.4883Z" fill="currentColor"/>
172
- </svg>`,
173
- read: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
174
- <path d="M7 6.5C6.71875 6.5 6.5 6.75 6.5 7V17C6.5 17.2812 6.71875 17.5 7 17.5H17C17.25 17.5 17.5 17.2812 17.5 17V7C17.5 6.75 17.25 6.5 17 6.5H7ZM5 7C5 5.90625 5.875 5 7 5H17C18.0938 5 19 5.90625 19 7V17C19 18.125 18.0938 19 17 19H7C5.875 19 5 18.125 5 17V7ZM15.5312 10.5312L11.5312 14.5312C11.2188 14.8438 10.75 14.8438 10.4688 14.5312L8.46875 12.5312C8.15625 12.25 8.15625 11.7812 8.46875 11.5C8.75 11.1875 9.21875 11.1875 9.53125 11.5L11 12.9688L14.4688 9.46875C14.75 9.1875 15.2188 9.1875 15.5 9.46875C15.8125 9.78125 15.8125 10.25 15.5 10.5312H15.5312Z" fill="currentColor"/>
175
- </svg>`,
176
- archiveRead: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
177
- <path d="M7.5 6.5V15.25H16.5V6.5H7.5ZM6 15.25V6.5C6 5.6875 6.65625 5 7.5 5H16.5C17.3125 5 18 5.6875 18 6.5V15.25C18.4062 15.25 18.75 15.5938 18.75 16C18.75 16.4375 18.4062 16.75 18 16.75H6C5.5625 16.75 5.25 16.4375 5.25 16C5.25 15.5938 5.5625 15.25 6 15.25ZM5 13V14.5H4.5V17.5H19.5V14.5H19V13H19.5C20.3125 13 21 13.6875 21 14.5V17.5C21 18.3438 20.3125 19 19.5 19H4.5C3.65625 19 3 18.3438 3 17.5V14.5C3 13.6875 3.65625 13 4.5 13H5ZM15.0312 9.625L11.6875 12.9688C11.5312 13.0938 11.3438 13.1875 11.1562 13.1875C10.9375 13.1875 10.75 13.0938 10.625 12.9688L8.96875 11.2812C8.65625 11 8.65625 10.5312 8.96875 10.25C9.25 9.9375 9.71875 9.9375 10 10.25L11.1562 11.375L13.9688 8.5625C14.25 8.28125 14.7188 8.28125 15 8.5625C15.3125 8.875 15.3125 9.34375 15 9.625H15.0312Z" fill="currentColor"/>
178
- </svg>`,
179
- unread: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
180
- <path d="M17 6.5H7C6.71875 6.5 6.5 6.75 6.5 7V17C6.5 17.2812 6.71875 17.5 7 17.5H17C17.25 17.5 17.5 17.2812 17.5 17V7C17.5 6.75 17.25 6.5 17 6.5ZM7 5H17C18.0938 5 19 5.90625 19 7V17C19 18.125 18.0938 19 17 19H7C5.875 19 5 18.125 5 17V7C5 5.90625 5.875 5 7 5Z" fill="currentColor"/>
181
- </svg>`,
182
- unarchive: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
183
- <path d="M5.5 11C5.0625 11 4.75 10.6875 4.75 10.25V5.75C4.75 5.34375 5.0625 5 5.5 5C5.90625 5 6.25 5.34375 6.25 5.75V8.28125L6.875 7.53125C8.15625 6 10.0625 5 12.25 5C16.0938 5 19.25 8.15625 19.25 12C19.25 15.875 16.0938 19 12.25 19C10.6562 19 9.21875 18.5 8.03125 17.625C7.71875 17.375 7.625 16.9062 7.875 16.5625C8.125 16.2188 8.59375 16.1562 8.9375 16.4062C9.84375 17.0938 11 17.5 12.25 17.5C15.2812 17.5 17.75 15.0625 17.75 12C17.75 8.96875 15.2812 6.5 12.25 6.5C10.5312 6.5 9.03125 7.28125 8 8.5L7.15625 9.5H10C10.4062 9.5 10.75 9.84375 10.75 10.25C10.75 10.6875 10.4062 11 10 11H5.5Z" fill="currentColor"/>
184
- </svg>`
185
- };
186
- class ie extends HTMLElement {
187
- constructor(i, e) {
188
- super(), L(this, "_color"), L(this, "_svg"), L(this, "_iconContainer"), L(this, "_style"), this._color = i ?? r.black[500], this._svg = e;
189
- const t = this.attachShadow({ mode: "open" });
190
- this._iconContainer = document.createElement("div"), t.appendChild(this._iconContainer), this._style = document.createElement("style"), this._style.textContent = this.getStyles(this._color), t.appendChild(this._style), this.refresh();
191
- }
192
- getStyles(i) {
193
- return `
194
- :host {
195
- display: inline-block;
196
- line-height: 0;
197
- display: flex;
198
- align-items: center;
199
- justify-content: center;
200
- }
201
-
202
- svg {
203
- width: 24px;
204
- height: 24px;
205
- color: ${i};
206
- }
207
- `;
208
- }
209
- refresh() {
210
- this._svg && (this._iconContainer.innerHTML = this._svg), this._color && (this._style.textContent = this.getStyles(this._color));
211
- }
212
- updateColor(i) {
213
- this._color = i, this.refresh();
214
- }
215
- updateSVG(i) {
216
- this._svg = i, this.refresh();
217
- }
218
- }
219
- customElements.get("courier-icon") || customElements.define("courier-icon", ie);
220
- class De extends HTMLElement {
221
- constructor() {
222
- super(), L(this, "link");
223
- const i = this.attachShadow({ mode: "open" });
224
- this.link = document.createElement("a"), this.link.setAttribute("part", "link");
225
- const e = document.createElement("style");
226
- e.textContent = `
227
- :host {
228
- display: inline-block;
229
- }
230
-
231
- a {
232
- text-decoration: none;
233
- border-radius: 4px;
234
- cursor: pointer;
235
- font-weight: 500;
236
- transition: all 0.2s ease;
237
- font-family: var(--courier-link-font-family, inherit);
238
- font-size: var(--courier-link-font-size, inherit);
239
- }
240
-
241
- /* Variants */
242
- a[data-variant="primary"][data-mode="light"] {
243
- color: var(--courier-link-color, ${G.light.colors.link});
244
- }
245
-
246
- a[data-variant="primary"][data-mode="light"]:hover {
247
- opacity: 0.8;
248
- }
249
-
250
- a[data-variant="primary"][data-mode="light"]:active {
251
- opacity: 0.6;
252
- }
253
-
254
- a[data-variant="primary"][data-mode="dark"] {
255
- color: var(--courier-link-color, ${G.dark.colors.link});
256
- }
257
-
258
- a[data-variant="primary"][data-mode="dark"]:hover {
259
- opacity: 0.8;
260
- }
261
-
262
- a[data-variant="primary"][data-mode="dark"]:active {
263
- opacity: 0.6;
264
- }
265
-
266
- a[data-underline="true"] {
267
- text-decoration: underline;
268
- }
269
-
270
- a:disabled {
271
- opacity: 0.6;
272
- cursor: not-allowed;
273
- pointer-events: none;
274
- }
275
- `, i.appendChild(e), i.appendChild(this.link), this.updateVariant(), this.updateUnderline(), this.updateMode();
276
- }
277
- connectedCallback() {
278
- const i = document.createElement("slot");
279
- this.link.appendChild(i), this.updateHref();
280
- }
281
- attributeChangedCallback(i, e, t) {
282
- if (e !== t)
283
- switch (i) {
284
- case "href":
285
- this.updateHref();
286
- break;
287
- case "variant":
288
- case "mode":
289
- this.updateVariant();
290
- break;
291
- case "disabled":
292
- this.link.style.pointerEvents = this.hasAttribute("disabled") ? "none" : "auto", this.link.style.opacity = this.hasAttribute("disabled") ? "0.6" : "1";
293
- break;
294
- case "color":
295
- this.updateColor();
296
- break;
297
- case "underline":
298
- this.updateUnderline();
299
- break;
300
- case "target":
301
- this.updateTarget();
302
- break;
303
- case "font-family":
304
- this.updateFontFamily();
305
- break;
306
- case "font-size":
307
- this.updateFontSize();
308
- break;
309
- }
310
- }
311
- updateHref() {
312
- const i = this.getAttribute("href");
313
- i && (this.link.href = i);
314
- }
315
- updateVariant() {
316
- const i = this.getAttribute("variant") || "primary", e = this.getAttribute("mode") || "light";
317
- this.link.setAttribute("data-variant", i), this.link.setAttribute("data-mode", e);
318
- }
319
- updateColor() {
320
- const i = this.getAttribute("color");
321
- i ? this.link.style.setProperty("--courier-link-color", i) : this.link.style.removeProperty("--courier-link-color");
322
- }
323
- updateUnderline() {
324
- const i = this.getAttribute("underline") === "true";
325
- this.link.setAttribute("data-underline", i.toString());
326
- }
327
- updateMode() {
328
- const i = this.getAttribute("mode") || "light";
329
- this.link.setAttribute("data-mode", i);
330
- }
331
- updateTarget() {
332
- const i = this.getAttribute("target");
333
- i && (this.link.target = i);
334
- }
335
- updateFontFamily() {
336
- const i = this.getAttribute("font-family");
337
- i ? this.link.style.setProperty("--courier-link-font-family", i) : this.link.style.removeProperty("--courier-link-font-family");
338
- }
339
- updateFontSize() {
340
- const i = this.getAttribute("font-size");
341
- i ? this.link.style.setProperty("--courier-link-font-size", i) : this.link.style.removeProperty("--courier-link-font-size");
342
- }
343
- }
344
- L(De, "observedAttributes", [
345
- "href",
346
- "variant",
347
- "disabled",
348
- "color",
349
- "underline",
350
- "mode",
351
- "target",
352
- "font-family",
353
- "font-size"
354
- ]);
355
- customElements.get("courier-link") || customElements.define("courier-link", De);
356
- class Le extends bo {
357
- constructor() {
358
- super(), L(this, "shadow"), this.shadow = this.attachShadow({ mode: "open" });
359
- }
360
- // Build the element with a factory function
361
- build(i) {
362
- if (i === null) {
363
- this.shadow.replaceChildren();
364
- return;
365
- }
366
- const e = i ?? this.defaultElement();
367
- this.shadow.replaceChildren(e);
368
- }
369
- // Default element to be used if no factory is provided
370
- defaultElement() {
371
- const i = document.createElement("div");
372
- return i.textContent = "Default Element Factory", i.style.cssText = `
373
- background-color: red;
374
- text-align: center;
375
- padding: 12px;
376
- `, i;
377
- }
378
- }
379
- class Ee extends Le {
380
- constructor(i) {
381
- super(), L(this, "_props"), L(this, "_title"), L(this, "_button"), L(this, "_style"), L(this, "_buttonClickCallback", null), this._props = i;
382
- }
383
- defaultElement() {
384
- var i, e;
385
- const t = document.createElement("div");
386
- return this._title = document.createElement("h2"), (i = this._props.title) != null && i.text && (this._title.textContent = this._props.title.text), this._button = new Ie(this._props.button ?? ee.secondary(this.currentSystemTheme)), this._style = document.createElement("style"), this._style.textContent = this.getStyles(this._props), t.className = "container", t.appendChild(this._style), t.appendChild(this._title), t.appendChild(this._button), this.shadow.appendChild(t), (e = this._button) == null || e.addEventListener("click", () => {
387
- this._buttonClickCallback && this._buttonClickCallback();
388
- }), t;
389
- }
390
- onSystemThemeChange(i) {
391
- this.updateStyles(this._props);
392
- }
393
- getStyles(i) {
394
- var e, t, s, o;
395
- return `
396
- :host {
397
- display: flex;
398
- align-items: center;
399
- justify-content: center;
400
- height: 100%;
401
- width: 100%;
402
- }
403
-
404
- .container {
405
- display: flex;
406
- flex-direction: column;
407
- align-items: center;
408
- justify-content: center;
409
- gap: 16px;
410
- text-align: center;
411
- padding: 24px;
412
- }
413
-
414
- .container h2 {
415
- margin: 0;
416
- color: ${((e = i.title) == null ? void 0 : e.textColor) ?? "red"};
417
- font-size: ${((t = i.title) == null ? void 0 : t.fontSize) ?? "16px"};
418
- font-weight: ${((s = i.title) == null ? void 0 : s.fontWeight) ?? "500"};
419
- font-family: ${((o = i.title) == null ? void 0 : o.fontFamily) ?? "inherit"};
420
- }
421
- `;
422
- }
423
- updateStyles(i) {
424
- this._props = i, this._style && (this._style.textContent = this.getStyles(i)), this._button && this._button.updateButton(i.button);
425
- }
426
- setButtonClickCallback(i) {
427
- this._buttonClickCallback = i;
428
- }
429
- }
430
- customElements.get("courier-info-state") || customElements.define("courier-info-state", Ee);
431
- class Se extends HTMLElement {
432
- constructor(i, e, t, s, o, n, h, d) {
433
- super(), L(this, "_backgroundColor"), L(this, "_hoverBackgroundColor"), L(this, "_activeBackgroundColor"), L(this, "_borderRadius"), L(this, "_height"), L(this, "_width"), L(this, "_style"), L(this, "_button"), L(this, "_icon"), this._borderRadius = n, this._backgroundColor = t, this._hoverBackgroundColor = s, this._activeBackgroundColor = o, this._height = h, this._width = d;
434
- const c = this.attachShadow({ mode: "open" });
435
- this._button = document.createElement("button"), this._button.setAttribute("part", "button"), this._icon = new ie(e, i), this._style = document.createElement("style"), this.refresh(), c.appendChild(this._style), this._button.appendChild(this._icon), c.appendChild(this._button);
436
- }
437
- refresh() {
438
- this._style.textContent = this.getStyles();
439
- }
440
- getStyles() {
441
- return `
442
- :host {
443
- display: inline-block;
444
- border-radius: ${this._borderRadius ?? "50%"};
445
- }
446
-
447
- button {
448
- border: none;
449
- border-radius: ${this._borderRadius ?? "50%"};
450
- cursor: pointer;
451
- width: ${this._width ?? "36px"};
452
- height: ${this._height ?? "36px"};
453
- display: flex;
454
- align-items: center;
455
- justify-content: center;
456
- background: ${this._backgroundColor ?? "transparent"};
457
- transition: background-color 0.2s ease;
458
- touch-action: manipulation;
459
- }
460
-
461
- button:hover {
462
- background-color: ${this._hoverBackgroundColor ?? "red"};
463
- }
464
-
465
- button:active {
466
- background-color: ${this._activeBackgroundColor ?? "red"};
467
- }
468
-
469
- button:disabled {
470
- opacity: 0.6;
471
- cursor: not-allowed;
472
- }
473
-
474
- [part="icon"] {
475
- display: flex;
476
- align-items: center;
477
- justify-content: center;
478
- width: 24px;
479
- height: 24px;
480
- }
481
- `;
482
- }
483
- updateIconColor(i) {
484
- this._icon.updateColor(i);
485
- }
486
- updateIconSVG(i) {
487
- this._icon.updateSVG(i);
488
- }
489
- updateBackgroundColor(i) {
490
- this._backgroundColor = i, this.refresh();
491
- }
492
- updateHoverBackgroundColor(i) {
493
- this._hoverBackgroundColor = i, this.refresh();
494
- }
495
- updateActiveBackgroundColor(i) {
496
- this._activeBackgroundColor = i, this.refresh();
497
- }
498
- }
499
- customElements.get("courier-icon-button") || customElements.define("courier-icon-button", Se);
500
- const Do = [
501
- { name: "courier-button", class: Ie },
502
- { name: "courier-icon", class: ie },
503
- { name: "courier-link", class: De },
504
- { name: "courier-info-state", class: Ee },
505
- { name: "courier-icon-button", class: Se }
506
- ];
507
- Do.forEach(({ name: g, class: i }) => {
508
- customElements.get(g) || customElements.define(g, i);
509
- });
510
- const te = class te {
511
- constructor() {
512
- a(this, "_inboxDataSet");
513
- a(this, "_archiveDataSet");
514
- a(this, "_dataStoreListeners", []);
515
- a(this, "_unreadCount");
516
- a(this, "isPaginatingInbox", !1);
517
- a(this, "isPaginatingArchive", !1);
518
- }
519
- static get shared() {
520
- return te.instance || (te.instance = new te()), te.instance;
521
- }
522
- get unreadCount() {
523
- return this._unreadCount ?? 0;
524
- }
525
- get inboxDataSet() {
526
- return this._inboxDataSet ?? { messages: [], canPaginate: !1, paginationCursor: null };
527
- }
528
- get archiveDataSet() {
529
- return this._archiveDataSet ?? { messages: [], canPaginate: !1, paginationCursor: null };
530
- }
531
- addDataStoreListener(i) {
532
- this._dataStoreListeners.push(i);
533
- }
534
- removeDataStoreListener(i) {
535
- this._dataStoreListeners = this._dataStoreListeners.filter((e) => e !== i);
536
- }
537
- async fetchDataSet(i) {
538
- var t, s, o, n, h, d, c, u, m, p;
539
- if (i.canUseCache)
540
- switch (i.feedType) {
541
- case "inbox":
542
- if (this._inboxDataSet)
543
- return this._inboxDataSet;
544
- break;
545
- case "archive":
546
- if (this._archiveDataSet)
547
- return this._archiveDataSet;
548
- break;
549
- }
550
- const e = i.feedType === "inbox" ? await ((t = C.shared.client) == null ? void 0 : t.inbox.getMessages()) : await ((s = C.shared.client) == null ? void 0 : s.inbox.getArchivedMessages());
551
- return {
552
- messages: ((n = (o = e == null ? void 0 : e.data) == null ? void 0 : o.messages) == null ? void 0 : n.nodes) ?? [],
553
- canPaginate: ((c = (d = (h = e == null ? void 0 : e.data) == null ? void 0 : h.messages) == null ? void 0 : d.pageInfo) == null ? void 0 : c.hasNextPage) ?? !1,
554
- paginationCursor: ((p = (m = (u = e == null ? void 0 : e.data) == null ? void 0 : u.messages) == null ? void 0 : m.pageInfo) == null ? void 0 : p.startCursor) ?? null
555
- };
556
- }
557
- async fetchUnreadCount(i) {
558
- var t;
559
- return i.canUseCache && this._unreadCount !== void 0 ? this._unreadCount : await ((t = C.shared.client) == null ? void 0 : t.inbox.getUnreadMessageCount()) ?? 0;
560
- }
561
- async load(i) {
562
- var e, t, s;
563
- try {
564
- if (!((e = C.shared.client) != null && e.options.userId))
565
- throw new Error("User is not signed in");
566
- const o = i ?? { feedType: "inbox", canUseCache: !0 }, [n, h] = await Promise.all([
567
- this.fetchDataSet(o),
568
- this.fetchUnreadCount(o)
569
- ]);
570
- switch (o.feedType) {
571
- case "inbox":
572
- this._inboxDataSet = n;
573
- break;
574
- case "archive":
575
- this._archiveDataSet = n;
576
- break;
577
- }
578
- this._unreadCount = h, this._dataStoreListeners.forEach((d) => {
579
- var c, u, m, p;
580
- (u = (c = d.events).onDataSetChange) == null || u.call(c, n, o.feedType), (p = (m = d.events).onUnreadCountChange) == null || p.call(m, this._unreadCount ?? 0);
581
- }), await this.connectSocket();
582
- } catch (o) {
583
- (s = (t = C.shared.client) == null ? void 0 : t.options.logger) == null || s.error("Error loading inbox:", o), this._dataStoreListeners.forEach((n) => {
584
- var h, d;
585
- (d = (h = n.events).onError) == null || d.call(h, o);
586
- });
587
- }
588
- }
589
- async connectSocket() {
590
- var e, t, s, o, n, h, d, c, u, m, p, x;
591
- const i = (e = C.shared.client) == null ? void 0 : e.inbox.socket;
592
- try {
593
- if (!i) {
594
- (s = (t = C.shared.client) == null ? void 0 : t.options.logger) == null || s.info("CourierInbox socket not available");
595
- return;
596
- }
597
- if ((h = (o = C.shared.client) == null ? void 0 : o.options.logger) == null || h.info("CourierInbox socket connectionId:", (n = C.shared.client) == null ? void 0 : n.options.connectionId), i.isConnected) {
598
- (c = (d = C.shared.client) == null ? void 0 : d.options.logger) == null || c.info("CourierInbox socket already connected. Socket will not attempt reconnection.");
599
- return;
600
- }
601
- i.receivedMessage = (_) => {
602
- this.addMessage(_, 0, "inbox");
603
- }, i.receivedMessageEvent = (_) => {
604
- let b;
605
- switch (_.messageId && (b = this.getMessage({ messageId: _.messageId })), _.event) {
606
- case "mark-all-read":
607
- this.readAllMessages({ canCallApi: !1 });
608
- break;
609
- case "read":
610
- b && this.readMessage({ message: b, canCallApi: !1 });
611
- break;
612
- case "unread":
613
- b && this.unreadMessage({ message: b, canCallApi: !1 });
614
- break;
615
- case "opened":
616
- b && this.openMessage({ message: b, canCallApi: !1 });
617
- break;
618
- case "archive":
619
- b && this.archiveMessage({ message: b, canCallApi: !1 });
620
- break;
621
- case "archive-read":
622
- this.archiveReadMessages({ canCallApi: !1 });
623
- break;
624
- case "click":
625
- b && this.clickMessage({ message: b, canCallApi: !1 });
626
- break;
627
- case "unopened":
628
- case "unarchive":
629
- break;
630
- }
631
- }, await i.connect(), await i.sendSubscribe(), i.keepAlive(), (m = (u = C.shared.client) == null ? void 0 : u.options.logger) == null || m.info("CourierInbox socket connected");
632
- } catch (_) {
633
- (x = (p = C.shared.client) == null ? void 0 : p.options.logger) == null || x.error("Failed to connect socket:", _);
634
- }
635
- }
636
- getMessage(i) {
637
- var e, t;
638
- return ((e = this._inboxDataSet) == null ? void 0 : e.messages.find((s) => s.messageId === i.messageId)) ?? ((t = this._archiveDataSet) == null ? void 0 : t.messages.find((s) => s.messageId === i.messageId));
639
- }
640
- async fetchNextPageOfMessages(i) {
641
- var e, t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $;
642
- switch (i.feedType) {
643
- case "inbox":
644
- if (this.isPaginatingInbox)
645
- return null;
646
- if ((e = this._inboxDataSet) != null && e.canPaginate && this._inboxDataSet.paginationCursor)
647
- try {
648
- this.isPaginatingInbox = !0;
649
- const y = await ((t = C.shared.client) == null ? void 0 : t.inbox.getMessages({
650
- paginationLimit: C.shared.paginationLimit,
651
- startCursor: this._inboxDataSet.paginationCursor
652
- })), B = {
653
- messages: ((o = (s = y == null ? void 0 : y.data) == null ? void 0 : s.messages) == null ? void 0 : o.nodes) ?? [],
654
- canPaginate: ((d = (h = (n = y == null ? void 0 : y.data) == null ? void 0 : n.messages) == null ? void 0 : h.pageInfo) == null ? void 0 : d.hasNextPage) ?? !1,
655
- paginationCursor: ((m = (u = (c = y == null ? void 0 : y.data) == null ? void 0 : c.messages) == null ? void 0 : u.pageInfo) == null ? void 0 : m.startCursor) ?? null
656
- };
657
- return this.addPage(B, "inbox"), B;
658
- } catch (y) {
659
- return (x = (p = C.shared.client) == null ? void 0 : p.options.logger) == null || x.error("Error fetching next page of inbox messages:", y), null;
660
- } finally {
661
- this.isPaginatingInbox = !1;
662
- }
663
- break;
664
- case "archive":
665
- if (this.isPaginatingArchive)
666
- return null;
667
- if ((_ = this._archiveDataSet) != null && _.canPaginate && this._archiveDataSet.paginationCursor)
668
- try {
669
- this.isPaginatingArchive = !0;
670
- const y = await ((b = C.shared.client) == null ? void 0 : b.inbox.getArchivedMessages({
671
- paginationLimit: C.shared.paginationLimit,
672
- startCursor: this._archiveDataSet.paginationCursor
673
- })), B = {
674
- messages: ((k = (v = y == null ? void 0 : y.data) == null ? void 0 : v.messages) == null ? void 0 : k.nodes) ?? [],
675
- canPaginate: ((M = (S = (w = y == null ? void 0 : y.data) == null ? void 0 : w.messages) == null ? void 0 : S.pageInfo) == null ? void 0 : M.hasNextPage) ?? !1,
676
- paginationCursor: ((T = (I = (E = y == null ? void 0 : y.data) == null ? void 0 : E.messages) == null ? void 0 : I.pageInfo) == null ? void 0 : T.startCursor) ?? null
677
- };
678
- return this.addPage(B, "archive"), B;
679
- } catch (y) {
680
- return ($ = (P = C.shared.client) == null ? void 0 : P.options.logger) == null || $.error("Error fetching next page of archived messages:", y), null;
681
- } finally {
682
- this.isPaginatingArchive = !1;
683
- }
684
- break;
685
- }
686
- return null;
687
- }
688
- applyLocalMessageChange(i, e) {
689
- for (const [t, s] of Object.entries(e))
690
- s !== void 0 && this.updateMessage(i, s, t);
691
- }
692
- async readMessage({ message: i, canCallApi: e = !0 }) {
693
- var o, n, h, d;
694
- if (!C.shared.client)
695
- return;
696
- const t = i;
697
- if (t.read)
698
- return;
699
- const s = {
700
- inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((c) => c.messageId === i.messageId),
701
- archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((c) => c.messageId === i.messageId)
702
- };
703
- try {
704
- i.read = (/* @__PURE__ */ new Date()).toISOString(), this.applyLocalMessageChange(i, s), e && await C.shared.client.inbox.read({ messageId: i.messageId });
705
- } catch (c) {
706
- this.applyLocalMessageChange(t, s), (d = (h = C.shared.client) == null ? void 0 : h.options.logger) == null || d.error("Error reading message:", c);
707
- }
708
- }
709
- async unreadMessage({ message: i, canCallApi: e = !0 }) {
710
- var o, n, h, d;
711
- if (!C.shared.client)
712
- return;
713
- const t = i;
714
- if (!t.read)
715
- return;
716
- const s = {
717
- inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((c) => c.messageId === i.messageId),
718
- archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((c) => c.messageId === i.messageId)
719
- };
720
- try {
721
- i.read = void 0, this.applyLocalMessageChange(i, s), e && await C.shared.client.inbox.unread({ messageId: i.messageId });
722
- } catch (c) {
723
- this.applyLocalMessageChange(t, s), (d = (h = C.shared.client) == null ? void 0 : h.options.logger) == null || d.error("Error unreading message:", c);
724
- }
725
- }
726
- async openMessage({ message: i, canCallApi: e = !0 }) {
727
- var o, n, h, d;
728
- if (!C.shared.client)
729
- return;
730
- const t = i, s = {
731
- inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((c) => c.messageId === i.messageId),
732
- archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((c) => c.messageId === i.messageId)
733
- };
734
- if (!(!s.inbox && !s.archive) && !t.opened)
735
- try {
736
- i.opened = (/* @__PURE__ */ new Date()).toISOString(), this.applyLocalMessageChange(i, s), e && await C.shared.client.inbox.open({ messageId: i.messageId });
737
- } catch (c) {
738
- this.applyLocalMessageChange(t, s), (d = (h = C.shared.client) == null ? void 0 : h.options.logger) == null || d.error("Error opening message:", c);
739
- }
740
- }
741
- async clickMessage({ message: i, canCallApi: e = !0 }) {
742
- var t, s, o, n;
743
- if (C.shared.client)
744
- try {
745
- (t = i.trackingIds) != null && t.clickTrackingId && e && await C.shared.client.inbox.click({
746
- messageId: i.messageId,
747
- trackingId: (s = i.trackingIds) == null ? void 0 : s.clickTrackingId
748
- });
749
- } catch (h) {
750
- (n = (o = C.shared.client) == null ? void 0 : o.options.logger) == null || n.error("Error clicking message:", h);
751
- }
752
- }
753
- async archiveMessage({ message: i, canCallApi: e = !0 }) {
754
- var o, n;
755
- if (!C.shared.client)
756
- return;
757
- const t = i, s = (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((h) => h.messageId === i.messageId);
758
- if (s !== void 0)
759
- try {
760
- if (this.removeMessage(i, s, "inbox"), (n = this._archiveDataSet) != null && n.messages) {
761
- const h = this.findInsertIndex(i, this._archiveDataSet.messages);
762
- i.archived = (/* @__PURE__ */ new Date()).toISOString(), this.addMessage(i, h, "archive");
763
- }
764
- e && await C.shared.client.inbox.archive({ messageId: i.messageId });
765
- } catch {
766
- this.addMessage(t, s, "inbox"), i.archived = void 0, this.removeMessage(i, s, "archive");
767
- }
768
- }
769
- async archiveReadMessages({ canCallApi: i = !0 } = {}) {
770
- var s;
771
- if (!C.shared.client)
772
- return;
773
- const e = this._inboxDataSet, t = this._archiveDataSet;
774
- try {
775
- (s = this._inboxDataSet) == null || s.messages.forEach((o) => {
776
- var h, d;
777
- if (!o.read)
778
- return;
779
- const n = (h = this._inboxDataSet) == null ? void 0 : h.messages.findIndex((c) => c.messageId === o.messageId);
780
- if (n !== void 0 && (this.removeMessage(o, n, "inbox"), (d = this._archiveDataSet) != null && d.messages)) {
781
- const c = this.findInsertIndex(o, this._archiveDataSet.messages);
782
- o.archived = (/* @__PURE__ */ new Date()).toISOString(), this.addMessage(o, c, "archive");
783
- }
784
- }), this._dataStoreListeners.forEach((o) => {
785
- var n, h, d, c;
786
- this._inboxDataSet && ((h = (n = o.events).onDataSetChange) == null || h.call(n, this._inboxDataSet, "inbox")), this._archiveDataSet && ((c = (d = o.events).onDataSetChange) == null || c.call(d, this._archiveDataSet, "archive"));
787
- }), i && await C.shared.client.inbox.archiveRead();
788
- } catch (o) {
789
- console.error("Error archiving read messages:", o), this._inboxDataSet && e && (this._inboxDataSet.messages = e.messages), this._archiveDataSet && t && (this._archiveDataSet.messages = t.messages), this._dataStoreListeners.forEach((n) => {
790
- var h, d, c, u;
791
- this._inboxDataSet && ((d = (h = n.events).onDataSetChange) == null || d.call(h, this._inboxDataSet, "inbox")), this._archiveDataSet && ((u = (c = n.events).onDataSetChange) == null || u.call(c, this._archiveDataSet, "archive"));
792
- });
793
- }
794
- }
795
- async readAllMessages({ canCallApi: i = !0 } = {}) {
796
- var o, n, h, d;
797
- if (!C.shared.client)
798
- return;
799
- const e = this._inboxDataSet, t = this._archiveDataSet, s = this._unreadCount;
800
- try {
801
- (o = this._inboxDataSet) == null || o.messages.forEach((c) => {
802
- c.read || (c.read = (/* @__PURE__ */ new Date()).toISOString());
803
- }), (n = this._archiveDataSet) == null || n.messages.forEach((c) => {
804
- c.read || (c.read = (/* @__PURE__ */ new Date()).toISOString());
805
- }), this._unreadCount = 0, this._dataStoreListeners.forEach((c) => {
806
- var u, m, p, x, _, b;
807
- this._inboxDataSet && ((m = (u = c.events).onDataSetChange) == null || m.call(u, this._inboxDataSet, "inbox")), this._archiveDataSet && ((x = (p = c.events).onDataSetChange) == null || x.call(p, this._archiveDataSet, "archive")), (b = (_ = c.events).onUnreadCountChange) == null || b.call(_, this._unreadCount);
808
- }), i && await C.shared.client.inbox.readAll();
809
- } catch (c) {
810
- (d = (h = C.shared.client) == null ? void 0 : h.options.logger) == null || d.error("Error reading all messages:", c), this._inboxDataSet && e && (this._inboxDataSet.messages = e.messages), this._archiveDataSet && t && (this._archiveDataSet.messages = t.messages), this._unreadCount = s, this._dataStoreListeners.forEach((u) => {
811
- var m, p, x, _, b, v;
812
- this._inboxDataSet && ((p = (m = u.events).onDataSetChange) == null || p.call(m, this._inboxDataSet, "inbox")), this._archiveDataSet && ((_ = (x = u.events).onDataSetChange) == null || _.call(x, this._archiveDataSet, "archive")), (v = (b = u.events).onUnreadCountChange) == null || v.call(b, this._unreadCount);
813
- });
814
- }
815
- }
816
- findInsertIndex(i, e) {
817
- const t = [...e];
818
- t.push(i), t.sort((o, n) => {
819
- const h = new Date(o.created ?? Date.now()).getTime();
820
- return new Date(n.created ?? Date.now()).getTime() - h;
821
- });
822
- const s = t.findIndex((o) => o.messageId === i.messageId);
823
- return Math.max(s - 1, 0);
824
- }
825
- addPage(i, e) {
826
- switch (e) {
827
- case "inbox":
828
- this._inboxDataSet && (this._inboxDataSet.canPaginate = i.canPaginate, this._inboxDataSet.paginationCursor = i.paginationCursor, this._inboxDataSet.messages = [...this._inboxDataSet.messages, ...i.messages]);
829
- break;
830
- case "archive":
831
- this._archiveDataSet && (this._archiveDataSet.canPaginate = i.canPaginate, this._archiveDataSet.paginationCursor = i.paginationCursor, this._archiveDataSet.messages = [...this._archiveDataSet.messages, ...i.messages]);
832
- break;
833
- }
834
- this._dataStoreListeners.forEach(
835
- (t) => {
836
- var s, o;
837
- return (o = (s = t.events).onPageAdded) == null ? void 0 : o.call(s, i, e);
838
- }
839
- );
840
- }
841
- addMessage(i, e, t) {
842
- var s, o;
843
- switch (t) {
844
- case "inbox":
845
- !i.read && this._unreadCount !== void 0 && (this._unreadCount = this._unreadCount + 1), (s = this._inboxDataSet) == null || s.messages.splice(e, 0, i);
846
- break;
847
- case "archive":
848
- (o = this._archiveDataSet) == null || o.messages.splice(e, 0, i);
849
- break;
850
- }
851
- this._dataStoreListeners.forEach((n) => {
852
- var h, d, c, u;
853
- (d = (h = n.events).onMessageAdd) == null || d.call(h, i, e, t), (u = (c = n.events).onUnreadCountChange) == null || u.call(c, this._unreadCount ?? 0);
854
- });
855
- }
856
- removeMessage(i, e, t) {
857
- var s, o;
858
- switch (t) {
859
- case "inbox":
860
- !i.read && this._unreadCount !== void 0 && (this._unreadCount = this._unreadCount - 1), (s = this._inboxDataSet) == null || s.messages.splice(e, 1);
861
- break;
862
- case "archive":
863
- (o = this._archiveDataSet) == null || o.messages.splice(e, 1);
864
- break;
865
- }
866
- this._dataStoreListeners.forEach((n) => {
867
- var h, d, c, u;
868
- (d = (h = n.events).onMessageRemove) == null || d.call(h, i, e, t), (u = (c = n.events).onUnreadCountChange) == null || u.call(c, this._unreadCount ?? 0);
869
- });
870
- }
871
- updateMessage(i, e, t) {
872
- switch (t) {
873
- case "inbox":
874
- this._unreadCount !== void 0 && !i.archived && (i.read && (this._unreadCount = Math.max(0, this._unreadCount - 1)), i.read || (this._unreadCount = this._unreadCount + 1)), this._inboxDataSet && (this._inboxDataSet.messages[e] = i);
875
- break;
876
- case "archive":
877
- this._archiveDataSet && (this._archiveDataSet.messages[e] = i);
878
- break;
879
- }
880
- this._dataStoreListeners.forEach((s) => {
881
- var o, n, h, d;
882
- (n = (o = s.events).onMessageUpdate) == null || n.call(o, i, e, t), (d = (h = s.events).onUnreadCountChange) == null || d.call(h, this._unreadCount ?? 0);
883
- });
884
- }
885
- };
886
- a(te, "instance");
887
- let A = te;
888
- function zo(g) {
889
- return A.shared.readMessage({ message: g });
890
- }
891
- function Oo(g) {
892
- return A.shared.unreadMessage({ message: g });
893
- }
894
- function No(g) {
895
- return A.shared.clickMessage({ message: g });
896
- }
897
- function Uo(g) {
898
- return A.shared.archiveMessage({ message: g });
899
- }
900
- function Vo(g) {
901
- return A.shared.openMessage({ message: g });
902
- }
903
- function Po(g) {
904
- if (!g.created) return "Now";
905
- const i = /* @__PURE__ */ new Date(), e = new Date(g.created), t = Math.floor((i.getTime() - e.getTime()) / 1e3);
906
- return t < 60 ? `${t}s` : t < 3600 ? `${Math.floor(t / 60)}m` : t < 86400 ? `${Math.floor(t / 3600)}h` : t < 604800 ? `${Math.floor(t / 86400)}d` : t < 31536e3 ? `${Math.floor(t / 604800)}w` : `${Math.floor(t / 31536e3)}y`;
907
- }
908
- class _o extends HTMLElement {
909
- constructor(e) {
910
- super();
911
- // State
912
- a(this, "_theme");
913
- a(this, "_options", []);
914
- // Components
915
- a(this, "_style");
916
- this._theme = e;
917
- const t = this.attachShadow({ mode: "open" });
918
- this._style = document.createElement("style"), this._style.textContent = this.getStyles(), t.appendChild(this._style);
919
- const s = document.createElement("ul");
920
- s.className = "menu", t.appendChild(s);
921
- }
922
- getStyles() {
923
- var t, s, o;
924
- const e = (o = (s = (t = this._theme.inbox) == null ? void 0 : t.list) == null ? void 0 : s.item) == null ? void 0 : o.menu;
925
- return `
926
- :host {
927
- display: block;
928
- position: absolute;
929
- background: ${(e == null ? void 0 : e.backgroundColor) ?? "red"};
930
- border: ${(e == null ? void 0 : e.border) ?? "1px solid red"};
931
- border-radius: ${(e == null ? void 0 : e.borderRadius) ?? "0px"};
932
- box-shadow: ${(e == null ? void 0 : e.shadow) ?? "0 2px 8px red"};
933
- user-select: none;
934
- opacity: 0;
935
- pointer-events: none;
936
- transition: opacity 0.15s;
937
- overflow: hidden;
938
- }
939
-
940
- :host(.visible) {
941
- opacity: 1;
942
- pointer-events: auto;
943
- }
944
-
945
- ul.menu {
946
- list-style: none;
947
- margin: 0;
948
- padding: 0;
949
- display: flex;
950
- flex-direction: row;
951
- }
952
-
953
- li.menu-item {
954
- display: flex;
955
- align-items: center;
956
- justify-content: center;
957
- cursor: pointer;
958
- border-bottom: none;
959
- background: transparent;
960
- }
961
- `;
962
- }
963
- setOptions(e) {
964
- this._options = e, this.renderMenu();
965
- }
966
- renderMenu() {
967
- var o, n, h, d;
968
- const e = (o = this.shadowRoot) == null ? void 0 : o.querySelector("ul.menu");
969
- if (!e) return;
970
- e.innerHTML = "";
971
- const t = (d = (h = (n = this._theme.inbox) == null ? void 0 : n.list) == null ? void 0 : h.item) == null ? void 0 : d.menu, s = (c) => {
972
- c.stopPropagation(), c.preventDefault();
973
- };
974
- this._options.forEach((c) => {
975
- var p, x, _;
976
- const u = new Se(c.icon.svg, c.icon.color, t == null ? void 0 : t.backgroundColor, (p = t == null ? void 0 : t.item) == null ? void 0 : p.hoverBackgroundColor, (x = t == null ? void 0 : t.item) == null ? void 0 : x.activeBackgroundColor, (_ = t == null ? void 0 : t.item) == null ? void 0 : _.borderRadius), m = (b) => {
977
- s(b), c.onClick();
978
- };
979
- u.addEventListener("click", m), u.addEventListener("touchstart", s), u.addEventListener("touchend", m), u.addEventListener("touchmove", s), u.addEventListener("mousedown", s), u.addEventListener("mouseup", s), e.appendChild(u);
980
- });
981
- }
982
- show() {
983
- this.classList.add("visible");
984
- }
985
- hide() {
986
- this.classList.remove("visible");
987
- }
988
- }
989
- customElements.get("courier-list-item-menu") || customElements.define("courier-list-item-menu", _o);
990
- class xo extends HTMLElement {
991
- constructor(e) {
992
- super();
993
- // State
994
- a(this, "_theme");
995
- a(this, "_message", null);
996
- a(this, "_feedType", "inbox");
997
- a(this, "_isMobile", !1);
998
- // Elements
999
- a(this, "_titleElement");
1000
- a(this, "_subtitleElement");
1001
- a(this, "_timeElement");
1002
- a(this, "_style");
1003
- a(this, "_menu");
1004
- a(this, "_unreadIndicator");
1005
- a(this, "_actionsContainer");
1006
- // Touch gestures
1007
- a(this, "_longPressTimeout", null);
1008
- a(this, "_isLongPress", !1);
1009
- // Callbacks
1010
- a(this, "onItemClick", null);
1011
- a(this, "onItemLongPress", null);
1012
- a(this, "onItemActionClick", null);
1013
- this._theme = e, this._isMobile = "ontouchstart" in window;
1014
- const t = this.attachShadow({ mode: "open" }), s = document.createElement("div");
1015
- s.className = "content-container", this._titleElement = document.createElement("p"), this._titleElement.setAttribute("part", "title"), this._subtitleElement = document.createElement("p"), this._subtitleElement.setAttribute("part", "subtitle"), this._actionsContainer = document.createElement("div"), this._actionsContainer.className = "actions-container", s.appendChild(this._titleElement), s.appendChild(this._subtitleElement), s.appendChild(this._actionsContainer), this._timeElement = document.createElement("p"), this._timeElement.setAttribute("part", "time"), this._unreadIndicator = document.createElement("div"), this._unreadIndicator.className = "unread-indicator", this._style = document.createElement("style"), this._refreshStyles(), this._menu = new _o(this._theme), this._menu.setOptions(this._getMenuOptions()), t.append(this._style, this._unreadIndicator, s, this._timeElement, this._menu);
1016
- const o = (n) => {
1017
- n.stopPropagation(), n.preventDefault();
1018
- };
1019
- this._menu.addEventListener("mousedown", o), this._menu.addEventListener("pointerdown", o), this._menu.addEventListener("click", o), this.addEventListener("click", (n) => {
1020
- this._menu.contains(n.target) || n.composedPath().includes(this._menu) || this._message && this.onItemClick && !(n.target instanceof ie) && !this._isLongPress && this.onItemClick(this._message);
1021
- }), this._setupHoverBehavior(), this._setupLongPressBehavior();
1022
- }
1023
- _setupHoverBehavior() {
1024
- this._isMobile || (this.addEventListener("mouseenter", () => {
1025
- this._isLongPress = !1, this._showMenu();
1026
- }), this.addEventListener("mouseleave", () => this._hideMenu()));
1027
- }
1028
- _setupLongPressBehavior() {
1029
- var s, o, n;
1030
- const e = (n = (o = (s = this._theme.inbox) == null ? void 0 : s.list) == null ? void 0 : o.item) == null ? void 0 : n.menu;
1031
- if (!(e != null && e.enabled))
1032
- return;
1033
- const t = e.longPress;
1034
- this.addEventListener(
1035
- "touchstart",
1036
- () => {
1037
- this._longPressTimeout = window.setTimeout(() => {
1038
- this._isLongPress = !0, this._showMenu(), this._message && this.onItemLongPress && (this.onItemLongPress(this._message), navigator.vibrate && navigator.vibrate((t == null ? void 0 : t.vibrationDuration) ?? 50)), setTimeout(() => {
1039
- this._hideMenu(), this._isLongPress = !1;
1040
- }, (t == null ? void 0 : t.displayDuration) ?? 2e3);
1041
- }, 650);
1042
- },
1043
- { passive: !0 }
1044
- ), this.addEventListener("touchend", () => {
1045
- this._longPressTimeout && (window.clearTimeout(this._longPressTimeout), this._longPressTimeout = null);
1046
- });
1047
- }
1048
- setOnLongPress(e) {
1049
- this.onItemLongPress = e;
1050
- }
1051
- // Helpers
1052
- _getMenuOptions() {
1053
- var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I;
1054
- const e = (h = (n = (o = (s = this._theme.inbox) == null ? void 0 : s.list) == null ? void 0 : o.item) == null ? void 0 : n.menu) == null ? void 0 : h.item;
1055
- let t = [];
1056
- return (d = this._message) != null && d.archived || t.push({
1057
- id: (c = this._message) != null && c.read ? "unread" : "read",
1058
- icon: {
1059
- svg: (u = this._message) != null && u.read ? (m = e == null ? void 0 : e.unread) == null ? void 0 : m.svg : (p = e == null ? void 0 : e.read) == null ? void 0 : p.svg,
1060
- color: (x = this._message) != null && x.read ? (_ = e == null ? void 0 : e.unread) == null ? void 0 : _.color : ((b = e == null ? void 0 : e.read) == null ? void 0 : b.color) ?? "red"
1061
- },
1062
- onClick: () => {
1063
- this._message && (this._message.read ? A.shared.unreadMessage({ message: this._message }) : A.shared.readMessage({ message: this._message }));
1064
- }
1065
- }), t.push({
1066
- id: (v = this._message) != null && v.archived ? "unarchive" : "archive",
1067
- icon: {
1068
- svg: (k = this._message) != null && k.archived ? (w = e == null ? void 0 : e.unarchive) == null ? void 0 : w.svg : (S = e == null ? void 0 : e.archive) == null ? void 0 : S.svg,
1069
- color: (M = this._message) != null && M.archived ? (E = e == null ? void 0 : e.unarchive) == null ? void 0 : E.color : ((I = e == null ? void 0 : e.archive) == null ? void 0 : I.color) ?? "red"
1070
- },
1071
- onClick: () => {
1072
- this._message && (this._message.archived ? alert("unarchive") : A.shared.archiveMessage({ message: this._message }));
1073
- }
1074
- }), t;
1075
- }
1076
- // Menu visibility helpers
1077
- _showMenu() {
1078
- var t, s, o;
1079
- const e = (o = (s = (t = this._theme.inbox) == null ? void 0 : t.list) == null ? void 0 : s.item) == null ? void 0 : o.menu;
1080
- e && e.enabled && (this._menu.setOptions(this._getMenuOptions()), this._menu.style.display = "block", this._menu.show(), this._timeElement.style.opacity = "0");
1081
- }
1082
- _hideMenu() {
1083
- var t, s, o;
1084
- const e = (o = (s = (t = this._theme.inbox) == null ? void 0 : t.list) == null ? void 0 : s.item) == null ? void 0 : o.menu;
1085
- e && e.enabled && (this._menu.hide(), this._menu.style.display = "none", this._timeElement.style.opacity = "1");
1086
- }
1087
- _getStyles() {
1088
- var t, s, o, n, h, d, c, u, m, p, x;
1089
- const e = (s = (t = this._theme.inbox) == null ? void 0 : t.list) == null ? void 0 : s.item;
1090
- return `
1091
- :host {
1092
- display: flex;
1093
- flex-direction: row;
1094
- align-items: flex-start;
1095
- justify-content: space-between;
1096
- border-bottom: ${(e == null ? void 0 : e.divider) ?? "1px solid red"};
1097
- font-family: inherit;
1098
- cursor: pointer;
1099
- transition: background-color 0.2s ease;
1100
- margin: 0;
1101
- width: 100%;
1102
- box-sizing: border-box;
1103
- padding: 12px 20px;
1104
- position: relative;
1105
- background-color: ${(e == null ? void 0 : e.backgroundColor) ?? "transparent"};
1106
- user-select: none;
1107
- -webkit-user-select: none;
1108
- -moz-user-select: none;
1109
- -ms-user-select: none;
1110
- touch-action: manipulation;
1111
- }
1112
-
1113
- /* ───────────────────────── Base hover / active ────────────────── */
1114
- @media (hover: hover) {
1115
- :host(:hover) {
1116
- background-color: ${(e == null ? void 0 : e.hoverBackgroundColor) ?? "red"};
1117
- }
1118
- }
1119
- :host(:active) {
1120
- background-color: ${(e == null ? void 0 : e.activeBackgroundColor) ?? "red"};
1121
- }
1122
-
1123
- /* ───────────────────────── Menu hover / active ────────────────── */
1124
- @media (hover: hover) {
1125
- :host(:hover):has(courier-list-item-menu:hover, courier-list-item-menu *:hover, courier-button:hover, courier-button *:hover) {
1126
- background-color: ${(e == null ? void 0 : e.backgroundColor) ?? "transparent"};
1127
- }
1128
- }
1129
- :host(:active):has(courier-list-item-menu:active, courier-list-item-menu *:active, courier-button:active, courier-button *:active) {
1130
- background-color: ${(e == null ? void 0 : e.backgroundColor) ?? "transparent"};
1131
- }
1132
-
1133
- :host(:last-child) {
1134
- border-bottom: none;
1135
- }
1136
-
1137
- .unread-indicator {
1138
- position: absolute;
1139
- top: 28px;
1140
- left: 6px;
1141
- width: 8px;
1142
- height: 8px;
1143
- border-radius: 50%;
1144
- background-color: ${(e == null ? void 0 : e.unreadIndicatorColor) ?? "red"};
1145
- display: none;
1146
- }
1147
-
1148
- :host(.unread) .unread-indicator {
1149
- display: block;
1150
- }
1151
-
1152
- .content-container {
1153
- flex: 1;
1154
- display: flex;
1155
- flex-direction: column;
1156
- margin-right: 12px;
1157
- }
1158
-
1159
- p {
1160
- margin: 0;
1161
- overflow-wrap: break-word;
1162
- word-break: break-word;
1163
- hyphens: auto;
1164
- line-height: 1.4;
1165
- user-select: none;
1166
- -webkit-user-select: none;
1167
- -moz-user-select: none;
1168
- -ms-user-select: none;
1169
- text-align: left;
1170
- }
1171
-
1172
- p[part='title'] {
1173
- font-family: ${((o = e == null ? void 0 : e.title) == null ? void 0 : o.family) ?? "inherit"};
1174
- font-size: ${((n = e == null ? void 0 : e.title) == null ? void 0 : n.size) ?? "14px"};
1175
- color: ${((h = e == null ? void 0 : e.title) == null ? void 0 : h.color) ?? "red"};
1176
- margin-bottom: 4px;
1177
- }
1178
-
1179
- p[part='subtitle'] {
1180
- font-family: ${((d = e == null ? void 0 : e.subtitle) == null ? void 0 : d.family) ?? "inherit"};
1181
- font-size: ${((c = e == null ? void 0 : e.subtitle) == null ? void 0 : c.size) ?? "14px"};
1182
- color: ${((u = e == null ? void 0 : e.subtitle) == null ? void 0 : u.color) ?? "red"};
1183
- }
1184
-
1185
- p[part='time'] {
1186
- font-family: ${((m = e == null ? void 0 : e.time) == null ? void 0 : m.family) ?? "inherit"};
1187
- font-size: ${((p = e == null ? void 0 : e.time) == null ? void 0 : p.size) ?? "14px"};
1188
- color: ${((x = e == null ? void 0 : e.time) == null ? void 0 : x.color) ?? "red"};
1189
- text-align: right;
1190
- white-space: nowrap;
1191
- }
1192
-
1193
- courier-list-item-menu {
1194
- z-index: 1;
1195
- position: absolute;
1196
- top: 8px;
1197
- right: 8px;
1198
- display: none; /* becomes block while visible */
1199
- }
1200
-
1201
- .actions-container {
1202
- display: flex;
1203
- margin-top: 10px;
1204
- flex-wrap: wrap;
1205
- flex-direction: row;
1206
- align-items: center;
1207
- gap: 8px;
1208
- display: none;
1209
- }
1210
-
1211
- `;
1212
- }
1213
- _refreshStyles() {
1214
- this._style.textContent = this._getStyles();
1215
- }
1216
- // Lifecycle hooks
1217
- connectedCallback() {
1218
- var s, o;
1219
- const e = this.getAttribute("message"), t = this.getAttribute("feed-type");
1220
- if (t && (this._feedType = t), e)
1221
- try {
1222
- this._message = JSON.parse(e), this._updateContent();
1223
- } catch (n) {
1224
- (o = (s = C.shared.client) == null ? void 0 : s.options.logger) == null || o.error("CourierListItem – failed to parse message:", n);
1225
- }
1226
- }
1227
- // Public API
1228
- setMessage(e, t) {
1229
- this._message = e, this._feedType = t, this._updateContent();
1230
- }
1231
- setOnItemClick(e) {
1232
- this.onItemClick = e;
1233
- }
1234
- setOnItemActionClick(e) {
1235
- this.onItemActionClick = e;
1236
- }
1237
- setOnItemLongPress(e) {
1238
- this.onItemLongPress = e;
1239
- }
1240
- // Content rendering
1241
- _updateContent() {
1242
- var s, o, n, h, d, c;
1243
- if (!this._message) {
1244
- this._titleElement.textContent = "", this._subtitleElement.textContent = "";
1245
- return;
1246
- }
1247
- this.classList.toggle("unread", !this._message.read && this._feedType !== "archive"), this._titleElement.textContent = this._message.title || "Untitled Message", this._subtitleElement.textContent = this._message.preview || this._message.body || "", this._timeElement.textContent = Po(this._message), this._menu.setOptions(this._getMenuOptions());
1248
- const e = ((s = this._message) == null ? void 0 : s.actions) && this._message.actions.length > 0;
1249
- this._actionsContainer.style.display = e ? "flex" : "none";
1250
- const t = (h = (n = (o = this._theme.inbox) == null ? void 0 : o.list) == null ? void 0 : n.item) == null ? void 0 : h.actions;
1251
- (c = (d = this._message) == null ? void 0 : d.actions) == null || c.forEach((u) => {
1252
- var p, x, _, b;
1253
- const m = new Ie({
1254
- text: u.content,
1255
- variant: "secondary",
1256
- backgroundColor: t == null ? void 0 : t.backgroundColor,
1257
- hoverBackgroundColor: t == null ? void 0 : t.hoverBackgroundColor,
1258
- activeBackgroundColor: t == null ? void 0 : t.activeBackgroundColor,
1259
- border: t == null ? void 0 : t.border,
1260
- borderRadius: t == null ? void 0 : t.borderRadius,
1261
- shadow: t == null ? void 0 : t.shadow,
1262
- fontFamily: (p = t == null ? void 0 : t.font) == null ? void 0 : p.family,
1263
- fontSize: (x = t == null ? void 0 : t.font) == null ? void 0 : x.size,
1264
- fontWeight: (_ = t == null ? void 0 : t.font) == null ? void 0 : _.weight,
1265
- textColor: (b = t == null ? void 0 : t.font) == null ? void 0 : b.color,
1266
- onClick: () => {
1267
- this._message && this.onItemActionClick && this.onItemActionClick(this._message, u);
1268
- }
1269
- });
1270
- this._actionsContainer.appendChild(m);
1271
- });
1272
- }
1273
- }
1274
- customElements.get("courier-list-item") || customElements.define("courier-list-item", xo);
1275
- class fo extends HTMLElement {
1276
- constructor(e, t) {
1277
- super();
1278
- // Shadow root
1279
- a(this, "_shadow");
1280
- this._shadow = this.attachShadow({ mode: "open" });
1281
- const s = document.createElement("style");
1282
- s.textContent = this.getStyles(t), this._shadow.appendChild(s);
1283
- const o = new Me(e, 35), n = new Me(e, 100), h = new Me(e, 82);
1284
- this._shadow.appendChild(o), this._shadow.appendChild(n), this._shadow.appendChild(h);
1285
- }
1286
- getStyles(e) {
1287
- return `
1288
- :host {
1289
- display: flex;
1290
- flex-direction: column;
1291
- gap: 12px;
1292
- padding: 12px;
1293
- width: 100%;
1294
- box-sizing: border-box;
1295
- opacity: ${e};
1296
- }
1297
- `;
1298
- }
1299
- }
1300
- customElements.get("courier-inbox-skeleton-list-item") || customElements.define("courier-inbox-skeleton-list-item", fo);
1301
- class Me extends HTMLElement {
1302
- constructor(e, t) {
1303
- super();
1304
- a(this, "_shadow");
1305
- this._shadow = this.attachShadow({ mode: "open" });
1306
- const s = document.createElement("style");
1307
- s.textContent = this.getStyles(e, t), this._shadow.appendChild(s);
1308
- const o = document.createElement("div");
1309
- o.className = "skeleton-item", this._shadow.appendChild(o);
1310
- }
1311
- getStyles(e, t) {
1312
- var m, p, x, _, b, v, k, w, S, M, E, I;
1313
- const s = ((x = (p = (m = e.inbox) == null ? void 0 : m.loading) == null ? void 0 : p.animation) == null ? void 0 : x.barColor) ?? "#000", o = s.length === 4 ? `#${s[1]}${s[1]}${s[2]}${s[2]}${s[3]}${s[3]}` : s, n = parseInt(o.slice(1, 3), 16), h = parseInt(o.slice(3, 5), 16), d = parseInt(o.slice(5, 7), 16), c = `rgba(${n}, ${h}, ${d}, 0.8)`, u = `rgba(${n}, ${h}, ${d}, 0.4)`;
1314
- return `
1315
- :host {
1316
- display: flex;
1317
- height: 100%;
1318
- width: ${t}%;
1319
- align-items: flex-start;
1320
- justify-content: flex-start;
1321
- }
1322
-
1323
- .skeleton-item {
1324
- height: ${((v = (b = (_ = e.inbox) == null ? void 0 : _.loading) == null ? void 0 : b.animation) == null ? void 0 : v.barHeight) ?? "14px"};
1325
- width: 100%;
1326
- background: linear-gradient(
1327
- 90deg,
1328
- ${c} 25%,
1329
- ${u} 50%,
1330
- ${c} 75%
1331
- );
1332
- background-size: 200% 100%;
1333
- animation: shimmer ${((S = (w = (k = e.inbox) == null ? void 0 : k.loading) == null ? void 0 : w.animation) == null ? void 0 : S.duration) ?? "2s"} ease-in-out infinite;
1334
- border-radius: ${((I = (E = (M = e.inbox) == null ? void 0 : M.loading) == null ? void 0 : E.animation) == null ? void 0 : I.barBorderRadius) ?? "14px"};
1335
- }
1336
-
1337
- @keyframes shimmer {
1338
- 0% {
1339
- background-position: 200% 0;
1340
- }
1341
- 100% {
1342
- background-position: -200% 0;
1343
- }
1344
- }
1345
- `;
1346
- }
1347
- }
1348
- customElements.get("courier-skeleton-animated-row") || customElements.define("courier-skeleton-animated-row", Me);
1349
- class Pe extends Le {
1350
- constructor(e) {
1351
- super();
1352
- a(this, "_theme");
1353
- this._theme = e;
1354
- }
1355
- defaultElement() {
1356
- const e = document.createElement("div");
1357
- e.className = "list";
1358
- const t = document.createElement("style");
1359
- t.textContent = this.getStyles(), e.appendChild(t);
1360
- for (let s = 0; s < 3; s++) {
1361
- const o = new fo(this._theme, 1 / (s + 1));
1362
- e.appendChild(o);
1363
- }
1364
- return this.shadow.appendChild(e), e;
1365
- }
1366
- getStyles() {
1367
- var e, t;
1368
- return `
1369
- :host {
1370
- display: flex;
1371
- height: 100%;
1372
- width: 100%;
1373
- align-items: flex-start;
1374
- justify-content: flex-start;
1375
- overflow: hidden;
1376
- }
1377
-
1378
- .list {
1379
- display: flex;
1380
- flex-direction: column;
1381
- gap: 8px;
1382
- width: 100%;
1383
- overflow: hidden;
1384
- }
1385
-
1386
- .list > * {
1387
- border-bottom: ${((t = (e = this._theme.inbox) == null ? void 0 : e.loading) == null ? void 0 : t.divider) ?? "1px solid red"};
1388
- }
1389
-
1390
- .list > *:last-child {
1391
- border-bottom: none;
1392
- }
1393
- `;
1394
- }
1395
- }
1396
- customElements.get("courier-inbox-skeleton-list") || customElements.define("courier-inbox-skeleton-list", Pe);
1397
- class Co extends HTMLElement {
1398
- constructor(e) {
1399
- super();
1400
- // Components
1401
- a(this, "skeletonLoadingList");
1402
- a(this, "observer");
1403
- a(this, "customItem");
1404
- // Handlers
1405
- a(this, "onPaginationTrigger");
1406
- this.onPaginationTrigger = e.onPaginationTrigger, this.customItem = e.customItem;
1407
- const t = this.attachShadow({ mode: "open" }), s = document.createElement("style");
1408
- if (s.textContent = this.getStyles(), t.appendChild(s), this.customItem)
1409
- t.appendChild(this.customItem);
1410
- else {
1411
- const o = document.createElement("div");
1412
- o.className = "skeleton-container", this.skeletonLoadingList = new Pe(e.theme), this.skeletonLoadingList.build(void 0), o.appendChild(this.skeletonLoadingList), t.appendChild(o);
1413
- }
1414
- this.observer = new IntersectionObserver((o) => {
1415
- o.forEach((n) => {
1416
- n.isIntersecting && this.onPaginationTrigger();
1417
- });
1418
- }), this.observer.observe(this);
1419
- }
1420
- getStyles() {
1421
- return `
1422
- :host {
1423
- padding: 0;
1424
- margin: 0;
1425
- box-sizing: border-box;
1426
- }
1427
-
1428
- .skeleton-container {
1429
- height: 150%;
1430
- }
1431
- `;
1432
- }
1433
- disconnectedCallback() {
1434
- this.observer.disconnect();
1435
- }
1436
- }
1437
- customElements.get("courier-inbox-pagination-list-item") || customElements.define("courier-inbox-pagination-list-item", Co);
1438
- class vo extends HTMLElement {
1439
- constructor(e) {
1440
- super();
1441
- // Theme
1442
- a(this, "_themeSubscription");
1443
- // State
1444
- a(this, "_messages", []);
1445
- a(this, "_feedType", "inbox");
1446
- a(this, "_isLoading", !0);
1447
- a(this, "_error", null);
1448
- a(this, "_canPaginate", !1);
1449
- // Callbacks
1450
- a(this, "_onMessageClick", null);
1451
- a(this, "_onMessageActionClick", null);
1452
- a(this, "_onMessageLongPress", null);
1453
- a(this, "_onRefresh");
1454
- // Factories
1455
- a(this, "_onPaginationTrigger");
1456
- a(this, "_listItemFactory");
1457
- a(this, "_paginationItemFactory");
1458
- a(this, "_loadingStateFactory");
1459
- a(this, "_emptyStateFactory");
1460
- a(this, "_errorStateFactory");
1461
- this._themeSubscription = e.themeManager.subscribe((o) => {
1462
- this.refreshTheme();
1463
- }), this._onRefresh = e.onRefresh, this._onPaginationTrigger = e.onPaginationTrigger, this._onMessageClick = e.onMessageClick, this._onMessageActionClick = e.onMessageActionClick, this._onMessageLongPress = e.onMessageLongPress;
1464
- const t = this.attachShadow({ mode: "open" }), s = document.createElement("style");
1465
- s.textContent = this.getStyles(), t.appendChild(s);
1466
- }
1467
- // Getters
1468
- get messages() {
1469
- return this._messages;
1470
- }
1471
- getStyles() {
1472
- var t;
1473
- const e = (t = this._themeSubscription.manager.getTheme().inbox) == null ? void 0 : t.list;
1474
- return `
1475
- :host {
1476
- flex: 1;
1477
- width: 100%;
1478
- background-color: ${(e == null ? void 0 : e.backgroundColor) ?? r.white[500]};
1479
- }
1480
-
1481
- ul {
1482
- list-style: none;
1483
- padding: 0;
1484
- margin: 0;
1485
- height: 100%;
1486
- }
1487
- `;
1488
- }
1489
- reset() {
1490
- var t, s;
1491
- for (; (t = this.shadowRoot) != null && t.firstChild; )
1492
- this.shadowRoot.removeChild(this.shadowRoot.firstChild);
1493
- const e = document.createElement("style");
1494
- e.textContent = this.getStyles(), (s = this.shadowRoot) == null || s.appendChild(e);
1495
- }
1496
- setDataSet(e) {
1497
- this._messages = [...e.messages], this._canPaginate = !!e.canPaginate, this._error = null, this._isLoading = !1, this.render();
1498
- }
1499
- addPage(e) {
1500
- this._messages = [...this._messages, ...e.messages], this._canPaginate = !!e.canPaginate, this._error = null, this._isLoading = !1, this.render();
1501
- }
1502
- addMessage(e, t = 0) {
1503
- this._messages.splice(t, 0, e), this.render();
1504
- }
1505
- removeMessage(e = 0) {
1506
- this._messages.splice(e, 1), this.render();
1507
- }
1508
- updateMessage(e, t = 0) {
1509
- this._messages[t] = e, this.render();
1510
- }
1511
- setFeedType(e) {
1512
- this._feedType = e, this._error = null, this._isLoading = !0, this.render();
1513
- }
1514
- setLoading(e) {
1515
- this._error = null, this._isLoading = e, this.render();
1516
- }
1517
- setError(e) {
1518
- this._error = e, this._isLoading = !1, this._messages = [], this.render();
1519
- }
1520
- setErrorNoClient() {
1521
- this.setError(new Error("No user signed in"));
1522
- }
1523
- handleRetry() {
1524
- this._onRefresh();
1525
- }
1526
- handleRefresh() {
1527
- this._onRefresh();
1528
- }
1529
- render() {
1530
- var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y, j, se, oe, ne, re, ae, he, ce, le, de, ue, pe, ge, me, be, _e, xe, fe, Ce, ve, ye;
1531
- this.reset();
1532
- const e = this._themeSubscription.manager.getTheme();
1533
- if (this._error) {
1534
- const l = (s = e.inbox) == null ? void 0 : s.error, D = new Ee({
1535
- title: {
1536
- text: ((o = l == null ? void 0 : l.title) == null ? void 0 : o.text) ?? this._error.message,
1537
- textColor: (h = (n = l == null ? void 0 : l.title) == null ? void 0 : n.font) == null ? void 0 : h.color,
1538
- fontFamily: (c = (d = l == null ? void 0 : l.title) == null ? void 0 : d.font) == null ? void 0 : c.family,
1539
- fontSize: (m = (u = l == null ? void 0 : l.title) == null ? void 0 : u.font) == null ? void 0 : m.size,
1540
- fontWeight: (x = (p = l == null ? void 0 : l.title) == null ? void 0 : p.font) == null ? void 0 : x.weight
1541
- },
1542
- button: {
1543
- text: (_ = l == null ? void 0 : l.button) == null ? void 0 : _.text,
1544
- backgroundColor: (b = l == null ? void 0 : l.button) == null ? void 0 : b.backgroundColor,
1545
- hoverBackgroundColor: (v = l == null ? void 0 : l.button) == null ? void 0 : v.hoverBackgroundColor,
1546
- activeBackgroundColor: (k = l == null ? void 0 : l.button) == null ? void 0 : k.activeBackgroundColor,
1547
- textColor: (S = (w = l == null ? void 0 : l.button) == null ? void 0 : w.font) == null ? void 0 : S.color,
1548
- fontFamily: (E = (M = l == null ? void 0 : l.button) == null ? void 0 : M.font) == null ? void 0 : E.family,
1549
- fontSize: (T = (I = l == null ? void 0 : l.button) == null ? void 0 : I.font) == null ? void 0 : T.size,
1550
- fontWeight: ($ = (P = l == null ? void 0 : l.button) == null ? void 0 : P.font) == null ? void 0 : $.weight,
1551
- shadow: (y = l == null ? void 0 : l.button) == null ? void 0 : y.shadow,
1552
- border: (B = l == null ? void 0 : l.button) == null ? void 0 : B.border,
1553
- borderRadius: (F = l == null ? void 0 : l.button) == null ? void 0 : F.borderRadius
1554
- }
1555
- });
1556
- D.build((H = this._errorStateFactory) == null ? void 0 : H.call(this, { feedType: this._feedType, error: this._error })), D.setButtonClickCallback(() => this.handleRetry()), (R = this.shadowRoot) == null || R.appendChild(D);
1557
- return;
1558
- }
1559
- if (this._isLoading) {
1560
- const l = new Pe(e);
1561
- l.build((z = this._loadingStateFactory) == null ? void 0 : z.call(this, { feedType: this._feedType })), (O = this.shadowRoot) == null || O.appendChild(l);
1562
- return;
1563
- }
1564
- if (this._messages.length === 0) {
1565
- const l = (N = e.inbox) == null ? void 0 : N.empty, D = new Ee({
1566
- title: {
1567
- text: ((U = l == null ? void 0 : l.title) == null ? void 0 : U.text) ?? `No ${this._feedType} messages yet`,
1568
- textColor: (Z = (V = l == null ? void 0 : l.title) == null ? void 0 : V.font) == null ? void 0 : Z.color,
1569
- fontFamily: (q = (J = l == null ? void 0 : l.title) == null ? void 0 : J.font) == null ? void 0 : q.family,
1570
- fontSize: (Y = (X = l == null ? void 0 : l.title) == null ? void 0 : X.font) == null ? void 0 : Y.size,
1571
- fontWeight: (se = (j = l == null ? void 0 : l.title) == null ? void 0 : j.font) == null ? void 0 : se.weight
1572
- },
1573
- button: {
1574
- text: (oe = l == null ? void 0 : l.button) == null ? void 0 : oe.text,
1575
- backgroundColor: (ne = l == null ? void 0 : l.button) == null ? void 0 : ne.backgroundColor,
1576
- hoverBackgroundColor: (re = l == null ? void 0 : l.button) == null ? void 0 : re.hoverBackgroundColor,
1577
- activeBackgroundColor: (ae = l == null ? void 0 : l.button) == null ? void 0 : ae.activeBackgroundColor,
1578
- textColor: (ce = (he = l == null ? void 0 : l.button) == null ? void 0 : he.font) == null ? void 0 : ce.color,
1579
- fontFamily: (de = (le = l == null ? void 0 : l.button) == null ? void 0 : le.font) == null ? void 0 : de.family,
1580
- fontSize: (pe = (ue = l == null ? void 0 : l.button) == null ? void 0 : ue.font) == null ? void 0 : pe.size,
1581
- fontWeight: (me = (ge = l == null ? void 0 : l.button) == null ? void 0 : ge.font) == null ? void 0 : me.weight,
1582
- shadow: (be = l == null ? void 0 : l.button) == null ? void 0 : be.shadow,
1583
- border: (_e = l == null ? void 0 : l.button) == null ? void 0 : _e.border,
1584
- borderRadius: (xe = l == null ? void 0 : l.button) == null ? void 0 : xe.borderRadius
1585
- }
1586
- });
1587
- D.build((fe = this._emptyStateFactory) == null ? void 0 : fe.call(this, { feedType: this._feedType })), D.setButtonClickCallback(() => this.handleRefresh()), (Ce = this.shadowRoot) == null || Ce.appendChild(D);
1588
- return;
1589
- }
1590
- const t = document.createElement("ul");
1591
- if ((ve = this.shadowRoot) == null || ve.appendChild(t), this._messages.forEach((l, D) => {
1592
- if (this._listItemFactory) {
1593
- t.appendChild(this._listItemFactory({ message: l, index: D }));
1594
- return;
1595
- }
1596
- const K = new xo(e);
1597
- K.setMessage(l, this._feedType), K.setOnItemClick((Q) => {
1598
- var W;
1599
- return (W = this._onMessageClick) == null ? void 0 : W.call(this, Q, D);
1600
- }), K.setOnItemActionClick((Q, W) => {
1601
- var ke;
1602
- return (ke = this._onMessageActionClick) == null ? void 0 : ke.call(this, Q, W, D);
1603
- }), K.setOnItemLongPress((Q) => {
1604
- var W;
1605
- return (W = this._onMessageLongPress) == null ? void 0 : W.call(this, Q, D);
1606
- }), t.appendChild(K);
1607
- }), this._canPaginate) {
1608
- const l = new Co({
1609
- theme: e,
1610
- customItem: (ye = this._paginationItemFactory) == null ? void 0 : ye.call(this, { feedType: this._feedType }),
1611
- onPaginationTrigger: () => {
1612
- var D;
1613
- return (D = this._onPaginationTrigger) == null ? void 0 : D.call(this, this._feedType);
1614
- }
1615
- });
1616
- t.appendChild(l);
1617
- }
1618
- }
1619
- // Factories
1620
- setLoadingStateFactory(e) {
1621
- this._loadingStateFactory = e, this.render();
1622
- }
1623
- setEmptyStateFactory(e) {
1624
- this._emptyStateFactory = e, this.render();
1625
- }
1626
- setErrorStateFactory(e) {
1627
- this._errorStateFactory = e, this.render();
1628
- }
1629
- setListItemFactory(e) {
1630
- this._listItemFactory = e, this.render();
1631
- }
1632
- setPaginationItemFactory(e) {
1633
- this._paginationItemFactory = e, this.render();
1634
- }
1635
- refreshTheme() {
1636
- this.render();
1637
- }
1638
- // Disconnect the theme subscription
1639
- disconnectedCallback() {
1640
- this._themeSubscription.unsubscribe();
1641
- }
1642
- }
1643
- customElements.get("courier-inbox-list") || customElements.define("courier-inbox-list", vo);
1644
- class yo extends HTMLElement {
1645
- constructor(e) {
1646
- super();
1647
- // State
1648
- a(this, "_option");
1649
- a(this, "_isSelected");
1650
- // Components
1651
- a(this, "_content");
1652
- a(this, "_itemIcon");
1653
- a(this, "_title");
1654
- a(this, "_selectionIcon");
1655
- a(this, "_style");
1656
- // Theme
1657
- a(this, "_themeManager");
1658
- this._option = e.option, this._isSelected = e.isSelected, this._themeManager = e.themeManager;
1659
- const t = this.attachShadow({ mode: "open" });
1660
- this._style = document.createElement("style"), this._content = document.createElement("div"), this._content.className = "menu-item", this._itemIcon = new ie(this._option.icon.svg ?? f.inbox), this._itemIcon.setAttribute("size", "16"), this._title = document.createElement("p"), this._title.textContent = this._option.text;
1661
- const s = document.createElement("div");
1662
- s.className = "spacer", this._selectionIcon = new ie(f.check), this._content.appendChild(this._itemIcon), this._content.appendChild(this._title), this._content.appendChild(s), e.selectable && this._content.appendChild(this._selectionIcon), t.appendChild(this._style), t.appendChild(this._content), this._selectionIcon.style.display = this._isSelected ? "block" : "none", this.refreshTheme();
1663
- }
1664
- getStyles() {
1665
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R, z, O, N, U, V, Z;
1666
- const e = this._themeManager.getTheme();
1667
- return `
1668
- :host {
1669
- display: flex;
1670
- flex-direction: row;
1671
- padding: 6px 12px;
1672
- cursor: pointer;
1673
- }
1674
-
1675
- :host(:hover) {
1676
- background-color: ${((h = (n = (o = (s = (t = e.inbox) == null ? void 0 : t.header) == null ? void 0 : s.menus) == null ? void 0 : o.popup) == null ? void 0 : n.list) == null ? void 0 : h.hoverBackgroundColor) ?? "red"};
1677
- }
1678
-
1679
- :host(:active) {
1680
- background-color: ${((p = (m = (u = (c = (d = e.inbox) == null ? void 0 : d.header) == null ? void 0 : c.menus) == null ? void 0 : u.popup) == null ? void 0 : m.list) == null ? void 0 : p.activeBackgroundColor) ?? "red"};
1681
- }
1682
-
1683
- .menu-item {
1684
- display: flex;
1685
- align-items: center;
1686
- width: 100%;
1687
- gap: 12px;
1688
- }
1689
-
1690
- .spacer {
1691
- flex: 1;
1692
- }
1693
-
1694
- p {
1695
- margin: 0;
1696
- font-family: ${((w = (k = (v = (b = (_ = (x = e.inbox) == null ? void 0 : x.header) == null ? void 0 : _.menus) == null ? void 0 : b.popup) == null ? void 0 : v.list) == null ? void 0 : k.font) == null ? void 0 : w.family) ?? "inherit"};
1697
- font-weight: ${((P = (T = (I = (E = (M = (S = e.inbox) == null ? void 0 : S.header) == null ? void 0 : M.menus) == null ? void 0 : E.popup) == null ? void 0 : I.list) == null ? void 0 : T.font) == null ? void 0 : P.weight) ?? "inherit"};
1698
- font-size: ${((R = (H = (F = (B = (y = ($ = e.inbox) == null ? void 0 : $.header) == null ? void 0 : y.menus) == null ? void 0 : B.popup) == null ? void 0 : F.list) == null ? void 0 : H.font) == null ? void 0 : R.size) ?? "14px"};
1699
- color: ${((Z = (V = (U = (N = (O = (z = e.inbox) == null ? void 0 : z.header) == null ? void 0 : O.menus) == null ? void 0 : N.popup) == null ? void 0 : U.list) == null ? void 0 : V.font) == null ? void 0 : Z.color) ?? "red"};
1700
- white-space: nowrap;
1701
- }
1702
-
1703
- .check-icon {
1704
- display: none;
1705
- }
1706
- `;
1707
- }
1708
- refreshTheme() {
1709
- var e, t, s, o;
1710
- this._style.textContent = this.getStyles(), this._selectionIcon.updateColor(((e = this._option.selectionIcon) == null ? void 0 : e.color) ?? "red"), this._selectionIcon.updateSVG(((t = this._option.selectionIcon) == null ? void 0 : t.svg) ?? f.check), this._title.textContent = this._option.text ?? "Missing Text", this._itemIcon.updateColor(((s = this._option.icon) == null ? void 0 : s.color) ?? "red"), this._itemIcon.updateSVG(((o = this._option.icon) == null ? void 0 : o.svg) ?? f.inbox);
1711
- }
1712
- }
1713
- customElements.get("courier-inbox-filter-menu-item") || customElements.define("courier-inbox-filter-menu-item", yo);
1714
- class Be extends HTMLElement {
1715
- constructor(e, t, s, o, n) {
1716
- super();
1717
- // Theme
1718
- a(this, "_themeSubscription");
1719
- // State
1720
- a(this, "_type");
1721
- a(this, "_selectedIndex", 0);
1722
- a(this, "_options");
1723
- a(this, "_selectable");
1724
- a(this, "_onMenuOpen");
1725
- // Components
1726
- a(this, "_menuButton");
1727
- a(this, "_menu");
1728
- a(this, "_style");
1729
- this._type = t, this._selectable = s, this._options = o, this._selectedIndex = 0, this._onMenuOpen = n;
1730
- const h = this.attachShadow({ mode: "open" });
1731
- this._menuButton = new Se(t === "filters" ? f.filter : f.overflow), this._menu = document.createElement("div"), this._menu.className = `menu ${t}`, this._style = document.createElement("style"), h.appendChild(this._style), h.appendChild(this._menuButton), h.appendChild(this._menu), this._menuButton.addEventListener("click", this.toggleMenu.bind(this)), document.addEventListener("click", this.handleOutsideClick.bind(this)), this._themeSubscription = e.subscribe((d) => {
1732
- this.refreshTheme();
1733
- }), this.refreshTheme();
1734
- }
1735
- getStyles() {
1736
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T;
1737
- const e = this._themeSubscription.manager.getTheme();
1738
- return `
1739
- :host {
1740
- position: relative;
1741
- display: inline-block;
1742
- }
1743
-
1744
- .menu {
1745
- display: none;
1746
- position: absolute;
1747
- top: 42px;
1748
- right: -6px;
1749
- border-radius: ${((n = (o = (s = (t = e.inbox) == null ? void 0 : t.header) == null ? void 0 : s.menus) == null ? void 0 : o.popup) == null ? void 0 : n.borderRadius) ?? "6px"};
1750
- border: ${((u = (c = (d = (h = e.inbox) == null ? void 0 : h.header) == null ? void 0 : d.menus) == null ? void 0 : c.popup) == null ? void 0 : u.border) ?? "1px solid red"};
1751
- background: ${((_ = (x = (p = (m = e.inbox) == null ? void 0 : m.header) == null ? void 0 : p.menus) == null ? void 0 : x.popup) == null ? void 0 : _.backgroundColor) ?? "red"};
1752
- box-shadow: ${((w = (k = (v = (b = e.inbox) == null ? void 0 : b.header) == null ? void 0 : v.menus) == null ? void 0 : k.popup) == null ? void 0 : w.shadow) ?? "0 4px 12px 0 red"};
1753
- z-index: 1000;
1754
- min-width: 200px;
1755
- overflow: hidden;
1756
- padding: 4px 0;
1757
- }
1758
-
1759
- courier-inbox-filter-menu-item {
1760
- border-bottom: ${((T = (I = (E = (M = (S = e.inbox) == null ? void 0 : S.header) == null ? void 0 : M.menus) == null ? void 0 : E.popup) == null ? void 0 : I.list) == null ? void 0 : T.divider) ?? "none"};
1761
- }
1762
-
1763
- courier-inbox-filter-menu-item:last-child {
1764
- border-bottom: none;
1765
- }
1766
- `;
1767
- }
1768
- refreshTheme() {
1769
- var h, d, c, u, m, p;
1770
- this._style.textContent = this.getStyles();
1771
- const t = (d = (h = this._themeSubscription.manager.getTheme().inbox) == null ? void 0 : h.header) == null ? void 0 : d.menus, s = this._type === "filters", o = s ? (c = t == null ? void 0 : t.filters) == null ? void 0 : c.button : (u = t == null ? void 0 : t.actions) == null ? void 0 : u.button, n = s ? f.filter : f.overflow;
1772
- this._menuButton.updateIconSVG(((m = o == null ? void 0 : o.icon) == null ? void 0 : m.svg) ?? n), this._menuButton.updateIconColor(((p = o == null ? void 0 : o.icon) == null ? void 0 : p.color) ?? "red"), this._menuButton.updateBackgroundColor((o == null ? void 0 : o.backgroundColor) ?? "transparent"), this._menuButton.updateHoverBackgroundColor((o == null ? void 0 : o.hoverBackgroundColor) ?? "red"), this._menuButton.updateActiveBackgroundColor((o == null ? void 0 : o.activeBackgroundColor) ?? "red"), this.refreshMenuItems();
1773
- }
1774
- setOptions(e) {
1775
- this._options = e, this.refreshMenuItems();
1776
- }
1777
- refreshMenuItems() {
1778
- this._menu.innerHTML = "", this._options.forEach((e, t) => {
1779
- const s = new yo({
1780
- option: e,
1781
- selectable: this._selectable,
1782
- isSelected: this._selectedIndex === t,
1783
- themeManager: this._themeSubscription.manager
1784
- });
1785
- s.addEventListener("click", () => {
1786
- this._selectedIndex = t, e.onClick(e), this.refreshMenuItems(), this.closeMenu();
1787
- }), this._menu.appendChild(s);
1788
- });
1789
- }
1790
- toggleMenu(e) {
1791
- e.stopPropagation();
1792
- const t = this._menu.style.display !== "block";
1793
- this._menu.style.display = t ? "block" : "none", t && this._onMenuOpen();
1794
- }
1795
- handleOutsideClick(e) {
1796
- this.contains(e.target) || this.closeMenu();
1797
- }
1798
- closeMenu() {
1799
- this._menu.style.display = "none";
1800
- }
1801
- selectOption(e) {
1802
- this._selectedIndex = this._options.findIndex((t) => t.id === e.id), this.refreshMenuItems();
1803
- }
1804
- disconnectedCallback() {
1805
- this._themeSubscription.unsubscribe();
1806
- }
1807
- }
1808
- customElements.get("courier-inbox-option-menu") || customElements.define("courier-inbox-option-menu", Be);
1809
- class $e extends HTMLElement {
1810
- constructor(e) {
1811
- super();
1812
- // Theme
1813
- a(this, "_themeSubscription");
1814
- // State
1815
- a(this, "_location");
1816
- a(this, "_count", 0);
1817
- // Elements
1818
- a(this, "_badge");
1819
- a(this, "_style");
1820
- this._location = e.location, this._themeSubscription = e.themeBus.subscribe((s) => {
1821
- this.refreshTheme(this._location);
1822
- });
1823
- const t = this.attachShadow({ mode: "open" });
1824
- this._badge = document.createElement("span"), this._badge.className = "unread-badge", this._style = document.createElement("style"), this._style.textContent = this.getStyles(this._location), t.appendChild(this._style), t.appendChild(this._badge);
1825
- }
1826
- getStyles(e) {
1827
- var c, u, m, p, x, _, b;
1828
- const t = this._themeSubscription.manager.getTheme(), s = e === "button" ? (u = (c = t.popup) == null ? void 0 : c.button) == null ? void 0 : u.unreadIndicator : (x = (p = (m = t.inbox) == null ? void 0 : m.header) == null ? void 0 : p.filters) == null ? void 0 : x.unreadIndicator, o = s == null ? void 0 : s.backgroundColor, n = s == null ? void 0 : s.borderRadius, h = (_ = s == null ? void 0 : s.font) == null ? void 0 : _.color, d = (b = s == null ? void 0 : s.font) == null ? void 0 : b.size;
1829
- return `
1830
- :host {
1831
- display: inline-block;
1832
- }
1833
-
1834
- .unread-badge {
1835
- background-color: ${o};
1836
- color: ${h};
1837
- border-radius: ${n};
1838
- padding: 4px 8px;
1839
- font-size: ${d};
1840
- text-align: center;
1841
- display: none;
1842
- pointer-events: none;
1843
- }
1844
- `;
1845
- }
1846
- setCount(e) {
1847
- this._count = e, this.updateBadge();
1848
- }
1849
- refreshTheme(e) {
1850
- this._location = e, this.updateBadge();
1851
- }
1852
- updateBadge() {
1853
- this._style.textContent = this.getStyles(this._location), this._count > 0 ? (this._badge.textContent = this._count.toString(), this._badge.style.display = "block") : this._badge.style.display = "none";
1854
- }
1855
- disconnectedCallback() {
1856
- this._themeSubscription.unsubscribe();
1857
- }
1858
- }
1859
- customElements.get("courier-unread-count-badge") || customElements.define("courier-unread-count-badge", $e);
1860
- class ko extends HTMLElement {
1861
- constructor(e, t) {
1862
- super();
1863
- // Theme
1864
- a(this, "_themeSubscription");
1865
- // State
1866
- a(this, "_option");
1867
- a(this, "_feedType");
1868
- // Components
1869
- a(this, "_titleElement");
1870
- a(this, "_iconElement");
1871
- a(this, "_unreadBadge");
1872
- a(this, "_container");
1873
- a(this, "_style");
1874
- this._option = t;
1875
- const s = this.attachShadow({ mode: "open" });
1876
- this._style = document.createElement("style"), this._container = document.createElement("div"), this._container.className = "title-section", this._iconElement = new ie(void 0, this._option.icon.svg), this._titleElement = document.createElement("h2"), this._unreadBadge = new $e({
1877
- themeBus: e,
1878
- location: "header"
1879
- }), this._container.appendChild(this._iconElement), this._container.appendChild(this._titleElement), this._container.appendChild(this._unreadBadge), s.appendChild(this._style), s.appendChild(this._container), this._themeSubscription = e.subscribe((o) => {
1880
- this.refreshTheme(this._feedType ?? "inbox");
1881
- }), this.refreshTheme(this._feedType ?? "inbox");
1882
- }
1883
- getStyles() {
1884
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w;
1885
- const e = this._themeSubscription.manager.getTheme();
1886
- return `
1887
- .title-section {
1888
- display: flex;
1889
- align-items: center;
1890
- gap: 8px;
1891
- position: relative;
1892
- }
1893
-
1894
- courier-icon {
1895
- display: flex;
1896
- align-items: center;
1897
- }
1898
-
1899
- h2 {
1900
- margin: 0;
1901
- font-family: ${((n = (o = (s = (t = e.inbox) == null ? void 0 : t.header) == null ? void 0 : s.filters) == null ? void 0 : o.font) == null ? void 0 : n.family) ?? "inherit"};
1902
- font-size: ${((u = (c = (d = (h = e.inbox) == null ? void 0 : h.header) == null ? void 0 : d.filters) == null ? void 0 : c.font) == null ? void 0 : u.size) ?? "18px"};
1903
- font-weight: ${((_ = (x = (p = (m = e.inbox) == null ? void 0 : m.header) == null ? void 0 : p.filters) == null ? void 0 : x.font) == null ? void 0 : _.weight) ?? "500"};
1904
- color: ${((w = (k = (v = (b = e.inbox) == null ? void 0 : b.header) == null ? void 0 : v.filters) == null ? void 0 : k.font) == null ? void 0 : w.color) ?? "red"};
1905
- }
1906
-
1907
- courier-unread-count-badge {
1908
- margin-left: 4px;
1909
- }
1910
- `;
1911
- }
1912
- refreshTheme(e) {
1913
- this._feedType = e, this._style.textContent = this.getStyles(), this._unreadBadge.refreshTheme("header"), this.updateFilter();
1914
- }
1915
- updateSelectedOption(e, t, s) {
1916
- this._option = e, this._feedType = t, this._unreadBadge.setCount(s), this.updateFilter();
1917
- }
1918
- updateFilter() {
1919
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R;
1920
- const e = this._themeSubscription.manager.getTheme();
1921
- switch (this._feedType) {
1922
- case "inbox":
1923
- this._titleElement.textContent = ((n = (o = (s = (t = e.inbox) == null ? void 0 : t.header) == null ? void 0 : s.filters) == null ? void 0 : o.inbox) == null ? void 0 : n.text) ?? "Inbox", this._iconElement.updateSVG(((m = (u = (c = (d = (h = e.inbox) == null ? void 0 : h.header) == null ? void 0 : d.filters) == null ? void 0 : c.inbox) == null ? void 0 : u.icon) == null ? void 0 : m.svg) ?? f.inbox), this._iconElement.updateColor(((v = (b = (_ = (x = (p = e.inbox) == null ? void 0 : p.header) == null ? void 0 : x.filters) == null ? void 0 : _.inbox) == null ? void 0 : b.icon) == null ? void 0 : v.color) ?? "red");
1924
- break;
1925
- case "archive":
1926
- this._titleElement.textContent = ((M = (S = (w = (k = e.inbox) == null ? void 0 : k.header) == null ? void 0 : w.filters) == null ? void 0 : S.archive) == null ? void 0 : M.text) ?? "Archive", this._iconElement.updateSVG((($ = (P = (T = (I = (E = e.inbox) == null ? void 0 : E.header) == null ? void 0 : I.filters) == null ? void 0 : T.archive) == null ? void 0 : P.icon) == null ? void 0 : $.svg) ?? f.archive), this._iconElement.updateColor(((R = (H = (F = (B = (y = e.inbox) == null ? void 0 : y.header) == null ? void 0 : B.filters) == null ? void 0 : F.archive) == null ? void 0 : H.icon) == null ? void 0 : R.color) ?? "red");
1927
- break;
1928
- }
1929
- }
1930
- // Disconnect the theme subscription
1931
- disconnectedCallback() {
1932
- this._themeSubscription.unsubscribe();
1933
- }
1934
- }
1935
- customElements.get("courier-inbox-header-title") || customElements.define("courier-inbox-header-title", ko);
1936
- class wo extends Le {
1937
- constructor(e) {
1938
- super();
1939
- // Theme
1940
- a(this, "_themeSubscription");
1941
- // State
1942
- a(this, "_feedType", "inbox");
1943
- a(this, "_unreadCount", 0);
1944
- // Components
1945
- a(this, "_titleSection");
1946
- a(this, "_filterMenu");
1947
- a(this, "_actionMenu");
1948
- a(this, "_style");
1949
- // Callbacks
1950
- a(this, "_onFeedTypeChange");
1951
- this._themeSubscription = e.themeManager.subscribe((t) => {
1952
- this.refreshTheme();
1953
- }), this._onFeedTypeChange = e.onFeedTypeChange;
1954
- }
1955
- // Menu options
1956
- getFilterOptions() {
1957
- var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y;
1958
- const e = this._themeSubscription.manager.getTheme(), t = (n = (o = (s = e.inbox) == null ? void 0 : s.header) == null ? void 0 : o.menus) == null ? void 0 : n.filters;
1959
- return [
1960
- {
1961
- id: "inbox",
1962
- text: ((h = t == null ? void 0 : t.inbox) == null ? void 0 : h.text) ?? "Inbox",
1963
- icon: {
1964
- color: ((c = (d = t == null ? void 0 : t.inbox) == null ? void 0 : d.icon) == null ? void 0 : c.color) ?? "red",
1965
- svg: ((m = (u = t == null ? void 0 : t.inbox) == null ? void 0 : u.icon) == null ? void 0 : m.svg) ?? f.inbox
1966
- },
1967
- selectionIcon: {
1968
- color: ((k = (v = (b = (_ = (x = (p = e.inbox) == null ? void 0 : p.header) == null ? void 0 : x.menus) == null ? void 0 : _.popup) == null ? void 0 : b.list) == null ? void 0 : v.selectionIcon) == null ? void 0 : k.color) ?? "red",
1969
- svg: ((T = (I = (E = (M = (S = (w = e.inbox) == null ? void 0 : w.header) == null ? void 0 : S.menus) == null ? void 0 : M.popup) == null ? void 0 : E.list) == null ? void 0 : I.selectionIcon) == null ? void 0 : T.svg) ?? f.check
1970
- },
1971
- onClick: (j) => {
1972
- this.handleOptionMenuItemClick("inbox", j);
1973
- }
1974
- },
1975
- {
1976
- id: "archive",
1977
- text: ((P = t == null ? void 0 : t.archive) == null ? void 0 : P.text) ?? "Archive",
1978
- icon: {
1979
- color: ((y = ($ = t == null ? void 0 : t.archive) == null ? void 0 : $.icon) == null ? void 0 : y.color) ?? "red",
1980
- svg: ((F = (B = t == null ? void 0 : t.archive) == null ? void 0 : B.icon) == null ? void 0 : F.svg) ?? f.archive
1981
- },
1982
- selectionIcon: {
1983
- color: ((U = (N = (O = (z = (R = (H = e.inbox) == null ? void 0 : H.header) == null ? void 0 : R.menus) == null ? void 0 : z.popup) == null ? void 0 : O.list) == null ? void 0 : N.selectionIcon) == null ? void 0 : U.color) ?? "red",
1984
- svg: ((Y = (X = (q = (J = (Z = (V = e.inbox) == null ? void 0 : V.header) == null ? void 0 : Z.menus) == null ? void 0 : J.popup) == null ? void 0 : q.list) == null ? void 0 : X.selectionIcon) == null ? void 0 : Y.svg) ?? f.check
1985
- },
1986
- onClick: (j) => {
1987
- this.handleOptionMenuItemClick("archive", j);
1988
- }
1989
- }
1990
- ];
1991
- }
1992
- getActionOptions() {
1993
- var s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E;
1994
- const t = (n = (o = (s = this._themeSubscription.manager.getTheme().inbox) == null ? void 0 : s.header) == null ? void 0 : o.menus) == null ? void 0 : n.actions;
1995
- return [
1996
- {
1997
- id: "markAllRead",
1998
- text: ((h = t == null ? void 0 : t.markAllRead) == null ? void 0 : h.text) ?? "Mark All as Read",
1999
- icon: {
2000
- color: ((c = (d = t == null ? void 0 : t.markAllRead) == null ? void 0 : d.icon) == null ? void 0 : c.color) ?? "red",
2001
- svg: ((m = (u = t == null ? void 0 : t.markAllRead) == null ? void 0 : u.icon) == null ? void 0 : m.svg) ?? f.inbox
2002
- },
2003
- selectionIcon: null,
2004
- onClick: (I) => {
2005
- A.shared.readAllMessages({ canCallApi: !0 });
2006
- }
2007
- },
2008
- {
2009
- id: "archiveAll",
2010
- text: ((p = t == null ? void 0 : t.archiveAll) == null ? void 0 : p.text) ?? "Archive All",
2011
- icon: {
2012
- color: ((_ = (x = t == null ? void 0 : t.archiveAll) == null ? void 0 : x.icon) == null ? void 0 : _.color) ?? "red",
2013
- svg: ((v = (b = t == null ? void 0 : t.archiveAll) == null ? void 0 : b.icon) == null ? void 0 : v.svg) ?? f.archive
2014
- },
2015
- selectionIcon: null,
2016
- onClick: (I) => {
2017
- var T;
2018
- alert(JSON.stringify((T = C.shared.client) == null ? void 0 : T.options));
2019
- }
2020
- },
2021
- {
2022
- id: "archiveRead",
2023
- text: ((k = t == null ? void 0 : t.archiveRead) == null ? void 0 : k.text) ?? "Archive Read",
2024
- icon: {
2025
- color: ((S = (w = t == null ? void 0 : t.archiveRead) == null ? void 0 : w.icon) == null ? void 0 : S.color) ?? "red",
2026
- svg: ((E = (M = t == null ? void 0 : t.archiveRead) == null ? void 0 : M.icon) == null ? void 0 : E.svg) ?? f.archive
2027
- },
2028
- selectionIcon: null,
2029
- onClick: (I) => {
2030
- A.shared.archiveReadMessages({ canCallApi: !0 });
2031
- }
2032
- }
2033
- ];
2034
- }
2035
- static get observedAttributes() {
2036
- return ["icon", "title", "feed-type"];
2037
- }
2038
- refreshTheme() {
2039
- var s, o, n, h, d, c, u;
2040
- const e = this._themeSubscription.manager.getTheme(), t = (s = this.shadow) == null ? void 0 : s.querySelector(".courier-inbox-header");
2041
- t && (t.style.backgroundColor = ((n = (o = e.inbox) == null ? void 0 : o.header) == null ? void 0 : n.backgroundColor) ?? r.white[500], t.style.boxShadow = ((d = (h = e.inbox) == null ? void 0 : h.header) == null ? void 0 : d.shadow) ?? `0px 1px 0px 0px ${r.gray[500]}`), (c = this._filterMenu) == null || c.setOptions(this.getFilterOptions()), (u = this._actionMenu) == null || u.setOptions(this.getActionOptions());
2042
- }
2043
- handleOptionMenuItemClick(e, t) {
2044
- this._feedType = e, this._titleSection && this._titleSection.updateSelectedOption(t, this._feedType, this._feedType === "inbox" ? this._unreadCount : 0), this._onFeedTypeChange(e);
2045
- }
2046
- render(e) {
2047
- this._feedType = e.feedType, this._unreadCount = e.unreadCount, this.refreshTitleSection();
2048
- }
2049
- refreshTitleSection() {
2050
- var t, s;
2051
- const e = this.getFilterOptions().find((o) => ["inbox", "archive"].includes(o.id) && o.id === this._feedType);
2052
- e && ((t = this._titleSection) == null || t.updateSelectedOption(e, this._feedType, this._feedType === "inbox" ? this._unreadCount : 0), (s = this._filterMenu) == null || s.selectOption(e));
2053
- }
2054
- build(e) {
2055
- var t;
2056
- super.build(e), this._style = document.createElement("style"), this._style.textContent = this.getStyles(), (t = this.shadow) == null || t.appendChild(this._style), this.refreshTheme();
2057
- }
2058
- defaultElement() {
2059
- const e = this.getFilterOptions();
2060
- this._titleSection = new ko(this._themeSubscription.manager, e[0]), this._filterMenu = new Be(this._themeSubscription.manager, "filters", !0, e, () => {
2061
- var n;
2062
- (n = this._actionMenu) == null || n.closeMenu();
2063
- }), this._actionMenu = new Be(this._themeSubscription.manager, "actions", !1, this.getActionOptions(), () => {
2064
- var n;
2065
- (n = this._filterMenu) == null || n.closeMenu();
2066
- }), this._filterMenu.selectOption(e[0]);
2067
- const t = document.createElement("div");
2068
- t.className = "spacer";
2069
- const s = document.createElement("div");
2070
- s.className = "actions", s.appendChild(this._filterMenu), s.appendChild(this._actionMenu);
2071
- const o = document.createElement("div");
2072
- return o.className = "courier-inbox-header", o.appendChild(this._titleSection), o.appendChild(t), o.appendChild(s), o;
2073
- }
2074
- getStyles() {
2075
- return `
2076
- :host {
2077
- z-index: 100;
2078
- }
2079
-
2080
- .courier-inbox-header {
2081
- display: flex;
2082
- align-items: center;
2083
- justify-content: space-between;
2084
- padding: 10px 10px 10px 16px;
2085
- background-color: ${r.white[500]};
2086
- box-shadow: 0px 1px 0px 0px ${r.gray[500]};
2087
- }
2088
-
2089
- .header-content {
2090
- display: flex;
2091
- align-items: center;
2092
- flex: 1;
2093
- }
2094
-
2095
- .spacer {
2096
- flex: 1;
2097
- }
2098
-
2099
- .actions {
2100
- display: flex;
2101
- align-items: center;
2102
- gap: 4px;
2103
- }
2104
- `;
2105
- }
2106
- // Disconnect the theme subscription
2107
- disconnectedCallback() {
2108
- this._themeSubscription.unsubscribe();
2109
- }
2110
- }
2111
- customElements.get("courier-inbox-header") || customElements.define("courier-inbox-header", wo);
2112
- class So {
2113
- constructor(i) {
2114
- a(this, "events");
2115
- this.events = i;
2116
- }
2117
- remove() {
2118
- A.shared.removeDataStoreListener(this);
2119
- }
2120
- }
2121
- const we = {
2122
- popup: {
2123
- button: {
2124
- icon: {
2125
- color: r.black[500],
2126
- svg: f.inbox
2127
- },
2128
- backgroundColor: "transparent",
2129
- hoverBackgroundColor: r.black[50010],
2130
- activeBackgroundColor: r.black[50020],
2131
- unreadIndicator: {
2132
- font: {
2133
- color: r.white[500],
2134
- size: "14px",
2135
- family: void 0,
2136
- weight: void 0
2137
- },
2138
- backgroundColor: r.blue[500],
2139
- borderRadius: "12px"
2140
- }
2141
- },
2142
- window: {
2143
- backgroundColor: r.white[500],
2144
- borderRadius: "8px",
2145
- border: `1px solid ${r.gray[500]}`,
2146
- shadow: `0px 8px 16px -4px ${r.gray[500]}`
2147
- }
2148
- },
2149
- inbox: {
2150
- header: {
2151
- backgroundColor: r.white[500],
2152
- shadow: `0px 1px 0px 0px ${r.gray[500]}`,
2153
- filters: {
2154
- font: {
2155
- color: r.black[500],
2156
- family: void 0,
2157
- size: "18px"
2158
- },
2159
- inbox: {
2160
- icon: {
2161
- color: r.black[500],
2162
- svg: f.inbox
2163
- },
2164
- text: "Inbox"
2165
- },
2166
- archive: {
2167
- icon: {
2168
- color: r.black[500],
2169
- svg: f.archive
2170
- },
2171
- text: "Archive"
2172
- },
2173
- unreadIndicator: {
2174
- font: {
2175
- color: r.white[500],
2176
- family: void 0,
2177
- size: "14px"
2178
- },
2179
- backgroundColor: r.blue[500],
2180
- borderRadius: "12px"
2181
- }
2182
- },
2183
- menus: {
2184
- popup: {
2185
- backgroundColor: r.white[500],
2186
- border: `1px solid ${r.gray[500]}`,
2187
- borderRadius: "4px",
2188
- shadow: `0px 4px 8px -2px ${r.gray[500]}`,
2189
- list: {
2190
- hoverBackgroundColor: r.gray[200],
2191
- activeBackgroundColor: r.gray[500],
2192
- divider: "none",
2193
- font: {
2194
- color: r.black[500],
2195
- family: void 0,
2196
- size: "14px"
2197
- },
2198
- selectionIcon: {
2199
- color: r.black[500],
2200
- svg: f.check
2201
- }
2202
- }
2203
- },
2204
- filters: {
2205
- button: {
2206
- icon: {
2207
- color: r.black[500],
2208
- svg: f.filter
2209
- },
2210
- backgroundColor: "transparent",
2211
- hoverBackgroundColor: r.black[50010],
2212
- activeBackgroundColor: r.black[50020]
2213
- },
2214
- inbox: {
2215
- icon: {
2216
- color: r.black[500],
2217
- svg: f.inbox
2218
- },
2219
- text: "Inbox"
2220
- },
2221
- archive: {
2222
- icon: {
2223
- color: r.black[500],
2224
- svg: f.archive
2225
- },
2226
- text: "Archive"
2227
- }
2228
- },
2229
- actions: {
2230
- button: {
2231
- icon: {
2232
- color: r.black[500],
2233
- svg: f.overflow
2234
- },
2235
- backgroundColor: "transparent",
2236
- hoverBackgroundColor: r.black[50010],
2237
- activeBackgroundColor: r.black[50020]
2238
- },
2239
- markAllRead: {
2240
- icon: {
2241
- color: r.black[500],
2242
- svg: f.read
2243
- },
2244
- text: "Mark All as Read"
2245
- },
2246
- archiveAll: {
2247
- icon: {
2248
- color: r.black[500],
2249
- svg: f.archive
2250
- },
2251
- text: "Archive All"
2252
- },
2253
- archiveRead: {
2254
- icon: {
2255
- color: r.black[500],
2256
- svg: f.archiveRead
2257
- },
2258
- text: "Archive Read"
2259
- }
2260
- }
2261
- }
2262
- },
2263
- list: {
2264
- backgroundColor: r.white[500],
2265
- item: {
2266
- backgroundColor: "transparent",
2267
- unreadIndicatorColor: r.blue[500],
2268
- hoverBackgroundColor: r.gray[200],
2269
- activeBackgroundColor: r.gray[500],
2270
- actions: {
2271
- backgroundColor: "transparent",
2272
- hoverBackgroundColor: r.gray[200],
2273
- activeBackgroundColor: r.gray[500],
2274
- border: `1px solid ${r.gray[500]}`,
2275
- borderRadius: "4px",
2276
- shadow: "0px 1px 2px 0px rgba(0, 0, 0, 0.06)",
2277
- font: {
2278
- color: r.black[500],
2279
- family: void 0,
2280
- size: "14px"
2281
- }
2282
- },
2283
- title: {
2284
- color: r.black[500],
2285
- family: void 0,
2286
- size: "14px"
2287
- },
2288
- subtitle: {
2289
- color: r.gray[600],
2290
- family: void 0,
2291
- size: "14px"
2292
- },
2293
- time: {
2294
- color: r.gray[600],
2295
- family: void 0,
2296
- size: "14px"
2297
- },
2298
- divider: `1px solid ${r.gray[200]}`,
2299
- menu: {
2300
- enabled: !0,
2301
- backgroundColor: r.white[500],
2302
- border: `1px solid ${r.gray[500]}`,
2303
- borderRadius: "4px",
2304
- shadow: `0px 2px 4px -2px ${r.gray[500]}`,
2305
- longPress: {
2306
- displayDuration: 4e3,
2307
- vibrationDuration: 50
2308
- },
2309
- item: {
2310
- hoverBackgroundColor: r.gray[200],
2311
- activeBackgroundColor: r.gray[500],
2312
- borderRadius: "0px",
2313
- read: {
2314
- color: r.black[500],
2315
- svg: f.read
2316
- },
2317
- unread: {
2318
- color: r.black[500],
2319
- svg: f.unread
2320
- },
2321
- archive: {
2322
- color: r.black[500],
2323
- svg: f.archive
2324
- },
2325
- unarchive: {
2326
- color: r.black[500],
2327
- svg: f.unarchive
2328
- }
2329
- }
2330
- }
2331
- }
2332
- },
2333
- loading: {
2334
- animation: {
2335
- barColor: r.gray[500],
2336
- barHeight: "14px",
2337
- barBorderRadius: "14px",
2338
- duration: "2s"
2339
- },
2340
- divider: `1px solid ${r.gray[200]}`
2341
- },
2342
- empty: {
2343
- title: {
2344
- font: {
2345
- size: "16px",
2346
- weight: "500",
2347
- color: r.black[500]
2348
- }
2349
- },
2350
- button: {
2351
- text: "Refresh"
2352
- }
2353
- },
2354
- error: {
2355
- title: {
2356
- font: {
2357
- size: "16px",
2358
- weight: "500",
2359
- color: r.black[500]
2360
- }
2361
- },
2362
- button: {
2363
- text: "Retry"
2364
- }
2365
- }
2366
- }
2367
- }, Ae = {
2368
- popup: {
2369
- button: {
2370
- icon: {
2371
- color: r.white[500],
2372
- svg: f.inbox
2373
- },
2374
- backgroundColor: "transparent",
2375
- hoverBackgroundColor: r.white[50010],
2376
- activeBackgroundColor: r.white[50020],
2377
- unreadIndicator: {
2378
- font: {
2379
- color: r.white[500],
2380
- size: "14px",
2381
- family: void 0,
2382
- weight: void 0
2383
- },
2384
- backgroundColor: r.blue[500],
2385
- borderRadius: "12px"
2386
- }
2387
- },
2388
- window: {
2389
- backgroundColor: r.black[500],
2390
- borderRadius: "8px",
2391
- border: `1px solid ${r.gray[400]}`,
2392
- shadow: `0px 4px 8px -2px ${r.white[50020]}`
2393
- }
2394
- },
2395
- inbox: {
2396
- header: {
2397
- backgroundColor: r.black[500],
2398
- shadow: `0px 1px 0px 0px ${r.gray[400]}`,
2399
- filters: {
2400
- font: {
2401
- color: r.white[500],
2402
- family: void 0,
2403
- size: "18px"
2404
- },
2405
- inbox: {
2406
- icon: {
2407
- color: r.white[500],
2408
- svg: f.inbox
2409
- },
2410
- text: "Inbox"
2411
- },
2412
- archive: {
2413
- icon: {
2414
- color: r.white[500],
2415
- svg: f.archive
2416
- },
2417
- text: "Archive"
2418
- },
2419
- unreadIndicator: {
2420
- font: {
2421
- color: r.white[500],
2422
- family: void 0,
2423
- size: "14px"
2424
- },
2425
- backgroundColor: r.blue[500],
2426
- borderRadius: "12px"
2427
- }
2428
- },
2429
- menus: {
2430
- popup: {
2431
- backgroundColor: r.black[500],
2432
- border: `1px solid ${r.gray[400]}`,
2433
- borderRadius: "4px",
2434
- shadow: `0px 4px 8px -2px ${r.white[50020]}`,
2435
- list: {
2436
- hoverBackgroundColor: r.white[50010],
2437
- activeBackgroundColor: r.white[50020],
2438
- divider: "none",
2439
- font: {
2440
- color: r.white[500],
2441
- family: void 0,
2442
- size: "14px"
2443
- },
2444
- selectionIcon: {
2445
- color: r.white[500],
2446
- svg: f.check
2447
- }
2448
- }
2449
- },
2450
- filters: {
2451
- button: {
2452
- icon: {
2453
- color: r.white[500],
2454
- svg: f.filter
2455
- },
2456
- backgroundColor: "transparent",
2457
- hoverBackgroundColor: r.white[50010],
2458
- activeBackgroundColor: r.white[50020]
2459
- },
2460
- inbox: {
2461
- icon: {
2462
- color: r.white[500],
2463
- svg: f.inbox
2464
- },
2465
- text: "Inbox"
2466
- },
2467
- archive: {
2468
- icon: {
2469
- color: r.white[500],
2470
- svg: f.archive
2471
- },
2472
- text: "Archive"
2473
- }
2474
- },
2475
- actions: {
2476
- button: {
2477
- icon: {
2478
- color: r.white[500],
2479
- svg: f.overflow
2480
- },
2481
- backgroundColor: "transparent",
2482
- hoverBackgroundColor: r.white[50010],
2483
- activeBackgroundColor: r.white[50020]
2484
- },
2485
- markAllRead: {
2486
- icon: {
2487
- color: r.white[500],
2488
- svg: f.read
2489
- },
2490
- text: "Mark All as Read"
2491
- },
2492
- archiveAll: {
2493
- icon: {
2494
- color: r.white[500],
2495
- svg: f.archive
2496
- },
2497
- text: "Archive All"
2498
- },
2499
- archiveRead: {
2500
- icon: {
2501
- color: r.white[500],
2502
- svg: f.archiveRead
2503
- },
2504
- text: "Archive Read"
2505
- }
2506
- }
2507
- }
2508
- },
2509
- list: {
2510
- backgroundColor: r.black[500],
2511
- item: {
2512
- backgroundColor: "transparent",
2513
- unreadIndicatorColor: r.blue[500],
2514
- hoverBackgroundColor: r.white[50010],
2515
- activeBackgroundColor: r.white[50020],
2516
- actions: {
2517
- backgroundColor: "transparent",
2518
- hoverBackgroundColor: r.white[50010],
2519
- activeBackgroundColor: r.white[50020],
2520
- border: `1px solid ${r.gray[400]}`,
2521
- borderRadius: "4px",
2522
- shadow: `0px 1px 2px 0px ${r.white[50010]}`,
2523
- font: {
2524
- color: r.white[500],
2525
- family: void 0,
2526
- size: "14px"
2527
- }
2528
- },
2529
- title: {
2530
- color: r.white[500],
2531
- family: void 0,
2532
- size: "14px"
2533
- },
2534
- subtitle: {
2535
- color: r.gray[500],
2536
- family: void 0,
2537
- size: "14px"
2538
- },
2539
- time: {
2540
- color: r.gray[500],
2541
- family: void 0,
2542
- size: "12px"
2543
- },
2544
- divider: `1px solid ${r.gray[400]}`,
2545
- menu: {
2546
- enabled: !0,
2547
- backgroundColor: r.black[500],
2548
- border: `1px solid ${r.gray[400]}`,
2549
- borderRadius: "4px",
2550
- shadow: `0px 2px 4px -2px ${r.white[50020]}`,
2551
- longPress: {
2552
- displayDuration: 4e3,
2553
- vibrationDuration: 50
2554
- },
2555
- item: {
2556
- hoverBackgroundColor: r.white[50010],
2557
- activeBackgroundColor: r.white[50020],
2558
- borderRadius: "0px",
2559
- read: {
2560
- color: r.white[500],
2561
- svg: f.read
2562
- },
2563
- unread: {
2564
- color: r.white[500],
2565
- svg: f.unread
2566
- },
2567
- archive: {
2568
- color: r.white[500],
2569
- svg: f.archive
2570
- },
2571
- unarchive: {
2572
- color: r.white[500],
2573
- svg: f.unarchive
2574
- }
2575
- }
2576
- }
2577
- }
2578
- },
2579
- loading: {
2580
- animation: {
2581
- barColor: r.white[500],
2582
- barHeight: "14px",
2583
- barBorderRadius: "14px",
2584
- duration: "2s"
2585
- },
2586
- divider: `1px solid ${r.gray[400]}`
2587
- },
2588
- empty: {
2589
- title: {
2590
- font: {
2591
- size: "16px",
2592
- weight: "500",
2593
- color: r.white[500]
2594
- }
2595
- },
2596
- button: {
2597
- text: "Refresh"
2598
- }
2599
- },
2600
- error: {
2601
- title: {
2602
- font: {
2603
- size: "16px",
2604
- weight: "500",
2605
- color: r.white[500]
2606
- }
2607
- },
2608
- button: {
2609
- text: "Retry"
2610
- }
2611
- }
2612
- }
2613
- }, $o = (g, i) => {
2614
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M, E, I, T, P, $, y, B, F, H, R, z, O, N, U, V, Z, J, q, X, Y, j, se, oe, ne, re, ae, he, ce, le, de, ue, pe, ge, me, be, _e, xe, fe, Ce, ve, ye, l, D, K, Q, W, ke, Fe, He, Re, ze, Oe, Ne, Ue, Ve, Ze, We, je, Ge, Je, qe, Xe, Ye, Ke, Qe, et, tt, it, st, ot, nt, rt, at, ht, ct, lt, dt, ut, pt, gt, mt, bt, _t, xt, ft, Ct, vt, yt, kt, wt, St, Mt, Et, It, Lt, Tt, Bt, At, Dt, Pt, $t, Ft, Ht, Rt, zt, Ot, Nt, Ut, Vt, Zt, Wt, jt, Gt, Jt, qt, Xt, Yt, Kt, Qt, ei, ti, ii, si, oi, ni, ri, ai, hi, ci, li, di, ui, pi, gi, mi, bi, _i, xi, fi, Ci, vi, yi, ki, wi, Si, Mi, Ei, Ii, Li, Ti, Bi, Ai, Di, Pi, $i, Fi, Hi, Ri, zi, Oi, Ni, Ui, Vi, Zi, Wi, ji, Gi, Ji, qi, Xi, Yi, Ki, Qi, es, ts, is, ss, os, ns, rs, as, hs, cs, ls, ds, us, ps, gs, ms, bs, _s, xs, fs, Cs, vs, ys, ks, ws, Ss, Ms, Es, Is, Ls, Ts, Bs, As, Ds, Ps, $s, Fs, Hs, Rs, zs, Os, Ns, Us, Vs, Zs, Ws, js, Gs, Js, qs, Xs, Ys, Ks, Qs, eo, to, io, so, oo, no, ro, ao, ho, co, lo, uo, po;
2615
- const e = g === "light" ? we : Ae;
2616
- return {
2617
- popup: {
2618
- button: {
2619
- ...(t = e.popup) == null ? void 0 : t.button,
2620
- ...(s = i.popup) == null ? void 0 : s.button,
2621
- icon: {
2622
- ...(n = (o = e.popup) == null ? void 0 : o.button) == null ? void 0 : n.icon,
2623
- ...(d = (h = i.popup) == null ? void 0 : h.button) == null ? void 0 : d.icon
2624
- },
2625
- unreadIndicator: {
2626
- ...(u = (c = e.popup) == null ? void 0 : c.button) == null ? void 0 : u.unreadIndicator,
2627
- ...(p = (m = i.popup) == null ? void 0 : m.button) == null ? void 0 : p.unreadIndicator
2628
- }
2629
- },
2630
- window: {
2631
- ...(x = e.popup) == null ? void 0 : x.window,
2632
- ...(_ = i.popup) == null ? void 0 : _.window
2633
- }
2634
- },
2635
- inbox: {
2636
- header: {
2637
- ...(b = e.inbox) == null ? void 0 : b.header,
2638
- ...(v = i.inbox) == null ? void 0 : v.header,
2639
- filters: {
2640
- ...(w = (k = e.inbox) == null ? void 0 : k.header) == null ? void 0 : w.filters,
2641
- ...(M = (S = i.inbox) == null ? void 0 : S.header) == null ? void 0 : M.filters,
2642
- inbox: {
2643
- ...(T = (I = (E = e.inbox) == null ? void 0 : E.header) == null ? void 0 : I.filters) == null ? void 0 : T.inbox,
2644
- ...(y = ($ = (P = i.inbox) == null ? void 0 : P.header) == null ? void 0 : $.filters) == null ? void 0 : y.inbox,
2645
- icon: {
2646
- ...(R = (H = (F = (B = e.inbox) == null ? void 0 : B.header) == null ? void 0 : F.filters) == null ? void 0 : H.inbox) == null ? void 0 : R.icon,
2647
- ...(U = (N = (O = (z = i.inbox) == null ? void 0 : z.header) == null ? void 0 : O.filters) == null ? void 0 : N.inbox) == null ? void 0 : U.icon
2648
- }
2649
- },
2650
- archive: {
2651
- ...(J = (Z = (V = e.inbox) == null ? void 0 : V.header) == null ? void 0 : Z.filters) == null ? void 0 : J.archive,
2652
- ...(Y = (X = (q = i.inbox) == null ? void 0 : q.header) == null ? void 0 : X.filters) == null ? void 0 : Y.archive,
2653
- icon: {
2654
- ...(ne = (oe = (se = (j = e.inbox) == null ? void 0 : j.header) == null ? void 0 : se.filters) == null ? void 0 : oe.archive) == null ? void 0 : ne.icon,
2655
- ...(ce = (he = (ae = (re = i.inbox) == null ? void 0 : re.header) == null ? void 0 : ae.filters) == null ? void 0 : he.archive) == null ? void 0 : ce.icon
2656
- }
2657
- },
2658
- unreadIndicator: {
2659
- ...(ue = (de = (le = e.inbox) == null ? void 0 : le.header) == null ? void 0 : de.filters) == null ? void 0 : ue.unreadIndicator,
2660
- ...(me = (ge = (pe = i.inbox) == null ? void 0 : pe.header) == null ? void 0 : ge.filters) == null ? void 0 : me.unreadIndicator
2661
- }
2662
- },
2663
- menus: {
2664
- ...(_e = (be = e.inbox) == null ? void 0 : be.header) == null ? void 0 : _e.menus,
2665
- ...(fe = (xe = i.inbox) == null ? void 0 : xe.header) == null ? void 0 : fe.menus,
2666
- popup: {
2667
- ...(ye = (ve = (Ce = e.inbox) == null ? void 0 : Ce.header) == null ? void 0 : ve.menus) == null ? void 0 : ye.popup,
2668
- ...(K = (D = (l = i.inbox) == null ? void 0 : l.header) == null ? void 0 : D.menus) == null ? void 0 : K.popup,
2669
- list: {
2670
- ...(Fe = (ke = (W = (Q = e.inbox) == null ? void 0 : Q.header) == null ? void 0 : W.menus) == null ? void 0 : ke.popup) == null ? void 0 : Fe.list,
2671
- ...(Oe = (ze = (Re = (He = i.inbox) == null ? void 0 : He.header) == null ? void 0 : Re.menus) == null ? void 0 : ze.popup) == null ? void 0 : Oe.list,
2672
- font: {
2673
- ...(We = (Ze = (Ve = (Ue = (Ne = e.inbox) == null ? void 0 : Ne.header) == null ? void 0 : Ue.menus) == null ? void 0 : Ve.popup) == null ? void 0 : Ze.list) == null ? void 0 : We.font,
2674
- ...(Xe = (qe = (Je = (Ge = (je = i.inbox) == null ? void 0 : je.header) == null ? void 0 : Ge.menus) == null ? void 0 : Je.popup) == null ? void 0 : qe.list) == null ? void 0 : Xe.font
2675
- },
2676
- selectionIcon: {
2677
- ...(tt = (et = (Qe = (Ke = (Ye = e.inbox) == null ? void 0 : Ye.header) == null ? void 0 : Ke.menus) == null ? void 0 : Qe.popup) == null ? void 0 : et.list) == null ? void 0 : tt.selectionIcon,
2678
- ...(rt = (nt = (ot = (st = (it = i.inbox) == null ? void 0 : it.header) == null ? void 0 : st.menus) == null ? void 0 : ot.popup) == null ? void 0 : nt.list) == null ? void 0 : rt.selectionIcon
2679
- }
2680
- }
2681
- },
2682
- filters: {
2683
- ...(ct = (ht = (at = e.inbox) == null ? void 0 : at.header) == null ? void 0 : ht.menus) == null ? void 0 : ct.filters,
2684
- ...(ut = (dt = (lt = i.inbox) == null ? void 0 : lt.header) == null ? void 0 : dt.menus) == null ? void 0 : ut.filters,
2685
- inbox: {
2686
- ...(bt = (mt = (gt = (pt = e.inbox) == null ? void 0 : pt.header) == null ? void 0 : gt.menus) == null ? void 0 : mt.filters) == null ? void 0 : bt.inbox,
2687
- ...(Ct = (ft = (xt = (_t = i.inbox) == null ? void 0 : _t.header) == null ? void 0 : xt.menus) == null ? void 0 : ft.filters) == null ? void 0 : Ct.inbox,
2688
- icon: {
2689
- ...(St = (wt = (kt = (yt = (vt = e.inbox) == null ? void 0 : vt.header) == null ? void 0 : yt.menus) == null ? void 0 : kt.filters) == null ? void 0 : wt.inbox) == null ? void 0 : St.icon,
2690
- ...(Tt = (Lt = (It = (Et = (Mt = i.inbox) == null ? void 0 : Mt.header) == null ? void 0 : Et.menus) == null ? void 0 : It.filters) == null ? void 0 : Lt.inbox) == null ? void 0 : Tt.icon
2691
- }
2692
- },
2693
- archive: {
2694
- ...(Pt = (Dt = (At = (Bt = e.inbox) == null ? void 0 : Bt.header) == null ? void 0 : At.menus) == null ? void 0 : Dt.filters) == null ? void 0 : Pt.archive,
2695
- ...(Rt = (Ht = (Ft = ($t = i.inbox) == null ? void 0 : $t.header) == null ? void 0 : Ft.menus) == null ? void 0 : Ht.filters) == null ? void 0 : Rt.archive,
2696
- icon: {
2697
- ...(Vt = (Ut = (Nt = (Ot = (zt = e.inbox) == null ? void 0 : zt.header) == null ? void 0 : Ot.menus) == null ? void 0 : Nt.filters) == null ? void 0 : Ut.archive) == null ? void 0 : Vt.icon,
2698
- ...(Jt = (Gt = (jt = (Wt = (Zt = i.inbox) == null ? void 0 : Zt.header) == null ? void 0 : Wt.menus) == null ? void 0 : jt.filters) == null ? void 0 : Gt.archive) == null ? void 0 : Jt.icon
2699
- }
2700
- }
2701
- },
2702
- actions: {
2703
- ...(Yt = (Xt = (qt = e.inbox) == null ? void 0 : qt.header) == null ? void 0 : Xt.menus) == null ? void 0 : Yt.actions,
2704
- ...(ei = (Qt = (Kt = i.inbox) == null ? void 0 : Kt.header) == null ? void 0 : Qt.menus) == null ? void 0 : ei.actions,
2705
- markAllRead: {
2706
- ...(oi = (si = (ii = (ti = e.inbox) == null ? void 0 : ti.header) == null ? void 0 : ii.menus) == null ? void 0 : si.actions) == null ? void 0 : oi.markAllRead,
2707
- ...(hi = (ai = (ri = (ni = i.inbox) == null ? void 0 : ni.header) == null ? void 0 : ri.menus) == null ? void 0 : ai.actions) == null ? void 0 : hi.markAllRead,
2708
- icon: {
2709
- ...(pi = (ui = (di = (li = (ci = e.inbox) == null ? void 0 : ci.header) == null ? void 0 : li.menus) == null ? void 0 : di.actions) == null ? void 0 : ui.markAllRead) == null ? void 0 : pi.icon,
2710
- ...(xi = (_i = (bi = (mi = (gi = i.inbox) == null ? void 0 : gi.header) == null ? void 0 : mi.menus) == null ? void 0 : bi.actions) == null ? void 0 : _i.markAllRead) == null ? void 0 : xi.icon
2711
- }
2712
- },
2713
- archiveAll: {
2714
- ...(yi = (vi = (Ci = (fi = e.inbox) == null ? void 0 : fi.header) == null ? void 0 : Ci.menus) == null ? void 0 : vi.actions) == null ? void 0 : yi.archiveAll,
2715
- ...(Mi = (Si = (wi = (ki = i.inbox) == null ? void 0 : ki.header) == null ? void 0 : wi.menus) == null ? void 0 : Si.actions) == null ? void 0 : Mi.archiveAll,
2716
- icon: {
2717
- ...(Bi = (Ti = (Li = (Ii = (Ei = e.inbox) == null ? void 0 : Ei.header) == null ? void 0 : Ii.menus) == null ? void 0 : Li.actions) == null ? void 0 : Ti.archiveAll) == null ? void 0 : Bi.icon,
2718
- ...(Fi = ($i = (Pi = (Di = (Ai = i.inbox) == null ? void 0 : Ai.header) == null ? void 0 : Di.menus) == null ? void 0 : Pi.actions) == null ? void 0 : $i.archiveAll) == null ? void 0 : Fi.icon
2719
- }
2720
- },
2721
- archiveRead: {
2722
- ...(Oi = (zi = (Ri = (Hi = e.inbox) == null ? void 0 : Hi.header) == null ? void 0 : Ri.menus) == null ? void 0 : zi.actions) == null ? void 0 : Oi.archiveRead,
2723
- ...(Zi = (Vi = (Ui = (Ni = i.inbox) == null ? void 0 : Ni.header) == null ? void 0 : Ui.menus) == null ? void 0 : Vi.actions) == null ? void 0 : Zi.archiveRead,
2724
- icon: {
2725
- ...(qi = (Ji = (Gi = (ji = (Wi = e.inbox) == null ? void 0 : Wi.header) == null ? void 0 : ji.menus) == null ? void 0 : Gi.actions) == null ? void 0 : Ji.archiveRead) == null ? void 0 : qi.icon,
2726
- ...(es = (Qi = (Ki = (Yi = (Xi = i.inbox) == null ? void 0 : Xi.header) == null ? void 0 : Yi.menus) == null ? void 0 : Ki.actions) == null ? void 0 : Qi.archiveRead) == null ? void 0 : es.icon
2727
- }
2728
- }
2729
- }
2730
- }
2731
- },
2732
- list: {
2733
- ...(ts = e.inbox) == null ? void 0 : ts.list,
2734
- ...(is = i.inbox) == null ? void 0 : is.list,
2735
- item: {
2736
- ...(os = (ss = e.inbox) == null ? void 0 : ss.list) == null ? void 0 : os.item,
2737
- ...(rs = (ns = i.inbox) == null ? void 0 : ns.list) == null ? void 0 : rs.item,
2738
- menu: {
2739
- ...(cs = (hs = (as = e.inbox) == null ? void 0 : as.list) == null ? void 0 : hs.item) == null ? void 0 : cs.menu,
2740
- ...(us = (ds = (ls = i.inbox) == null ? void 0 : ls.list) == null ? void 0 : ds.item) == null ? void 0 : us.menu,
2741
- item: {
2742
- ...(bs = (ms = (gs = (ps = e.inbox) == null ? void 0 : ps.list) == null ? void 0 : gs.item) == null ? void 0 : ms.menu) == null ? void 0 : bs.item,
2743
- ...(Cs = (fs = (xs = (_s = i.inbox) == null ? void 0 : _s.list) == null ? void 0 : xs.item) == null ? void 0 : fs.menu) == null ? void 0 : Cs.item,
2744
- read: {
2745
- ...(Ss = (ws = (ks = (ys = (vs = e.inbox) == null ? void 0 : vs.list) == null ? void 0 : ys.item) == null ? void 0 : ks.menu) == null ? void 0 : ws.item) == null ? void 0 : Ss.read,
2746
- ...(Ts = (Ls = (Is = (Es = (Ms = i.inbox) == null ? void 0 : Ms.list) == null ? void 0 : Es.item) == null ? void 0 : Is.menu) == null ? void 0 : Ls.item) == null ? void 0 : Ts.read
2747
- },
2748
- unread: {
2749
- ...($s = (Ps = (Ds = (As = (Bs = e.inbox) == null ? void 0 : Bs.list) == null ? void 0 : As.item) == null ? void 0 : Ds.menu) == null ? void 0 : Ps.item) == null ? void 0 : $s.unread,
2750
- ...(Os = (zs = (Rs = (Hs = (Fs = i.inbox) == null ? void 0 : Fs.list) == null ? void 0 : Hs.item) == null ? void 0 : Rs.menu) == null ? void 0 : zs.item) == null ? void 0 : Os.unread
2751
- },
2752
- archive: {
2753
- ...(Ws = (Zs = (Vs = (Us = (Ns = e.inbox) == null ? void 0 : Ns.list) == null ? void 0 : Us.item) == null ? void 0 : Vs.menu) == null ? void 0 : Zs.item) == null ? void 0 : Ws.archive,
2754
- ...(Xs = (qs = (Js = (Gs = (js = i.inbox) == null ? void 0 : js.list) == null ? void 0 : Gs.item) == null ? void 0 : Js.menu) == null ? void 0 : qs.item) == null ? void 0 : Xs.archive
2755
- },
2756
- unarchive: {
2757
- ...(to = (eo = (Qs = (Ks = (Ys = e.inbox) == null ? void 0 : Ys.list) == null ? void 0 : Ks.item) == null ? void 0 : Qs.menu) == null ? void 0 : eo.item) == null ? void 0 : to.unarchive,
2758
- ...(ro = (no = (oo = (so = (io = i.inbox) == null ? void 0 : io.list) == null ? void 0 : so.item) == null ? void 0 : oo.menu) == null ? void 0 : no.item) == null ? void 0 : ro.unarchive
2759
- }
2760
- }
2761
- }
2762
- }
2763
- },
2764
- loading: {
2765
- ...(ao = e.inbox) == null ? void 0 : ao.loading,
2766
- ...(ho = i.inbox) == null ? void 0 : ho.loading
2767
- },
2768
- empty: {
2769
- ...(co = e.inbox) == null ? void 0 : co.empty,
2770
- ...(lo = i.inbox) == null ? void 0 : lo.empty
2771
- },
2772
- error: {
2773
- ...(uo = e.inbox) == null ? void 0 : uo.error,
2774
- ...(po = i.inbox) == null ? void 0 : po.error
2775
- }
2776
- }
2777
- };
2778
- };
2779
- class Mo {
2780
- constructor(i) {
2781
- // Event IDs
2782
- a(this, "THEME_CHANGE_EVENT", "courier_inbox_theme_change");
2783
- // State
2784
- a(this, "_theme");
2785
- a(this, "_lightTheme", we);
2786
- a(this, "_darkTheme", Ae);
2787
- a(this, "_target");
2788
- a(this, "_subscriptions", []);
2789
- // System theme
2790
- a(this, "_userMode");
2791
- a(this, "_systemMode");
2792
- a(this, "_systemThemeCleanup");
2793
- this._theme = i, this._target = new EventTarget(), this._userMode = "system", this._systemMode = go(), this.setLightTheme(we), this.setDarkTheme(Ae), this._systemThemeCleanup = mo((e) => {
2794
- this._systemMode = e, this.updateTheme();
2795
- });
2796
- }
2797
- setLightTheme(i) {
2798
- this._lightTheme = i, this._systemMode === "light" && this.updateTheme();
2799
- }
2800
- setDarkTheme(i) {
2801
- this._darkTheme = i, this._systemMode === "dark" && this.updateTheme();
2802
- }
2803
- /**
2804
- * Get the current system theme
2805
- */
2806
- get currentSystemTheme() {
2807
- return this._systemMode;
2808
- }
2809
- /**
2810
- * Get the current theme
2811
- */
2812
- getTheme() {
2813
- return this._theme;
2814
- }
2815
- /**
2816
- * Update the theme
2817
- */
2818
- updateTheme() {
2819
- const i = this._userMode === "system" ? this._systemMode : this._userMode, e = i === "light" ? this._lightTheme : this._darkTheme, t = $o(i, e);
2820
- this.setTheme(t);
2821
- }
2822
- /**
2823
- * Set the theme and notify all listeners
2824
- */
2825
- setTheme(i) {
2826
- i !== this._theme && (this._theme = i, this._target.dispatchEvent(new CustomEvent(this.THEME_CHANGE_EVENT, {
2827
- detail: { theme: i }
2828
- })));
2829
- }
2830
- /**
2831
- * Set the mode and notify all listeners
2832
- */
2833
- setMode(i) {
2834
- this._userMode = i, this.updateTheme();
2835
- }
2836
- /**
2837
- * Subscribe to theme changes
2838
- * @param {Function} callback - Function to run when the theme changes
2839
- * @returns {CourierInboxThemeSubscription} - Object with remove method to stop listening
2840
- */
2841
- subscribe(i) {
2842
- const e = new AbortController();
2843
- this._target.addEventListener(this.THEME_CHANGE_EVENT, (s) => {
2844
- i(s.detail.theme);
2845
- }, { signal: e.signal });
2846
- const t = {
2847
- manager: this,
2848
- unsubscribe: () => {
2849
- e.abort();
2850
- const s = this._subscriptions.indexOf(t);
2851
- s > -1 && this._subscriptions.splice(s, 1);
2852
- }
2853
- };
2854
- return this._subscriptions.push(t), t;
2855
- }
2856
- /**
2857
- * Clean up event listeners
2858
- */
2859
- cleanup() {
2860
- this._systemThemeCleanup && this._systemThemeCleanup(), this._subscriptions.forEach((i) => i.unsubscribe()), this._subscriptions = [];
2861
- }
2862
- }
2863
- class Eo extends HTMLElement {
2864
- constructor(e) {
2865
- var t;
2866
- super();
2867
- // State
2868
- a(this, "_currentFeed", "inbox");
2869
- // Theming
2870
- a(this, "_themeManager");
2871
- // Components
2872
- a(this, "_shadow");
2873
- a(this, "_list");
2874
- a(this, "_datastoreListener");
2875
- a(this, "_authListener");
2876
- a(this, "_style");
2877
- // Header
2878
- a(this, "_header");
2879
- a(this, "_headerFactory");
2880
- // List
2881
- a(this, "_onMessageClick");
2882
- a(this, "_onMessageActionClick");
2883
- a(this, "_onMessageLongPress");
2884
- // Default props
2885
- a(this, "_defaultProps", {
2886
- title: "Inbox",
2887
- icon: f.inbox,
2888
- feedType: this._currentFeed,
2889
- height: "768px"
2890
- });
2891
- this._shadow = this.attachShadow({ mode: "open" }), this._themeManager = e ?? new Mo(we), this._header = new wo({
2892
- themeManager: this._themeManager,
2893
- onFeedTypeChange: (s) => {
2894
- this.setFeedType(s);
2895
- }
2896
- }), this._header.build(void 0), this._shadow.appendChild(this._header), this._list = new vo({
2897
- themeManager: this._themeManager,
2898
- onRefresh: () => {
2899
- this.refresh();
2900
- },
2901
- onPaginationTrigger: async (s) => {
2902
- var o, n;
2903
- try {
2904
- await A.shared.fetchNextPageOfMessages({
2905
- feedType: s
2906
- });
2907
- } catch (h) {
2908
- (n = (o = C.shared.client) == null ? void 0 : o.options.logger) == null || n.error("Failed to fetch next page of messages:", h);
2909
- }
2910
- },
2911
- onMessageClick: (s, o) => {
2912
- var n;
2913
- A.shared.clickMessage({ message: s }), this.dispatchEvent(new CustomEvent("message-click", {
2914
- detail: { message: s, index: o },
2915
- bubbles: !0,
2916
- composed: !0
2917
- })), (n = this._onMessageClick) == null || n.call(this, { message: s, index: o });
2918
- },
2919
- onMessageActionClick: (s, o, n) => {
2920
- var h;
2921
- this.dispatchEvent(new CustomEvent("message-action-click", {
2922
- detail: { message: s, action: o, index: n },
2923
- bubbles: !0,
2924
- composed: !0
2925
- })), (h = this._onMessageActionClick) == null || h.call(this, { message: s, action: o, index: n });
2926
- },
2927
- onMessageLongPress: (s, o) => {
2928
- var n;
2929
- this.dispatchEvent(new CustomEvent("message-long-press", {
2930
- detail: { message: s, index: o },
2931
- bubbles: !0,
2932
- composed: !0
2933
- })), (n = this._onMessageLongPress) == null || n.call(this, { message: s, index: o });
2934
- }
2935
- }), this._style = document.createElement("style"), this.refreshTheme(), this._shadow.appendChild(this._style), this._shadow.appendChild(this._list), this._datastoreListener = new So({
2936
- onError: (s) => {
2937
- this._list.setError(s);
2938
- },
2939
- onDataSetChange: (s, o) => {
2940
- this._currentFeed === o && (this._list.setDataSet(s), this.updateHeader());
2941
- },
2942
- onPageAdded: (s, o) => {
2943
- this._currentFeed === o && (this._list.addPage(s), this.updateHeader());
2944
- },
2945
- onMessageAdd: (s, o, n) => {
2946
- this._currentFeed === n && (this._list.addMessage(s, o), this.updateHeader());
2947
- },
2948
- onMessageRemove: (s, o, n) => {
2949
- this._currentFeed === n && (this._list.removeMessage(o), this.updateHeader());
2950
- },
2951
- onMessageUpdate: (s, o, n) => {
2952
- this._currentFeed === n && (this._list.updateMessage(s, o), this.updateHeader());
2953
- },
2954
- onUnreadCountChange: (s) => {
2955
- this.updateHeader();
2956
- }
2957
- }), A.shared.addDataStoreListener(this._datastoreListener), this._themeManager.subscribe((s) => {
2958
- this.refreshTheme();
2959
- }), this._authListener = C.shared.addAuthenticationListener((s) => {
2960
- this.refresh();
2961
- }), (t = C.shared.client) != null && t.options.userId && this.refresh();
2962
- }
2963
- get theme() {
2964
- return this._themeManager.getTheme();
2965
- }
2966
- setLightTheme(e) {
2967
- this._themeManager.setLightTheme(e);
2968
- }
2969
- setDarkTheme(e) {
2970
- this._themeManager.setDarkTheme(e);
2971
- }
2972
- static get observedAttributes() {
2973
- return ["height", "light-theme", "dark-theme", "mode", "message-click", "message-action-click", "message-long-press"];
2974
- }
2975
- refreshTheme() {
2976
- this._style.textContent = this.getStyles();
2977
- }
2978
- getStyles() {
2979
- return `
2980
- :host {
2981
- display: flex;
2982
- flex-direction: column;
2983
- width: 100%;
2984
- height: ${this._defaultProps.height};
2985
- }
2986
-
2987
- courier-inbox-header {
2988
- flex-shrink: 0;
2989
- }
2990
-
2991
- courier-inbox-list {
2992
- flex: 1;
2993
- overflow-y: auto;
2994
- overflow-x: hidden;
2995
- }
2996
- `;
2997
- }
2998
- setHeader(e) {
2999
- this._headerFactory = e, this.updateHeader();
3000
- }
3001
- removeHeader() {
3002
- this._headerFactory = null, this.updateHeader();
3003
- }
3004
- setLoadingState(e) {
3005
- this._list.setLoadingStateFactory(e);
3006
- }
3007
- setEmptyState(e) {
3008
- this._list.setEmptyStateFactory(e);
3009
- }
3010
- setErrorState(e) {
3011
- this._list.setErrorStateFactory(e);
3012
- }
3013
- setListItem(e) {
3014
- this._list.setListItemFactory(e);
3015
- }
3016
- setPaginationItem(e) {
3017
- this._list.setPaginationItemFactory(e);
3018
- }
3019
- onMessageClick(e) {
3020
- this._onMessageClick = e;
3021
- }
3022
- onMessageActionClick(e) {
3023
- this._onMessageActionClick = e;
3024
- }
3025
- onMessageLongPress(e) {
3026
- this._onMessageLongPress = e;
3027
- }
3028
- setFeedType(e) {
3029
- this._currentFeed = e, this._list.setFeedType(e), this.updateHeader(), this.load({
3030
- feedType: this._currentFeed,
3031
- canUseCache: !0
3032
- });
3033
- }
3034
- updateHeader() {
3035
- const e = {
3036
- feedType: this._currentFeed,
3037
- unreadCount: A.shared.unreadCount,
3038
- messageCount: this._list.messages.length
3039
- };
3040
- switch (this._headerFactory) {
3041
- case void 0:
3042
- this._header.render(e);
3043
- break;
3044
- case null:
3045
- this._header.build(null);
3046
- break;
3047
- default:
3048
- const t = this._headerFactory(e);
3049
- this._header.build(t);
3050
- break;
3051
- }
3052
- }
3053
- async load(e) {
3054
- await A.shared.load(e);
3055
- }
3056
- refresh() {
3057
- this.load({
3058
- feedType: this._currentFeed,
3059
- canUseCache: !1
3060
- });
3061
- }
3062
- connectedCallback() {
3063
- this.refresh();
3064
- }
3065
- disconnectedCallback() {
3066
- var e, t;
3067
- this._themeManager.cleanup(), (e = this._datastoreListener) == null || e.remove(), (t = this._authListener) == null || t.remove();
3068
- }
3069
- attributeChangedCallback(e, t, s) {
3070
- var o, n, h, d, c, u;
3071
- if (t !== s)
3072
- switch (e) {
3073
- case "height":
3074
- const m = s || this._defaultProps.height;
3075
- this.style.height = m;
3076
- break;
3077
- case "message-click":
3078
- if (s)
3079
- try {
3080
- this._onMessageClick = new Function("props", s);
3081
- } catch (p) {
3082
- (n = (o = C.shared.client) == null ? void 0 : o.options.logger) == null || n.error("Failed to parse message-click handler:", p);
3083
- }
3084
- else
3085
- this._onMessageClick = void 0;
3086
- break;
3087
- case "message-action-click":
3088
- if (s)
3089
- try {
3090
- this._onMessageActionClick = new Function("props", s);
3091
- } catch (p) {
3092
- (d = (h = C.shared.client) == null ? void 0 : h.options.logger) == null || d.error("Failed to parse message-action-click handler:", p);
3093
- }
3094
- else
3095
- this._onMessageActionClick = void 0;
3096
- break;
3097
- case "message-long-press":
3098
- if (s)
3099
- try {
3100
- this._onMessageLongPress = new Function("props", s);
3101
- } catch (p) {
3102
- (u = (c = C.shared.client) == null ? void 0 : c.options.logger) == null || u.error("Failed to parse message-long-press handler:", p);
3103
- }
3104
- else
3105
- this._onMessageLongPress = void 0;
3106
- break;
3107
- case "light-theme":
3108
- s && this.setLightTheme(JSON.parse(s));
3109
- break;
3110
- case "dark-theme":
3111
- s && this.setDarkTheme(JSON.parse(s));
3112
- break;
3113
- case "mode":
3114
- this._themeManager.setMode(s);
3115
- break;
3116
- }
3117
- }
3118
- }
3119
- customElements.get("courier-inbox") || customElements.define("courier-inbox", Eo);
3120
- class Io extends Le {
3121
- constructor(e) {
3122
- super();
3123
- // Theme
3124
- a(this, "_themeSubscription");
3125
- // Components
3126
- a(this, "_container");
3127
- a(this, "_triggerButton");
3128
- a(this, "_unreadCountBadge");
3129
- this._themeSubscription = e.subscribe((t) => {
3130
- this.updateTheme();
3131
- });
3132
- }
3133
- defaultElement() {
3134
- this._container = document.createElement("div"), this._container.className = "menu-button-container", this._triggerButton = new Se(f.inbox), this._unreadCountBadge = new $e({
3135
- themeBus: this._themeSubscription.manager,
3136
- location: "button"
3137
- }), this._unreadCountBadge.id = "unread-badge";
3138
- const e = document.createElement("style");
3139
- return e.textContent = this.getStyles(), this._container.appendChild(e), this._container.appendChild(this._triggerButton), this._container.appendChild(this._unreadCountBadge), this.shadow.appendChild(this._container), this.updateTheme(), this._container;
3140
- }
3141
- getStyles() {
3142
- return `
3143
- .menu-button-container {
3144
- position: relative;
3145
- display: inline-block;
3146
- }
3147
-
3148
- #unread-badge {
3149
- position: absolute;
3150
- top: -8px;
3151
- left: 50%;
3152
- pointer-events: none;
3153
- }
3154
- `;
3155
- }
3156
- onUnreadCountChange(e) {
3157
- var t;
3158
- (t = this._unreadCountBadge) == null || t.setCount(e), this.updateTheme();
3159
- }
3160
- updateTheme() {
3161
- var t, s, o, n, h, d, c, u, m, p, x, _, b, v, k, w, S, M;
3162
- const e = this._themeSubscription.manager.getTheme();
3163
- (n = this._triggerButton) == null || n.updateIconColor(((o = (s = (t = e == null ? void 0 : e.popup) == null ? void 0 : t.button) == null ? void 0 : s.icon) == null ? void 0 : o.color) ?? r.black[500]), (u = this._triggerButton) == null || u.updateIconSVG(((c = (d = (h = e == null ? void 0 : e.popup) == null ? void 0 : h.button) == null ? void 0 : d.icon) == null ? void 0 : c.svg) ?? f.inbox), (x = this._triggerButton) == null || x.updateBackgroundColor(((p = (m = e == null ? void 0 : e.popup) == null ? void 0 : m.button) == null ? void 0 : p.backgroundColor) ?? "transparent"), (v = this._triggerButton) == null || v.updateHoverBackgroundColor(((b = (_ = e == null ? void 0 : e.popup) == null ? void 0 : _.button) == null ? void 0 : b.hoverBackgroundColor) ?? r.black[50010]), (S = this._triggerButton) == null || S.updateActiveBackgroundColor(((w = (k = e == null ? void 0 : e.popup) == null ? void 0 : k.button) == null ? void 0 : w.activeBackgroundColor) ?? r.black[50020]), (M = this._unreadCountBadge) == null || M.refreshTheme("button");
3164
- }
3165
- disconnectedCallback() {
3166
- this._themeSubscription.unsubscribe();
3167
- }
3168
- }
3169
- customElements.get("courier-inbox-menu-button") || customElements.define("courier-inbox-menu-button", Io);
3170
- class Fo extends HTMLElement {
3171
- constructor() {
3172
- super();
3173
- // State
3174
- a(this, "_width", "440px");
3175
- a(this, "_height", "440px");
3176
- a(this, "_popupAlignment", "top-right");
3177
- a(this, "_top", "40px");
3178
- a(this, "_right", "0");
3179
- a(this, "_bottom", "40px");
3180
- a(this, "_left", "0");
3181
- // Theming
3182
- a(this, "_themeManager", new Mo(we));
3183
- // Components
3184
- a(this, "_triggerButton");
3185
- a(this, "_popup");
3186
- a(this, "_inbox");
3187
- a(this, "_style");
3188
- // Listeners
3189
- a(this, "_datastoreListener");
3190
- // Factories
3191
- a(this, "_popupMenuButtonFactory");
3192
- const e = this.attachShadow({ mode: "open" });
3193
- this._triggerButton = new Io(this._themeManager), this._triggerButton.build(void 0), this._popup = document.createElement("div"), this._popup.className = "popup", this._inbox = new Eo(this._themeManager), this._inbox.setAttribute("height", "100%"), this._style = document.createElement("style"), this.refreshTheme(), e.appendChild(this._style), e.appendChild(this._triggerButton), e.appendChild(this._popup), this._popup.appendChild(this._inbox), this._triggerButton.addEventListener("click", this.togglePopup.bind(this)), document.addEventListener("click", this.handleOutsideClick.bind(this)), this.updatePopupPosition(), this._datastoreListener = new So(this), A.shared.addDataStoreListener(this._datastoreListener), this._themeManager.subscribe((t) => {
3194
- this.refreshTheme();
3195
- });
3196
- }
3197
- get theme() {
3198
- return this._themeManager.getTheme();
3199
- }
3200
- setLightTheme(e) {
3201
- this._themeManager.setLightTheme(e);
3202
- }
3203
- setDarkTheme(e) {
3204
- this._themeManager.setDarkTheme(e);
3205
- }
3206
- static get observedAttributes() {
3207
- return ["popup-alignment", "message-click", "message-action-click", "message-long-press", "popup-width", "popup-height", "top", "right", "bottom", "left", "light-theme", "dark-theme", "mode"];
3208
- }
3209
- refreshTheme() {
3210
- this._style.textContent = this.getStyles();
3211
- }
3212
- getStyles() {
3213
- var e, t, s, o, n, h, d, c;
3214
- return `
3215
- :host {
3216
- display: inline-block;
3217
- position: relative;
3218
- }
3219
-
3220
- .menu-button-container {
3221
- position: relative;
3222
- display: inline-block;
3223
- }
3224
-
3225
- .popup {
3226
- display: none;
3227
- position: absolute;
3228
- background: ${((t = (e = this.theme.popup) == null ? void 0 : e.window) == null ? void 0 : t.backgroundColor) ?? "red"};
3229
- border-radius: ${((o = (s = this.theme.popup) == null ? void 0 : s.window) == null ? void 0 : o.borderRadius) ?? "8px"};
3230
- border: ${((h = (n = this.theme.popup) == null ? void 0 : n.window) == null ? void 0 : h.border) ?? "1px solid red"};
3231
- box-shadow: ${((c = (d = this.theme.popup) == null ? void 0 : d.window) == null ? void 0 : c.shadow) ?? "0px 8px 16px -4px red"};
3232
- z-index: 1000;
3233
- width: ${this._width};
3234
- height: ${this._height};
3235
- overflow: hidden;
3236
- transform: translateZ(0);
3237
- will-change: transform;
3238
- }
3239
-
3240
- #unread-badge {
3241
- position: absolute;
3242
- top: -8px;
3243
- left: 50%;
3244
- pointer-events: none;
3245
- }
3246
-
3247
- courier-inbox {
3248
- height: 100%;
3249
- }
3250
- `;
3251
- }
3252
- attributeChangedCallback(e, t, s) {
3253
- switch (e) {
3254
- case "popup-alignment":
3255
- this.isValidPosition(s) && (this._popupAlignment = s, this.updatePopupPosition());
3256
- break;
3257
- case "popup-width":
3258
- this._width = s, this.setSize(s, this._height);
3259
- break;
3260
- case "popup-height":
3261
- this._height = s, this.setSize(this._width, s);
3262
- break;
3263
- case "top":
3264
- this._top = s, this.updatePopupPosition();
3265
- break;
3266
- case "right":
3267
- this._right = s, this.updatePopupPosition();
3268
- break;
3269
- case "bottom":
3270
- this._bottom = s, this.updatePopupPosition();
3271
- break;
3272
- case "left":
3273
- this._left = s, this.updatePopupPosition();
3274
- break;
3275
- case "light-theme":
3276
- s && this.setLightTheme(JSON.parse(s));
3277
- break;
3278
- case "dark-theme":
3279
- s && this.setDarkTheme(JSON.parse(s));
3280
- break;
3281
- case "mode":
3282
- this._themeManager.setMode(s);
3283
- break;
3284
- }
3285
- }
3286
- onUnreadCountChange(e) {
3287
- this.render();
3288
- }
3289
- onMessageClick(e) {
3290
- this._inbox.onMessageClick(e);
3291
- }
3292
- onMessageActionClick(e) {
3293
- this._inbox.onMessageActionClick(e);
3294
- }
3295
- onMessageLongPress(e) {
3296
- this._inbox.onMessageLongPress(e);
3297
- }
3298
- isValidPosition(e) {
3299
- return [
3300
- "top-right",
3301
- "top-left",
3302
- "top-center",
3303
- "bottom-right",
3304
- "bottom-left",
3305
- "bottom-center",
3306
- "center-right",
3307
- "center-left",
3308
- "center-center"
3309
- ].includes(e);
3310
- }
3311
- updatePopupPosition() {
3312
- switch (this._popup.style.top = "", this._popup.style.bottom = "", this._popup.style.left = "", this._popup.style.right = "", this._popup.style.margin = "", this._popup.style.transform = "", this._popupAlignment) {
3313
- case "top-right":
3314
- this._popup.style.top = this._top, this._popup.style.right = this._right;
3315
- break;
3316
- case "top-left":
3317
- this._popup.style.top = this._top, this._popup.style.left = this._left;
3318
- break;
3319
- case "top-center":
3320
- this._popup.style.top = this._top, this._popup.style.left = "50%", this._popup.style.transform = "translateX(-50%)";
3321
- break;
3322
- case "bottom-right":
3323
- this._popup.style.bottom = this._bottom, this._popup.style.right = this._right;
3324
- break;
3325
- case "bottom-left":
3326
- this._popup.style.bottom = this._bottom, this._popup.style.left = this._left;
3327
- break;
3328
- case "bottom-center":
3329
- this._popup.style.bottom = this._bottom, this._popup.style.left = "50%", this._popup.style.transform = "translateX(-50%)";
3330
- break;
3331
- case "center-right":
3332
- this._popup.style.top = "50%", this._popup.style.right = this._right, this._popup.style.transform = "translateY(-50%)";
3333
- break;
3334
- case "center-left":
3335
- this._popup.style.top = "50%", this._popup.style.left = this._left, this._popup.style.transform = "translateY(-50%)";
3336
- break;
3337
- case "center-center":
3338
- this._popup.style.top = "50%", this._popup.style.left = "50%", this._popup.style.transform = "translate(-50%, -50%)";
3339
- break;
3340
- }
3341
- }
3342
- togglePopup(e) {
3343
- e.stopPropagation(), this._popup.style.display === "block" ? this._popup.style.display = "none" : this._popup.style.display = "block";
3344
- }
3345
- handleOutsideClick(e) {
3346
- this.contains(e.target) || (this._popup.style.display = "none");
3347
- }
3348
- setContent(e) {
3349
- this._inbox.innerHTML = "", this._inbox.appendChild(e);
3350
- }
3351
- setSize(e, t) {
3352
- this._width = e, this._height = t, this._popup.style.width = e, this._popup.style.height = t;
3353
- }
3354
- setPosition(e) {
3355
- var t, s;
3356
- this.isValidPosition(e) ? (this._popupAlignment = e, this.updatePopupPosition()) : (s = (t = C.shared.client) == null ? void 0 : t.options.logger) == null || s.error(`Invalid position: ${e}`);
3357
- }
3358
- setFeedType(e) {
3359
- this._inbox.setFeedType(e);
3360
- }
3361
- // Factory methods
3362
- setPopupHeader(e) {
3363
- this._inbox.setHeader(e);
3364
- }
3365
- removePopupHeader() {
3366
- this._inbox.removeHeader();
3367
- }
3368
- setPopupLoadingState(e) {
3369
- this._inbox.setLoadingState(e);
3370
- }
3371
- setPopupEmptyState(e) {
3372
- this._inbox.setEmptyState(e);
3373
- }
3374
- setPopupErrorState(e) {
3375
- this._inbox.setErrorState(e);
3376
- }
3377
- setPopupListItem(e) {
3378
- this._inbox.setListItem(e);
3379
- }
3380
- setPopupPaginationItem(e) {
3381
- this._inbox.setPaginationItem(e);
3382
- }
3383
- setPopupMenuButton(e) {
3384
- this._popupMenuButtonFactory = e, this.render();
3385
- }
3386
- render() {
3387
- const e = A.shared.unreadCount;
3388
- switch (this._popupMenuButtonFactory) {
3389
- case void 0:
3390
- case null:
3391
- this._triggerButton.build(void 0), this._triggerButton.onUnreadCountChange(e);
3392
- break;
3393
- default:
3394
- const t = this._popupMenuButtonFactory({ unreadCount: e });
3395
- this._triggerButton.build(t);
3396
- break;
3397
- }
3398
- }
3399
- disconnectedCallback() {
3400
- var e;
3401
- (e = this._datastoreListener) == null || e.remove(), this._themeManager.cleanup();
3402
- }
3403
- }
3404
- customElements.get("courier-inbox-menu") || customElements.define("courier-inbox-menu", Fo);
3405
- class Zo {
3406
- onDataSetChange(i, e) {
3407
- }
3408
- onPageAdded(i, e) {
3409
- }
3410
- onUnreadCountChange(i) {
3411
- }
3412
- onMessageAdd(i, e, t) {
3413
- }
3414
- onMessageRemove(i, e, t) {
3415
- }
3416
- onMessageUpdate(i, e, t) {
3417
- }
3418
- onError(i) {
3419
- }
3420
- }
3421
- export {
3422
- Eo as CourierInbox,
3423
- So as CourierInboxDataStoreListener,
3424
- A as CourierInboxDatastore,
3425
- Zo as CourierInboxDatastoreEvents,
3426
- wo as CourierInboxHeader,
3427
- Fo as CourierInboxMenu,
3428
- Mo as CourierInboxThemeManager,
3429
- xo as CourierListItem,
3430
- Uo as archiveMessage,
3431
- No as clickMessage,
3432
- Ae as defaultDarkTheme,
3433
- we as defaultLightTheme,
3434
- Po as getMessageTime,
3435
- zo as markAsRead,
3436
- Oo as markAsUnread,
3437
- $o as mergeTheme,
3438
- Vo as openMessage
3439
- };