react-notify-sdk 1.0.30 → 1.0.31

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,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useState } from 'react';
4
4
  import { useLocation } from 'react-router-dom';
5
5
  import NotificationMessage from './NotifyMessage';
6
- import { supabase } from './supabase/supabaseClient';
6
+ import { getSupabaseClient } from './supabase/supabaseClient';
7
7
  import useDeviceDetection from './UseDeviceDetection';
8
8
  import FadeWrapper from './FadeWrapper';
9
9
  // Wildcard route matching utility
@@ -28,6 +28,7 @@ export const NotifyProvider = ({ projectKey,
28
28
  const [visible, setVisible] = useState(false);
29
29
  const location = useLocation();
30
30
  const device = useDeviceDetection();
31
+ const supabase = getSupabaseClient();
31
32
  useEffect(() => {
32
33
  if (typeof window === 'undefined')
33
34
  return; // Skip on server
@@ -1 +1,2 @@
1
- export declare const supabase: import("@supabase/supabase-js").SupabaseClient<any, "public", any>;
1
+ import { SupabaseClient } from '@supabase/supabase-js';
2
+ export declare const getSupabaseClient: () => SupabaseClient<any, "public", any>;
@@ -2,4 +2,17 @@ import { createClient } from '@supabase/supabase-js';
2
2
  const supabaseUrl = process.env.REACT_APP_SUPABASE_URL;
3
3
  const supabaseKey = process.env.REACT_APP_SUPABASE_KEY;
4
4
  // Create a single supabase client for interacting with your database
5
- export const supabase = createClient(supabaseUrl, supabaseKey);
5
+ //export const supabase = createClient(supabaseUrl, supabaseKey)
6
+ let client = null;
7
+ export const getSupabaseClient = () => {
8
+ if (!client) {
9
+ client = createClient(supabaseUrl, supabaseKey, {
10
+ global: {
11
+ headers: {
12
+ "X-Feature-Messages": "react-notified", // debugging / tracing
13
+ },
14
+ },
15
+ });
16
+ }
17
+ return client;
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-notify-sdk",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
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",