@alpaca-headless/alpaca-headless-nextjs 1.0.3390 → 1.0.3399

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.
Files changed (81) hide show
  1. package/.eslintrc.json +3 -0
  2. package/README.md +36 -0
  3. package/dist/EditorIntegration.d.ts +6 -0
  4. package/dist/EditorIntegration.js +5 -0
  5. package/dist/EditorIntegrationClient.d.ts +9 -0
  6. package/dist/EditorIntegrationClient.js +54 -0
  7. package/dist/client-components/MultiComponentEditor.d.ts +12 -0
  8. package/dist/client-components/MultiComponentEditor.js +47 -0
  9. package/dist/client-components/index.d.ts +1 -0
  10. package/dist/client-components/index.js +2 -0
  11. package/dist/handleBasicAuthRoute.d.ts +8 -0
  12. package/dist/handleBasicAuthRoute.js +42 -0
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.js +11 -0
  15. package/dist/middleware/handleRequest.d.ts +8 -0
  16. package/dist/middleware/handleRequest.js +42 -0
  17. package/dist/middleware/index.d.ts +1 -0
  18. package/dist/middleware/index.js +1 -0
  19. package/dist/proxy/index.d.ts +8 -0
  20. package/dist/proxy/index.js +77 -0
  21. package/dist/useExposeRefreshFunction.d.ts +7 -0
  22. package/dist/useExposeRefreshFunction.js +32 -0
  23. package/next.config.mjs +4 -0
  24. package/package.json +51 -29
  25. package/postcss.config.js +6 -0
  26. package/src/EditorIntegration.tsx +11 -0
  27. package/src/EditorIntegrationClient.tsx +74 -0
  28. package/src/client-components/MultiComponentEditor.tsx +133 -0
  29. package/src/client-components/index.ts +3 -0
  30. package/src/handleBasicAuthRoute.ts +62 -0
  31. package/src/index.ts +15 -0
  32. package/src/middleware/handleRequest.ts +62 -0
  33. package/src/middleware/index.ts +1 -0
  34. package/src/proxy/index.ts +108 -0
  35. package/src/useExposeRefreshFunction.ts +45 -0
  36. package/tailwind.config.js +17 -0
  37. package/tailwind.config.ts +20 -0
  38. package/tsconfig.json +26 -0
  39. package/dist/cjs/alpacaContext.js +0 -12
  40. package/dist/cjs/components/Image.js +0 -36
  41. package/dist/cjs/components/Link.js +0 -22
  42. package/dist/cjs/components/Picture.js +0 -116
  43. package/dist/cjs/components/Placeholder.js +0 -55
  44. package/dist/cjs/components/RichText.js +0 -42
  45. package/dist/cjs/components/Text.js +0 -39
  46. package/dist/cjs/components/index.js +0 -22
  47. package/dist/cjs/fieldTypes.js +0 -2
  48. package/dist/cjs/graphQLTypes.js +0 -2
  49. package/dist/cjs/index.js +0 -36
  50. package/dist/cjs/layoutData.js +0 -2
  51. package/dist/cjs/loadRouteData.js +0 -114
  52. package/dist/cjs/mediaProtection.js +0 -56
  53. package/dist/esm/alpacaContext.js +0 -8
  54. package/dist/esm/components/Image.js +0 -32
  55. package/dist/esm/components/Link.js +0 -18
  56. package/dist/esm/components/Picture.js +0 -112
  57. package/dist/esm/components/Placeholder.js +0 -51
  58. package/dist/esm/components/RichText.js +0 -35
  59. package/dist/esm/components/Text.js +0 -32
  60. package/dist/esm/components/index.js +0 -6
  61. package/dist/esm/fieldTypes.js +0 -1
  62. package/dist/esm/graphQLTypes.js +0 -1
  63. package/dist/esm/index.js +0 -7
  64. package/dist/esm/layoutData.js +0 -1
  65. package/dist/esm/loadRouteData.js +0 -110
  66. package/dist/esm/mediaProtection.js +0 -49
  67. package/next.config.js +0 -6
  68. package/types/alpacaContext.d.ts +0 -19
  69. package/types/components/Image.d.ts +0 -10
  70. package/types/components/Link.d.ts +0 -6
  71. package/types/components/Picture.d.ts +0 -20
  72. package/types/components/Placeholder.d.ts +0 -5
  73. package/types/components/RichText.d.ts +0 -282
  74. package/types/components/Text.d.ts +0 -278
  75. package/types/components/index.d.ts +0 -6
  76. package/types/fieldTypes.d.ts +0 -62
  77. package/types/graphQLTypes.d.ts +0 -26
  78. package/types/index.d.ts +0 -7
  79. package/types/layoutData.d.ts +0 -11
  80. package/types/loadRouteData.d.ts +0 -36
  81. package/types/mediaProtection.d.ts +0 -2
