@becklinks/next 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Beck Link
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,47 @@
1
- # Temporary Holding Version
1
+ # @becklinks/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
+ Beck Links for Next.js 14 and newer (App Router and Pages Router). Two entry points:
4
+
5
+ - `@becklinks/next`: for the browser. The provider, the `useCreateLink` hook and the `SmartBanner`
6
+ component, already marked `'use client'`.
7
+ - `@becklinks/next/server`: for your server code. Creates links with your **secret key**.
8
+
9
+ ```bash
10
+ npm install @becklinks/next
11
+ ```
12
+
13
+ ```tsx
14
+ // app/beck-links.tsx
15
+ 'use client';
16
+
17
+ import { BeckLinksProvider, SmartBanner } from '@becklinks/next';
18
+
19
+ export function BeckLinks({ children }: { children: React.ReactNode }) {
20
+ return (
21
+ <BeckLinksProvider publishableKey={process.env.NEXT_PUBLIC_BECKLINKS_KEY ?? ''}>
22
+ <SmartBanner url="https://yourproject.becklinks.com/summer" title="Open in the Acme app" />
23
+ {children}
24
+ </BeckLinksProvider>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ```ts
30
+ // app/api/share/route.ts
31
+ import { createServerBeckLinks } from '@becklinks/next/server';
32
+
33
+ const beckLinks = createServerBeckLinks(); // reads BECKLINKS_SECRET_KEY
34
+
35
+ export async function POST() {
36
+ const link = await beckLinks.createLink({ deepLinkPath: '/product/42', path: 'p-42' });
37
+ return Response.json({ url: link.url });
38
+ }
39
+ ```
40
+
41
+ Only the **publishable** key (`pk_…`) may carry the `NEXT_PUBLIC_` prefix. The secret key
42
+ (`sk_…`) lives in a server-only environment variable; the server helper refuses a publishable key and
43
+ refuses to run in a browser. List your website under **Settings → Web origins** in the Beck Links
44
+ dashboard so browsers may use the publishable key.
45
+
46
+ Documentation: [docs.becklinks.com/nextjs-sdk](https://docs.becklinks.com/nextjs-sdk) · MIT licensed,
47
+ made by [Tecbeck](https://tecbeck.com).
@@ -0,0 +1,7 @@
1
+ import type { BeckLinksProviderProps } from '@becklinks/react';
2
+ import type { ReactElement } from 'react';
3
+ /** The provider of @becklinks/react, reporting itself as `becklinks_next`. */
4
+ export declare function BeckLinksProvider(props: BeckLinksProviderProps): ReactElement;
5
+ export { SmartBanner, useBeckLinks, useCreateLink, BeckLinksError } from '@becklinks/react';
6
+ export type { BannerHandle, BannerOptions, BeckLink, BeckLinksClient, BeckLinksOptions, BeckLinksProviderProps, CreateLinkInput, MobilePlatform, SmartBannerProps, UseCreateLink, UtmParameters, } from '@becklinks/react';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAM7E;AAED,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5F,YAAY,EACV,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,GACd,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+ // Client entry of @becklinks/next. Everything here runs in the browser (it is marked
3
+ // 'use client'), so import it from Client Components or from a small client wrapper in your
4
+ // layout. The secret-key helper lives in '@becklinks/next/server'.
5
+ import { BeckLinksProvider as ReactProvider } from '@becklinks/react';
6
+ import { createElement } from 'react';
7
+ const NEXT_SDK_NAME = 'becklinks_next';
8
+ const NEXT_SDK_VERSION = '0.1.0';
9
+ /** The provider of @becklinks/react, reporting itself as `becklinks_next`. */
10
+ export function BeckLinksProvider(props) {
11
+ return createElement(ReactProvider, {
12
+ sdkName: NEXT_SDK_NAME,
13
+ sdkVersion: NEXT_SDK_VERSION,
14
+ ...props,
15
+ });
16
+ }
17
+ export { SmartBanner, useBeckLinks, useCreateLink, BeckLinksError } from '@becklinks/react';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,qFAAqF;AACrF,4FAA4F;AAC5F,mEAAmE;AACnE,OAAO,EAAE,iBAAiB,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,MAAM,aAAa,GAAG,gBAAgB,CAAC;AACvC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAEjC,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,OAAO,aAAa,CAAC,aAAa,EAAE;QAClC,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,gBAAgB;QAC5B,GAAG,KAAK;KACT,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { CreateLinkInput } from '@becklinks/web';
2
+ export { BeckLinksError } from '@becklinks/web';
3
+ export type { CreateLinkInput, UtmParameters } from '@becklinks/web';
4
+ export interface ServerBeckLinksOptions {
5
+ /** Defaults to the `BECKLINKS_SECRET_KEY` environment variable. */
6
+ readonly secretKey?: string;
7
+ readonly apiUrl?: string;
8
+ /** Per request, default 10 000 ms. */
9
+ readonly timeoutMs?: number;
10
+ readonly fetch?: typeof fetch;
11
+ }
12
+ export interface ServerLinkInput extends CreateLinkInput {
13
+ /** A custom short path, 1–64 characters of letters, digits, "-" and "_". Omit for a generated one. */
14
+ readonly path?: string;
15
+ /** A label for the dashboard. */
16
+ readonly name?: string;
17
+ }
18
+ export interface ServerLink {
19
+ readonly id: string;
20
+ readonly url: string;
21
+ readonly path: string;
22
+ readonly status: string;
23
+ readonly createdAt: Date;
24
+ readonly expiresAt: Date | null;
25
+ }
26
+ export interface ServerBeckLinks {
27
+ /**
28
+ * Creates a link with the REST API (`POST /v1/links`). Pass `idempotencyKey` when you retry a
29
+ * call yourself: the same key returns the same link instead of a second one.
30
+ */
31
+ createLink: (input: ServerLinkInput, options?: {
32
+ idempotencyKey?: string;
33
+ }) => Promise<ServerLink>;
34
+ }
35
+ /** Creates the server helper. Throws `BeckLinksError` (kind `configuration`) for a bad key. */
36
+ export declare function createServerBeckLinks(options?: ServerBeckLinksOptions): ServerBeckLinks;
37
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAOrE,MAAM,WAAW,sBAAsB;IACrC,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CAC/B;AAED,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,sGAAsG;IACtG,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,UAAU,EAAE,CACV,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,KAClC,OAAO,CAAC,UAAU,CAAC,CAAC;CAC1B;AAqDD,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAoF3F"}
package/dist/server.js ADDED
@@ -0,0 +1,138 @@
1
+ // Server entry of @becklinks/next. It uses a SECRET key (`sk_…`), which must never reach a browser,
2
+ // so it refuses to run where `window` exists. Use it in Route Handlers, Server Actions, Server
3
+ // Components and `getServerSideProps`.
4
+ import { BeckLinksError } from '@becklinks/web';
5
+ export { BeckLinksError } from '@becklinks/web';
6
+ const DEFAULT_API_URL = 'https://api.becklinks.com';
7
+ const SECRET_KEY = /^sk_(test|live)_[A-Za-z0-9]{8,}$/;
8
+ const SDK_NAME = 'becklinks_next';
9
+ const SDK_VERSION = '0.1.0';
10
+ function configurationError(message) {
11
+ return new BeckLinksError({ kind: 'configuration', message });
12
+ }
13
+ function text(record, name) {
14
+ const value = record[name];
15
+ if (typeof value !== 'string') {
16
+ throw new BeckLinksError({
17
+ kind: 'unexpected_response',
18
+ message: `The link response is missing "${name}".`,
19
+ });
20
+ }
21
+ return value;
22
+ }
23
+ function body(input) {
24
+ const expires = input.expiresAt === undefined ? undefined : new Date(input.expiresAt).toISOString();
25
+ return {
26
+ deep_link_path: input.deepLinkPath,
27
+ ...(input.path === undefined ? {} : { path: input.path }),
28
+ ...(input.name === undefined ? {} : { name: input.name }),
29
+ ...(input.data === undefined ? {} : { data: input.data }),
30
+ ...(input.campaign === undefined ? {} : { campaign: input.campaign }),
31
+ ...(input.utm === undefined ? {} : { utm: input.utm }),
32
+ ...(expires === undefined ? {} : { expires_at: expires }),
33
+ };
34
+ }
35
+ async function readProblem(response) {
36
+ let problem = {};
37
+ try {
38
+ const parsed = await response.json();
39
+ if (typeof parsed === 'object' && parsed !== null)
40
+ problem = parsed;
41
+ }
42
+ catch {
43
+ // Not JSON: the status says enough.
44
+ }
45
+ const code = typeof problem.code === 'string' ? problem.code : undefined;
46
+ const detail = typeof problem.detail === 'string' ? problem.detail : undefined;
47
+ const requestId = response.headers.get('x-request-id');
48
+ const retryAfter = Number(response.headers.get('retry-after'));
49
+ return new BeckLinksError({
50
+ kind: 'api',
51
+ message: detail ?? `The API answered ${String(response.status)}.`,
52
+ status: response.status,
53
+ ...(code === undefined ? {} : { code }),
54
+ ...(requestId === null ? {} : { requestId }),
55
+ ...(Number.isFinite(retryAfter) && retryAfter > 0 ? { retryAfterSeconds: retryAfter } : {}),
56
+ });
57
+ }
58
+ /** Creates the server helper. Throws `BeckLinksError` (kind `configuration`) for a bad key. */
59
+ export function createServerBeckLinks(options = {}) {
60
+ if (typeof window !== 'undefined') {
61
+ throw configurationError('@becklinks/next/server uses a secret key and must run on the server, never in the browser.');
62
+ }
63
+ const secretKey = options.secretKey ?? process.env.BECKLINKS_SECRET_KEY;
64
+ if (secretKey === undefined || secretKey === '') {
65
+ throw configurationError('No secret key. Set BECKLINKS_SECRET_KEY (sk_test_… or sk_live_…) or pass secretKey.');
66
+ }
67
+ if (secretKey.startsWith('pk_')) {
68
+ throw configurationError('This is a publishable key (pk_…). The server helper needs a secret key (sk_…).');
69
+ }
70
+ if (!SECRET_KEY.test(secretKey)) {
71
+ throw configurationError('secretKey must look like sk_test_… or sk_live_….');
72
+ }
73
+ const apiUrl = (options.apiUrl ?? DEFAULT_API_URL).replace(/\/+$/, '');
74
+ if (!apiUrl.startsWith('https://') &&
75
+ !/^http:\/\/(localhost|[^/]*\.localhost)(:\d+)?$/.test(apiUrl)) {
76
+ throw configurationError('apiUrl must be https (http is accepted for localhost only).');
77
+ }
78
+ const fetchImpl = options.fetch ?? fetch;
79
+ const timeoutMs = options.timeoutMs ?? 10_000;
80
+ return {
81
+ async createLink(input, callOptions) {
82
+ const controller = new AbortController();
83
+ const timer = setTimeout(() => {
84
+ controller.abort();
85
+ }, timeoutMs);
86
+ let response;
87
+ try {
88
+ response = await fetchImpl(`${apiUrl}/v1/links`, {
89
+ method: 'POST',
90
+ headers: {
91
+ authorization: `Bearer ${secretKey}`,
92
+ 'content-type': 'application/json',
93
+ 'idempotency-key': callOptions?.idempotencyKey ?? crypto.randomUUID(),
94
+ 'user-agent': `${SDK_NAME}/${SDK_VERSION}`,
95
+ 'x-sdk-name': SDK_NAME,
96
+ 'x-sdk-version': SDK_VERSION,
97
+ },
98
+ body: JSON.stringify(body(input)),
99
+ signal: controller.signal,
100
+ cache: 'no-store',
101
+ });
102
+ }
103
+ catch (error) {
104
+ throw new BeckLinksError({
105
+ kind: 'network',
106
+ message: controller.signal.aborted
107
+ ? `The request timed out after ${String(timeoutMs)} ms.`
108
+ : 'The request did not reach Beck Links.',
109
+ cause: error,
110
+ });
111
+ }
112
+ finally {
113
+ clearTimeout(timer);
114
+ }
115
+ if (!response.ok)
116
+ throw await readProblem(response);
117
+ const parsed = await response.json().catch(() => null);
118
+ if (typeof parsed !== 'object' || parsed === null) {
119
+ throw new BeckLinksError({
120
+ kind: 'unexpected_response',
121
+ message: 'The API answered with a body that is not JSON.',
122
+ status: response.status,
123
+ });
124
+ }
125
+ const record = parsed;
126
+ const expiresAt = record.expires_at;
127
+ return {
128
+ id: text(record, 'id'),
129
+ url: text(record, 'url'),
130
+ path: text(record, 'path'),
131
+ status: text(record, 'status'),
132
+ createdAt: new Date(text(record, 'created_at')),
133
+ expiresAt: typeof expiresAt === 'string' ? new Date(expiresAt) : null,
134
+ };
135
+ },
136
+ };
137
+ }
138
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,+FAA+F;AAC/F,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIhD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,MAAM,UAAU,GAAG,kCAAkC,CAAC;AACtD,MAAM,QAAQ,GAAG,gBAAgB,CAAC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,CAAC;YACL,CAAC;oBAAS,CAAC;gBACT,YAAY,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,MAAM,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;YACpD,MAAM,MAAM,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YAChE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gBAClD,MAAM,IAAI,cAAc,CAAC;oBACvB,IAAI,EAAE,qBAAqB;oBAC3B,OAAO,EAAE,gDAAgD;oBACzD,MAAM,EAAE,QAAQ,CAAC,MAAM;iBACxB,CAAC,CAAC;YACL,CAAC;YACD,MAAM,MAAM,GAAG,MAA2C,CAAC;YAC3D,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC;YACpC,OAAO;gBACL,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;gBACtB,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;gBACxB,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;gBAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC;gBAC9B,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBAC/C,SAAS,EAAE,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI;aACtE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "@becklinks/next",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Beck Links for Next.js (App Router and Pages): client provider, hooks, banner, and a server helper that creates links with your secret key.",
5
+ "keywords": [
6
+ "nextjs",
7
+ "next",
8
+ "deep links",
9
+ "smart banner",
10
+ "becklinks"
11
+ ],
12
+ "homepage": "https://docs.becklinks.com/sdks/nextjs",
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "sideEffects": false,
16
+ "main": "./dist/index.js",
17
+ "module": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./server": {
25
+ "types": "./dist/server.d.ts",
26
+ "default": "./dist/server.js"
27
+ },
28
+ "./package.json": "./package.json"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "dependencies": {
36
+ "@becklinks/web": "^0.1.0",
37
+ "@becklinks/react": "^0.1.0"
38
+ },
39
+ "peerDependencies": {
40
+ "next": ">=14",
41
+ "react": ">=18"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^24.19.1",
45
+ "@types/react": "19.3.0",
46
+ "@types/react-dom": "19.3.0",
47
+ "eslint": "10.12.0",
48
+ "jsdom": "30.1.3",
49
+ "react": "19.3.0",
50
+ "react-dom": "19.3.0",
51
+ "typescript": "6.0.3",
52
+ "vitest": "5.0.3",
53
+ "@becklink/config": "0.0.0"
54
+ },
55
+ "engines": {
56
+ "node": ">=18"
57
+ },
58
+ "scripts": {
59
+ "build": "tsc -p tsconfig.build.json",
60
+ "typecheck": "tsc -p tsconfig.json --noEmit",
61
+ "lint": "eslint .",
62
+ "test": "vitest run",
63
+ "clean": "rimraf dist coverage"
64
+ }
6
65
  }