@notificationapi/react 0.0.34 → 0.0.35
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 +1 -1
- package/dist/assets/AntdIcon.js +1 -1
- package/dist/assets/CloseOutlined.js +13 -0
- package/dist/assets/Notification.js +17 -16
- package/dist/assets/PreferenceInput.js +1470 -0
- package/dist/assets/PurePanel.js +32 -42
- package/dist/assets/WebPushOptInMessage.js +478 -0
- package/dist/assets/button.js +50 -50
- package/dist/assets/colors.js +25 -20840
- package/dist/assets/compact-item.js +860 -0
- package/dist/assets/index.js +11 -9
- package/dist/assets/index2.js +10 -9
- package/dist/assets/index3.js +2303 -3150
- package/dist/assets/presets.js +22 -22
- package/dist/assets/reactNode.js +20821 -0
- package/dist/components/Notifications/Inbox.js +81 -78
- package/dist/components/Notifications/NotificationFeed.js +59 -31
- package/dist/components/Notifications/NotificationLauncher.js +61 -41
- package/dist/components/Notifications/NotificationPopup.js +72 -65
- package/dist/components/Preferences/NotificationPreferencesInline.d.ts +1 -1
- package/dist/components/Preferences/NotificationPreferencesInline.js +39 -5
- package/dist/components/Preferences/NotificationPreferencesPopup.d.ts +1 -1
- package/dist/components/Preferences/NotificationPreferencesPopup.js +463 -464
- package/dist/components/Preferences/PreferenceInput.js +5 -1466
- package/dist/components/Preferences/Preferences.js +24 -23
- package/dist/components/Provider/index.d.ts +9 -1
- package/dist/components/Provider/index.js +209 -154
- package/dist/components/WebPush/WebPushOptInMessage.d.ts +14 -0
- package/dist/components/WebPush/WebPushOptInMessage.js +8 -0
- package/package.json +2 -2
|
@@ -2,11 +2,12 @@ import { jsxs as re, Fragment as V, jsx as z } from "react/jsx-runtime";
|
|
|
2
2
|
import { NotificationAPIContext as le } from "../Provider/index.js";
|
|
3
3
|
import * as M from "react";
|
|
4
4
|
import h, { useContext as se } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { P as W } from "../../assets/PreferenceInput.js";
|
|
6
6
|
import { R as ce } from "../../assets/RightOutlined.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { f as J, c as D, b as K, e as Q, a as T, w as de, d as ue } from "../../assets/presets.js";
|
|
8
|
+
import { e as fe, d as me, f as Y, a as Z, g as ve, m as pe, u as R, r as ge, h as Ce, c as X } from "../../assets/reactNode.js";
|
|
9
|
+
import { t as ee, u as be, a as ye, o as q } from "../../assets/compact-item.js";
|
|
10
|
+
import { K as F, e as he } from "../../assets/index3.js";
|
|
10
11
|
import { p as xe } from "../../assets/pickAttrs.js";
|
|
11
12
|
var ne = /* @__PURE__ */ h.forwardRef(function(e, n) {
|
|
12
13
|
var a = e.prefixCls, t = e.forceRender, o = e.className, c = e.style, v = e.children, l = e.isActive, u = e.role, i = e.classNames, C = e.styles, f = h.useState(l || t), d = J(f, 2), r = d[0], g = d[1];
|
|
@@ -27,14 +28,14 @@ var Ie = ["showArrow", "headerClass", "isActive", "onItemClick", "forceRender",
|
|
|
27
28
|
var a = e.showArrow, t = a === void 0 ? !0 : a, o = e.headerClass, c = e.isActive, v = e.onItemClick, l = e.forceRender, u = e.className, i = e.classNames, C = i === void 0 ? {} : i, f = e.styles, d = f === void 0 ? {} : f, r = e.prefixCls, g = e.collapsible, x = e.accordion, s = e.panelKey, b = e.extra, $ = e.header, N = e.expandIcon, p = e.openMotion, S = e.destroyInactivePanel, y = e.children, E = Q(e, Ie), P = g === "disabled", w = g === "header", A = g === "icon", m = b != null && typeof b != "boolean", I = function() {
|
|
28
29
|
v == null || v(s);
|
|
29
30
|
}, O = function(B) {
|
|
30
|
-
(B.key === "Enter" || B.keyCode ===
|
|
31
|
-
},
|
|
31
|
+
(B.key === "Enter" || B.keyCode === F.ENTER || B.which === F.ENTER) && I();
|
|
32
|
+
}, _ = typeof N == "function" ? N(e) : /* @__PURE__ */ h.createElement("i", {
|
|
32
33
|
className: "arrow"
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
+
_ && (_ = /* @__PURE__ */ h.createElement("div", {
|
|
35
36
|
className: "".concat(r, "-expand-icon"),
|
|
36
37
|
onClick: ["header", "icon"].includes(g) ? I : void 0
|
|
37
|
-
},
|
|
38
|
+
}, _));
|
|
38
39
|
var H = D(K(K(K({}, "".concat(r, "-item"), !0), "".concat(r, "-item-active"), c), "".concat(r, "-item-disabled"), P), u), G = D(o, K(K(K({}, "".concat(r, "-header"), !0), "".concat(r, "-header-collapsible-only"), w), "".concat(r, "-icon-collapsible-only"), A), C.header), k = {
|
|
39
40
|
className: G,
|
|
40
41
|
"aria-expanded": c,
|
|
@@ -45,7 +46,7 @@ var Ie = ["showArrow", "headerClass", "isActive", "onItemClick", "forceRender",
|
|
|
45
46
|
return !w && !A && (k.onClick = I, k.role = x ? "tab" : "button", k.tabIndex = P ? -1 : 0), /* @__PURE__ */ h.createElement("div", T({}, E, {
|
|
46
47
|
ref: n,
|
|
47
48
|
className: H
|
|
48
|
-
}), /* @__PURE__ */ h.createElement("div", k, t &&
|
|
49
|
+
}), /* @__PURE__ */ h.createElement("div", k, t && _, /* @__PURE__ */ h.createElement("span", {
|
|
49
50
|
className: "".concat(r, "-header-text"),
|
|
50
51
|
onClick: g === "header" ? I : void 0
|
|
51
52
|
}, $), m && /* @__PURE__ */ h.createElement("div", {
|
|
@@ -237,7 +238,7 @@ const Ae = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
|
237
238
|
contentPadding: P,
|
|
238
239
|
fontHeight: w,
|
|
239
240
|
fontHeightLG: A
|
|
240
|
-
} = e, m = `${
|
|
241
|
+
} = e, m = `${R(i)} ${C} ${f}`;
|
|
241
242
|
return {
|
|
242
243
|
[n]: Object.assign(Object.assign({}, ge(e)), {
|
|
243
244
|
backgroundColor: o,
|
|
@@ -252,7 +253,7 @@ const Ae = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
|
252
253
|
[`
|
|
253
254
|
&,
|
|
254
255
|
& > ${n}-header`]: {
|
|
255
|
-
borderRadius: `0 0 ${
|
|
256
|
+
borderRadius: `0 0 ${R(u)} ${R(u)}`
|
|
256
257
|
}
|
|
257
258
|
},
|
|
258
259
|
[`> ${n}-header`]: {
|
|
@@ -347,7 +348,7 @@ const Ae = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
|
347
348
|
[`${n}-item:last-child`]: {
|
|
348
349
|
borderBottom: 0,
|
|
349
350
|
[`> ${n}-content`]: {
|
|
350
|
-
borderRadius: `0 0 ${
|
|
351
|
+
borderRadius: `0 0 ${R(u)} ${R(u)}`
|
|
351
352
|
}
|
|
352
353
|
},
|
|
353
354
|
[`& ${n}-item-disabled > ${n}-header`]: {
|
|
@@ -370,7 +371,7 @@ const Ae = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
|
370
371
|
}
|
|
371
372
|
})
|
|
372
373
|
};
|
|
373
|
-
},
|
|
374
|
+
}, Re = (e) => {
|
|
374
375
|
const {
|
|
375
376
|
componentCls: n
|
|
376
377
|
} = e, a = `> ${n}-item > ${n}-header ${n}-arrow`;
|
|
@@ -381,7 +382,7 @@ const Ae = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
|
381
382
|
}
|
|
382
383
|
}
|
|
383
384
|
};
|
|
384
|
-
},
|
|
385
|
+
}, _e = (e) => {
|
|
385
386
|
const {
|
|
386
387
|
componentCls: n,
|
|
387
388
|
headerBg: a,
|
|
@@ -442,11 +443,11 @@ const Ae = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
|
442
443
|
contentBg: e.colorBgContainer
|
|
443
444
|
}), De = ve("Collapse", (e) => {
|
|
444
445
|
const n = pe(e, {
|
|
445
|
-
collapseHeaderPaddingSM: `${
|
|
446
|
-
collapseHeaderPaddingLG: `${
|
|
446
|
+
collapseHeaderPaddingSM: `${R(e.paddingXS)} ${R(e.paddingSM)}`,
|
|
447
|
+
collapseHeaderPaddingLG: `${R(e.padding)} ${R(e.paddingLG)}`,
|
|
447
448
|
collapsePanelBorderRadius: e.borderRadiusLG
|
|
448
449
|
});
|
|
449
|
-
return [Oe(n),
|
|
450
|
+
return [Oe(n), _e(n), ke(n), Re(n), Me(n)];
|
|
450
451
|
}, Ke), te = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
451
452
|
const {
|
|
452
453
|
getPrefixCls: a,
|
|
@@ -492,12 +493,12 @@ const Ae = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
|
492
493
|
motionAppear: !1,
|
|
493
494
|
leavedClassName: `${s}-content-hidden`
|
|
494
495
|
}), A = M.useMemo(() => r ? ee(r).map((m, I) => {
|
|
495
|
-
var O,
|
|
496
|
+
var O, _;
|
|
496
497
|
if (!((O = m.props) === null || O === void 0) && O.disabled) {
|
|
497
|
-
const H = (
|
|
498
|
+
const H = (_ = m.key) !== null && _ !== void 0 ? _ : String(I), {
|
|
498
499
|
disabled: G,
|
|
499
500
|
collapsible: k
|
|
500
|
-
} = m.props, j = Object.assign(Object.assign({},
|
|
501
|
+
} = m.props, j = Object.assign(Object.assign({}, q(m.props, ["disabled"])), {
|
|
501
502
|
key: H,
|
|
502
503
|
collapsible: k ?? (G ? "disabled" : void 0)
|
|
503
504
|
});
|
|
@@ -510,7 +511,7 @@ const Ae = /* @__PURE__ */ M.forwardRef((e, n) => {
|
|
|
510
511
|
/* @__PURE__ */ M.createElement(L, Object.assign({
|
|
511
512
|
ref: n,
|
|
512
513
|
openMotion: w
|
|
513
|
-
},
|
|
514
|
+
}, q(e, ["rootClassName"]), {
|
|
514
515
|
expandIcon: E,
|
|
515
516
|
prefixCls: s,
|
|
516
517
|
className: P,
|
|
@@ -522,7 +523,7 @@ process.env.NODE_ENV !== "production" && (te.displayName = "Collapse");
|
|
|
522
523
|
const U = Object.assign(te, {
|
|
523
524
|
Panel: Ae
|
|
524
525
|
});
|
|
525
|
-
function
|
|
526
|
+
function qe() {
|
|
526
527
|
const e = se(le);
|
|
527
528
|
if (!e || !e.preferences)
|
|
528
529
|
return null;
|
|
@@ -580,5 +581,5 @@ function Xe() {
|
|
|
580
581
|
return /* @__PURE__ */ z(V, { children: /* @__PURE__ */ z(U, { items: n, defaultActiveKey: [] }) });
|
|
581
582
|
}
|
|
582
583
|
export {
|
|
583
|
-
|
|
584
|
+
qe as Preferences
|
|
584
585
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { NotificationAPIClientSDK } from '@notificationapi/core';
|
|
3
|
-
import { GetPreferencesResponse, InAppNotification, User, BaseDeliveryOptions, Channels, DeliveryOptionsForEmail, DeliveryOptionsForInappWeb } from '@notificationapi/core/dist/interfaces';
|
|
3
|
+
import { GetPreferencesResponse, InAppNotification, User, UserAccountMetadata, BaseDeliveryOptions, Channels, DeliveryOptionsForEmail, DeliveryOptionsForInappWeb } from '@notificationapi/core/dist/interfaces';
|
|
4
4
|
|
|
5
5
|
export type Context = {
|
|
6
6
|
notifications?: InAppNotification[];
|
|
7
7
|
preferences?: GetPreferencesResponse;
|
|
8
|
+
userAccountMetaData?: {
|
|
9
|
+
userAccountMetadata: UserAccountMetadata;
|
|
10
|
+
};
|
|
11
|
+
webPushOptInMessage?: 'AUTOMATIC' | boolean;
|
|
8
12
|
loadNotifications: (initial?: boolean) => void;
|
|
9
13
|
markAsOpened: () => void;
|
|
10
14
|
markAsArchived: (ids: string[] | 'ALL') => void;
|
|
@@ -18,6 +22,8 @@ export type Context = {
|
|
|
18
22
|
subNotificationId?: string;
|
|
19
23
|
}[]) => void;
|
|
20
24
|
getClient: () => typeof NotificationAPIClientSDK;
|
|
25
|
+
setWebPushOptInMessage: React.Dispatch<React.SetStateAction<'AUTOMATIC' | boolean>>;
|
|
26
|
+
setWebPushOptIn: React.Dispatch<React.SetStateAction<boolean>>;
|
|
21
27
|
};
|
|
22
28
|
export declare const NotificationAPIContext: import('react').Context<Context | undefined>;
|
|
23
29
|
type Props = ({
|
|
@@ -34,6 +40,8 @@ type Props = ({
|
|
|
34
40
|
playSoundOnNewNotification?: boolean;
|
|
35
41
|
newNotificationSoundPath?: string;
|
|
36
42
|
client?: typeof NotificationAPIClientSDK;
|
|
43
|
+
webPushOptInMessage?: 'AUTOMATIC' | boolean;
|
|
44
|
+
customServiceWorkerPath?: string;
|
|
37
45
|
};
|
|
38
46
|
export declare const NotificationAPIProvider: React.FunctionComponent<PropsWithChildren<Props>> & {
|
|
39
47
|
useNotificationAPIContext: typeof useNotificationAPIContext;
|