react-notify-sdk 1.0.4 → 1.0.5

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.
@@ -1,35 +1,20 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.NotifyProvider = void 0;
16
- const jsx_runtime_1 = require("react/jsx-runtime");
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
2
  // src/FeatureMessage.tsx
18
- const react_1 = require("react");
19
- const react_router_dom_1 = require("react-router-dom");
20
- const clsx_1 = __importDefault(require("clsx"));
21
- const supabaseClient_1 = require("./supabase/supabaseClient");
22
- const NotifyProvider = ({ projectId,
3
+ import { useEffect, useState } from 'react';
4
+ import { useLocation } from 'react-router-dom';
5
+ import clsx from 'clsx';
6
+ import { supabase } from './supabase/supabaseClient';
7
+ export const NotifyProvider = ({ projectId,
23
8
  //className,
24
9
  //style,
25
10
  disableDefaultStyles = false, }) => {
26
- const [message, setMessage] = (0, react_1.useState)(null);
27
- const location = (0, react_router_dom_1.useLocation)();
28
- (0, react_1.useEffect)(() => {
11
+ const [message, setMessage] = useState(null);
12
+ const location = useLocation();
13
+ useEffect(() => {
29
14
  if (typeof window === 'undefined')
30
15
  return; // Skip on server
31
- const fetchMessage = () => __awaiter(void 0, void 0, void 0, function* () {
32
- const { data } = yield supabaseClient_1.supabase
16
+ const fetchMessage = async () => {
17
+ const { data } = await supabase
33
18
  .from('feature_messages')
34
19
  .select('*')
35
20
  .eq('project_key', projectId)
@@ -39,9 +24,9 @@ disableDefaultStyles = false, }) => {
39
24
  .limit(1)
40
25
  .single();
41
26
  setMessage(data);
42
- });
27
+ };
43
28
  fetchMessage();
44
- const subscription = supabaseClient_1.supabase
29
+ const subscription = supabase
45
30
  .channel('feature_messages_channel')
46
31
  .on('postgres_changes', {
47
32
  event: '*',
@@ -55,35 +40,34 @@ disableDefaultStyles = false, }) => {
55
40
  })
56
41
  .subscribe();
57
42
  return () => {
58
- supabaseClient_1.supabase.removeChannel(subscription);
43
+ supabase.removeChannel(subscription);
59
44
  };
60
45
  }, [location.pathname, projectId]);
61
46
  if (!message)
62
47
  return null;
63
- const defaultClasses = `fixed ${message === null || message === void 0 ? void 0 : message.position}-4 left-1/2 transform -translate-x-1/2 z-50 w-[${message === null || message === void 0 ? void 0 : message.width}%] p-4 bg-[${message === null || message === void 0 ? void 0 : message.backgroundColor}] border border-[${message === null || message === void 0 ? void 0 : message.borderColor}] text-[${message === null || message === void 0 ? void 0 : message.textColor}] rounded-lg shadow`;
64
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, clsx_1.default)(!disableDefaultStyles && defaultClasses), style: disableDefaultStyles ?
48
+ const defaultClasses = `fixed ${message?.position}-4 left-1/2 transform -translate-x-1/2 z-50 w-[${message?.width}%] px-3 bg-[${message?.backgroundColor}] border border-[${message?.borderColor}] text-[${message?.textColor}] rounded-lg shadow`;
49
+ return (_jsxs("div", { className: clsx(!disableDefaultStyles && defaultClasses), style: disableDefaultStyles ?
65
50
  {
66
51
  position: 'fixed',
67
- top: (message === null || message === void 0 ? void 0 : message.position) === 'top' ? '16px' : undefined,
68
- bottom: (message === null || message === void 0 ? void 0 : message.position) === 'top' ? undefined : '16px',
52
+ top: message?.position === 'top' ? '16px' : undefined,
53
+ bottom: message?.position === 'top' ? undefined : '16px',
69
54
  left: '50%',
70
55
  transform: 'translateX(-50%)',
71
56
  zIndex: 50,
72
- width: `${message === null || message === void 0 ? void 0 : message.width}%`,
57
+ width: `${message?.width}%`,
73
58
  padding: '1rem', // p-4 = 1rem
74
- backgroundColor: message === null || message === void 0 ? void 0 : message.backgroundColor,
59
+ backgroundColor: message?.backgroundColor,
75
60
  border: '1px solid', // Completed border style
76
61
  }
77
62
  :
78
- {}, children: [(0, jsx_runtime_1.jsx)("strong", { className: `block mb-2 text-lg font-semibold text-[${message === null || message === void 0 ? void 0 : message.textColor}]`, style: {
63
+ {}, children: [_jsx("strong", { className: `block mb-2 text-lg font-semibold text-[${message?.textColor}]`, style: {
79
64
  display: 'block',
80
65
  marginBottom: '0.5rem', // mb-2 = 0.5rem
81
66
  fontSize: '1.125rem', // text-lg = 18px = 1.125rem
82
67
  fontWeight: 600, // font-semibold = 600
83
- color: `${message === null || message === void 0 ? void 0 : message.backgroundColor}`,
84
- }, children: message.title }), (0, jsx_runtime_1.jsx)("p", { className: `text-sm text-[${message === null || message === void 0 ? void 0 : message.textColor}]`, style: {
68
+ color: `${message?.backgroundColor}`,
69
+ }, children: message.title }), _jsx("p", { className: `text-sm text-[${message?.textColor}]`, style: {
85
70
  fontSize: '0.875rem', // text-sm = 14px = 0.875rem
86
- color: `${message === null || message === void 0 ? void 0 : message.backgroundColor}`,
71
+ color: `${message?.backgroundColor}`,
87
72
  }, children: message.content })] }));
88
73
  };
89
- exports.NotifyProvider = NotifyProvider;
package/dist/index.js CHANGED
@@ -1,5 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotifyProvider = void 0;
4
- var NotifyProvider_1 = require("./NotifyProvider");
5
- Object.defineProperty(exports, "NotifyProvider", { enumerable: true, get: function () { return NotifyProvider_1.NotifyProvider; } });
1
+ export { NotifyProvider } from './NotifyProvider';
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.supabase = void 0;
4
- const supabase_js_1 = require("@supabase/supabase-js");
1
+ import { createClient } from '@supabase/supabase-js';
5
2
  const supabaseUrl = process.env.REACT_APP_SUPABASE_URL;
6
3
  const supabaseKey = process.env.REACT_APP_SUPABASE_KEY;
7
4
  // Create a single supabase client for interacting with your database
8
- exports.supabase = (0, supabase_js_1.createClient)(supabaseUrl, supabaseKey);
5
+ export const supabase = createClient(supabaseUrl, supabaseKey);
package/dist/types.d.ts CHANGED
@@ -6,7 +6,6 @@ export type NotifyMessage = {
6
6
  content: string;
7
7
  position: string;
8
8
  positionValue: number;
9
- twPosition: string;
10
9
  backgroundColor: string;
11
10
  borderColor: string;
12
11
  textColor: string;
package/dist/types.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-notify-sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -56,7 +56,7 @@ export const NotifyProvider = ({
56
56
 
57
57
  if (!message) return null;
58
58
 
59
- const defaultClasses = `fixed ${message?.position}-4 left-1/2 transform -translate-x-1/2 z-50 w-[${message?.width}%] p-4 bg-[${message?.backgroundColor}] border border-[${message?.borderColor}] text-[${message?.textColor}] rounded-lg shadow`;
59
+ const defaultClasses = `fixed ${message?.position}-4 left-1/2 transform -translate-x-1/2 z-50 w-[${message?.width}%] px-3 bg-[${message?.backgroundColor}] border border-[${message?.borderColor}] text-[${message?.textColor}] rounded-lg shadow`;
60
60
 
61
61
  return (
62
62
  <div
package/src/types.ts CHANGED
@@ -6,7 +6,6 @@ export type NotifyMessage = {
6
6
  content: string;
7
7
  position: string;
8
8
  positionValue: number;
9
- twPosition: string;
10
9
  backgroundColor: string;
11
10
  borderColor: string;
12
11
  textColor: string;
package/tsconfig.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES6",
3
+ "target": "ESNext",
4
4
  //"module": "ESNext",
5
5
  "declaration": true,
6
- "outDir": "dist",
6
+ "outDir": "./dist",
7
7
  //"strict": true,
8
8
  //"esModuleInterop": true,
9
9
  "jsx": "react-jsx", // ✅ This is required for React 17+ JSX
@@ -33,9 +33,9 @@
33
33
  // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
34
34
 
35
35
  /* Modules */
36
- "module": "commonjs", /* Specify what module code is generated. */
36
+ "module": "ESNext", /* Specify what module code is generated. */
37
37
  // "rootDir": "./", /* Specify the root folder within your source files. */
38
- // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
38
+ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
39
39
  // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
40
40
  // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
41
41
  // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */