revproof 0.1.0

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.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # revproof
2
+
3
+ Drop verified revenue badges, reviews and testimonials into your React app. The
4
+ proof is rendered by RevProof (isolated iframe + shadow DOM), so it can't be
5
+ faked or restyled — you place and theme the frame, not the seal.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm i revproof
11
+ ```
12
+
13
+ ## Use
14
+
15
+ Get a **publishable key** and allow-list your domain in your RevProof dashboard →
16
+ **Embed**. The publishable key is safe to ship in frontend code — it only works
17
+ from the domains you list.
18
+
19
+ ```tsx
20
+ import { RevProofProvider, RevProofBadge, RevProofReviews, RevProofTestimonials, RevProofVerified } from "revproof";
21
+
22
+ export default function Proof() {
23
+ return (
24
+ <RevProofProvider publicKey="rp_pub_xxx">
25
+ <RevProofBadge theme="dark" size="md" />
26
+ <RevProofVerified metric="mrr" />
27
+ <RevProofReviews theme="light" columns={2} />
28
+ <RevProofTestimonials theme="brand" columns={2} />
29
+ </RevProofProvider>
30
+ );
31
+ }
32
+ ```
33
+
34
+ ## Props you can tweak
35
+
36
+ | Prop | Components | Values |
37
+ | --- | --- | --- |
38
+ | `theme` | all | `light` · `dark` · `brand` |
39
+ | `size` | badge | `sm` · `md` · `lg` |
40
+ | `columns` | reviews · testimonials | `1` · `2` · `3` |
41
+ | `limit` | reviews | number of reviews |
42
+ | `metric` | verified | `mrr` · `arr` · `revenue30d` · `customers` |
43
+ | CSS vars | reviews · testimonials · verified | `--rp-accent`, `--rp-radius`, `--rp-font` |
44
+
45
+ ### What you can't change (on purpose)
46
+
47
+ The "✓ Verified" chips, the "Verified by RevProof" seal and heading, and the
48
+ numbers/review text are locked. That's what keeps the proof credible — style the
49
+ frame, not the seal.
50
+
51
+ ## Without React
52
+
53
+ Any site can use the same widgets with one script tag:
54
+
55
+ ```html
56
+ <script src="https://revproof.app/sdk.js" data-key="rp_pub_xxx" async></script>
57
+ <revproof-badge theme="dark"></revproof-badge>
58
+ <revproof-reviews columns="2"></revproof-reviews>
59
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var react = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ var DEFAULT_ORIGIN = "https://revproof-production.up.railway.app";
8
+ var injected = false;
9
+ function useSdk(publicKey, origin) {
10
+ react.useEffect(() => {
11
+ if (injected || typeof document === "undefined") return;
12
+ injected = true;
13
+ const s = document.createElement("script");
14
+ s.src = origin.replace(/\/$/, "") + "/sdk.js";
15
+ s.async = true;
16
+ s.setAttribute("data-key", publicKey);
17
+ document.head.appendChild(s);
18
+ }, [publicKey, origin]);
19
+ }
20
+ function RevProofProvider({
21
+ publicKey,
22
+ origin = DEFAULT_ORIGIN,
23
+ children
24
+ }) {
25
+ useSdk(publicKey, origin);
26
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
27
+ }
28
+ function RevProofBadge({
29
+ publicKey,
30
+ theme,
31
+ size,
32
+ badgeStyle,
33
+ className
34
+ }) {
35
+ const ref = react.useCallback(
36
+ (el) => {
37
+ if (el && badgeStyle) el.setAttribute("style", badgeStyle);
38
+ },
39
+ [badgeStyle]
40
+ );
41
+ return /* @__PURE__ */ jsxRuntime.jsx("revproof-badge", { ref, "data-key": publicKey, theme, size, class: className });
42
+ }
43
+ function RevProofReviews({ publicKey, theme, columns, limit, className, style }) {
44
+ return /* @__PURE__ */ jsxRuntime.jsx("revproof-reviews", { "data-key": publicKey, theme, columns, limit, class: className, ...style ? { style } : {} });
45
+ }
46
+ function RevProofTestimonials({ publicKey, theme, columns, className, style }) {
47
+ return /* @__PURE__ */ jsxRuntime.jsx("revproof-testimonials", { "data-key": publicKey, theme, columns, class: className, ...style ? { style } : {} });
48
+ }
49
+ function RevProofVerified({ publicKey, theme, metric, className, style }) {
50
+ return /* @__PURE__ */ jsxRuntime.jsx("revproof-verified", { "data-key": publicKey, theme, metric, class: className, ...style ? { style } : {} });
51
+ }
52
+
53
+ exports.RevProofBadge = RevProofBadge;
54
+ exports.RevProofProvider = RevProofProvider;
55
+ exports.RevProofReviews = RevProofReviews;
56
+ exports.RevProofTestimonials = RevProofTestimonials;
57
+ exports.RevProofVerified = RevProofVerified;
58
+ //# sourceMappingURL=index.cjs.map
59
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":["useEffect","useCallback","jsx"],"mappings":";;;;;AASA,IAAM,cAAA,GAAiB,4CAAA;AACvB,IAAI,QAAA,GAAW,KAAA;AAEf,SAAS,MAAA,CAAO,WAAmB,MAAA,EAAgB;AACjD,EAAAA,eAAA,CAAU,MAAM;AACd,IAAA,IAAI,QAAA,IAAY,OAAO,QAAA,KAAa,WAAA,EAAa;AACjD,IAAA,QAAA,GAAW,IAAA;AACX,IAAA,MAAM,CAAA,GAAI,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AACzC,IAAA,CAAA,CAAE,GAAA,GAAM,MAAA,CAAO,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA,GAAI,SAAA;AACpC,IAAA,CAAA,CAAE,KAAA,GAAQ,IAAA;AACV,IAAA,CAAA,CAAE,YAAA,CAAa,YAAY,SAAS,CAAA;AACpC,IAAA,QAAA,CAAS,IAAA,CAAK,YAAY,CAAC,CAAA;AAAA,EAC7B,CAAA,EAAG,CAAC,SAAA,EAAW,MAAM,CAAC,CAAA;AACxB;AAMO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,SAAA;AAAA,EACA,MAAA,GAAS,cAAA;AAAA,EACT;AACF,CAAA,EAIG;AACD,EAAA,MAAA,CAAO,WAAW,MAAM,CAAA;AACxB,EAAA,6DAAU,QAAA,EAAS,CAAA;AACrB;AAEO,SAAS,aAAA,CAAc;AAAA,EAC5B,SAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA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ourcesContent":["\"use client\";\n// revproof — thin, SSR-safe wrappers around the RevProof web components.\n// Each component renders the underlying custom element and the provider injects\n// the SDK loader once. The verified marks are rendered by RevProof (iframe /\n// shadow DOM), so nothing here — or in the host app — can restyle or fake them.\nimport { useCallback, useEffect, type CSSProperties, type ReactNode } from \"react\";\n\n// Where the SDK (sdk.js) is served from. Override via <RevProofProvider origin>\n// if you point a custom domain at your RevProof deployment.\nconst DEFAULT_ORIGIN = \"https://revproof-production.up.railway.app\";\nlet injected = false;\n\nfunction useSdk(publicKey: string, origin: string) {\n useEffect(() => {\n if (injected || typeof document === \"undefined\") return;\n injected = true;\n const s = document.createElement(\"script\");\n s.src = origin.replace(/\\/$/, \"\") + \"/sdk.js\";\n s.async = true;\n s.setAttribute(\"data-key\", publicKey);\n document.head.appendChild(s);\n }, [publicKey, origin]);\n}\n\ntype Theme = \"light\" | \"dark\" | \"brand\";\ntype Base = { publicKey?: string; theme?: Theme; className?: string; style?: CSSProperties };\n\n/** Injects the SDK loader once. Wrap your app (or the page) with your publishable key. */\nexport function RevProofProvider({\n publicKey,\n origin = DEFAULT_ORIGIN,\n children,\n}: {\n publicKey: string;\n origin?: string;\n children?: ReactNode;\n}) {\n useSdk(publicKey, origin);\n return <>{children}</>;\n}\n\nexport function RevProofBadge({\n publicKey,\n theme,\n size,\n badgeStyle,\n className,\n}: Omit<Base, \"style\"> & { size?: \"sm\" | \"md\" | \"lg\"; badgeStyle?: \"seal\" | \"shield\" }) {\n // The SDK reads the seal/shield variant from the element's `style` attribute,\n // which React reserves for CSS objects — so set it via a ref instead of a prop.\n const ref = useCallback(\n (el: HTMLElement | null) => {\n if (el && badgeStyle) el.setAttribute(\"style\", badgeStyle);\n },\n [badgeStyle]\n );\n return <revproof-badge ref={ref} data-key={publicKey} theme={theme} size={size} class={className} />;\n}\n\nexport function RevProofReviews({ publicKey, theme, columns, limit, className, style }: Base & { columns?: 1 | 2 | 3; limit?: number }) {\n return <revproof-reviews data-key={publicKey} theme={theme} columns={columns} limit={limit} class={className} {...(style ? { style } : {})} />;\n}\n\nexport function RevProofTestimonials({ publicKey, theme, columns, className, style }: Base & { columns?: 1 | 2 }) {\n return <revproof-testimonials data-key={publicKey} theme={theme} columns={columns} class={className} {...(style ? { style } : {})} />;\n}\n\nexport function RevProofVerified({ publicKey, theme, metric, className, style }: Base & { metric?: \"mrr\" | \"arr\" | \"revenue30d\" | \"customers\" }) {\n return <revproof-verified data-key={publicKey} theme={theme} metric={metric} class={className} {...(style ? { style } : {})} />;\n}\n\n// Let TSX accept the custom elements. React 19 resolves intrinsics from the\n// `react` module's JSX namespace; React 18 uses the global one — augment both so\n// the package types work in either.\ntype RevProofElements = {\n \"revproof-badge\": Record<string, unknown>;\n \"revproof-reviews\": Record<string, unknown>;\n \"revproof-testimonials\": Record<string, unknown>;\n \"revproof-verified\": Record<string, unknown>;\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface IntrinsicElements extends RevProofElements {}\n }\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface IntrinsicElements extends RevProofElements {}\n }\n}\n"]}
@@ -0,0 +1,50 @@
1
+ import * as react from 'react';
2
+ import { CSSProperties, ReactNode } from 'react';
3
+
4
+ type Theme = "light" | "dark" | "brand";
5
+ type Base = {
6
+ publicKey?: string;
7
+ theme?: Theme;
8
+ className?: string;
9
+ style?: CSSProperties;
10
+ };
11
+ /** Injects the SDK loader once. Wrap your app (or the page) with your publishable key. */
12
+ declare function RevProofProvider({ publicKey, origin, children, }: {
13
+ publicKey: string;
14
+ origin?: string;
15
+ children?: ReactNode;
16
+ }): react.JSX.Element;
17
+ declare function RevProofBadge({ publicKey, theme, size, badgeStyle, className, }: Omit<Base, "style"> & {
18
+ size?: "sm" | "md" | "lg";
19
+ badgeStyle?: "seal" | "shield";
20
+ }): react.JSX.Element;
21
+ declare function RevProofReviews({ publicKey, theme, columns, limit, className, style }: Base & {
22
+ columns?: 1 | 2 | 3;
23
+ limit?: number;
24
+ }): react.JSX.Element;
25
+ declare function RevProofTestimonials({ publicKey, theme, columns, className, style }: Base & {
26
+ columns?: 1 | 2;
27
+ }): react.JSX.Element;
28
+ declare function RevProofVerified({ publicKey, theme, metric, className, style }: Base & {
29
+ metric?: "mrr" | "arr" | "revenue30d" | "customers";
30
+ }): react.JSX.Element;
31
+ type RevProofElements = {
32
+ "revproof-badge": Record<string, unknown>;
33
+ "revproof-reviews": Record<string, unknown>;
34
+ "revproof-testimonials": Record<string, unknown>;
35
+ "revproof-verified": Record<string, unknown>;
36
+ };
37
+ declare global {
38
+ namespace JSX {
39
+ interface IntrinsicElements extends RevProofElements {
40
+ }
41
+ }
42
+ }
43
+ declare module "react" {
44
+ namespace JSX {
45
+ interface IntrinsicElements extends RevProofElements {
46
+ }
47
+ }
48
+ }
49
+
50
+ export { RevProofBadge, RevProofProvider, RevProofReviews, RevProofTestimonials, RevProofVerified };
@@ -0,0 +1,50 @@
1
+ import * as react from 'react';
2
+ import { CSSProperties, ReactNode } from 'react';
3
+
4
+ type Theme = "light" | "dark" | "brand";
5
+ type Base = {
6
+ publicKey?: string;
7
+ theme?: Theme;
8
+ className?: string;
9
+ style?: CSSProperties;
10
+ };
11
+ /** Injects the SDK loader once. Wrap your app (or the page) with your publishable key. */
12
+ declare function RevProofProvider({ publicKey, origin, children, }: {
13
+ publicKey: string;
14
+ origin?: string;
15
+ children?: ReactNode;
16
+ }): react.JSX.Element;
17
+ declare function RevProofBadge({ publicKey, theme, size, badgeStyle, className, }: Omit<Base, "style"> & {
18
+ size?: "sm" | "md" | "lg";
19
+ badgeStyle?: "seal" | "shield";
20
+ }): react.JSX.Element;
21
+ declare function RevProofReviews({ publicKey, theme, columns, limit, className, style }: Base & {
22
+ columns?: 1 | 2 | 3;
23
+ limit?: number;
24
+ }): react.JSX.Element;
25
+ declare function RevProofTestimonials({ publicKey, theme, columns, className, style }: Base & {
26
+ columns?: 1 | 2;
27
+ }): react.JSX.Element;
28
+ declare function RevProofVerified({ publicKey, theme, metric, className, style }: Base & {
29
+ metric?: "mrr" | "arr" | "revenue30d" | "customers";
30
+ }): react.JSX.Element;
31
+ type RevProofElements = {
32
+ "revproof-badge": Record<string, unknown>;
33
+ "revproof-reviews": Record<string, unknown>;
34
+ "revproof-testimonials": Record<string, unknown>;
35
+ "revproof-verified": Record<string, unknown>;
36
+ };
37
+ declare global {
38
+ namespace JSX {
39
+ interface IntrinsicElements extends RevProofElements {
40
+ }
41
+ }
42
+ }
43
+ declare module "react" {
44
+ namespace JSX {
45
+ interface IntrinsicElements extends RevProofElements {
46
+ }
47
+ }
48
+ }
49
+
50
+ export { RevProofBadge, RevProofProvider, RevProofReviews, RevProofTestimonials, RevProofVerified };
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { useCallback, useEffect } from 'react';
3
+ import { jsx, Fragment } from 'react/jsx-runtime';
4
+
5
+ var DEFAULT_ORIGIN = "https://revproof-production.up.railway.app";
6
+ var injected = false;
7
+ function useSdk(publicKey, origin) {
8
+ useEffect(() => {
9
+ if (injected || typeof document === "undefined") return;
10
+ injected = true;
11
+ const s = document.createElement("script");
12
+ s.src = origin.replace(/\/$/, "") + "/sdk.js";
13
+ s.async = true;
14
+ s.setAttribute("data-key", publicKey);
15
+ document.head.appendChild(s);
16
+ }, [publicKey, origin]);
17
+ }
18
+ function RevProofProvider({
19
+ publicKey,
20
+ origin = DEFAULT_ORIGIN,
21
+ children
22
+ }) {
23
+ useSdk(publicKey, origin);
24
+ return /* @__PURE__ */ jsx(Fragment, { children });
25
+ }
26
+ function RevProofBadge({
27
+ publicKey,
28
+ theme,
29
+ size,
30
+ badgeStyle,
31
+ className
32
+ }) {
33
+ const ref = useCallback(
34
+ (el) => {
35
+ if (el && badgeStyle) el.setAttribute("style", badgeStyle);
36
+ },
37
+ [badgeStyle]
38
+ );
39
+ return /* @__PURE__ */ jsx("revproof-badge", { ref, "data-key": publicKey, theme, size, class: className });
40
+ }
41
+ function RevProofReviews({ publicKey, theme, columns, limit, className, style }) {
42
+ return /* @__PURE__ */ jsx("revproof-reviews", { "data-key": publicKey, theme, columns, limit, class: className, ...style ? { style } : {} });
43
+ }
44
+ function RevProofTestimonials({ publicKey, theme, columns, className, style }) {
45
+ return /* @__PURE__ */ jsx("revproof-testimonials", { "data-key": publicKey, theme, columns, class: className, ...style ? { style } : {} });
46
+ }
47
+ function RevProofVerified({ publicKey, theme, metric, className, style }) {
48
+ return /* @__PURE__ */ jsx("revproof-verified", { "data-key": publicKey, theme, metric, class: className, ...style ? { style } : {} });
49
+ }
50
+
51
+ export { RevProofBadge, RevProofProvider, RevProofReviews, RevProofTestimonials, RevProofVerified };
52
+ //# sourceMappingURL=index.js.map
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;AASA,IAAM,cAAA,GAAiB,4CAAA;AACvB,IAAI,QAAA,GAAW,KAAA;AAEf,SAAS,MAAA,CAAO,WAAmB,MAAA,EAAgB;AACjD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,QAAA,IAAY,OAAO,QAAA,KAAa,WAAA,EAAa;AACjD,IAAA,QAAA,GAAW,IAAA;AACX,IAAA,MAAM,CAAA,GAAI,QAAA,CAAS,aAAA,CAAc,QAAQ,CAAA;AACzC,IAAA,CAAA,CAAE,GAAA,GAAM,MAAA,CAAO,OAAA,CAAQ,KAAA,EAAO,EAAE,CAAA,GAAI,SAAA;AACpC,IAAA,CAAA,CAAE,KAAA,GAAQ,IAAA;AACV,IAAA,CAAA,CAAE,YAAA,CAAa,YAAY,SAAS,CAAA;AACpC,IAAA,QAAA,CAAS,IAAA,CAAK,YAAY,CAAC,CAAA;AAAA,EAC7B,CAAA,EAAG,CAAC,SAAA,EAAW,MAAM,CAAC,CAA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EAAE,SAAA,EAAW,OAAO,MAAA,EAAQ,SAAA,EAAW,OAAM,EAAmE;AAC/I,EAAA,uBAAO,GAAA,CAAC,mBAAA,EAAA,EAAkB,UAAA,EAAU,SAAA,EAAW,OAAc,MAAA,EAAgB,KAAA,EAAO,SAAA,EAAY,GAAI,KAAA,GAAQ,EAAE,KAAA,EAAM,GAAI,EAAC,EAAI,CAAA;AAC/H","file":"index.js","sourcesContent":["\"use client\";\n// revproof — thin, SSR-safe wrappers around the RevProof web components.\n// Each component renders the underlying custom element and the provider injects\n// the SDK loader once. The verified marks are rendered by RevProof (iframe /\n// shadow DOM), so nothing here — or in the host app — can restyle or fake them.\nimport { useCallback, useEffect, type CSSProperties, type ReactNode } from \"react\";\n\n// Where the SDK (sdk.js) is served from. Override via <RevProofProvider origin>\n// if you point a custom domain at your RevProof deployment.\nconst DEFAULT_ORIGIN = \"https://revproof-production.up.railway.app\";\nlet injected = false;\n\nfunction useSdk(publicKey: string, origin: string) {\n useEffect(() => {\n if (injected || typeof document === \"undefined\") return;\n injected = true;\n const s = document.createElement(\"script\");\n s.src = origin.replace(/\\/$/, \"\") + \"/sdk.js\";\n s.async = true;\n s.setAttribute(\"data-key\", publicKey);\n document.head.appendChild(s);\n }, [publicKey, origin]);\n}\n\ntype Theme = \"light\" | \"dark\" | \"brand\";\ntype Base = { publicKey?: string; theme?: Theme; className?: string; style?: CSSProperties };\n\n/** Injects the SDK loader once. Wrap your app (or the page) with your publishable key. */\nexport function RevProofProvider({\n publicKey,\n origin = DEFAULT_ORIGIN,\n children,\n}: {\n publicKey: string;\n origin?: string;\n children?: ReactNode;\n}) {\n useSdk(publicKey, origin);\n return <>{children}</>;\n}\n\nexport function RevProofBadge({\n publicKey,\n theme,\n size,\n badgeStyle,\n className,\n}: Omit<Base, \"style\"> & { size?: \"sm\" | \"md\" | \"lg\"; badgeStyle?: \"seal\" | \"shield\" }) {\n // The SDK reads the seal/shield variant from the element's `style` attribute,\n // which React reserves for CSS objects — so set it via a ref instead of a prop.\n const ref = useCallback(\n (el: HTMLElement | null) => {\n if (el && badgeStyle) el.setAttribute(\"style\", badgeStyle);\n },\n [badgeStyle]\n );\n return <revproof-badge ref={ref} data-key={publicKey} theme={theme} size={size} class={className} />;\n}\n\nexport function RevProofReviews({ publicKey, theme, columns, limit, className, style }: Base & { columns?: 1 | 2 | 3; limit?: number }) {\n return <revproof-reviews data-key={publicKey} theme={theme} columns={columns} limit={limit} class={className} {...(style ? { style } : {})} />;\n}\n\nexport function RevProofTestimonials({ publicKey, theme, columns, className, style }: Base & { columns?: 1 | 2 }) {\n return <revproof-testimonials data-key={publicKey} theme={theme} columns={columns} class={className} {...(style ? { style } : {})} />;\n}\n\nexport function RevProofVerified({ publicKey, theme, metric, className, style }: Base & { metric?: \"mrr\" | \"arr\" | \"revenue30d\" | \"customers\" }) {\n return <revproof-verified data-key={publicKey} theme={theme} metric={metric} class={className} {...(style ? { style } : {})} />;\n}\n\n// Let TSX accept the custom elements. React 19 resolves intrinsics from the\n// `react` module's JSX namespace; React 18 uses the global one — augment both so\n// the package types work in either.\ntype RevProofElements = {\n \"revproof-badge\": Record<string, unknown>;\n \"revproof-reviews\": Record<string, unknown>;\n \"revproof-testimonials\": Record<string, unknown>;\n \"revproof-verified\": Record<string, unknown>;\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface IntrinsicElements extends RevProofElements {}\n }\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n interface IntrinsicElements extends RevProofElements {}\n }\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "revproof",
3
+ "version": "0.1.0",
4
+ "description": "React components for RevProof verified badges, reviews and testimonials — proof you can't fake.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "require": "./dist/index.cjs"
19
+ }
20
+ },
21
+ "files": ["dist", "README.md"],
22
+ "scripts": {
23
+ "build": "tsup",
24
+ "prepublishOnly": "npm run build"
25
+ },
26
+ "keywords": ["revproof", "verified", "reviews", "testimonials", "badge", "social-proof"],
27
+ "peerDependencies": {
28
+ "react": ">=18"
29
+ },
30
+ "devDependencies": {
31
+ "@types/react": "^19.1.0",
32
+ "react": "^19.1.0",
33
+ "tsup": "^8.3.5",
34
+ "typescript": "^5.7.2"
35
+ }
36
+ }