Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

chore: add open panel for analytics (#54)

Vlad Sazonau47357962c700
diff --git a/README.md b/README.md
index 9179706..6c29e82 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
# [EasyInvoicePDF](https://easyinvoicepdf.com)
-[EasyInvoicePDF](https://easyinvoicepdf.com) – Free & Open-Source Invoice Generator | Live Preview, No Sign-Up, Runs in Your Browser
+[EasyInvoicePDF](https://easyinvoicepdf.com) – Free & Open-Source Invoice Generator | Live Preview, No Sign-Up, Runs in Your Browser.
+
+If you find this project useful, consider supporting it: https://buymeacoffee.com/vladsazon
<img width="1440" alt="image" src="https://github.com/user-attachments/assets/a8b14dbb-234d-4506-9f59-232750dec642" />
@@ -14,8 +16,7 @@
- [Origin UI](https://originui.com/)
- [@react-pdf/renderer](https://github.com/diegomura/react-pdf)
-
## other tools we use
-- https://www.loglib.io/s/pdf-invoice-editor for analytics
-- Generate beautiful OG images: https://og.new/
+- Generate beautiful OG images: https://og.new
+- Analytics: https://dashboard.openpanel.dev
diff --git a/package.json b/package.json
index 59d4a5c..c169670 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
},
"dependencies": {
"@hookform/resolvers": "3.9.0",
- "@loglib/tracker": "0.8.0",
+ "@openpanel/nextjs": "1.0.7",
"@radix-ui/react-alert-dialog": "1.1.6",
"@radix-ui/react-dialog": "1.1.6",
"@radix-ui/react-label": "2.1.2",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 641f4b2..bb08675 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,9 +11,9 @@ importers:
'@hookform/resolvers':
specifier: 3.9.0
- '@loglib/tracker':
- specifier: 0.8.0
- version: 0.8.0([email protected])
+ '@openpanel/nextjs':
+ specifier: 1.0.7
'@radix-ui/react-alert-dialog':
specifier: 1.1.6
@@ -201,11 +201,6 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
- '@loglib/[email protected]':
- resolution: {integrity: sha512-WShEN7s4fcmWaWgBNmx4sDNaoLPudvfmopHxeJpWTAb4SEpypRsk4Kx143UQQEvFHE+jPQi/P3m8ennpVqFWAg==}
- peerDependencies:
- react: ^16.8||^17||^18
-
resolution: {integrity: sha512-S1qaj25Wru2dUpcIZMjxeMVSwkt8BK4dmWHHiBuRstcIyOsMapqT4A4jSB6onvqeygkSSmOkyny9VVx8JIGamQ==}
@@ -282,6 +277,19 @@ packages:
resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==}
engines: {node: '>=12.4.0'}
+ '@openpanel/[email protected]':
+ resolution: {integrity: sha512-XygTPiVlxUkcnZ3DYYwnWiogDgCL1hFK5G8nxokdrFKKuM0XQ+9mFElW/+dKgnVfmV2QiP1aAscudHAlRSUQhg==}
+ peerDependencies:
+ next: ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+
+ '@openpanel/[email protected]':
+ resolution: {integrity: sha512-FNmmfjdXoC/VHEjA+WkrQ4lyM5lxEmV7xDd57uj4E+lIS0sU3DLG2mV/dpS8AscnZbUvuMn3kPhiLCqYzuv/gg==}
+
+ '@openpanel/[email protected]':
+ resolution: {integrity: sha512-cVZ7Kr9SicczJ/RDIfEtZs8+1iGDzwkabVA/j3NqSl8VSucsC8m1+LVbjmCDzCJNnK4yVn6tEcc9PJRi2rtllw==}
+
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
@@ -2230,9 +2238,6 @@ packages:
resolution: {integrity: sha512-t20zYkrSf868+j/p31cRIGN28Phrjm3nRSLR2fyc2tiWi4cZGVdv68yNlwnIINTkMTmPoMiSlc0OadaO7DXZaQ==}
engines: {node: '>= 6'}
- resolution: {integrity: sha512-c0rhqNcHXRkY/ogGDJQxZ9Im9D19hDihbzSQJrsioex+KnFgmMzBiy57Z1EjkhX/+OjyBpclDCzz2ITtjokFmg==}
-
resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==}
@@ -2373,11 +2378,6 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0
- dependencies:
- react: 18.3.1
- web-vitals: 3.5.2
-
'@next/[email protected]': {}
@@ -2425,6 +2425,19 @@ snapshots:
'@nolyfill/[email protected]': {}
+ dependencies:
+ '@openpanel/web': 1.0.1
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+
+ '@openpanel/[email protected]': {}
+
+ '@openpanel/[email protected]':
+ dependencies:
+ '@openpanel/sdk': 1.0.0
+
optional: true
@@ -4595,8 +4608,6 @@ snapshots:
string_decoder: 1.3.0
util-deprecate: 1.0.2
-
dependencies:
is-bigint: 1.0.4
diff --git a/src/app/components/invoice-form.tsx b/src/app/components/invoice-form.tsx
index 0e324bd..a3eb865 100644
--- a/src/app/components/invoice-form.tsx
+++ b/src/app/components/invoice-form.tsx
@@ -23,7 +23,7 @@ import { Textarea } from "@/components/ui/textarea";
import { CustomTooltip } from "@/components/ui/tooltip";
import { getAmountInWords, getNumberFractionalPart } from "@/lib/utils";
import { zodResolver } from "@hookform/resolvers/zod";
-import { loglib } from "@loglib/tracker";
+import { useOpenPanel } from "@openpanel/nextjs";
import dayjs from "dayjs";
import { AlertTriangle, Plus, Trash2 } from "lucide-react";
import React, { useCallback, useEffect } from "react";
@@ -101,6 +101,8 @@ export function InvoiceForm({
invoiceData,
onInvoiceDataChange,
}: InvoiceFormProps) {
+ const openPanel = useOpenPanel();
+
const {
control,
handleSubmit,
@@ -237,13 +239,13 @@ export function InvoiceForm({
remove(index);
// analytics track event
- loglib.track("remove_invoice_item");
+ openPanel.track("remove_invoice_item");
// Manually trigger form submission after removal
const currentFormData = watch();
debouncedRegeneratePdfOnFormChange(currentFormData);
},
- [remove, watch, debouncedRegeneratePdfOnFormChange]
+ [remove, openPanel, watch, debouncedRegeneratePdfOnFormChange]
);
const onSubmit = (data: InvoiceData) => {
@@ -1591,7 +1593,7 @@ export function InvoiceForm({
type="button"
onClick={() => {
// analytics track event
- loglib.track("add_invoice_item");
+ openPanel.track("add_invoice_item");
append({
invoiceItemNumberIsVisible: true,
diff --git a/src/app/components/invoice-pdf-download-link.tsx b/src/app/components/invoice-pdf-download-link.tsx
index 3aeacad..842a668 100644
--- a/src/app/components/invoice-pdf-download-link.tsx
+++ b/src/app/components/invoice-pdf-download-link.tsx
@@ -4,11 +4,11 @@ import { useEffect, useState } from "react";
import { usePDF } from "@react-pdf/renderer";
import type { InvoiceData } from "@/app/schema";
import { InvoicePdfTemplate } from "./invoice-pdf-template";
-import { loglib } from "@loglib/tracker";
import { cn } from "@/lib/utils";
import { Loader2 } from "lucide-react";
import { LOADING_BUTTON_TEXT, LOADING_BUTTON_TIMEOUT } from "./invoice-form";
import { toast } from "sonner";
+import { useOpenPanel } from "@openpanel/nextjs";
export function InvoicePDFDownloadLink({
invoiceData,
@@ -19,6 +19,8 @@ export function InvoicePDFDownloadLink({
invoiceData.language
}-${invoiceData.invoiceNumber.replace("/", "-")}.pdf`;
+ const openPanel = useOpenPanel();
+
const [{ loading: pdfLoading, url, error }, updatePdfInstance] = usePDF();
const [isLoading, setIsLoading] = useState(false);
@@ -54,7 +56,7 @@ export function InvoicePDFDownloadLink({
download={filename}
onClick={() => {
if (!isLoading && url) {
- loglib.track("download_invoice");
+ openPanel.track("download_invoice");
}
}}
className={cn(
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index b9092d8..ee51665 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,6 +1,6 @@
import type { Metadata } from "next";
import { NuqsAdapter } from "nuqs/adapters/next/app";
-import Loglib from "@loglib/tracker/react";
+import { OpenPanelComponent } from "@openpanel/nextjs";
import "./globals.css";
import { Toaster } from "sonner";
@@ -51,12 +51,13 @@ export default function RootLayout({
<html lang="en">
<body className={`antialiased`}>
<NuqsAdapter>{children}</NuqsAdapter>
- <Loglib
- config={{
- id: "pdf-invoice-editor",
- webVitals: true,
- }}
- />
+ {/* https://openpanel.dev/docs */}
+ {process.env.NODE_ENV === "production" && (
+ <OpenPanelComponent
+ clientId="34cab0b1-c372-4d2d-9646-9a4cea67faf9"
+ trackScreenViews={true}
+ />
+ )}
{/* https://sonner.emilkowal.ski/ */}
<Toaster visibleToasts={1} richColors />
</body>