mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 11:51:14 -05:00
Fix Novu API import error
This commit is contained in:
@@ -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/api@0.0.7";
|
import { Novu } from "npm:@novu/api@1.6.0";
|
||||||
|
|
||||||
// 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
|
||||||
@@ -22,8 +22,7 @@ serve(async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const novu = new Novu({
|
const novu = new Novu({
|
||||||
apiKey: novuApiKey,
|
secretKey: novuApiKey
|
||||||
baseURL: Deno.env.get('VITE_NOVU_API_URL') || 'https://api.novu.co',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Parse and validate request body
|
// Parse and validate request body
|
||||||
|
|||||||
2
supabase/functions/deno.d.ts
vendored
2
supabase/functions/deno.d.ts
vendored
@@ -20,7 +20,7 @@ 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/api@0.0.7' {
|
declare module 'npm:@novu/api@1.6.0' {
|
||||||
export * from '@novu/api';
|
export * from '@novu/api';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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/api@0.0.7";
|
import { Novu } from "npm:@novu/api@1.6.0";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
@@ -25,8 +25,7 @@ serve(async (req) => {
|
|||||||
const supabase = createClient(supabaseUrl, supabaseServiceKey);
|
const supabase = createClient(supabaseUrl, supabaseServiceKey);
|
||||||
|
|
||||||
const novu = new Novu({
|
const novu = new Novu({
|
||||||
apiKey: novuApiKey,
|
secretKey: 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/api@0.0.7";
|
import { Novu } from "npm:@novu/api@1.6.0";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
@@ -19,16 +19,18 @@ serve(async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const novu = new Novu({
|
const novu = new Novu({
|
||||||
apiKey: novuApiKey,
|
secretKey: 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.events.trigger(workflowId, {
|
const result = await novu.trigger({
|
||||||
to: subscriberId,
|
to: {
|
||||||
|
subscriberId,
|
||||||
|
},
|
||||||
|
workflowId,
|
||||||
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/api@0.0.7";
|
import { Novu } from "npm:@novu/api@1.6.0";
|
||||||
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 = {
|
||||||
@@ -22,8 +22,7 @@ serve(async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const novu = new Novu({
|
const novu = new Novu({
|
||||||
apiKey: novuApiKey,
|
secretKey: 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/api@0.0.7";
|
import { Novu } from "npm:@novu/api@1.6.0";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
@@ -19,8 +19,7 @@ serve(async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const novu = new Novu({
|
const novu = new Novu({
|
||||||
apiKey: novuApiKey,
|
secretKey: 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