@trycourier/courier-ui-inbox 1.0.2-beta → 1.0.3-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/components/courier-inbox-list-item.d.ts +1 -1
- package/dist/components/courier-inbox-list.d.ts +1 -1
- package/dist/datastore/datastore.d.ts +1 -1
- package/dist/datastore/datatore-events.d.ts +1 -1
- package/dist/index.es.js +1722 -820
- package/dist/index.umd.js +199 -69
- package/dist/types/factories.d.ts +1 -1
- package/dist/types/inbox-data-set.d.ts +1 -1
- package/dist/utils/extensions.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,910 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var qo = Object.defineProperty;
|
|
2
|
+
var Vo = (h, t, e) => t in h ? qo(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
|
+
var a = (h, t, e) => Vo(h, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
var jo = Object.defineProperty, Zo = (h, t, e) => t in h ? jo(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, T = (h, t, e) => Zo(h, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
const ko = class wo {
|
|
6
|
+
constructor(t, e) {
|
|
7
|
+
T(this, "webSocket", null), T(this, "pingInterval", null), T(this, "onOpen"), T(this, "onMessageReceived"), T(this, "onClose"), T(this, "onError"), T(this, "url"), T(this, "options"), this.url = t, this.options = e;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Dynamically checks if the WebSocket is connected
|
|
11
|
+
*/
|
|
12
|
+
get isConnected() {
|
|
13
|
+
return this.webSocket !== null;
|
|
14
|
+
}
|
|
15
|
+
async connect() {
|
|
16
|
+
return this.disconnect(), new Promise((t, e) => {
|
|
17
|
+
try {
|
|
18
|
+
this.webSocket = new WebSocket(this.url), this.webSocket.onopen = () => {
|
|
19
|
+
var i;
|
|
20
|
+
(i = this.onOpen) == null || i.call(this), t();
|
|
21
|
+
}, this.webSocket.onmessage = (i) => {
|
|
22
|
+
var s;
|
|
23
|
+
(s = this.onMessageReceived) == null || s.call(this, i.data);
|
|
24
|
+
}, this.webSocket.onclose = (i) => {
|
|
25
|
+
var s;
|
|
26
|
+
this.webSocket = null, (s = this.onClose) == null || s.call(this, i.code, i.reason);
|
|
27
|
+
}, this.webSocket.onerror = (i) => {
|
|
28
|
+
var s;
|
|
29
|
+
this.webSocket = null;
|
|
30
|
+
const o = new Error("Courier Socket connection failed");
|
|
31
|
+
o.originalEvent = i, (s = this.onError) == null || s.call(this, o), e(o);
|
|
32
|
+
};
|
|
33
|
+
} catch (i) {
|
|
34
|
+
this.webSocket = null, e(i);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
disconnect() {
|
|
39
|
+
this.stopPing(), this.webSocket && (this.webSocket.close(wo.NORMAL_CLOSURE_STATUS), this.webSocket = null);
|
|
40
|
+
}
|
|
41
|
+
async send(t) {
|
|
42
|
+
if (!this.webSocket)
|
|
43
|
+
return !1;
|
|
44
|
+
const e = JSON.stringify(t);
|
|
45
|
+
return this.webSocket.send(e) !== void 0;
|
|
46
|
+
}
|
|
47
|
+
keepAlive(t) {
|
|
48
|
+
this.stopPing(), this.pingInterval = setInterval(async () => {
|
|
49
|
+
var e;
|
|
50
|
+
try {
|
|
51
|
+
await this.send({ action: "keepAlive" });
|
|
52
|
+
} catch (i) {
|
|
53
|
+
(e = this.options.logger) == null || e.error("Error occurred on Keep Alive:", i);
|
|
54
|
+
}
|
|
55
|
+
}, (t == null ? void 0 : t.intervalInMillis) ?? 3e5);
|
|
56
|
+
}
|
|
57
|
+
stopPing() {
|
|
58
|
+
this.pingInterval && (clearInterval(this.pingInterval), this.pingInterval = null);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
T(ko, "NORMAL_CLOSURE_STATUS", 1e3);
|
|
62
|
+
let Jo = ko;
|
|
63
|
+
const yo = (h) => ({
|
|
64
|
+
courier: {
|
|
65
|
+
rest: (h == null ? void 0 : h.courier.rest) || "https://api.courier.com",
|
|
66
|
+
graphql: (h == null ? void 0 : h.courier.graphql) || "https://api.courier.com/client/q"
|
|
67
|
+
},
|
|
68
|
+
inbox: {
|
|
69
|
+
graphql: (h == null ? void 0 : h.inbox.graphql) || "https://inbox.courier.com/q",
|
|
70
|
+
webSocket: (h == null ? void 0 : h.inbox.webSocket) || "wss://realtime.courier.com"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
class Go {
|
|
74
|
+
constructor(t) {
|
|
75
|
+
T(this, "PREFIX", "[COURIER]"), this.showLogs = t;
|
|
76
|
+
}
|
|
77
|
+
warn(t, ...e) {
|
|
78
|
+
this.showLogs && console.warn(`${this.PREFIX} ${t}`, ...e);
|
|
79
|
+
}
|
|
80
|
+
log(t, ...e) {
|
|
81
|
+
this.showLogs && console.log(`${this.PREFIX} ${t}`, ...e);
|
|
82
|
+
}
|
|
83
|
+
error(t, ...e) {
|
|
84
|
+
this.showLogs && console.error(`${this.PREFIX} ${t}`, ...e);
|
|
85
|
+
}
|
|
86
|
+
debug(t, ...e) {
|
|
87
|
+
this.showLogs && console.debug(`${this.PREFIX} ${t}`, ...e);
|
|
88
|
+
}
|
|
89
|
+
info(t, ...e) {
|
|
90
|
+
this.showLogs && console.info(`${this.PREFIX} ${t}`, ...e);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
class Ae {
|
|
94
|
+
static generate(t) {
|
|
95
|
+
const e = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
96
|
+
return t ? t + e : e;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
class Pe extends Error {
|
|
100
|
+
constructor(t, e, i) {
|
|
101
|
+
super(e), this.code = t, this.type = i, this.name = "CourierRequestError";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function So(h, t, e, i) {
|
|
105
|
+
h.log(`
|
|
106
|
+
📡 New Courier ${e} Request: ${t}
|
|
107
|
+
URL: ${i.url}
|
|
108
|
+
${i.method ? `Method: ${i.method}` : ""}
|
|
109
|
+
${i.query ? `Query: ${i.query}` : ""}
|
|
110
|
+
${i.variables ? `Variables: ${JSON.stringify(i.variables, null, 2)}` : ""}
|
|
111
|
+
Headers: ${JSON.stringify(i.headers, null, 2)}
|
|
112
|
+
Body: ${i.body ? JSON.stringify(i.body, null, 2) : "Empty"}
|
|
113
|
+
`);
|
|
114
|
+
}
|
|
115
|
+
function Io(h, t, e, i) {
|
|
116
|
+
h.log(`
|
|
117
|
+
📡 New Courier ${e} Response: ${t}
|
|
118
|
+
Status Code: ${i.status}
|
|
119
|
+
Response JSON: ${JSON.stringify(i.response, null, 2)}
|
|
120
|
+
`);
|
|
121
|
+
}
|
|
122
|
+
async function K(h) {
|
|
123
|
+
const t = h.validCodes ?? [200], e = h.options.showLogs ? Ae.generate() : void 0, i = new Request(h.url, {
|
|
124
|
+
method: h.method,
|
|
125
|
+
headers: {
|
|
126
|
+
"Content-Type": "application/json",
|
|
127
|
+
...h.headers
|
|
128
|
+
},
|
|
129
|
+
body: h.body ? JSON.stringify(h.body) : void 0
|
|
130
|
+
});
|
|
131
|
+
e && So(h.options.logger, e, "HTTP", {
|
|
132
|
+
url: i.url,
|
|
133
|
+
method: i.method,
|
|
134
|
+
headers: Object.fromEntries(i.headers.entries()),
|
|
135
|
+
body: h.body
|
|
136
|
+
});
|
|
137
|
+
const s = await fetch(i);
|
|
138
|
+
if (s.status === 204)
|
|
139
|
+
return;
|
|
140
|
+
let o;
|
|
141
|
+
try {
|
|
142
|
+
o = await s.json();
|
|
143
|
+
} catch {
|
|
144
|
+
if (s.status === 200)
|
|
145
|
+
return;
|
|
146
|
+
throw new Pe(
|
|
147
|
+
s.status,
|
|
148
|
+
"Failed to parse response as JSON",
|
|
149
|
+
"PARSE_ERROR"
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
if (e && Io(h.options.logger, e, "HTTP", {
|
|
153
|
+
status: s.status,
|
|
154
|
+
response: o
|
|
155
|
+
}), !t.includes(s.status))
|
|
156
|
+
throw new Pe(
|
|
157
|
+
s.status,
|
|
158
|
+
(o == null ? void 0 : o.message) || "Unknown Error",
|
|
159
|
+
o == null ? void 0 : o.type
|
|
160
|
+
);
|
|
161
|
+
return o;
|
|
162
|
+
}
|
|
163
|
+
async function Z(h) {
|
|
164
|
+
const t = h.options.showLogs ? Ae.generate() : void 0;
|
|
165
|
+
t && So(h.options.logger, t, "GraphQL", {
|
|
166
|
+
url: h.url,
|
|
167
|
+
headers: h.headers,
|
|
168
|
+
query: h.query,
|
|
169
|
+
variables: h.variables
|
|
170
|
+
});
|
|
171
|
+
const e = await fetch(h.url, {
|
|
172
|
+
method: "POST",
|
|
173
|
+
headers: {
|
|
174
|
+
"Content-Type": "application/json",
|
|
175
|
+
...h.headers
|
|
176
|
+
},
|
|
177
|
+
body: JSON.stringify({
|
|
178
|
+
query: h.query,
|
|
179
|
+
variables: h.variables
|
|
180
|
+
})
|
|
181
|
+
});
|
|
182
|
+
let i;
|
|
183
|
+
try {
|
|
184
|
+
i = await e.json();
|
|
185
|
+
} catch {
|
|
186
|
+
throw new Pe(
|
|
187
|
+
e.status,
|
|
188
|
+
"Failed to parse response as JSON",
|
|
189
|
+
"PARSE_ERROR"
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
if (t && Io(h.options.logger, t, "GraphQL", {
|
|
193
|
+
status: e.status,
|
|
194
|
+
response: i
|
|
195
|
+
}), !e.ok)
|
|
196
|
+
throw new Pe(
|
|
197
|
+
e.status,
|
|
198
|
+
(i == null ? void 0 : i.message) || "Unknown Error",
|
|
199
|
+
i == null ? void 0 : i.type
|
|
200
|
+
);
|
|
201
|
+
return i;
|
|
202
|
+
}
|
|
203
|
+
class re {
|
|
204
|
+
constructor(t) {
|
|
205
|
+
this.options = t;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
class Wo extends re {
|
|
209
|
+
/**
|
|
210
|
+
* Get a brand by ID using GraphQL
|
|
211
|
+
* @param brandId - The ID of the brand to retrieve
|
|
212
|
+
* @returns Promise resolving to the requested brand
|
|
213
|
+
*/
|
|
214
|
+
async getBrand(t) {
|
|
215
|
+
const e = `
|
|
216
|
+
query GetBrand {
|
|
217
|
+
brand(brandId: "${t.brandId}") {
|
|
218
|
+
settings {
|
|
219
|
+
colors {
|
|
220
|
+
primary
|
|
221
|
+
secondary
|
|
222
|
+
tertiary
|
|
223
|
+
}
|
|
224
|
+
inapp {
|
|
225
|
+
borderRadius
|
|
226
|
+
disableCourierFooter
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
`;
|
|
232
|
+
return (await Z({
|
|
233
|
+
options: this.options,
|
|
234
|
+
url: this.options.apiUrls.courier.graphql,
|
|
235
|
+
headers: {
|
|
236
|
+
"x-courier-user-id": this.options.userId,
|
|
237
|
+
"x-courier-client-key": "empty",
|
|
238
|
+
// Empty for now. Will be removed in future.
|
|
239
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
240
|
+
},
|
|
241
|
+
query: e,
|
|
242
|
+
variables: { brandId: t.brandId }
|
|
243
|
+
})).data.brand;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
class ze extends Jo {
|
|
247
|
+
constructor(t) {
|
|
248
|
+
const e = ze.buildUrl(t);
|
|
249
|
+
super(e, t), T(this, "receivedMessage"), T(this, "receivedMessageEvent"), this.onMessageReceived = (i) => this.convertToType(i);
|
|
250
|
+
}
|
|
251
|
+
convertToType(t) {
|
|
252
|
+
var e, i, s, o;
|
|
253
|
+
try {
|
|
254
|
+
switch (JSON.parse(t).type) {
|
|
255
|
+
case "event":
|
|
256
|
+
const c = JSON.parse(t);
|
|
257
|
+
(e = this.receivedMessageEvent) == null || e.call(this, c);
|
|
258
|
+
break;
|
|
259
|
+
case "message":
|
|
260
|
+
const d = JSON.parse(t);
|
|
261
|
+
(i = this.receivedMessage) == null || i.call(this, d);
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
} catch (n) {
|
|
265
|
+
(s = this.options.logger) == null || s.error("Error parsing socket message", n), n instanceof Error && ((o = this.onError) == null || o.call(this, n));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
async sendSubscribe(t) {
|
|
269
|
+
var e;
|
|
270
|
+
const i = {
|
|
271
|
+
action: "subscribe",
|
|
272
|
+
data: {
|
|
273
|
+
userAgent: "courier-js",
|
|
274
|
+
// TODO: Equivalent to Courier.agent.value()
|
|
275
|
+
channel: this.options.userId,
|
|
276
|
+
event: "*",
|
|
277
|
+
version: (t == null ? void 0 : t.version) ?? 5
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
this.options.connectionId && (i.data.clientSourceId = this.options.connectionId), this.options.tenantId && (i.data.accountId = this.options.tenantId), (e = this.options.logger) == null || e.debug("Sending subscribe request", i), await this.send(i);
|
|
281
|
+
}
|
|
282
|
+
static buildUrl(t) {
|
|
283
|
+
var e;
|
|
284
|
+
let i = ((e = t.apiUrls) == null ? void 0 : e.inbox.webSocket) ?? "";
|
|
285
|
+
return t.accessToken && (i += `/?auth=${t.accessToken}`), i;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
class Ko extends re {
|
|
289
|
+
constructor(t) {
|
|
290
|
+
super(t), T(this, "socket"), this.socket = new ze(t);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Get paginated messages
|
|
294
|
+
* @param paginationLimit - Number of messages to return per page (default: 24)
|
|
295
|
+
* @param startCursor - Cursor for pagination
|
|
296
|
+
* @returns Promise resolving to paginated messages response
|
|
297
|
+
*/
|
|
298
|
+
async getMessages(t) {
|
|
299
|
+
const e = `
|
|
300
|
+
query GetInboxMessages(
|
|
301
|
+
$params: FilterParamsInput = { ${this.options.tenantId ? `accountId: "${this.options.tenantId}"` : ""} }
|
|
302
|
+
$limit: Int = ${(t == null ? void 0 : t.paginationLimit) ?? 24}
|
|
303
|
+
$after: String ${t != null && t.startCursor ? `= "${t.startCursor}"` : ""}
|
|
304
|
+
) {
|
|
305
|
+
count(params: $params)
|
|
306
|
+
messages(params: $params, limit: $limit, after: $after) {
|
|
307
|
+
totalCount
|
|
308
|
+
pageInfo {
|
|
309
|
+
startCursor
|
|
310
|
+
hasNextPage
|
|
311
|
+
}
|
|
312
|
+
nodes {
|
|
313
|
+
messageId
|
|
314
|
+
read
|
|
315
|
+
archived
|
|
316
|
+
created
|
|
317
|
+
opened
|
|
318
|
+
title
|
|
319
|
+
preview
|
|
320
|
+
data
|
|
321
|
+
tags
|
|
322
|
+
trackingIds {
|
|
323
|
+
clickTrackingId
|
|
324
|
+
}
|
|
325
|
+
actions {
|
|
326
|
+
content
|
|
327
|
+
data
|
|
328
|
+
href
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
`;
|
|
334
|
+
return await Z({
|
|
335
|
+
options: this.options,
|
|
336
|
+
query: e,
|
|
337
|
+
headers: {
|
|
338
|
+
"x-courier-user-id": this.options.userId,
|
|
339
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
340
|
+
},
|
|
341
|
+
url: this.options.apiUrls.inbox.graphql
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Get paginated archived messages
|
|
346
|
+
* @param paginationLimit - Number of messages to return per page (default: 24)
|
|
347
|
+
* @param startCursor - Cursor for pagination
|
|
348
|
+
* @returns Promise resolving to paginated archived messages response
|
|
349
|
+
*/
|
|
350
|
+
async getArchivedMessages(t) {
|
|
351
|
+
const e = `
|
|
352
|
+
query GetInboxMessages(
|
|
353
|
+
$params: FilterParamsInput = { ${this.options.tenantId ? `accountId: "${this.options.tenantId}"` : ""}, archived: true }
|
|
354
|
+
$limit: Int = ${(t == null ? void 0 : t.paginationLimit) ?? 24}
|
|
355
|
+
$after: String ${t != null && t.startCursor ? `= "${t.startCursor}"` : ""}
|
|
356
|
+
) {
|
|
357
|
+
count(params: $params)
|
|
358
|
+
messages(params: $params, limit: $limit, after: $after) {
|
|
359
|
+
totalCount
|
|
360
|
+
pageInfo {
|
|
361
|
+
startCursor
|
|
362
|
+
hasNextPage
|
|
363
|
+
}
|
|
364
|
+
nodes {
|
|
365
|
+
messageId
|
|
366
|
+
read
|
|
367
|
+
archived
|
|
368
|
+
created
|
|
369
|
+
opened
|
|
370
|
+
title
|
|
371
|
+
preview
|
|
372
|
+
data
|
|
373
|
+
tags
|
|
374
|
+
trackingIds {
|
|
375
|
+
clickTrackingId
|
|
376
|
+
}
|
|
377
|
+
actions {
|
|
378
|
+
content
|
|
379
|
+
data
|
|
380
|
+
href
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
`;
|
|
386
|
+
return Z({
|
|
387
|
+
options: this.options,
|
|
388
|
+
query: e,
|
|
389
|
+
headers: {
|
|
390
|
+
"x-courier-user-id": this.options.userId,
|
|
391
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
392
|
+
},
|
|
393
|
+
url: this.options.apiUrls.inbox.graphql
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Get unread message count
|
|
398
|
+
* @returns Promise resolving to number of unread messages
|
|
399
|
+
*/
|
|
400
|
+
async getUnreadMessageCount() {
|
|
401
|
+
var t;
|
|
402
|
+
const e = `
|
|
403
|
+
query GetMessages {
|
|
404
|
+
count(params: { status: "unread" ${this.options.tenantId ? `, accountId: "${this.options.tenantId}"` : ""} })
|
|
405
|
+
}
|
|
406
|
+
`;
|
|
407
|
+
return ((t = (await Z({
|
|
408
|
+
options: this.options,
|
|
409
|
+
query: e,
|
|
410
|
+
headers: {
|
|
411
|
+
"x-courier-user-id": this.options.userId,
|
|
412
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
413
|
+
},
|
|
414
|
+
url: this.options.apiUrls.inbox.graphql
|
|
415
|
+
})).data) == null ? void 0 : t.count) ?? 0;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Track a click event
|
|
419
|
+
* @param messageId - ID of the message
|
|
420
|
+
* @param trackingId - ID for tracking the click
|
|
421
|
+
* @returns Promise resolving when click is tracked
|
|
422
|
+
*/
|
|
423
|
+
async click(t) {
|
|
424
|
+
const e = `
|
|
425
|
+
mutation TrackEvent {
|
|
426
|
+
clicked(messageId: "${t.messageId}", trackingId: "${t.trackingId}")
|
|
427
|
+
}
|
|
428
|
+
`, i = {
|
|
429
|
+
"x-courier-user-id": this.options.userId,
|
|
430
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
431
|
+
};
|
|
432
|
+
this.options.connectionId && (i["x-courier-client-source-id"] = this.options.connectionId), await Z({
|
|
433
|
+
options: this.options,
|
|
434
|
+
query: e,
|
|
435
|
+
headers: i,
|
|
436
|
+
url: this.options.apiUrls.inbox.graphql
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Mark a message as read
|
|
441
|
+
* @param messageId - ID of the message to mark as read
|
|
442
|
+
* @returns Promise resolving when message is marked as read
|
|
443
|
+
*/
|
|
444
|
+
async read(t) {
|
|
445
|
+
const e = `
|
|
446
|
+
mutation TrackEvent {
|
|
447
|
+
read(messageId: "${t.messageId}")
|
|
448
|
+
}
|
|
449
|
+
`, i = {
|
|
450
|
+
"x-courier-user-id": this.options.userId,
|
|
451
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
452
|
+
};
|
|
453
|
+
this.options.connectionId && (i["x-courier-client-source-id"] = this.options.connectionId), await Z({
|
|
454
|
+
options: this.options,
|
|
455
|
+
query: e,
|
|
456
|
+
headers: i,
|
|
457
|
+
url: this.options.apiUrls.inbox.graphql
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Mark a message as unread
|
|
462
|
+
* @param messageId - ID of the message to mark as unread
|
|
463
|
+
* @returns Promise resolving when message is marked as unread
|
|
464
|
+
*/
|
|
465
|
+
async unread(t) {
|
|
466
|
+
const e = `
|
|
467
|
+
mutation TrackEvent {
|
|
468
|
+
unread(messageId: "${t.messageId}")
|
|
469
|
+
}
|
|
470
|
+
`, i = {
|
|
471
|
+
"x-courier-user-id": this.options.userId,
|
|
472
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
473
|
+
};
|
|
474
|
+
this.options.connectionId && (i["x-courier-client-source-id"] = this.options.connectionId), await Z({
|
|
475
|
+
options: this.options,
|
|
476
|
+
query: e,
|
|
477
|
+
headers: i,
|
|
478
|
+
url: this.options.apiUrls.inbox.graphql
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Mark all messages as read
|
|
483
|
+
* @returns Promise resolving when all messages are marked as read
|
|
484
|
+
*/
|
|
485
|
+
async readAll() {
|
|
486
|
+
const t = `
|
|
487
|
+
mutation TrackEvent {
|
|
488
|
+
markAllRead
|
|
489
|
+
}
|
|
490
|
+
`, e = {
|
|
491
|
+
"x-courier-user-id": this.options.userId,
|
|
492
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
493
|
+
};
|
|
494
|
+
this.options.connectionId && (e["x-courier-client-source-id"] = this.options.connectionId), await Z({
|
|
495
|
+
options: this.options,
|
|
496
|
+
query: t,
|
|
497
|
+
headers: e,
|
|
498
|
+
url: this.options.apiUrls.inbox.graphql
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Mark a message as opened
|
|
503
|
+
* @param messageId - ID of the message to mark as opened
|
|
504
|
+
* @returns Promise resolving when message is marked as opened
|
|
505
|
+
*/
|
|
506
|
+
async open(t) {
|
|
507
|
+
const e = `
|
|
508
|
+
mutation TrackEvent {
|
|
509
|
+
opened(messageId: "${t.messageId}")
|
|
510
|
+
}
|
|
511
|
+
`, i = {
|
|
512
|
+
"x-courier-user-id": this.options.userId,
|
|
513
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
514
|
+
};
|
|
515
|
+
this.options.connectionId && (i["x-courier-client-source-id"] = this.options.connectionId), await Z({
|
|
516
|
+
options: this.options,
|
|
517
|
+
query: e,
|
|
518
|
+
headers: i,
|
|
519
|
+
url: this.options.apiUrls.inbox.graphql
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Archive a message
|
|
524
|
+
* @param messageId - ID of the message to archive
|
|
525
|
+
* @returns Promise resolving when message is archived
|
|
526
|
+
*/
|
|
527
|
+
async archive(t) {
|
|
528
|
+
const e = `
|
|
529
|
+
mutation TrackEvent {
|
|
530
|
+
archive(messageId: "${t.messageId}")
|
|
531
|
+
}
|
|
532
|
+
`, i = {
|
|
533
|
+
"x-courier-user-id": this.options.userId,
|
|
534
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
535
|
+
};
|
|
536
|
+
this.options.connectionId && (i["x-courier-client-source-id"] = this.options.connectionId), await Z({
|
|
537
|
+
options: this.options,
|
|
538
|
+
query: e,
|
|
539
|
+
headers: i,
|
|
540
|
+
url: this.options.apiUrls.inbox.graphql
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Archive all read messages.
|
|
545
|
+
*/
|
|
546
|
+
async archiveRead() {
|
|
547
|
+
const t = `
|
|
548
|
+
mutation TrackEvent {
|
|
549
|
+
archiveRead
|
|
550
|
+
}
|
|
551
|
+
`, e = {
|
|
552
|
+
"x-courier-user-id": this.options.userId,
|
|
553
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
554
|
+
};
|
|
555
|
+
this.options.connectionId && (e["x-courier-client-source-id"] = this.options.connectionId), await Z({
|
|
556
|
+
options: this.options,
|
|
557
|
+
query: t,
|
|
558
|
+
headers: e,
|
|
559
|
+
url: this.options.apiUrls.inbox.graphql
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
class Xo {
|
|
564
|
+
/**
|
|
565
|
+
* Transforms a single API response item to the CourierUserPreferencesTopic type
|
|
566
|
+
* @param item - The API response item
|
|
567
|
+
* @returns A CourierUserPreferencesTopic object
|
|
568
|
+
*/
|
|
569
|
+
transformItem(t) {
|
|
570
|
+
return {
|
|
571
|
+
topicId: t.topic_id,
|
|
572
|
+
topicName: t.topic_name,
|
|
573
|
+
sectionId: t.section_id,
|
|
574
|
+
sectionName: t.section_name,
|
|
575
|
+
status: t.status,
|
|
576
|
+
defaultStatus: t.default_status,
|
|
577
|
+
hasCustomRouting: t.has_custom_routing,
|
|
578
|
+
customRouting: t.custom_routing || []
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Transforms an array of API response items to CourierUserPreferencesTopic objects
|
|
583
|
+
* @param items - The API response items
|
|
584
|
+
* @returns A generator of CourierUserPreferencesTopic objects
|
|
585
|
+
*/
|
|
586
|
+
*transform(t) {
|
|
587
|
+
for (const e of t)
|
|
588
|
+
yield this.transformItem(e);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
function Qo(h) {
|
|
592
|
+
const t = atob(h), e = new Uint8Array(t.length);
|
|
593
|
+
for (let i = 0; i < t.length; i++)
|
|
594
|
+
e[i] = t.charCodeAt(i);
|
|
595
|
+
return String.fromCharCode(...e);
|
|
596
|
+
}
|
|
597
|
+
function Yo(h) {
|
|
598
|
+
const t = new Uint8Array(h.length);
|
|
599
|
+
for (let e = 0; e < h.length; e++)
|
|
600
|
+
t[e] = h.charCodeAt(e);
|
|
601
|
+
return btoa(String.fromCharCode(...t));
|
|
602
|
+
}
|
|
603
|
+
class en extends re {
|
|
604
|
+
constructor() {
|
|
605
|
+
super(...arguments), T(this, "transformer", new Xo());
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Get all preferences for a user
|
|
609
|
+
* @param paginationCursor - Optional cursor for pagination
|
|
610
|
+
* @returns Promise resolving to user preferences
|
|
611
|
+
* @see https://www.courier.com/docs/reference/user-preferences/list-all-user-preferences
|
|
612
|
+
*/
|
|
613
|
+
async getUserPreferences(t) {
|
|
614
|
+
let e = `${this.options.apiUrls.courier.rest}/users/${this.options.userId}/preferences`;
|
|
615
|
+
t != null && t.paginationCursor && (e += `?cursor=${t.paginationCursor}`);
|
|
616
|
+
const s = await K({
|
|
617
|
+
options: this.options,
|
|
618
|
+
url: e,
|
|
619
|
+
method: "GET",
|
|
620
|
+
headers: {
|
|
621
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
return {
|
|
625
|
+
items: [...this.transformer.transform(s.items)],
|
|
626
|
+
paging: s.paging
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Get preferences for a specific topic
|
|
631
|
+
* @param topicId - The ID of the topic to get preferences for
|
|
632
|
+
* @returns Promise resolving to topic preferences
|
|
633
|
+
* @see https://www.courier.com/docs/reference/user-preferences/get-subscription-topic-preferences
|
|
634
|
+
*/
|
|
635
|
+
async getUserPreferenceTopic(t) {
|
|
636
|
+
const i = await K({
|
|
637
|
+
options: this.options,
|
|
638
|
+
url: `${this.options.apiUrls.courier.rest}/users/${this.options.userId}/preferences/${t.topicId}`,
|
|
639
|
+
method: "GET",
|
|
640
|
+
headers: {
|
|
641
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
return this.transformer.transformItem(i.topic);
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Update preferences for a specific topic
|
|
648
|
+
* @param topicId - The ID of the topic to update preferences for
|
|
649
|
+
* @param status - The new status for the topic
|
|
650
|
+
* @param hasCustomRouting - Whether the topic has custom routing
|
|
651
|
+
* @param customRouting - The custom routing channels for the topic
|
|
652
|
+
* @returns Promise resolving when update is complete
|
|
653
|
+
* @see https://www.courier.com/docs/reference/user-preferences/update-subscription-topic-preferences
|
|
654
|
+
*/
|
|
655
|
+
async putUserPreferenceTopic(t) {
|
|
656
|
+
const e = {
|
|
657
|
+
topic: {
|
|
658
|
+
status: t.status,
|
|
659
|
+
has_custom_routing: t.hasCustomRouting,
|
|
660
|
+
custom_routing: t.customRouting
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
await K({
|
|
664
|
+
options: this.options,
|
|
665
|
+
url: `${this.options.apiUrls.courier.rest}/users/${this.options.userId}/preferences/${t.topicId}`,
|
|
666
|
+
method: "PUT",
|
|
667
|
+
headers: {
|
|
668
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
669
|
+
},
|
|
670
|
+
body: e
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Get the notification center URL
|
|
675
|
+
* @param clientKey - The client key to use for the URL
|
|
676
|
+
* @returns The notification center URL
|
|
677
|
+
*/
|
|
678
|
+
getNotificationCenterUrl(t) {
|
|
679
|
+
const e = Qo(t.clientKey);
|
|
680
|
+
return `https://view.notificationcenter.app/p/${Yo(`${e}#${this.options.userId}${this.options.tenantId ? `#${this.options.tenantId}` : ""}#false`)}`;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
class tn extends re {
|
|
684
|
+
/**
|
|
685
|
+
* Store a push notification token for a user
|
|
686
|
+
* @param token - The push notification token
|
|
687
|
+
* @param provider - The provider of the token
|
|
688
|
+
* @param device - The device information
|
|
689
|
+
* @see https://www.courier.com/docs/reference/token-management/put-token
|
|
690
|
+
*/
|
|
691
|
+
async putUserToken(t) {
|
|
692
|
+
const e = {
|
|
693
|
+
provider_key: t.provider,
|
|
694
|
+
...t.device && {
|
|
695
|
+
device: {
|
|
696
|
+
app_id: t.device.appId,
|
|
697
|
+
ad_id: t.device.adId,
|
|
698
|
+
device_id: t.device.deviceId,
|
|
699
|
+
platform: t.device.platform,
|
|
700
|
+
manufacturer: t.device.manufacturer,
|
|
701
|
+
model: t.device.model
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
await K({
|
|
706
|
+
options: this.options,
|
|
707
|
+
url: `${this.options.apiUrls.courier.rest}/users/${this.options.userId}/tokens/${t.token}`,
|
|
708
|
+
method: "PUT",
|
|
709
|
+
headers: {
|
|
710
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
711
|
+
},
|
|
712
|
+
body: e,
|
|
713
|
+
validCodes: [200, 204]
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Delete a push notification token for a user
|
|
718
|
+
* @param token - The push notification token
|
|
719
|
+
* @returns Promise resolving when token is deleted
|
|
720
|
+
*/
|
|
721
|
+
async deleteUserToken(t) {
|
|
722
|
+
await K({
|
|
723
|
+
options: this.options,
|
|
724
|
+
url: `${this.options.apiUrls.courier.rest}/users/${this.options.userId}/tokens/${t.token}`,
|
|
725
|
+
method: "DELETE",
|
|
726
|
+
headers: {
|
|
727
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
728
|
+
},
|
|
729
|
+
validCodes: [200, 204]
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
class sn extends re {
|
|
734
|
+
/**
|
|
735
|
+
* Subscribe a user to a list
|
|
736
|
+
* @param listId - The ID of the list to subscribe to
|
|
737
|
+
* @returns Promise resolving when subscription is complete
|
|
738
|
+
* @see https://www.courier.com/docs/reference/lists/recipient-subscribe
|
|
739
|
+
*/
|
|
740
|
+
async putSubscription(t) {
|
|
741
|
+
return await K({
|
|
742
|
+
url: `${this.options.apiUrls.courier.rest}/lists/${t.listId}/subscriptions/${this.options.userId}`,
|
|
743
|
+
options: this.options,
|
|
744
|
+
method: "PUT",
|
|
745
|
+
headers: {
|
|
746
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Unsubscribe a user from a list
|
|
752
|
+
* @param listId - The ID of the list to unsubscribe from
|
|
753
|
+
* @returns Promise resolving when unsubscription is complete
|
|
754
|
+
* @see https://www.courier.com/docs/reference/lists/delete-subscription
|
|
755
|
+
*/
|
|
756
|
+
async deleteSubscription(t) {
|
|
757
|
+
return await K({
|
|
758
|
+
url: `${this.options.apiUrls.courier.rest}/lists/${t.listId}/subscriptions/${this.options.userId}`,
|
|
759
|
+
options: this.options,
|
|
760
|
+
method: "DELETE",
|
|
761
|
+
headers: {
|
|
762
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
class on extends re {
|
|
768
|
+
/**
|
|
769
|
+
* Post an inbound courier event
|
|
770
|
+
* @param event - The event type: Example: "New Order Placed"
|
|
771
|
+
* @param messageId - The message ID
|
|
772
|
+
* @param type - The type of event: Available options: "track"
|
|
773
|
+
* @param properties - The properties of the event
|
|
774
|
+
* @returns Promise resolving to the message ID
|
|
775
|
+
* @see https://www.courier.com/docs/reference/inbound/courier-track-event
|
|
776
|
+
*/
|
|
777
|
+
async postInboundCourier(t) {
|
|
778
|
+
return await K({
|
|
779
|
+
url: `${this.options.apiUrls.courier.rest}/inbound/courier`,
|
|
780
|
+
options: this.options,
|
|
781
|
+
method: "POST",
|
|
782
|
+
headers: {
|
|
783
|
+
Authorization: `Bearer ${this.options.accessToken}`
|
|
784
|
+
},
|
|
785
|
+
body: {
|
|
786
|
+
...t,
|
|
787
|
+
userId: this.options.userId
|
|
788
|
+
},
|
|
789
|
+
validCodes: [200, 202]
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Post a tracking URL event
|
|
794
|
+
* These urls are found in messages sent from Courier
|
|
795
|
+
* @param url - The URL to post the event to
|
|
796
|
+
* @param event - The event type: Available options: "click", "open", "unsubscribe"
|
|
797
|
+
* @returns Promise resolving when the event is posted
|
|
798
|
+
*/
|
|
799
|
+
async postTrackingUrl(t) {
|
|
800
|
+
return await K({
|
|
801
|
+
url: t.url,
|
|
802
|
+
options: this.options,
|
|
803
|
+
method: "POST",
|
|
804
|
+
body: {
|
|
805
|
+
event: t.event
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
class nn extends re {
|
|
811
|
+
constructor(t) {
|
|
812
|
+
var e, i;
|
|
813
|
+
const s = t.showLogs !== void 0 ? t.showLogs : process.env.NODE_ENV === "development", o = {
|
|
814
|
+
...t,
|
|
815
|
+
showLogs: s,
|
|
816
|
+
apiUrls: t.apiUrls || yo(),
|
|
817
|
+
accessToken: t.jwt ?? t.publicApiKey
|
|
818
|
+
};
|
|
819
|
+
super({
|
|
820
|
+
...o,
|
|
821
|
+
logger: new Go(o.showLogs),
|
|
822
|
+
apiUrls: yo(o.apiUrls)
|
|
823
|
+
}), T(this, "tokens"), T(this, "brands"), T(this, "preferences"), T(this, "inbox"), T(this, "lists"), T(this, "tracking"), this.tokens = new tn(this.options), this.brands = new Wo(this.options), this.preferences = new en(this.options), this.inbox = new Ko(this.options), this.lists = new sn(this.options), this.tracking = new on(this.options), !this.options.jwt && !this.options.publicApiKey && this.options.logger.warn("Courier Client initialized with no authentication method. Please provide a JWT or public API key."), this.options.publicApiKey && ((e = this.options.logger) == null || e.warn(
|
|
824
|
+
`Courier Warning: Public API Keys are for testing only. Please use JWTs for production.
|
|
825
|
+
You can generate a JWT with this endpoint: https://www.courier.com/docs/reference/auth/issue-token
|
|
826
|
+
This endpoint should be called from your backend server, not the SDK.`
|
|
827
|
+
)), this.options.jwt && this.options.publicApiKey && ((i = this.options.logger) == null || i.warn(
|
|
828
|
+
"Courier Warning: Both a JWT and a Public API Key were provided. The Public API Key will be ignored."
|
|
829
|
+
));
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
class rn {
|
|
833
|
+
constructor(t) {
|
|
834
|
+
T(this, "callback"), this.callback = t;
|
|
835
|
+
}
|
|
836
|
+
remove() {
|
|
837
|
+
v.shared.removeAuthenticationListener(this);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
const Eo = class Me {
|
|
841
|
+
constructor() {
|
|
842
|
+
T(this, "id", Ae.generate()), T(this, "instanceClient"), T(this, "_paginationLimit", 24), T(this, "authenticationListeners", []);
|
|
843
|
+
}
|
|
844
|
+
get paginationLimit() {
|
|
845
|
+
return this._paginationLimit;
|
|
846
|
+
}
|
|
847
|
+
set paginationLimit(t) {
|
|
848
|
+
this._paginationLimit = Math.min(Math.max(t, 1), 100);
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Get the Courier client instance
|
|
852
|
+
* @returns The Courier client instance or undefined if not signed in
|
|
853
|
+
*/
|
|
854
|
+
get client() {
|
|
855
|
+
return this.instanceClient;
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Get the shared Courier instance
|
|
859
|
+
* @returns The shared Courier instance
|
|
860
|
+
*/
|
|
861
|
+
static get shared() {
|
|
862
|
+
return Me.instance || (Me.instance = new Me()), Me.instance;
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Sign in to Courier
|
|
866
|
+
* @param options - The options for the Courier client
|
|
867
|
+
*/
|
|
868
|
+
signIn(t) {
|
|
869
|
+
const e = t.connectionId ?? Ae.generate();
|
|
870
|
+
this.instanceClient = new nn({ ...t, connectionId: e }), this.notifyAuthenticationListeners({ userId: t.userId });
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Sign out of Courier
|
|
874
|
+
*/
|
|
875
|
+
signOut() {
|
|
876
|
+
this.instanceClient = void 0, this.notifyAuthenticationListeners({ userId: void 0 });
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Register a callback to be notified of authentication state changes
|
|
880
|
+
* @param callback - Function to be called when authentication state changes
|
|
881
|
+
* @returns AuthenticationListener instance that can be used to remove the listener
|
|
882
|
+
*/
|
|
883
|
+
addAuthenticationListener(t) {
|
|
884
|
+
var e;
|
|
885
|
+
(e = this.instanceClient) == null || e.options.logger.info("Adding authentication listener");
|
|
886
|
+
const i = new rn(t);
|
|
887
|
+
return this.authenticationListeners.push(i), i;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Unregister an authentication state change listener
|
|
891
|
+
* @param listener - The AuthenticationListener instance to remove
|
|
892
|
+
*/
|
|
893
|
+
removeAuthenticationListener(t) {
|
|
894
|
+
var e;
|
|
895
|
+
(e = this.instanceClient) == null || e.options.logger.info("Removing authentication listener"), this.authenticationListeners = this.authenticationListeners.filter((i) => i !== t);
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Notify all authentication listeners
|
|
899
|
+
* @param props - The props to notify the listeners with
|
|
900
|
+
*/
|
|
901
|
+
notifyAuthenticationListeners(t) {
|
|
902
|
+
this.authenticationListeners.forEach((e) => e.callback(t));
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
T(Eo, "instance");
|
|
906
|
+
let v = Eo;
|
|
907
|
+
var an = Object.defineProperty, hn = (h, t, e) => t in h ? an(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, $ = (h, t, e) => hn(h, typeof t != "symbol" ? t + "" : t, e);
|
|
6
908
|
const r = {
|
|
7
909
|
black: {
|
|
8
910
|
500: "#171717",
|
|
@@ -24,7 +926,7 @@ const r = {
|
|
|
24
926
|
400: "#60A5FA",
|
|
25
927
|
500: "#2563EB"
|
|
26
928
|
}
|
|
27
|
-
},
|
|
929
|
+
}, W = {
|
|
28
930
|
light: {
|
|
29
931
|
colors: {
|
|
30
932
|
primary: r.black[500],
|
|
@@ -49,21 +951,21 @@ const r = {
|
|
|
49
951
|
cornerRadius: "4px"
|
|
50
952
|
}
|
|
51
953
|
}
|
|
52
|
-
},
|
|
954
|
+
}, Mo = () => typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", To = (h) => {
|
|
53
955
|
if (typeof window > "u")
|
|
54
956
|
return () => {
|
|
55
957
|
};
|
|
56
|
-
const
|
|
57
|
-
|
|
958
|
+
const t = window.matchMedia("(prefers-color-scheme: dark)"), e = (i) => {
|
|
959
|
+
h(i.matches ? "dark" : "light");
|
|
58
960
|
};
|
|
59
|
-
return
|
|
60
|
-
|
|
961
|
+
return t.addEventListener("change", e), () => {
|
|
962
|
+
t.removeEventListener("change", e);
|
|
61
963
|
};
|
|
62
964
|
};
|
|
63
|
-
class
|
|
965
|
+
class $o extends HTMLElement {
|
|
64
966
|
constructor() {
|
|
65
|
-
super(),
|
|
66
|
-
this._currentSystemTheme =
|
|
967
|
+
super(), $(this, "_currentSystemTheme"), $(this, "_systemThemeCleanup"), this._currentSystemTheme = Mo(), this._systemThemeCleanup = To((t) => {
|
|
968
|
+
this._currentSystemTheme = t, this.onSystemThemeChange(t);
|
|
67
969
|
});
|
|
68
970
|
}
|
|
69
971
|
get currentSystemTheme() {
|
|
@@ -72,47 +974,47 @@ class bo extends HTMLElement {
|
|
|
72
974
|
disconnectedCallback() {
|
|
73
975
|
this._systemThemeCleanup && this._systemThemeCleanup();
|
|
74
976
|
}
|
|
75
|
-
onSystemThemeChange(
|
|
977
|
+
onSystemThemeChange(t) {
|
|
76
978
|
}
|
|
77
979
|
}
|
|
78
|
-
const
|
|
980
|
+
const Fe = {
|
|
79
981
|
borderRadius: "4px",
|
|
80
982
|
fontSize: "14px"
|
|
81
|
-
},
|
|
82
|
-
primary: (
|
|
83
|
-
...
|
|
84
|
-
backgroundColor:
|
|
85
|
-
textColor:
|
|
983
|
+
}, se = {
|
|
984
|
+
primary: (h) => ({
|
|
985
|
+
...Fe,
|
|
986
|
+
backgroundColor: W[h].colors.primary,
|
|
987
|
+
textColor: W[h].colors.secondary,
|
|
86
988
|
fontWeight: "500",
|
|
87
989
|
shadow: "none"
|
|
88
990
|
}),
|
|
89
|
-
secondary: (
|
|
90
|
-
...
|
|
91
|
-
backgroundColor:
|
|
92
|
-
textColor:
|
|
991
|
+
secondary: (h) => ({
|
|
992
|
+
...Fe,
|
|
993
|
+
backgroundColor: W[h].colors.secondary,
|
|
994
|
+
textColor: W[h].colors.primary,
|
|
93
995
|
fontWeight: "500",
|
|
94
|
-
border: `1px solid ${
|
|
95
|
-
shadow:
|
|
996
|
+
border: `1px solid ${W[h].colors.border}`,
|
|
997
|
+
shadow: h === "light" ? "0px 1px 2px 0px rgba(0, 0, 0, 0.06)" : "0px 1px 2px 0px rgba(255, 255, 255, 0.1)"
|
|
96
998
|
}),
|
|
97
|
-
tertiary: (
|
|
98
|
-
...
|
|
99
|
-
backgroundColor:
|
|
100
|
-
textColor:
|
|
999
|
+
tertiary: (h) => ({
|
|
1000
|
+
...Fe,
|
|
1001
|
+
backgroundColor: W[h].colors.border,
|
|
1002
|
+
textColor: W[h].colors.primary,
|
|
101
1003
|
fontWeight: "500",
|
|
102
1004
|
border: "none",
|
|
103
1005
|
shadow: "none"
|
|
104
1006
|
})
|
|
105
1007
|
};
|
|
106
|
-
class
|
|
107
|
-
constructor(
|
|
108
|
-
super(),
|
|
1008
|
+
class Re extends $o {
|
|
1009
|
+
constructor(t) {
|
|
1010
|
+
super(), $(this, "_button"), $(this, "_style");
|
|
109
1011
|
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(
|
|
111
|
-
|
|
1012
|
+
this._button = document.createElement("button"), this._button.setAttribute("part", "button"), this._style = document.createElement("style"), this._style.textContent = this.getStyles(t), e.appendChild(this._style), e.appendChild(this._button), this.updateButton(t), this._button.addEventListener("click", (i) => {
|
|
1013
|
+
i.preventDefault(), i.stopPropagation(), t.onClick && t.onClick();
|
|
112
1014
|
});
|
|
113
1015
|
}
|
|
114
|
-
getStyles(
|
|
115
|
-
const e = () =>
|
|
1016
|
+
getStyles(t) {
|
|
1017
|
+
const e = () => se.secondary(this.currentSystemTheme).textColor, i = () => se.secondary(this.currentSystemTheme).backgroundColor, s = () => se.secondary(this.currentSystemTheme).border, o = () => se.secondary(this.currentSystemTheme).shadow, n = () => se.secondary(this.currentSystemTheme).borderRadius, c = () => se.secondary(this.currentSystemTheme).fontSize, d = () => se.secondary(this.currentSystemTheme).fontWeight;
|
|
116
1018
|
return `
|
|
117
1019
|
:host {
|
|
118
1020
|
display: inline-block;
|
|
@@ -120,27 +1022,27 @@ class Ie extends bo {
|
|
|
120
1022
|
|
|
121
1023
|
button {
|
|
122
1024
|
border: none;
|
|
123
|
-
border-radius: ${
|
|
124
|
-
font-weight: ${
|
|
125
|
-
font-family: ${
|
|
126
|
-
font-size: ${
|
|
1025
|
+
border-radius: ${t.borderRadius ?? n()};
|
|
1026
|
+
font-weight: ${t.fontWeight ?? d()};
|
|
1027
|
+
font-family: ${t.fontFamily ?? "inherit"};
|
|
1028
|
+
font-size: ${t.fontSize ?? c()};
|
|
127
1029
|
padding: 6px 10px;
|
|
128
1030
|
cursor: pointer;
|
|
129
1031
|
width: 100%;
|
|
130
1032
|
height: 100%;
|
|
131
|
-
background-color: ${
|
|
132
|
-
color: ${
|
|
133
|
-
border: ${
|
|
134
|
-
box-shadow: ${
|
|
1033
|
+
background-color: ${t.backgroundColor ?? i()};
|
|
1034
|
+
color: ${t.textColor ?? e()};
|
|
1035
|
+
border: ${t.border ?? s()};
|
|
1036
|
+
box-shadow: ${t.shadow ?? o()};
|
|
135
1037
|
touch-action: manipulation;
|
|
136
1038
|
}
|
|
137
1039
|
|
|
138
1040
|
button:hover {
|
|
139
|
-
${
|
|
1041
|
+
${t.hoverBackgroundColor ? `background-color: ${t.hoverBackgroundColor};` : "filter: brightness(0.9);"}
|
|
140
1042
|
}
|
|
141
1043
|
|
|
142
1044
|
button:active {
|
|
143
|
-
${
|
|
1045
|
+
${t.activeBackgroundColor ? `background-color: ${t.activeBackgroundColor};` : "filter: brightness(0.8);"}
|
|
144
1046
|
}
|
|
145
1047
|
|
|
146
1048
|
button:disabled {
|
|
@@ -149,12 +1051,12 @@ class Ie extends bo {
|
|
|
149
1051
|
}
|
|
150
1052
|
`;
|
|
151
1053
|
}
|
|
152
|
-
updateButton(
|
|
153
|
-
|
|
1054
|
+
updateButton(t) {
|
|
1055
|
+
t.text && (this._button.textContent = t.text), this._style.textContent = this.getStyles(t);
|
|
154
1056
|
}
|
|
155
1057
|
}
|
|
156
|
-
customElements.get("courier-button") || customElements.define("courier-button",
|
|
157
|
-
const
|
|
1058
|
+
customElements.get("courier-button") || customElements.define("courier-button", Re);
|
|
1059
|
+
const x = {
|
|
158
1060
|
inbox: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
159
1061
|
<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
1062
|
</svg>`,
|
|
@@ -183,13 +1085,13 @@ const f = {
|
|
|
183
1085
|
<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
1086
|
</svg>`
|
|
185
1087
|
};
|
|
186
|
-
class
|
|
187
|
-
constructor(
|
|
188
|
-
super(),
|
|
189
|
-
const
|
|
190
|
-
this._iconContainer = document.createElement("div"),
|
|
1088
|
+
class ne extends HTMLElement {
|
|
1089
|
+
constructor(t, e) {
|
|
1090
|
+
super(), $(this, "_color"), $(this, "_svg"), $(this, "_iconContainer"), $(this, "_style"), this._color = t ?? r.black[500], this._svg = e;
|
|
1091
|
+
const i = this.attachShadow({ mode: "open" });
|
|
1092
|
+
this._iconContainer = document.createElement("div"), i.appendChild(this._iconContainer), this._style = document.createElement("style"), this._style.textContent = this.getStyles(this._color), i.appendChild(this._style), this.refresh();
|
|
191
1093
|
}
|
|
192
|
-
getStyles(
|
|
1094
|
+
getStyles(t) {
|
|
193
1095
|
return `
|
|
194
1096
|
:host {
|
|
195
1097
|
display: inline-block;
|
|
@@ -202,25 +1104,25 @@ class ie extends HTMLElement {
|
|
|
202
1104
|
svg {
|
|
203
1105
|
width: 24px;
|
|
204
1106
|
height: 24px;
|
|
205
|
-
color: ${
|
|
1107
|
+
color: ${t};
|
|
206
1108
|
}
|
|
207
1109
|
`;
|
|
208
1110
|
}
|
|
209
1111
|
refresh() {
|
|
210
1112
|
this._svg && (this._iconContainer.innerHTML = this._svg), this._color && (this._style.textContent = this.getStyles(this._color));
|
|
211
1113
|
}
|
|
212
|
-
updateColor(
|
|
213
|
-
this._color =
|
|
1114
|
+
updateColor(t) {
|
|
1115
|
+
this._color = t, this.refresh();
|
|
214
1116
|
}
|
|
215
|
-
updateSVG(
|
|
216
|
-
this._svg =
|
|
1117
|
+
updateSVG(t) {
|
|
1118
|
+
this._svg = t, this.refresh();
|
|
217
1119
|
}
|
|
218
1120
|
}
|
|
219
|
-
customElements.get("courier-icon") || customElements.define("courier-icon",
|
|
220
|
-
class
|
|
1121
|
+
customElements.get("courier-icon") || customElements.define("courier-icon", ne);
|
|
1122
|
+
class Ue extends HTMLElement {
|
|
221
1123
|
constructor() {
|
|
222
|
-
super(),
|
|
223
|
-
const
|
|
1124
|
+
super(), $(this, "link");
|
|
1125
|
+
const t = this.attachShadow({ mode: "open" });
|
|
224
1126
|
this.link = document.createElement("a"), this.link.setAttribute("part", "link");
|
|
225
1127
|
const e = document.createElement("style");
|
|
226
1128
|
e.textContent = `
|
|
@@ -240,7 +1142,7 @@ class De extends HTMLElement {
|
|
|
240
1142
|
|
|
241
1143
|
/* Variants */
|
|
242
1144
|
a[data-variant="primary"][data-mode="light"] {
|
|
243
|
-
color: var(--courier-link-color, ${
|
|
1145
|
+
color: var(--courier-link-color, ${W.light.colors.link});
|
|
244
1146
|
}
|
|
245
1147
|
|
|
246
1148
|
a[data-variant="primary"][data-mode="light"]:hover {
|
|
@@ -252,7 +1154,7 @@ class De extends HTMLElement {
|
|
|
252
1154
|
}
|
|
253
1155
|
|
|
254
1156
|
a[data-variant="primary"][data-mode="dark"] {
|
|
255
|
-
color: var(--courier-link-color, ${
|
|
1157
|
+
color: var(--courier-link-color, ${W.dark.colors.link});
|
|
256
1158
|
}
|
|
257
1159
|
|
|
258
1160
|
a[data-variant="primary"][data-mode="dark"]:hover {
|
|
@@ -272,15 +1174,15 @@ class De extends HTMLElement {
|
|
|
272
1174
|
cursor: not-allowed;
|
|
273
1175
|
pointer-events: none;
|
|
274
1176
|
}
|
|
275
|
-
`,
|
|
1177
|
+
`, t.appendChild(e), t.appendChild(this.link), this.updateVariant(), this.updateUnderline(), this.updateMode();
|
|
276
1178
|
}
|
|
277
1179
|
connectedCallback() {
|
|
278
|
-
const
|
|
279
|
-
this.link.appendChild(
|
|
1180
|
+
const t = document.createElement("slot");
|
|
1181
|
+
this.link.appendChild(t), this.updateHref();
|
|
280
1182
|
}
|
|
281
|
-
attributeChangedCallback(
|
|
282
|
-
if (e !==
|
|
283
|
-
switch (
|
|
1183
|
+
attributeChangedCallback(t, e, i) {
|
|
1184
|
+
if (e !== i)
|
|
1185
|
+
switch (t) {
|
|
284
1186
|
case "href":
|
|
285
1187
|
this.updateHref();
|
|
286
1188
|
break;
|
|
@@ -309,39 +1211,39 @@ class De extends HTMLElement {
|
|
|
309
1211
|
}
|
|
310
1212
|
}
|
|
311
1213
|
updateHref() {
|
|
312
|
-
const
|
|
313
|
-
|
|
1214
|
+
const t = this.getAttribute("href");
|
|
1215
|
+
t && (this.link.href = t);
|
|
314
1216
|
}
|
|
315
1217
|
updateVariant() {
|
|
316
|
-
const
|
|
317
|
-
this.link.setAttribute("data-variant",
|
|
1218
|
+
const t = this.getAttribute("variant") || "primary", e = this.getAttribute("mode") || "light";
|
|
1219
|
+
this.link.setAttribute("data-variant", t), this.link.setAttribute("data-mode", e);
|
|
318
1220
|
}
|
|
319
1221
|
updateColor() {
|
|
320
|
-
const
|
|
321
|
-
|
|
1222
|
+
const t = this.getAttribute("color");
|
|
1223
|
+
t ? this.link.style.setProperty("--courier-link-color", t) : this.link.style.removeProperty("--courier-link-color");
|
|
322
1224
|
}
|
|
323
1225
|
updateUnderline() {
|
|
324
|
-
const
|
|
325
|
-
this.link.setAttribute("data-underline",
|
|
1226
|
+
const t = this.getAttribute("underline") === "true";
|
|
1227
|
+
this.link.setAttribute("data-underline", t.toString());
|
|
326
1228
|
}
|
|
327
1229
|
updateMode() {
|
|
328
|
-
const
|
|
329
|
-
this.link.setAttribute("data-mode",
|
|
1230
|
+
const t = this.getAttribute("mode") || "light";
|
|
1231
|
+
this.link.setAttribute("data-mode", t);
|
|
330
1232
|
}
|
|
331
1233
|
updateTarget() {
|
|
332
|
-
const
|
|
333
|
-
|
|
1234
|
+
const t = this.getAttribute("target");
|
|
1235
|
+
t && (this.link.target = t);
|
|
334
1236
|
}
|
|
335
1237
|
updateFontFamily() {
|
|
336
|
-
const
|
|
337
|
-
|
|
1238
|
+
const t = this.getAttribute("font-family");
|
|
1239
|
+
t ? this.link.style.setProperty("--courier-link-font-family", t) : this.link.style.removeProperty("--courier-link-font-family");
|
|
338
1240
|
}
|
|
339
1241
|
updateFontSize() {
|
|
340
|
-
const
|
|
341
|
-
|
|
1242
|
+
const t = this.getAttribute("font-size");
|
|
1243
|
+
t ? this.link.style.setProperty("--courier-link-font-size", t) : this.link.style.removeProperty("--courier-link-font-size");
|
|
342
1244
|
}
|
|
343
1245
|
}
|
|
344
|
-
|
|
1246
|
+
$(Ue, "observedAttributes", [
|
|
345
1247
|
"href",
|
|
346
1248
|
"variant",
|
|
347
1249
|
"disabled",
|
|
@@ -352,46 +1254,46 @@ L(De, "observedAttributes", [
|
|
|
352
1254
|
"font-family",
|
|
353
1255
|
"font-size"
|
|
354
1256
|
]);
|
|
355
|
-
customElements.get("courier-link") || customElements.define("courier-link",
|
|
356
|
-
class
|
|
1257
|
+
customElements.get("courier-link") || customElements.define("courier-link", Ue);
|
|
1258
|
+
class De extends $o {
|
|
357
1259
|
constructor() {
|
|
358
|
-
super(),
|
|
1260
|
+
super(), $(this, "shadow"), this.shadow = this.attachShadow({ mode: "open" });
|
|
359
1261
|
}
|
|
360
1262
|
// Build the element with a factory function
|
|
361
|
-
build(
|
|
362
|
-
if (
|
|
1263
|
+
build(t) {
|
|
1264
|
+
if (t === null) {
|
|
363
1265
|
this.shadow.replaceChildren();
|
|
364
1266
|
return;
|
|
365
1267
|
}
|
|
366
|
-
const e =
|
|
1268
|
+
const e = t ?? this.defaultElement();
|
|
367
1269
|
this.shadow.replaceChildren(e);
|
|
368
1270
|
}
|
|
369
1271
|
// Default element to be used if no factory is provided
|
|
370
1272
|
defaultElement() {
|
|
371
|
-
const
|
|
372
|
-
return
|
|
1273
|
+
const t = document.createElement("div");
|
|
1274
|
+
return t.textContent = "Default Element Factory", t.style.cssText = `
|
|
373
1275
|
background-color: red;
|
|
374
1276
|
text-align: center;
|
|
375
1277
|
padding: 12px;
|
|
376
|
-
`,
|
|
1278
|
+
`, t;
|
|
377
1279
|
}
|
|
378
1280
|
}
|
|
379
|
-
class
|
|
380
|
-
constructor(
|
|
381
|
-
super(),
|
|
1281
|
+
class Be extends De {
|
|
1282
|
+
constructor(t) {
|
|
1283
|
+
super(), $(this, "_props"), $(this, "_title"), $(this, "_button"), $(this, "_style"), $(this, "_buttonClickCallback", null), this._props = t;
|
|
382
1284
|
}
|
|
383
1285
|
defaultElement() {
|
|
384
|
-
var
|
|
385
|
-
const
|
|
386
|
-
return this._title = document.createElement("h2"), (
|
|
1286
|
+
var t, e;
|
|
1287
|
+
const i = document.createElement("div");
|
|
1288
|
+
return this._title = document.createElement("h2"), (t = this._props.title) != null && t.text && (this._title.textContent = this._props.title.text), this._button = new Re(this._props.button ?? se.secondary(this.currentSystemTheme)), this._style = document.createElement("style"), this._style.textContent = this.getStyles(this._props), i.className = "container", i.appendChild(this._style), i.appendChild(this._title), i.appendChild(this._button), this.shadow.appendChild(i), (e = this._button) == null || e.addEventListener("click", () => {
|
|
387
1289
|
this._buttonClickCallback && this._buttonClickCallback();
|
|
388
|
-
}),
|
|
1290
|
+
}), i;
|
|
389
1291
|
}
|
|
390
|
-
onSystemThemeChange(
|
|
1292
|
+
onSystemThemeChange(t) {
|
|
391
1293
|
this.updateStyles(this._props);
|
|
392
1294
|
}
|
|
393
|
-
getStyles(
|
|
394
|
-
var e,
|
|
1295
|
+
getStyles(t) {
|
|
1296
|
+
var e, i, s, o;
|
|
395
1297
|
return `
|
|
396
1298
|
:host {
|
|
397
1299
|
display: flex;
|
|
@@ -413,26 +1315,26 @@ class Ee extends Le {
|
|
|
413
1315
|
|
|
414
1316
|
.container h2 {
|
|
415
1317
|
margin: 0;
|
|
416
|
-
color: ${((e =
|
|
417
|
-
font-size: ${((
|
|
418
|
-
font-weight: ${((s =
|
|
419
|
-
font-family: ${((o =
|
|
1318
|
+
color: ${((e = t.title) == null ? void 0 : e.textColor) ?? "red"};
|
|
1319
|
+
font-size: ${((i = t.title) == null ? void 0 : i.fontSize) ?? "16px"};
|
|
1320
|
+
font-weight: ${((s = t.title) == null ? void 0 : s.fontWeight) ?? "500"};
|
|
1321
|
+
font-family: ${((o = t.title) == null ? void 0 : o.fontFamily) ?? "inherit"};
|
|
420
1322
|
}
|
|
421
1323
|
`;
|
|
422
1324
|
}
|
|
423
|
-
updateStyles(
|
|
424
|
-
this._props =
|
|
1325
|
+
updateStyles(t) {
|
|
1326
|
+
this._props = t, this._style && (this._style.textContent = this.getStyles(t)), this._button && this._button.updateButton(t.button);
|
|
425
1327
|
}
|
|
426
|
-
setButtonClickCallback(
|
|
427
|
-
this._buttonClickCallback =
|
|
1328
|
+
setButtonClickCallback(t) {
|
|
1329
|
+
this._buttonClickCallback = t;
|
|
428
1330
|
}
|
|
429
1331
|
}
|
|
430
|
-
customElements.get("courier-info-state") || customElements.define("courier-info-state",
|
|
431
|
-
class
|
|
432
|
-
constructor(
|
|
433
|
-
super(),
|
|
434
|
-
const
|
|
435
|
-
this._button = document.createElement("button"), this._button.setAttribute("part", "button"), this._icon = new
|
|
1332
|
+
customElements.get("courier-info-state") || customElements.define("courier-info-state", Be);
|
|
1333
|
+
class $e extends HTMLElement {
|
|
1334
|
+
constructor(t, e, i, s, o, n, c, d) {
|
|
1335
|
+
super(), $(this, "_backgroundColor"), $(this, "_hoverBackgroundColor"), $(this, "_activeBackgroundColor"), $(this, "_borderRadius"), $(this, "_height"), $(this, "_width"), $(this, "_style"), $(this, "_button"), $(this, "_icon"), this._borderRadius = n, this._backgroundColor = i, this._hoverBackgroundColor = s, this._activeBackgroundColor = o, this._height = c, this._width = d;
|
|
1336
|
+
const l = this.attachShadow({ mode: "open" });
|
|
1337
|
+
this._button = document.createElement("button"), this._button.setAttribute("part", "button"), this._icon = new ne(e, t), this._style = document.createElement("style"), this.refresh(), l.appendChild(this._style), this._button.appendChild(this._icon), l.appendChild(this._button);
|
|
436
1338
|
}
|
|
437
1339
|
refresh() {
|
|
438
1340
|
this._style.textContent = this.getStyles();
|
|
@@ -480,34 +1382,34 @@ class Se extends HTMLElement {
|
|
|
480
1382
|
}
|
|
481
1383
|
`;
|
|
482
1384
|
}
|
|
483
|
-
updateIconColor(
|
|
484
|
-
this._icon.updateColor(
|
|
1385
|
+
updateIconColor(t) {
|
|
1386
|
+
this._icon.updateColor(t);
|
|
485
1387
|
}
|
|
486
|
-
updateIconSVG(
|
|
487
|
-
this._icon.updateSVG(
|
|
1388
|
+
updateIconSVG(t) {
|
|
1389
|
+
this._icon.updateSVG(t);
|
|
488
1390
|
}
|
|
489
|
-
updateBackgroundColor(
|
|
490
|
-
this._backgroundColor =
|
|
1391
|
+
updateBackgroundColor(t) {
|
|
1392
|
+
this._backgroundColor = t, this.refresh();
|
|
491
1393
|
}
|
|
492
|
-
updateHoverBackgroundColor(
|
|
493
|
-
this._hoverBackgroundColor =
|
|
1394
|
+
updateHoverBackgroundColor(t) {
|
|
1395
|
+
this._hoverBackgroundColor = t, this.refresh();
|
|
494
1396
|
}
|
|
495
|
-
updateActiveBackgroundColor(
|
|
496
|
-
this._activeBackgroundColor =
|
|
1397
|
+
updateActiveBackgroundColor(t) {
|
|
1398
|
+
this._activeBackgroundColor = t, this.refresh();
|
|
497
1399
|
}
|
|
498
1400
|
}
|
|
499
|
-
customElements.get("courier-icon-button") || customElements.define("courier-icon-button",
|
|
500
|
-
const
|
|
501
|
-
{ name: "courier-button", class:
|
|
502
|
-
{ name: "courier-icon", class:
|
|
503
|
-
{ name: "courier-link", class:
|
|
504
|
-
{ name: "courier-info-state", class:
|
|
505
|
-
{ name: "courier-icon-button", class:
|
|
1401
|
+
customElements.get("courier-icon-button") || customElements.define("courier-icon-button", $e);
|
|
1402
|
+
const cn = [
|
|
1403
|
+
{ name: "courier-button", class: Re },
|
|
1404
|
+
{ name: "courier-icon", class: ne },
|
|
1405
|
+
{ name: "courier-link", class: Ue },
|
|
1406
|
+
{ name: "courier-info-state", class: Be },
|
|
1407
|
+
{ name: "courier-icon-button", class: $e }
|
|
506
1408
|
];
|
|
507
|
-
|
|
508
|
-
customElements.get(
|
|
1409
|
+
cn.forEach(({ name: h, class: t }) => {
|
|
1410
|
+
customElements.get(h) || customElements.define(h, t);
|
|
509
1411
|
});
|
|
510
|
-
const
|
|
1412
|
+
const oe = class oe {
|
|
511
1413
|
constructor() {
|
|
512
1414
|
a(this, "_inboxDataSet");
|
|
513
1415
|
a(this, "_archiveDataSet");
|
|
@@ -517,7 +1419,7 @@ const te = class te {
|
|
|
517
1419
|
a(this, "isPaginatingArchive", !1);
|
|
518
1420
|
}
|
|
519
1421
|
static get shared() {
|
|
520
|
-
return
|
|
1422
|
+
return oe.instance || (oe.instance = new oe()), oe.instance;
|
|
521
1423
|
}
|
|
522
1424
|
get unreadCount() {
|
|
523
1425
|
return this._unreadCount ?? 0;
|
|
@@ -528,16 +1430,16 @@ const te = class te {
|
|
|
528
1430
|
get archiveDataSet() {
|
|
529
1431
|
return this._archiveDataSet ?? { messages: [], canPaginate: !1, paginationCursor: null };
|
|
530
1432
|
}
|
|
531
|
-
addDataStoreListener(
|
|
532
|
-
this._dataStoreListeners.push(
|
|
1433
|
+
addDataStoreListener(t) {
|
|
1434
|
+
this._dataStoreListeners.push(t);
|
|
533
1435
|
}
|
|
534
|
-
removeDataStoreListener(
|
|
535
|
-
this._dataStoreListeners = this._dataStoreListeners.filter((e) => e !==
|
|
1436
|
+
removeDataStoreListener(t) {
|
|
1437
|
+
this._dataStoreListeners = this._dataStoreListeners.filter((e) => e !== t);
|
|
536
1438
|
}
|
|
537
|
-
async fetchDataSet(
|
|
538
|
-
var
|
|
539
|
-
if (
|
|
540
|
-
switch (
|
|
1439
|
+
async fetchDataSet(t) {
|
|
1440
|
+
var i, s, o, n, c, d, l, p, m, g;
|
|
1441
|
+
if (t.canUseCache)
|
|
1442
|
+
switch (t.feedType) {
|
|
541
1443
|
case "inbox":
|
|
542
1444
|
if (this._inboxDataSet)
|
|
543
1445
|
return this._inboxDataSet;
|
|
@@ -547,23 +1449,23 @@ const te = class te {
|
|
|
547
1449
|
return this._archiveDataSet;
|
|
548
1450
|
break;
|
|
549
1451
|
}
|
|
550
|
-
const e =
|
|
1452
|
+
const e = t.feedType === "inbox" ? await ((i = v.shared.client) == null ? void 0 : i.inbox.getMessages()) : await ((s = v.shared.client) == null ? void 0 : s.inbox.getArchivedMessages());
|
|
551
1453
|
return {
|
|
552
1454
|
messages: ((n = (o = e == null ? void 0 : e.data) == null ? void 0 : o.messages) == null ? void 0 : n.nodes) ?? [],
|
|
553
|
-
canPaginate: ((
|
|
554
|
-
paginationCursor: ((
|
|
1455
|
+
canPaginate: ((l = (d = (c = e == null ? void 0 : e.data) == null ? void 0 : c.messages) == null ? void 0 : d.pageInfo) == null ? void 0 : l.hasNextPage) ?? !1,
|
|
1456
|
+
paginationCursor: ((g = (m = (p = e == null ? void 0 : e.data) == null ? void 0 : p.messages) == null ? void 0 : m.pageInfo) == null ? void 0 : g.startCursor) ?? null
|
|
555
1457
|
};
|
|
556
1458
|
}
|
|
557
|
-
async fetchUnreadCount(
|
|
558
|
-
var
|
|
559
|
-
return
|
|
1459
|
+
async fetchUnreadCount(t) {
|
|
1460
|
+
var i;
|
|
1461
|
+
return t.canUseCache && this._unreadCount !== void 0 ? this._unreadCount : await ((i = v.shared.client) == null ? void 0 : i.inbox.getUnreadMessageCount()) ?? 0;
|
|
560
1462
|
}
|
|
561
|
-
async load(
|
|
562
|
-
var e,
|
|
1463
|
+
async load(t) {
|
|
1464
|
+
var e, i, s;
|
|
563
1465
|
try {
|
|
564
|
-
if (!((e =
|
|
1466
|
+
if (!((e = v.shared.client) != null && e.options.userId))
|
|
565
1467
|
throw new Error("User is not signed in");
|
|
566
|
-
const o =
|
|
1468
|
+
const o = t ?? { feedType: "inbox", canUseCache: !0 }, [n, c] = await Promise.all([
|
|
567
1469
|
this.fetchDataSet(o),
|
|
568
1470
|
this.fetchUnreadCount(o)
|
|
569
1471
|
]);
|
|
@@ -575,32 +1477,32 @@ const te = class te {
|
|
|
575
1477
|
this._archiveDataSet = n;
|
|
576
1478
|
break;
|
|
577
1479
|
}
|
|
578
|
-
this._unreadCount =
|
|
579
|
-
var
|
|
580
|
-
(
|
|
1480
|
+
this._unreadCount = c, this._dataStoreListeners.forEach((d) => {
|
|
1481
|
+
var l, p, m, g;
|
|
1482
|
+
(p = (l = d.events).onDataSetChange) == null || p.call(l, n, o.feedType), (g = (m = d.events).onUnreadCountChange) == null || g.call(m, this._unreadCount ?? 0);
|
|
581
1483
|
}), await this.connectSocket();
|
|
582
1484
|
} catch (o) {
|
|
583
|
-
(s = (
|
|
584
|
-
var
|
|
585
|
-
(d = (
|
|
1485
|
+
(s = (i = v.shared.client) == null ? void 0 : i.options.logger) == null || s.error("Error loading inbox:", o), this._dataStoreListeners.forEach((n) => {
|
|
1486
|
+
var c, d;
|
|
1487
|
+
(d = (c = n.events).onError) == null || d.call(c, o);
|
|
586
1488
|
});
|
|
587
1489
|
}
|
|
588
1490
|
}
|
|
589
1491
|
async connectSocket() {
|
|
590
|
-
var e,
|
|
591
|
-
const
|
|
1492
|
+
var e, i, s, o, n, c, d, l, p, m, g, f;
|
|
1493
|
+
const t = (e = v.shared.client) == null ? void 0 : e.inbox.socket;
|
|
592
1494
|
try {
|
|
593
|
-
if (!
|
|
594
|
-
(s = (
|
|
1495
|
+
if (!t) {
|
|
1496
|
+
(s = (i = v.shared.client) == null ? void 0 : i.options.logger) == null || s.info("CourierInbox socket not available");
|
|
595
1497
|
return;
|
|
596
1498
|
}
|
|
597
|
-
if ((
|
|
598
|
-
(
|
|
1499
|
+
if ((c = (o = v.shared.client) == null ? void 0 : o.options.logger) == null || c.info("CourierInbox socket connectionId:", (n = v.shared.client) == null ? void 0 : n.options.connectionId), t.isConnected) {
|
|
1500
|
+
(l = (d = v.shared.client) == null ? void 0 : d.options.logger) == null || l.info("CourierInbox socket already connected. Socket will not attempt reconnection.");
|
|
599
1501
|
return;
|
|
600
1502
|
}
|
|
601
|
-
|
|
1503
|
+
t.receivedMessage = (_) => {
|
|
602
1504
|
this.addMessage(_, 0, "inbox");
|
|
603
|
-
},
|
|
1505
|
+
}, t.receivedMessageEvent = (_) => {
|
|
604
1506
|
let b;
|
|
605
1507
|
switch (_.messageId && (b = this.getMessage({ messageId: _.messageId })), _.event) {
|
|
606
1508
|
case "mark-all-read":
|
|
@@ -628,35 +1530,35 @@ const te = class te {
|
|
|
628
1530
|
case "unarchive":
|
|
629
1531
|
break;
|
|
630
1532
|
}
|
|
631
|
-
}, await
|
|
1533
|
+
}, await t.connect(), await t.sendSubscribe(), t.keepAlive(), (m = (p = v.shared.client) == null ? void 0 : p.options.logger) == null || m.info("CourierInbox socket connected");
|
|
632
1534
|
} catch (_) {
|
|
633
|
-
(
|
|
1535
|
+
(f = (g = v.shared.client) == null ? void 0 : g.options.logger) == null || f.error("Failed to connect socket:", _);
|
|
634
1536
|
}
|
|
635
1537
|
}
|
|
636
|
-
getMessage(
|
|
637
|
-
var e,
|
|
638
|
-
return ((e = this._inboxDataSet) == null ? void 0 : e.messages.find((s) => s.messageId ===
|
|
1538
|
+
getMessage(t) {
|
|
1539
|
+
var e, i;
|
|
1540
|
+
return ((e = this._inboxDataSet) == null ? void 0 : e.messages.find((s) => s.messageId === t.messageId)) ?? ((i = this._archiveDataSet) == null ? void 0 : i.messages.find((s) => s.messageId === t.messageId));
|
|
639
1541
|
}
|
|
640
|
-
async fetchNextPageOfMessages(
|
|
641
|
-
var e,
|
|
642
|
-
switch (
|
|
1542
|
+
async fetchNextPageOfMessages(t) {
|
|
1543
|
+
var e, i, s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E, M, L, R, D;
|
|
1544
|
+
switch (t.feedType) {
|
|
643
1545
|
case "inbox":
|
|
644
1546
|
if (this.isPaginatingInbox)
|
|
645
1547
|
return null;
|
|
646
1548
|
if ((e = this._inboxDataSet) != null && e.canPaginate && this._inboxDataSet.paginationCursor)
|
|
647
1549
|
try {
|
|
648
1550
|
this.isPaginatingInbox = !0;
|
|
649
|
-
const y = await ((
|
|
650
|
-
paginationLimit:
|
|
1551
|
+
const y = await ((i = v.shared.client) == null ? void 0 : i.inbox.getMessages({
|
|
1552
|
+
paginationLimit: v.shared.paginationLimit,
|
|
651
1553
|
startCursor: this._inboxDataSet.paginationCursor
|
|
652
|
-
})),
|
|
1554
|
+
})), A = {
|
|
653
1555
|
messages: ((o = (s = y == null ? void 0 : y.data) == null ? void 0 : s.messages) == null ? void 0 : o.nodes) ?? [],
|
|
654
|
-
canPaginate: ((d = (
|
|
655
|
-
paginationCursor: ((m = (
|
|
1556
|
+
canPaginate: ((d = (c = (n = y == null ? void 0 : y.data) == null ? void 0 : n.messages) == null ? void 0 : c.pageInfo) == null ? void 0 : d.hasNextPage) ?? !1,
|
|
1557
|
+
paginationCursor: ((m = (p = (l = y == null ? void 0 : y.data) == null ? void 0 : l.messages) == null ? void 0 : p.pageInfo) == null ? void 0 : m.startCursor) ?? null
|
|
656
1558
|
};
|
|
657
|
-
return this.addPage(
|
|
1559
|
+
return this.addPage(A, "inbox"), A;
|
|
658
1560
|
} catch (y) {
|
|
659
|
-
return (
|
|
1561
|
+
return (f = (g = v.shared.client) == null ? void 0 : g.options.logger) == null || f.error("Error fetching next page of inbox messages:", y), null;
|
|
660
1562
|
} finally {
|
|
661
1563
|
this.isPaginatingInbox = !1;
|
|
662
1564
|
}
|
|
@@ -667,17 +1569,17 @@ const te = class te {
|
|
|
667
1569
|
if ((_ = this._archiveDataSet) != null && _.canPaginate && this._archiveDataSet.paginationCursor)
|
|
668
1570
|
try {
|
|
669
1571
|
this.isPaginatingArchive = !0;
|
|
670
|
-
const y = await ((b =
|
|
671
|
-
paginationLimit:
|
|
1572
|
+
const y = await ((b = v.shared.client) == null ? void 0 : b.inbox.getArchivedMessages({
|
|
1573
|
+
paginationLimit: v.shared.paginationLimit,
|
|
672
1574
|
startCursor: this._archiveDataSet.paginationCursor
|
|
673
|
-
})),
|
|
674
|
-
messages: ((k = (
|
|
675
|
-
canPaginate: ((
|
|
676
|
-
paginationCursor: ((
|
|
1575
|
+
})), A = {
|
|
1576
|
+
messages: ((k = (C = y == null ? void 0 : y.data) == null ? void 0 : C.messages) == null ? void 0 : k.nodes) ?? [],
|
|
1577
|
+
canPaginate: ((I = (S = (w = y == null ? void 0 : y.data) == null ? void 0 : w.messages) == null ? void 0 : S.pageInfo) == null ? void 0 : I.hasNextPage) ?? !1,
|
|
1578
|
+
paginationCursor: ((L = (M = (E = y == null ? void 0 : y.data) == null ? void 0 : E.messages) == null ? void 0 : M.pageInfo) == null ? void 0 : L.startCursor) ?? null
|
|
677
1579
|
};
|
|
678
|
-
return this.addPage(
|
|
1580
|
+
return this.addPage(A, "archive"), A;
|
|
679
1581
|
} catch (y) {
|
|
680
|
-
return (
|
|
1582
|
+
return (D = (R = v.shared.client) == null ? void 0 : R.options.logger) == null || D.error("Error fetching next page of archived messages:", y), null;
|
|
681
1583
|
} finally {
|
|
682
1584
|
this.isPaginatingArchive = !1;
|
|
683
1585
|
}
|
|
@@ -685,227 +1587,227 @@ const te = class te {
|
|
|
685
1587
|
}
|
|
686
1588
|
return null;
|
|
687
1589
|
}
|
|
688
|
-
applyLocalMessageChange(
|
|
689
|
-
for (const [
|
|
690
|
-
s !== void 0 && this.updateMessage(
|
|
1590
|
+
applyLocalMessageChange(t, e) {
|
|
1591
|
+
for (const [i, s] of Object.entries(e))
|
|
1592
|
+
s !== void 0 && this.updateMessage(t, s, i);
|
|
691
1593
|
}
|
|
692
|
-
async readMessage({ message:
|
|
693
|
-
var o, n,
|
|
694
|
-
if (!
|
|
1594
|
+
async readMessage({ message: t, canCallApi: e = !0 }) {
|
|
1595
|
+
var o, n, c, d;
|
|
1596
|
+
if (!v.shared.client)
|
|
695
1597
|
return;
|
|
696
|
-
const
|
|
697
|
-
if (
|
|
1598
|
+
const i = t;
|
|
1599
|
+
if (i.read)
|
|
698
1600
|
return;
|
|
699
1601
|
const s = {
|
|
700
|
-
inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((
|
|
701
|
-
archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((
|
|
1602
|
+
inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((l) => l.messageId === t.messageId),
|
|
1603
|
+
archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((l) => l.messageId === t.messageId)
|
|
702
1604
|
};
|
|
703
1605
|
try {
|
|
704
|
-
|
|
705
|
-
} catch (
|
|
706
|
-
this.applyLocalMessageChange(
|
|
1606
|
+
t.read = (/* @__PURE__ */ new Date()).toISOString(), this.applyLocalMessageChange(t, s), e && await v.shared.client.inbox.read({ messageId: t.messageId });
|
|
1607
|
+
} catch (l) {
|
|
1608
|
+
this.applyLocalMessageChange(i, s), (d = (c = v.shared.client) == null ? void 0 : c.options.logger) == null || d.error("Error reading message:", l);
|
|
707
1609
|
}
|
|
708
1610
|
}
|
|
709
|
-
async unreadMessage({ message:
|
|
710
|
-
var o, n,
|
|
711
|
-
if (!
|
|
1611
|
+
async unreadMessage({ message: t, canCallApi: e = !0 }) {
|
|
1612
|
+
var o, n, c, d;
|
|
1613
|
+
if (!v.shared.client)
|
|
712
1614
|
return;
|
|
713
|
-
const
|
|
714
|
-
if (!
|
|
1615
|
+
const i = t;
|
|
1616
|
+
if (!i.read)
|
|
715
1617
|
return;
|
|
716
1618
|
const s = {
|
|
717
|
-
inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((
|
|
718
|
-
archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((
|
|
1619
|
+
inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((l) => l.messageId === t.messageId),
|
|
1620
|
+
archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((l) => l.messageId === t.messageId)
|
|
719
1621
|
};
|
|
720
1622
|
try {
|
|
721
|
-
|
|
722
|
-
} catch (
|
|
723
|
-
this.applyLocalMessageChange(
|
|
1623
|
+
t.read = void 0, this.applyLocalMessageChange(t, s), e && await v.shared.client.inbox.unread({ messageId: t.messageId });
|
|
1624
|
+
} catch (l) {
|
|
1625
|
+
this.applyLocalMessageChange(i, s), (d = (c = v.shared.client) == null ? void 0 : c.options.logger) == null || d.error("Error unreading message:", l);
|
|
724
1626
|
}
|
|
725
1627
|
}
|
|
726
|
-
async openMessage({ message:
|
|
727
|
-
var o, n,
|
|
728
|
-
if (!
|
|
1628
|
+
async openMessage({ message: t, canCallApi: e = !0 }) {
|
|
1629
|
+
var o, n, c, d;
|
|
1630
|
+
if (!v.shared.client)
|
|
729
1631
|
return;
|
|
730
|
-
const
|
|
731
|
-
inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((
|
|
732
|
-
archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((
|
|
1632
|
+
const i = t, s = {
|
|
1633
|
+
inbox: (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((l) => l.messageId === t.messageId),
|
|
1634
|
+
archive: (n = this._archiveDataSet) == null ? void 0 : n.messages.findIndex((l) => l.messageId === t.messageId)
|
|
733
1635
|
};
|
|
734
|
-
if (!(!s.inbox && !s.archive) && !
|
|
1636
|
+
if (!(!s.inbox && !s.archive) && !i.opened)
|
|
735
1637
|
try {
|
|
736
|
-
|
|
737
|
-
} catch (
|
|
738
|
-
this.applyLocalMessageChange(
|
|
1638
|
+
t.opened = (/* @__PURE__ */ new Date()).toISOString(), this.applyLocalMessageChange(t, s), e && await v.shared.client.inbox.open({ messageId: t.messageId });
|
|
1639
|
+
} catch (l) {
|
|
1640
|
+
this.applyLocalMessageChange(i, s), (d = (c = v.shared.client) == null ? void 0 : c.options.logger) == null || d.error("Error opening message:", l);
|
|
739
1641
|
}
|
|
740
1642
|
}
|
|
741
|
-
async clickMessage({ message:
|
|
742
|
-
var
|
|
743
|
-
if (
|
|
1643
|
+
async clickMessage({ message: t, canCallApi: e = !0 }) {
|
|
1644
|
+
var i, s, o, n;
|
|
1645
|
+
if (v.shared.client)
|
|
744
1646
|
try {
|
|
745
|
-
(
|
|
746
|
-
messageId:
|
|
747
|
-
trackingId: (s =
|
|
1647
|
+
(i = t.trackingIds) != null && i.clickTrackingId && e && await v.shared.client.inbox.click({
|
|
1648
|
+
messageId: t.messageId,
|
|
1649
|
+
trackingId: (s = t.trackingIds) == null ? void 0 : s.clickTrackingId
|
|
748
1650
|
});
|
|
749
|
-
} catch (
|
|
750
|
-
(n = (o =
|
|
1651
|
+
} catch (c) {
|
|
1652
|
+
(n = (o = v.shared.client) == null ? void 0 : o.options.logger) == null || n.error("Error clicking message:", c);
|
|
751
1653
|
}
|
|
752
1654
|
}
|
|
753
|
-
async archiveMessage({ message:
|
|
1655
|
+
async archiveMessage({ message: t, canCallApi: e = !0 }) {
|
|
754
1656
|
var o, n;
|
|
755
|
-
if (!
|
|
1657
|
+
if (!v.shared.client)
|
|
756
1658
|
return;
|
|
757
|
-
const
|
|
1659
|
+
const i = t, s = (o = this._inboxDataSet) == null ? void 0 : o.messages.findIndex((c) => c.messageId === t.messageId);
|
|
758
1660
|
if (s !== void 0)
|
|
759
1661
|
try {
|
|
760
|
-
if (this.removeMessage(
|
|
761
|
-
const
|
|
762
|
-
|
|
1662
|
+
if (this.removeMessage(t, s, "inbox"), (n = this._archiveDataSet) != null && n.messages) {
|
|
1663
|
+
const c = this.findInsertIndex(t, this._archiveDataSet.messages);
|
|
1664
|
+
t.archived = (/* @__PURE__ */ new Date()).toISOString(), this.addMessage(t, c, "archive");
|
|
763
1665
|
}
|
|
764
|
-
e && await
|
|
1666
|
+
e && await v.shared.client.inbox.archive({ messageId: t.messageId });
|
|
765
1667
|
} catch {
|
|
766
|
-
this.addMessage(
|
|
1668
|
+
this.addMessage(i, s, "inbox"), t.archived = void 0, this.removeMessage(t, s, "archive");
|
|
767
1669
|
}
|
|
768
1670
|
}
|
|
769
|
-
async archiveReadMessages({ canCallApi:
|
|
1671
|
+
async archiveReadMessages({ canCallApi: t = !0 } = {}) {
|
|
770
1672
|
var s;
|
|
771
|
-
if (!
|
|
1673
|
+
if (!v.shared.client)
|
|
772
1674
|
return;
|
|
773
|
-
const e = this._inboxDataSet,
|
|
1675
|
+
const e = this._inboxDataSet, i = this._archiveDataSet;
|
|
774
1676
|
try {
|
|
775
1677
|
(s = this._inboxDataSet) == null || s.messages.forEach((o) => {
|
|
776
|
-
var
|
|
1678
|
+
var c, d;
|
|
777
1679
|
if (!o.read)
|
|
778
1680
|
return;
|
|
779
|
-
const n = (
|
|
1681
|
+
const n = (c = this._inboxDataSet) == null ? void 0 : c.messages.findIndex((l) => l.messageId === o.messageId);
|
|
780
1682
|
if (n !== void 0 && (this.removeMessage(o, n, "inbox"), (d = this._archiveDataSet) != null && d.messages)) {
|
|
781
|
-
const
|
|
782
|
-
o.archived = (/* @__PURE__ */ new Date()).toISOString(), this.addMessage(o,
|
|
1683
|
+
const l = this.findInsertIndex(o, this._archiveDataSet.messages);
|
|
1684
|
+
o.archived = (/* @__PURE__ */ new Date()).toISOString(), this.addMessage(o, l, "archive");
|
|
783
1685
|
}
|
|
784
1686
|
}), this._dataStoreListeners.forEach((o) => {
|
|
785
|
-
var n,
|
|
786
|
-
this._inboxDataSet && ((
|
|
787
|
-
}),
|
|
1687
|
+
var n, c, d, l;
|
|
1688
|
+
this._inboxDataSet && ((c = (n = o.events).onDataSetChange) == null || c.call(n, this._inboxDataSet, "inbox")), this._archiveDataSet && ((l = (d = o.events).onDataSetChange) == null || l.call(d, this._archiveDataSet, "archive"));
|
|
1689
|
+
}), t && await v.shared.client.inbox.archiveRead();
|
|
788
1690
|
} catch (o) {
|
|
789
|
-
console.error("Error archiving read messages:", o), this._inboxDataSet && e && (this._inboxDataSet.messages = e.messages), this._archiveDataSet &&
|
|
790
|
-
var
|
|
791
|
-
this._inboxDataSet && ((d = (
|
|
1691
|
+
console.error("Error archiving read messages:", o), this._inboxDataSet && e && (this._inboxDataSet.messages = e.messages), this._archiveDataSet && i && (this._archiveDataSet.messages = i.messages), this._dataStoreListeners.forEach((n) => {
|
|
1692
|
+
var c, d, l, p;
|
|
1693
|
+
this._inboxDataSet && ((d = (c = n.events).onDataSetChange) == null || d.call(c, this._inboxDataSet, "inbox")), this._archiveDataSet && ((p = (l = n.events).onDataSetChange) == null || p.call(l, this._archiveDataSet, "archive"));
|
|
792
1694
|
});
|
|
793
1695
|
}
|
|
794
1696
|
}
|
|
795
|
-
async readAllMessages({ canCallApi:
|
|
796
|
-
var o, n,
|
|
797
|
-
if (!
|
|
1697
|
+
async readAllMessages({ canCallApi: t = !0 } = {}) {
|
|
1698
|
+
var o, n, c, d;
|
|
1699
|
+
if (!v.shared.client)
|
|
798
1700
|
return;
|
|
799
|
-
const e = this._inboxDataSet,
|
|
1701
|
+
const e = this._inboxDataSet, i = this._archiveDataSet, s = this._unreadCount;
|
|
800
1702
|
try {
|
|
801
|
-
(o = this._inboxDataSet) == null || o.messages.forEach((
|
|
802
|
-
|
|
803
|
-
}), (n = this._archiveDataSet) == null || n.messages.forEach((
|
|
804
|
-
|
|
805
|
-
}), this._unreadCount = 0, this._dataStoreListeners.forEach((
|
|
806
|
-
var
|
|
807
|
-
this._inboxDataSet && ((m = (
|
|
808
|
-
}),
|
|
809
|
-
} catch (
|
|
810
|
-
(d = (
|
|
811
|
-
var m,
|
|
812
|
-
this._inboxDataSet && ((
|
|
1703
|
+
(o = this._inboxDataSet) == null || o.messages.forEach((l) => {
|
|
1704
|
+
l.read || (l.read = (/* @__PURE__ */ new Date()).toISOString());
|
|
1705
|
+
}), (n = this._archiveDataSet) == null || n.messages.forEach((l) => {
|
|
1706
|
+
l.read || (l.read = (/* @__PURE__ */ new Date()).toISOString());
|
|
1707
|
+
}), this._unreadCount = 0, this._dataStoreListeners.forEach((l) => {
|
|
1708
|
+
var p, m, g, f, _, b;
|
|
1709
|
+
this._inboxDataSet && ((m = (p = l.events).onDataSetChange) == null || m.call(p, this._inboxDataSet, "inbox")), this._archiveDataSet && ((f = (g = l.events).onDataSetChange) == null || f.call(g, this._archiveDataSet, "archive")), (b = (_ = l.events).onUnreadCountChange) == null || b.call(_, this._unreadCount);
|
|
1710
|
+
}), t && await v.shared.client.inbox.readAll();
|
|
1711
|
+
} catch (l) {
|
|
1712
|
+
(d = (c = v.shared.client) == null ? void 0 : c.options.logger) == null || d.error("Error reading all messages:", l), this._inboxDataSet && e && (this._inboxDataSet.messages = e.messages), this._archiveDataSet && i && (this._archiveDataSet.messages = i.messages), this._unreadCount = s, this._dataStoreListeners.forEach((p) => {
|
|
1713
|
+
var m, g, f, _, b, C;
|
|
1714
|
+
this._inboxDataSet && ((g = (m = p.events).onDataSetChange) == null || g.call(m, this._inboxDataSet, "inbox")), this._archiveDataSet && ((_ = (f = p.events).onDataSetChange) == null || _.call(f, this._archiveDataSet, "archive")), (C = (b = p.events).onUnreadCountChange) == null || C.call(b, this._unreadCount);
|
|
813
1715
|
});
|
|
814
1716
|
}
|
|
815
1717
|
}
|
|
816
|
-
findInsertIndex(
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
const
|
|
820
|
-
return new Date(n.created ?? Date.now()).getTime() -
|
|
1718
|
+
findInsertIndex(t, e) {
|
|
1719
|
+
const i = [...e];
|
|
1720
|
+
i.push(t), i.sort((o, n) => {
|
|
1721
|
+
const c = new Date(o.created ?? Date.now()).getTime();
|
|
1722
|
+
return new Date(n.created ?? Date.now()).getTime() - c;
|
|
821
1723
|
});
|
|
822
|
-
const s =
|
|
1724
|
+
const s = i.findIndex((o) => o.messageId === t.messageId);
|
|
823
1725
|
return Math.max(s - 1, 0);
|
|
824
1726
|
}
|
|
825
|
-
addPage(
|
|
1727
|
+
addPage(t, e) {
|
|
826
1728
|
switch (e) {
|
|
827
1729
|
case "inbox":
|
|
828
|
-
this._inboxDataSet && (this._inboxDataSet.canPaginate =
|
|
1730
|
+
this._inboxDataSet && (this._inboxDataSet.canPaginate = t.canPaginate, this._inboxDataSet.paginationCursor = t.paginationCursor, this._inboxDataSet.messages = [...this._inboxDataSet.messages, ...t.messages]);
|
|
829
1731
|
break;
|
|
830
1732
|
case "archive":
|
|
831
|
-
this._archiveDataSet && (this._archiveDataSet.canPaginate =
|
|
1733
|
+
this._archiveDataSet && (this._archiveDataSet.canPaginate = t.canPaginate, this._archiveDataSet.paginationCursor = t.paginationCursor, this._archiveDataSet.messages = [...this._archiveDataSet.messages, ...t.messages]);
|
|
832
1734
|
break;
|
|
833
1735
|
}
|
|
834
1736
|
this._dataStoreListeners.forEach(
|
|
835
|
-
(
|
|
1737
|
+
(i) => {
|
|
836
1738
|
var s, o;
|
|
837
|
-
return (o = (s =
|
|
1739
|
+
return (o = (s = i.events).onPageAdded) == null ? void 0 : o.call(s, t, e);
|
|
838
1740
|
}
|
|
839
1741
|
);
|
|
840
1742
|
}
|
|
841
|
-
addMessage(
|
|
1743
|
+
addMessage(t, e, i) {
|
|
842
1744
|
var s, o;
|
|
843
|
-
switch (
|
|
1745
|
+
switch (i) {
|
|
844
1746
|
case "inbox":
|
|
845
|
-
!
|
|
1747
|
+
!t.read && this._unreadCount !== void 0 && (this._unreadCount = this._unreadCount + 1), (s = this._inboxDataSet) == null || s.messages.splice(e, 0, t);
|
|
846
1748
|
break;
|
|
847
1749
|
case "archive":
|
|
848
|
-
(o = this._archiveDataSet) == null || o.messages.splice(e, 0,
|
|
1750
|
+
(o = this._archiveDataSet) == null || o.messages.splice(e, 0, t);
|
|
849
1751
|
break;
|
|
850
1752
|
}
|
|
851
1753
|
this._dataStoreListeners.forEach((n) => {
|
|
852
|
-
var
|
|
853
|
-
(d = (
|
|
1754
|
+
var c, d, l, p;
|
|
1755
|
+
(d = (c = n.events).onMessageAdd) == null || d.call(c, t, e, i), (p = (l = n.events).onUnreadCountChange) == null || p.call(l, this._unreadCount ?? 0);
|
|
854
1756
|
});
|
|
855
1757
|
}
|
|
856
|
-
removeMessage(
|
|
1758
|
+
removeMessage(t, e, i) {
|
|
857
1759
|
var s, o;
|
|
858
|
-
switch (
|
|
1760
|
+
switch (i) {
|
|
859
1761
|
case "inbox":
|
|
860
|
-
!
|
|
1762
|
+
!t.read && this._unreadCount !== void 0 && (this._unreadCount = this._unreadCount - 1), (s = this._inboxDataSet) == null || s.messages.splice(e, 1);
|
|
861
1763
|
break;
|
|
862
1764
|
case "archive":
|
|
863
1765
|
(o = this._archiveDataSet) == null || o.messages.splice(e, 1);
|
|
864
1766
|
break;
|
|
865
1767
|
}
|
|
866
1768
|
this._dataStoreListeners.forEach((n) => {
|
|
867
|
-
var
|
|
868
|
-
(d = (
|
|
1769
|
+
var c, d, l, p;
|
|
1770
|
+
(d = (c = n.events).onMessageRemove) == null || d.call(c, t, e, i), (p = (l = n.events).onUnreadCountChange) == null || p.call(l, this._unreadCount ?? 0);
|
|
869
1771
|
});
|
|
870
1772
|
}
|
|
871
|
-
updateMessage(
|
|
872
|
-
switch (
|
|
1773
|
+
updateMessage(t, e, i) {
|
|
1774
|
+
switch (i) {
|
|
873
1775
|
case "inbox":
|
|
874
|
-
this._unreadCount !== void 0 && !
|
|
1776
|
+
this._unreadCount !== void 0 && !t.archived && (t.read && (this._unreadCount = Math.max(0, this._unreadCount - 1)), t.read || (this._unreadCount = this._unreadCount + 1)), this._inboxDataSet && (this._inboxDataSet.messages[e] = t);
|
|
875
1777
|
break;
|
|
876
1778
|
case "archive":
|
|
877
|
-
this._archiveDataSet && (this._archiveDataSet.messages[e] =
|
|
1779
|
+
this._archiveDataSet && (this._archiveDataSet.messages[e] = t);
|
|
878
1780
|
break;
|
|
879
1781
|
}
|
|
880
1782
|
this._dataStoreListeners.forEach((s) => {
|
|
881
|
-
var o, n,
|
|
882
|
-
(n = (o = s.events).onMessageUpdate) == null || n.call(o,
|
|
1783
|
+
var o, n, c, d;
|
|
1784
|
+
(n = (o = s.events).onMessageUpdate) == null || n.call(o, t, e, i), (d = (c = s.events).onUnreadCountChange) == null || d.call(c, this._unreadCount ?? 0);
|
|
883
1785
|
});
|
|
884
1786
|
}
|
|
885
1787
|
};
|
|
886
|
-
a(
|
|
887
|
-
let
|
|
888
|
-
function
|
|
889
|
-
return
|
|
1788
|
+
a(oe, "instance");
|
|
1789
|
+
let P = oe;
|
|
1790
|
+
function gn(h) {
|
|
1791
|
+
return P.shared.readMessage({ message: h });
|
|
890
1792
|
}
|
|
891
|
-
function
|
|
892
|
-
return
|
|
1793
|
+
function mn(h) {
|
|
1794
|
+
return P.shared.unreadMessage({ message: h });
|
|
893
1795
|
}
|
|
894
|
-
function
|
|
895
|
-
return
|
|
1796
|
+
function bn(h) {
|
|
1797
|
+
return P.shared.clickMessage({ message: h });
|
|
896
1798
|
}
|
|
897
|
-
function
|
|
898
|
-
return
|
|
1799
|
+
function _n(h) {
|
|
1800
|
+
return P.shared.archiveMessage({ message: h });
|
|
899
1801
|
}
|
|
900
|
-
function
|
|
901
|
-
return
|
|
1802
|
+
function fn(h) {
|
|
1803
|
+
return P.shared.openMessage({ message: h });
|
|
902
1804
|
}
|
|
903
|
-
function
|
|
904
|
-
if (!
|
|
905
|
-
const
|
|
906
|
-
return
|
|
1805
|
+
function ln(h) {
|
|
1806
|
+
if (!h.created) return "Now";
|
|
1807
|
+
const t = /* @__PURE__ */ new Date(), e = new Date(h.created), i = Math.floor((t.getTime() - e.getTime()) / 1e3);
|
|
1808
|
+
return i < 60 ? `${i}s` : i < 3600 ? `${Math.floor(i / 60)}m` : i < 86400 ? `${Math.floor(i / 3600)}h` : i < 604800 ? `${Math.floor(i / 86400)}d` : i < 31536e3 ? `${Math.floor(i / 604800)}w` : `${Math.floor(i / 31536e3)}y`;
|
|
907
1809
|
}
|
|
908
|
-
class
|
|
1810
|
+
class Lo extends HTMLElement {
|
|
909
1811
|
constructor(e) {
|
|
910
1812
|
super();
|
|
911
1813
|
// State
|
|
@@ -914,14 +1816,14 @@ class _o extends HTMLElement {
|
|
|
914
1816
|
// Components
|
|
915
1817
|
a(this, "_style");
|
|
916
1818
|
this._theme = e;
|
|
917
|
-
const
|
|
918
|
-
this._style = document.createElement("style"), this._style.textContent = this.getStyles(),
|
|
1819
|
+
const i = this.attachShadow({ mode: "open" });
|
|
1820
|
+
this._style = document.createElement("style"), this._style.textContent = this.getStyles(), i.appendChild(this._style);
|
|
919
1821
|
const s = document.createElement("ul");
|
|
920
|
-
s.className = "menu",
|
|
1822
|
+
s.className = "menu", i.appendChild(s);
|
|
921
1823
|
}
|
|
922
1824
|
getStyles() {
|
|
923
|
-
var
|
|
924
|
-
const e = (o = (s = (
|
|
1825
|
+
var i, s, o;
|
|
1826
|
+
const e = (o = (s = (i = this._theme.inbox) == null ? void 0 : i.list) == null ? void 0 : s.item) == null ? void 0 : o.menu;
|
|
925
1827
|
return `
|
|
926
1828
|
:host {
|
|
927
1829
|
display: block;
|
|
@@ -964,19 +1866,19 @@ class _o extends HTMLElement {
|
|
|
964
1866
|
this._options = e, this.renderMenu();
|
|
965
1867
|
}
|
|
966
1868
|
renderMenu() {
|
|
967
|
-
var o, n,
|
|
1869
|
+
var o, n, c, d;
|
|
968
1870
|
const e = (o = this.shadowRoot) == null ? void 0 : o.querySelector("ul.menu");
|
|
969
1871
|
if (!e) return;
|
|
970
1872
|
e.innerHTML = "";
|
|
971
|
-
const
|
|
972
|
-
|
|
1873
|
+
const i = (d = (c = (n = this._theme.inbox) == null ? void 0 : n.list) == null ? void 0 : c.item) == null ? void 0 : d.menu, s = (l) => {
|
|
1874
|
+
l.stopPropagation(), l.preventDefault();
|
|
973
1875
|
};
|
|
974
|
-
this._options.forEach((
|
|
975
|
-
var
|
|
976
|
-
const
|
|
977
|
-
s(b),
|
|
1876
|
+
this._options.forEach((l) => {
|
|
1877
|
+
var g, f, _;
|
|
1878
|
+
const p = new $e(l.icon.svg, l.icon.color, i == null ? void 0 : i.backgroundColor, (g = i == null ? void 0 : i.item) == null ? void 0 : g.hoverBackgroundColor, (f = i == null ? void 0 : i.item) == null ? void 0 : f.activeBackgroundColor, (_ = i == null ? void 0 : i.item) == null ? void 0 : _.borderRadius), m = (b) => {
|
|
1879
|
+
s(b), l.onClick();
|
|
978
1880
|
};
|
|
979
|
-
|
|
1881
|
+
p.addEventListener("click", m), p.addEventListener("touchstart", s), p.addEventListener("touchend", m), p.addEventListener("touchmove", s), p.addEventListener("mousedown", s), p.addEventListener("mouseup", s), e.appendChild(p);
|
|
980
1882
|
});
|
|
981
1883
|
}
|
|
982
1884
|
show() {
|
|
@@ -986,8 +1888,8 @@ class _o extends HTMLElement {
|
|
|
986
1888
|
this.classList.remove("visible");
|
|
987
1889
|
}
|
|
988
1890
|
}
|
|
989
|
-
customElements.get("courier-list-item-menu") || customElements.define("courier-list-item-menu",
|
|
990
|
-
class
|
|
1891
|
+
customElements.get("courier-list-item-menu") || customElements.define("courier-list-item-menu", Lo);
|
|
1892
|
+
class Ao extends HTMLElement {
|
|
991
1893
|
constructor(e) {
|
|
992
1894
|
super();
|
|
993
1895
|
// State
|
|
@@ -1011,13 +1913,13 @@ class xo extends HTMLElement {
|
|
|
1011
1913
|
a(this, "onItemLongPress", null);
|
|
1012
1914
|
a(this, "onItemActionClick", null);
|
|
1013
1915
|
this._theme = e, this._isMobile = "ontouchstart" in window;
|
|
1014
|
-
const
|
|
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
|
|
1916
|
+
const i = this.attachShadow({ mode: "open" }), s = document.createElement("div");
|
|
1917
|
+
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 Lo(this._theme), this._menu.setOptions(this._getMenuOptions()), i.append(this._style, this._unreadIndicator, s, this._timeElement, this._menu);
|
|
1016
1918
|
const o = (n) => {
|
|
1017
1919
|
n.stopPropagation(), n.preventDefault();
|
|
1018
1920
|
};
|
|
1019
1921
|
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
|
|
1922
|
+
this._menu.contains(n.target) || n.composedPath().includes(this._menu) || this._message && this.onItemClick && !(n.target instanceof ne) && !this._isLongPress && this.onItemClick(this._message);
|
|
1021
1923
|
}), this._setupHoverBehavior(), this._setupLongPressBehavior();
|
|
1022
1924
|
}
|
|
1023
1925
|
_setupHoverBehavior() {
|
|
@@ -1030,14 +1932,14 @@ class xo extends HTMLElement {
|
|
|
1030
1932
|
const e = (n = (o = (s = this._theme.inbox) == null ? void 0 : s.list) == null ? void 0 : o.item) == null ? void 0 : n.menu;
|
|
1031
1933
|
if (!(e != null && e.enabled))
|
|
1032
1934
|
return;
|
|
1033
|
-
const
|
|
1935
|
+
const i = e.longPress;
|
|
1034
1936
|
this.addEventListener(
|
|
1035
1937
|
"touchstart",
|
|
1036
1938
|
() => {
|
|
1037
1939
|
this._longPressTimeout = window.setTimeout(() => {
|
|
1038
|
-
this._isLongPress = !0, this._showMenu(), this._message && this.onItemLongPress && (this.onItemLongPress(this._message), navigator.vibrate && navigator.vibrate((
|
|
1940
|
+
this._isLongPress = !0, this._showMenu(), this._message && this.onItemLongPress && (this.onItemLongPress(this._message), navigator.vibrate && navigator.vibrate((i == null ? void 0 : i.vibrationDuration) ?? 50)), setTimeout(() => {
|
|
1039
1941
|
this._hideMenu(), this._isLongPress = !1;
|
|
1040
|
-
}, (
|
|
1942
|
+
}, (i == null ? void 0 : i.displayDuration) ?? 2e3);
|
|
1041
1943
|
}, 650);
|
|
1042
1944
|
},
|
|
1043
1945
|
{ passive: !0 }
|
|
@@ -1050,43 +1952,43 @@ class xo extends HTMLElement {
|
|
|
1050
1952
|
}
|
|
1051
1953
|
// Helpers
|
|
1052
1954
|
_getMenuOptions() {
|
|
1053
|
-
var s, o, n,
|
|
1054
|
-
const e = (
|
|
1055
|
-
let
|
|
1056
|
-
return (d = this._message) != null && d.archived ||
|
|
1057
|
-
id: (
|
|
1955
|
+
var s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E, M;
|
|
1956
|
+
const e = (c = (n = (o = (s = this._theme.inbox) == null ? void 0 : s.list) == null ? void 0 : o.item) == null ? void 0 : n.menu) == null ? void 0 : c.item;
|
|
1957
|
+
let i = [];
|
|
1958
|
+
return (d = this._message) != null && d.archived || i.push({
|
|
1959
|
+
id: (l = this._message) != null && l.read ? "unread" : "read",
|
|
1058
1960
|
icon: {
|
|
1059
|
-
svg: (
|
|
1060
|
-
color: (
|
|
1961
|
+
svg: (p = this._message) != null && p.read ? (m = e == null ? void 0 : e.unread) == null ? void 0 : m.svg : (g = e == null ? void 0 : e.read) == null ? void 0 : g.svg,
|
|
1962
|
+
color: (f = this._message) != null && f.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
1963
|
},
|
|
1062
1964
|
onClick: () => {
|
|
1063
|
-
this._message && (this._message.read ?
|
|
1965
|
+
this._message && (this._message.read ? P.shared.unreadMessage({ message: this._message }) : P.shared.readMessage({ message: this._message }));
|
|
1064
1966
|
}
|
|
1065
|
-
}),
|
|
1066
|
-
id: (
|
|
1967
|
+
}), i.push({
|
|
1968
|
+
id: (C = this._message) != null && C.archived ? "unarchive" : "archive",
|
|
1067
1969
|
icon: {
|
|
1068
1970
|
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: (
|
|
1971
|
+
color: (I = this._message) != null && I.archived ? (E = e == null ? void 0 : e.unarchive) == null ? void 0 : E.color : ((M = e == null ? void 0 : e.archive) == null ? void 0 : M.color) ?? "red"
|
|
1070
1972
|
},
|
|
1071
1973
|
onClick: () => {
|
|
1072
|
-
this._message && (this._message.archived ? alert("unarchive") :
|
|
1974
|
+
this._message && (this._message.archived ? alert("unarchive") : P.shared.archiveMessage({ message: this._message }));
|
|
1073
1975
|
}
|
|
1074
|
-
}),
|
|
1976
|
+
}), i;
|
|
1075
1977
|
}
|
|
1076
1978
|
// Menu visibility helpers
|
|
1077
1979
|
_showMenu() {
|
|
1078
|
-
var
|
|
1079
|
-
const e = (o = (s = (
|
|
1980
|
+
var i, s, o;
|
|
1981
|
+
const e = (o = (s = (i = this._theme.inbox) == null ? void 0 : i.list) == null ? void 0 : s.item) == null ? void 0 : o.menu;
|
|
1080
1982
|
e && e.enabled && (this._menu.setOptions(this._getMenuOptions()), this._menu.style.display = "block", this._menu.show(), this._timeElement.style.opacity = "0");
|
|
1081
1983
|
}
|
|
1082
1984
|
_hideMenu() {
|
|
1083
|
-
var
|
|
1084
|
-
const e = (o = (s = (
|
|
1985
|
+
var i, s, o;
|
|
1986
|
+
const e = (o = (s = (i = this._theme.inbox) == null ? void 0 : i.list) == null ? void 0 : s.item) == null ? void 0 : o.menu;
|
|
1085
1987
|
e && e.enabled && (this._menu.hide(), this._menu.style.display = "none", this._timeElement.style.opacity = "1");
|
|
1086
1988
|
}
|
|
1087
1989
|
_getStyles() {
|
|
1088
|
-
var
|
|
1089
|
-
const e = (s = (
|
|
1990
|
+
var i, s, o, n, c, d, l, p, m, g, f;
|
|
1991
|
+
const e = (s = (i = this._theme.inbox) == null ? void 0 : i.list) == null ? void 0 : s.item;
|
|
1090
1992
|
return `
|
|
1091
1993
|
:host {
|
|
1092
1994
|
display: flex;
|
|
@@ -1172,20 +2074,20 @@ class xo extends HTMLElement {
|
|
|
1172
2074
|
p[part='title'] {
|
|
1173
2075
|
font-family: ${((o = e == null ? void 0 : e.title) == null ? void 0 : o.family) ?? "inherit"};
|
|
1174
2076
|
font-size: ${((n = e == null ? void 0 : e.title) == null ? void 0 : n.size) ?? "14px"};
|
|
1175
|
-
color: ${((
|
|
2077
|
+
color: ${((c = e == null ? void 0 : e.title) == null ? void 0 : c.color) ?? "red"};
|
|
1176
2078
|
margin-bottom: 4px;
|
|
1177
2079
|
}
|
|
1178
2080
|
|
|
1179
2081
|
p[part='subtitle'] {
|
|
1180
2082
|
font-family: ${((d = e == null ? void 0 : e.subtitle) == null ? void 0 : d.family) ?? "inherit"};
|
|
1181
|
-
font-size: ${((
|
|
1182
|
-
color: ${((
|
|
2083
|
+
font-size: ${((l = e == null ? void 0 : e.subtitle) == null ? void 0 : l.size) ?? "14px"};
|
|
2084
|
+
color: ${((p = e == null ? void 0 : e.subtitle) == null ? void 0 : p.color) ?? "red"};
|
|
1183
2085
|
}
|
|
1184
2086
|
|
|
1185
2087
|
p[part='time'] {
|
|
1186
2088
|
font-family: ${((m = e == null ? void 0 : e.time) == null ? void 0 : m.family) ?? "inherit"};
|
|
1187
|
-
font-size: ${((
|
|
1188
|
-
color: ${((
|
|
2089
|
+
font-size: ${((g = e == null ? void 0 : e.time) == null ? void 0 : g.size) ?? "14px"};
|
|
2090
|
+
color: ${((f = e == null ? void 0 : e.time) == null ? void 0 : f.color) ?? "red"};
|
|
1189
2091
|
text-align: right;
|
|
1190
2092
|
white-space: nowrap;
|
|
1191
2093
|
}
|
|
@@ -1216,17 +2118,17 @@ class xo extends HTMLElement {
|
|
|
1216
2118
|
// Lifecycle hooks
|
|
1217
2119
|
connectedCallback() {
|
|
1218
2120
|
var s, o;
|
|
1219
|
-
const e = this.getAttribute("message"),
|
|
1220
|
-
if (
|
|
2121
|
+
const e = this.getAttribute("message"), i = this.getAttribute("feed-type");
|
|
2122
|
+
if (i && (this._feedType = i), e)
|
|
1221
2123
|
try {
|
|
1222
2124
|
this._message = JSON.parse(e), this._updateContent();
|
|
1223
2125
|
} catch (n) {
|
|
1224
|
-
(o = (s =
|
|
2126
|
+
(o = (s = v.shared.client) == null ? void 0 : s.options.logger) == null || o.error("CourierListItem – failed to parse message:", n);
|
|
1225
2127
|
}
|
|
1226
2128
|
}
|
|
1227
2129
|
// Public API
|
|
1228
|
-
setMessage(e,
|
|
1229
|
-
this._message = e, this._feedType =
|
|
2130
|
+
setMessage(e, i) {
|
|
2131
|
+
this._message = e, this._feedType = i, this._updateContent();
|
|
1230
2132
|
}
|
|
1231
2133
|
setOnItemClick(e) {
|
|
1232
2134
|
this.onItemClick = e;
|
|
@@ -1239,49 +2141,49 @@ class xo extends HTMLElement {
|
|
|
1239
2141
|
}
|
|
1240
2142
|
// Content rendering
|
|
1241
2143
|
_updateContent() {
|
|
1242
|
-
var s, o, n,
|
|
2144
|
+
var s, o, n, c, d, l;
|
|
1243
2145
|
if (!this._message) {
|
|
1244
2146
|
this._titleElement.textContent = "", this._subtitleElement.textContent = "";
|
|
1245
2147
|
return;
|
|
1246
2148
|
}
|
|
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 =
|
|
2149
|
+
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 = ln(this._message), this._menu.setOptions(this._getMenuOptions());
|
|
1248
2150
|
const e = ((s = this._message) == null ? void 0 : s.actions) && this._message.actions.length > 0;
|
|
1249
2151
|
this._actionsContainer.style.display = e ? "flex" : "none";
|
|
1250
|
-
const
|
|
1251
|
-
(
|
|
1252
|
-
var
|
|
1253
|
-
const m = new
|
|
1254
|
-
text:
|
|
2152
|
+
const i = (c = (n = (o = this._theme.inbox) == null ? void 0 : o.list) == null ? void 0 : n.item) == null ? void 0 : c.actions;
|
|
2153
|
+
(l = (d = this._message) == null ? void 0 : d.actions) == null || l.forEach((p) => {
|
|
2154
|
+
var g, f, _, b;
|
|
2155
|
+
const m = new Re({
|
|
2156
|
+
text: p.content,
|
|
1255
2157
|
variant: "secondary",
|
|
1256
|
-
backgroundColor:
|
|
1257
|
-
hoverBackgroundColor:
|
|
1258
|
-
activeBackgroundColor:
|
|
1259
|
-
border:
|
|
1260
|
-
borderRadius:
|
|
1261
|
-
shadow:
|
|
1262
|
-
fontFamily: (
|
|
1263
|
-
fontSize: (
|
|
1264
|
-
fontWeight: (_ =
|
|
1265
|
-
textColor: (b =
|
|
2158
|
+
backgroundColor: i == null ? void 0 : i.backgroundColor,
|
|
2159
|
+
hoverBackgroundColor: i == null ? void 0 : i.hoverBackgroundColor,
|
|
2160
|
+
activeBackgroundColor: i == null ? void 0 : i.activeBackgroundColor,
|
|
2161
|
+
border: i == null ? void 0 : i.border,
|
|
2162
|
+
borderRadius: i == null ? void 0 : i.borderRadius,
|
|
2163
|
+
shadow: i == null ? void 0 : i.shadow,
|
|
2164
|
+
fontFamily: (g = i == null ? void 0 : i.font) == null ? void 0 : g.family,
|
|
2165
|
+
fontSize: (f = i == null ? void 0 : i.font) == null ? void 0 : f.size,
|
|
2166
|
+
fontWeight: (_ = i == null ? void 0 : i.font) == null ? void 0 : _.weight,
|
|
2167
|
+
textColor: (b = i == null ? void 0 : i.font) == null ? void 0 : b.color,
|
|
1266
2168
|
onClick: () => {
|
|
1267
|
-
this._message && this.onItemActionClick && this.onItemActionClick(this._message,
|
|
2169
|
+
this._message && this.onItemActionClick && this.onItemActionClick(this._message, p);
|
|
1268
2170
|
}
|
|
1269
2171
|
});
|
|
1270
2172
|
this._actionsContainer.appendChild(m);
|
|
1271
2173
|
});
|
|
1272
2174
|
}
|
|
1273
2175
|
}
|
|
1274
|
-
customElements.get("courier-list-item") || customElements.define("courier-list-item",
|
|
1275
|
-
class
|
|
1276
|
-
constructor(e,
|
|
2176
|
+
customElements.get("courier-list-item") || customElements.define("courier-list-item", Ao);
|
|
2177
|
+
class Po extends HTMLElement {
|
|
2178
|
+
constructor(e, i) {
|
|
1277
2179
|
super();
|
|
1278
2180
|
// Shadow root
|
|
1279
2181
|
a(this, "_shadow");
|
|
1280
2182
|
this._shadow = this.attachShadow({ mode: "open" });
|
|
1281
2183
|
const s = document.createElement("style");
|
|
1282
|
-
s.textContent = this.getStyles(
|
|
1283
|
-
const o = new
|
|
1284
|
-
this._shadow.appendChild(o), this._shadow.appendChild(n), this._shadow.appendChild(
|
|
2184
|
+
s.textContent = this.getStyles(i), this._shadow.appendChild(s);
|
|
2185
|
+
const o = new Le(e, 35), n = new Le(e, 100), c = new Le(e, 82);
|
|
2186
|
+
this._shadow.appendChild(o), this._shadow.appendChild(n), this._shadow.appendChild(c);
|
|
1285
2187
|
}
|
|
1286
2188
|
getStyles(e) {
|
|
1287
2189
|
return `
|
|
@@ -1297,41 +2199,41 @@ class fo extends HTMLElement {
|
|
|
1297
2199
|
`;
|
|
1298
2200
|
}
|
|
1299
2201
|
}
|
|
1300
|
-
customElements.get("courier-inbox-skeleton-list-item") || customElements.define("courier-inbox-skeleton-list-item",
|
|
1301
|
-
class
|
|
1302
|
-
constructor(e,
|
|
2202
|
+
customElements.get("courier-inbox-skeleton-list-item") || customElements.define("courier-inbox-skeleton-list-item", Po);
|
|
2203
|
+
class Le extends HTMLElement {
|
|
2204
|
+
constructor(e, i) {
|
|
1303
2205
|
super();
|
|
1304
2206
|
a(this, "_shadow");
|
|
1305
2207
|
this._shadow = this.attachShadow({ mode: "open" });
|
|
1306
2208
|
const s = document.createElement("style");
|
|
1307
|
-
s.textContent = this.getStyles(e,
|
|
2209
|
+
s.textContent = this.getStyles(e, i), this._shadow.appendChild(s);
|
|
1308
2210
|
const o = document.createElement("div");
|
|
1309
2211
|
o.className = "skeleton-item", this._shadow.appendChild(o);
|
|
1310
2212
|
}
|
|
1311
|
-
getStyles(e,
|
|
1312
|
-
var m,
|
|
1313
|
-
const s = ((
|
|
2213
|
+
getStyles(e, i) {
|
|
2214
|
+
var m, g, f, _, b, C, k, w, S, I, E, M;
|
|
2215
|
+
const s = ((f = (g = (m = e.inbox) == null ? void 0 : m.loading) == null ? void 0 : g.animation) == null ? void 0 : f.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), c = parseInt(o.slice(3, 5), 16), d = parseInt(o.slice(5, 7), 16), l = `rgba(${n}, ${c}, ${d}, 0.8)`, p = `rgba(${n}, ${c}, ${d}, 0.4)`;
|
|
1314
2216
|
return `
|
|
1315
2217
|
:host {
|
|
1316
2218
|
display: flex;
|
|
1317
2219
|
height: 100%;
|
|
1318
|
-
width: ${
|
|
2220
|
+
width: ${i}%;
|
|
1319
2221
|
align-items: flex-start;
|
|
1320
2222
|
justify-content: flex-start;
|
|
1321
2223
|
}
|
|
1322
2224
|
|
|
1323
2225
|
.skeleton-item {
|
|
1324
|
-
height: ${((
|
|
2226
|
+
height: ${((C = (b = (_ = e.inbox) == null ? void 0 : _.loading) == null ? void 0 : b.animation) == null ? void 0 : C.barHeight) ?? "14px"};
|
|
1325
2227
|
width: 100%;
|
|
1326
2228
|
background: linear-gradient(
|
|
1327
2229
|
90deg,
|
|
1328
|
-
${
|
|
1329
|
-
${
|
|
1330
|
-
${
|
|
2230
|
+
${l} 25%,
|
|
2231
|
+
${p} 50%,
|
|
2232
|
+
${l} 75%
|
|
1331
2233
|
);
|
|
1332
2234
|
background-size: 200% 100%;
|
|
1333
2235
|
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: ${((
|
|
2236
|
+
border-radius: ${((M = (E = (I = e.inbox) == null ? void 0 : I.loading) == null ? void 0 : E.animation) == null ? void 0 : M.barBorderRadius) ?? "14px"};
|
|
1335
2237
|
}
|
|
1336
2238
|
|
|
1337
2239
|
@keyframes shimmer {
|
|
@@ -1345,8 +2247,8 @@ class Me extends HTMLElement {
|
|
|
1345
2247
|
`;
|
|
1346
2248
|
}
|
|
1347
2249
|
}
|
|
1348
|
-
customElements.get("courier-skeleton-animated-row") || customElements.define("courier-skeleton-animated-row",
|
|
1349
|
-
class
|
|
2250
|
+
customElements.get("courier-skeleton-animated-row") || customElements.define("courier-skeleton-animated-row", Le);
|
|
2251
|
+
class Ne extends De {
|
|
1350
2252
|
constructor(e) {
|
|
1351
2253
|
super();
|
|
1352
2254
|
a(this, "_theme");
|
|
@@ -1355,16 +2257,16 @@ class Pe extends Le {
|
|
|
1355
2257
|
defaultElement() {
|
|
1356
2258
|
const e = document.createElement("div");
|
|
1357
2259
|
e.className = "list";
|
|
1358
|
-
const
|
|
1359
|
-
|
|
2260
|
+
const i = document.createElement("style");
|
|
2261
|
+
i.textContent = this.getStyles(), e.appendChild(i);
|
|
1360
2262
|
for (let s = 0; s < 3; s++) {
|
|
1361
|
-
const o = new
|
|
2263
|
+
const o = new Po(this._theme, 1 / (s + 1));
|
|
1362
2264
|
e.appendChild(o);
|
|
1363
2265
|
}
|
|
1364
2266
|
return this.shadow.appendChild(e), e;
|
|
1365
2267
|
}
|
|
1366
2268
|
getStyles() {
|
|
1367
|
-
var e,
|
|
2269
|
+
var e, i;
|
|
1368
2270
|
return `
|
|
1369
2271
|
:host {
|
|
1370
2272
|
display: flex;
|
|
@@ -1384,7 +2286,7 @@ class Pe extends Le {
|
|
|
1384
2286
|
}
|
|
1385
2287
|
|
|
1386
2288
|
.list > * {
|
|
1387
|
-
border-bottom: ${((
|
|
2289
|
+
border-bottom: ${((i = (e = this._theme.inbox) == null ? void 0 : e.loading) == null ? void 0 : i.divider) ?? "1px solid red"};
|
|
1388
2290
|
}
|
|
1389
2291
|
|
|
1390
2292
|
.list > *:last-child {
|
|
@@ -1393,8 +2295,8 @@ class Pe extends Le {
|
|
|
1393
2295
|
`;
|
|
1394
2296
|
}
|
|
1395
2297
|
}
|
|
1396
|
-
customElements.get("courier-inbox-skeleton-list") || customElements.define("courier-inbox-skeleton-list",
|
|
1397
|
-
class
|
|
2298
|
+
customElements.get("courier-inbox-skeleton-list") || customElements.define("courier-inbox-skeleton-list", Ne);
|
|
2299
|
+
class Bo extends HTMLElement {
|
|
1398
2300
|
constructor(e) {
|
|
1399
2301
|
super();
|
|
1400
2302
|
// Components
|
|
@@ -1404,12 +2306,12 @@ class Co extends HTMLElement {
|
|
|
1404
2306
|
// Handlers
|
|
1405
2307
|
a(this, "onPaginationTrigger");
|
|
1406
2308
|
this.onPaginationTrigger = e.onPaginationTrigger, this.customItem = e.customItem;
|
|
1407
|
-
const
|
|
1408
|
-
if (s.textContent = this.getStyles(),
|
|
1409
|
-
|
|
2309
|
+
const i = this.attachShadow({ mode: "open" }), s = document.createElement("style");
|
|
2310
|
+
if (s.textContent = this.getStyles(), i.appendChild(s), this.customItem)
|
|
2311
|
+
i.appendChild(this.customItem);
|
|
1410
2312
|
else {
|
|
1411
2313
|
const o = document.createElement("div");
|
|
1412
|
-
o.className = "skeleton-container", this.skeletonLoadingList = new
|
|
2314
|
+
o.className = "skeleton-container", this.skeletonLoadingList = new Ne(e.theme), this.skeletonLoadingList.build(void 0), o.appendChild(this.skeletonLoadingList), i.appendChild(o);
|
|
1413
2315
|
}
|
|
1414
2316
|
this.observer = new IntersectionObserver((o) => {
|
|
1415
2317
|
o.forEach((n) => {
|
|
@@ -1434,8 +2336,8 @@ class Co extends HTMLElement {
|
|
|
1434
2336
|
this.observer.disconnect();
|
|
1435
2337
|
}
|
|
1436
2338
|
}
|
|
1437
|
-
customElements.get("courier-inbox-pagination-list-item") || customElements.define("courier-inbox-pagination-list-item",
|
|
1438
|
-
class
|
|
2339
|
+
customElements.get("courier-inbox-pagination-list-item") || customElements.define("courier-inbox-pagination-list-item", Bo);
|
|
2340
|
+
class Ro extends HTMLElement {
|
|
1439
2341
|
constructor(e) {
|
|
1440
2342
|
super();
|
|
1441
2343
|
// Theme
|
|
@@ -1461,16 +2363,16 @@ class vo extends HTMLElement {
|
|
|
1461
2363
|
this._themeSubscription = e.themeManager.subscribe((o) => {
|
|
1462
2364
|
this.refreshTheme();
|
|
1463
2365
|
}), this._onRefresh = e.onRefresh, this._onPaginationTrigger = e.onPaginationTrigger, this._onMessageClick = e.onMessageClick, this._onMessageActionClick = e.onMessageActionClick, this._onMessageLongPress = e.onMessageLongPress;
|
|
1464
|
-
const
|
|
1465
|
-
s.textContent = this.getStyles(),
|
|
2366
|
+
const i = this.attachShadow({ mode: "open" }), s = document.createElement("style");
|
|
2367
|
+
s.textContent = this.getStyles(), i.appendChild(s);
|
|
1466
2368
|
}
|
|
1467
2369
|
// Getters
|
|
1468
2370
|
get messages() {
|
|
1469
2371
|
return this._messages;
|
|
1470
2372
|
}
|
|
1471
2373
|
getStyles() {
|
|
1472
|
-
var
|
|
1473
|
-
const e = (
|
|
2374
|
+
var i;
|
|
2375
|
+
const e = (i = this._themeSubscription.manager.getTheme().inbox) == null ? void 0 : i.list;
|
|
1474
2376
|
return `
|
|
1475
2377
|
:host {
|
|
1476
2378
|
flex: 1;
|
|
@@ -1487,8 +2389,8 @@ class vo extends HTMLElement {
|
|
|
1487
2389
|
`;
|
|
1488
2390
|
}
|
|
1489
2391
|
reset() {
|
|
1490
|
-
var
|
|
1491
|
-
for (; (
|
|
2392
|
+
var i, s;
|
|
2393
|
+
for (; (i = this.shadowRoot) != null && i.firstChild; )
|
|
1492
2394
|
this.shadowRoot.removeChild(this.shadowRoot.firstChild);
|
|
1493
2395
|
const e = document.createElement("style");
|
|
1494
2396
|
e.textContent = this.getStyles(), (s = this.shadowRoot) == null || s.appendChild(e);
|
|
@@ -1499,14 +2401,14 @@ class vo extends HTMLElement {
|
|
|
1499
2401
|
addPage(e) {
|
|
1500
2402
|
this._messages = [...this._messages, ...e.messages], this._canPaginate = !!e.canPaginate, this._error = null, this._isLoading = !1, this.render();
|
|
1501
2403
|
}
|
|
1502
|
-
addMessage(e,
|
|
1503
|
-
this._messages.splice(
|
|
2404
|
+
addMessage(e, i = 0) {
|
|
2405
|
+
this._messages.splice(i, 0, e), this.render();
|
|
1504
2406
|
}
|
|
1505
2407
|
removeMessage(e = 0) {
|
|
1506
2408
|
this._messages.splice(e, 1), this.render();
|
|
1507
2409
|
}
|
|
1508
|
-
updateMessage(e,
|
|
1509
|
-
this._messages[
|
|
2410
|
+
updateMessage(e, i = 0) {
|
|
2411
|
+
this._messages[i] = e, this.render();
|
|
1510
2412
|
}
|
|
1511
2413
|
setFeedType(e) {
|
|
1512
2414
|
this._feedType = e, this._error = null, this._isLoading = !0, this.render();
|
|
@@ -1527,93 +2429,93 @@ class vo extends HTMLElement {
|
|
|
1527
2429
|
this._onRefresh();
|
|
1528
2430
|
}
|
|
1529
2431
|
render() {
|
|
1530
|
-
var s, o, n,
|
|
2432
|
+
var s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E, M, L, R, D, y, A, F, H, O, z, U, N, q, V, j, X, Q, Y, ee, G, ae, he, ce, le, de, ue, pe, ge, me, be, _e, fe, xe, ve, Ce, ye, ke, we, Se, Ie;
|
|
1531
2433
|
this.reset();
|
|
1532
2434
|
const e = this._themeSubscription.manager.getTheme();
|
|
1533
2435
|
if (this._error) {
|
|
1534
|
-
const
|
|
2436
|
+
const u = (s = e.inbox) == null ? void 0 : s.error, B = new Be({
|
|
1535
2437
|
title: {
|
|
1536
|
-
text: ((o =
|
|
1537
|
-
textColor: (
|
|
1538
|
-
fontFamily: (
|
|
1539
|
-
fontSize: (m = (
|
|
1540
|
-
fontWeight: (
|
|
2438
|
+
text: ((o = u == null ? void 0 : u.title) == null ? void 0 : o.text) ?? this._error.message,
|
|
2439
|
+
textColor: (c = (n = u == null ? void 0 : u.title) == null ? void 0 : n.font) == null ? void 0 : c.color,
|
|
2440
|
+
fontFamily: (l = (d = u == null ? void 0 : u.title) == null ? void 0 : d.font) == null ? void 0 : l.family,
|
|
2441
|
+
fontSize: (m = (p = u == null ? void 0 : u.title) == null ? void 0 : p.font) == null ? void 0 : m.size,
|
|
2442
|
+
fontWeight: (f = (g = u == null ? void 0 : u.title) == null ? void 0 : g.font) == null ? void 0 : f.weight
|
|
1541
2443
|
},
|
|
1542
2444
|
button: {
|
|
1543
|
-
text: (_ =
|
|
1544
|
-
backgroundColor: (b =
|
|
1545
|
-
hoverBackgroundColor: (
|
|
1546
|
-
activeBackgroundColor: (k =
|
|
1547
|
-
textColor: (S = (w =
|
|
1548
|
-
fontFamily: (E = (
|
|
1549
|
-
fontSize: (
|
|
1550
|
-
fontWeight: (
|
|
1551
|
-
shadow: (y =
|
|
1552
|
-
border: (
|
|
1553
|
-
borderRadius: (F =
|
|
2445
|
+
text: (_ = u == null ? void 0 : u.button) == null ? void 0 : _.text,
|
|
2446
|
+
backgroundColor: (b = u == null ? void 0 : u.button) == null ? void 0 : b.backgroundColor,
|
|
2447
|
+
hoverBackgroundColor: (C = u == null ? void 0 : u.button) == null ? void 0 : C.hoverBackgroundColor,
|
|
2448
|
+
activeBackgroundColor: (k = u == null ? void 0 : u.button) == null ? void 0 : k.activeBackgroundColor,
|
|
2449
|
+
textColor: (S = (w = u == null ? void 0 : u.button) == null ? void 0 : w.font) == null ? void 0 : S.color,
|
|
2450
|
+
fontFamily: (E = (I = u == null ? void 0 : u.button) == null ? void 0 : I.font) == null ? void 0 : E.family,
|
|
2451
|
+
fontSize: (L = (M = u == null ? void 0 : u.button) == null ? void 0 : M.font) == null ? void 0 : L.size,
|
|
2452
|
+
fontWeight: (D = (R = u == null ? void 0 : u.button) == null ? void 0 : R.font) == null ? void 0 : D.weight,
|
|
2453
|
+
shadow: (y = u == null ? void 0 : u.button) == null ? void 0 : y.shadow,
|
|
2454
|
+
border: (A = u == null ? void 0 : u.button) == null ? void 0 : A.border,
|
|
2455
|
+
borderRadius: (F = u == null ? void 0 : u.button) == null ? void 0 : F.borderRadius
|
|
1554
2456
|
}
|
|
1555
2457
|
});
|
|
1556
|
-
|
|
2458
|
+
B.build((H = this._errorStateFactory) == null ? void 0 : H.call(this, { feedType: this._feedType, error: this._error })), B.setButtonClickCallback(() => this.handleRetry()), (O = this.shadowRoot) == null || O.appendChild(B);
|
|
1557
2459
|
return;
|
|
1558
2460
|
}
|
|
1559
2461
|
if (this._isLoading) {
|
|
1560
|
-
const
|
|
1561
|
-
|
|
2462
|
+
const u = new Ne(e);
|
|
2463
|
+
u.build((z = this._loadingStateFactory) == null ? void 0 : z.call(this, { feedType: this._feedType })), (U = this.shadowRoot) == null || U.appendChild(u);
|
|
1562
2464
|
return;
|
|
1563
2465
|
}
|
|
1564
2466
|
if (this._messages.length === 0) {
|
|
1565
|
-
const
|
|
2467
|
+
const u = (N = e.inbox) == null ? void 0 : N.empty, B = new Be({
|
|
1566
2468
|
title: {
|
|
1567
|
-
text: ((
|
|
1568
|
-
textColor: (
|
|
1569
|
-
fontFamily: (
|
|
1570
|
-
fontSize: (
|
|
1571
|
-
fontWeight: (
|
|
2469
|
+
text: ((q = u == null ? void 0 : u.title) == null ? void 0 : q.text) ?? `No ${this._feedType} messages yet`,
|
|
2470
|
+
textColor: (j = (V = u == null ? void 0 : u.title) == null ? void 0 : V.font) == null ? void 0 : j.color,
|
|
2471
|
+
fontFamily: (Q = (X = u == null ? void 0 : u.title) == null ? void 0 : X.font) == null ? void 0 : Q.family,
|
|
2472
|
+
fontSize: (ee = (Y = u == null ? void 0 : u.title) == null ? void 0 : Y.font) == null ? void 0 : ee.size,
|
|
2473
|
+
fontWeight: (ae = (G = u == null ? void 0 : u.title) == null ? void 0 : G.font) == null ? void 0 : ae.weight
|
|
1572
2474
|
},
|
|
1573
2475
|
button: {
|
|
1574
|
-
text: (
|
|
1575
|
-
backgroundColor: (
|
|
1576
|
-
hoverBackgroundColor: (
|
|
1577
|
-
activeBackgroundColor: (
|
|
1578
|
-
textColor: (
|
|
1579
|
-
fontFamily: (
|
|
1580
|
-
fontSize: (
|
|
1581
|
-
fontWeight: (
|
|
1582
|
-
shadow: (
|
|
1583
|
-
border: (
|
|
1584
|
-
borderRadius: (
|
|
2476
|
+
text: (he = u == null ? void 0 : u.button) == null ? void 0 : he.text,
|
|
2477
|
+
backgroundColor: (ce = u == null ? void 0 : u.button) == null ? void 0 : ce.backgroundColor,
|
|
2478
|
+
hoverBackgroundColor: (le = u == null ? void 0 : u.button) == null ? void 0 : le.hoverBackgroundColor,
|
|
2479
|
+
activeBackgroundColor: (de = u == null ? void 0 : u.button) == null ? void 0 : de.activeBackgroundColor,
|
|
2480
|
+
textColor: (pe = (ue = u == null ? void 0 : u.button) == null ? void 0 : ue.font) == null ? void 0 : pe.color,
|
|
2481
|
+
fontFamily: (me = (ge = u == null ? void 0 : u.button) == null ? void 0 : ge.font) == null ? void 0 : me.family,
|
|
2482
|
+
fontSize: (_e = (be = u == null ? void 0 : u.button) == null ? void 0 : be.font) == null ? void 0 : _e.size,
|
|
2483
|
+
fontWeight: (xe = (fe = u == null ? void 0 : u.button) == null ? void 0 : fe.font) == null ? void 0 : xe.weight,
|
|
2484
|
+
shadow: (ve = u == null ? void 0 : u.button) == null ? void 0 : ve.shadow,
|
|
2485
|
+
border: (Ce = u == null ? void 0 : u.button) == null ? void 0 : Ce.border,
|
|
2486
|
+
borderRadius: (ye = u == null ? void 0 : u.button) == null ? void 0 : ye.borderRadius
|
|
1585
2487
|
}
|
|
1586
2488
|
});
|
|
1587
|
-
|
|
2489
|
+
B.build((ke = this._emptyStateFactory) == null ? void 0 : ke.call(this, { feedType: this._feedType })), B.setButtonClickCallback(() => this.handleRefresh()), (we = this.shadowRoot) == null || we.appendChild(B);
|
|
1588
2490
|
return;
|
|
1589
2491
|
}
|
|
1590
|
-
const
|
|
1591
|
-
if ((
|
|
2492
|
+
const i = document.createElement("ul");
|
|
2493
|
+
if ((Se = this.shadowRoot) == null || Se.appendChild(i), this._messages.forEach((u, B) => {
|
|
1592
2494
|
if (this._listItemFactory) {
|
|
1593
|
-
|
|
2495
|
+
i.appendChild(this._listItemFactory({ message: u, index: B }));
|
|
1594
2496
|
return;
|
|
1595
2497
|
}
|
|
1596
|
-
const
|
|
1597
|
-
|
|
1598
|
-
var
|
|
1599
|
-
return (
|
|
1600
|
-
}),
|
|
1601
|
-
var
|
|
1602
|
-
return (
|
|
1603
|
-
}),
|
|
1604
|
-
var
|
|
1605
|
-
return (
|
|
1606
|
-
}),
|
|
2498
|
+
const te = new Ao(e);
|
|
2499
|
+
te.setMessage(u, this._feedType), te.setOnItemClick((ie) => {
|
|
2500
|
+
var J;
|
|
2501
|
+
return (J = this._onMessageClick) == null ? void 0 : J.call(this, ie, B);
|
|
2502
|
+
}), te.setOnItemActionClick((ie, J) => {
|
|
2503
|
+
var Ee;
|
|
2504
|
+
return (Ee = this._onMessageActionClick) == null ? void 0 : Ee.call(this, ie, J, B);
|
|
2505
|
+
}), te.setOnItemLongPress((ie) => {
|
|
2506
|
+
var J;
|
|
2507
|
+
return (J = this._onMessageLongPress) == null ? void 0 : J.call(this, ie, B);
|
|
2508
|
+
}), i.appendChild(te);
|
|
1607
2509
|
}), this._canPaginate) {
|
|
1608
|
-
const
|
|
2510
|
+
const u = new Bo({
|
|
1609
2511
|
theme: e,
|
|
1610
|
-
customItem: (
|
|
2512
|
+
customItem: (Ie = this._paginationItemFactory) == null ? void 0 : Ie.call(this, { feedType: this._feedType }),
|
|
1611
2513
|
onPaginationTrigger: () => {
|
|
1612
|
-
var
|
|
1613
|
-
return (
|
|
2514
|
+
var B;
|
|
2515
|
+
return (B = this._onPaginationTrigger) == null ? void 0 : B.call(this, this._feedType);
|
|
1614
2516
|
}
|
|
1615
2517
|
});
|
|
1616
|
-
|
|
2518
|
+
i.appendChild(u);
|
|
1617
2519
|
}
|
|
1618
2520
|
}
|
|
1619
2521
|
// Factories
|
|
@@ -1640,8 +2542,8 @@ class vo extends HTMLElement {
|
|
|
1640
2542
|
this._themeSubscription.unsubscribe();
|
|
1641
2543
|
}
|
|
1642
2544
|
}
|
|
1643
|
-
customElements.get("courier-inbox-list") || customElements.define("courier-inbox-list",
|
|
1644
|
-
class
|
|
2545
|
+
customElements.get("courier-inbox-list") || customElements.define("courier-inbox-list", Ro);
|
|
2546
|
+
class Do extends HTMLElement {
|
|
1645
2547
|
constructor(e) {
|
|
1646
2548
|
super();
|
|
1647
2549
|
// State
|
|
@@ -1656,13 +2558,13 @@ class yo extends HTMLElement {
|
|
|
1656
2558
|
// Theme
|
|
1657
2559
|
a(this, "_themeManager");
|
|
1658
2560
|
this._option = e.option, this._isSelected = e.isSelected, this._themeManager = e.themeManager;
|
|
1659
|
-
const
|
|
1660
|
-
this._style = document.createElement("style"), this._content = document.createElement("div"), this._content.className = "menu-item", this._itemIcon = new
|
|
2561
|
+
const i = this.attachShadow({ mode: "open" });
|
|
2562
|
+
this._style = document.createElement("style"), this._content = document.createElement("div"), this._content.className = "menu-item", this._itemIcon = new ne(this._option.icon.svg ?? x.inbox), this._itemIcon.setAttribute("size", "16"), this._title = document.createElement("p"), this._title.textContent = this._option.text;
|
|
1661
2563
|
const s = document.createElement("div");
|
|
1662
|
-
s.className = "spacer", this._selectionIcon = new
|
|
2564
|
+
s.className = "spacer", this._selectionIcon = new ne(x.check), this._content.appendChild(this._itemIcon), this._content.appendChild(this._title), this._content.appendChild(s), e.selectable && this._content.appendChild(this._selectionIcon), i.appendChild(this._style), i.appendChild(this._content), this._selectionIcon.style.display = this._isSelected ? "block" : "none", this.refreshTheme();
|
|
1663
2565
|
}
|
|
1664
2566
|
getStyles() {
|
|
1665
|
-
var
|
|
2567
|
+
var i, s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E, M, L, R, D, y, A, F, H, O, z, U, N, q, V, j;
|
|
1666
2568
|
const e = this._themeManager.getTheme();
|
|
1667
2569
|
return `
|
|
1668
2570
|
:host {
|
|
@@ -1673,11 +2575,11 @@ class yo extends HTMLElement {
|
|
|
1673
2575
|
}
|
|
1674
2576
|
|
|
1675
2577
|
:host(:hover) {
|
|
1676
|
-
background-color: ${((
|
|
2578
|
+
background-color: ${((c = (n = (o = (s = (i = e.inbox) == null ? void 0 : i.header) == null ? void 0 : s.menus) == null ? void 0 : o.popup) == null ? void 0 : n.list) == null ? void 0 : c.hoverBackgroundColor) ?? "red"};
|
|
1677
2579
|
}
|
|
1678
2580
|
|
|
1679
2581
|
:host(:active) {
|
|
1680
|
-
background-color: ${((
|
|
2582
|
+
background-color: ${((g = (m = (p = (l = (d = e.inbox) == null ? void 0 : d.header) == null ? void 0 : l.menus) == null ? void 0 : p.popup) == null ? void 0 : m.list) == null ? void 0 : g.activeBackgroundColor) ?? "red"};
|
|
1681
2583
|
}
|
|
1682
2584
|
|
|
1683
2585
|
.menu-item {
|
|
@@ -1693,10 +2595,10 @@ class yo extends HTMLElement {
|
|
|
1693
2595
|
|
|
1694
2596
|
p {
|
|
1695
2597
|
margin: 0;
|
|
1696
|
-
font-family: ${((w = (k = (
|
|
1697
|
-
font-weight: ${((
|
|
1698
|
-
font-size: ${((
|
|
1699
|
-
color: ${((
|
|
2598
|
+
font-family: ${((w = (k = (C = (b = (_ = (f = e.inbox) == null ? void 0 : f.header) == null ? void 0 : _.menus) == null ? void 0 : b.popup) == null ? void 0 : C.list) == null ? void 0 : k.font) == null ? void 0 : w.family) ?? "inherit"};
|
|
2599
|
+
font-weight: ${((R = (L = (M = (E = (I = (S = e.inbox) == null ? void 0 : S.header) == null ? void 0 : I.menus) == null ? void 0 : E.popup) == null ? void 0 : M.list) == null ? void 0 : L.font) == null ? void 0 : R.weight) ?? "inherit"};
|
|
2600
|
+
font-size: ${((O = (H = (F = (A = (y = (D = e.inbox) == null ? void 0 : D.header) == null ? void 0 : y.menus) == null ? void 0 : A.popup) == null ? void 0 : F.list) == null ? void 0 : H.font) == null ? void 0 : O.size) ?? "14px"};
|
|
2601
|
+
color: ${((j = (V = (q = (N = (U = (z = e.inbox) == null ? void 0 : z.header) == null ? void 0 : U.menus) == null ? void 0 : N.popup) == null ? void 0 : q.list) == null ? void 0 : V.font) == null ? void 0 : j.color) ?? "red"};
|
|
1700
2602
|
white-space: nowrap;
|
|
1701
2603
|
}
|
|
1702
2604
|
|
|
@@ -1706,13 +2608,13 @@ class yo extends HTMLElement {
|
|
|
1706
2608
|
`;
|
|
1707
2609
|
}
|
|
1708
2610
|
refreshTheme() {
|
|
1709
|
-
var e,
|
|
1710
|
-
this._style.textContent = this.getStyles(), this._selectionIcon.updateColor(((e = this._option.selectionIcon) == null ? void 0 : e.color) ?? "red"), this._selectionIcon.updateSVG(((
|
|
2611
|
+
var e, i, s, o;
|
|
2612
|
+
this._style.textContent = this.getStyles(), this._selectionIcon.updateColor(((e = this._option.selectionIcon) == null ? void 0 : e.color) ?? "red"), this._selectionIcon.updateSVG(((i = this._option.selectionIcon) == null ? void 0 : i.svg) ?? x.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) ?? x.inbox);
|
|
1711
2613
|
}
|
|
1712
2614
|
}
|
|
1713
|
-
customElements.get("courier-inbox-filter-menu-item") || customElements.define("courier-inbox-filter-menu-item",
|
|
1714
|
-
class
|
|
1715
|
-
constructor(e,
|
|
2615
|
+
customElements.get("courier-inbox-filter-menu-item") || customElements.define("courier-inbox-filter-menu-item", Do);
|
|
2616
|
+
class He extends HTMLElement {
|
|
2617
|
+
constructor(e, i, s, o, n) {
|
|
1716
2618
|
super();
|
|
1717
2619
|
// Theme
|
|
1718
2620
|
a(this, "_themeSubscription");
|
|
@@ -1726,14 +2628,14 @@ class Be extends HTMLElement {
|
|
|
1726
2628
|
a(this, "_menuButton");
|
|
1727
2629
|
a(this, "_menu");
|
|
1728
2630
|
a(this, "_style");
|
|
1729
|
-
this._type =
|
|
1730
|
-
const
|
|
1731
|
-
this._menuButton = new
|
|
2631
|
+
this._type = i, this._selectable = s, this._options = o, this._selectedIndex = 0, this._onMenuOpen = n;
|
|
2632
|
+
const c = this.attachShadow({ mode: "open" });
|
|
2633
|
+
this._menuButton = new $e(i === "filters" ? x.filter : x.overflow), this._menu = document.createElement("div"), this._menu.className = `menu ${i}`, this._style = document.createElement("style"), c.appendChild(this._style), c.appendChild(this._menuButton), c.appendChild(this._menu), this._menuButton.addEventListener("click", this.toggleMenu.bind(this)), document.addEventListener("click", this.handleOutsideClick.bind(this)), this._themeSubscription = e.subscribe((d) => {
|
|
1732
2634
|
this.refreshTheme();
|
|
1733
2635
|
}), this.refreshTheme();
|
|
1734
2636
|
}
|
|
1735
2637
|
getStyles() {
|
|
1736
|
-
var
|
|
2638
|
+
var i, s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E, M, L;
|
|
1737
2639
|
const e = this._themeSubscription.manager.getTheme();
|
|
1738
2640
|
return `
|
|
1739
2641
|
:host {
|
|
@@ -1746,10 +2648,10 @@ class Be extends HTMLElement {
|
|
|
1746
2648
|
position: absolute;
|
|
1747
2649
|
top: 42px;
|
|
1748
2650
|
right: -6px;
|
|
1749
|
-
border-radius: ${((n = (o = (s = (
|
|
1750
|
-
border: ${((
|
|
1751
|
-
background: ${((_ = (
|
|
1752
|
-
box-shadow: ${((w = (k = (
|
|
2651
|
+
border-radius: ${((n = (o = (s = (i = e.inbox) == null ? void 0 : i.header) == null ? void 0 : s.menus) == null ? void 0 : o.popup) == null ? void 0 : n.borderRadius) ?? "6px"};
|
|
2652
|
+
border: ${((p = (l = (d = (c = e.inbox) == null ? void 0 : c.header) == null ? void 0 : d.menus) == null ? void 0 : l.popup) == null ? void 0 : p.border) ?? "1px solid red"};
|
|
2653
|
+
background: ${((_ = (f = (g = (m = e.inbox) == null ? void 0 : m.header) == null ? void 0 : g.menus) == null ? void 0 : f.popup) == null ? void 0 : _.backgroundColor) ?? "red"};
|
|
2654
|
+
box-shadow: ${((w = (k = (C = (b = e.inbox) == null ? void 0 : b.header) == null ? void 0 : C.menus) == null ? void 0 : k.popup) == null ? void 0 : w.shadow) ?? "0 4px 12px 0 red"};
|
|
1753
2655
|
z-index: 1000;
|
|
1754
2656
|
min-width: 200px;
|
|
1755
2657
|
overflow: hidden;
|
|
@@ -1757,7 +2659,7 @@ class Be extends HTMLElement {
|
|
|
1757
2659
|
}
|
|
1758
2660
|
|
|
1759
2661
|
courier-inbox-filter-menu-item {
|
|
1760
|
-
border-bottom: ${((
|
|
2662
|
+
border-bottom: ${((L = (M = (E = (I = (S = e.inbox) == null ? void 0 : S.header) == null ? void 0 : I.menus) == null ? void 0 : E.popup) == null ? void 0 : M.list) == null ? void 0 : L.divider) ?? "none"};
|
|
1761
2663
|
}
|
|
1762
2664
|
|
|
1763
2665
|
courier-inbox-filter-menu-item:last-child {
|
|
@@ -1766,31 +2668,31 @@ class Be extends HTMLElement {
|
|
|
1766
2668
|
`;
|
|
1767
2669
|
}
|
|
1768
2670
|
refreshTheme() {
|
|
1769
|
-
var
|
|
2671
|
+
var c, d, l, p, m, g;
|
|
1770
2672
|
this._style.textContent = this.getStyles();
|
|
1771
|
-
const
|
|
1772
|
-
this._menuButton.updateIconSVG(((m = o == null ? void 0 : o.icon) == null ? void 0 : m.svg) ?? n), this._menuButton.updateIconColor(((
|
|
2673
|
+
const i = (d = (c = this._themeSubscription.manager.getTheme().inbox) == null ? void 0 : c.header) == null ? void 0 : d.menus, s = this._type === "filters", o = s ? (l = i == null ? void 0 : i.filters) == null ? void 0 : l.button : (p = i == null ? void 0 : i.actions) == null ? void 0 : p.button, n = s ? x.filter : x.overflow;
|
|
2674
|
+
this._menuButton.updateIconSVG(((m = o == null ? void 0 : o.icon) == null ? void 0 : m.svg) ?? n), this._menuButton.updateIconColor(((g = o == null ? void 0 : o.icon) == null ? void 0 : g.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
2675
|
}
|
|
1774
2676
|
setOptions(e) {
|
|
1775
2677
|
this._options = e, this.refreshMenuItems();
|
|
1776
2678
|
}
|
|
1777
2679
|
refreshMenuItems() {
|
|
1778
|
-
this._menu.innerHTML = "", this._options.forEach((e,
|
|
1779
|
-
const s = new
|
|
2680
|
+
this._menu.innerHTML = "", this._options.forEach((e, i) => {
|
|
2681
|
+
const s = new Do({
|
|
1780
2682
|
option: e,
|
|
1781
2683
|
selectable: this._selectable,
|
|
1782
|
-
isSelected: this._selectedIndex ===
|
|
2684
|
+
isSelected: this._selectedIndex === i,
|
|
1783
2685
|
themeManager: this._themeSubscription.manager
|
|
1784
2686
|
});
|
|
1785
2687
|
s.addEventListener("click", () => {
|
|
1786
|
-
this._selectedIndex =
|
|
2688
|
+
this._selectedIndex = i, e.onClick(e), this.refreshMenuItems(), this.closeMenu();
|
|
1787
2689
|
}), this._menu.appendChild(s);
|
|
1788
2690
|
});
|
|
1789
2691
|
}
|
|
1790
2692
|
toggleMenu(e) {
|
|
1791
2693
|
e.stopPropagation();
|
|
1792
|
-
const
|
|
1793
|
-
this._menu.style.display =
|
|
2694
|
+
const i = this._menu.style.display !== "block";
|
|
2695
|
+
this._menu.style.display = i ? "block" : "none", i && this._onMenuOpen();
|
|
1794
2696
|
}
|
|
1795
2697
|
handleOutsideClick(e) {
|
|
1796
2698
|
this.contains(e.target) || this.closeMenu();
|
|
@@ -1799,14 +2701,14 @@ class Be extends HTMLElement {
|
|
|
1799
2701
|
this._menu.style.display = "none";
|
|
1800
2702
|
}
|
|
1801
2703
|
selectOption(e) {
|
|
1802
|
-
this._selectedIndex = this._options.findIndex((
|
|
2704
|
+
this._selectedIndex = this._options.findIndex((i) => i.id === e.id), this.refreshMenuItems();
|
|
1803
2705
|
}
|
|
1804
2706
|
disconnectedCallback() {
|
|
1805
2707
|
this._themeSubscription.unsubscribe();
|
|
1806
2708
|
}
|
|
1807
2709
|
}
|
|
1808
|
-
customElements.get("courier-inbox-option-menu") || customElements.define("courier-inbox-option-menu",
|
|
1809
|
-
class
|
|
2710
|
+
customElements.get("courier-inbox-option-menu") || customElements.define("courier-inbox-option-menu", He);
|
|
2711
|
+
class qe extends HTMLElement {
|
|
1810
2712
|
constructor(e) {
|
|
1811
2713
|
super();
|
|
1812
2714
|
// Theme
|
|
@@ -1820,12 +2722,12 @@ class $e extends HTMLElement {
|
|
|
1820
2722
|
this._location = e.location, this._themeSubscription = e.themeBus.subscribe((s) => {
|
|
1821
2723
|
this.refreshTheme(this._location);
|
|
1822
2724
|
});
|
|
1823
|
-
const
|
|
1824
|
-
this._badge = document.createElement("span"), this._badge.className = "unread-badge", this._style = document.createElement("style"), this._style.textContent = this.getStyles(this._location),
|
|
2725
|
+
const i = this.attachShadow({ mode: "open" });
|
|
2726
|
+
this._badge = document.createElement("span"), this._badge.className = "unread-badge", this._style = document.createElement("style"), this._style.textContent = this.getStyles(this._location), i.appendChild(this._style), i.appendChild(this._badge);
|
|
1825
2727
|
}
|
|
1826
2728
|
getStyles(e) {
|
|
1827
|
-
var
|
|
1828
|
-
const
|
|
2729
|
+
var l, p, m, g, f, _, b;
|
|
2730
|
+
const i = this._themeSubscription.manager.getTheme(), s = e === "button" ? (p = (l = i.popup) == null ? void 0 : l.button) == null ? void 0 : p.unreadIndicator : (f = (g = (m = i.inbox) == null ? void 0 : m.header) == null ? void 0 : g.filters) == null ? void 0 : f.unreadIndicator, o = s == null ? void 0 : s.backgroundColor, n = s == null ? void 0 : s.borderRadius, c = (_ = s == null ? void 0 : s.font) == null ? void 0 : _.color, d = (b = s == null ? void 0 : s.font) == null ? void 0 : b.size;
|
|
1829
2731
|
return `
|
|
1830
2732
|
:host {
|
|
1831
2733
|
display: inline-block;
|
|
@@ -1833,7 +2735,7 @@ class $e extends HTMLElement {
|
|
|
1833
2735
|
|
|
1834
2736
|
.unread-badge {
|
|
1835
2737
|
background-color: ${o};
|
|
1836
|
-
color: ${
|
|
2738
|
+
color: ${c};
|
|
1837
2739
|
border-radius: ${n};
|
|
1838
2740
|
padding: 4px 8px;
|
|
1839
2741
|
font-size: ${d};
|
|
@@ -1856,9 +2758,9 @@ class $e extends HTMLElement {
|
|
|
1856
2758
|
this._themeSubscription.unsubscribe();
|
|
1857
2759
|
}
|
|
1858
2760
|
}
|
|
1859
|
-
customElements.get("courier-unread-count-badge") || customElements.define("courier-unread-count-badge",
|
|
1860
|
-
class
|
|
1861
|
-
constructor(e,
|
|
2761
|
+
customElements.get("courier-unread-count-badge") || customElements.define("courier-unread-count-badge", qe);
|
|
2762
|
+
class Fo extends HTMLElement {
|
|
2763
|
+
constructor(e, i) {
|
|
1862
2764
|
super();
|
|
1863
2765
|
// Theme
|
|
1864
2766
|
a(this, "_themeSubscription");
|
|
@@ -1871,9 +2773,9 @@ class ko extends HTMLElement {
|
|
|
1871
2773
|
a(this, "_unreadBadge");
|
|
1872
2774
|
a(this, "_container");
|
|
1873
2775
|
a(this, "_style");
|
|
1874
|
-
this._option =
|
|
2776
|
+
this._option = i;
|
|
1875
2777
|
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
|
|
2778
|
+
this._style = document.createElement("style"), this._container = document.createElement("div"), this._container.className = "title-section", this._iconElement = new ne(void 0, this._option.icon.svg), this._titleElement = document.createElement("h2"), this._unreadBadge = new qe({
|
|
1877
2779
|
themeBus: e,
|
|
1878
2780
|
location: "header"
|
|
1879
2781
|
}), 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) => {
|
|
@@ -1881,7 +2783,7 @@ class ko extends HTMLElement {
|
|
|
1881
2783
|
}), this.refreshTheme(this._feedType ?? "inbox");
|
|
1882
2784
|
}
|
|
1883
2785
|
getStyles() {
|
|
1884
|
-
var
|
|
2786
|
+
var i, s, o, n, c, d, l, p, m, g, f, _, b, C, k, w;
|
|
1885
2787
|
const e = this._themeSubscription.manager.getTheme();
|
|
1886
2788
|
return `
|
|
1887
2789
|
.title-section {
|
|
@@ -1898,10 +2800,10 @@ class ko extends HTMLElement {
|
|
|
1898
2800
|
|
|
1899
2801
|
h2 {
|
|
1900
2802
|
margin: 0;
|
|
1901
|
-
font-family: ${((n = (o = (s = (
|
|
1902
|
-
font-size: ${((
|
|
1903
|
-
font-weight: ${((_ = (
|
|
1904
|
-
color: ${((w = (k = (
|
|
2803
|
+
font-family: ${((n = (o = (s = (i = e.inbox) == null ? void 0 : i.header) == null ? void 0 : s.filters) == null ? void 0 : o.font) == null ? void 0 : n.family) ?? "inherit"};
|
|
2804
|
+
font-size: ${((p = (l = (d = (c = e.inbox) == null ? void 0 : c.header) == null ? void 0 : d.filters) == null ? void 0 : l.font) == null ? void 0 : p.size) ?? "18px"};
|
|
2805
|
+
font-weight: ${((_ = (f = (g = (m = e.inbox) == null ? void 0 : m.header) == null ? void 0 : g.filters) == null ? void 0 : f.font) == null ? void 0 : _.weight) ?? "500"};
|
|
2806
|
+
color: ${((w = (k = (C = (b = e.inbox) == null ? void 0 : b.header) == null ? void 0 : C.filters) == null ? void 0 : k.font) == null ? void 0 : w.color) ?? "red"};
|
|
1905
2807
|
}
|
|
1906
2808
|
|
|
1907
2809
|
courier-unread-count-badge {
|
|
@@ -1912,18 +2814,18 @@ class ko extends HTMLElement {
|
|
|
1912
2814
|
refreshTheme(e) {
|
|
1913
2815
|
this._feedType = e, this._style.textContent = this.getStyles(), this._unreadBadge.refreshTheme("header"), this.updateFilter();
|
|
1914
2816
|
}
|
|
1915
|
-
updateSelectedOption(e,
|
|
1916
|
-
this._option = e, this._feedType =
|
|
2817
|
+
updateSelectedOption(e, i, s) {
|
|
2818
|
+
this._option = e, this._feedType = i, this._unreadBadge.setCount(s), this.updateFilter();
|
|
1917
2819
|
}
|
|
1918
2820
|
updateFilter() {
|
|
1919
|
-
var
|
|
2821
|
+
var i, s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E, M, L, R, D, y, A, F, H, O;
|
|
1920
2822
|
const e = this._themeSubscription.manager.getTheme();
|
|
1921
2823
|
switch (this._feedType) {
|
|
1922
2824
|
case "inbox":
|
|
1923
|
-
this._titleElement.textContent = ((n = (o = (s = (
|
|
2825
|
+
this._titleElement.textContent = ((n = (o = (s = (i = e.inbox) == null ? void 0 : i.header) == null ? void 0 : s.filters) == null ? void 0 : o.inbox) == null ? void 0 : n.text) ?? "Inbox", this._iconElement.updateSVG(((m = (p = (l = (d = (c = e.inbox) == null ? void 0 : c.header) == null ? void 0 : d.filters) == null ? void 0 : l.inbox) == null ? void 0 : p.icon) == null ? void 0 : m.svg) ?? x.inbox), this._iconElement.updateColor(((C = (b = (_ = (f = (g = e.inbox) == null ? void 0 : g.header) == null ? void 0 : f.filters) == null ? void 0 : _.inbox) == null ? void 0 : b.icon) == null ? void 0 : C.color) ?? "red");
|
|
1924
2826
|
break;
|
|
1925
2827
|
case "archive":
|
|
1926
|
-
this._titleElement.textContent = ((
|
|
2828
|
+
this._titleElement.textContent = ((I = (S = (w = (k = e.inbox) == null ? void 0 : k.header) == null ? void 0 : w.filters) == null ? void 0 : S.archive) == null ? void 0 : I.text) ?? "Archive", this._iconElement.updateSVG(((D = (R = (L = (M = (E = e.inbox) == null ? void 0 : E.header) == null ? void 0 : M.filters) == null ? void 0 : L.archive) == null ? void 0 : R.icon) == null ? void 0 : D.svg) ?? x.archive), this._iconElement.updateColor(((O = (H = (F = (A = (y = e.inbox) == null ? void 0 : y.header) == null ? void 0 : A.filters) == null ? void 0 : F.archive) == null ? void 0 : H.icon) == null ? void 0 : O.color) ?? "red");
|
|
1927
2829
|
break;
|
|
1928
2830
|
}
|
|
1929
2831
|
}
|
|
@@ -1932,8 +2834,8 @@ class ko extends HTMLElement {
|
|
|
1932
2834
|
this._themeSubscription.unsubscribe();
|
|
1933
2835
|
}
|
|
1934
2836
|
}
|
|
1935
|
-
customElements.get("courier-inbox-header-title") || customElements.define("courier-inbox-header-title",
|
|
1936
|
-
class
|
|
2837
|
+
customElements.get("courier-inbox-header-title") || customElements.define("courier-inbox-header-title", Fo);
|
|
2838
|
+
class Ho extends De {
|
|
1937
2839
|
constructor(e) {
|
|
1938
2840
|
super();
|
|
1939
2841
|
// Theme
|
|
@@ -1948,86 +2850,86 @@ class wo extends Le {
|
|
|
1948
2850
|
a(this, "_style");
|
|
1949
2851
|
// Callbacks
|
|
1950
2852
|
a(this, "_onFeedTypeChange");
|
|
1951
|
-
this._themeSubscription = e.themeManager.subscribe((
|
|
2853
|
+
this._themeSubscription = e.themeManager.subscribe((i) => {
|
|
1952
2854
|
this.refreshTheme();
|
|
1953
2855
|
}), this._onFeedTypeChange = e.onFeedTypeChange;
|
|
1954
2856
|
}
|
|
1955
2857
|
// Menu options
|
|
1956
2858
|
getFilterOptions() {
|
|
1957
|
-
var s, o, n,
|
|
1958
|
-
const e = this._themeSubscription.manager.getTheme(),
|
|
2859
|
+
var s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E, M, L, R, D, y, A, F, H, O, z, U, N, q, V, j, X, Q, Y, ee;
|
|
2860
|
+
const e = this._themeSubscription.manager.getTheme(), i = (n = (o = (s = e.inbox) == null ? void 0 : s.header) == null ? void 0 : o.menus) == null ? void 0 : n.filters;
|
|
1959
2861
|
return [
|
|
1960
2862
|
{
|
|
1961
2863
|
id: "inbox",
|
|
1962
|
-
text: ((
|
|
2864
|
+
text: ((c = i == null ? void 0 : i.inbox) == null ? void 0 : c.text) ?? "Inbox",
|
|
1963
2865
|
icon: {
|
|
1964
|
-
color: ((
|
|
1965
|
-
svg: ((m = (
|
|
2866
|
+
color: ((l = (d = i == null ? void 0 : i.inbox) == null ? void 0 : d.icon) == null ? void 0 : l.color) ?? "red",
|
|
2867
|
+
svg: ((m = (p = i == null ? void 0 : i.inbox) == null ? void 0 : p.icon) == null ? void 0 : m.svg) ?? x.inbox
|
|
1966
2868
|
},
|
|
1967
2869
|
selectionIcon: {
|
|
1968
|
-
color: ((k = (
|
|
1969
|
-
svg: ((
|
|
2870
|
+
color: ((k = (C = (b = (_ = (f = (g = e.inbox) == null ? void 0 : g.header) == null ? void 0 : f.menus) == null ? void 0 : _.popup) == null ? void 0 : b.list) == null ? void 0 : C.selectionIcon) == null ? void 0 : k.color) ?? "red",
|
|
2871
|
+
svg: ((L = (M = (E = (I = (S = (w = e.inbox) == null ? void 0 : w.header) == null ? void 0 : S.menus) == null ? void 0 : I.popup) == null ? void 0 : E.list) == null ? void 0 : M.selectionIcon) == null ? void 0 : L.svg) ?? x.check
|
|
1970
2872
|
},
|
|
1971
|
-
onClick: (
|
|
1972
|
-
this.handleOptionMenuItemClick("inbox",
|
|
2873
|
+
onClick: (G) => {
|
|
2874
|
+
this.handleOptionMenuItemClick("inbox", G);
|
|
1973
2875
|
}
|
|
1974
2876
|
},
|
|
1975
2877
|
{
|
|
1976
2878
|
id: "archive",
|
|
1977
|
-
text: ((
|
|
2879
|
+
text: ((R = i == null ? void 0 : i.archive) == null ? void 0 : R.text) ?? "Archive",
|
|
1978
2880
|
icon: {
|
|
1979
|
-
color: ((y = (
|
|
1980
|
-
svg: ((F = (
|
|
2881
|
+
color: ((y = (D = i == null ? void 0 : i.archive) == null ? void 0 : D.icon) == null ? void 0 : y.color) ?? "red",
|
|
2882
|
+
svg: ((F = (A = i == null ? void 0 : i.archive) == null ? void 0 : A.icon) == null ? void 0 : F.svg) ?? x.archive
|
|
1981
2883
|
},
|
|
1982
2884
|
selectionIcon: {
|
|
1983
|
-
color: ((
|
|
1984
|
-
svg: ((
|
|
2885
|
+
color: ((q = (N = (U = (z = (O = (H = e.inbox) == null ? void 0 : H.header) == null ? void 0 : O.menus) == null ? void 0 : z.popup) == null ? void 0 : U.list) == null ? void 0 : N.selectionIcon) == null ? void 0 : q.color) ?? "red",
|
|
2886
|
+
svg: ((ee = (Y = (Q = (X = (j = (V = e.inbox) == null ? void 0 : V.header) == null ? void 0 : j.menus) == null ? void 0 : X.popup) == null ? void 0 : Q.list) == null ? void 0 : Y.selectionIcon) == null ? void 0 : ee.svg) ?? x.check
|
|
1985
2887
|
},
|
|
1986
|
-
onClick: (
|
|
1987
|
-
this.handleOptionMenuItemClick("archive",
|
|
2888
|
+
onClick: (G) => {
|
|
2889
|
+
this.handleOptionMenuItemClick("archive", G);
|
|
1988
2890
|
}
|
|
1989
2891
|
}
|
|
1990
2892
|
];
|
|
1991
2893
|
}
|
|
1992
2894
|
getActionOptions() {
|
|
1993
|
-
var s, o, n,
|
|
1994
|
-
const
|
|
2895
|
+
var s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E;
|
|
2896
|
+
const i = (n = (o = (s = this._themeSubscription.manager.getTheme().inbox) == null ? void 0 : s.header) == null ? void 0 : o.menus) == null ? void 0 : n.actions;
|
|
1995
2897
|
return [
|
|
1996
2898
|
{
|
|
1997
2899
|
id: "markAllRead",
|
|
1998
|
-
text: ((
|
|
2900
|
+
text: ((c = i == null ? void 0 : i.markAllRead) == null ? void 0 : c.text) ?? "Mark All as Read",
|
|
1999
2901
|
icon: {
|
|
2000
|
-
color: ((
|
|
2001
|
-
svg: ((m = (
|
|
2902
|
+
color: ((l = (d = i == null ? void 0 : i.markAllRead) == null ? void 0 : d.icon) == null ? void 0 : l.color) ?? "red",
|
|
2903
|
+
svg: ((m = (p = i == null ? void 0 : i.markAllRead) == null ? void 0 : p.icon) == null ? void 0 : m.svg) ?? x.inbox
|
|
2002
2904
|
},
|
|
2003
2905
|
selectionIcon: null,
|
|
2004
|
-
onClick: (
|
|
2005
|
-
|
|
2906
|
+
onClick: (M) => {
|
|
2907
|
+
P.shared.readAllMessages({ canCallApi: !0 });
|
|
2006
2908
|
}
|
|
2007
2909
|
},
|
|
2008
2910
|
{
|
|
2009
2911
|
id: "archiveAll",
|
|
2010
|
-
text: ((
|
|
2912
|
+
text: ((g = i == null ? void 0 : i.archiveAll) == null ? void 0 : g.text) ?? "Archive All",
|
|
2011
2913
|
icon: {
|
|
2012
|
-
color: ((_ = (
|
|
2013
|
-
svg: ((
|
|
2914
|
+
color: ((_ = (f = i == null ? void 0 : i.archiveAll) == null ? void 0 : f.icon) == null ? void 0 : _.color) ?? "red",
|
|
2915
|
+
svg: ((C = (b = i == null ? void 0 : i.archiveAll) == null ? void 0 : b.icon) == null ? void 0 : C.svg) ?? x.archive
|
|
2014
2916
|
},
|
|
2015
2917
|
selectionIcon: null,
|
|
2016
|
-
onClick: (
|
|
2017
|
-
var
|
|
2018
|
-
alert(JSON.stringify((
|
|
2918
|
+
onClick: (M) => {
|
|
2919
|
+
var L;
|
|
2920
|
+
alert(JSON.stringify((L = v.shared.client) == null ? void 0 : L.options));
|
|
2019
2921
|
}
|
|
2020
2922
|
},
|
|
2021
2923
|
{
|
|
2022
2924
|
id: "archiveRead",
|
|
2023
|
-
text: ((k =
|
|
2925
|
+
text: ((k = i == null ? void 0 : i.archiveRead) == null ? void 0 : k.text) ?? "Archive Read",
|
|
2024
2926
|
icon: {
|
|
2025
|
-
color: ((S = (w =
|
|
2026
|
-
svg: ((E = (
|
|
2927
|
+
color: ((S = (w = i == null ? void 0 : i.archiveRead) == null ? void 0 : w.icon) == null ? void 0 : S.color) ?? "red",
|
|
2928
|
+
svg: ((E = (I = i == null ? void 0 : i.archiveRead) == null ? void 0 : I.icon) == null ? void 0 : E.svg) ?? x.archive
|
|
2027
2929
|
},
|
|
2028
2930
|
selectionIcon: null,
|
|
2029
|
-
onClick: (
|
|
2030
|
-
|
|
2931
|
+
onClick: (M) => {
|
|
2932
|
+
P.shared.archiveReadMessages({ canCallApi: !0 });
|
|
2031
2933
|
}
|
|
2032
2934
|
}
|
|
2033
2935
|
];
|
|
@@ -2036,40 +2938,40 @@ class wo extends Le {
|
|
|
2036
2938
|
return ["icon", "title", "feed-type"];
|
|
2037
2939
|
}
|
|
2038
2940
|
refreshTheme() {
|
|
2039
|
-
var s, o, n,
|
|
2040
|
-
const e = this._themeSubscription.manager.getTheme(),
|
|
2041
|
-
|
|
2941
|
+
var s, o, n, c, d, l, p;
|
|
2942
|
+
const e = this._themeSubscription.manager.getTheme(), i = (s = this.shadow) == null ? void 0 : s.querySelector(".courier-inbox-header");
|
|
2943
|
+
i && (i.style.backgroundColor = ((n = (o = e.inbox) == null ? void 0 : o.header) == null ? void 0 : n.backgroundColor) ?? r.white[500], i.style.boxShadow = ((d = (c = e.inbox) == null ? void 0 : c.header) == null ? void 0 : d.shadow) ?? `0px 1px 0px 0px ${r.gray[500]}`), (l = this._filterMenu) == null || l.setOptions(this.getFilterOptions()), (p = this._actionMenu) == null || p.setOptions(this.getActionOptions());
|
|
2042
2944
|
}
|
|
2043
|
-
handleOptionMenuItemClick(e,
|
|
2044
|
-
this._feedType = e, this._titleSection && this._titleSection.updateSelectedOption(
|
|
2945
|
+
handleOptionMenuItemClick(e, i) {
|
|
2946
|
+
this._feedType = e, this._titleSection && this._titleSection.updateSelectedOption(i, this._feedType, this._feedType === "inbox" ? this._unreadCount : 0), this._onFeedTypeChange(e);
|
|
2045
2947
|
}
|
|
2046
2948
|
render(e) {
|
|
2047
2949
|
this._feedType = e.feedType, this._unreadCount = e.unreadCount, this.refreshTitleSection();
|
|
2048
2950
|
}
|
|
2049
2951
|
refreshTitleSection() {
|
|
2050
|
-
var
|
|
2952
|
+
var i, s;
|
|
2051
2953
|
const e = this.getFilterOptions().find((o) => ["inbox", "archive"].includes(o.id) && o.id === this._feedType);
|
|
2052
|
-
e && ((
|
|
2954
|
+
e && ((i = this._titleSection) == null || i.updateSelectedOption(e, this._feedType, this._feedType === "inbox" ? this._unreadCount : 0), (s = this._filterMenu) == null || s.selectOption(e));
|
|
2053
2955
|
}
|
|
2054
2956
|
build(e) {
|
|
2055
|
-
var
|
|
2056
|
-
super.build(e), this._style = document.createElement("style"), this._style.textContent = this.getStyles(), (
|
|
2957
|
+
var i;
|
|
2958
|
+
super.build(e), this._style = document.createElement("style"), this._style.textContent = this.getStyles(), (i = this.shadow) == null || i.appendChild(this._style), this.refreshTheme();
|
|
2057
2959
|
}
|
|
2058
2960
|
defaultElement() {
|
|
2059
2961
|
const e = this.getFilterOptions();
|
|
2060
|
-
this._titleSection = new
|
|
2962
|
+
this._titleSection = new Fo(this._themeSubscription.manager, e[0]), this._filterMenu = new He(this._themeSubscription.manager, "filters", !0, e, () => {
|
|
2061
2963
|
var n;
|
|
2062
2964
|
(n = this._actionMenu) == null || n.closeMenu();
|
|
2063
|
-
}), this._actionMenu = new
|
|
2965
|
+
}), this._actionMenu = new He(this._themeSubscription.manager, "actions", !1, this.getActionOptions(), () => {
|
|
2064
2966
|
var n;
|
|
2065
2967
|
(n = this._filterMenu) == null || n.closeMenu();
|
|
2066
2968
|
}), this._filterMenu.selectOption(e[0]);
|
|
2067
|
-
const
|
|
2068
|
-
|
|
2969
|
+
const i = document.createElement("div");
|
|
2970
|
+
i.className = "spacer";
|
|
2069
2971
|
const s = document.createElement("div");
|
|
2070
2972
|
s.className = "actions", s.appendChild(this._filterMenu), s.appendChild(this._actionMenu);
|
|
2071
2973
|
const o = document.createElement("div");
|
|
2072
|
-
return o.className = "courier-inbox-header", o.appendChild(this._titleSection), o.appendChild(
|
|
2974
|
+
return o.className = "courier-inbox-header", o.appendChild(this._titleSection), o.appendChild(i), o.appendChild(s), o;
|
|
2073
2975
|
}
|
|
2074
2976
|
getStyles() {
|
|
2075
2977
|
return `
|
|
@@ -2108,22 +3010,22 @@ class wo extends Le {
|
|
|
2108
3010
|
this._themeSubscription.unsubscribe();
|
|
2109
3011
|
}
|
|
2110
3012
|
}
|
|
2111
|
-
customElements.get("courier-inbox-header") || customElements.define("courier-inbox-header",
|
|
2112
|
-
class
|
|
2113
|
-
constructor(
|
|
3013
|
+
customElements.get("courier-inbox-header") || customElements.define("courier-inbox-header", Ho);
|
|
3014
|
+
class Oo {
|
|
3015
|
+
constructor(t) {
|
|
2114
3016
|
a(this, "events");
|
|
2115
|
-
this.events =
|
|
3017
|
+
this.events = t;
|
|
2116
3018
|
}
|
|
2117
3019
|
remove() {
|
|
2118
|
-
|
|
3020
|
+
P.shared.removeDataStoreListener(this);
|
|
2119
3021
|
}
|
|
2120
3022
|
}
|
|
2121
|
-
const
|
|
3023
|
+
const Te = {
|
|
2122
3024
|
popup: {
|
|
2123
3025
|
button: {
|
|
2124
3026
|
icon: {
|
|
2125
3027
|
color: r.black[500],
|
|
2126
|
-
svg:
|
|
3028
|
+
svg: x.inbox
|
|
2127
3029
|
},
|
|
2128
3030
|
backgroundColor: "transparent",
|
|
2129
3031
|
hoverBackgroundColor: r.black[50010],
|
|
@@ -2159,14 +3061,14 @@ const we = {
|
|
|
2159
3061
|
inbox: {
|
|
2160
3062
|
icon: {
|
|
2161
3063
|
color: r.black[500],
|
|
2162
|
-
svg:
|
|
3064
|
+
svg: x.inbox
|
|
2163
3065
|
},
|
|
2164
3066
|
text: "Inbox"
|
|
2165
3067
|
},
|
|
2166
3068
|
archive: {
|
|
2167
3069
|
icon: {
|
|
2168
3070
|
color: r.black[500],
|
|
2169
|
-
svg:
|
|
3071
|
+
svg: x.archive
|
|
2170
3072
|
},
|
|
2171
3073
|
text: "Archive"
|
|
2172
3074
|
},
|
|
@@ -2197,7 +3099,7 @@ const we = {
|
|
|
2197
3099
|
},
|
|
2198
3100
|
selectionIcon: {
|
|
2199
3101
|
color: r.black[500],
|
|
2200
|
-
svg:
|
|
3102
|
+
svg: x.check
|
|
2201
3103
|
}
|
|
2202
3104
|
}
|
|
2203
3105
|
},
|
|
@@ -2205,7 +3107,7 @@ const we = {
|
|
|
2205
3107
|
button: {
|
|
2206
3108
|
icon: {
|
|
2207
3109
|
color: r.black[500],
|
|
2208
|
-
svg:
|
|
3110
|
+
svg: x.filter
|
|
2209
3111
|
},
|
|
2210
3112
|
backgroundColor: "transparent",
|
|
2211
3113
|
hoverBackgroundColor: r.black[50010],
|
|
@@ -2214,14 +3116,14 @@ const we = {
|
|
|
2214
3116
|
inbox: {
|
|
2215
3117
|
icon: {
|
|
2216
3118
|
color: r.black[500],
|
|
2217
|
-
svg:
|
|
3119
|
+
svg: x.inbox
|
|
2218
3120
|
},
|
|
2219
3121
|
text: "Inbox"
|
|
2220
3122
|
},
|
|
2221
3123
|
archive: {
|
|
2222
3124
|
icon: {
|
|
2223
3125
|
color: r.black[500],
|
|
2224
|
-
svg:
|
|
3126
|
+
svg: x.archive
|
|
2225
3127
|
},
|
|
2226
3128
|
text: "Archive"
|
|
2227
3129
|
}
|
|
@@ -2230,7 +3132,7 @@ const we = {
|
|
|
2230
3132
|
button: {
|
|
2231
3133
|
icon: {
|
|
2232
3134
|
color: r.black[500],
|
|
2233
|
-
svg:
|
|
3135
|
+
svg: x.overflow
|
|
2234
3136
|
},
|
|
2235
3137
|
backgroundColor: "transparent",
|
|
2236
3138
|
hoverBackgroundColor: r.black[50010],
|
|
@@ -2239,21 +3141,21 @@ const we = {
|
|
|
2239
3141
|
markAllRead: {
|
|
2240
3142
|
icon: {
|
|
2241
3143
|
color: r.black[500],
|
|
2242
|
-
svg:
|
|
3144
|
+
svg: x.read
|
|
2243
3145
|
},
|
|
2244
3146
|
text: "Mark All as Read"
|
|
2245
3147
|
},
|
|
2246
3148
|
archiveAll: {
|
|
2247
3149
|
icon: {
|
|
2248
3150
|
color: r.black[500],
|
|
2249
|
-
svg:
|
|
3151
|
+
svg: x.archive
|
|
2250
3152
|
},
|
|
2251
3153
|
text: "Archive All"
|
|
2252
3154
|
},
|
|
2253
3155
|
archiveRead: {
|
|
2254
3156
|
icon: {
|
|
2255
3157
|
color: r.black[500],
|
|
2256
|
-
svg:
|
|
3158
|
+
svg: x.archiveRead
|
|
2257
3159
|
},
|
|
2258
3160
|
text: "Archive Read"
|
|
2259
3161
|
}
|
|
@@ -2312,19 +3214,19 @@ const we = {
|
|
|
2312
3214
|
borderRadius: "0px",
|
|
2313
3215
|
read: {
|
|
2314
3216
|
color: r.black[500],
|
|
2315
|
-
svg:
|
|
3217
|
+
svg: x.read
|
|
2316
3218
|
},
|
|
2317
3219
|
unread: {
|
|
2318
3220
|
color: r.black[500],
|
|
2319
|
-
svg:
|
|
3221
|
+
svg: x.unread
|
|
2320
3222
|
},
|
|
2321
3223
|
archive: {
|
|
2322
3224
|
color: r.black[500],
|
|
2323
|
-
svg:
|
|
3225
|
+
svg: x.archive
|
|
2324
3226
|
},
|
|
2325
3227
|
unarchive: {
|
|
2326
3228
|
color: r.black[500],
|
|
2327
|
-
svg:
|
|
3229
|
+
svg: x.unarchive
|
|
2328
3230
|
}
|
|
2329
3231
|
}
|
|
2330
3232
|
}
|
|
@@ -2364,12 +3266,12 @@ const we = {
|
|
|
2364
3266
|
}
|
|
2365
3267
|
}
|
|
2366
3268
|
}
|
|
2367
|
-
},
|
|
3269
|
+
}, Oe = {
|
|
2368
3270
|
popup: {
|
|
2369
3271
|
button: {
|
|
2370
3272
|
icon: {
|
|
2371
3273
|
color: r.white[500],
|
|
2372
|
-
svg:
|
|
3274
|
+
svg: x.inbox
|
|
2373
3275
|
},
|
|
2374
3276
|
backgroundColor: "transparent",
|
|
2375
3277
|
hoverBackgroundColor: r.white[50010],
|
|
@@ -2405,14 +3307,14 @@ const we = {
|
|
|
2405
3307
|
inbox: {
|
|
2406
3308
|
icon: {
|
|
2407
3309
|
color: r.white[500],
|
|
2408
|
-
svg:
|
|
3310
|
+
svg: x.inbox
|
|
2409
3311
|
},
|
|
2410
3312
|
text: "Inbox"
|
|
2411
3313
|
},
|
|
2412
3314
|
archive: {
|
|
2413
3315
|
icon: {
|
|
2414
3316
|
color: r.white[500],
|
|
2415
|
-
svg:
|
|
3317
|
+
svg: x.archive
|
|
2416
3318
|
},
|
|
2417
3319
|
text: "Archive"
|
|
2418
3320
|
},
|
|
@@ -2443,7 +3345,7 @@ const we = {
|
|
|
2443
3345
|
},
|
|
2444
3346
|
selectionIcon: {
|
|
2445
3347
|
color: r.white[500],
|
|
2446
|
-
svg:
|
|
3348
|
+
svg: x.check
|
|
2447
3349
|
}
|
|
2448
3350
|
}
|
|
2449
3351
|
},
|
|
@@ -2451,7 +3353,7 @@ const we = {
|
|
|
2451
3353
|
button: {
|
|
2452
3354
|
icon: {
|
|
2453
3355
|
color: r.white[500],
|
|
2454
|
-
svg:
|
|
3356
|
+
svg: x.filter
|
|
2455
3357
|
},
|
|
2456
3358
|
backgroundColor: "transparent",
|
|
2457
3359
|
hoverBackgroundColor: r.white[50010],
|
|
@@ -2460,14 +3362,14 @@ const we = {
|
|
|
2460
3362
|
inbox: {
|
|
2461
3363
|
icon: {
|
|
2462
3364
|
color: r.white[500],
|
|
2463
|
-
svg:
|
|
3365
|
+
svg: x.inbox
|
|
2464
3366
|
},
|
|
2465
3367
|
text: "Inbox"
|
|
2466
3368
|
},
|
|
2467
3369
|
archive: {
|
|
2468
3370
|
icon: {
|
|
2469
3371
|
color: r.white[500],
|
|
2470
|
-
svg:
|
|
3372
|
+
svg: x.archive
|
|
2471
3373
|
},
|
|
2472
3374
|
text: "Archive"
|
|
2473
3375
|
}
|
|
@@ -2476,7 +3378,7 @@ const we = {
|
|
|
2476
3378
|
button: {
|
|
2477
3379
|
icon: {
|
|
2478
3380
|
color: r.white[500],
|
|
2479
|
-
svg:
|
|
3381
|
+
svg: x.overflow
|
|
2480
3382
|
},
|
|
2481
3383
|
backgroundColor: "transparent",
|
|
2482
3384
|
hoverBackgroundColor: r.white[50010],
|
|
@@ -2485,21 +3387,21 @@ const we = {
|
|
|
2485
3387
|
markAllRead: {
|
|
2486
3388
|
icon: {
|
|
2487
3389
|
color: r.white[500],
|
|
2488
|
-
svg:
|
|
3390
|
+
svg: x.read
|
|
2489
3391
|
},
|
|
2490
3392
|
text: "Mark All as Read"
|
|
2491
3393
|
},
|
|
2492
3394
|
archiveAll: {
|
|
2493
3395
|
icon: {
|
|
2494
3396
|
color: r.white[500],
|
|
2495
|
-
svg:
|
|
3397
|
+
svg: x.archive
|
|
2496
3398
|
},
|
|
2497
3399
|
text: "Archive All"
|
|
2498
3400
|
},
|
|
2499
3401
|
archiveRead: {
|
|
2500
3402
|
icon: {
|
|
2501
3403
|
color: r.white[500],
|
|
2502
|
-
svg:
|
|
3404
|
+
svg: x.archiveRead
|
|
2503
3405
|
},
|
|
2504
3406
|
text: "Archive Read"
|
|
2505
3407
|
}
|
|
@@ -2558,19 +3460,19 @@ const we = {
|
|
|
2558
3460
|
borderRadius: "0px",
|
|
2559
3461
|
read: {
|
|
2560
3462
|
color: r.white[500],
|
|
2561
|
-
svg:
|
|
3463
|
+
svg: x.read
|
|
2562
3464
|
},
|
|
2563
3465
|
unread: {
|
|
2564
3466
|
color: r.white[500],
|
|
2565
|
-
svg:
|
|
3467
|
+
svg: x.unread
|
|
2566
3468
|
},
|
|
2567
3469
|
archive: {
|
|
2568
3470
|
color: r.white[500],
|
|
2569
|
-
svg:
|
|
3471
|
+
svg: x.archive
|
|
2570
3472
|
},
|
|
2571
3473
|
unarchive: {
|
|
2572
3474
|
color: r.white[500],
|
|
2573
|
-
svg:
|
|
3475
|
+
svg: x.unarchive
|
|
2574
3476
|
}
|
|
2575
3477
|
}
|
|
2576
3478
|
}
|
|
@@ -2610,195 +3512,195 @@ const we = {
|
|
|
2610
3512
|
}
|
|
2611
3513
|
}
|
|
2612
3514
|
}
|
|
2613
|
-
},
|
|
2614
|
-
var
|
|
2615
|
-
const e =
|
|
3515
|
+
}, dn = (h, t) => {
|
|
3516
|
+
var i, s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I, E, M, L, R, D, y, A, F, H, O, z, U, N, q, V, j, X, Q, Y, ee, G, ae, he, ce, le, de, ue, pe, ge, me, be, _e, fe, xe, ve, Ce, ye, ke, we, Se, Ie, u, B, te, ie, J, Ee, Ve, je, Ze, Je, Ge, We, Ke, Xe, Qe, Ye, et, tt, it, st, ot, nt, rt, at, ht, ct, lt, dt, ut, pt, gt, mt, bt, _t, ft, xt, vt, Ct, yt, kt, wt, St, It, Et, Mt, Tt, $t, Lt, At, Pt, Bt, Rt, Dt, Ft, Ht, Ot, zt, Ut, Nt, qt, Vt, jt, Zt, Jt, Gt, Wt, Kt, Xt, Qt, Yt, ei, ti, ii, si, oi, ni, ri, ai, hi, ci, li, di, ui, pi, gi, mi, bi, _i, fi, xi, vi, Ci, yi, ki, wi, Si, Ii, Ei, Mi, Ti, $i, Li, Ai, Pi, Bi, Ri, Di, Fi, Hi, Oi, zi, Ui, Ni, qi, Vi, ji, Zi, Ji, Gi, Wi, Ki, Xi, Qi, Yi, es, ts, is, ss, os, ns, rs, as, hs, cs, ls, ds, us, ps, gs, ms, bs, _s, fs, xs, vs, Cs, ys, ks, ws, Ss, Is, Es, Ms, Ts, $s, Ls, As, Ps, Bs, Rs, Ds, Fs, Hs, Os, zs, Us, Ns, qs, Vs, js, Zs, Js, Gs, Ws, Ks, Xs, Qs, Ys, eo, to, io, so, oo, no, ro, ao, ho, co, lo, uo, po, go, mo, bo, _o, fo, xo, vo, Co;
|
|
3517
|
+
const e = h === "light" ? Te : Oe;
|
|
2616
3518
|
return {
|
|
2617
3519
|
popup: {
|
|
2618
3520
|
button: {
|
|
2619
|
-
...(
|
|
2620
|
-
...(s =
|
|
3521
|
+
...(i = e.popup) == null ? void 0 : i.button,
|
|
3522
|
+
...(s = t.popup) == null ? void 0 : s.button,
|
|
2621
3523
|
icon: {
|
|
2622
3524
|
...(n = (o = e.popup) == null ? void 0 : o.button) == null ? void 0 : n.icon,
|
|
2623
|
-
...(d = (
|
|
3525
|
+
...(d = (c = t.popup) == null ? void 0 : c.button) == null ? void 0 : d.icon
|
|
2624
3526
|
},
|
|
2625
3527
|
unreadIndicator: {
|
|
2626
|
-
...(
|
|
2627
|
-
...(
|
|
3528
|
+
...(p = (l = e.popup) == null ? void 0 : l.button) == null ? void 0 : p.unreadIndicator,
|
|
3529
|
+
...(g = (m = t.popup) == null ? void 0 : m.button) == null ? void 0 : g.unreadIndicator
|
|
2628
3530
|
}
|
|
2629
3531
|
},
|
|
2630
3532
|
window: {
|
|
2631
|
-
...(
|
|
2632
|
-
...(_ =
|
|
3533
|
+
...(f = e.popup) == null ? void 0 : f.window,
|
|
3534
|
+
...(_ = t.popup) == null ? void 0 : _.window
|
|
2633
3535
|
}
|
|
2634
3536
|
},
|
|
2635
3537
|
inbox: {
|
|
2636
3538
|
header: {
|
|
2637
3539
|
...(b = e.inbox) == null ? void 0 : b.header,
|
|
2638
|
-
...(
|
|
3540
|
+
...(C = t.inbox) == null ? void 0 : C.header,
|
|
2639
3541
|
filters: {
|
|
2640
3542
|
...(w = (k = e.inbox) == null ? void 0 : k.header) == null ? void 0 : w.filters,
|
|
2641
|
-
...(
|
|
3543
|
+
...(I = (S = t.inbox) == null ? void 0 : S.header) == null ? void 0 : I.filters,
|
|
2642
3544
|
inbox: {
|
|
2643
|
-
...(
|
|
2644
|
-
...(y = (
|
|
3545
|
+
...(L = (M = (E = e.inbox) == null ? void 0 : E.header) == null ? void 0 : M.filters) == null ? void 0 : L.inbox,
|
|
3546
|
+
...(y = (D = (R = t.inbox) == null ? void 0 : R.header) == null ? void 0 : D.filters) == null ? void 0 : y.inbox,
|
|
2645
3547
|
icon: {
|
|
2646
|
-
...(
|
|
2647
|
-
...(
|
|
3548
|
+
...(O = (H = (F = (A = e.inbox) == null ? void 0 : A.header) == null ? void 0 : F.filters) == null ? void 0 : H.inbox) == null ? void 0 : O.icon,
|
|
3549
|
+
...(q = (N = (U = (z = t.inbox) == null ? void 0 : z.header) == null ? void 0 : U.filters) == null ? void 0 : N.inbox) == null ? void 0 : q.icon
|
|
2648
3550
|
}
|
|
2649
3551
|
},
|
|
2650
3552
|
archive: {
|
|
2651
|
-
...(
|
|
2652
|
-
...(
|
|
3553
|
+
...(X = (j = (V = e.inbox) == null ? void 0 : V.header) == null ? void 0 : j.filters) == null ? void 0 : X.archive,
|
|
3554
|
+
...(ee = (Y = (Q = t.inbox) == null ? void 0 : Q.header) == null ? void 0 : Y.filters) == null ? void 0 : ee.archive,
|
|
2653
3555
|
icon: {
|
|
2654
|
-
...(
|
|
2655
|
-
...(
|
|
3556
|
+
...(ce = (he = (ae = (G = e.inbox) == null ? void 0 : G.header) == null ? void 0 : ae.filters) == null ? void 0 : he.archive) == null ? void 0 : ce.icon,
|
|
3557
|
+
...(pe = (ue = (de = (le = t.inbox) == null ? void 0 : le.header) == null ? void 0 : de.filters) == null ? void 0 : ue.archive) == null ? void 0 : pe.icon
|
|
2656
3558
|
}
|
|
2657
3559
|
},
|
|
2658
3560
|
unreadIndicator: {
|
|
2659
|
-
...(
|
|
2660
|
-
...(
|
|
3561
|
+
...(be = (me = (ge = e.inbox) == null ? void 0 : ge.header) == null ? void 0 : me.filters) == null ? void 0 : be.unreadIndicator,
|
|
3562
|
+
...(xe = (fe = (_e = t.inbox) == null ? void 0 : _e.header) == null ? void 0 : fe.filters) == null ? void 0 : xe.unreadIndicator
|
|
2661
3563
|
}
|
|
2662
3564
|
},
|
|
2663
3565
|
menus: {
|
|
2664
|
-
...(
|
|
2665
|
-
...(
|
|
3566
|
+
...(Ce = (ve = e.inbox) == null ? void 0 : ve.header) == null ? void 0 : Ce.menus,
|
|
3567
|
+
...(ke = (ye = t.inbox) == null ? void 0 : ye.header) == null ? void 0 : ke.menus,
|
|
2666
3568
|
popup: {
|
|
2667
|
-
...(
|
|
2668
|
-
...(
|
|
3569
|
+
...(Ie = (Se = (we = e.inbox) == null ? void 0 : we.header) == null ? void 0 : Se.menus) == null ? void 0 : Ie.popup,
|
|
3570
|
+
...(te = (B = (u = t.inbox) == null ? void 0 : u.header) == null ? void 0 : B.menus) == null ? void 0 : te.popup,
|
|
2669
3571
|
list: {
|
|
2670
|
-
...(
|
|
2671
|
-
...(
|
|
3572
|
+
...(Ve = (Ee = (J = (ie = e.inbox) == null ? void 0 : ie.header) == null ? void 0 : J.menus) == null ? void 0 : Ee.popup) == null ? void 0 : Ve.list,
|
|
3573
|
+
...(Ge = (Je = (Ze = (je = t.inbox) == null ? void 0 : je.header) == null ? void 0 : Ze.menus) == null ? void 0 : Je.popup) == null ? void 0 : Ge.list,
|
|
2672
3574
|
font: {
|
|
2673
|
-
...(
|
|
2674
|
-
...(
|
|
3575
|
+
...(Ye = (Qe = (Xe = (Ke = (We = e.inbox) == null ? void 0 : We.header) == null ? void 0 : Ke.menus) == null ? void 0 : Xe.popup) == null ? void 0 : Qe.list) == null ? void 0 : Ye.font,
|
|
3576
|
+
...(ot = (st = (it = (tt = (et = t.inbox) == null ? void 0 : et.header) == null ? void 0 : tt.menus) == null ? void 0 : it.popup) == null ? void 0 : st.list) == null ? void 0 : ot.font
|
|
2675
3577
|
},
|
|
2676
3578
|
selectionIcon: {
|
|
2677
|
-
...(
|
|
2678
|
-
...(
|
|
3579
|
+
...(ct = (ht = (at = (rt = (nt = e.inbox) == null ? void 0 : nt.header) == null ? void 0 : rt.menus) == null ? void 0 : at.popup) == null ? void 0 : ht.list) == null ? void 0 : ct.selectionIcon,
|
|
3580
|
+
...(gt = (pt = (ut = (dt = (lt = t.inbox) == null ? void 0 : lt.header) == null ? void 0 : dt.menus) == null ? void 0 : ut.popup) == null ? void 0 : pt.list) == null ? void 0 : gt.selectionIcon
|
|
2679
3581
|
}
|
|
2680
3582
|
}
|
|
2681
3583
|
},
|
|
2682
3584
|
filters: {
|
|
2683
|
-
...(
|
|
2684
|
-
...(
|
|
3585
|
+
...(_t = (bt = (mt = e.inbox) == null ? void 0 : mt.header) == null ? void 0 : bt.menus) == null ? void 0 : _t.filters,
|
|
3586
|
+
...(vt = (xt = (ft = t.inbox) == null ? void 0 : ft.header) == null ? void 0 : xt.menus) == null ? void 0 : vt.filters,
|
|
2685
3587
|
inbox: {
|
|
2686
|
-
...(
|
|
2687
|
-
...(
|
|
3588
|
+
...(wt = (kt = (yt = (Ct = e.inbox) == null ? void 0 : Ct.header) == null ? void 0 : yt.menus) == null ? void 0 : kt.filters) == null ? void 0 : wt.inbox,
|
|
3589
|
+
...(Mt = (Et = (It = (St = t.inbox) == null ? void 0 : St.header) == null ? void 0 : It.menus) == null ? void 0 : Et.filters) == null ? void 0 : Mt.inbox,
|
|
2688
3590
|
icon: {
|
|
2689
|
-
...(
|
|
2690
|
-
...(
|
|
3591
|
+
...(Pt = (At = (Lt = ($t = (Tt = e.inbox) == null ? void 0 : Tt.header) == null ? void 0 : $t.menus) == null ? void 0 : Lt.filters) == null ? void 0 : At.inbox) == null ? void 0 : Pt.icon,
|
|
3592
|
+
...(Ht = (Ft = (Dt = (Rt = (Bt = t.inbox) == null ? void 0 : Bt.header) == null ? void 0 : Rt.menus) == null ? void 0 : Dt.filters) == null ? void 0 : Ft.inbox) == null ? void 0 : Ht.icon
|
|
2691
3593
|
}
|
|
2692
3594
|
},
|
|
2693
3595
|
archive: {
|
|
2694
|
-
...(
|
|
2695
|
-
...(
|
|
3596
|
+
...(Nt = (Ut = (zt = (Ot = e.inbox) == null ? void 0 : Ot.header) == null ? void 0 : zt.menus) == null ? void 0 : Ut.filters) == null ? void 0 : Nt.archive,
|
|
3597
|
+
...(Zt = (jt = (Vt = (qt = t.inbox) == null ? void 0 : qt.header) == null ? void 0 : Vt.menus) == null ? void 0 : jt.filters) == null ? void 0 : Zt.archive,
|
|
2696
3598
|
icon: {
|
|
2697
|
-
...(
|
|
2698
|
-
...(
|
|
3599
|
+
...(Xt = (Kt = (Wt = (Gt = (Jt = e.inbox) == null ? void 0 : Jt.header) == null ? void 0 : Gt.menus) == null ? void 0 : Wt.filters) == null ? void 0 : Kt.archive) == null ? void 0 : Xt.icon,
|
|
3600
|
+
...(ii = (ti = (ei = (Yt = (Qt = t.inbox) == null ? void 0 : Qt.header) == null ? void 0 : Yt.menus) == null ? void 0 : ei.filters) == null ? void 0 : ti.archive) == null ? void 0 : ii.icon
|
|
2699
3601
|
}
|
|
2700
3602
|
}
|
|
2701
3603
|
},
|
|
2702
3604
|
actions: {
|
|
2703
|
-
...(
|
|
2704
|
-
...(
|
|
3605
|
+
...(ni = (oi = (si = e.inbox) == null ? void 0 : si.header) == null ? void 0 : oi.menus) == null ? void 0 : ni.actions,
|
|
3606
|
+
...(hi = (ai = (ri = t.inbox) == null ? void 0 : ri.header) == null ? void 0 : ai.menus) == null ? void 0 : hi.actions,
|
|
2705
3607
|
markAllRead: {
|
|
2706
|
-
...(
|
|
2707
|
-
...(
|
|
3608
|
+
...(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,
|
|
3609
|
+
...(bi = (mi = (gi = (pi = t.inbox) == null ? void 0 : pi.header) == null ? void 0 : gi.menus) == null ? void 0 : mi.actions) == null ? void 0 : bi.markAllRead,
|
|
2708
3610
|
icon: {
|
|
2709
|
-
...(
|
|
2710
|
-
...(
|
|
3611
|
+
...(Ci = (vi = (xi = (fi = (_i = e.inbox) == null ? void 0 : _i.header) == null ? void 0 : fi.menus) == null ? void 0 : xi.actions) == null ? void 0 : vi.markAllRead) == null ? void 0 : Ci.icon,
|
|
3612
|
+
...(Ii = (Si = (wi = (ki = (yi = t.inbox) == null ? void 0 : yi.header) == null ? void 0 : ki.menus) == null ? void 0 : wi.actions) == null ? void 0 : Si.markAllRead) == null ? void 0 : Ii.icon
|
|
2711
3613
|
}
|
|
2712
3614
|
},
|
|
2713
3615
|
archiveAll: {
|
|
2714
|
-
...(
|
|
2715
|
-
...(
|
|
3616
|
+
...($i = (Ti = (Mi = (Ei = e.inbox) == null ? void 0 : Ei.header) == null ? void 0 : Mi.menus) == null ? void 0 : Ti.actions) == null ? void 0 : $i.archiveAll,
|
|
3617
|
+
...(Bi = (Pi = (Ai = (Li = t.inbox) == null ? void 0 : Li.header) == null ? void 0 : Ai.menus) == null ? void 0 : Pi.actions) == null ? void 0 : Bi.archiveAll,
|
|
2716
3618
|
icon: {
|
|
2717
|
-
...(
|
|
2718
|
-
...(
|
|
3619
|
+
...(Oi = (Hi = (Fi = (Di = (Ri = e.inbox) == null ? void 0 : Ri.header) == null ? void 0 : Di.menus) == null ? void 0 : Fi.actions) == null ? void 0 : Hi.archiveAll) == null ? void 0 : Oi.icon,
|
|
3620
|
+
...(Vi = (qi = (Ni = (Ui = (zi = t.inbox) == null ? void 0 : zi.header) == null ? void 0 : Ui.menus) == null ? void 0 : Ni.actions) == null ? void 0 : qi.archiveAll) == null ? void 0 : Vi.icon
|
|
2719
3621
|
}
|
|
2720
3622
|
},
|
|
2721
3623
|
archiveRead: {
|
|
2722
|
-
...(
|
|
2723
|
-
...(
|
|
3624
|
+
...(Gi = (Ji = (Zi = (ji = e.inbox) == null ? void 0 : ji.header) == null ? void 0 : Zi.menus) == null ? void 0 : Ji.actions) == null ? void 0 : Gi.archiveRead,
|
|
3625
|
+
...(Qi = (Xi = (Ki = (Wi = t.inbox) == null ? void 0 : Wi.header) == null ? void 0 : Ki.menus) == null ? void 0 : Xi.actions) == null ? void 0 : Qi.archiveRead,
|
|
2724
3626
|
icon: {
|
|
2725
|
-
...(
|
|
2726
|
-
...(
|
|
3627
|
+
...(ss = (is = (ts = (es = (Yi = e.inbox) == null ? void 0 : Yi.header) == null ? void 0 : es.menus) == null ? void 0 : ts.actions) == null ? void 0 : is.archiveRead) == null ? void 0 : ss.icon,
|
|
3628
|
+
...(hs = (as = (rs = (ns = (os = t.inbox) == null ? void 0 : os.header) == null ? void 0 : ns.menus) == null ? void 0 : rs.actions) == null ? void 0 : as.archiveRead) == null ? void 0 : hs.icon
|
|
2727
3629
|
}
|
|
2728
3630
|
}
|
|
2729
3631
|
}
|
|
2730
3632
|
}
|
|
2731
3633
|
},
|
|
2732
3634
|
list: {
|
|
2733
|
-
...(
|
|
2734
|
-
...(
|
|
3635
|
+
...(cs = e.inbox) == null ? void 0 : cs.list,
|
|
3636
|
+
...(ls = t.inbox) == null ? void 0 : ls.list,
|
|
2735
3637
|
item: {
|
|
2736
|
-
...(
|
|
2737
|
-
...(
|
|
3638
|
+
...(us = (ds = e.inbox) == null ? void 0 : ds.list) == null ? void 0 : us.item,
|
|
3639
|
+
...(gs = (ps = t.inbox) == null ? void 0 : ps.list) == null ? void 0 : gs.item,
|
|
2738
3640
|
menu: {
|
|
2739
|
-
...(
|
|
2740
|
-
...(
|
|
3641
|
+
...(_s = (bs = (ms = e.inbox) == null ? void 0 : ms.list) == null ? void 0 : bs.item) == null ? void 0 : _s.menu,
|
|
3642
|
+
...(vs = (xs = (fs = t.inbox) == null ? void 0 : fs.list) == null ? void 0 : xs.item) == null ? void 0 : vs.menu,
|
|
2741
3643
|
item: {
|
|
2742
|
-
...(
|
|
2743
|
-
...(
|
|
3644
|
+
...(ws = (ks = (ys = (Cs = e.inbox) == null ? void 0 : Cs.list) == null ? void 0 : ys.item) == null ? void 0 : ks.menu) == null ? void 0 : ws.item,
|
|
3645
|
+
...(Ms = (Es = (Is = (Ss = t.inbox) == null ? void 0 : Ss.list) == null ? void 0 : Is.item) == null ? void 0 : Es.menu) == null ? void 0 : Ms.item,
|
|
2744
3646
|
read: {
|
|
2745
|
-
...(
|
|
2746
|
-
...(
|
|
3647
|
+
...(Ps = (As = (Ls = ($s = (Ts = e.inbox) == null ? void 0 : Ts.list) == null ? void 0 : $s.item) == null ? void 0 : Ls.menu) == null ? void 0 : As.item) == null ? void 0 : Ps.read,
|
|
3648
|
+
...(Hs = (Fs = (Ds = (Rs = (Bs = t.inbox) == null ? void 0 : Bs.list) == null ? void 0 : Rs.item) == null ? void 0 : Ds.menu) == null ? void 0 : Fs.item) == null ? void 0 : Hs.read
|
|
2747
3649
|
},
|
|
2748
3650
|
unread: {
|
|
2749
|
-
...(
|
|
2750
|
-
...(
|
|
3651
|
+
...(qs = (Ns = (Us = (zs = (Os = e.inbox) == null ? void 0 : Os.list) == null ? void 0 : zs.item) == null ? void 0 : Us.menu) == null ? void 0 : Ns.item) == null ? void 0 : qs.unread,
|
|
3652
|
+
...(Gs = (Js = (Zs = (js = (Vs = t.inbox) == null ? void 0 : Vs.list) == null ? void 0 : js.item) == null ? void 0 : Zs.menu) == null ? void 0 : Js.item) == null ? void 0 : Gs.unread
|
|
2751
3653
|
},
|
|
2752
3654
|
archive: {
|
|
2753
|
-
...(
|
|
2754
|
-
...(
|
|
3655
|
+
...(Ys = (Qs = (Xs = (Ks = (Ws = e.inbox) == null ? void 0 : Ws.list) == null ? void 0 : Ks.item) == null ? void 0 : Xs.menu) == null ? void 0 : Qs.item) == null ? void 0 : Ys.archive,
|
|
3656
|
+
...(oo = (so = (io = (to = (eo = t.inbox) == null ? void 0 : eo.list) == null ? void 0 : to.item) == null ? void 0 : io.menu) == null ? void 0 : so.item) == null ? void 0 : oo.archive
|
|
2755
3657
|
},
|
|
2756
3658
|
unarchive: {
|
|
2757
|
-
...(
|
|
2758
|
-
...(
|
|
3659
|
+
...(co = (ho = (ao = (ro = (no = e.inbox) == null ? void 0 : no.list) == null ? void 0 : ro.item) == null ? void 0 : ao.menu) == null ? void 0 : ho.item) == null ? void 0 : co.unarchive,
|
|
3660
|
+
...(mo = (go = (po = (uo = (lo = t.inbox) == null ? void 0 : lo.list) == null ? void 0 : uo.item) == null ? void 0 : po.menu) == null ? void 0 : go.item) == null ? void 0 : mo.unarchive
|
|
2759
3661
|
}
|
|
2760
3662
|
}
|
|
2761
3663
|
}
|
|
2762
3664
|
}
|
|
2763
3665
|
},
|
|
2764
3666
|
loading: {
|
|
2765
|
-
...(
|
|
2766
|
-
...(
|
|
3667
|
+
...(bo = e.inbox) == null ? void 0 : bo.loading,
|
|
3668
|
+
...(_o = t.inbox) == null ? void 0 : _o.loading
|
|
2767
3669
|
},
|
|
2768
3670
|
empty: {
|
|
2769
|
-
...(
|
|
2770
|
-
...(
|
|
3671
|
+
...(fo = e.inbox) == null ? void 0 : fo.empty,
|
|
3672
|
+
...(xo = t.inbox) == null ? void 0 : xo.empty
|
|
2771
3673
|
},
|
|
2772
3674
|
error: {
|
|
2773
|
-
...(
|
|
2774
|
-
...(
|
|
3675
|
+
...(vo = e.inbox) == null ? void 0 : vo.error,
|
|
3676
|
+
...(Co = t.inbox) == null ? void 0 : Co.error
|
|
2775
3677
|
}
|
|
2776
3678
|
}
|
|
2777
3679
|
};
|
|
2778
3680
|
};
|
|
2779
|
-
class
|
|
2780
|
-
constructor(
|
|
3681
|
+
class zo {
|
|
3682
|
+
constructor(t) {
|
|
2781
3683
|
// Event IDs
|
|
2782
3684
|
a(this, "THEME_CHANGE_EVENT", "courier_inbox_theme_change");
|
|
2783
3685
|
// State
|
|
2784
3686
|
a(this, "_theme");
|
|
2785
|
-
a(this, "_lightTheme",
|
|
2786
|
-
a(this, "_darkTheme",
|
|
3687
|
+
a(this, "_lightTheme", Te);
|
|
3688
|
+
a(this, "_darkTheme", Oe);
|
|
2787
3689
|
a(this, "_target");
|
|
2788
3690
|
a(this, "_subscriptions", []);
|
|
2789
3691
|
// System theme
|
|
2790
3692
|
a(this, "_userMode");
|
|
2791
3693
|
a(this, "_systemMode");
|
|
2792
3694
|
a(this, "_systemThemeCleanup");
|
|
2793
|
-
this._theme =
|
|
3695
|
+
this._theme = t, this._target = new EventTarget(), this._userMode = "system", this._systemMode = Mo(), this.setLightTheme(Te), this.setDarkTheme(Oe), this._systemThemeCleanup = To((e) => {
|
|
2794
3696
|
this._systemMode = e, this.updateTheme();
|
|
2795
3697
|
});
|
|
2796
3698
|
}
|
|
2797
|
-
setLightTheme(
|
|
2798
|
-
this._lightTheme =
|
|
3699
|
+
setLightTheme(t) {
|
|
3700
|
+
this._lightTheme = t, this._systemMode === "light" && this.updateTheme();
|
|
2799
3701
|
}
|
|
2800
|
-
setDarkTheme(
|
|
2801
|
-
this._darkTheme =
|
|
3702
|
+
setDarkTheme(t) {
|
|
3703
|
+
this._darkTheme = t, this._systemMode === "dark" && this.updateTheme();
|
|
2802
3704
|
}
|
|
2803
3705
|
/**
|
|
2804
3706
|
* Get the current system theme
|
|
@@ -2816,53 +3718,53 @@ class Mo {
|
|
|
2816
3718
|
* Update the theme
|
|
2817
3719
|
*/
|
|
2818
3720
|
updateTheme() {
|
|
2819
|
-
const
|
|
2820
|
-
this.setTheme(
|
|
3721
|
+
const t = this._userMode === "system" ? this._systemMode : this._userMode, e = t === "light" ? this._lightTheme : this._darkTheme, i = dn(t, e);
|
|
3722
|
+
this.setTheme(i);
|
|
2821
3723
|
}
|
|
2822
3724
|
/**
|
|
2823
3725
|
* Set the theme and notify all listeners
|
|
2824
3726
|
*/
|
|
2825
|
-
setTheme(
|
|
2826
|
-
|
|
2827
|
-
detail: { theme:
|
|
3727
|
+
setTheme(t) {
|
|
3728
|
+
t !== this._theme && (this._theme = t, this._target.dispatchEvent(new CustomEvent(this.THEME_CHANGE_EVENT, {
|
|
3729
|
+
detail: { theme: t }
|
|
2828
3730
|
})));
|
|
2829
3731
|
}
|
|
2830
3732
|
/**
|
|
2831
3733
|
* Set the mode and notify all listeners
|
|
2832
3734
|
*/
|
|
2833
|
-
setMode(
|
|
2834
|
-
this._userMode =
|
|
3735
|
+
setMode(t) {
|
|
3736
|
+
this._userMode = t, this.updateTheme();
|
|
2835
3737
|
}
|
|
2836
3738
|
/**
|
|
2837
3739
|
* Subscribe to theme changes
|
|
2838
3740
|
* @param {Function} callback - Function to run when the theme changes
|
|
2839
3741
|
* @returns {CourierInboxThemeSubscription} - Object with remove method to stop listening
|
|
2840
3742
|
*/
|
|
2841
|
-
subscribe(
|
|
3743
|
+
subscribe(t) {
|
|
2842
3744
|
const e = new AbortController();
|
|
2843
3745
|
this._target.addEventListener(this.THEME_CHANGE_EVENT, (s) => {
|
|
2844
|
-
|
|
3746
|
+
t(s.detail.theme);
|
|
2845
3747
|
}, { signal: e.signal });
|
|
2846
|
-
const
|
|
3748
|
+
const i = {
|
|
2847
3749
|
manager: this,
|
|
2848
3750
|
unsubscribe: () => {
|
|
2849
3751
|
e.abort();
|
|
2850
|
-
const s = this._subscriptions.indexOf(
|
|
3752
|
+
const s = this._subscriptions.indexOf(i);
|
|
2851
3753
|
s > -1 && this._subscriptions.splice(s, 1);
|
|
2852
3754
|
}
|
|
2853
3755
|
};
|
|
2854
|
-
return this._subscriptions.push(
|
|
3756
|
+
return this._subscriptions.push(i), i;
|
|
2855
3757
|
}
|
|
2856
3758
|
/**
|
|
2857
3759
|
* Clean up event listeners
|
|
2858
3760
|
*/
|
|
2859
3761
|
cleanup() {
|
|
2860
|
-
this._systemThemeCleanup && this._systemThemeCleanup(), this._subscriptions.forEach((
|
|
3762
|
+
this._systemThemeCleanup && this._systemThemeCleanup(), this._subscriptions.forEach((t) => t.unsubscribe()), this._subscriptions = [];
|
|
2861
3763
|
}
|
|
2862
3764
|
}
|
|
2863
|
-
class
|
|
3765
|
+
class Uo extends HTMLElement {
|
|
2864
3766
|
constructor(e) {
|
|
2865
|
-
var
|
|
3767
|
+
var i;
|
|
2866
3768
|
super();
|
|
2867
3769
|
// State
|
|
2868
3770
|
a(this, "_currentFeed", "inbox");
|
|
@@ -2884,16 +3786,16 @@ class Eo extends HTMLElement {
|
|
|
2884
3786
|
// Default props
|
|
2885
3787
|
a(this, "_defaultProps", {
|
|
2886
3788
|
title: "Inbox",
|
|
2887
|
-
icon:
|
|
3789
|
+
icon: x.inbox,
|
|
2888
3790
|
feedType: this._currentFeed,
|
|
2889
3791
|
height: "768px"
|
|
2890
3792
|
});
|
|
2891
|
-
this._shadow = this.attachShadow({ mode: "open" }), this._themeManager = e ?? new
|
|
3793
|
+
this._shadow = this.attachShadow({ mode: "open" }), this._themeManager = e ?? new zo(Te), this._header = new Ho({
|
|
2892
3794
|
themeManager: this._themeManager,
|
|
2893
3795
|
onFeedTypeChange: (s) => {
|
|
2894
3796
|
this.setFeedType(s);
|
|
2895
3797
|
}
|
|
2896
|
-
}), this._header.build(void 0), this._shadow.appendChild(this._header), this._list = new
|
|
3798
|
+
}), this._header.build(void 0), this._shadow.appendChild(this._header), this._list = new Ro({
|
|
2897
3799
|
themeManager: this._themeManager,
|
|
2898
3800
|
onRefresh: () => {
|
|
2899
3801
|
this.refresh();
|
|
@@ -2901,28 +3803,28 @@ class Eo extends HTMLElement {
|
|
|
2901
3803
|
onPaginationTrigger: async (s) => {
|
|
2902
3804
|
var o, n;
|
|
2903
3805
|
try {
|
|
2904
|
-
await
|
|
3806
|
+
await P.shared.fetchNextPageOfMessages({
|
|
2905
3807
|
feedType: s
|
|
2906
3808
|
});
|
|
2907
|
-
} catch (
|
|
2908
|
-
(n = (o =
|
|
3809
|
+
} catch (c) {
|
|
3810
|
+
(n = (o = v.shared.client) == null ? void 0 : o.options.logger) == null || n.error("Failed to fetch next page of messages:", c);
|
|
2909
3811
|
}
|
|
2910
3812
|
},
|
|
2911
3813
|
onMessageClick: (s, o) => {
|
|
2912
3814
|
var n;
|
|
2913
|
-
|
|
3815
|
+
P.shared.clickMessage({ message: s }), this.dispatchEvent(new CustomEvent("message-click", {
|
|
2914
3816
|
detail: { message: s, index: o },
|
|
2915
3817
|
bubbles: !0,
|
|
2916
3818
|
composed: !0
|
|
2917
3819
|
})), (n = this._onMessageClick) == null || n.call(this, { message: s, index: o });
|
|
2918
3820
|
},
|
|
2919
3821
|
onMessageActionClick: (s, o, n) => {
|
|
2920
|
-
var
|
|
3822
|
+
var c;
|
|
2921
3823
|
this.dispatchEvent(new CustomEvent("message-action-click", {
|
|
2922
3824
|
detail: { message: s, action: o, index: n },
|
|
2923
3825
|
bubbles: !0,
|
|
2924
3826
|
composed: !0
|
|
2925
|
-
})), (
|
|
3827
|
+
})), (c = this._onMessageActionClick) == null || c.call(this, { message: s, action: o, index: n });
|
|
2926
3828
|
},
|
|
2927
3829
|
onMessageLongPress: (s, o) => {
|
|
2928
3830
|
var n;
|
|
@@ -2932,7 +3834,7 @@ class Eo extends HTMLElement {
|
|
|
2932
3834
|
composed: !0
|
|
2933
3835
|
})), (n = this._onMessageLongPress) == null || n.call(this, { message: s, index: o });
|
|
2934
3836
|
}
|
|
2935
|
-
}), this._style = document.createElement("style"), this.refreshTheme(), this._shadow.appendChild(this._style), this._shadow.appendChild(this._list), this._datastoreListener = new
|
|
3837
|
+
}), this._style = document.createElement("style"), this.refreshTheme(), this._shadow.appendChild(this._style), this._shadow.appendChild(this._list), this._datastoreListener = new Oo({
|
|
2936
3838
|
onError: (s) => {
|
|
2937
3839
|
this._list.setError(s);
|
|
2938
3840
|
},
|
|
@@ -2954,11 +3856,11 @@ class Eo extends HTMLElement {
|
|
|
2954
3856
|
onUnreadCountChange: (s) => {
|
|
2955
3857
|
this.updateHeader();
|
|
2956
3858
|
}
|
|
2957
|
-
}),
|
|
3859
|
+
}), P.shared.addDataStoreListener(this._datastoreListener), this._themeManager.subscribe((s) => {
|
|
2958
3860
|
this.refreshTheme();
|
|
2959
|
-
}), this._authListener =
|
|
3861
|
+
}), this._authListener = v.shared.addAuthenticationListener((s) => {
|
|
2960
3862
|
this.refresh();
|
|
2961
|
-
}), (
|
|
3863
|
+
}), (i = v.shared.client) != null && i.options.userId && this.refresh();
|
|
2962
3864
|
}
|
|
2963
3865
|
get theme() {
|
|
2964
3866
|
return this._themeManager.getTheme();
|
|
@@ -3034,7 +3936,7 @@ class Eo extends HTMLElement {
|
|
|
3034
3936
|
updateHeader() {
|
|
3035
3937
|
const e = {
|
|
3036
3938
|
feedType: this._currentFeed,
|
|
3037
|
-
unreadCount:
|
|
3939
|
+
unreadCount: P.shared.unreadCount,
|
|
3038
3940
|
messageCount: this._list.messages.length
|
|
3039
3941
|
};
|
|
3040
3942
|
switch (this._headerFactory) {
|
|
@@ -3045,13 +3947,13 @@ class Eo extends HTMLElement {
|
|
|
3045
3947
|
this._header.build(null);
|
|
3046
3948
|
break;
|
|
3047
3949
|
default:
|
|
3048
|
-
const
|
|
3049
|
-
this._header.build(
|
|
3950
|
+
const i = this._headerFactory(e);
|
|
3951
|
+
this._header.build(i);
|
|
3050
3952
|
break;
|
|
3051
3953
|
}
|
|
3052
3954
|
}
|
|
3053
3955
|
async load(e) {
|
|
3054
|
-
await
|
|
3956
|
+
await P.shared.load(e);
|
|
3055
3957
|
}
|
|
3056
3958
|
refresh() {
|
|
3057
3959
|
this.load({
|
|
@@ -3063,12 +3965,12 @@ class Eo extends HTMLElement {
|
|
|
3063
3965
|
this.refresh();
|
|
3064
3966
|
}
|
|
3065
3967
|
disconnectedCallback() {
|
|
3066
|
-
var e,
|
|
3067
|
-
this._themeManager.cleanup(), (e = this._datastoreListener) == null || e.remove(), (
|
|
3968
|
+
var e, i;
|
|
3969
|
+
this._themeManager.cleanup(), (e = this._datastoreListener) == null || e.remove(), (i = this._authListener) == null || i.remove();
|
|
3068
3970
|
}
|
|
3069
|
-
attributeChangedCallback(e,
|
|
3070
|
-
var o, n,
|
|
3071
|
-
if (
|
|
3971
|
+
attributeChangedCallback(e, i, s) {
|
|
3972
|
+
var o, n, c, d, l, p;
|
|
3973
|
+
if (i !== s)
|
|
3072
3974
|
switch (e) {
|
|
3073
3975
|
case "height":
|
|
3074
3976
|
const m = s || this._defaultProps.height;
|
|
@@ -3078,8 +3980,8 @@ class Eo extends HTMLElement {
|
|
|
3078
3980
|
if (s)
|
|
3079
3981
|
try {
|
|
3080
3982
|
this._onMessageClick = new Function("props", s);
|
|
3081
|
-
} catch (
|
|
3082
|
-
(n = (o =
|
|
3983
|
+
} catch (g) {
|
|
3984
|
+
(n = (o = v.shared.client) == null ? void 0 : o.options.logger) == null || n.error("Failed to parse message-click handler:", g);
|
|
3083
3985
|
}
|
|
3084
3986
|
else
|
|
3085
3987
|
this._onMessageClick = void 0;
|
|
@@ -3088,8 +3990,8 @@ class Eo extends HTMLElement {
|
|
|
3088
3990
|
if (s)
|
|
3089
3991
|
try {
|
|
3090
3992
|
this._onMessageActionClick = new Function("props", s);
|
|
3091
|
-
} catch (
|
|
3092
|
-
(d = (
|
|
3993
|
+
} catch (g) {
|
|
3994
|
+
(d = (c = v.shared.client) == null ? void 0 : c.options.logger) == null || d.error("Failed to parse message-action-click handler:", g);
|
|
3093
3995
|
}
|
|
3094
3996
|
else
|
|
3095
3997
|
this._onMessageActionClick = void 0;
|
|
@@ -3098,8 +4000,8 @@ class Eo extends HTMLElement {
|
|
|
3098
4000
|
if (s)
|
|
3099
4001
|
try {
|
|
3100
4002
|
this._onMessageLongPress = new Function("props", s);
|
|
3101
|
-
} catch (
|
|
3102
|
-
(
|
|
4003
|
+
} catch (g) {
|
|
4004
|
+
(p = (l = v.shared.client) == null ? void 0 : l.options.logger) == null || p.error("Failed to parse message-long-press handler:", g);
|
|
3103
4005
|
}
|
|
3104
4006
|
else
|
|
3105
4007
|
this._onMessageLongPress = void 0;
|
|
@@ -3116,8 +4018,8 @@ class Eo extends HTMLElement {
|
|
|
3116
4018
|
}
|
|
3117
4019
|
}
|
|
3118
4020
|
}
|
|
3119
|
-
customElements.get("courier-inbox") || customElements.define("courier-inbox",
|
|
3120
|
-
class
|
|
4021
|
+
customElements.get("courier-inbox") || customElements.define("courier-inbox", Uo);
|
|
4022
|
+
class No extends De {
|
|
3121
4023
|
constructor(e) {
|
|
3122
4024
|
super();
|
|
3123
4025
|
// Theme
|
|
@@ -3126,12 +4028,12 @@ class Io extends Le {
|
|
|
3126
4028
|
a(this, "_container");
|
|
3127
4029
|
a(this, "_triggerButton");
|
|
3128
4030
|
a(this, "_unreadCountBadge");
|
|
3129
|
-
this._themeSubscription = e.subscribe((
|
|
4031
|
+
this._themeSubscription = e.subscribe((i) => {
|
|
3130
4032
|
this.updateTheme();
|
|
3131
4033
|
});
|
|
3132
4034
|
}
|
|
3133
4035
|
defaultElement() {
|
|
3134
|
-
this._container = document.createElement("div"), this._container.className = "menu-button-container", this._triggerButton = new
|
|
4036
|
+
this._container = document.createElement("div"), this._container.className = "menu-button-container", this._triggerButton = new $e(x.inbox), this._unreadCountBadge = new qe({
|
|
3135
4037
|
themeBus: this._themeSubscription.manager,
|
|
3136
4038
|
location: "button"
|
|
3137
4039
|
}), this._unreadCountBadge.id = "unread-badge";
|
|
@@ -3154,20 +4056,20 @@ class Io extends Le {
|
|
|
3154
4056
|
`;
|
|
3155
4057
|
}
|
|
3156
4058
|
onUnreadCountChange(e) {
|
|
3157
|
-
var
|
|
3158
|
-
(
|
|
4059
|
+
var i;
|
|
4060
|
+
(i = this._unreadCountBadge) == null || i.setCount(e), this.updateTheme();
|
|
3159
4061
|
}
|
|
3160
4062
|
updateTheme() {
|
|
3161
|
-
var
|
|
4063
|
+
var i, s, o, n, c, d, l, p, m, g, f, _, b, C, k, w, S, I;
|
|
3162
4064
|
const e = this._themeSubscription.manager.getTheme();
|
|
3163
|
-
(n = this._triggerButton) == null || n.updateIconColor(((o = (s = (
|
|
4065
|
+
(n = this._triggerButton) == null || n.updateIconColor(((o = (s = (i = e == null ? void 0 : e.popup) == null ? void 0 : i.button) == null ? void 0 : s.icon) == null ? void 0 : o.color) ?? r.black[500]), (p = this._triggerButton) == null || p.updateIconSVG(((l = (d = (c = e == null ? void 0 : e.popup) == null ? void 0 : c.button) == null ? void 0 : d.icon) == null ? void 0 : l.svg) ?? x.inbox), (f = this._triggerButton) == null || f.updateBackgroundColor(((g = (m = e == null ? void 0 : e.popup) == null ? void 0 : m.button) == null ? void 0 : g.backgroundColor) ?? "transparent"), (C = this._triggerButton) == null || C.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]), (I = this._unreadCountBadge) == null || I.refreshTheme("button");
|
|
3164
4066
|
}
|
|
3165
4067
|
disconnectedCallback() {
|
|
3166
4068
|
this._themeSubscription.unsubscribe();
|
|
3167
4069
|
}
|
|
3168
4070
|
}
|
|
3169
|
-
customElements.get("courier-inbox-menu-button") || customElements.define("courier-inbox-menu-button",
|
|
3170
|
-
class
|
|
4071
|
+
customElements.get("courier-inbox-menu-button") || customElements.define("courier-inbox-menu-button", No);
|
|
4072
|
+
class un extends HTMLElement {
|
|
3171
4073
|
constructor() {
|
|
3172
4074
|
super();
|
|
3173
4075
|
// State
|
|
@@ -3179,7 +4081,7 @@ class Fo extends HTMLElement {
|
|
|
3179
4081
|
a(this, "_bottom", "40px");
|
|
3180
4082
|
a(this, "_left", "0");
|
|
3181
4083
|
// Theming
|
|
3182
|
-
a(this, "_themeManager", new
|
|
4084
|
+
a(this, "_themeManager", new zo(Te));
|
|
3183
4085
|
// Components
|
|
3184
4086
|
a(this, "_triggerButton");
|
|
3185
4087
|
a(this, "_popup");
|
|
@@ -3190,7 +4092,7 @@ class Fo extends HTMLElement {
|
|
|
3190
4092
|
// Factories
|
|
3191
4093
|
a(this, "_popupMenuButtonFactory");
|
|
3192
4094
|
const e = this.attachShadow({ mode: "open" });
|
|
3193
|
-
this._triggerButton = new
|
|
4095
|
+
this._triggerButton = new No(this._themeManager), this._triggerButton.build(void 0), this._popup = document.createElement("div"), this._popup.className = "popup", this._inbox = new Uo(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 Oo(this), P.shared.addDataStoreListener(this._datastoreListener), this._themeManager.subscribe((i) => {
|
|
3194
4096
|
this.refreshTheme();
|
|
3195
4097
|
});
|
|
3196
4098
|
}
|
|
@@ -3210,7 +4112,7 @@ class Fo extends HTMLElement {
|
|
|
3210
4112
|
this._style.textContent = this.getStyles();
|
|
3211
4113
|
}
|
|
3212
4114
|
getStyles() {
|
|
3213
|
-
var e,
|
|
4115
|
+
var e, i, s, o, n, c, d, l;
|
|
3214
4116
|
return `
|
|
3215
4117
|
:host {
|
|
3216
4118
|
display: inline-block;
|
|
@@ -3225,10 +4127,10 @@ class Fo extends HTMLElement {
|
|
|
3225
4127
|
.popup {
|
|
3226
4128
|
display: none;
|
|
3227
4129
|
position: absolute;
|
|
3228
|
-
background: ${((
|
|
4130
|
+
background: ${((i = (e = this.theme.popup) == null ? void 0 : e.window) == null ? void 0 : i.backgroundColor) ?? "red"};
|
|
3229
4131
|
border-radius: ${((o = (s = this.theme.popup) == null ? void 0 : s.window) == null ? void 0 : o.borderRadius) ?? "8px"};
|
|
3230
|
-
border: ${((
|
|
3231
|
-
box-shadow: ${((
|
|
4132
|
+
border: ${((c = (n = this.theme.popup) == null ? void 0 : n.window) == null ? void 0 : c.border) ?? "1px solid red"};
|
|
4133
|
+
box-shadow: ${((l = (d = this.theme.popup) == null ? void 0 : d.window) == null ? void 0 : l.shadow) ?? "0px 8px 16px -4px red"};
|
|
3232
4134
|
z-index: 1000;
|
|
3233
4135
|
width: ${this._width};
|
|
3234
4136
|
height: ${this._height};
|
|
@@ -3249,7 +4151,7 @@ class Fo extends HTMLElement {
|
|
|
3249
4151
|
}
|
|
3250
4152
|
`;
|
|
3251
4153
|
}
|
|
3252
|
-
attributeChangedCallback(e,
|
|
4154
|
+
attributeChangedCallback(e, i, s) {
|
|
3253
4155
|
switch (e) {
|
|
3254
4156
|
case "popup-alignment":
|
|
3255
4157
|
this.isValidPosition(s) && (this._popupAlignment = s, this.updatePopupPosition());
|
|
@@ -3348,12 +4250,12 @@ class Fo extends HTMLElement {
|
|
|
3348
4250
|
setContent(e) {
|
|
3349
4251
|
this._inbox.innerHTML = "", this._inbox.appendChild(e);
|
|
3350
4252
|
}
|
|
3351
|
-
setSize(e,
|
|
3352
|
-
this._width = e, this._height =
|
|
4253
|
+
setSize(e, i) {
|
|
4254
|
+
this._width = e, this._height = i, this._popup.style.width = e, this._popup.style.height = i;
|
|
3353
4255
|
}
|
|
3354
4256
|
setPosition(e) {
|
|
3355
|
-
var
|
|
3356
|
-
this.isValidPosition(e) ? (this._popupAlignment = e, this.updatePopupPosition()) : (s = (
|
|
4257
|
+
var i, s;
|
|
4258
|
+
this.isValidPosition(e) ? (this._popupAlignment = e, this.updatePopupPosition()) : (s = (i = v.shared.client) == null ? void 0 : i.options.logger) == null || s.error(`Invalid position: ${e}`);
|
|
3357
4259
|
}
|
|
3358
4260
|
setFeedType(e) {
|
|
3359
4261
|
this._inbox.setFeedType(e);
|
|
@@ -3384,15 +4286,15 @@ class Fo extends HTMLElement {
|
|
|
3384
4286
|
this._popupMenuButtonFactory = e, this.render();
|
|
3385
4287
|
}
|
|
3386
4288
|
render() {
|
|
3387
|
-
const e =
|
|
4289
|
+
const e = P.shared.unreadCount;
|
|
3388
4290
|
switch (this._popupMenuButtonFactory) {
|
|
3389
4291
|
case void 0:
|
|
3390
4292
|
case null:
|
|
3391
4293
|
this._triggerButton.build(void 0), this._triggerButton.onUnreadCountChange(e);
|
|
3392
4294
|
break;
|
|
3393
4295
|
default:
|
|
3394
|
-
const
|
|
3395
|
-
this._triggerButton.build(
|
|
4296
|
+
const i = this._popupMenuButtonFactory({ unreadCount: e });
|
|
4297
|
+
this._triggerButton.build(i);
|
|
3396
4298
|
break;
|
|
3397
4299
|
}
|
|
3398
4300
|
}
|
|
@@ -3401,39 +4303,39 @@ class Fo extends HTMLElement {
|
|
|
3401
4303
|
(e = this._datastoreListener) == null || e.remove(), this._themeManager.cleanup();
|
|
3402
4304
|
}
|
|
3403
4305
|
}
|
|
3404
|
-
customElements.get("courier-inbox-menu") || customElements.define("courier-inbox-menu",
|
|
3405
|
-
class
|
|
3406
|
-
onDataSetChange(
|
|
4306
|
+
customElements.get("courier-inbox-menu") || customElements.define("courier-inbox-menu", un);
|
|
4307
|
+
class xn {
|
|
4308
|
+
onDataSetChange(t, e) {
|
|
3407
4309
|
}
|
|
3408
|
-
onPageAdded(
|
|
4310
|
+
onPageAdded(t, e) {
|
|
3409
4311
|
}
|
|
3410
|
-
onUnreadCountChange(
|
|
4312
|
+
onUnreadCountChange(t) {
|
|
3411
4313
|
}
|
|
3412
|
-
onMessageAdd(
|
|
4314
|
+
onMessageAdd(t, e, i) {
|
|
3413
4315
|
}
|
|
3414
|
-
onMessageRemove(
|
|
4316
|
+
onMessageRemove(t, e, i) {
|
|
3415
4317
|
}
|
|
3416
|
-
onMessageUpdate(
|
|
4318
|
+
onMessageUpdate(t, e, i) {
|
|
3417
4319
|
}
|
|
3418
|
-
onError(
|
|
4320
|
+
onError(t) {
|
|
3419
4321
|
}
|
|
3420
4322
|
}
|
|
3421
4323
|
export {
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
4324
|
+
Uo as CourierInbox,
|
|
4325
|
+
Oo as CourierInboxDataStoreListener,
|
|
4326
|
+
P as CourierInboxDatastore,
|
|
4327
|
+
xn as CourierInboxDatastoreEvents,
|
|
4328
|
+
Ho as CourierInboxHeader,
|
|
4329
|
+
un as CourierInboxMenu,
|
|
4330
|
+
zo as CourierInboxThemeManager,
|
|
4331
|
+
Ao as CourierListItem,
|
|
4332
|
+
_n as archiveMessage,
|
|
4333
|
+
bn as clickMessage,
|
|
4334
|
+
Oe as defaultDarkTheme,
|
|
4335
|
+
Te as defaultLightTheme,
|
|
4336
|
+
ln as getMessageTime,
|
|
4337
|
+
gn as markAsRead,
|
|
4338
|
+
mn as markAsUnread,
|
|
4339
|
+
dn as mergeTheme,
|
|
4340
|
+
fn as openMessage
|
|
3439
4341
|
};
|