fix build
This commit is contained in:
@@ -92,6 +92,10 @@ export const EditContact: React.FC<{
|
||||
});
|
||||
|
||||
async function onContactUpdate(values: z.infer<typeof contactSchema>) {
|
||||
const properties: Record<string, string> = Object.fromEntries(
|
||||
Object.entries(variableValues).filter(([, value]) => value.trim()),
|
||||
);
|
||||
|
||||
updateContactMutation.mutate(
|
||||
{
|
||||
contactId: contact.id,
|
||||
@@ -100,11 +104,9 @@ export const EditContact: React.FC<{
|
||||
properties: replaceContactVariableValues(
|
||||
(contact.properties as Record<string, unknown> | null | undefined) ??
|
||||
{},
|
||||
Object.fromEntries(
|
||||
Object.entries(variableValues).filter(([, value]) => value.trim()),
|
||||
),
|
||||
properties,
|
||||
contactBookVariables ?? [],
|
||||
),
|
||||
) as Record<string, string>,
|
||||
},
|
||||
{
|
||||
onSuccess: async () => {
|
||||
@@ -155,7 +157,7 @@ export const EditContact: React.FC<{
|
||||
<FormField
|
||||
control={contactForm.control}
|
||||
name="firstName"
|
||||
render={({ field, formState }) => (
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>First Name</FormLabel>
|
||||
<FormControl>
|
||||
@@ -167,7 +169,7 @@ export const EditContact: React.FC<{
|
||||
<FormField
|
||||
control={contactForm.control}
|
||||
name="lastName"
|
||||
render={({ field, formState }) => (
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Last Name</FormLabel>
|
||||
<FormControl>
|
||||
|
||||
@@ -149,6 +149,7 @@ export async function updateContactBook(
|
||||
emoji?: string;
|
||||
variables?: string[];
|
||||
doubleOptInEnabled?: boolean;
|
||||
doubleOptInFrom?: string | null;
|
||||
doubleOptInSubject?: string;
|
||||
doubleOptInContent?: string;
|
||||
} = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type Contact, UnsubscribeReason } from "@prisma/client";
|
||||
import { Prisma, type Contact, UnsubscribeReason } from "@prisma/client";
|
||||
import {
|
||||
type ContactPayload,
|
||||
type ContactWebhookEventType,
|
||||
@@ -106,7 +106,7 @@ export async function addOrUpdateContact(
|
||||
email: contact.email,
|
||||
firstName: contact.firstName,
|
||||
lastName: contact.lastName,
|
||||
properties: normalizedProperties ?? {},
|
||||
properties: (normalizedProperties ?? {}) as Prisma.InputJsonObject,
|
||||
subscribed: shouldCreatePendingContact
|
||||
? false
|
||||
: (contact.subscribed ?? true),
|
||||
@@ -120,7 +120,7 @@ export async function addOrUpdateContact(
|
||||
firstName: contact.firstName,
|
||||
lastName: contact.lastName,
|
||||
...(mergedProperties !== undefined
|
||||
? { properties: mergedProperties }
|
||||
? { properties: mergedProperties as Prisma.InputJsonObject }
|
||||
: {}),
|
||||
...(subscribedValue !== undefined
|
||||
? {
|
||||
@@ -210,7 +210,7 @@ export async function updateContactInContactBook(
|
||||
data: {
|
||||
...contact,
|
||||
...(mergedProperties !== undefined
|
||||
? { properties: mergedProperties }
|
||||
? { properties: mergedProperties as Prisma.InputJsonObject }
|
||||
: {}),
|
||||
...(contact.subscribed !== undefined
|
||||
? {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { escapeHtml, toPlainHtml } from "~/server/utils/email-content";
|
||||
|
||||
describe("email-content utils", () => {
|
||||
it("escapes unsafe HTML characters", () => {
|
||||
const value = `<script>alert('x') & \"y\"</script>`;
|
||||
const value = `<script>alert('x') & "y"</script>`;
|
||||
expect(escapeHtml(value)).toBe(
|
||||
"<script>alert('x') & "y"</script>",
|
||||
);
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
import { create } from "zustand";
|
||||
import { create, type StateCreator } from "zustand";
|
||||
import { LimitReason } from "~/lib/constants/plans";
|
||||
|
||||
const createUpgradeModalActions = (
|
||||
set: Parameters<StateCreator<UpgradeModalStore>>[0],
|
||||
) => ({
|
||||
openModal: (reason?: LimitReason) => set({ isOpen: true, reason }),
|
||||
closeModal: () => set({ isOpen: false, reason: undefined }),
|
||||
});
|
||||
|
||||
interface UpgradeModalStore {
|
||||
isOpen: boolean;
|
||||
reason?: LimitReason;
|
||||
action: {
|
||||
openModal: (reason?: LimitReason) => void;
|
||||
closeModal: () => void;
|
||||
};
|
||||
action: ReturnType<typeof createUpgradeModalActions>;
|
||||
}
|
||||
|
||||
export const useUpgradeModalStore = create<UpgradeModalStore>((set) => ({
|
||||
const createUpgradeModalStore: StateCreator<UpgradeModalStore> = (set) => ({
|
||||
isOpen: false,
|
||||
reason: undefined,
|
||||
action: {
|
||||
openModal: (reason?: LimitReason) => set({ isOpen: true, reason }),
|
||||
closeModal: () => set({ isOpen: false, reason: undefined }),
|
||||
},
|
||||
}));
|
||||
action: createUpgradeModalActions(set),
|
||||
});
|
||||
|
||||
export const useUpgradeModalStore = create<UpgradeModalStore>(
|
||||
createUpgradeModalStore,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user