react-notify-sdk 1.0.44 → 1.0.45

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.
@@ -16,6 +16,13 @@ const FeatureMessage = ({ message, onDismiss }) => {
16
16
  const b = bigint & 255;
17
17
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
18
18
  }
19
+ // spaNavigate.ts
20
+ const spaNavigate = (path) => {
21
+ if (window.location.pathname === path)
22
+ return;
23
+ window.history.pushState({}, "", path);
24
+ window.dispatchEvent(new PopStateEvent("popstate"));
25
+ };
19
26
  // Handle click with tracking
20
27
  const handleClick = async (e) => {
21
28
  // Don't trigger if clicking close button
@@ -27,7 +34,7 @@ const FeatureMessage = ({ message, onDismiss }) => {
27
34
  switch (action) {
28
35
  case 'navigate':
29
36
  if (message.click_url) {
30
- window.location.href = message.click_url;
37
+ spaNavigate(`${message.click_url}`);
31
38
  }
32
39
  break;
33
40
  case 'external':
@@ -84,7 +91,7 @@ const FeatureMessage = ({ message, onDismiss }) => {
84
91
  display: "flex", // flex flex-col
85
92
  flexDirection: "column",
86
93
  borderRightWidth: "1px", // border-r
87
- borderRightColor: "white"
94
+ borderRightColor: `${message?.textColor}`
88
95
  }, children: [_jsxs("div", { style: {
89
96
  position: "relative", // relative
90
97
  width: "100%", // w-full
@@ -95,7 +102,7 @@ const FeatureMessage = ({ message, onDismiss }) => {
95
102
  ), message?.type === "Warning" && (_jsx(AlertTriangle, { size: 16, style: { color: "#f59e0b" } }) // text-amber-500
96
103
  ), message?.type === "Error" && (_jsx(CircleX, { size: 16, style: { color: "#ef4444" } }) // text-red-500
97
104
  ), _jsx("p", { style: {
98
- color: message?.textColor,
105
+ color: `${message?.textColor}`,
99
106
  fontSize: "1.125rem", // text-lg
100
107
  fontWeight: 600, // font-semibold
101
108
  marginLeft: "0.75rem" // ml-3
@@ -118,7 +125,7 @@ const FeatureMessage = ({ message, onDismiss }) => {
118
125
  alignItems: "center" // items-center
119
126
  }, children: _jsx("p", { style: {
120
127
  fontSize: "1rem", // text-base
121
- color: `${message?.borderColor}`,
128
+ color: `${message?.textColor}`,
122
129
  cursor: "pointer"
123
130
  }, onClick: message?.click_action ? handleClick : undefined, onMouseEnter: (e) => (e.currentTarget.style.color = `${message?.borderColor}`), onMouseLeave: (e) => (e.currentTarget.style.color = "white"), children: `${filterButton(message)}` }) })] }));
124
131
  };
@@ -45,6 +45,7 @@ export const FeatureMessageProvider = ({ projectKey, }) => {
45
45
  messageUpdatedAt: message.updated_at,
46
46
  };
47
47
  localStorage.setItem(DISMISSED_KEY, JSON.stringify(dismissed));
48
+ setVisible(false);
48
49
  };
49
50
  const isDismissed = (message) => {
50
51
  const dismissed = getDismissedMessages()[message.id];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-notify-sdk",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
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",