@trycourier/courier-ui-inbox 1.0.8-beta → 1.0.9-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 +380 -0
- package/dist/components/courier-inbox-popup-menu.d.ts +10 -9
- package/dist/components/courier-inbox.d.ts +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { Courier, InboxMessageEvent } from "@trycourier/courier-js";
|
|
5
|
+
import { Courier as Courier2 } from "@trycourier/courier-js";
|
|
5
6
|
var __defProp2 = Object.defineProperty;
|
|
6
7
|
var __typeError = (msg) => {
|
|
7
8
|
throw TypeError(msg);
|
|
@@ -556,14 +557,13 @@ class CourierInfoState extends CourierFactoryElement {
|
|
|
556
557
|
__publicField2(this, "_title");
|
|
557
558
|
__publicField2(this, "_button");
|
|
558
559
|
__publicField2(this, "_style");
|
|
559
|
-
__publicField2(this, "_buttonClickCallback", null);
|
|
560
560
|
this._props = props;
|
|
561
561
|
}
|
|
562
562
|
static get id() {
|
|
563
563
|
return "courier-info-state";
|
|
564
564
|
}
|
|
565
565
|
defaultElement() {
|
|
566
|
-
var _a
|
|
566
|
+
var _a;
|
|
567
567
|
const container = document.createElement("div");
|
|
568
568
|
this._title = document.createElement("h2");
|
|
569
569
|
if ((_a = this._props.title) == null ? void 0 : _a.text) {
|
|
@@ -577,11 +577,6 @@ class CourierInfoState extends CourierFactoryElement {
|
|
|
577
577
|
container.appendChild(this._title);
|
|
578
578
|
container.appendChild(this._button);
|
|
579
579
|
this.appendChild(container);
|
|
580
|
-
(_b = this._button) == null ? void 0 : _b.addEventListener("click", () => {
|
|
581
|
-
if (this._buttonClickCallback) {
|
|
582
|
-
this._buttonClickCallback();
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
580
|
return container;
|
|
586
581
|
}
|
|
587
582
|
onSystemThemeChange(_) {
|
|
@@ -628,9 +623,6 @@ class CourierInfoState extends CourierFactoryElement {
|
|
|
628
623
|
this._button.updateButton(props.button);
|
|
629
624
|
}
|
|
630
625
|
}
|
|
631
|
-
setButtonClickCallback(callback) {
|
|
632
|
-
this._buttonClickCallback = callback;
|
|
633
|
-
}
|
|
634
626
|
}
|
|
635
627
|
class CourierIconButton extends CourierBaseElement {
|
|
636
628
|
constructor(svg, color, backgroundColor, hoverBackgroundColor, activeBackgroundColor, borderRadius, height, width) {
|
|
@@ -2355,11 +2347,11 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2355
2347
|
fontWeight: (_v = (_u = error == null ? void 0 : error.button) == null ? void 0 : _u.font) == null ? void 0 : _v.weight,
|
|
2356
2348
|
shadow: (_w = error == null ? void 0 : error.button) == null ? void 0 : _w.shadow,
|
|
2357
2349
|
border: (_x = error == null ? void 0 : error.button) == null ? void 0 : _x.border,
|
|
2358
|
-
borderRadius: (_y = error == null ? void 0 : error.button) == null ? void 0 : _y.borderRadius
|
|
2350
|
+
borderRadius: (_y = error == null ? void 0 : error.button) == null ? void 0 : _y.borderRadius,
|
|
2351
|
+
onClick: () => this.handleRetry()
|
|
2359
2352
|
}
|
|
2360
2353
|
});
|
|
2361
2354
|
errorElement.build((_z = this._errorStateFactory) == null ? void 0 : _z.call(this, { feedType: this._feedType, error: this._error }));
|
|
2362
|
-
errorElement.setButtonClickCallback(() => this.handleRetry());
|
|
2363
2355
|
this.appendChild(errorElement);
|
|
2364
2356
|
return;
|
|
2365
2357
|
}
|
|
@@ -2390,11 +2382,11 @@ class CourierInboxList extends CourierBaseElement {
|
|
|
2390
2382
|
fontWeight: (_W = (_V = empty == null ? void 0 : empty.button) == null ? void 0 : _V.font) == null ? void 0 : _W.weight,
|
|
2391
2383
|
shadow: (_X = empty == null ? void 0 : empty.button) == null ? void 0 : _X.shadow,
|
|
2392
2384
|
border: (_Y = empty == null ? void 0 : empty.button) == null ? void 0 : _Y.border,
|
|
2393
|
-
borderRadius: (_Z = empty == null ? void 0 : empty.button) == null ? void 0 : _Z.borderRadius
|
|
2385
|
+
borderRadius: (_Z = empty == null ? void 0 : empty.button) == null ? void 0 : _Z.borderRadius,
|
|
2386
|
+
onClick: () => this.handleRefresh()
|
|
2394
2387
|
}
|
|
2395
2388
|
});
|
|
2396
2389
|
emptyElement.build((__ = this._emptyStateFactory) == null ? void 0 : __.call(this, { feedType: this._feedType }));
|
|
2397
|
-
emptyElement.setButtonClickCallback(() => this.handleRefresh());
|
|
2398
2390
|
this.appendChild(emptyElement);
|
|
2399
2391
|
return;
|
|
2400
2392
|
}
|
|
@@ -2764,7 +2756,7 @@ class CourierUnreadCountBadge extends CourierBaseElement {
|
|
|
2764
2756
|
updateBadge() {
|
|
2765
2757
|
if (this._badge) {
|
|
2766
2758
|
if (this._count > 0) {
|
|
2767
|
-
this._badge.textContent = this._count.toString();
|
|
2759
|
+
this._badge.textContent = this._count > 99 ? "99+" : this._count.toString();
|
|
2768
2760
|
this._badge.style.display = "block";
|
|
2769
2761
|
} else {
|
|
2770
2762
|
this._badge.style.display = "none";
|
|
@@ -3888,7 +3880,7 @@ class CourierInbox extends CourierBaseElement {
|
|
|
3888
3880
|
title: "Inbox",
|
|
3889
3881
|
icon: CourierIconSVGs.inbox,
|
|
3890
3882
|
feedType: this._currentFeed,
|
|
3891
|
-
height: "
|
|
3883
|
+
height: "auto"
|
|
3892
3884
|
});
|
|
3893
3885
|
this._themeManager = themeManager ?? new CourierInboxThemeManager(defaultLightTheme);
|
|
3894
3886
|
}
|
|
@@ -3904,6 +3896,9 @@ class CourierInbox extends CourierBaseElement {
|
|
|
3904
3896
|
setDarkTheme(theme2) {
|
|
3905
3897
|
this._themeManager.setDarkTheme(theme2);
|
|
3906
3898
|
}
|
|
3899
|
+
setMode(mode) {
|
|
3900
|
+
this._themeManager.setMode(mode);
|
|
3901
|
+
}
|
|
3907
3902
|
static get observedAttributes() {
|
|
3908
3903
|
return ["height", "light-theme", "dark-theme", "mode", "message-click", "message-action-click", "message-long-press"];
|
|
3909
3904
|
}
|
|
@@ -4267,7 +4262,7 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4267
4262
|
// State
|
|
4268
4263
|
__publicField(this, "_width", "440px");
|
|
4269
4264
|
__publicField(this, "_height", "440px");
|
|
4270
|
-
__publicField(this, "_popupAlignment", "top-
|
|
4265
|
+
__publicField(this, "_popupAlignment", "top-left");
|
|
4271
4266
|
__publicField(this, "_top", "40px");
|
|
4272
4267
|
__publicField(this, "_right", "0");
|
|
4273
4268
|
__publicField(this, "_bottom", "40px");
|
|
@@ -4312,6 +4307,9 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4312
4307
|
setDarkTheme(theme2) {
|
|
4313
4308
|
this._themeManager.setDarkTheme(theme2);
|
|
4314
4309
|
}
|
|
4310
|
+
setMode(mode) {
|
|
4311
|
+
this._themeManager.setMode(mode);
|
|
4312
|
+
}
|
|
4315
4313
|
static get observedAttributes() {
|
|
4316
4314
|
return ["popup-alignment", "message-click", "message-action-click", "message-long-press", "popup-width", "popup-height", "top", "right", "bottom", "left", "light-theme", "dark-theme", "mode"];
|
|
4317
4315
|
}
|
|
@@ -4544,35 +4542,35 @@ class CourierInboxPopupMenu extends CourierBaseElement {
|
|
|
4544
4542
|
(_a = this._inbox) == null ? void 0 : _a.setFeedType(feedType);
|
|
4545
4543
|
}
|
|
4546
4544
|
// Factory methods
|
|
4547
|
-
|
|
4545
|
+
setHeader(factory) {
|
|
4548
4546
|
var _a;
|
|
4549
4547
|
(_a = this._inbox) == null ? void 0 : _a.setHeader(factory);
|
|
4550
4548
|
}
|
|
4551
|
-
|
|
4549
|
+
removeHeader() {
|
|
4552
4550
|
var _a;
|
|
4553
4551
|
(_a = this._inbox) == null ? void 0 : _a.removeHeader();
|
|
4554
4552
|
}
|
|
4555
|
-
|
|
4553
|
+
setLoadingState(factory) {
|
|
4556
4554
|
var _a;
|
|
4557
4555
|
(_a = this._inbox) == null ? void 0 : _a.setLoadingState(factory);
|
|
4558
4556
|
}
|
|
4559
|
-
|
|
4557
|
+
setEmptyState(factory) {
|
|
4560
4558
|
var _a;
|
|
4561
4559
|
(_a = this._inbox) == null ? void 0 : _a.setEmptyState(factory);
|
|
4562
4560
|
}
|
|
4563
|
-
|
|
4561
|
+
setErrorState(factory) {
|
|
4564
4562
|
var _a;
|
|
4565
4563
|
(_a = this._inbox) == null ? void 0 : _a.setErrorState(factory);
|
|
4566
4564
|
}
|
|
4567
|
-
|
|
4565
|
+
setListItem(factory) {
|
|
4568
4566
|
var _a;
|
|
4569
4567
|
(_a = this._inbox) == null ? void 0 : _a.setListItem(factory);
|
|
4570
4568
|
}
|
|
4571
|
-
|
|
4569
|
+
setPaginationItem(factory) {
|
|
4572
4570
|
var _a;
|
|
4573
4571
|
(_a = this._inbox) == null ? void 0 : _a.setPaginationItem(factory);
|
|
4574
4572
|
}
|
|
4575
|
-
|
|
4573
|
+
setMenuButton(factory) {
|
|
4576
4574
|
this._popupMenuButtonFactory = factory;
|
|
4577
4575
|
this.render();
|
|
4578
4576
|
}
|
|
@@ -4625,6 +4623,7 @@ class CourierInboxDatastoreEvents {
|
|
|
4625
4623
|
}
|
|
4626
4624
|
}
|
|
4627
4625
|
export {
|
|
4626
|
+
Courier2 as Courier,
|
|
4628
4627
|
CourierInbox,
|
|
4629
4628
|
CourierInboxDataStoreListener,
|
|
4630
4629
|
CourierInboxDatastore,
|