@trycourier/courier-ui-inbox 1.0.9-beta → 1.0.12-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/README.md +4 -10
- package/dist/components/courier-inbox-list-item.d.ts +4 -1
- package/dist/components/courier-inbox-list.d.ts +11 -0
- package/dist/components/courier-inbox-menu-button.d.ts +2 -2
- package/dist/components/courier-inbox-popup-menu.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +231 -151
- package/dist/index.mjs.map +1 -1
- package/dist/types/courier-inbox-theme-manager.d.ts +1 -0
- package/dist/types/courier-inbox-theme.d.ts +10 -3
- package/package.json +4 -5
package/dist/index.mjs
CHANGED
|
@@ -157,29 +157,35 @@ const baseButtonStyles = {
|
|
|
157
157
|
fontSize: "14px"
|
|
158
158
|
};
|
|
159
159
|
const CourierButtonVariants = {
|
|
160
|
-
primary: (mode) =>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
160
|
+
primary: (mode) => {
|
|
161
|
+
return {
|
|
162
|
+
...baseButtonStyles,
|
|
163
|
+
backgroundColor: theme[mode].colors.primary,
|
|
164
|
+
textColor: theme[mode].colors.secondary,
|
|
165
|
+
fontWeight: "500",
|
|
166
|
+
shadow: "none"
|
|
167
|
+
};
|
|
168
|
+
},
|
|
169
|
+
secondary: (mode) => {
|
|
170
|
+
return {
|
|
171
|
+
...baseButtonStyles,
|
|
172
|
+
backgroundColor: theme[mode].colors.secondary,
|
|
173
|
+
textColor: theme[mode].colors.primary,
|
|
174
|
+
fontWeight: "500",
|
|
175
|
+
border: `1px solid ${theme[mode].colors.border}`,
|
|
176
|
+
shadow: mode === "light" ? "0px 1px 2px 0px rgba(0, 0, 0, 0.06)" : "0px 1px 2px 0px rgba(255, 255, 255, 0.1)"
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
tertiary: (mode) => {
|
|
180
|
+
return {
|
|
181
|
+
...baseButtonStyles,
|
|
182
|
+
backgroundColor: theme[mode].colors.border,
|
|
183
|
+
textColor: theme[mode].colors.primary,
|
|
184
|
+
fontWeight: "500",
|
|
185
|
+
border: "none",
|
|
186
|
+
shadow: "none"
|
|
187
|
+
};
|
|
188
|
+
}
|
|
183
189
|
};
|
|
184
190
|
class CourierButton extends CourierSystemThemeElement {
|
|
185
191
|
constructor(props) {
|
|
@@ -206,32 +212,33 @@ class CourierButton extends CourierSystemThemeElement {
|
|
|
206
212
|
return "courier-button";
|
|
207
213
|
}
|
|
208
214
|
getStyles(props) {
|
|
215
|
+
const mode = props.mode === "system" ? this.currentSystemTheme : props.mode;
|
|
209
216
|
const defaultTextColor = () => {
|
|
210
|
-
const secondary = CourierButtonVariants.secondary(
|
|
217
|
+
const secondary = CourierButtonVariants.secondary(mode);
|
|
211
218
|
return secondary.textColor;
|
|
212
219
|
};
|
|
213
220
|
const defaultBackgroundColor = () => {
|
|
214
|
-
const secondary = CourierButtonVariants.secondary(
|
|
221
|
+
const secondary = CourierButtonVariants.secondary(mode);
|
|
215
222
|
return secondary.backgroundColor;
|
|
216
223
|
};
|
|
217
224
|
const defaultBorder = () => {
|
|
218
|
-
const secondary = CourierButtonVariants.secondary(
|
|
225
|
+
const secondary = CourierButtonVariants.secondary(mode);
|
|
219
226
|
return secondary.border;
|
|
220
227
|
};
|
|
221
228
|
const defaultShadow = () => {
|
|
222
|
-
const secondary = CourierButtonVariants.secondary(
|
|
229
|
+
const secondary = CourierButtonVariants.secondary(mode);
|
|
223
230
|
return secondary.shadow;
|
|
224
231
|
};
|
|
225
232
|
const defaultBorderRadius = () => {
|
|
226
|
-
const secondary = CourierButtonVariants.secondary(
|
|
233
|
+
const secondary = CourierButtonVariants.secondary(mode);
|
|
227
234
|
return secondary.borderRadius;
|
|
228
235
|
};
|
|
229
236
|
const defaultFontSize = () => {
|
|
230
|
-
const secondary = CourierButtonVariants.secondary(
|
|
237
|
+
const secondary = CourierButtonVariants.secondary(mode);
|
|
231
238
|
return secondary.fontSize;
|
|
232
239
|
};
|
|
233
240
|
const defaultFontWeight = () => {
|
|
234
|
-
const secondary = CourierButtonVariants.secondary(
|
|
241
|
+
const secondary = CourierButtonVariants.secondary(mode);
|
|
235
242
|
return secondary.fontWeight;
|
|
236
243
|
};
|
|
237
244
|
return `
|
|
@@ -1571,13 +1578,16 @@ const _CourierInboxDatastore = class _CourierInboxDatastore {
|
|
|
1571
1578
|
__publicField(_CourierInboxDatastore, "instance");
|
|
1572
1579
|
let CourierInboxDatastore = _CourierInboxDatastore;
|
|
1573
1580
|
class CourierInboxListItem extends CourierBaseElement {
|
|
1574
|
-
constructor(
|
|
1581
|
+
constructor(themeManager, canClick, _canLongPress) {
|
|
1575
1582
|
super();
|
|
1576
1583
|
// State
|
|
1584
|
+
__publicField(this, "_themeManager");
|
|
1577
1585
|
__publicField(this, "_theme");
|
|
1578
1586
|
__publicField(this, "_message", null);
|
|
1579
1587
|
__publicField(this, "_feedType", "inbox");
|
|
1580
1588
|
__publicField(this, "_isMobile", false);
|
|
1589
|
+
__publicField(this, "_canClick", false);
|
|
1590
|
+
// private _canLongPress: boolean = false; // Unused for now. But we can use this in the future if needed.
|
|
1581
1591
|
// Elements
|
|
1582
1592
|
__publicField(this, "_titleElement");
|
|
1583
1593
|
__publicField(this, "_subtitleElement");
|
|
@@ -1592,7 +1602,9 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1592
1602
|
__publicField(this, "onItemClick", null);
|
|
1593
1603
|
__publicField(this, "onItemLongPress", null);
|
|
1594
1604
|
__publicField(this, "onItemActionClick", null);
|
|
1595
|
-
this.
|
|
1605
|
+
this._canClick = canClick;
|
|
1606
|
+
this._themeManager = themeManager;
|
|
1607
|
+
this._theme = themeManager.getTheme();
|
|
1596
1608
|
this._isMobile = "ontouchstart" in window;
|
|
1597
1609
|
this.render();
|
|
1598
1610
|
}
|
|
@@ -1626,6 +1638,7 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1626
1638
|
this._menu.addEventListener("pointerdown", cancelPropagation);
|
|
1627
1639
|
this._menu.addEventListener("click", cancelPropagation);
|
|
1628
1640
|
this.addEventListener("click", (e) => {
|
|
1641
|
+
if (!this._canClick) return;
|
|
1629
1642
|
if (this._menu && (this._menu.contains(e.target) || e.composedPath().includes(this._menu))) {
|
|
1630
1643
|
return;
|
|
1631
1644
|
}
|
|
@@ -1635,6 +1648,9 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1635
1648
|
});
|
|
1636
1649
|
this._setupHoverBehavior();
|
|
1637
1650
|
this._setupLongPressBehavior();
|
|
1651
|
+
if (this._canClick) {
|
|
1652
|
+
this.classList.add("clickable");
|
|
1653
|
+
}
|
|
1638
1654
|
}
|
|
1639
1655
|
static getStyles(theme2) {
|
|
1640
1656
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
@@ -1647,7 +1663,7 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1647
1663
|
justify-content: space-between;
|
|
1648
1664
|
border-bottom: ${((_b = list == null ? void 0 : list.item) == null ? void 0 : _b.divider) ?? "1px solid red"};
|
|
1649
1665
|
font-family: inherit;
|
|
1650
|
-
cursor:
|
|
1666
|
+
cursor: default;
|
|
1651
1667
|
transition: background-color 0.2s ease;
|
|
1652
1668
|
margin: 0;
|
|
1653
1669
|
width: 100%;
|
|
@@ -1662,25 +1678,27 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1662
1678
|
touch-action: manipulation;
|
|
1663
1679
|
}
|
|
1664
1680
|
|
|
1665
|
-
/*
|
|
1681
|
+
/* Only apply hover/active background if clickable */
|
|
1666
1682
|
@media (hover: hover) {
|
|
1667
|
-
${CourierInboxListItem.id}:hover {
|
|
1683
|
+
${CourierInboxListItem.id}.clickable:hover {
|
|
1684
|
+
cursor: pointer;
|
|
1668
1685
|
background-color: ${((_d = list == null ? void 0 : list.item) == null ? void 0 : _d.hoverBackgroundColor) ?? "red"};
|
|
1669
1686
|
}
|
|
1670
1687
|
}
|
|
1671
1688
|
|
|
1672
|
-
${CourierInboxListItem.id}:active {
|
|
1689
|
+
${CourierInboxListItem.id}.clickable:active {
|
|
1690
|
+
cursor: pointer;
|
|
1673
1691
|
background-color: ${((_e = list == null ? void 0 : list.item) == null ? void 0 : _e.activeBackgroundColor) ?? "red"};
|
|
1674
1692
|
}
|
|
1675
1693
|
|
|
1676
1694
|
/* Menu hover / active */
|
|
1677
1695
|
@media (hover: hover) {
|
|
1678
|
-
${CourierInboxListItem.id}:hover:has(courier-inbox-list-item-menu:hover, courier-inbox-list-item-menu *:hover, courier-button:hover, courier-button *:hover) {
|
|
1696
|
+
${CourierInboxListItem.id}.clickable:hover:has(courier-inbox-list-item-menu:hover, courier-inbox-list-item-menu *:hover, courier-button:hover, courier-button *:hover) {
|
|
1679
1697
|
background-color: ${((_f = list == null ? void 0 : list.item) == null ? void 0 : _f.backgroundColor) ?? "transparent"};
|
|
1680
1698
|
}
|
|
1681
1699
|
}
|
|
1682
1700
|
|
|
1683
|
-
${CourierInboxListItem.id}:active:has(courier-inbox-list-item-menu:active, courier-inbox-list-item-menu *:active, courier-button:active, courier-button *:active) {
|
|
1701
|
+
${CourierInboxListItem.id}.clickable:active:has(courier-inbox-list-item-menu:active, courier-inbox-list-item-menu *:active, courier-button:active, courier-button *:active) {
|
|
1684
1702
|
background-color: ${((_g = list == null ? void 0 : list.item) == null ? void 0 : _g.backgroundColor) ?? "transparent"};
|
|
1685
1703
|
}
|
|
1686
1704
|
|
|
@@ -1913,9 +1931,11 @@ class CourierInboxListItem extends CourierBaseElement {
|
|
|
1913
1931
|
}
|
|
1914
1932
|
const actionsTheme = (_c = (_b = (_a = this._theme.inbox) == null ? void 0 : _a.list) == null ? void 0 : _b.item) == null ? void 0 : _c.actions;
|
|
1915
1933
|
if (this._actionsContainer && this._message.actions) {
|
|
1934
|
+
this._actionsContainer.innerHTML = "";
|
|
1916
1935
|
this._message.actions.forEach((action) => {
|
|
1917
1936
|
var _a2, _b2, _c2, _d, _e;
|
|
1918
1937
|
const actionButton = new CourierButton({
|
|
1938
|
+
mode: this._themeManager.mode,
|
|
1919
1939
|
text: action.content,
|
|
1920
1940
|
variant: "secondary",
|
|
1921
1941
|
backgroundColor: actionsTheme == null ? void 0 : actionsTheme.backgroundColor,
|
|
@@ -2194,6 +2214,8 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2194
2214
|
__publicField(this, "_isLoading", true);
|
|
2195
2215
|
__publicField(this, "_error", null);
|
|
2196
2216
|
__publicField(this, "_canPaginate", false);
|
|
2217
|
+
__publicField(this, "_canClickListItems", false);
|
|
2218
|
+
__publicField(this, "_canLongPressListItems", false);
|
|
2197
2219
|
// Callbacks
|
|
2198
2220
|
__publicField(this, "_onMessageClick", null);
|
|
2199
2221
|
__publicField(this, "_onMessageActionClick", null);
|
|
@@ -2210,6 +2232,8 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2210
2232
|
__publicField(this, "_listStyles");
|
|
2211
2233
|
__publicField(this, "_listItemStyles");
|
|
2212
2234
|
__publicField(this, "_listItemMenuStyles");
|
|
2235
|
+
__publicField(this, "_errorContainer");
|
|
2236
|
+
__publicField(this, "_emptyContainer");
|
|
2213
2237
|
this._onRefresh = props.onRefresh;
|
|
2214
2238
|
this._onPaginationTrigger = props.onPaginationTrigger;
|
|
2215
2239
|
this._onMessageClick = props.onMessageClick;
|
|
@@ -2242,6 +2266,12 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2242
2266
|
(_b = this._listItemStyles) == null ? void 0 : _b.remove();
|
|
2243
2267
|
(_c = this._listItemMenuStyles) == null ? void 0 : _c.remove();
|
|
2244
2268
|
}
|
|
2269
|
+
setCanClickListItems(canClick) {
|
|
2270
|
+
this._canClickListItems = canClick;
|
|
2271
|
+
}
|
|
2272
|
+
setCanLongPressListItems(canLongPress) {
|
|
2273
|
+
this._canLongPressListItems = canLongPress;
|
|
2274
|
+
}
|
|
2245
2275
|
static getStyles(theme2) {
|
|
2246
2276
|
var _a;
|
|
2247
2277
|
const list = (_a = theme2.inbox) == null ? void 0 : _a.list;
|
|
@@ -2312,10 +2342,75 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2312
2342
|
handleRefresh() {
|
|
2313
2343
|
this._onRefresh();
|
|
2314
2344
|
}
|
|
2345
|
+
refreshInfoStateThemes() {
|
|
2346
|
+
var _a, _b;
|
|
2347
|
+
(_a = this._emptyContainer) == null ? void 0 : _a.updateStyles(this.errorProps);
|
|
2348
|
+
(_b = this._emptyContainer) == null ? void 0 : _b.updateStyles(this.emptyProps);
|
|
2349
|
+
}
|
|
2350
|
+
get errorProps() {
|
|
2351
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
2352
|
+
const error = (_a = this.theme.inbox) == null ? void 0 : _a.error;
|
|
2353
|
+
const themeMode = this._themeSubscription.manager.mode;
|
|
2354
|
+
return {
|
|
2355
|
+
title: {
|
|
2356
|
+
text: ((_b = error == null ? void 0 : error.title) == null ? void 0 : _b.text) ?? ((_c = this._error) == null ? void 0 : _c.message),
|
|
2357
|
+
textColor: (_e = (_d = error == null ? void 0 : error.title) == null ? void 0 : _d.font) == null ? void 0 : _e.color,
|
|
2358
|
+
fontFamily: (_g = (_f = error == null ? void 0 : error.title) == null ? void 0 : _f.font) == null ? void 0 : _g.family,
|
|
2359
|
+
fontSize: (_i = (_h = error == null ? void 0 : error.title) == null ? void 0 : _h.font) == null ? void 0 : _i.size,
|
|
2360
|
+
fontWeight: (_k = (_j = error == null ? void 0 : error.title) == null ? void 0 : _j.font) == null ? void 0 : _k.weight
|
|
2361
|
+
},
|
|
2362
|
+
button: {
|
|
2363
|
+
mode: themeMode,
|
|
2364
|
+
text: (_l = error == null ? void 0 : error.button) == null ? void 0 : _l.text,
|
|
2365
|
+
backgroundColor: (_m = error == null ? void 0 : error.button) == null ? void 0 : _m.backgroundColor,
|
|
2366
|
+
hoverBackgroundColor: (_n = error == null ? void 0 : error.button) == null ? void 0 : _n.hoverBackgroundColor,
|
|
2367
|
+
activeBackgroundColor: (_o = error == null ? void 0 : error.button) == null ? void 0 : _o.activeBackgroundColor,
|
|
2368
|
+
textColor: (_q = (_p = error == null ? void 0 : error.button) == null ? void 0 : _p.font) == null ? void 0 : _q.color,
|
|
2369
|
+
fontFamily: (_s = (_r = error == null ? void 0 : error.button) == null ? void 0 : _r.font) == null ? void 0 : _s.family,
|
|
2370
|
+
fontSize: (_u = (_t = error == null ? void 0 : error.button) == null ? void 0 : _t.font) == null ? void 0 : _u.size,
|
|
2371
|
+
fontWeight: (_w = (_v = error == null ? void 0 : error.button) == null ? void 0 : _v.font) == null ? void 0 : _w.weight,
|
|
2372
|
+
shadow: (_x = error == null ? void 0 : error.button) == null ? void 0 : _x.shadow,
|
|
2373
|
+
border: (_y = error == null ? void 0 : error.button) == null ? void 0 : _y.border,
|
|
2374
|
+
borderRadius: (_z = error == null ? void 0 : error.button) == null ? void 0 : _z.borderRadius,
|
|
2375
|
+
onClick: () => this.handleRetry()
|
|
2376
|
+
}
|
|
2377
|
+
};
|
|
2378
|
+
}
|
|
2379
|
+
get emptyProps() {
|
|
2380
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
2381
|
+
const empty = (_a = this.theme.inbox) == null ? void 0 : _a.empty;
|
|
2382
|
+
const themeMode = this._themeSubscription.manager.mode;
|
|
2383
|
+
return {
|
|
2384
|
+
title: {
|
|
2385
|
+
text: ((_b = empty == null ? void 0 : empty.title) == null ? void 0 : _b.text) ?? `No ${this._feedType} messages yet`,
|
|
2386
|
+
textColor: (_d = (_c = empty == null ? void 0 : empty.title) == null ? void 0 : _c.font) == null ? void 0 : _d.color,
|
|
2387
|
+
fontFamily: (_f = (_e = empty == null ? void 0 : empty.title) == null ? void 0 : _e.font) == null ? void 0 : _f.family,
|
|
2388
|
+
fontSize: (_h = (_g = empty == null ? void 0 : empty.title) == null ? void 0 : _g.font) == null ? void 0 : _h.size,
|
|
2389
|
+
fontWeight: (_j = (_i = empty == null ? void 0 : empty.title) == null ? void 0 : _i.font) == null ? void 0 : _j.weight
|
|
2390
|
+
},
|
|
2391
|
+
button: {
|
|
2392
|
+
mode: themeMode,
|
|
2393
|
+
text: (_k = empty == null ? void 0 : empty.button) == null ? void 0 : _k.text,
|
|
2394
|
+
backgroundColor: (_l = empty == null ? void 0 : empty.button) == null ? void 0 : _l.backgroundColor,
|
|
2395
|
+
hoverBackgroundColor: (_m = empty == null ? void 0 : empty.button) == null ? void 0 : _m.hoverBackgroundColor,
|
|
2396
|
+
activeBackgroundColor: (_n = empty == null ? void 0 : empty.button) == null ? void 0 : _n.activeBackgroundColor,
|
|
2397
|
+
textColor: (_p = (_o = empty == null ? void 0 : empty.button) == null ? void 0 : _o.font) == null ? void 0 : _p.color,
|
|
2398
|
+
fontFamily: (_r = (_q = empty == null ? void 0 : empty.button) == null ? void 0 : _q.font) == null ? void 0 : _r.family,
|
|
2399
|
+
fontSize: (_t = (_s = empty == null ? void 0 : empty.button) == null ? void 0 : _s.font) == null ? void 0 : _t.size,
|
|
2400
|
+
fontWeight: (_v = (_u = empty == null ? void 0 : empty.button) == null ? void 0 : _u.font) == null ? void 0 : _v.weight,
|
|
2401
|
+
shadow: (_w = empty == null ? void 0 : empty.button) == null ? void 0 : _w.shadow,
|
|
2402
|
+
border: (_x = empty == null ? void 0 : empty.button) == null ? void 0 : _x.border,
|
|
2403
|
+
borderRadius: (_y = empty == null ? void 0 : empty.button) == null ? void 0 : _y.borderRadius,
|
|
2404
|
+
onClick: () => this.handleRefresh()
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2315
2408
|
render() {
|
|
2316
|
-
var _a, _b, _c, _d
|
|
2409
|
+
var _a, _b, _c, _d;
|
|
2317
2410
|
while (this.firstChild) {
|
|
2318
2411
|
this.removeChild(this.firstChild);
|
|
2412
|
+
this._errorContainer = void 0;
|
|
2413
|
+
this._emptyContainer = void 0;
|
|
2319
2414
|
}
|
|
2320
2415
|
if (this._listStyles) {
|
|
2321
2416
|
this._listStyles.textContent = CourierInboxList.getStyles(this.theme);
|
|
@@ -2327,67 +2422,21 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2327
2422
|
this._listItemMenuStyles.textContent = CourierInboxListItemMenu.getStyles(this.theme);
|
|
2328
2423
|
}
|
|
2329
2424
|
if (this._error) {
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
text: ((_b = error == null ? void 0 : error.title) == null ? void 0 : _b.text) ?? this._error.message,
|
|
2334
|
-
textColor: (_d = (_c = error == null ? void 0 : error.title) == null ? void 0 : _c.font) == null ? void 0 : _d.color,
|
|
2335
|
-
fontFamily: (_f = (_e = error == null ? void 0 : error.title) == null ? void 0 : _e.font) == null ? void 0 : _f.family,
|
|
2336
|
-
fontSize: (_h = (_g = error == null ? void 0 : error.title) == null ? void 0 : _g.font) == null ? void 0 : _h.size,
|
|
2337
|
-
fontWeight: (_j = (_i = error == null ? void 0 : error.title) == null ? void 0 : _i.font) == null ? void 0 : _j.weight
|
|
2338
|
-
},
|
|
2339
|
-
button: {
|
|
2340
|
-
text: (_k = error == null ? void 0 : error.button) == null ? void 0 : _k.text,
|
|
2341
|
-
backgroundColor: (_l = error == null ? void 0 : error.button) == null ? void 0 : _l.backgroundColor,
|
|
2342
|
-
hoverBackgroundColor: (_m = error == null ? void 0 : error.button) == null ? void 0 : _m.hoverBackgroundColor,
|
|
2343
|
-
activeBackgroundColor: (_n = error == null ? void 0 : error.button) == null ? void 0 : _n.activeBackgroundColor,
|
|
2344
|
-
textColor: (_p = (_o = error == null ? void 0 : error.button) == null ? void 0 : _o.font) == null ? void 0 : _p.color,
|
|
2345
|
-
fontFamily: (_r = (_q = error == null ? void 0 : error.button) == null ? void 0 : _q.font) == null ? void 0 : _r.family,
|
|
2346
|
-
fontSize: (_t = (_s = error == null ? void 0 : error.button) == null ? void 0 : _s.font) == null ? void 0 : _t.size,
|
|
2347
|
-
fontWeight: (_v = (_u = error == null ? void 0 : error.button) == null ? void 0 : _u.font) == null ? void 0 : _v.weight,
|
|
2348
|
-
shadow: (_w = error == null ? void 0 : error.button) == null ? void 0 : _w.shadow,
|
|
2349
|
-
border: (_x = error == null ? void 0 : error.button) == null ? void 0 : _x.border,
|
|
2350
|
-
borderRadius: (_y = error == null ? void 0 : error.button) == null ? void 0 : _y.borderRadius,
|
|
2351
|
-
onClick: () => this.handleRetry()
|
|
2352
|
-
}
|
|
2353
|
-
});
|
|
2354
|
-
errorElement.build((_z = this._errorStateFactory) == null ? void 0 : _z.call(this, { feedType: this._feedType, error: this._error }));
|
|
2355
|
-
this.appendChild(errorElement);
|
|
2425
|
+
this._errorContainer = new CourierInfoState(this.errorProps);
|
|
2426
|
+
this._errorContainer.build((_a = this._errorStateFactory) == null ? void 0 : _a.call(this, { feedType: this._feedType, error: this._error }));
|
|
2427
|
+
this.appendChild(this._errorContainer);
|
|
2356
2428
|
return;
|
|
2357
2429
|
}
|
|
2358
2430
|
if (this._isLoading) {
|
|
2359
2431
|
const loadingElement = new CourierInboxSkeletonList(this.theme);
|
|
2360
|
-
loadingElement.build((
|
|
2432
|
+
loadingElement.build((_b = this._loadingStateFactory) == null ? void 0 : _b.call(this, { feedType: this._feedType }));
|
|
2361
2433
|
this.appendChild(loadingElement);
|
|
2362
2434
|
return;
|
|
2363
2435
|
}
|
|
2364
2436
|
if (this._messages.length === 0) {
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
text: ((_C = empty == null ? void 0 : empty.title) == null ? void 0 : _C.text) ?? `No ${this._feedType} messages yet`,
|
|
2369
|
-
textColor: (_E = (_D = empty == null ? void 0 : empty.title) == null ? void 0 : _D.font) == null ? void 0 : _E.color,
|
|
2370
|
-
fontFamily: (_G = (_F = empty == null ? void 0 : empty.title) == null ? void 0 : _F.font) == null ? void 0 : _G.family,
|
|
2371
|
-
fontSize: (_I = (_H = empty == null ? void 0 : empty.title) == null ? void 0 : _H.font) == null ? void 0 : _I.size,
|
|
2372
|
-
fontWeight: (_K = (_J = empty == null ? void 0 : empty.title) == null ? void 0 : _J.font) == null ? void 0 : _K.weight
|
|
2373
|
-
},
|
|
2374
|
-
button: {
|
|
2375
|
-
text: (_L = empty == null ? void 0 : empty.button) == null ? void 0 : _L.text,
|
|
2376
|
-
backgroundColor: (_M = empty == null ? void 0 : empty.button) == null ? void 0 : _M.backgroundColor,
|
|
2377
|
-
hoverBackgroundColor: (_N = empty == null ? void 0 : empty.button) == null ? void 0 : _N.hoverBackgroundColor,
|
|
2378
|
-
activeBackgroundColor: (_O = empty == null ? void 0 : empty.button) == null ? void 0 : _O.activeBackgroundColor,
|
|
2379
|
-
textColor: (_Q = (_P = empty == null ? void 0 : empty.button) == null ? void 0 : _P.font) == null ? void 0 : _Q.color,
|
|
2380
|
-
fontFamily: (_S = (_R = empty == null ? void 0 : empty.button) == null ? void 0 : _R.font) == null ? void 0 : _S.family,
|
|
2381
|
-
fontSize: (_U = (_T = empty == null ? void 0 : empty.button) == null ? void 0 : _T.font) == null ? void 0 : _U.size,
|
|
2382
|
-
fontWeight: (_W = (_V = empty == null ? void 0 : empty.button) == null ? void 0 : _V.font) == null ? void 0 : _W.weight,
|
|
2383
|
-
shadow: (_X = empty == null ? void 0 : empty.button) == null ? void 0 : _X.shadow,
|
|
2384
|
-
border: (_Y = empty == null ? void 0 : empty.button) == null ? void 0 : _Y.border,
|
|
2385
|
-
borderRadius: (_Z = empty == null ? void 0 : empty.button) == null ? void 0 : _Z.borderRadius,
|
|
2386
|
-
onClick: () => this.handleRefresh()
|
|
2387
|
-
}
|
|
2388
|
-
});
|
|
2389
|
-
emptyElement.build((__ = this._emptyStateFactory) == null ? void 0 : __.call(this, { feedType: this._feedType }));
|
|
2390
|
-
this.appendChild(emptyElement);
|
|
2437
|
+
this._emptyContainer = new CourierInfoState(this.emptyProps);
|
|
2438
|
+
this._emptyContainer.build((_c = this._emptyStateFactory) == null ? void 0 : _c.call(this, { feedType: this._feedType }));
|
|
2439
|
+
this.appendChild(this._emptyContainer);
|
|
2391
2440
|
return;
|
|
2392
2441
|
}
|
|
2393
2442
|
const list = document.createElement("ul");
|
|
@@ -2397,7 +2446,7 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2397
2446
|
list.appendChild(this._listItemFactory({ message, index }));
|
|
2398
2447
|
return;
|
|
2399
2448
|
}
|
|
2400
|
-
const listItem = new CourierInboxListItem(this.
|
|
2449
|
+
const listItem = new CourierInboxListItem(this._themeSubscription.manager, this._canClickListItems, this._canLongPressListItems);
|
|
2401
2450
|
listItem.setMessage(message, this._feedType);
|
|
2402
2451
|
listItem.setOnItemClick((message2) => {
|
|
2403
2452
|
var _a2;
|
|
@@ -2416,7 +2465,7 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2416
2465
|
if (this._canPaginate) {
|
|
2417
2466
|
const paginationItem = new CourierInboxPaginationListItem({
|
|
2418
2467
|
theme: this.theme,
|
|
2419
|
-
customItem: (
|
|
2468
|
+
customItem: (_d = this._paginationItemFactory) == null ? void 0 : _d.call(this, { feedType: this._feedType }),
|
|
2420
2469
|
onPaginationTrigger: () => {
|
|
2421
2470
|
var _a2;
|
|
2422
2471
|
return (_a2 = this._onPaginationTrigger) == null ? void 0 : _a2.call(this, this._feedType);
|
|
@@ -2717,31 +2766,27 @@ class CourierUnreadCountBadge extends CourierBaseElement {
|
|
|
2717
2766
|
(_a = this._style) == null ? void 0 : _a.remove();
|
|
2718
2767
|
}
|
|
2719
2768
|
static getStyles(theme2) {
|
|
2720
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
2769
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2721
2770
|
return `
|
|
2722
2771
|
${CourierUnreadCountBadge.id} {
|
|
2723
2772
|
display: inline-block;
|
|
2724
2773
|
}
|
|
2725
2774
|
|
|
2726
2775
|
${CourierUnreadCountBadge.id} .unread-badge {
|
|
2727
|
-
padding:
|
|
2776
|
+
padding: 3px 8px;
|
|
2777
|
+
font-size: 12px;
|
|
2728
2778
|
text-align: center;
|
|
2729
2779
|
display: none;
|
|
2730
2780
|
pointer-events: none;
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
${CourierUnreadCountBadge.id} .button {
|
|
2734
|
-
background-color: ${(_c = (_b = (_a = theme2.popup) == null ? void 0 : _a.button) == null ? void 0 : _b.unreadIndicator) == null ? void 0 : _c.backgroundColor};
|
|
2735
|
-
color: ${(_g = (_f = (_e = (_d = theme2.popup) == null ? void 0 : _d.button) == null ? void 0 : _e.unreadIndicator) == null ? void 0 : _f.font) == null ? void 0 : _g.color};
|
|
2736
|
-
border-radius: ${(_j = (_i = (_h = theme2.popup) == null ? void 0 : _h.button) == null ? void 0 : _i.unreadIndicator) == null ? void 0 : _j.borderRadius};
|
|
2737
|
-
font-size: ${(_n = (_m = (_l = (_k = theme2.popup) == null ? void 0 : _k.button) == null ? void 0 : _l.unreadIndicator) == null ? void 0 : _m.font) == null ? void 0 : _n.size};
|
|
2781
|
+
min-width: 20px;
|
|
2738
2782
|
}
|
|
2739
2783
|
|
|
2740
2784
|
${CourierUnreadCountBadge.id} .header {
|
|
2741
|
-
background-color: ${(
|
|
2742
|
-
color: ${(
|
|
2743
|
-
border-radius: ${(
|
|
2744
|
-
font-size: ${(
|
|
2785
|
+
background-color: ${(_d = (_c = (_b = (_a = theme2.inbox) == null ? void 0 : _a.header) == null ? void 0 : _b.filters) == null ? void 0 : _c.unreadIndicator) == null ? void 0 : _d.backgroundColor};
|
|
2786
|
+
color: ${(_i = (_h = (_g = (_f = (_e = theme2.inbox) == null ? void 0 : _e.header) == null ? void 0 : _f.filters) == null ? void 0 : _g.unreadIndicator) == null ? void 0 : _h.font) == null ? void 0 : _i.color};
|
|
2787
|
+
border-radius: ${(_m = (_l = (_k = (_j = theme2.inbox) == null ? void 0 : _j.header) == null ? void 0 : _k.filters) == null ? void 0 : _l.unreadIndicator) == null ? void 0 : _m.borderRadius};
|
|
2788
|
+
font-size: ${(_r = (_q = (_p = (_o = (_n = theme2.inbox) == null ? void 0 : _n.header) == null ? void 0 : _o.filters) == null ? void 0 : _p.unreadIndicator) == null ? void 0 : _q.font) == null ? void 0 : _r.size};
|
|
2789
|
+
padding: ${(_v = (_u = (_t = (_s = theme2.inbox) == null ? void 0 : _s.header) == null ? void 0 : _t.filters) == null ? void 0 : _u.unreadIndicator) == null ? void 0 : _v.padding};
|
|
2745
2790
|
}
|
|
2746
2791
|
`;
|
|
2747
2792
|
}
|
|
@@ -3096,15 +3141,11 @@ const defaultLightTheme = {
|
|
|
3096
3141
|
backgroundColor: "transparent",
|
|
3097
3142
|
hoverBackgroundColor: CourierColors.black[50010],
|
|
3098
3143
|
activeBackgroundColor: CourierColors.black[50020],
|
|
3099
|
-
|
|
3100
|
-
font: {
|
|
3101
|
-
color: CourierColors.white[500],
|
|
3102
|
-
size: "14px",
|
|
3103
|
-
family: void 0,
|
|
3104
|
-
weight: void 0
|
|
3105
|
-
},
|
|
3144
|
+
unreadDotIndicator: {
|
|
3106
3145
|
backgroundColor: CourierColors.blue[500],
|
|
3107
|
-
borderRadius: "
|
|
3146
|
+
borderRadius: "50%",
|
|
3147
|
+
height: "8px",
|
|
3148
|
+
width: "8px"
|
|
3108
3149
|
}
|
|
3109
3150
|
},
|
|
3110
3151
|
window: {
|
|
@@ -3142,10 +3183,11 @@ const defaultLightTheme = {
|
|
|
3142
3183
|
font: {
|
|
3143
3184
|
color: CourierColors.white[500],
|
|
3144
3185
|
family: void 0,
|
|
3145
|
-
size: "
|
|
3186
|
+
size: "12px"
|
|
3146
3187
|
},
|
|
3147
3188
|
backgroundColor: CourierColors.blue[500],
|
|
3148
|
-
borderRadius: "
|
|
3189
|
+
borderRadius: "4px",
|
|
3190
|
+
padding: "2px 6px"
|
|
3149
3191
|
}
|
|
3150
3192
|
},
|
|
3151
3193
|
menus: {
|
|
@@ -3343,15 +3385,11 @@ const defaultDarkTheme = {
|
|
|
3343
3385
|
backgroundColor: "transparent",
|
|
3344
3386
|
hoverBackgroundColor: CourierColors.white[50010],
|
|
3345
3387
|
activeBackgroundColor: CourierColors.white[50020],
|
|
3346
|
-
|
|
3347
|
-
font: {
|
|
3348
|
-
color: CourierColors.white[500],
|
|
3349
|
-
size: "14px",
|
|
3350
|
-
family: void 0,
|
|
3351
|
-
weight: void 0
|
|
3352
|
-
},
|
|
3388
|
+
unreadDotIndicator: {
|
|
3353
3389
|
backgroundColor: CourierColors.blue[500],
|
|
3354
|
-
borderRadius: "
|
|
3390
|
+
borderRadius: "50%",
|
|
3391
|
+
height: "8px",
|
|
3392
|
+
width: "8px"
|
|
3355
3393
|
}
|
|
3356
3394
|
},
|
|
3357
3395
|
window: {
|
|
@@ -3389,10 +3427,11 @@ const defaultDarkTheme = {
|
|
|
3389
3427
|
font: {
|
|
3390
3428
|
color: CourierColors.white[500],
|
|
3391
3429
|
family: void 0,
|
|
3392
|
-
size: "
|
|
3430
|
+
size: "12px"
|
|
3393
3431
|
},
|
|
3394
3432
|
backgroundColor: CourierColors.blue[500],
|
|
3395
|
-
borderRadius: "
|
|
3433
|
+
borderRadius: "4px",
|
|
3434
|
+
padding: "3px 8px"
|
|
3396
3435
|
}
|
|
3397
3436
|
},
|
|
3398
3437
|
menus: {
|
|
@@ -3592,9 +3631,9 @@ const mergeTheme = (mode, theme2) => {
|
|
|
3592
3631
|
...(_d = (_c = defaultTheme.popup) == null ? void 0 : _c.button) == null ? void 0 : _d.icon,
|
|
3593
3632
|
...(_f = (_e = theme2.popup) == null ? void 0 : _e.button) == null ? void 0 : _f.icon
|
|
3594
3633
|
},
|
|
3595
|
-
|
|
3596
|
-
...(_h = (_g = defaultTheme.popup) == null ? void 0 : _g.button) == null ? void 0 : _h.
|
|
3597
|
-
...(_j = (_i = theme2.popup) == null ? void 0 : _i.button) == null ? void 0 : _j.
|
|
3634
|
+
unreadDotIndicator: {
|
|
3635
|
+
...(_h = (_g = defaultTheme.popup) == null ? void 0 : _g.button) == null ? void 0 : _h.unreadDotIndicator,
|
|
3636
|
+
...(_j = (_i = theme2.popup) == null ? void 0 : _i.button) == null ? void 0 : _j.unreadDotIndicator
|
|
3598
3637
|
}
|
|
3599
3638
|
},
|
|
3600
3639
|
window: {
|
|
@@ -3821,6 +3860,9 @@ class CourierInboxThemeManager {
|
|
|
3821
3860
|
this._userMode = mode;
|
|
3822
3861
|
this.updateTheme();
|
|
3823
3862
|
}
|
|
3863
|
+
get mode() {
|
|
3864
|
+
return this._userMode;
|
|
3865
|
+
}
|
|
3824
3866
|
/**
|
|
3825
3867
|
* Subscribe to theme changes
|
|
3826
3868
|
* @param {Function} callback - Function to run when the theme changes
|
|
@@ -3916,6 +3958,8 @@ class CourierInbox extends CourierBaseElement {
|
|
|
3916
3958
|
this.appendChild(this._header);
|
|
3917
3959
|
this._list = new CourierInboxList({
|
|
3918
3960
|
themeManager: this._themeManager,
|
|
3961
|
+
canClickListItems: false,
|
|
3962
|
+
canLongPressListItems: false,
|
|
3919
3963
|
onRefresh: () => {
|
|
3920
3964
|
this.refresh();
|
|
3921
3965
|
},
|
|
@@ -4026,6 +4070,8 @@ class CourierInbox extends CourierBaseElement {
|
|
|
4026
4070
|
(_d = this._unreadIndicatorStyle) == null ? void 0 : _d.remove();
|
|
4027
4071
|
}
|
|
4028
4072
|
refreshTheme() {
|
|
4073
|
+
var _a;
|
|
4074
|
+
(_a = this._list) == null ? void 0 : _a.refreshInfoStateThemes();
|
|
4029
4075
|
if (this._inboxStyle) {
|
|
4030
4076
|
this._inboxStyle.textContent = this.getStyles();
|
|
4031
4077
|
}
|
|
@@ -4078,13 +4124,17 @@ class CourierInbox extends CourierBaseElement {
|
|
|
4078
4124
|
(_a = this._list) == null ? void 0 : _a.setPaginationItemFactory(factory);
|
|
4079
4125
|
}
|
|
4080
4126
|
onMessageClick(handler) {
|
|
4127
|
+
var _a;
|
|
4081
4128
|
this._onMessageClick = handler;
|
|
4129
|
+
(_a = this._list) == null ? void 0 : _a.setCanClickListItems(handler !== void 0);
|
|
4082
4130
|
}
|
|
4083
4131
|
onMessageActionClick(handler) {
|
|
4084
4132
|
this._onMessageActionClick = handler;
|
|
4085
4133
|
}
|
|
4086
4134
|
onMessageLongPress(handler) {
|
|
4135
|
+
var _a;
|
|
4087
4136
|
this._onMessageLongPress = handler;
|
|
4137
|
+
(_a = this._list) == null ? void 0 : _a.setCanLongPressListItems(handler !== void 0);
|
|
4088
4138
|
}
|
|
4089
4139
|
setFeedType(feedType) {
|
|
4090
4140
|
var _a;
|
|
@@ -4191,7 +4241,7 @@ class CourierInboxMenuButton extends CourierFactoryElement {
|
|
|
4191
4241
|
__publicField(this, "_style");
|
|
4192
4242
|
__publicField(this, "_container");
|
|
4193
4243
|
__publicField(this, "_triggerButton");
|
|
4194
|
-
__publicField(this, "
|
|
4244
|
+
__publicField(this, "_unreadBadge");
|
|
4195
4245
|
this._themeSubscription = themeBus.subscribe((_) => {
|
|
4196
4246
|
this.refreshTheme();
|
|
4197
4247
|
});
|
|
@@ -4214,45 +4264,50 @@ class CourierInboxMenuButton extends CourierFactoryElement {
|
|
|
4214
4264
|
this._container = document.createElement("div");
|
|
4215
4265
|
this._container.className = "menu-button-container";
|
|
4216
4266
|
this._triggerButton = new CourierIconButton(CourierIconSVGs.inbox);
|
|
4217
|
-
this.
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
});
|
|
4221
|
-
this._unreadCountBadge.id = "unread-badge";
|
|
4267
|
+
this._unreadBadge = document.createElement("div");
|
|
4268
|
+
this._unreadBadge.className = "unread-badge";
|
|
4269
|
+
this._unreadBadge.style.display = "none";
|
|
4222
4270
|
this._container.appendChild(this._triggerButton);
|
|
4223
|
-
this._container.appendChild(this.
|
|
4271
|
+
this._container.appendChild(this._unreadBadge);
|
|
4224
4272
|
this.appendChild(this._container);
|
|
4225
4273
|
this.refreshTheme();
|
|
4226
4274
|
return this._container;
|
|
4227
4275
|
}
|
|
4228
|
-
static getStyles(
|
|
4276
|
+
static getStyles(theme2) {
|
|
4277
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
4229
4278
|
return `
|
|
4230
4279
|
${CourierInboxMenuButton.id} .menu-button-container {
|
|
4231
4280
|
position: relative;
|
|
4232
4281
|
display: inline-block;
|
|
4233
4282
|
}
|
|
4234
4283
|
|
|
4235
|
-
${CourierInboxMenuButton.id}
|
|
4284
|
+
${CourierInboxMenuButton.id} .unread-badge {
|
|
4236
4285
|
position: absolute;
|
|
4237
|
-
top:
|
|
4238
|
-
|
|
4286
|
+
top: 2px;
|
|
4287
|
+
right: 2px;
|
|
4239
4288
|
pointer-events: none;
|
|
4289
|
+
width: ${((_c = (_b = (_a = theme2.popup) == null ? void 0 : _a.button) == null ? void 0 : _b.unreadDotIndicator) == null ? void 0 : _c.height) ?? "8px"};
|
|
4290
|
+
height: ${((_f = (_e = (_d = theme2.popup) == null ? void 0 : _d.button) == null ? void 0 : _e.unreadDotIndicator) == null ? void 0 : _f.width) ?? "8px"};
|
|
4291
|
+
background: ${((_i = (_h = (_g = theme2.popup) == null ? void 0 : _g.button) == null ? void 0 : _h.unreadDotIndicator) == null ? void 0 : _i.backgroundColor) ?? "red"};
|
|
4292
|
+
border-radius: ${((_l = (_k = (_j = theme2.popup) == null ? void 0 : _j.button) == null ? void 0 : _k.unreadDotIndicator) == null ? void 0 : _l.borderRadius) ?? "50%"};
|
|
4293
|
+
display: none;
|
|
4294
|
+
z-index: 1;
|
|
4240
4295
|
}
|
|
4241
4296
|
`;
|
|
4242
4297
|
}
|
|
4243
4298
|
onUnreadCountChange(unreadCount) {
|
|
4244
|
-
|
|
4245
|
-
|
|
4299
|
+
if (this._unreadBadge) {
|
|
4300
|
+
this._unreadBadge.style.display = unreadCount > 0 ? "block" : "none";
|
|
4301
|
+
}
|
|
4246
4302
|
this.refreshTheme();
|
|
4247
4303
|
}
|
|
4248
4304
|
refreshTheme() {
|
|
4249
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
4305
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
4250
4306
|
(_e = this._triggerButton) == null ? void 0 : _e.updateIconColor(((_d = (_c = (_b = (_a = this.theme) == null ? void 0 : _a.popup) == null ? void 0 : _b.button) == null ? void 0 : _c.icon) == null ? void 0 : _d.color) ?? CourierColors.black[500]);
|
|
4251
4307
|
(_j = this._triggerButton) == null ? void 0 : _j.updateIconSVG(((_i = (_h = (_g = (_f = this.theme) == null ? void 0 : _f.popup) == null ? void 0 : _g.button) == null ? void 0 : _h.icon) == null ? void 0 : _i.svg) ?? CourierIconSVGs.inbox);
|
|
4252
4308
|
(_n = this._triggerButton) == null ? void 0 : _n.updateBackgroundColor(((_m = (_l = (_k = this.theme) == null ? void 0 : _k.popup) == null ? void 0 : _l.button) == null ? void 0 : _m.backgroundColor) ?? "transparent");
|
|
4253
4309
|
(_r = this._triggerButton) == null ? void 0 : _r.updateHoverBackgroundColor(((_q = (_p = (_o = this.theme) == null ? void 0 : _o.popup) == null ? void 0 : _p.button) == null ? void 0 : _q.hoverBackgroundColor) ?? CourierColors.black[50010]);
|
|
4254
4310
|
(_v = this._triggerButton) == null ? void 0 : _v.updateActiveBackgroundColor(((_u = (_t = (_s = this.theme) == null ? void 0 : _s.popup) == null ? void 0 : _t.button) == null ? void 0 : _u.activeBackgroundColor) ?? CourierColors.black[50020]);
|
|
4255
|
-
(_w = this._unreadCountBadge) == null ? void 0 : _w.refreshTheme("button");
|
|
4256
4311
|
}
|
|
4257
4312
|
}
|
|
4258
4313
|
registerElement(CourierInboxMenuButton);
|
|
@@ -4274,6 +4329,10 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4274
4329
|
__publicField(this, "_popup");
|
|
4275
4330
|
__publicField(this, "_inbox");
|
|
4276
4331
|
__publicField(this, "_style");
|
|
4332
|
+
// Inbox Handlers
|
|
4333
|
+
__publicField(this, "_onMessageClick");
|
|
4334
|
+
__publicField(this, "_onMessageActionClick");
|
|
4335
|
+
__publicField(this, "_onMessageLongPress");
|
|
4277
4336
|
// Listeners
|
|
4278
4337
|
__publicField(this, "_datastoreListener");
|
|
4279
4338
|
// Factories
|
|
@@ -4321,6 +4380,26 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4321
4380
|
this._popup.className = "popup";
|
|
4322
4381
|
this._inbox = new CourierInbox(this._themeManager);
|
|
4323
4382
|
this._inbox.setAttribute("height", "100%");
|
|
4383
|
+
if (this._inbox) {
|
|
4384
|
+
this._inbox.onMessageClick((props) => {
|
|
4385
|
+
if (this._onMessageClick) {
|
|
4386
|
+
this._onMessageClick(props);
|
|
4387
|
+
}
|
|
4388
|
+
this.closePopup();
|
|
4389
|
+
});
|
|
4390
|
+
this._inbox.onMessageActionClick((props) => {
|
|
4391
|
+
if (this._onMessageActionClick) {
|
|
4392
|
+
this._onMessageActionClick(props);
|
|
4393
|
+
}
|
|
4394
|
+
this.closePopup();
|
|
4395
|
+
});
|
|
4396
|
+
this._inbox.onMessageLongPress((props) => {
|
|
4397
|
+
if (this._onMessageLongPress) {
|
|
4398
|
+
this._onMessageLongPress(props);
|
|
4399
|
+
}
|
|
4400
|
+
this.closePopup();
|
|
4401
|
+
});
|
|
4402
|
+
}
|
|
4324
4403
|
this.refreshTheme();
|
|
4325
4404
|
this.appendChild(this._triggerButton);
|
|
4326
4405
|
this.appendChild(this._popup);
|
|
@@ -4433,16 +4512,13 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4433
4512
|
this.render();
|
|
4434
4513
|
}
|
|
4435
4514
|
onMessageClick(handler) {
|
|
4436
|
-
|
|
4437
|
-
(_a = this._inbox) == null ? void 0 : _a.onMessageClick(handler);
|
|
4515
|
+
this._onMessageClick = handler;
|
|
4438
4516
|
}
|
|
4439
4517
|
onMessageActionClick(handler) {
|
|
4440
|
-
|
|
4441
|
-
(_a = this._inbox) == null ? void 0 : _a.onMessageActionClick(handler);
|
|
4518
|
+
this._onMessageActionClick = handler;
|
|
4442
4519
|
}
|
|
4443
4520
|
onMessageLongPress(handler) {
|
|
4444
|
-
|
|
4445
|
-
(_a = this._inbox) == null ? void 0 : _a.onMessageLongPress(handler);
|
|
4521
|
+
this._onMessageLongPress = handler;
|
|
4446
4522
|
}
|
|
4447
4523
|
isValidPosition(value) {
|
|
4448
4524
|
const validPositions = [
|
|
@@ -4516,6 +4592,10 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4516
4592
|
const isVisible = this._popup.style.display === "block";
|
|
4517
4593
|
this._popup.style.display = isVisible ? "none" : "block";
|
|
4518
4594
|
}
|
|
4595
|
+
closePopup() {
|
|
4596
|
+
if (!this._popup) return;
|
|
4597
|
+
this._popup.style.display = "none";
|
|
4598
|
+
}
|
|
4519
4599
|
setContent(element) {
|
|
4520
4600
|
if (!this._inbox) return;
|
|
4521
4601
|
this._inbox.innerHTML = "";
|