@proofhorn/next 0.0.0-stage → 0.3.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.
@@ -0,0 +1,78 @@
1
+ import { normalizeBase, pathKey, ProofhornError, READ_TIMEOUT_MS, request, UPLOAD_TIMEOUT_MS, WRITE_TIMEOUT_MS, } from './http.js';
2
+ import { BROWSER_EVENT_TYPES, } from './types.js';
3
+ const MAX_RATINGS = 50;
4
+ function query(params) {
5
+ const search = new URLSearchParams();
6
+ for (const [name, value] of Object.entries(params)) {
7
+ if (value !== undefined)
8
+ search.set(name, String(value));
9
+ }
10
+ const text = search.toString();
11
+ return text ? `?${text}` : '';
12
+ }
13
+ export function createPublicClient(options) {
14
+ const { publicKey, apiBase, readInit } = options;
15
+ // A mistaken secret key must stop here, before it is ever put in a URL.
16
+ if (!publicKey?.startsWith('pk_')) {
17
+ throw new ProofhornError('publicKey must be a pk_live_ or pk_test_ key', { code: 'invalid_config' });
18
+ }
19
+ const base = `${normalizeBase(apiBase)}/v1/public/${encodeURIComponent(publicKey)}`;
20
+ const read = (path) => request(base + path, { timeoutMs: READ_TIMEOUT_MS, init: readInit });
21
+ return {
22
+ testMode: publicKey.startsWith('pk_test_'),
23
+ getConfig: () => read('/config'),
24
+ getItemReviews: (itemKey, q = {}) => read(`/items/${pathKey(itemKey, 'itemKey')}/reviews${query(q)}`),
25
+ getSiteReviews: (q = {}) => read(`/reviews${query(q)}`),
26
+ async getRatings(itemKeys) {
27
+ if (itemKeys.length > MAX_RATINGS) {
28
+ throw new ProofhornError(`At most ${MAX_RATINGS} keys per call`, { code: 'invalid_request', field: 'items' });
29
+ }
30
+ // Sorted so the same set of keys always hits the same cache entry.
31
+ const items = [...new Set(itemKeys)].sort();
32
+ items.forEach((key) => pathKey(key, 'items'));
33
+ if (items.length === 0)
34
+ return {};
35
+ const { ratings } = await read(`/ratings${query({ items: items.join(',') })}`);
36
+ return ratings;
37
+ },
38
+ /** Analytics beacon. Never throws and has no result, as the endpoint itself returns no body. */
39
+ sendEvents(batch) {
40
+ // Anything malformed is dropped here, as /events itself would drop it.
41
+ const events = Array.isArray(batch?.events) ? batch.events.filter((event) => BROWSER_EVENT_TYPES.includes(event?.t)) : [];
42
+ if (events.length === 0)
43
+ return;
44
+ const body = JSON.stringify({ ...batch, events });
45
+ const url = `${base}/events`;
46
+ try {
47
+ if (typeof navigator !== 'undefined' && navigator.sendBeacon?.(url, body))
48
+ return;
49
+ void fetch(url, { method: 'POST', body, keepalive: true, headers: { 'Content-Type': 'text/plain' } }).catch(() => { });
50
+ }
51
+ catch {
52
+ // Analytics must never reach the host page.
53
+ }
54
+ },
55
+ submitReview(input) {
56
+ const { itemKey, token, rating, title, body, name, email, mediaIds, locale, website } = input;
57
+ return request(`${base}/reviews`, {
58
+ method: 'POST',
59
+ timeoutMs: WRITE_TIMEOUT_MS,
60
+ json: { itemKey, token, rating, title, body, name, email, mediaIds, locale, website },
61
+ });
62
+ },
63
+ getReviewRequest: (token) => read(`/review-requests/${encodeURIComponent(token)}`),
64
+ /** Accepts one JPEG, PNG or WebP image of at most 8MB. */
65
+ uploadReviewMedia(file, token) {
66
+ const form = new FormData();
67
+ form.set('file', file);
68
+ if (token)
69
+ form.set('token', token);
70
+ return request(`${base}/review-media`, {
71
+ method: 'POST',
72
+ timeoutMs: UPLOAD_TIMEOUT_MS,
73
+ body: form,
74
+ });
75
+ },
76
+ getReferral: (code) => read(`/referrals/${pathKey(code, 'code')}`),
77
+ };
78
+ }
@@ -0,0 +1,323 @@
1
+ /** Types for API contract v1. Clients must ignore fields they do not know, so none of these are exhaustive. */
2
+ export type Money = {
3
+ amountMinor: number;
4
+ currency: string;
5
+ };
6
+ export type Sort = 'newest' | 'highest' | 'lowest' | 'photos';
7
+ export type Placement = 'all' | 'item' | 'collection' | 'home' | 'other';
8
+ export type ItemType = 'product' | 'course' | 'service' | 'plan' | 'page' | 'other';
9
+ export type Variant = {
10
+ id: string;
11
+ weight: number;
12
+ holdout: boolean;
13
+ template: string;
14
+ };
15
+ export type WidgetDesign = {
16
+ position?: string;
17
+ delayMs?: number;
18
+ displayMs?: number;
19
+ gapMs?: number;
20
+ maxPerSession?: number;
21
+ };
22
+ export type WidgetConfig = {
23
+ id: string;
24
+ /** Known values are listed in the contract. New types can arrive at any time and must be ignored. */
25
+ type: string;
26
+ placement: Placement;
27
+ design?: WidgetDesign;
28
+ targeting?: {
29
+ devices?: Array<'m' | 'd'>;
30
+ };
31
+ variants: Variant[];
32
+ };
33
+ export type FeedRow = {
34
+ type: string;
35
+ who: string;
36
+ verb: string;
37
+ itemKey?: string;
38
+ item?: string;
39
+ url?: string;
40
+ image?: string | null;
41
+ at: string;
42
+ /** Added by the dashboard addendum. `amount` is null unless the site shows amounts. */
43
+ firstName?: string | null;
44
+ initials?: string | null;
45
+ city?: string | null;
46
+ country?: string | null;
47
+ amount?: Money | null;
48
+ };
49
+ export type SiteConfig = {
50
+ v: number;
51
+ site: {
52
+ platform: string;
53
+ locale: string;
54
+ consentMode: 'none' | 'required';
55
+ branding: boolean;
56
+ };
57
+ widgets: WidgetConfig[];
58
+ feed: FeedRow[];
59
+ };
60
+ export type ReviewMedia = {
61
+ type: string;
62
+ url: string;
63
+ };
64
+ export type Review = {
65
+ id: string;
66
+ rating: number;
67
+ title: string | null;
68
+ body: string;
69
+ author: string;
70
+ verified: boolean;
71
+ incentivized: boolean;
72
+ media: ReviewMedia[];
73
+ reply: string | null;
74
+ locale: string;
75
+ date: string;
76
+ itemKey?: string;
77
+ };
78
+ export type ReviewPage = {
79
+ total: number;
80
+ page: number;
81
+ pageSize: number;
82
+ average: number;
83
+ breakdown: Record<string, number>;
84
+ reviews: Review[];
85
+ };
86
+ export type Rating = {
87
+ average: number;
88
+ count: number;
89
+ };
90
+ export declare const BROWSER_EVENT_TYPES: readonly ["page_view", "product_view", "proof_impression", "proof_interaction", "proof_click", "review_view", "review_submission", "add_to_cart", "checkout_started", "intent", "referral_view", "referral_click", "ugc_view", "ugc_interaction"];
91
+ export type BrowserEventType = (typeof BROWSER_EVENT_TYPES)[number];
92
+ export type BrowserEvent = {
93
+ t: BrowserEventType;
94
+ w?: string;
95
+ i?: string;
96
+ n?: string;
97
+ ts: number;
98
+ };
99
+ export type EventBatch = {
100
+ vid: string;
101
+ sid: string;
102
+ d: 'm' | 'd';
103
+ events: BrowserEvent[];
104
+ };
105
+ type ReviewFields = {
106
+ itemKey?: string;
107
+ rating: 1 | 2 | 3 | 4 | 5;
108
+ title?: string;
109
+ body: string;
110
+ mediaIds?: string[];
111
+ locale?: string;
112
+ /** Honeypot. Leave empty; a value makes the core discard the review. */
113
+ website?: string;
114
+ };
115
+ /** With a review-request token, name and email are optional. Without one, the site must allow open reviews. */
116
+ export type SubmitReviewInput = ReviewFields & ({
117
+ token: string;
118
+ name?: string;
119
+ email?: string;
120
+ } | {
121
+ token?: undefined;
122
+ name: string;
123
+ email: string;
124
+ });
125
+ export type SubmitReviewResult = {
126
+ id: string;
127
+ status: string;
128
+ referralOffer: {
129
+ code: string;
130
+ url: string;
131
+ message: string;
132
+ } | null;
133
+ };
134
+ export type ReviewRequestPrefill = {
135
+ item: {
136
+ key: string;
137
+ title: string;
138
+ image?: string;
139
+ };
140
+ firstName: string;
141
+ incentive: unknown;
142
+ };
143
+ export type ReferralLookup = {
144
+ valid: boolean;
145
+ offer: {
146
+ type: string;
147
+ value: number;
148
+ message: string;
149
+ };
150
+ };
151
+ export type ItemInput = {
152
+ type: ItemType;
153
+ title: string;
154
+ url?: string;
155
+ image?: string;
156
+ active?: boolean;
157
+ stock?: number;
158
+ };
159
+ export type WriteResult = {
160
+ id: string;
161
+ duplicate: boolean;
162
+ };
163
+ export type Item = ItemInput & {
164
+ itemKey: string;
165
+ [key: string]: unknown;
166
+ };
167
+ export type BatchResults<T = Record<string, unknown>> = {
168
+ results: T[];
169
+ };
170
+ export type Actor = {
171
+ firstName?: string;
172
+ city?: string;
173
+ countryCode?: string;
174
+ };
175
+ export type ActivityInput = {
176
+ source: string;
177
+ externalId: string;
178
+ type: 'purchase' | 'enrollment' | 'signup' | 'booking' | 'lead' | 'subscription' | 'other';
179
+ occurredAt: string;
180
+ item: {
181
+ key: string;
182
+ type?: ItemType;
183
+ title?: string;
184
+ url?: string;
185
+ image?: string;
186
+ };
187
+ actor?: Actor;
188
+ customerRef?: string;
189
+ value?: Money;
190
+ publicDisplay?: boolean;
191
+ conversion?: boolean;
192
+ visitorId?: string;
193
+ sessionId?: string;
194
+ referralCode?: string;
195
+ };
196
+ type Extra<Shape, T> = Record<Exclude<keyof T, keyof Shape>, never>;
197
+ /**
198
+ * Resolves to an impossible type if `T` has a field the contract does not list, including in `actor` and `item`.
199
+ * TypeScript only checks excess properties on object literals; this also catches values built elsewhere.
200
+ */
201
+ export type ExactActivity<T extends ActivityInput> = T & Extra<ActivityInput, T> & (T extends {
202
+ actor?: infer A;
203
+ } ? {
204
+ actor?: A & Extra<Actor, NonNullable<A>>;
205
+ } : unknown) & (T extends {
206
+ item: infer I;
207
+ } ? {
208
+ item: I & Extra<ActivityInput['item'], I>;
209
+ } : unknown);
210
+ export type ReviewRequestInput = {
211
+ source: string;
212
+ externalId: string;
213
+ itemKey: string;
214
+ customerRef?: string;
215
+ email: string;
216
+ firstName?: string;
217
+ locale?: string;
218
+ sendAt?: string;
219
+ };
220
+ export type ReviewRequestResult = {
221
+ id: string;
222
+ status: string;
223
+ sendAt?: string;
224
+ duplicate?: boolean;
225
+ };
226
+ export type ReviewImport = {
227
+ externalId: string;
228
+ itemKey?: string;
229
+ rating: number;
230
+ body: string;
231
+ title?: string | null;
232
+ name?: string;
233
+ emailHash?: string;
234
+ createdAt: string;
235
+ verified?: boolean;
236
+ incentivized?: boolean;
237
+ };
238
+ export type ReferralInput = {
239
+ customerRef: string;
240
+ emailHash?: string;
241
+ };
242
+ export type ReferralCode = {
243
+ code: string;
244
+ url: string;
245
+ duplicate?: boolean;
246
+ };
247
+ export type Period = '7d' | '30d' | '90d';
248
+ export type Summary = {
249
+ period: Period;
250
+ /**
251
+ * `activitiesUsed` counts live activities this UTC calendar month, excluding backfilled history.
252
+ * `activitiesLimit` is null when there is no limit, which is also the case for every plan until
253
+ * limits are switched on. Always treat null as "no limit".
254
+ */
255
+ plan: {
256
+ name: 'free' | 'growth' | 'pro' | (string & {});
257
+ activitiesUsed: number;
258
+ activitiesLimit: number | null;
259
+ };
260
+ proof: {
261
+ impressions: number;
262
+ clicks: number;
263
+ };
264
+ reviews: {
265
+ published: number;
266
+ pending: number;
267
+ average: number;
268
+ };
269
+ conversions: {
270
+ count: number;
271
+ revenueMinor: number;
272
+ currency: string;
273
+ };
274
+ lift: {
275
+ basis: 'holdout' | 'estimated';
276
+ percent: number | null;
277
+ };
278
+ };
279
+ export type Experiment = {
280
+ widgetId: string;
281
+ variants: Array<{
282
+ id: string;
283
+ holdout: boolean;
284
+ exposures: number;
285
+ clicks: number;
286
+ conversions: number;
287
+ revenueMinor: number;
288
+ }>;
289
+ pValue: number | null;
290
+ status: 'collecting' | 'no_difference' | 'significant';
291
+ };
292
+ export type PrivacySubject = {
293
+ customerRef: string;
294
+ email?: undefined;
295
+ } | {
296
+ email: string;
297
+ customerRef?: undefined;
298
+ };
299
+ export type ConnectExchangeInput = {
300
+ code: string;
301
+ code_verifier: string;
302
+ site_url: string;
303
+ };
304
+ export type ConnectExchangeResult = {
305
+ siteId: string;
306
+ publicKey: string;
307
+ secretKey: string;
308
+ webhookSecret: string;
309
+ dashboardUrl: string;
310
+ };
311
+ export type SiteInfo = {
312
+ siteId?: string;
313
+ platform?: string;
314
+ plan?: string;
315
+ status?: string;
316
+ };
317
+ export type WebhookEvent<T = Record<string, unknown>> = {
318
+ id: string;
319
+ type: string;
320
+ createdAt: string;
321
+ data: T;
322
+ };
323
+ export {};
@@ -0,0 +1,17 @@
1
+ /** Types for API contract v1. Clients must ignore fields they do not know, so none of these are exhaustive. */
2
+ export const BROWSER_EVENT_TYPES = [
3
+ 'page_view',
4
+ 'product_view',
5
+ 'proof_impression',
6
+ 'proof_interaction',
7
+ 'proof_click',
8
+ 'review_view',
9
+ 'review_submission',
10
+ 'add_to_cart',
11
+ 'checkout_started',
12
+ 'intent',
13
+ 'referral_view',
14
+ 'referral_click',
15
+ 'ugc_view',
16
+ 'ugc_interaction',
17
+ ];
@@ -0,0 +1,6 @@
1
+ export type StarRatingProps = {
2
+ itemKey: string;
3
+ className?: string;
4
+ };
5
+ /** Space is reserved before the rating arrives. With no reviews or on failure, that space stays empty. */
6
+ export declare function StarRating({ itemKey, className }: StarRatingProps): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useContext, useEffect, useState } from 'react';
4
+ import { ProofhornContext } from './provider.js';
5
+ import { createPublicClient } from './shared/public-client.js';
6
+ const BATCH_SIZE = 50;
7
+ const RESERVED = { display: 'inline-block', minWidth: '10em', height: '1.25em', lineHeight: '1.25em' };
8
+ let queue = [];
9
+ /** Star badges on one page share a request, so a list of 50 makes one call. */
10
+ function fetchRating(options, key) {
11
+ return new Promise((resolve) => {
12
+ if (queue.length === 0) {
13
+ setTimeout(() => {
14
+ const batch = queue;
15
+ queue = [];
16
+ const client = createPublicClient(options);
17
+ for (let i = 0; i < batch.length; i += BATCH_SIZE) {
18
+ const part = batch.slice(i, i + BATCH_SIZE);
19
+ client
20
+ .getRatings(part.map((entry) => entry.key))
21
+ .catch(() => ({}))
22
+ .then((ratings) => part.forEach((entry) => entry.resolve(ratings[entry.key] ?? null)));
23
+ }
24
+ });
25
+ }
26
+ queue.push({ key, resolve });
27
+ });
28
+ }
29
+ /** Space is reserved before the rating arrives. With no reviews or on failure, that space stays empty. */
30
+ export function StarRating({ itemKey, className }) {
31
+ const context = useContext(ProofhornContext);
32
+ const [rating, setRating] = useState(null);
33
+ useEffect(() => {
34
+ if (!context)
35
+ return;
36
+ let active = true;
37
+ void fetchRating(context, itemKey).then((value) => {
38
+ if (active)
39
+ setRating(value);
40
+ });
41
+ return () => {
42
+ active = false;
43
+ };
44
+ }, [context, itemKey]);
45
+ const shown = rating && rating.count > 0 ? rating : null;
46
+ const rounded = shown ? Math.round(shown.average) : 0;
47
+ return (_jsx("span", { className: className ?? 'phn-star-rating', style: RESERVED, ...(shown ? { role: 'img', 'aria-label': `${shown.average} out of 5 from ${shown.count} reviews` } : {}), children: shown ? `${'★'.repeat(rounded)}${'☆'.repeat(5 - rounded)} ${shown.average.toFixed(1)} (${shown.count})` : null }));
48
+ }
@@ -0,0 +1,8 @@
1
+ import type { Visitor } from './runtime/types.js';
2
+ /**
3
+ * Returns the IDs to pass to your server for attribution. Safe during server rendering, and never throws.
4
+ * All values are null until the runtime has started, and stay null without consent where it is required.
5
+ */
6
+ export declare function getVisitor(): Visitor;
7
+ /** Tells the runtime the visitor's choice. Safe to call before the runtime has loaded. */
8
+ export declare function consent(granted: boolean): void;
@@ -0,0 +1,19 @@
1
+ import { setPendingConsent } from './runtime/load.js';
2
+ /**
3
+ * Returns the IDs to pass to your server for attribution. Safe during server rendering, and never throws.
4
+ * All values are null until the runtime has started, and stay null without consent where it is required.
5
+ */
6
+ export function getVisitor() {
7
+ if (typeof window === 'undefined')
8
+ return { visitorId: null, sessionId: null, referralCode: null };
9
+ return window.Proofhorn?.getVisitor() ?? { visitorId: null, sessionId: null, referralCode: null };
10
+ }
11
+ /** Tells the runtime the visitor's choice. Safe to call before the runtime has loaded. */
12
+ export function consent(granted) {
13
+ if (typeof window === 'undefined')
14
+ return;
15
+ if (window.Proofhorn)
16
+ window.Proofhorn.consent(granted);
17
+ else
18
+ setPendingConsent(granted);
19
+ }
package/docs/csp.md ADDED
@@ -0,0 +1,22 @@
1
+ # Content Security Policy
2
+
3
+ The package ships no remote script. The runtime is bundled with your app, so `script-src` needs nothing new. The API sends data only, never code.
4
+
5
+ Allow these in your policy:
6
+
7
+ | Directive | Value | Why |
8
+ | --- | --- | --- |
9
+ | `connect-src` | `https://proofhorn.khushrav.com` | Config, reviews, ratings, review submission and the events beacon |
10
+ | `img-src` | `https://proofhorn-cdn.khushrav.com` | Item and review images |
11
+
12
+ The popup uses inline styles inside a shadow root. If your policy sets `style-src` without `'unsafe-inline'`, popups still render but unstyled; a nonce is not needed for anything else.
13
+
14
+ `ReviewJsonLd` prints a `<script type="application/ld+json">` tag. JSON-LD is data, not executed, and browsers do not apply `script-src` to it.
15
+
16
+ Example header:
17
+
18
+ ```
19
+ Content-Security-Policy: default-src 'self'; connect-src 'self' https://proofhorn.khushrav.com; img-src 'self' https://proofhorn-cdn.khushrav.com data:;
20
+ ```
21
+
22
+ During development against the local mock, add `http://localhost:4010` to `connect-src`.
@@ -0,0 +1,104 @@
1
+ # Quick start
2
+
3
+ ## 1. Install and set keys
4
+
5
+ ```bash
6
+ npm install @proofhorn/next
7
+ ```
8
+
9
+ Get both keys from the Proofhorn dashboard and put them in `.env.local`:
10
+
11
+ ```
12
+ NEXT_PUBLIC_PROOFHORN_KEY=pk_test_...
13
+ PROOFHORN_SECRET_KEY=sk_test_...
14
+ ```
15
+
16
+ Use test keys while you build. Switch both to live keys together; the package refuses a mixed pair.
17
+
18
+ ## 2. Load the widgets (App Router)
19
+
20
+ In `app/layout.tsx`:
21
+
22
+ ```tsx
23
+ import { ProofhornProvider, ProofWidgets } from '@proofhorn/next';
24
+
25
+ export default function RootLayout({ children }) {
26
+ return (
27
+ <html lang="en">
28
+ <body>
29
+ <ProofhornProvider publicKey={process.env.NEXT_PUBLIC_PROOFHORN_KEY!}>
30
+ {children}
31
+ <ProofWidgets placement="all" />
32
+ </ProofhornProvider>
33
+ </body>
34
+ </html>
35
+ );
36
+ }
37
+ ```
38
+
39
+ The provider renders no DOM and loads the runtime after hydration. Popups are fixed-position, so they never move your layout. On an item page, pass `placement="item"` and `itemKey` so product views are counted.
40
+
41
+ Pages Router sites use the same two components in `_app.tsx`. The server entry needs the App Router.
42
+
43
+ ## 3. Show reviews
44
+
45
+ On an item page (a server component):
46
+
47
+ ```tsx
48
+ import { StarRating } from '@proofhorn/next';
49
+ import { Reviews, ReviewJsonLd } from '@proofhorn/next/server';
50
+
51
+ export default function ProductPage() {
52
+ return (
53
+ <>
54
+ <ReviewJsonLd itemKey="course-101" name="Data Analytics Bootcamp" />
55
+ <h1>Data Analytics Bootcamp</h1>
56
+ <StarRating itemKey="course-101" />
57
+ <Reviews itemKey="course-101" />
58
+ </>
59
+ );
60
+ }
61
+ ```
62
+
63
+ `Reviews` renders on the server and is cached for about 60 seconds, so reviews reach crawlers with no layout shift. `ReviewJsonLd` prints `Product` markup only when at least one published review exists, so use it on real item pages only. `StarRating` reserves its space and stays empty until there are reviews. For your own markup, call `getReviews(itemKey)` and `getRatings(itemKeys)`; both return `null` on failure rather than throwing.
64
+
65
+ ## 4. Record real activity
66
+
67
+ Activity enters Proofhorn only from your server, with the secret key. See [server examples](server-examples.md) for a form handler and a payment webhook. The short version:
68
+
69
+ ```ts
70
+ import { recordActivity } from '@proofhorn/next/server';
71
+
72
+ await recordActivity({
73
+ source: 'form',
74
+ externalId: submissionId,
75
+ type: 'enrollment',
76
+ occurredAt: new Date().toISOString(),
77
+ item: { key: 'course-101', type: 'course', title: 'Data Analytics Bootcamp' },
78
+ actor: { firstName: 'Priya', city: 'Pune', countryCode: 'IN' },
79
+ visitorId,
80
+ sessionId,
81
+ });
82
+ ```
83
+
84
+ `actor` accepts first name, city and country only. For A/B and holdout results to count, pass the visitor and session IDs from `getVisitor()` in the browser.
85
+
86
+ ## 5. Ask for reviews
87
+
88
+ After an order or enrolment completes:
89
+
90
+ ```ts
91
+ import { requestReview } from '@proofhorn/next/server';
92
+
93
+ await requestReview({ source: 'razorpay', externalId: `${paymentId}:course-101`, itemKey: 'course-101', email, firstName });
94
+ ```
95
+
96
+ Proofhorn sends the email, one reminder and the unsubscribe link. Send a request for every eligible customer.
97
+
98
+ ## Consent
99
+
100
+ If your site's consent mode is `required` in the dashboard, the runtime stores and sends nothing until you call `consent(true)` from `@proofhorn/next`. Call `consent(false)` to clear what was stored.
101
+
102
+ ## Test mode
103
+
104
+ With `pk_test_` and `sk_test_` keys, everything you record is a test row, visible only to test keys. Run against the local mock during development with `PROOFHORN_API_URL=http://localhost:4010` and `npm run mock` in this package.