mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:11:13 -05:00
feat: Implement Novu package migration
This commit is contained in:
545
package-lock.json
generated
545
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -13,8 +13,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^3.10.0",
|
"@hookform/resolvers": "^3.10.0",
|
||||||
"@marsidev/react-turnstile": "^1.3.1",
|
"@marsidev/react-turnstile": "^1.3.1",
|
||||||
"@novu/headless": "^2.6.6",
|
|
||||||
"@novu/node": "^2.6.6",
|
|
||||||
"@novu/react": "^3.10.1",
|
"@novu/react": "^3.10.1",
|
||||||
"@radix-ui/react-accordion": "^1.2.11",
|
"@radix-ui/react-accordion": "^1.2.11",
|
||||||
"@radix-ui/react-alert-dialog": "^1.1.14",
|
"@radix-ui/react-alert-dialog": "^1.1.14",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
||||||
import { Novu } from "npm:@novu/node@2.0.2";
|
import { Novu } from "@novu/api";
|
||||||
|
|
||||||
// TODO: In production, restrict CORS to specific domains
|
// TODO: In production, restrict CORS to specific domains
|
||||||
// For now, allowing all origins for development flexibility
|
// For now, allowing all origins for development flexibility
|
||||||
@@ -21,8 +21,9 @@ serve(async (req) => {
|
|||||||
throw new Error('NOVU_API_KEY is not configured');
|
throw new Error('NOVU_API_KEY is not configured');
|
||||||
}
|
}
|
||||||
|
|
||||||
const novu = new Novu(novuApiKey, {
|
const novu = new Novu({
|
||||||
backendUrl: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
apiKey: novuApiKey,
|
||||||
|
baseURL: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Parse and validate request body
|
// Parse and validate request body
|
||||||
|
|||||||
4
supabase/functions/deno.d.ts
vendored
4
supabase/functions/deno.d.ts
vendored
@@ -20,8 +20,8 @@ declare module 'https://esm.sh/@supabase/supabase-js@2.57.4' {
|
|||||||
export * from '@supabase/supabase-js';
|
export * from '@supabase/supabase-js';
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'npm:@novu/node@2.0.2' {
|
declare module 'npm:@novu/api' {
|
||||||
export * from '@novu/node';
|
export * from '@novu/api';
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace Deno {
|
declare namespace Deno {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"imports": {
|
"imports": {
|
||||||
"@supabase/supabase-js": "https://esm.sh/@supabase/supabase-js@2.57.4",
|
"@supabase/supabase-js": "https://esm.sh/@supabase/supabase-js@2.57.4",
|
||||||
"std/": "https://deno.land/std@0.190.0/",
|
"std/": "https://deno.land/std@0.190.0/",
|
||||||
"@novu/node": "npm:@novu/node@2.0.2"
|
"@novu/api": "npm:@novu/api@latest"
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"rules": {
|
"rules": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.57.4";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.57.4";
|
||||||
import { Novu } from "npm:@novu/node@2.0.2";
|
import { Novu } from "@novu/api";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
@@ -24,8 +24,9 @@ serve(async (req) => {
|
|||||||
// Create Supabase client with service role for admin access
|
// Create Supabase client with service role for admin access
|
||||||
const supabase = createClient(supabaseUrl, supabaseServiceKey);
|
const supabase = createClient(supabaseUrl, supabaseServiceKey);
|
||||||
|
|
||||||
const novu = new Novu(novuApiKey, {
|
const novu = new Novu({
|
||||||
backendUrl: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
apiKey: novuApiKey,
|
||||||
|
baseURL: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch users who don't have Novu subscriber IDs
|
// Fetch users who don't have Novu subscriber IDs
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
||||||
import { Novu } from "npm:@novu/node@2.0.2";
|
import { Novu } from "@novu/api";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
@@ -18,18 +18,17 @@ serve(async (req) => {
|
|||||||
throw new Error('NOVU_API_KEY is not configured');
|
throw new Error('NOVU_API_KEY is not configured');
|
||||||
}
|
}
|
||||||
|
|
||||||
const novu = new Novu(novuApiKey, {
|
const novu = new Novu({
|
||||||
backendUrl: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
apiKey: novuApiKey,
|
||||||
|
baseURL: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
||||||
});
|
});
|
||||||
|
|
||||||
const { workflowId, subscriberId, payload, overrides } = await req.json();
|
const { workflowId, subscriberId, payload, overrides } = await req.json();
|
||||||
|
|
||||||
console.log('Triggering notification:', { workflowId, subscriberId });
|
console.log('Triggering notification:', { workflowId, subscriberId });
|
||||||
|
|
||||||
const result = await novu.trigger(workflowId, {
|
const result = await novu.events.trigger(workflowId, {
|
||||||
to: {
|
to: subscriberId,
|
||||||
subscriberId,
|
|
||||||
},
|
|
||||||
payload,
|
payload,
|
||||||
overrides,
|
overrides,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
||||||
import { Novu } from "npm:@novu/node@2.0.2";
|
import { Novu } from "@novu/api";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.57.4";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.57.4";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
@@ -21,8 +21,9 @@ serve(async (req) => {
|
|||||||
throw new Error('NOVU_API_KEY is not configured');
|
throw new Error('NOVU_API_KEY is not configured');
|
||||||
}
|
}
|
||||||
|
|
||||||
const novu = new Novu(novuApiKey, {
|
const novu = new Novu({
|
||||||
backendUrl: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
apiKey: novuApiKey,
|
||||||
|
baseURL: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
||||||
});
|
});
|
||||||
|
|
||||||
const supabase = createClient(supabaseUrl, supabaseServiceKey);
|
const supabase = createClient(supabaseUrl, supabaseServiceKey);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
||||||
import { Novu } from "npm:@novu/node@2.0.2";
|
import { Novu } from "@novu/api";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
@@ -18,8 +18,9 @@ serve(async (req) => {
|
|||||||
throw new Error('NOVU_API_KEY is not configured');
|
throw new Error('NOVU_API_KEY is not configured');
|
||||||
}
|
}
|
||||||
|
|
||||||
const novu = new Novu(novuApiKey, {
|
const novu = new Novu({
|
||||||
backendUrl: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
apiKey: novuApiKey,
|
||||||
|
baseURL: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
||||||
});
|
});
|
||||||
|
|
||||||
const { subscriberId, email, firstName, lastName, phone, avatar, data } = await req.json();
|
const { subscriberId, email, firstName, lastName, phone, avatar, data } = await req.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user