@fingerly/next 0.0.0-stage → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,231 @@
1
- # Temporary Holding Version
1
+ # @fingerly/next
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Next.js integration. It wraps [`@fingerly/react`](../react/README.md) and adds
4
+ the three things that are actually about Next: where the configuration comes
5
+ from, where the client boundary sits, and how an identification reaches a
6
+ Server Action.
7
+
8
+ Requires Next **15 or newer** and React **19** (App Router or Pages Router).
9
+ Tested against Next 16.
10
+
11
+ ```
12
+ pnpm add @fingerly/next
13
+ ```
14
+
15
+ ## Configure
16
+
17
+ Read the key in a Server Component and pass it down:
18
+
19
+ ```tsx
20
+ // app/layout.tsx (a Server Component)
21
+ <FingerlyProvider apiKey={process.env.FINGERLY_API_KEY}>{children}</FingerlyProvider>
22
+ ```
23
+
24
+ That is the arrangement that always works, and it is worth understanding why
25
+ rather than copying. A server render reads `process.env` at runtime, so any
26
+ variable name will do (no `NEXT_PUBLIC_` prefix needed), and the value reaches
27
+ the browser through the RSC payload, which is where a public SDK key was
28
+ always going to end up.
29
+
30
+ The provider will also read `NEXT_PUBLIC_FINGERLY_API_KEY` and
31
+ `NEXT_PUBLIC_FINGERLY_ENDPOINT` itself, but that path has a condition on it:
32
+ Next inlines `NEXT_PUBLIC_` variables **while compiling**, and it does not
33
+ compile your dependencies. In a published build the read survives as a
34
+ `process.env` lookup, and in a browser there is no `process`. The server
35
+ render finds the key, hydration does not, and identification fails (the page
36
+ keeps rendering, and the console says which variable to set). It works if
37
+ your app lists `@fingerly/next` in `transpilePackages`; the prop above needs no
38
+ such condition, which is why it is the documented route.
39
+
40
+ Either way the key is a **public** SDK key, scoped to the origins you list
41
+ against it. A **secret** key is refused by the API whenever a request carries
42
+ an `Origin`, so the mistake either route invites cannot silently work.
43
+
44
+ ## Add the provider
45
+
46
+ ```tsx
47
+ // app/layout.tsx (still a Server Component)
48
+ import { FingerlyProvider } from '@fingerly/next'
49
+
50
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
51
+ return (
52
+ <html>
53
+ <body>
54
+ {/* consent="granted" only once you have consent (or another lawful basis) */}
55
+ <FingerlyProvider apiKey={process.env.FINGERLY_API_KEY} consent="granted">
56
+ {children}
57
+ </FingerlyProvider>
58
+ </body>
59
+ </html>
60
+ )
61
+ }
62
+ ```
63
+
64
+ The package is marked `'use client'`, so the provider is a client boundary and
65
+ your layout does not have to become one. Pages Router is the same component in
66
+ `_app.tsx`.
67
+
68
+ Mounting it collects nothing. When to identify stays the page's decision.
69
+
70
+ Consent defaults to `pending`, and nothing is collected or sent until it is
71
+ `granted`. A site with a consent banner passes the banner's answer instead of
72
+ `"granted"`, as below.
73
+
74
+ ### Waiting for consent
75
+
76
+ Consent defaults to `pending`. When identification needs the visitor's consent
77
+ first, pass `consent` with what your consent tool says now. It is a prop rather than an environment
78
+ variable, because it is the visitor's decision rather than the deployment's:
79
+
80
+ ```tsx
81
+ 'use client'
82
+ <FingerlyProvider apiKey={apiKey} consent={accepted ? 'granted' : 'pending'}>{children}</FingerlyProvider>
83
+ ```
84
+
85
+ - `consent`: `'pending'` (the default), `'granted'` or `'denied'`.
86
+ - `useFingerly().setConsent(state)`: sets it from a consent tool's callback. The
87
+ client's own `setConsent()` does the same.
88
+
89
+ While it is not `granted` nothing is collected or sent,
90
+ `useIdentify({ immediate: true })` and `<FingerlyRequestId />` wait, and a
91
+ manual `identify()` fails with a `ConsentError`. Once it becomes `granted` the
92
+ waiting identification runs, once. The details are in the
93
+ [React binding's README](../react/README.md#waiting-for-consent).
94
+
95
+ ## Identify
96
+
97
+ The hooks are `@fingerly/react`'s, re-exported so you install one package:
98
+
99
+ ```tsx
100
+ 'use client'
101
+ import { useIdentify } from '@fingerly/next'
102
+
103
+ export function Checkout() {
104
+ const { identify, isSuspicious, suspectLevel, isLoading } = useIdentify()
105
+ …
106
+ }
107
+ ```
108
+
109
+ `useIdentify({ immediate: true })` is safe in a Next app for the reason it is
110
+ safe anywhere: it runs in an effect, and effects do not run during a server
111
+ render. The page renders on the server, collects after hydration, and every
112
+ component that asks shares the one identification.
113
+
114
+ The full surface (`immediate`, `suspend`, `tag`, `refresh`) is documented in
115
+ the [React binding's README](../react/README.md).
116
+
117
+ ## Carry it into a Server Action
118
+
119
+ A Server Action runs where the browser is not, so the identification has to
120
+ travel with the submission:
121
+
122
+ ```tsx
123
+ // app/signup/page.tsx
124
+ import { FingerlyRequestId } from '@fingerly/next'
125
+ import { signUp } from './actions'
126
+
127
+ export default function Page() {
128
+ return (
129
+ <form action={signUp}>
130
+ <input name="email" />
131
+ <FingerlyRequestId />
132
+ <button>Create account</button>
133
+ </form>
134
+ )
135
+ }
136
+ ```
137
+
138
+ ```ts
139
+ // app/signup/actions.ts
140
+ 'use server'
141
+ import { readRequestId } from '@fingerly/next/server'
142
+
143
+ export async function signUp(formData: FormData) {
144
+ const requestId = readRequestId(formData)
145
+ // correlate the signup with the identification, or proceed without one
146
+ }
147
+ ```
148
+
149
+ `<FingerlyRequestId />` identifies on mount and renders a hidden field. It is in
150
+ the server-rendered HTML **empty** rather than absent, which is deliberate: a
151
+ form submitted before the SDK finished, or with JavaScript disabled, is a
152
+ normal event, and the server can tell it apart from a form that never carried a
153
+ field at all.
154
+
155
+ `readRequestId()` returns `null` for all of those cases rather than throwing:
156
+ what to do about an unidentified submission is a policy your server owns. It
157
+ also refuses anything that is not a short opaque token: the field arrives from
158
+ the page, which means it arrives from whoever is driving the browser, and a
159
+ server that joins or logs it unchecked is one hand-written `<input>` away from
160
+ storing what the visitor typed.
161
+
162
+ Both halves agree on the field name through one exported constant,
163
+ `REQUEST_ID_FIELD`. Pass `name` to `<FingerlyRequestId />` and the same `name` to
164
+ `readRequestId()` if you need a different one.
165
+
166
+ ## The two entries, and why
167
+
168
+ | Import | Runs | Contains |
169
+ | --- | --- | --- |
170
+ | `@fingerly/next` | the browser | provider, field, hooks (a `'use client'` module) |
171
+ | `@fingerly/next/server` | the server | `readRequestId`, `REQUEST_ID_FIELD` (no React) |
172
+
173
+ A Server Action that imported `readRequestId` from the main entry would get a
174
+ client reference rather than a function: the import succeeds and the call fails
175
+ at runtime, which is the worst way to learn about a boundary. Hence the split.
176
+
177
+ ## Running the demo
178
+
179
+ `demo/` is a real Next application: a Server Component layout, a client page,
180
+ and a Server Action reading the field back:
181
+
182
+ ```
183
+ pnpm --filter @fingerly/next demo # http://localhost:4178
184
+ ```
185
+
186
+ It collects and submits nothing until you give it somewhere to submit: put `FINGERLY_API_KEY`, `FINGERLY_ENDPOINT` and `FINGERLY_SUBMIT=true` in
187
+ `demo/.env.local` (gitignored), with a key whose allowed origins include the
188
+ port you are running it on. Then the identification produces a real
189
+ `requestId`, the hidden field carries it, and the action prints the one it
190
+ read.
191
+
192
+ Open it twice, in an ordinary window and a private one, and watch the incognito
193
+ card change.
194
+
195
+ ## What this deliberately does not do
196
+
197
+ **It does not proxy the API itself.** Serving the SDK's submissions from your
198
+ own origin is what gets them past content blockers, and the proxy for it lives
199
+ in `@fingerly/node`, because it holds a server secret and has to forward the
200
+ visitor's real address rather than your server's. Create a proxy in the
201
+ dashboard, put it in the route file for the path it issued, and give the
202
+ provider `endpoints="/k7x2qm4a"`:
203
+
204
+ ```ts
205
+ // app/k7x2qm4a/route.ts
206
+ import { Fingerly } from '@fingerly/node'
207
+
208
+ // Built on the first request rather than at import, so `next build` does not
209
+ // need the proxy key.
210
+ let proxy: ((request: Request) => Promise<Response>) | undefined
211
+
212
+ export function POST(request: Request) {
213
+ proxy ??= Fingerly.createProxy({
214
+ proxyKey: process.env.FINGERLY_PROXY_KEY!,
215
+ // The last X-Forwarded-For entry is the address your own server or load
216
+ // balancer saw. Read a CDN's client-IP header instead only when traffic
217
+ // can reach this app through that CDN alone.
218
+ clientIp: (req) => req.headers.get('x-forwarded-for')?.split(',').at(-1)?.trim() ?? '',
219
+ })
220
+ return proxy(request)
221
+ }
222
+ ```
223
+
224
+ Pass the path as a string. An array works too, and is compared by its
225
+ contents, so `endpoints={['/k7x2qm4a']}` does not start a new identification
226
+ when the layout renders again.
227
+
228
+ **It does not read events back.** It does not need to: `identify()` resolves
229
+ with the server's answer (`visitorId`, and `suspectScore` and `suspectLevel`
230
+ unless the key hides them), so there is nothing to fetch afterwards. Reading stored
231
+ events for reporting is `@fingerly/node`'s job.
@@ -0,0 +1,6 @@
1
+ // src/field-name.ts
2
+ var REQUEST_ID_FIELD = "fingerly_request_id";
3
+
4
+ export {
5
+ REQUEST_ID_FIELD
6
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The name of the form field that carries a `requestId` to the server.
3
+ *
4
+ * Its own module, imported by both entries, because it is the one thing the
5
+ * client and the server have to agree on and neither can import the other:
6
+ * the client entry is a `'use client'` module, which a Server Action cannot
7
+ * call into, and `@fingerly/next/server` is the half that runs where there is no
8
+ * React at all.
9
+ *
10
+ * A constant rather than a convention written twice in a README, because the
11
+ * failure when the two drift is a form that submits successfully and a server
12
+ * that quietly never sees an identification.
13
+ */
14
+ declare const REQUEST_ID_FIELD = "fingerly_request_id";
15
+
16
+ export { REQUEST_ID_FIELD as R };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The name of the form field that carries a `requestId` to the server.
3
+ *
4
+ * Its own module, imported by both entries, because it is the one thing the
5
+ * client and the server have to agree on and neither can import the other:
6
+ * the client entry is a `'use client'` module, which a Server Action cannot
7
+ * call into, and `@fingerly/next/server` is the half that runs where there is no
8
+ * React at all.
9
+ *
10
+ * A constant rather than a convention written twice in a README, because the
11
+ * failure when the two drift is a form that submits successfully and a server
12
+ * that quietly never sees an identification.
13
+ */
14
+ declare const REQUEST_ID_FIELD = "fingerly_request_id";
15
+
16
+ export { REQUEST_ID_FIELD as R };
package/dist/index.cjs ADDED
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ ConsentError: () => import_react4.ConsentError,
25
+ FingerlyProvider: () => FingerlyProvider,
26
+ FingerlyRequestId: () => FingerlyRequestId,
27
+ FingerlyServerError: () => import_react3.FingerlyServerError,
28
+ REQUEST_ID_FIELD: () => REQUEST_ID_FIELD,
29
+ TransportError: () => import_react4.TransportError,
30
+ createFingerlyStore: () => import_react3.createFingerlyStore,
31
+ useFingerly: () => import_react3.useFingerly,
32
+ useIdentify: () => import_react3.useIdentify
33
+ });
34
+ module.exports = __toCommonJS(index_exports);
35
+
36
+ // src/provider.tsx
37
+ var import_react = require("@fingerly/react");
38
+ var import_jsx_runtime = require("react/jsx-runtime");
39
+ function fromEnvironment() {
40
+ const apiKey = typeof process === "undefined" ? void 0 : process.env.NEXT_PUBLIC_FINGERLY_API_KEY;
41
+ const endpoint = typeof process === "undefined" ? void 0 : process.env.NEXT_PUBLIC_FINGERLY_ENDPOINT;
42
+ const endpointsRaw = typeof process === "undefined" ? void 0 : process.env.NEXT_PUBLIC_FINGERLY_ENDPOINTS;
43
+ const endpoints = endpointsRaw ? parsedEndpoints(endpointsRaw) : void 0;
44
+ return {
45
+ ...apiKey === void 0 || apiKey === "" ? {} : { apiKey },
46
+ ...endpoint === void 0 || endpoint === "" ? {} : { endpoint },
47
+ ...endpoints === void 0 ? {} : { endpoints }
48
+ };
49
+ }
50
+ var parsedFrom;
51
+ var parsed;
52
+ function parsedEndpoints(raw) {
53
+ if (raw === parsedFrom) return parsed;
54
+ parsedFrom = raw;
55
+ parsed = void 0;
56
+ try {
57
+ const value = JSON.parse(raw);
58
+ if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string")) parsed = value;
59
+ } catch {
60
+ }
61
+ if (parsed === void 0) {
62
+ console.error("[fingerly] NEXT_PUBLIC_FINGERLY_ENDPOINTS must be a non-empty JSON array of strings; it is ignored.");
63
+ }
64
+ return parsed;
65
+ }
66
+ var reportedMissingKey = false;
67
+ function FingerlyProvider(props) {
68
+ const environment = fromEnvironment();
69
+ const apiKey = props.apiKey ?? environment.apiKey;
70
+ const endpoints = props.endpoints ?? environment.endpoints;
71
+ const endpoint = endpoints === void 0 ? props.endpoint ?? environment.endpoint : void 0;
72
+ if (!apiKey && !reportedMissingKey) {
73
+ reportedMissingKey = true;
74
+ console.error(
75
+ "[fingerly] No Fingerly key. Pass one from a Server Component, which is the arrangement that always works:\n\n // app/layout.tsx\n <FingerlyProvider apiKey={process.env.FINGERLY_API_KEY}>\n\nReading it here instead works only where this package is compiled by your app - an app that lists it in `transpilePackages` and sets NEXT_PUBLIC_FINGERLY_API_KEY. A published build cannot rely on that: Next inlines NEXT_PUBLIC_ variables while compiling, and a dependency it does not compile keeps a `process.env` lookup that is undefined in a browser."
76
+ );
77
+ }
78
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
+ import_react.FingerlyProvider,
80
+ {
81
+ apiKey: apiKey ?? "",
82
+ ...endpoint === void 0 ? {} : { endpoint },
83
+ ...props.apiVersion === void 0 ? {} : { apiVersion: props.apiVersion },
84
+ ...endpoints === void 0 ? {} : { endpoints },
85
+ ...props.fallbackToDefaultEndpoint === void 0 ? {} : { fallbackToDefaultEndpoint: props.fallbackToDefaultEndpoint },
86
+ ...props.submit === void 0 ? {} : { submit: props.submit },
87
+ ...props.consent === void 0 ? {} : { consent: props.consent },
88
+ children: props.children
89
+ }
90
+ );
91
+ }
92
+
93
+ // src/field.tsx
94
+ var import_react2 = require("@fingerly/react");
95
+
96
+ // src/field-name.ts
97
+ var REQUEST_ID_FIELD = "fingerly_request_id";
98
+
99
+ // src/field.tsx
100
+ var import_jsx_runtime2 = require("react/jsx-runtime");
101
+ function FingerlyRequestId({ name, immediate = true } = {}) {
102
+ const { requestId } = (0, import_react2.useIdentify)({ immediate });
103
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
104
+ "input",
105
+ {
106
+ type: "hidden",
107
+ name: name ?? REQUEST_ID_FIELD,
108
+ readOnly: true,
109
+ value: requestId ?? ""
110
+ }
111
+ );
112
+ }
113
+
114
+ // src/index.ts
115
+ var import_react3 = require("@fingerly/react");
116
+ var import_react4 = require("@fingerly/react");
117
+ // Annotate the CommonJS export names for ESM import in node:
118
+ 0 && (module.exports = {
119
+ ConsentError,
120
+ FingerlyProvider,
121
+ FingerlyRequestId,
122
+ FingerlyServerError,
123
+ REQUEST_ID_FIELD,
124
+ TransportError,
125
+ createFingerlyStore,
126
+ useFingerly,
127
+ useIdentify
128
+ });
@@ -0,0 +1,70 @@
1
+ import { ConsentState } from '@fingerly/react';
2
+ export { Confidence, ConsentError, ConsentState, FingerlyReactOptions, FingerlyServerError, FingerlyState, FingerlyStore, IdentifyResult, SignalReport, TransportError, UseIdentifyOptions, UseIdentifyReturn, createFingerlyStore, useFingerly, useIdentify } from '@fingerly/react';
3
+ import { ReactNode } from 'react';
4
+ export { R as REQUEST_ID_FIELD } from './field-name-CAkWsUa5.cjs';
5
+
6
+ /**
7
+ * The provider, configured the way a Next app configures things.
8
+ */
9
+
10
+ interface FingerlyNextProviderProps {
11
+ /** Overrides `NEXT_PUBLIC_FINGERLY_API_KEY`. */
12
+ apiKey?: string;
13
+ /** Overrides `NEXT_PUBLIC_FINGERLY_ENDPOINT`. Defaults to production. */
14
+ /** API route version. Defaults to v1. */
15
+ apiVersion?: string;
16
+ endpoint?: string;
17
+ /** Ordered first-party endpoints; overrides NEXT_PUBLIC_FINGERLY_ENDPOINTS. */
18
+ endpoints?: string | readonly string[];
19
+ /** Opt into the Fingerly API after custom endpoints fail. */
20
+ fallbackToDefaultEndpoint?: boolean;
21
+ /** Collect and score without submitting anything. */
22
+ submit?: boolean;
23
+ /**
24
+ * Whether the visitor has agreed to be identified. Defaults to `pending`.
25
+ *
26
+ * Read as the current answer: pass what the consent tool says now, and a
27
+ * change to `granted` starts any automatic identification that was waiting.
28
+ * Deliberately not read from the environment, because it is the visitor's
29
+ * decision rather than the deployment's.
30
+ */
31
+ consent?: ConsentState;
32
+ children?: ReactNode;
33
+ }
34
+ declare function FingerlyProvider(props: FingerlyNextProviderProps): ReactNode;
35
+
36
+ interface FingerlyRequestIdProps {
37
+ /** Overrides the field name. Read it back with the same value. */
38
+ name?: string;
39
+ /**
40
+ * Identify on mount, so the field has something to carry by the time the
41
+ * form is submitted.
42
+ *
43
+ * On by default, because a hidden field whose whole job is to carry a
44
+ * `requestId` and which is empty at submit time is worse than no field: the
45
+ * action succeeds and the event is never correlated. Turn it off in a form
46
+ * that identifies at submit time instead.
47
+ */
48
+ immediate?: boolean;
49
+ }
50
+ /**
51
+ * A hidden input carrying this page's `requestId`.
52
+ *
53
+ * ```tsx
54
+ * <form action={signUp}>
55
+ * <input name="email" />
56
+ * <FingerlyRequestId />
57
+ * <button>Create account</button>
58
+ * </form>
59
+ * ```
60
+ *
61
+ * A Server Action runs where the browser is not, so the identification has to
62
+ * travel with the submission. A form field is how, and it is the option that
63
+ * keeps working without JavaScript having hydrated - the field is in the HTML
64
+ * and empty rather than absent, which the server can tell apart.
65
+ *
66
+ * Read it back with `readRequestId(formData)` from `@fingerly/next/server`.
67
+ */
68
+ declare function FingerlyRequestId({ name, immediate }?: FingerlyRequestIdProps): ReactNode;
69
+
70
+ export { type FingerlyNextProviderProps, FingerlyProvider, FingerlyRequestId, type FingerlyRequestIdProps };
@@ -0,0 +1,70 @@
1
+ import { ConsentState } from '@fingerly/react';
2
+ export { Confidence, ConsentError, ConsentState, FingerlyReactOptions, FingerlyServerError, FingerlyState, FingerlyStore, IdentifyResult, SignalReport, TransportError, UseIdentifyOptions, UseIdentifyReturn, createFingerlyStore, useFingerly, useIdentify } from '@fingerly/react';
3
+ import { ReactNode } from 'react';
4
+ export { R as REQUEST_ID_FIELD } from './field-name-CAkWsUa5.js';
5
+
6
+ /**
7
+ * The provider, configured the way a Next app configures things.
8
+ */
9
+
10
+ interface FingerlyNextProviderProps {
11
+ /** Overrides `NEXT_PUBLIC_FINGERLY_API_KEY`. */
12
+ apiKey?: string;
13
+ /** Overrides `NEXT_PUBLIC_FINGERLY_ENDPOINT`. Defaults to production. */
14
+ /** API route version. Defaults to v1. */
15
+ apiVersion?: string;
16
+ endpoint?: string;
17
+ /** Ordered first-party endpoints; overrides NEXT_PUBLIC_FINGERLY_ENDPOINTS. */
18
+ endpoints?: string | readonly string[];
19
+ /** Opt into the Fingerly API after custom endpoints fail. */
20
+ fallbackToDefaultEndpoint?: boolean;
21
+ /** Collect and score without submitting anything. */
22
+ submit?: boolean;
23
+ /**
24
+ * Whether the visitor has agreed to be identified. Defaults to `pending`.
25
+ *
26
+ * Read as the current answer: pass what the consent tool says now, and a
27
+ * change to `granted` starts any automatic identification that was waiting.
28
+ * Deliberately not read from the environment, because it is the visitor's
29
+ * decision rather than the deployment's.
30
+ */
31
+ consent?: ConsentState;
32
+ children?: ReactNode;
33
+ }
34
+ declare function FingerlyProvider(props: FingerlyNextProviderProps): ReactNode;
35
+
36
+ interface FingerlyRequestIdProps {
37
+ /** Overrides the field name. Read it back with the same value. */
38
+ name?: string;
39
+ /**
40
+ * Identify on mount, so the field has something to carry by the time the
41
+ * form is submitted.
42
+ *
43
+ * On by default, because a hidden field whose whole job is to carry a
44
+ * `requestId` and which is empty at submit time is worse than no field: the
45
+ * action succeeds and the event is never correlated. Turn it off in a form
46
+ * that identifies at submit time instead.
47
+ */
48
+ immediate?: boolean;
49
+ }
50
+ /**
51
+ * A hidden input carrying this page's `requestId`.
52
+ *
53
+ * ```tsx
54
+ * <form action={signUp}>
55
+ * <input name="email" />
56
+ * <FingerlyRequestId />
57
+ * <button>Create account</button>
58
+ * </form>
59
+ * ```
60
+ *
61
+ * A Server Action runs where the browser is not, so the identification has to
62
+ * travel with the submission. A form field is how, and it is the option that
63
+ * keeps working without JavaScript having hydrated - the field is in the HTML
64
+ * and empty rather than absent, which the server can tell apart.
65
+ *
66
+ * Read it back with `readRequestId(formData)` from `@fingerly/next/server`.
67
+ */
68
+ declare function FingerlyRequestId({ name, immediate }?: FingerlyRequestIdProps): ReactNode;
69
+
70
+ export { type FingerlyNextProviderProps, FingerlyProvider, FingerlyRequestId, type FingerlyRequestIdProps };
package/dist/index.js ADDED
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import {
3
+ REQUEST_ID_FIELD
4
+ } from "./chunk-2RV4QBLR.js";
5
+
6
+ // src/provider.tsx
7
+ import { FingerlyProvider as ReactFingerlyProvider } from "@fingerly/react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function fromEnvironment() {
10
+ const apiKey = typeof process === "undefined" ? void 0 : process.env.NEXT_PUBLIC_FINGERLY_API_KEY;
11
+ const endpoint = typeof process === "undefined" ? void 0 : process.env.NEXT_PUBLIC_FINGERLY_ENDPOINT;
12
+ const endpointsRaw = typeof process === "undefined" ? void 0 : process.env.NEXT_PUBLIC_FINGERLY_ENDPOINTS;
13
+ const endpoints = endpointsRaw ? parsedEndpoints(endpointsRaw) : void 0;
14
+ return {
15
+ ...apiKey === void 0 || apiKey === "" ? {} : { apiKey },
16
+ ...endpoint === void 0 || endpoint === "" ? {} : { endpoint },
17
+ ...endpoints === void 0 ? {} : { endpoints }
18
+ };
19
+ }
20
+ var parsedFrom;
21
+ var parsed;
22
+ function parsedEndpoints(raw) {
23
+ if (raw === parsedFrom) return parsed;
24
+ parsedFrom = raw;
25
+ parsed = void 0;
26
+ try {
27
+ const value = JSON.parse(raw);
28
+ if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string")) parsed = value;
29
+ } catch {
30
+ }
31
+ if (parsed === void 0) {
32
+ console.error("[fingerly] NEXT_PUBLIC_FINGERLY_ENDPOINTS must be a non-empty JSON array of strings; it is ignored.");
33
+ }
34
+ return parsed;
35
+ }
36
+ var reportedMissingKey = false;
37
+ function FingerlyProvider(props) {
38
+ const environment = fromEnvironment();
39
+ const apiKey = props.apiKey ?? environment.apiKey;
40
+ const endpoints = props.endpoints ?? environment.endpoints;
41
+ const endpoint = endpoints === void 0 ? props.endpoint ?? environment.endpoint : void 0;
42
+ if (!apiKey && !reportedMissingKey) {
43
+ reportedMissingKey = true;
44
+ console.error(
45
+ "[fingerly] No Fingerly key. Pass one from a Server Component, which is the arrangement that always works:\n\n // app/layout.tsx\n <FingerlyProvider apiKey={process.env.FINGERLY_API_KEY}>\n\nReading it here instead works only where this package is compiled by your app - an app that lists it in `transpilePackages` and sets NEXT_PUBLIC_FINGERLY_API_KEY. A published build cannot rely on that: Next inlines NEXT_PUBLIC_ variables while compiling, and a dependency it does not compile keeps a `process.env` lookup that is undefined in a browser."
46
+ );
47
+ }
48
+ return /* @__PURE__ */ jsx(
49
+ ReactFingerlyProvider,
50
+ {
51
+ apiKey: apiKey ?? "",
52
+ ...endpoint === void 0 ? {} : { endpoint },
53
+ ...props.apiVersion === void 0 ? {} : { apiVersion: props.apiVersion },
54
+ ...endpoints === void 0 ? {} : { endpoints },
55
+ ...props.fallbackToDefaultEndpoint === void 0 ? {} : { fallbackToDefaultEndpoint: props.fallbackToDefaultEndpoint },
56
+ ...props.submit === void 0 ? {} : { submit: props.submit },
57
+ ...props.consent === void 0 ? {} : { consent: props.consent },
58
+ children: props.children
59
+ }
60
+ );
61
+ }
62
+
63
+ // src/field.tsx
64
+ import { useIdentify } from "@fingerly/react";
65
+ import { jsx as jsx2 } from "react/jsx-runtime";
66
+ function FingerlyRequestId({ name, immediate = true } = {}) {
67
+ const { requestId } = useIdentify({ immediate });
68
+ return /* @__PURE__ */ jsx2(
69
+ "input",
70
+ {
71
+ type: "hidden",
72
+ name: name ?? REQUEST_ID_FIELD,
73
+ readOnly: true,
74
+ value: requestId ?? ""
75
+ }
76
+ );
77
+ }
78
+
79
+ // src/index.ts
80
+ import { useFingerly, useIdentify as useIdentify2, createFingerlyStore, FingerlyServerError } from "@fingerly/react";
81
+ import { ConsentError, TransportError } from "@fingerly/react";
82
+ export {
83
+ ConsentError,
84
+ FingerlyProvider,
85
+ FingerlyRequestId,
86
+ FingerlyServerError,
87
+ REQUEST_ID_FIELD,
88
+ TransportError,
89
+ createFingerlyStore,
90
+ useFingerly,
91
+ useIdentify2 as useIdentify
92
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/server.ts
21
+ var server_exports = {};
22
+ __export(server_exports, {
23
+ REQUEST_ID_FIELD: () => REQUEST_ID_FIELD,
24
+ createFingerlyProxy: () => import_node.createProxy,
25
+ readRequestId: () => readRequestId
26
+ });
27
+ module.exports = __toCommonJS(server_exports);
28
+
29
+ // src/field-name.ts
30
+ var REQUEST_ID_FIELD = "fingerly_request_id";
31
+
32
+ // src/server.ts
33
+ var import_node = require("@fingerly/node");
34
+ var MAX_LENGTH = 128;
35
+ var SHAPE = /^[A-Za-z0-9_-]+$/;
36
+ function readRequestId(formData, options = {}) {
37
+ const value = formData.get(options.name ?? REQUEST_ID_FIELD);
38
+ if (typeof value !== "string") return null;
39
+ const trimmed = value.trim();
40
+ if (trimmed.length === 0 || trimmed.length > MAX_LENGTH) return null;
41
+ if (!SHAPE.test(trimmed)) return null;
42
+ return trimmed;
43
+ }
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ REQUEST_ID_FIELD,
47
+ createFingerlyProxy,
48
+ readRequestId
49
+ });
@@ -0,0 +1,38 @@
1
+ export { R as REQUEST_ID_FIELD } from './field-name-CAkWsUa5.cjs';
2
+ export { ProxyOptions as FingerlyProxyOptions, createProxy as createFingerlyProxy } from '@fingerly/node';
3
+
4
+ /**
5
+ * `@fingerly/next/server` - the half that runs where there is no browser.
6
+ *
7
+ * A separate entry, and it has to be. Everything in the main entry is a
8
+ * `'use client'` module, and a Server Action that imported from there would
9
+ * get a client reference rather than a function - the import succeeds and the
10
+ * call fails at runtime, which is the worst way to learn about a boundary.
11
+ *
12
+ * Nothing here touches React.
13
+ */
14
+
15
+ /**
16
+ * Read the `requestId` a `<FingerlyRequestId />` field carried into an action.
17
+ *
18
+ * ```ts
19
+ * 'use server'
20
+ * import { readRequestId } from '@fingerly/next/server'
21
+ *
22
+ * export async function signUp(formData: FormData) {
23
+ * const requestId = readRequestId(formData)
24
+ * // correlate the signup with the identification, or proceed without one
25
+ * }
26
+ * ```
27
+ *
28
+ * Returns null rather than throwing when the field is missing, empty or
29
+ * malformed, because all three mean the same thing to the caller: this
30
+ * submission has no identification attached. A form submitted before the SDK
31
+ * finished, or with JavaScript disabled, is a normal event and not an error -
32
+ * what the server does about it is a policy the server owns.
33
+ */
34
+ declare function readRequestId(formData: Pick<FormData, 'get'>, options?: {
35
+ name?: string;
36
+ }): string | null;
37
+
38
+ export { readRequestId };
@@ -0,0 +1,38 @@
1
+ export { R as REQUEST_ID_FIELD } from './field-name-CAkWsUa5.js';
2
+ export { ProxyOptions as FingerlyProxyOptions, createProxy as createFingerlyProxy } from '@fingerly/node';
3
+
4
+ /**
5
+ * `@fingerly/next/server` - the half that runs where there is no browser.
6
+ *
7
+ * A separate entry, and it has to be. Everything in the main entry is a
8
+ * `'use client'` module, and a Server Action that imported from there would
9
+ * get a client reference rather than a function - the import succeeds and the
10
+ * call fails at runtime, which is the worst way to learn about a boundary.
11
+ *
12
+ * Nothing here touches React.
13
+ */
14
+
15
+ /**
16
+ * Read the `requestId` a `<FingerlyRequestId />` field carried into an action.
17
+ *
18
+ * ```ts
19
+ * 'use server'
20
+ * import { readRequestId } from '@fingerly/next/server'
21
+ *
22
+ * export async function signUp(formData: FormData) {
23
+ * const requestId = readRequestId(formData)
24
+ * // correlate the signup with the identification, or proceed without one
25
+ * }
26
+ * ```
27
+ *
28
+ * Returns null rather than throwing when the field is missing, empty or
29
+ * malformed, because all three mean the same thing to the caller: this
30
+ * submission has no identification attached. A form submitted before the SDK
31
+ * finished, or with JavaScript disabled, is a normal event and not an error -
32
+ * what the server does about it is a policy the server owns.
33
+ */
34
+ declare function readRequestId(formData: Pick<FormData, 'get'>, options?: {
35
+ name?: string;
36
+ }): string | null;
37
+
38
+ export { readRequestId };
package/dist/server.js ADDED
@@ -0,0 +1,21 @@
1
+ import {
2
+ REQUEST_ID_FIELD
3
+ } from "./chunk-2RV4QBLR.js";
4
+
5
+ // src/server.ts
6
+ import { createProxy } from "@fingerly/node";
7
+ var MAX_LENGTH = 128;
8
+ var SHAPE = /^[A-Za-z0-9_-]+$/;
9
+ function readRequestId(formData, options = {}) {
10
+ const value = formData.get(options.name ?? REQUEST_ID_FIELD);
11
+ if (typeof value !== "string") return null;
12
+ const trimmed = value.trim();
13
+ if (trimmed.length === 0 || trimmed.length > MAX_LENGTH) return null;
14
+ if (!SHAPE.test(trimmed)) return null;
15
+ return trimmed;
16
+ }
17
+ export {
18
+ REQUEST_ID_FIELD,
19
+ createProxy as createFingerlyProxy,
20
+ readRequestId
21
+ };
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@fingerly/next",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "Next.js integration wrapping @fingerly/react",
8
+ "license": "Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/fingerly-io/sdks.git",
12
+ "directory": "client/web/next"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.cjs",
16
+ "module": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js",
22
+ "require": "./dist/index.cjs"
23
+ },
24
+ "./server": {
25
+ "types": "./dist/server.d.ts",
26
+ "import": "./dist/server.js",
27
+ "require": "./dist/server.cjs"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "sideEffects": false,
34
+ "dependencies": {
35
+ "@fingerly/node": "0.1.1",
36
+ "@fingerly/react": "0.1.1"
37
+ },
38
+ "peerDependencies": {
39
+ "next": ">=15",
40
+ "react": ">=19"
41
+ },
42
+ "devDependencies": {
43
+ "@types/react": "^19.2.7",
44
+ "@types/react-dom": "^19.2.3",
45
+ "happy-dom": "^15.11.7",
46
+ "next": "^16.3.3",
47
+ "react": "^19.2.8",
48
+ "react-dom": "^19.2.8",
49
+ "tsup": "^8.3.5",
50
+ "typescript": "^5.7.2",
51
+ "vitest": "^2.1.8",
52
+ "@fingerly/web-js": "0.1.1"
53
+ },
54
+ "scripts": {
55
+ "build": "tsup",
56
+ "lint": "tsc --noEmit",
57
+ "test": "vitest run",
58
+ "demo": "tsup && next dev demo --port 4178"
59
+ }
6
60
  }