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.
@@ -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
- export declare const FadeWrapper: import("goober").StyledVNode<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & import("goober").DefaultTheme & FadeWrapperProps, never>>;
9
+ declare const FadeWrapper: React.FC<FadeWrapperProps>;
9
10
  export default FadeWrapper;
@@ -1,15 +1,18 @@
1
- import { styled } from "goober";
2
- import { fadeIn, fadeOut } from './animations';
3
- export const FadeWrapper = styled("div") `
4
- opacity: ${(props) => (props.visible ? 1 : 0)};
5
- animation: ${(props) => (props.visible ? fadeIn : fadeOut)} 0.3s ease forwards;
6
- transition: opacity 0.3s ease;
7
- position: absolute;
8
- width: ${(props) => props.device === 'Mobile' ? '95%' : props.device === 'Tablet' ? '420px' : '420px'};
9
- top: ${(props) => props.message?.position === 'top' ? '24px' : ''};
10
- bottom: ${(props) => props.message?.position === 'bottom' ? '24px' : ''};
11
- left: 50%;
12
- transform: translateX(-50%);
13
- z-index: 5000;
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
@@ -1,4 +1 @@
1
- import { setup } from 'goober';
2
- import { createElement } from 'react';
3
- setup(createElement);
4
1
  export { FeatureMessageProvider } from './FeatureMessageProvider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-notify-sdk",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "SDK for displaying real-time route-specific messages in React apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",