react-notify-sdk 1.0.38 → 1.0.40
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/FadeWrapper.d.ts +3 -2
- package/dist/FadeWrapper.js +17 -14
- package/dist/FeatureMessageProvider.js +1 -8
- package/dist/index.js +0 -3
- package/package.json +1 -1
package/dist/FadeWrapper.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { FeatureMessages } from './types';
|
|
|
3
3
|
interface FadeWrapperProps {
|
|
4
4
|
visible: boolean;
|
|
5
5
|
message: FeatureMessages;
|
|
6
|
-
device: string;
|
|
6
|
+
device: string | null;
|
|
7
|
+
children: React.ReactNode;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
declare const FadeWrapper: React.FC<FadeWrapperProps>;
|
|
9
10
|
export default FadeWrapper;
|
package/dist/FadeWrapper.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const FadeWrapper = ({ visible, message, device, children }) => {
|
|
3
|
+
const width = device === 'Mobile' ? '95%' : '420px';
|
|
4
|
+
const top = message?.position === 'top' ? '24px' : 'auto';
|
|
5
|
+
const bottom = message?.position === 'bottom' ? '24px' : 'auto';
|
|
6
|
+
return (_jsx("div", { style: {
|
|
7
|
+
opacity: visible ? 1 : 0,
|
|
8
|
+
transition: 'opacity 0.3s ease',
|
|
9
|
+
position: 'fixed',
|
|
10
|
+
width: width,
|
|
11
|
+
top: top,
|
|
12
|
+
bottom: bottom,
|
|
13
|
+
left: '50%',
|
|
14
|
+
transform: 'translateX(-50%)',
|
|
15
|
+
zIndex: 9999,
|
|
16
|
+
}, children: children }));
|
|
17
|
+
};
|
|
15
18
|
export default FadeWrapper;
|
|
@@ -18,11 +18,7 @@ const routeMatches = (pattern, path) => {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
export const FeatureMessageProvider = ({ projectKey,
|
|
22
|
-
//className,
|
|
23
|
-
//style,
|
|
24
|
-
//disableDefaultStyles = true,
|
|
25
|
-
}) => {
|
|
21
|
+
export const FeatureMessageProvider = ({ projectKey, }) => {
|
|
26
22
|
const [message, setMessage] = useState(null);
|
|
27
23
|
const [visible, setVisible] = useState(false);
|
|
28
24
|
const [pathname, setPathname] = useState(() => typeof window !== 'undefined' ? window.location.pathname : '');
|
|
@@ -67,8 +63,6 @@ export const FeatureMessageProvider = ({ projectKey,
|
|
|
67
63
|
.eq('route', pathname)
|
|
68
64
|
.eq('is_active', true)
|
|
69
65
|
.order('created_at', { ascending: false });
|
|
70
|
-
//.limit(1)
|
|
71
|
-
//.single();
|
|
72
66
|
const match = data?.find((msg) => routeMatches(msg.route, pathname));
|
|
73
67
|
if (match) {
|
|
74
68
|
setMessage(match);
|
|
@@ -105,6 +99,5 @@ export const FeatureMessageProvider = ({ projectKey,
|
|
|
105
99
|
}, [pathname, projectKey]);
|
|
106
100
|
if (!message)
|
|
107
101
|
return null;
|
|
108
|
-
//const defaultClasses = `absolute ${message?.position}-6 left-1/2 transform -translate-x-1/2 z-20 w-full md:w-[${message?.width}%] px-3 py-1 bg-[${message?.backgroundColor}] border border-[${message?.borderColor}] text-[${message?.textColor}] rounded-lg shadow`;
|
|
109
102
|
return (_jsx(FadeWrapper, { visible: visible, device: device, message: message, children: _jsx(FeatureMessage, { message: message }) }));
|
|
110
103
|
};
|
package/dist/index.js
CHANGED