@@ -0,0 +1,133 @@
1
+ "use client";
2
+ import { ComponentData } from "@alpaca-headless/alpaca-headless";
3
+
4
+ import React, {
5
+ useState,
6
+ ReactElement,
7
+ ReactNode,
8
+ useEffect,
9
+ Fragment,
10
+ useCallback,
11
+ } from "react";
12
+
13
+ interface MultiComponentEditorProps {
14
+ children: ReactNode;
15
+ component: ComponentData;
16
+ placeholderName: string;
17
+ thumbZoom?: number;
18
+ thumbWidth?: string;
19
+ thumbHeight?: string;
20
+ }
21
+
22
+ export function MultiComponentEditor({
23
+ children,
24
+ component,
25
+ placeholderName,
26
+ thumbZoom,
27
+ thumbWidth = "200px",
28
+ thumbHeight = "112px",
29
+ }: MultiComponentEditorProps) {
30
+ const [selectedId, setSelectedId] = useState<string | null>(null);
31
+ const placeholder = component.placeholders.find(
32
+ (x) => x.name === placeholderName
33
+ );
34
+ if (!placeholder) return;
35
+ const components = placeholder.components;
36
+ if (!components) return;
37
+
38
+ const handleMessage = useCallback(
39
+ (event: MessageEvent) => {
40
+ if (event.data.type === "componentsSelected") {
41
+ setSelectedId(event.data.componentIds[0]);
42
+ }
43
+ },
44
+ [components]
45
+ );
46
+
47
+ useEffect(() => {
48
+ window.addEventListener("message", handleMessage);
49
+
50
+ return () => {
51
+ window.removeEventListener("message", handleMessage);
52
+ };
53
+ }, []);
54
+
55
+ const selectedIndex = components.findIndex(
56
+ (x: ComponentData) => x.id === selectedId
57
+ );
58
+
59
+ const childrenArray = React.Children.toArray(children) as ReactElement[];
60
+
61
+ const filteredChildren = childrenArray.filter(
62
+ (child) => child.type !== "script"
63
+ );
64
+
65
+ return (
66
+ <>
67
+ {filteredChildren[selectedIndex < 0 ? 0 : selectedIndex]}
68
+ <div className="a-editor-mce">
69
+ <script
70
+ data-placeholder-start={placeholder.key}
71
+ data-orientation="horizontal"
72
+ />
73
+ {filteredChildren.map((x, index) => thumbnail(x, index))}
74
+ <script data-placeholder-end={placeholder.key} />
75
+ </div>
76
+ </>
77
+ );
78
+
79
+ function thumbnail(x: React.ReactNode, index: number) {
80
+ const style: {
81
+ height?: string;
82
+ width?: string;
83
+ zoom?: number;
84
+ transform?: string;
85
+ } = {};
86
+
87
+ if (thumbHeight) {
88
+ style.height = thumbHeight;
89
+ }
90
+ if (thumbWidth) {
91
+ style.width = thumbWidth;
92
+ }
93
+
94
+ const componentArray = (x as any).props?.children;
95
+
96
+ const component = components![index];
97
+
98
+ return (
99
+ <Fragment key={index}>
100
+ <div
101
+ className={
102
+ "a-editor-mce-thumbnail" +
103
+ (index === selectedIndex ? " a-editor-mce-thumbnail--selected" : "")
104
+ }
105
+ style={style}
106
+ onClick={() => {
107
+ selectComponents([components![index].id]);
108
+ }}
109
+ >
110
+ <script
111
+ data-component-start={component.id}
112
+ data-itemid={
113
+ component._editor?.linkedComponentItem?.id || component.id
114
+ }
115
+ data-layoutid={component._editor?.hostingPageItem?.id}
116
+ />
117
+ <div style={{ pointerEvents: "none", zoom: thumbZoom || 0.25 }}>
118
+ {componentArray.slice(1, -1)}
119
+ </div>
120
+ <script data-component-end={component.id} />
121
+ </div>
122
+ <div data-dropzone={components[index].id}></div>
123
+ </Fragment>
124
+ );
125
+ }
126
+ }
127
+
128
+ function selectComponents(componentIds: string[]) {
129
+ window.top?.window.postMessage(
130
+ { componentIds, type: "componentsSelected" },
131
+ "*"
132
+ );
133
+ }
@@ -0,0 +1,3 @@
1
+ "use client";
2
+
3
+ export { MultiComponentEditor } from "./MultiComponentEditor";
@@ -0,0 +1,62 @@
1
+ import {
2
+ ApiConfig,
3
+ RenderOptions,
4
+ resolveRoute,
5
+ } from "@alpaca-headless/alpaca-headless";
6
+ import { NextRequest } from "next/server";
7
+ import { getApiHeaders } from ".";
8
+
9
+ export async function handleBasicAuthRoute({
10
+ request,
11
+ mapHost,
12
+ renderOptions,
13
+ apiConfig,
14
+ }: {
15
+ request: NextRequest;
16
+ mapHost: (host: string) => string;
17
+ renderOptions: RenderOptions;
18
+ apiConfig?: ApiConfig;
19
+ }) {
20
+ const urlSearchParams = new URLSearchParams(request.nextUrl.search);
21
+ const nextSearchParams: any = {};
22
+ for (const [key, value] of urlSearchParams.entries()) {
23
+ nextSearchParams[key] = value;
24
+ }
25
+
26
+ const config = apiConfig || {};
27
+ if (!config.headers) {
28
+ config.headers = getApiHeaders();
29
+ }
30
+
31
+ const routeData = await resolveRoute({
32
+ path: request.nextUrl.pathname,
33
+ searchParams: nextSearchParams,
34
+ host: mapHost(request.headers.get("host") || ""),
35
+ renderOptions,
36
+ renderings: {},
37
+ apiConfig: config,
38
+ });
39
+
40
+ if (routeData.result.type === "redirect") {
41
+ return new Response(null, {
42
+ status: routeData.result.redirectType === "permanent" ? 301 : 302,
43
+ headers: {
44
+ Location: routeData.result.location,
45
+ },
46
+ });
47
+ }
48
+
49
+ if (routeData.result.type === "unauthorized") {
50
+ if (routeData.result.auth)
51
+ return new Response(null, {
52
+ status: 401,
53
+ headers: {
54
+ "WWW-Authenticate": routeData.result.auth.replace(", Bearer", ""),
55
+ },
56
+ });
57
+ else
58
+ return new Response(null, {
59
+ status: 401,
60
+ });
61
+ }
62
+ }
package/src/index.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { headers } from "next/headers";
2
+
3
+ export { EditorIntegration } from "./EditorIntegration";
4
+
5
+ export function getApiHeaders() {
6
+ const requestHeaders = headers();
7
+ const apiHeaders = new Headers();
8
+ apiHeaders.set("Cookie", requestHeaders.get("Cookie") || "");
9
+ apiHeaders.set("Authorization", requestHeaders.get("Authorization") || "");
10
+ return apiHeaders;
11
+ }
12
+
13
+ export { handleRequest } from "./middleware/handleRequest";
14
+
15
+ export { proxy } from "./proxy";
@@ -0,0 +1,62 @@
1
+ import {
2
+ ApiConfig,
3
+ RenderOptions,
4
+ resolveRoute,
5
+ } from "@alpaca-headless/alpaca-headless";
6
+ import { NextRequest } from "next/server";
7
+ import { getApiHeaders } from "..";
8
+
9
+ export async function handleRequest({
10
+ request,
11
+ mapHost,
12
+ renderOptions,
13
+ apiConfig,
14
+ }: {
15
+ request: NextRequest;
16
+ mapHost: (host: string) => string;
17
+ renderOptions: RenderOptions;
18
+ apiConfig?: ApiConfig;
19
+ }) {
20
+ const urlSearchParams = new URLSearchParams(request.nextUrl.search);
21
+ const nextSearchParams: any = {};
22
+ for (const [key, value] of urlSearchParams.entries()) {
23
+ nextSearchParams[key] = value;
24
+ }
25
+
26
+ const config = apiConfig || {};
27
+ if (!config.headers) {
28
+ config.headers = getApiHeaders();
29
+ }
30
+
31
+ const routeData = await resolveRoute({
32
+ path: request.nextUrl.pathname,
33
+ searchParams: nextSearchParams,
34
+ host: mapHost(request.headers.get("host") || ""),
35
+ renderOptions,
36
+ renderings: {},
37
+ apiConfig: config,
38
+ });
39
+
40
+ if (routeData.result.type === "redirect") {
41
+ return new Response(null, {
42
+ status: routeData.result.redirectType === "permanent" ? 301 : 302,
43
+ headers: {
44
+ Location: routeData.result.location,
45
+ },
46
+ });
47
+ }
48
+
49
+ if (routeData.result.type === "unauthorized") {
50
+ if (routeData.result.auth)
51
+ return new Response(null, {
52
+ status: 401,
53
+ headers: {
54
+ "WWW-Authenticate": routeData.result.auth.replace(", Bearer", ""),
55
+ },
56
+ });
57
+ else
58
+ return new Response(null, {
59
+ status: 401,
60
+ });
61
+ }
62
+ }
@@ -0,0 +1 @@
1
+ export * from "./handleRequest";
@@ -0,0 +1,108 @@
1
+ import axios from "axios";
2
+ // import { HttpsProxyAgent } from "https-proxy-agent";
3
+ import { NextResponse } from "next/server";
4
+
5
+ async function GET(
6
+ req: Request,
7
+ target: string
8
+ //{ proxy }: { proxy?: string }
9
+ ) {
10
+ const reqUrl = new URL(req.url);
11
+
12
+ const url: string =
13
+ target + reqUrl.pathname + "?" + reqUrl.searchParams.toString();
14
+
15
+ const headers: { [key: string]: string } = {
16
+ Authorization: req.headers.get("Authorization") || "",
17
+ Cookie: req.headers.get("Cookie") || "",
18
+ };
19
+
20
+ // const agent = proxy ? new HttpsProxyAgent(proxy) : undefined;
21
+
22
+ const externalResponse = await axios.get(url, {
23
+ headers: headers,
24
+ // httpAgent: agent,
25
+ // httpsAgent: agent,
26
+ responseType: "stream",
27
+ });
28
+
29
+ return new NextResponse(nodeReadableToReadableStream(externalResponse.data), {
30
+ status: externalResponse.status,
31
+ });
32
+ }
33
+
34
+ async function POST(
35
+ req: Request
36
+ //{ proxy }: { proxy?: string }
37
+ ) {
38
+ const reqUrl = new URL(req.url);
39
+ const body = await req.text();
40
+
41
+ const url: string =
42
+ process.env.EDITOR_SERVICE_URL +
43
+ reqUrl.pathname +
44
+ "?" +
45
+ reqUrl.searchParams.toString();
46
+
47
+ const headers: { [key: string]: string } = {
48
+ "Content-Type": req.headers.get("Content-Type") || "",
49
+ Authorization: req.headers.get("Authorization") || "",
50
+ Cookie: req.headers.get("Cookie") || "",
51
+ };
52
+
53
+ // const agent = proxy ? new HttpsProxyAgent(proxy) : undefined;
54
+
55
+ const externalResponse = await axios.post(url, body, {
56
+ headers: headers,
57
+ // httpAgent: agent,
58
+ // httpsAgent: agent,
59
+ responseType: "stream",
60
+ });
61
+
62
+ const responseHeaders = getResponseHeaders(externalResponse);
63
+
64
+ return new NextResponse(nodeReadableToReadableStream(externalResponse.data), {
65
+ status: externalResponse.status,
66
+ headers: responseHeaders,
67
+ });
68
+ }
69
+
70
+ const getResponseHeaders = (externalResponse: any) => {
71
+ const responseHeaders = new Headers();
72
+ responseHeaders.set(
73
+ "Content-Type",
74
+ externalResponse.headers["content-type"] || ""
75
+ );
76
+ responseHeaders.set(
77
+ "Set-Cookie",
78
+ externalResponse.headers["set-cookie"] || ""
79
+ );
80
+ return responseHeaders;
81
+ };
82
+
83
+ function nodeReadableToReadableStream(
84
+ nodeStream: NodeJS.ReadableStream
85
+ ): ReadableStream<Uint8Array> {
86
+ return new ReadableStream<Uint8Array>({
87
+ start(controller) {
88
+ nodeStream.on("data", (chunk: Buffer) => {
89
+ controller.enqueue(new Uint8Array(chunk));
90
+ });
91
+
92
+ nodeStream.on("end", () => {
93
+ controller.close();
94
+ });
95
+
96
+ nodeStream.on("error", (err: Error) => {
97
+ controller.error(err);
98
+ });
99
+ },
100
+ pull() {},
101
+ cancel() {},
102
+ });
103
+ }
104
+
105
+ export const proxy = {
106
+ POST,
107
+ GET,
108
+ };
@@ -0,0 +1,45 @@
1
+ import { useRouter, useSearchParams } from "next/navigation";
2
+ import { useEffect, useState } from "react";
3
+ import uuid from "react-uuid";
4
+
5
+ declare global {
6
+ interface Window {
7
+ requestRefresh?: (newUri?: string) => boolean;
8
+ }
9
+ }
10
+
11
+ const useExposeRefreshFunction = () => {
12
+ const router = useRouter();
13
+ const searchParams = useSearchParams();
14
+ const [refreshStart, setRefreshStart] = useState<number>();
15
+
16
+ useEffect(() => {
17
+ // Expose the refresh function to the parent window
18
+ window.requestRefresh = (newUri?: string) => {
19
+ console.log("refresh requested", newUri);
20
+ if (!newUri) {
21
+ const uri = new URL(window.location.href);
22
+ uri.searchParams.set("edit_rev", uuid().toString());
23
+ newUri = uri.toString();
24
+ }
25
+
26
+ router.replace(newUri, { scroll: false });
27
+ setRefreshStart(performance.now());
28
+ return true; // Indicate the function executed successfully
29
+ };
30
+
31
+ // Optionally clean up when the component unmounts
32
+ return () => {
33
+ delete window.requestRefresh;
34
+ };
35
+ }, [router]);
36
+
37
+ useEffect(() => {
38
+ if (refreshStart)
39
+ console.log("Refresh complete", performance.now() - refreshStart!);
40
+ }, [searchParams]);
41
+
42
+ return null; // This hook doesn't render anything
43
+ };
44
+
45
+ export default useExposeRefreshFunction;
@@ -0,0 +1,17 @@
1
+ var config = {
2
+ content: [
3
+ "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
4
+ "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
5
+ "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
6
+ ],
7
+ theme: {
8
+ extend: {
9
+ backgroundImage: {
10
+ "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
11
+ "gradient-conic": "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
12
+ },
13
+ },
14
+ },
15
+ plugins: [],
16
+ };
17
+ export default config;
@@ -0,0 +1,20 @@
1
+ import type { Config } from "tailwindcss";
2
+
3
+ const config: Config = {
4
+ content: [
5
+ "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
6
+ "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
7
+ "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
8
+ ],
9
+ theme: {
10
+ extend: {
11
+ backgroundImage: {
12
+ "gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
13
+ "gradient-conic":
14
+ "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
15
+ },
16
+ },
17
+ },
18
+ plugins: [],
19
+ };
20
+ export default config;
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "module": "esnext",
5
+ "moduleResolution": "bundler",
6
+ "jsx": "react-jsx",
7
+ "declaration": true,
8
+ "outDir": "./dist",
9
+ "strict": true,
10
+ "lib": ["dom", "dom.iterable", "es2021"],
11
+ "esModuleInterop": true,
12
+ "skipLibCheck": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "emitDecoratorMetadata": true,
17
+ "experimentalDecorators": true,
18
+ "allowSyntheticDefaultImports": true,
19
+ "noImplicitThis": true,
20
+ "noImplicitAny": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true
23
+ },
24
+ "include": ["src/**/*"],
25
+ "exclude": ["node_modules", "**/*.spec.ts"]
26
+ }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAlpacaContext = void 0;
4
- function useAlpacaContext() {
5
- let context = globalThis.alpacaContext;
6
- if (!context) {
7
- context = {};
8
- globalThis.alpacaContext = context;
9
- }
10
- return context;
11
- }
12
- exports.useAlpacaContext = useAlpacaContext;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.Image = void 0;
15
- const jsx_runtime_1 = require("react/jsx-runtime");
16
- // const addClassName = (otherAttrs: { [key: string]: unknown }): void => {
17
- // if (otherAttrs.class) {
18
- // // if any classes are defined properly already
19
- // if (otherAttrs.className) {
20
- // let className: string = otherAttrs.className as string;
21
- // className += ` ${otherAttrs.class}`;
22
- // otherAttrs.className = className;
23
- // } else {
24
- // otherAttrs.className = otherAttrs.class;
25
- // }
26
- // delete otherAttrs.class;
27
- // }
28
- // };
29
- const Image = (_a) => {
30
- var { field } = _a, otherProps = __rest(_a, ["field"]);
31
- if (!field)
32
- return;
33
- const attrs = Object.assign(Object.assign({}, field.value), otherProps);
34
- return (0, jsx_runtime_1.jsx)("img", Object.assign({}, attrs, { alt: "" }));
35
- };
36
- exports.Image = Image;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.Link = void 0;
15
- const jsx_runtime_1 = require("react/jsx-runtime");
16
- function Link(_a) {
17
- var { field, children } = _a, props = __rest(_a, ["field", "children"]);
18
- if (!field)
19
- return;
20
- return ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: field.value.url }, props, { children: children })));
21
- }
22
- exports.Link = Link;