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