@prismicio/react 2.0.3-debug.0 → 2.0.3-debug.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/dist/index.cjs +23 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/PrismicProvider.tsx +3 -2
- package/src/PrismicRichText.tsx +4 -3
- package/src/PrismicText.tsx +2 -1
- package/src/PrismicToolbar.tsx +3 -3
- package/src/SliceZone.tsx +6 -7
- package/src/lib/pascalCase.ts +12 -0
- package/src/usePrismicContext.ts +2 -2
- package/src/usePrismicPreviewResolver.ts +2 -2
- package/src/useStatefulPrismicClientMethod.ts +4 -4
- package/CHANGELOG.md +0 -321
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const React = require('react');
|
|
6
6
|
const prismicH = require('@prismicio/helpers');
|
|
7
7
|
const prismicR = require('@prismicio/richtext');
|
|
8
|
-
const tinyCase = require('tiny-case');
|
|
9
8
|
|
|
10
9
|
function _interopNamespace(e) {
|
|
11
10
|
if (e && e.__esModule) return e;
|
|
@@ -29,7 +28,7 @@ const React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
29
28
|
const prismicH__namespace = /*#__PURE__*/_interopNamespace(prismicH);
|
|
30
29
|
const prismicR__namespace = /*#__PURE__*/_interopNamespace(prismicR);
|
|
31
30
|
|
|
32
|
-
const PrismicContext =
|
|
31
|
+
const PrismicContext = React.createContext({});
|
|
33
32
|
const PrismicProvider = ({
|
|
34
33
|
client,
|
|
35
34
|
linkResolver,
|
|
@@ -38,7 +37,7 @@ const PrismicProvider = ({
|
|
|
38
37
|
externalLinkComponent,
|
|
39
38
|
children
|
|
40
39
|
}) => {
|
|
41
|
-
const value =
|
|
40
|
+
const value = React.useMemo(() => ({
|
|
42
41
|
client,
|
|
43
42
|
linkResolver,
|
|
44
43
|
richTextComponents,
|
|
@@ -57,7 +56,7 @@ const PrismicProvider = ({
|
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
const usePrismicContext = () => {
|
|
60
|
-
return
|
|
59
|
+
return React.useContext(PrismicContext) || {};
|
|
61
60
|
};
|
|
62
61
|
|
|
63
62
|
if (typeof process === "undefined") {
|
|
@@ -130,7 +129,7 @@ const PrismicLink = (props) => {
|
|
|
130
129
|
};
|
|
131
130
|
|
|
132
131
|
const PrismicText = (props) => {
|
|
133
|
-
return
|
|
132
|
+
return React.useMemo(() => {
|
|
134
133
|
if (props.field) {
|
|
135
134
|
const text = prismicH__namespace.asText(props.field, props.separator);
|
|
136
135
|
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, text);
|
|
@@ -230,19 +229,19 @@ const createDefaultSerializer = (args) => prismicR__namespace.wrapMapSerializer(
|
|
|
230
229
|
key: `${i}__break`
|
|
231
230
|
}));
|
|
232
231
|
}
|
|
233
|
-
result.push(/* @__PURE__ */ React__namespace.createElement(
|
|
232
|
+
result.push(/* @__PURE__ */ React__namespace.createElement(React.Fragment, {
|
|
234
233
|
key: `${i}__line`
|
|
235
234
|
}, line));
|
|
236
235
|
i++;
|
|
237
236
|
}
|
|
238
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
237
|
+
return /* @__PURE__ */ React__namespace.createElement(React.Fragment, {
|
|
239
238
|
key
|
|
240
239
|
}, result);
|
|
241
240
|
}
|
|
242
241
|
});
|
|
243
242
|
const PrismicRichText = (props) => {
|
|
244
243
|
const context = usePrismicContext();
|
|
245
|
-
return
|
|
244
|
+
return React.useMemo(() => {
|
|
246
245
|
if (!props.field) {
|
|
247
246
|
return null;
|
|
248
247
|
} else {
|
|
@@ -267,10 +266,17 @@ const PrismicRichText = (props) => {
|
|
|
267
266
|
]);
|
|
268
267
|
};
|
|
269
268
|
|
|
269
|
+
const pascalCase = (input) => {
|
|
270
|
+
const camelCased = input.replace(/(?:-|_)(\w)/g, (_, c) => {
|
|
271
|
+
return c ? c.toUpperCase() : "";
|
|
272
|
+
});
|
|
273
|
+
return camelCased[0].toUpperCase() + camelCased.slice(1);
|
|
274
|
+
};
|
|
275
|
+
|
|
270
276
|
const TODOSliceComponent = __PRODUCTION__ ? () => null : ({
|
|
271
277
|
slice
|
|
272
278
|
}) => {
|
|
273
|
-
|
|
279
|
+
React.useEffect(() => {
|
|
274
280
|
console.warn(`[SliceZone] Could not find a component for Slice type "${slice.slice_type}"`, slice);
|
|
275
281
|
}, [slice]);
|
|
276
282
|
return /* @__PURE__ */ React__namespace.createElement("section", {
|
|
@@ -285,13 +291,13 @@ const SliceZone = ({
|
|
|
285
291
|
defaultComponent = TODOSliceComponent,
|
|
286
292
|
context = {}
|
|
287
293
|
}) => {
|
|
288
|
-
const renderedSlices =
|
|
294
|
+
const renderedSlices = React.useMemo(() => {
|
|
289
295
|
return slices.map((slice, index) => {
|
|
290
296
|
let Comp = components[slice.slice_type] || defaultComponent;
|
|
291
297
|
if (resolver) {
|
|
292
298
|
const resolvedComp = resolver({
|
|
293
299
|
slice,
|
|
294
|
-
sliceName:
|
|
300
|
+
sliceName: pascalCase(slice.slice_type),
|
|
295
301
|
i: index
|
|
296
302
|
});
|
|
297
303
|
if (resolvedComp) {
|
|
@@ -316,7 +322,7 @@ const PrismicToolbar = ({
|
|
|
316
322
|
type = "new"
|
|
317
323
|
}) => {
|
|
318
324
|
const src = `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${type === "new" ? "&new=true" : ""}`;
|
|
319
|
-
|
|
325
|
+
React.useEffect(() => {
|
|
320
326
|
const existingScript = document.querySelector(`script[src="${src}"]`);
|
|
321
327
|
if (!existingScript) {
|
|
322
328
|
const script = document.createElement("script");
|
|
@@ -327,7 +333,7 @@ const PrismicToolbar = ({
|
|
|
327
333
|
script.dataset.type = type;
|
|
328
334
|
document.body.appendChild(script);
|
|
329
335
|
}
|
|
330
|
-
}, [repositoryName, type]);
|
|
336
|
+
}, [repositoryName, type, src]);
|
|
331
337
|
return null;
|
|
332
338
|
};
|
|
333
339
|
|
|
@@ -363,8 +369,8 @@ const useStatefulPrismicClientMethod = (methodName, args, explicitClient) => {
|
|
|
363
369
|
} = isParams(lastArg) ? lastArg : {};
|
|
364
370
|
const argsWithoutParams = isParams(lastArg) ? args.slice(0, -1) : args;
|
|
365
371
|
const client = usePrismicClient(explicitClient || lastArgExplicitClient);
|
|
366
|
-
const [state, dispatch] =
|
|
367
|
-
|
|
372
|
+
const [state, dispatch] = React.useReducer(reducer, initialState);
|
|
373
|
+
React.useEffect(() => {
|
|
368
374
|
if (!skip) {
|
|
369
375
|
{
|
|
370
376
|
dispatch(["start"]);
|
|
@@ -386,7 +392,7 @@ const useStatefulPrismicClientMethod = (methodName, args, explicitClient) => {
|
|
|
386
392
|
JSON.stringify(argsWithoutParams),
|
|
387
393
|
JSON.stringify(params)
|
|
388
394
|
]);
|
|
389
|
-
return
|
|
395
|
+
return React.useMemo(() => [
|
|
390
396
|
state.data,
|
|
391
397
|
{
|
|
392
398
|
state: state.state,
|
|
@@ -408,7 +414,7 @@ const usePrismicPreviewResolver = (args = {}) => {
|
|
|
408
414
|
], args.client);
|
|
409
415
|
const [resolvedURL] = result;
|
|
410
416
|
const { navigate } = args;
|
|
411
|
-
|
|
417
|
+
React.useEffect(() => {
|
|
412
418
|
if (resolvedURL && navigate) {
|
|
413
419
|
navigate(resolvedURL);
|
|
414
420
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/PrismicProvider.tsx","../src/usePrismicContext.ts","../src/lib/__PRODUCTION__.ts","../src/lib/invariant.ts","../src/usePrismicClient.ts","../src/lib/isInternalURL.ts","../src/PrismicLink.tsx","../src/PrismicText.tsx","../src/PrismicRichText.tsx","../src/SliceZone.tsx","../src/PrismicToolbar.tsx","../src/useStatefulPrismicClientMethod.ts","../src/usePrismicPreviewResolver.ts","../src/clientHooks.ts","../src/index.ts"],"sourcesContent":["import type * as prismic from \"@prismicio/client\";\n\nimport * as React from \"react\";\nimport * as prismicH from \"@prismicio/helpers\";\n\nimport { LinkProps } from \"./PrismicLink\";\nimport { JSXFunctionSerializer, JSXMapSerializer } from \"./types\";\n\n/**\n * React context value containing shared configuration for `@prismicio/react`\n * components and hooks.\n */\nexport type PrismicContextValue = {\n\t/**\n\t * A `@prismicio/client` instance used to fetch content from a Prismic\n\t * repository. This is used by `@prismicio/react` hooks, such as\n\t * `usePrismicDocuments()`.\n\t */\n\tclient?: prismic.Client;\n\n\t/**\n\t * A Link Resolver used to resolve links for `<PrismicLink>` and `<PrismicRichText>`.\n\t *\n\t * @remarks\n\t * If your app uses Route Resolvers when querying for your Prismic\n\t * repository's content, a Link Resolver does not need to be provided.\n\t * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: prismicH.LinkResolverFunction;\n\n\t/**\n\t * A map or function that maps a Rich Text block to a React component.\n\t *\n\t * @remarks\n\t * Prefer using a map serializer over the function serializer when possible.\n\t * The map serializer is simpler to maintain.\n\t * @example A map serializer.\n\t *\n\t * ```jsx\n\t * {\n\t * heading1: ({children}) => <Heading>{children}</Heading>\n\t * }\n\t * ```\n\t *\n\t * @example A function serializer.\n\t *\n\t * ```jsx\n\t * (type, node, content, children) => {\n\t * \tswitch (type) {\n\t * \t\tcase \"heading1\": {\n\t * \t\t\treturn <Heading>{chidlren}</Heading>;\n\t * \t\t}\n\t * \t}\n\t * };\n\t * ```\n\t */\n\trichTextComponents?: JSXMapSerializer | JSXFunctionSerializer;\n\n\t/**\n\t * The component rendered by `<PrismicLink>` for internal URLs. Defaults to `<a>`.\n\t */\n\tinternalLinkComponent?: React.ElementType<LinkProps>;\n\n\t/**\n\t * The component rendered by `<PrismicLink>` for external URLs. Defaults to `<a>`.\n\t */\n\texternalLinkComponent?: React.ElementType<LinkProps>;\n\n\t/**\n\t * Children for the component.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React context containing shared configuration for `@prismicio/react`\n * components and hooks.\n */\nexport const PrismicContext = React.createContext<PrismicContextValue>({});\n\n/**\n * Props for `<PrismicProvider>`.\n */\nexport type PrismicProviderProps = PrismicContextValue;\n\n/**\n * React context provider to share configuration for `@prismicio/react`\n * components and hooks.\n *\n * @returns A React context provider with shared configuration.\n */\nexport const PrismicProvider = ({\n\tclient,\n\tlinkResolver,\n\trichTextComponents,\n\tinternalLinkComponent,\n\texternalLinkComponent,\n\tchildren,\n}: PrismicProviderProps): JSX.Element => {\n\tconst value = React.useMemo<PrismicContextValue>(\n\t\t() => ({\n\t\t\tclient,\n\t\t\tlinkResolver,\n\t\t\trichTextComponents,\n\t\t\tinternalLinkComponent,\n\t\t\texternalLinkComponent,\n\t\t}),\n\t\t[\n\t\t\tclient,\n\t\t\tlinkResolver,\n\t\t\trichTextComponents,\n\t\t\tinternalLinkComponent,\n\t\t\texternalLinkComponent,\n\t\t],\n\t);\n\n\treturn (\n\t\t<PrismicContext.Provider value={value}>{children}</PrismicContext.Provider>\n\t);\n};\n","import * as React from \"react\";\n\nimport { PrismicContext, PrismicContextValue } from \"./PrismicProvider\";\n\n/**\n * React hook used to read shared configuration for `@prismicio/react`\n * components and hooks.\n *\n * @returns The closest `<PrismicProvider>` context value.\n */\nexport const usePrismicContext = (): PrismicContextValue => {\n\treturn React.useContext(PrismicContext) || {};\n};\n","// We need to polyfill process if it doesn't exist, such as in the browser.\nif (typeof process === \"undefined\") {\n\tglobalThis.process = { env: {} } as typeof process;\n}\n\n/**\n * `true` if in the production environment, `false` otherwise.\n *\n * This boolean can be used to perform actions only in development environments,\n * such as logging.\n */\nexport const __PRODUCTION__ = process.env.NODE_ENV === \"production\";\n","/**\n * MIT License\n *\n * Copyright (c) 2019 Alexander Reardon\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { __PRODUCTION__ } from \"./__PRODUCTION__\";\n\nconst prefix = \"Invariant failed\";\n\n// Throw an error if the condition fails\n// Strip out error messages for production\n// > Not providing an inline default argument for message as the result is smaller\nexport function invariant(\n\tcondition: unknown,\n\tmessage?: string,\n): asserts condition {\n\tif (condition) {\n\t\treturn;\n\t}\n\t// Condition not passed\n\n\t// In production we strip the message but still throw\n\tif (__PRODUCTION__) {\n\t\tthrow new Error(prefix);\n\t}\n\n\t// When not in production we allow the message to pass through\n\t// *This block will be removed in production builds*\n\tthrow new Error(`${prefix}: ${message || \"\"}`);\n}\n","import type * as prismic from \"@prismicio/client\";\n\nimport { invariant } from \"./lib/invariant\";\n\nimport { usePrismicContext } from \"./usePrismicContext\";\n\n/**\n * Retrieve the `@prismicio/client` instance provided to `<PrismicProvider>`\n * higher in the React tree.\n *\n * @param explicitClient - An optional `@prismicio/client` instance to override\n * the Client provided to `<PrismicProvider>`.\n *\n * @returns The `@prismicio/client` instance provided to `<PrismicProvider>`.\n */\nexport const usePrismicClient = (\n\texplicitClient?: prismic.Client,\n): prismic.Client => {\n\tconst context = usePrismicContext();\n\n\tconst client = explicitClient || context?.client;\n\tinvariant(\n\t\tclient,\n\t\t\"A @prismicio/client is required to query documents. Provide a client to the hook or to a <PrismicProvider> higher in your component tree.\",\n\t);\n\n\treturn client;\n};\n","/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n *\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url);\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url);\n\n\treturn isInternal && !isSpecialLink;\n};\n","import * as React from \"react\";\nimport * as prismicH from \"@prismicio/helpers\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { isInternalURL } from \"./lib/isInternalURL\";\n\nimport { usePrismicContext } from \"./usePrismicContext\";\n\n/**\n * Props provided to a component when rendered with `<PrismicLink>`.\n */\nexport interface LinkProps {\n\t/**\n\t * The URL to link.\n\t */\n\thref: string;\n\n\t/**\n\t * The `target` attribute for anchor elements. If the Prismic field is\n\t * configured to open in a new window, this prop defaults to `_blank`.\n\t */\n\ttarget?: string;\n\n\t/**\n\t * The `rel` attribute for anchor elements. If the `target` prop is set to\n\t * `\"_blank\"`, this prop defaults to `\"noopener noreferrer\"`.\n\t */\n\trel?: string;\n\n\t/**\n\t * Children for the component. *\n\t */\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Props for `<PrismicLink>`.\n */\nexport type PrismicLinkProps<\n\tInternalComponent extends React.ElementType<LinkProps> = React.ElementType<LinkProps>,\n\tExternalComponent extends React.ElementType<LinkProps> = React.ElementType<LinkProps>,\n\tLinkResolverFunction extends prismicH.LinkResolverFunction = prismicH.LinkResolverFunction,\n> = Omit<\n\tReact.ComponentProps<InternalComponent> &\n\t\tReact.ComponentProps<ExternalComponent>,\n\tkeyof LinkProps\n> & {\n\t/**\n\t * The Link Resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses Route Resolvers when querying for your Prismic\n\t * repository's content, a Link Resolver does not need to be provided.\n\t * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction;\n\n\t/**\n\t * The component rendered for internal URLs. Defaults to `<a>`.\n\t *\n\t * If your app uses a client-side router that requires a special Link\n\t * component, provide the Link component to this prop.\n\t */\n\tinternalComponent?: InternalComponent;\n\n\t/**\n\t * The component rendered for external URLs. Defaults to `<a>`.\n\t */\n\texternalComponent?: ExternalComponent;\n\n\t/**\n\t * The `target` attribute for anchor elements. If the Prismic field is\n\t * configured to open in a new window, this prop defaults to `_blank`.\n\t */\n\ttarget?: string | null;\n\n\t/**\n\t * The `rel` attribute for anchor elements. If the `target` prop is set to\n\t * `\"_blank\"`, this prop defaults to `\"noopener noreferrer\"`.\n\t */\n\trel?: string | null;\n\n\t/**\n\t * Children for the component. *\n\t */\n\tchildren?: React.ReactNode;\n} & (\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * The Prismic Link field containing the URL or document to link.\n\t\t\t\t *\n\t\t\t\t * @see Learn about Prismic Link fields {@link https://prismic.io/docs/core-concepts/link-content-relationship}\n\t\t\t\t */\n\t\t\t\tfield: prismicT.LinkField | null | undefined;\n\t\t }\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * The Prismic document to link.\n\t\t\t\t */\n\t\t\t\tdocument: prismicT.PrismicDocument | null | undefined;\n\t\t }\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * The URL to link.\n\t\t\t\t */\n\t\t\t\thref: string | null | undefined;\n\t\t }\n\t);\n\n/**\n * The default component rendered for internal URLs.\n */\nconst defaultInternalComponent = \"a\";\n\n/**\n * The default component rendered for external URLs.\n */\nconst defaultExternalComponent = \"a\";\n\n/**\n * React component that renders a link from a Prismic Link field.\n *\n * Different components can be rendered depending on whether the link is\n * internal or external. This is helpful when integrating with client-side\n * routers, such as a router-specific Link component.\n *\n * If a link is configured to open in a new window using `target=\"_blank\"`,\n * `rel=\"noopener noreferrer\"` is set by default.\n *\n * @param props - Props for the component.\n *\n * @returns The internal or external link component depending on whether the\n * link is internal or external.\n */\nexport const PrismicLink = <\n\tInternalComponent extends React.ElementType<LinkProps> = typeof defaultInternalComponent,\n\tExternalComponent extends React.ElementType<LinkProps> = typeof defaultExternalComponent,\n\tLinkResolverFunction extends prismicH.LinkResolverFunction = prismicH.LinkResolverFunction,\n>(\n\tprops: PrismicLinkProps<\n\t\tInternalComponent,\n\t\tExternalComponent,\n\t\tLinkResolverFunction\n\t>,\n): JSX.Element | null => {\n\tconst context = usePrismicContext();\n\n\tconst linkResolver = props.linkResolver || context.linkResolver;\n\n\tlet href: string | null | undefined;\n\tif (\"href\" in props) {\n\t\thref = props.href;\n\t} else if (\"document\" in props && props.document) {\n\t\thref = prismicH.asLink(props.document, linkResolver);\n\t} else if (\"field\" in props && props.field) {\n\t\thref = prismicH.asLink(props.field, linkResolver);\n\t}\n\n\tconst target =\n\t\tprops.target ||\n\t\t(\"field\" in props &&\n\t\t\tprops.field &&\n\t\t\t\"target\" in props.field &&\n\t\t\tprops.field.target) ||\n\t\tundefined;\n\n\tconst rel =\n\t\tprops.rel || (target === \"_blank\" ? \"noopener noreferrer\" : undefined);\n\n\tconst InternalComponent: React.ElementType<LinkProps> =\n\t\tprops.internalComponent ||\n\t\tcontext.internalLinkComponent ||\n\t\tdefaultInternalComponent;\n\n\tconst ExternalComponent: React.ElementType<LinkProps> =\n\t\tprops.externalComponent ||\n\t\tcontext.externalLinkComponent ||\n\t\tdefaultExternalComponent;\n\n\tconst isInternal = href && isInternalURL(href);\n\n\tconst Component = isInternal ? InternalComponent : ExternalComponent;\n\n\tconst passthroughProps: typeof props = Object.assign({}, props);\n\tdelete passthroughProps.linkResolver;\n\tdelete passthroughProps.internalComponent;\n\tdelete passthroughProps.externalComponent;\n\tdelete passthroughProps.rel;\n\tdelete passthroughProps.target;\n\tif (\"field\" in passthroughProps) {\n\t\tdelete passthroughProps.field;\n\t} else if (\"document\" in passthroughProps) {\n\t\tdelete passthroughProps.document;\n\t} else if (\"href\" in passthroughProps) {\n\t\tdelete passthroughProps.href;\n\t}\n\n\treturn href ? (\n\t\t<Component {...passthroughProps} href={href} target={target} rel={rel} />\n\t) : null;\n};\n","import * as React from \"react\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as prismicH from \"@prismicio/helpers\";\n\n/**\n * Props for `<PrismicText>`.\n */\nexport type PrismicTextProps = {\n\t/**\n\t * The Prismic Rich Text field to render.\n\t */\n\tfield: prismicT.RichTextField | null | undefined;\n\n\t/**\n\t * The separator used between blocks. Defaults to `\\n`.\n\t */\n\tseparator?: string;\n};\n\n/**\n * React component that renders content from a Prismic Rich Text field as plain text.\n *\n * @remarks\n * This component returns a React fragment with no wrapping element around the\n * content. If you need a wrapper, add a component around `<PrismicText>`.\n * @example Rendering a Rich Text field as plain text.\n *\n * ```jsx\n * <PrismicText field={document.data.content} />;\n * ```\n *\n * @param props - Props for the component.\n *\n * @returns The Rich Text field's content as plain text.\n *\n * @see Learn about Rich Text fields {@link https://prismic.io/docs/core-concepts/rich-text-title}\n */\nexport const PrismicText = (props: PrismicTextProps): JSX.Element | null => {\n\treturn React.useMemo(() => {\n\t\tif (props.field) {\n\t\t\tconst text = prismicH.asText(props.field, props.separator);\n\n\t\t\treturn <>{text}</>;\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}, [props.field, props.separator]);\n};\n","/* eslint-disable react/display-name */\n/* eslint-disable react/prop-types */\n\nimport * as React from \"react\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as prismicH from \"@prismicio/helpers\";\nimport * as prismicR from \"@prismicio/richtext\";\n\nimport { JSXFunctionSerializer, JSXMapSerializer } from \"./types\";\nimport { PrismicLink, PrismicLinkProps } from \"./PrismicLink\";\nimport { usePrismicContext } from \"./usePrismicContext\";\n\n/**\n * Props for `<PrismicRichText>`.\n */\nexport type PrismicRichTextProps = {\n\t/**\n\t * The Prismic Rich Text field to render.\n\t */\n\tfield: prismicT.RichTextField | null | undefined;\n\n\t/**\n\t * The Link Resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses Route Resolvers when querying for your Prismic\n\t * repository's content, a Link Resolver does not need to be provided.\n\t * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: PrismicLinkProps[\"linkResolver\"];\n\n\t/**\n\t * A function that maps a Rich Text block to a React component.\n\t *\n\t * @deprecated Use the `components` prop instead. Prefer using a map\n\t * serializer when possible.\n\t * @see Learn about Rich Text serializers {@link https://prismic.io/docs/core-concepts/html-serializer}\n\t */\n\thtmlSerializer?: JSXFunctionSerializer;\n\n\t/**\n\t * A map or function that maps a Rich Text block to a React component.\n\t *\n\t * @remarks\n\t * Prefer using a map serializer over the function serializer when possible.\n\t * The map serializer is simpler to maintain.\n\t * @example A map serializer.\n\t *\n\t * ```jsx\n\t * {\n\t * heading1: ({children}) => <Heading>{children}</Heading>\n\t * }\n\t * ```\n\t *\n\t * @example A function serializer.\n\t *\n\t * ```jsx\n\t * (type, node, content, children) => {\n\t * \tswitch (type) {\n\t * \t\tcase \"heading1\": {\n\t * \t\t\treturn <Heading>{chidlren}</Heading>;\n\t * \t\t}\n\t * \t}\n\t * };\n\t * ```\n\t */\n\tcomponents?: JSXMapSerializer | JSXFunctionSerializer;\n\n\t/**\n\t * The React component rendered for links when the URL is internal.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\tinternalLinkComponent?: PrismicLinkProps[\"internalComponent\"];\n\n\t/**\n\t * The React component rendered for links when the URL is external.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalLinkComponent?: PrismicLinkProps[\"externalComponent\"];\n};\n\ntype CreateDefaultSerializerArgs = {\n\tlinkResolver: prismicH.LinkResolverFunction<string> | undefined;\n\tinternalLinkComponent: PrismicRichTextProps[\"internalLinkComponent\"];\n\texternalLinkComponent: PrismicRichTextProps[\"externalLinkComponent\"];\n};\n\nconst createDefaultSerializer = (\n\targs: CreateDefaultSerializerArgs,\n): JSXFunctionSerializer =>\n\tprismicR.wrapMapSerializer({\n\t\theading1: ({ children, key }) => <h1 key={key}>{children}</h1>,\n\t\theading2: ({ children, key }) => <h2 key={key}>{children}</h2>,\n\t\theading3: ({ children, key }) => <h3 key={key}>{children}</h3>,\n\t\theading4: ({ children, key }) => <h4 key={key}>{children}</h4>,\n\t\theading5: ({ children, key }) => <h5 key={key}>{children}</h5>,\n\t\theading6: ({ children, key }) => <h6 key={key}>{children}</h6>,\n\t\tparagraph: ({ children, key }) => <p key={key}>{children}</p>,\n\t\tpreformatted: ({ node, key }) => <pre key={key}>{node.text}</pre>,\n\t\tstrong: ({ children, key }) => <strong key={key}>{children}</strong>,\n\t\tem: ({ children, key }) => <em key={key}>{children}</em>,\n\t\tlistItem: ({ children, key }) => <li key={key}>{children}</li>,\n\t\toListItem: ({ children, key }) => <li key={key}>{children}</li>,\n\t\tlist: ({ children, key }) => <ul key={key}>{children}</ul>,\n\t\toList: ({ children, key }) => <ol key={key}>{children}</ol>,\n\t\timage: ({ node, key }) => {\n\t\t\tconst img = (\n\t\t\t\t<img\n\t\t\t\t\tsrc={node.url}\n\t\t\t\t\talt={node.alt ?? undefined}\n\t\t\t\t\tdata-copyright={node.copyright ? node.copyright : undefined}\n\t\t\t\t/>\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<p key={key} className=\"block-img\">\n\t\t\t\t\t{node.linkTo ? (\n\t\t\t\t\t\t<PrismicLink\n\t\t\t\t\t\t\tlinkResolver={args.linkResolver}\n\t\t\t\t\t\t\tinternalComponent={args.internalLinkComponent}\n\t\t\t\t\t\t\texternalComponent={args.externalLinkComponent}\n\t\t\t\t\t\t\tfield={node.linkTo}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{img}\n\t\t\t\t\t\t</PrismicLink>\n\t\t\t\t\t) : (\n\t\t\t\t\t\timg\n\t\t\t\t\t)}\n\t\t\t\t</p>\n\t\t\t);\n\t\t},\n\t\tembed: ({ node, key }) => (\n\t\t\t<div\n\t\t\t\tkey={key}\n\t\t\t\tdata-oembed={node.oembed.embed_url}\n\t\t\t\tdata-oembed-type={node.oembed.type}\n\t\t\t\tdata-oembed-provider={node.oembed.provider_name}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: node.oembed.html ?? \"\" }}\n\t\t\t/>\n\t\t),\n\t\thyperlink: ({ node, children, key }) => (\n\t\t\t<PrismicLink\n\t\t\t\tkey={key}\n\t\t\t\tfield={node.data}\n\t\t\t\tlinkResolver={args.linkResolver}\n\t\t\t\tinternalComponent={args.internalLinkComponent}\n\t\t\t\texternalComponent={args.externalLinkComponent}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</PrismicLink>\n\t\t),\n\t\tlabel: ({ node, children, key }) => (\n\t\t\t<span key={key} className={node.data.label}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t),\n\t\tspan: ({ text, key }) => {\n\t\t\tconst result: React.ReactNode[] = [];\n\n\t\t\tlet i = 0;\n\t\t\tfor (const line of text.split(\"\\n\")) {\n\t\t\t\tif (i > 0) {\n\t\t\t\t\tresult.push(<br key={`${i}__break`} />);\n\t\t\t\t}\n\n\t\t\t\tresult.push(<React.Fragment key={`${i}__line`}>{line}</React.Fragment>);\n\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\treturn <React.Fragment key={key}>{result}</React.Fragment>;\n\t\t},\n\t});\n\n/**\n * React component that renders content from a Prismic Rich Text field. By\n * default, HTML elements are rendered for each piece of content. A `heading1`\n * block will render an `<h1>` HTML element, for example. Links will use\n * `<PrismicLink>` by default which can be customized using the\n * `internalLinkComponent` and `externalLinkComponent` props.\n *\n * To customize the components that are rendered, provide a map or function\n * serializer to the `components` prop.\n *\n * Components can also be provided in a centralized location using the\n * `<PrismicProvider>` React context provider.\n *\n * @remarks\n * This component returns a React fragment with no wrapping element around the\n * content. If you need a wrapper, add a component around `<PrismicRichText>`.\n * @example Rendering a Rich Text field using the default HTMl elements.\n *\n * ```jsx\n * <PrismicRichText field={document.data.content} />;\n * ```\n *\n * @example Rendering a Rich Text field using a custom set of React components.\n *\n * ```jsx\n * <PrismicRichText\n * \tfield={document.data.content}\n * \tcomponents={{\n * \t\theading1: ({ children }) => <Heading>{children}</Heading>,\n * \t}}\n * />;\n * ```\n *\n * @param props - Props for the component.\n *\n * @returns The Rich Text field's content as React components.\n *\n * @see Learn about Rich Text fields {@link https://prismic.io/docs/core-concepts/rich-text-title}\n * @see Learn about Rich Text serializers {@link https://prismic.io/docs/core-concepts/html-serializer}\n */\nexport const PrismicRichText = (\n\tprops: PrismicRichTextProps,\n): JSX.Element | null => {\n\tconst context = usePrismicContext();\n\n\treturn React.useMemo(() => {\n\t\tif (!props.field) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\tconst linkResolver = props.linkResolver || context.linkResolver;\n\t\t\tconst defaultSerializer = createDefaultSerializer({\n\t\t\t\tlinkResolver,\n\t\t\t\tinternalLinkComponent: props.internalLinkComponent,\n\t\t\t\texternalLinkComponent: props.externalLinkComponent,\n\t\t\t});\n\n\t\t\tconst serializer = prismicR.composeSerializers(\n\t\t\t\ttypeof props.components === \"object\"\n\t\t\t\t\t? prismicR.wrapMapSerializer(props.components)\n\t\t\t\t\t: props.components,\n\t\t\t\ttypeof context.richTextComponents === \"object\"\n\t\t\t\t\t? prismicR.wrapMapSerializer(context.richTextComponents)\n\t\t\t\t\t: context.richTextComponents,\n\t\t\t\tdefaultSerializer,\n\t\t\t);\n\n\t\t\tconst serialized = prismicR.serialize(props.field, serializer);\n\n\t\t\treturn <>{serialized}</>;\n\t\t}\n\t}, [\n\t\tprops.field,\n\t\tprops.internalLinkComponent,\n\t\tprops.externalLinkComponent,\n\t\tprops.components,\n\t\tprops.linkResolver,\n\t\tcontext.linkResolver,\n\t\tcontext.richTextComponents,\n\t]);\n};\n","import * as React from \"react\";\nimport * as prismicT from \"@prismicio/types\";\nimport { pascalCase } from \"tiny-case\";\nimport { PascalCase } from \"type-fest\";\n\nimport { __PRODUCTION__ } from \"./lib/__PRODUCTION__\";\n\n/**\n * The minimum required properties to represent a Prismic Slice for the\n * `<SliceZone>` component.\n *\n * If using Prismic's REST API, use the `Slice` export from `@prismicio/types`\n * for a full interface.\n *\n * @typeParam SliceType - Type name of the Slice.\n */\nexport type SliceLike<SliceType extends string = string> = Pick<\n\tprismicT.Slice<SliceType>,\n\t\"slice_type\"\n>;\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/types` using `SliceLike`.\n *\n * If using Prismic's REST API, use the `SliceZone` export from\n * `@prismicio/types` for the full type.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n */\nexport type SliceZoneLike<TSlice extends SliceLike> = readonly TSlice[];\n\n/**\n * React props for a component rendering content from a Prismic Slice using the\n * `<SliceZone>` component.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `<SliceZone>` and made\n * available to all Slice components.\n */\nexport type SliceComponentProps<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = {\n\t/**\n\t * Slice data for this component.\n\t */\n\tslice: TSlice;\n\n\t/**\n\t * The index of the Slice in the Slice Zone.\n\t */\n\tindex: number;\n\n\t/**\n\t * All Slices from the Slice Zone to which the Slice belongs.\n\t */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<SliceLike>;\n\n\t/**\n\t * Arbitrary data passed to `<SliceZone>` and made available to all Slice components.\n\t */\n\tcontext: TContext;\n};\n\n/**\n * A React component to be rendered for each instance of its Slice.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceComponentType<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = React.ComponentType<SliceComponentProps<TSlice, TContext>>;\n\n/**\n * A record of Slice types mapped to a React component. The component will be\n * rendered for each instance of its Slice.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceZoneComponents<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> =\n\t// This is purposely not wrapped in Partial to ensure a component is provided\n\t// for all Slice types. <SliceZone> will render a default component if one is\n\t// not provided, but it *should* be a type error if an explicit component is\n\t// missing.\n\t//\n\t// If a developer purposely does not want to provide a component, they can\n\t// assign it to the TODOSliceComponent exported from this package. This\n\t// signals to future developers that it is a placeholder and should be\n\t// implemented.\n\t{\n\t\t[SliceType in keyof Record<\n\t\t\tTSlice[\"slice_type\"],\n\t\t\tnever\n\t\t>]: SliceComponentType<\n\t\t\tExtract<TSlice, SliceLike<SliceType>> extends never\n\t\t\t\t? SliceLike\n\t\t\t\t: Extract<TSlice, SliceLike<SliceType>>,\n\t\t\tTContext\n\t\t>;\n\t};\n\n/**\n * This Slice component can be used as a reminder to provide a proper implementation.\n *\n * This is also the default React component rendered when a component mapping\n * cannot be found in `<SliceZone>`.\n */\nexport const TODOSliceComponent = __PRODUCTION__\n\t? () => null\n\t: <TSlice extends SliceLike, TContext>({\n\t\t\tslice,\n\t }: SliceComponentProps<TSlice, TContext>): JSX.Element | null => {\n\t\t\tReact.useEffect(() => {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[SliceZone] Could not find a component for Slice type \"${slice.slice_type}\"`,\n\t\t\t\t\tslice,\n\t\t\t\t);\n\t\t\t}, [slice]);\n\n\t\t\treturn (\n\t\t\t\t<section\n\t\t\t\t\tdata-slice-zone-todo-component=\"\"\n\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t>\n\t\t\t\t\tCould not find a component for Slice type “{slice.slice_type}\n\t\t\t\t\t”\n\t\t\t\t</section>\n\t\t\t);\n\t };\n\n/**\n * Arguments for a `<SliceZone>` `resolver` function.\n */\ntype SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {\n\t/**\n\t * The Slice to resolve to a React component.\n\t */\n\tslice: TSlice;\n\n\t/**\n\t * The name of the Slice.\n\t */\n\tsliceName: PascalCase<TSlice[\"slice_type\"]>;\n\n\t/**\n\t * The index of the Slice in the Slice Zone.\n\t */\n\ti: number;\n};\n\n/**\n * A function that determines the rendered React component for each Slice in the\n * Slice Zone. If a nullish value is returned, the component will fallback to\n * the `components` or `defaultComponent` props to determine the rendered component.\n *\n * @deprecated Use the `components` prop instead.\n *\n * @param args - Arguments for the resolver function.\n *\n * @returns The React component to render for a Slice.\n */\nexport type SliceZoneResolver<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = (\n\targs: SliceZoneResolverArgs<TSlice>,\n) => SliceComponentType<TSlice, TContext> | undefined | null;\n\n/**\n * React props for the `<SliceZone>` component.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceZoneProps<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = {\n\t/**\n\t * List of Slice data from the Slice Zone.\n\t */\n\tslices?: SliceZoneLike<TSlice>;\n\n\t/**\n\t * A record mapping Slice types to React components.\n\t */\n\tcomponents?: SliceZoneComponents<TSlice, TContext>;\n\n\t/**\n\t * A function that determines the rendered React component for each Slice in\n\t * the Slice Zone.\n\t *\n\t * @deprecated Use the `components` prop instead.\n\t *\n\t * @param args - Arguments for the resolver function.\n\t *\n\t * @returns The React component to render for a Slice.\n\t */\n\tresolver?: SliceZoneResolver<TSlice, TContext>;\n\n\t/**\n\t * The React component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t */\n\tdefaultComponent?: SliceComponentType<TSlice, TContext>;\n\n\t/**\n\t * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext;\n};\n\n/**\n * Renders content from a Prismic Slice Zone using React components for each\n * type of Slice.\n *\n * If a component is not provided for a type of Slice, a default component can\n * be provided. A fallback component is provided by default that will not be\n * rendered in a production build of your app.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n *\n * @returns The Slice Zone's content as React components.\n *\n * @see Learn about Prismic Slices and Slice Zones {@link https://prismic.io/docs/core-concepts/slices}\n */\nexport const SliceZone = <TSlice extends SliceLike, TContext>({\n\tslices = [],\n\tcomponents = {} as SliceZoneComponents<TSlice, TContext>,\n\tresolver,\n\tdefaultComponent = TODOSliceComponent,\n\tcontext = {} as TContext,\n}: SliceZoneProps<TSlice, TContext>): JSX.Element => {\n\tconst renderedSlices = React.useMemo(() => {\n\t\treturn slices.map((slice, index) => {\n\t\t\tlet Comp = (components[slice.slice_type as keyof typeof components] ||\n\t\t\t\tdefaultComponent) as SliceComponentType<TSlice, TContext>;\n\n\t\t\t// TODO: Remove `resolver` in v3 in favor of `components`.\n\t\t\tif (resolver) {\n\t\t\t\tconst resolvedComp = resolver({\n\t\t\t\t\tslice,\n\t\t\t\t\tsliceName: pascalCase(slice.slice_type) as PascalCase<\n\t\t\t\t\t\ttypeof slice.slice_type\n\t\t\t\t\t>,\n\t\t\t\t\ti: index,\n\t\t\t\t});\n\n\t\t\t\tif (resolvedComp) {\n\t\t\t\t\tComp = resolvedComp;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst key = `${index}-${JSON.stringify(slice)}`;\n\n\t\t\treturn (\n\t\t\t\t<Comp\n\t\t\t\t\tkey={key}\n\t\t\t\t\tslice={slice}\n\t\t\t\t\tindex={index}\n\t\t\t\t\tslices={slices}\n\t\t\t\t\tcontext={context}\n\t\t\t\t/>\n\t\t\t);\n\t\t});\n\t}, [components, context, defaultComponent, slices, resolver]);\n\n\treturn <>{renderedSlices}</>;\n};\n","import * as React from \"react\";\n\n/**\n * Props for `<PrismicToolbar>`.\n */\nexport type PrismicToolbarProps = {\n\t/**\n\t * The name of the Prismic repository. For example, `\"my-repo\"` if the\n\t * repository URL is `my-repo.prismic.io`.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The type of toolbar needed for the repository. Defaults to `\"new\"`.\n\t *\n\t * @see To check which version you need, view the Prismic Toolbar documentation {@link https://prismic.io/docs/technologies/previews-and-the-prismic-toolbar-reactjs}\n\t */\n\ttype?: \"new\" | \"legacy\";\n};\n\n/**\n * React component that injects the Prismic Toolbar into the app. This component\n * can be placed anywhere in the React tree.\n */\nexport const PrismicToolbar = ({\n\trepositoryName,\n\ttype = \"new\",\n}: PrismicToolbarProps): null => {\n\tconst src = `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${\n\t\ttype === \"new\" ? \"&new=true\" : \"\"\n\t}`;\n\n\tReact.useEffect(() => {\n\t\tconst existingScript = document.querySelector(`script[src=\"${src}\"]`);\n\n\t\tif (!existingScript) {\n\t\t\tconst script = document.createElement(\"script\");\n\t\t\tscript.src = src;\n\t\t\tscript.defer = true;\n\n\t\t\t// Used to distinguish the toolbar element from other elements.\n\t\t\tscript.dataset.prismicToolbar = \"\";\n\t\t\tscript.dataset.repositoryName = repositoryName;\n\t\t\tscript.dataset.type = type;\n\n\t\t\tdocument.body.appendChild(script);\n\t\t}\n\t}, [repositoryName, type]);\n\n\treturn null;\n};\n","import type * as prismic from \"@prismicio/client\";\n\nimport * as React from \"react\";\n\nimport { PrismicClientHookState } from \"./types\";\nimport { usePrismicClient } from \"./usePrismicClient\";\n\ntype StateMachineState<TData> = {\n\tstate: PrismicClientHookState;\n\tdata?: TData;\n\terror?: Error;\n};\n\ntype StateMachineAction<TData> =\n\t| [type: \"start\"]\n\t| [type: \"succeed\", payload: TData]\n\t| [type: \"fail\", payload: Error];\n\nconst reducer = <TData>(\n\tstate: StateMachineState<TData>,\n\taction: StateMachineAction<TData>,\n): StateMachineState<TData> => {\n\tswitch (action[0]) {\n\t\tcase \"start\": {\n\t\t\treturn { state: \"loading\" };\n\t\t}\n\n\t\tcase \"succeed\": {\n\t\t\treturn { state: \"loaded\", data: action[1] };\n\t\t}\n\n\t\tcase \"fail\": {\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tstate: \"failed\",\n\t\t\t\terror: action[1],\n\t\t\t};\n\t\t}\n\t}\n};\n\nconst initialState: StateMachineState<never> = {\n\tstate: \"idle\",\n};\n\ntype UnwrapPromise<T> = T extends Promise<infer U> ? U : T;\n\ntype ClientPrototype = typeof prismic.Client.prototype;\n\ntype ClientMethod<MethodName extends keyof ClientPrototype> =\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tClientPrototype[MethodName] extends (...args: any[]) => any\n\t\t? ClientPrototype[MethodName]\n\t\t: never;\n\ntype ClientMethodName = keyof {\n\t[P in keyof prismic.Client as prismic.Client[P] extends (\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t...args: any[]\n\t) => // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tPromise<any>\n\t\t? P\n\t\t: never]: unknown;\n};\n\nexport type ClientMethodParameters<MethodName extends keyof ClientPrototype> =\n\tParameters<ClientMethod<MethodName>>;\n\nexport type HookOnlyParameters = {\n\tclient?: prismic.Client;\n\tskip?: boolean;\n};\n\n/**\n * Determines if a value is a `@prismicio/client` params object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if `value` is a `@prismicio/client` params object, `false` otherwise.\n */\nconst isParams = (\n\tvalue: unknown,\n): value is ClientMethodParameters<\"get\">[0] & HookOnlyParameters => {\n\t// This is a *very* naive check.\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n};\n\n/**\n * The return value of a `@prismicio/client` React hook.\n *\n * @typeParam TData - Data returned by the client.\n */\nexport type ClientHookReturnType<TData = unknown> = [\n\t/**\n\t * Data returned by the client.\n\t */\n\tdata: TData | undefined,\n\n\t/**\n\t * The current state of the hook's client method call.\n\t */\n\tstate: Pick<StateMachineState<TData>, \"state\" | \"error\">,\n];\n\n/**\n * Creates a React hook that forwards arguments to a specific method of a\n * `@prismicio/client` instance. The created hook has its own internal state\n * manager to report async status, such as pending or error statuses.\n *\n * @param methodName - The `@prismicio/client` method to which hook arguments\n * will be forwarded.\n *\n * @returns A new React hook configured for the provided method.\n *\n * @internal\n */\nexport const useStatefulPrismicClientMethod = <\n\tTMethodName extends ClientMethodName,\n\tTArgs extends Parameters<ClientMethod<TMethodName>>,\n\tTData extends UnwrapPromise<ReturnType<ClientMethod<TMethodName>>>,\n>(\n\tmethodName: TMethodName,\n\targs: TArgs,\n\texplicitClient?: prismic.Client,\n): ClientHookReturnType<TData> => {\n\tconst lastArg = args[args.length - 1];\n\tconst {\n\t\tclient: lastArgExplicitClient,\n\t\tskip,\n\t\t...params\n\t} = isParams(lastArg) ? lastArg : ({} as HookOnlyParameters);\n\tconst argsWithoutParams = isParams(lastArg) ? args.slice(0, -1) : args;\n\n\tconst client = usePrismicClient(explicitClient || lastArgExplicitClient);\n\n\tconst [state, dispatch] = React.useReducer<\n\t\tReact.Reducer<StateMachineState<TData>, StateMachineAction<TData>>\n\t>(reducer, initialState);\n\n\tReact.useEffect(\n\t\t() => {\n\t\t\t// Used to prevent dispatching an action if the hook was cleaned up.\n\t\t\tlet didCancel = false;\n\n\t\t\tif (!skip) {\n\t\t\t\tif (!didCancel) {\n\t\t\t\t\tdispatch([\"start\"]);\n\t\t\t\t}\n\n\t\t\t\tclient[methodName]\n\t\t\t\t\t.call(\n\t\t\t\t\t\tclient,\n\t\t\t\t\t\t// @ts-expect-error - Merging method arg types is too complex\n\t\t\t\t\t\t...argsWithoutParams,\n\t\t\t\t\t\tparams,\n\t\t\t\t\t)\n\t\t\t\t\t.then((result) => {\n\t\t\t\t\t\tif (!didCancel) {\n\t\t\t\t\t\t\tdispatch([\"succeed\", result as TData]);\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tif (!didCancel) {\n\t\t\t\t\t\t\tdispatch([\"fail\", error]);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Ensure we don't dispatch an action if the hook is cleaned up.\n\t\t\t() => {\n\t\t\t\tdidCancel = true;\n\t\t\t};\n\t\t},\n\t\t// We must disable exhaustive-deps since we are using\n\t\t// JSON.stringify on params (effectively a deep equality check).\n\t\t// We want this effect to run again anytime params change.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[\n\t\t\tclient,\n\t\t\tmethodName,\n\t\t\tskip,\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t\tJSON.stringify(argsWithoutParams),\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t\tJSON.stringify(params),\n\t\t],\n\t);\n\n\treturn React.useMemo(\n\t\t() => [\n\t\t\tstate.data,\n\t\t\t{\n\t\t\t\tstate: state.state,\n\t\t\t\terror: state.error,\n\t\t\t},\n\t\t],\n\t\t[state],\n\t);\n};\n","import type * as prismic from \"@prismicio/client\";\n\nimport * as React from \"react\";\n\nimport { usePrismicContext } from \"./usePrismicContext\";\nimport {\n\tClientHookReturnType,\n\tuseStatefulPrismicClientMethod,\n} from \"./useStatefulPrismicClientMethod\";\n\nexport type UsePrismicPreviewResolverArgs = {\n\t/**\n\t * An optional `@prismicio/client` instance to override the Client provided to\n\t * `<PrismicProvider>`\n\t */\n\tclient?: prismic.Client;\n\n\t/**\n\t * A function that maps a Prismic document to a URL within your app.\n\t */\n\tlinkResolver?: Parameters<\n\t\tprismic.Client[\"resolvePreviewURL\"]\n\t>[0][\"linkResolver\"];\n\n\t/**\n\t * A fallback URL if the Link Resolver does not return a value.\n\t */\n\tdefaultURL?: Parameters<prismic.Client[\"resolvePreviewURL\"]>[0][\"defaultURL\"];\n\n\t/**\n\t * The preview token (also known as a ref) that will be used to query preview\n\t * content from the Prismic repository.\n\t */\n\tpreviewToken?: Parameters<\n\t\tprismic.Client[\"resolvePreviewURL\"]\n\t>[0][\"previewToken\"];\n\n\t/**\n\t * The previewed document that will be used to determine the destination URL.\n\t */\n\tdocumentID?: Parameters<prismic.Client[\"resolvePreviewURL\"]>[0][\"documentID\"];\n\n\t/**\n\t * A function to automatically navigate to the resolved URL. If a function is\n\t * not provded, `usePreviewResolver` will not navigate to the URL.\n\t *\n\t * @param url - The resolved preview URL.\n\t */\n\tnavigate?: (url: string) => unknown;\n};\n\n/**\n * Resolve a preview session's URL. The resolved URL can be used to redirect to\n * the previewed document.\n *\n * If a `navigate` function is provided, the hook will automatically navigate to\n * the previewed document's URL.\n *\n * @param args - Arguments to configure how a URL is resolved.\n *\n * @returns A tuple containing the resolved URL and the hook's state.\n */\nexport const usePrismicPreviewResolver = (\n\targs: UsePrismicPreviewResolverArgs = {},\n): ClientHookReturnType<string> => {\n\tconst context = usePrismicContext();\n\n\tconst linkResolver = args.linkResolver || context.linkResolver;\n\n\tconst result = useStatefulPrismicClientMethod(\n\t\t\"resolvePreviewURL\",\n\t\t[\n\t\t\t{\n\t\t\t\tlinkResolver,\n\t\t\t\tdefaultURL: args.defaultURL || \"/\",\n\t\t\t\tpreviewToken: args.previewToken,\n\t\t\t\tdocumentID: args.documentID,\n\t\t\t},\n\t\t],\n\t\targs.client,\n\t);\n\n\tconst [resolvedURL] = result;\n\tconst { navigate } = args;\n\n\tReact.useEffect(() => {\n\t\tif (resolvedURL && navigate) {\n\t\t\tnavigate(resolvedURL);\n\t\t}\n\t}, [resolvedURL, navigate]);\n\n\treturn result;\n};\n","import type * as prismicT from \"@prismicio/types\";\n\nimport {\n\tClientHookReturnType,\n\tClientMethodParameters,\n\tHookOnlyParameters,\n\tuseStatefulPrismicClientMethod,\n} from \"./useStatefulPrismicClientMethod\";\n\n/**\n * A hook that queries content from the Prismic repository.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.get}\n */\nexport const usePrismicDocuments = <TDocument extends prismicT.PrismicDocument>(\n\t...args: [params?: ClientMethodParameters<\"get\">[0] & HookOnlyParameters]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"get\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns only the\n * first result, if any.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getFirst}\n */\nexport const useFirstPrismicDocument = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [params?: ClientMethodParameters<\"getFirst\">[0] & HookOnlyParameters]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getFirst\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns all\n * matching content. If no predicates are provided, all documents will be fetched.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAll}\n */\nexport const useAllPrismicDocumentsDangerously = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"dangerouslyGetAll\">[0] &\n\t\t\tHookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"dangerouslyGetAll\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific ID.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param id - ID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByID}\n */\nexport const usePrismicDocumentByID = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByID\">[0],\n\t\tparams?: ClientMethodParameters<\"getByID\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByIDs}\n */\nexport const usePrismicDocumentsByIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getAllByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByIDs\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific\n * UID and Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uid - UID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentByUID = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUID\">[0],\n\t\tuid: ClientMethodParameters<\"getByUID\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUID\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByUID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific UIDs\n * of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentsByUIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByUIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * UIDs of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const useAllPrismicDocumentsByUIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByUIDs\", args);\n\n/**\n * A hook that queries a singleton document from the Prismic repository for a\n * specific Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the singleton Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getSingle}\n */\nexport const useSinglePrismicDocument = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getSingle\">[0],\n\t\tparams?: ClientMethodParameters<\"getSingle\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getSingle\", args);\n\n/**\n * A hook that queries documents from the Prismic repository for a specific Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByType}\n */\nexport const usePrismicDocumentsByType = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByType\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository for a specific\n * Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByType}\n */\nexport const useAllPrismicDocumentsByType = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByType\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with a specific tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTag}\n */\nexport const usePrismicDocumentsByTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with a specific tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTag}\n */\nexport const useAllPrismicDocumentsByTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByTag\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with at least one of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsBySomeTags = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getBySomeTags\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with at least one of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsBySomeTags = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllBySomeTags\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsByEveryTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByEveryTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsByEveryTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByEveryTag\", args);\n","export { PrismicProvider } from \"./PrismicProvider\";\nexport type {\n\tPrismicProviderProps,\n\tPrismicContextValue,\n} from \"./PrismicProvider\";\n\nexport { usePrismicContext } from \"./usePrismicContext\";\n\nexport { usePrismicClient } from \"./usePrismicClient\";\n\nexport { PrismicLink } from \"./PrismicLink\";\nexport type { PrismicLinkProps, LinkProps } from \"./PrismicLink\";\n\nexport { PrismicText } from \"./PrismicText\";\nexport type { PrismicTextProps } from \"./PrismicText\";\n\nexport { PrismicRichText } from \"./PrismicRichText\";\nexport type { PrismicRichTextProps } from \"./PrismicRichText\";\n\nimport { Element } from \"@prismicio/richtext\";\nexport { Element };\n/**\n * @deprecated Renamed to `Element` (without an \"s\").\n */\n// TODO: Remove in v3.\nexport const Elements = Element;\n\nexport { SliceZone, TODOSliceComponent } from \"./SliceZone\";\nexport type {\n\tSliceComponentProps,\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n\tSliceZoneProps,\n\tSliceZoneResolver,\n} from \"./SliceZone\";\n\nexport { PrismicToolbar } from \"./PrismicToolbar\";\nexport type { PrismicToolbarProps } from \"./PrismicToolbar\";\n\nexport { usePrismicPreviewResolver } from \"./usePrismicPreviewResolver\";\nexport type { UsePrismicPreviewResolverArgs } from \"./usePrismicPreviewResolver\";\n\nexport {\n\tuseAllPrismicDocumentsDangerously,\n\tuseAllPrismicDocumentsByEveryTag,\n\tuseAllPrismicDocumentsByIDs,\n\tuseAllPrismicDocumentsBySomeTags,\n\tuseAllPrismicDocumentsByTag,\n\tuseAllPrismicDocumentsByType,\n\tuseAllPrismicDocumentsByUIDs,\n\tuseFirstPrismicDocument,\n\tusePrismicDocumentByID,\n\tusePrismicDocumentByUID,\n\tusePrismicDocuments,\n\tusePrismicDocumentsByEveryTag,\n\tusePrismicDocumentsByIDs,\n\tusePrismicDocumentsBySomeTags,\n\tusePrismicDocumentsByTag,\n\tusePrismicDocumentsByType,\n\tusePrismicDocumentsByUIDs,\n\tuseSinglePrismicDocument,\n} from \"./clientHooks\";\n\nexport type {\n\tJSXMapSerializer,\n\tJSXFunctionSerializer,\n\tPrismicClientHook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AgB;MAkBnC,2BAA2B,IAGpC,SAKH,+BAA+B,aAAa;MAiBhC,4BAA4B,IAGrC,SAKH,+BAA+B,aAAa;MAkBhC,+BAA+B,IAGxC,SAKH,+BAA+B,gBAAgB;MAiBnC,2BAA2B,IAGpC,SAKH,+BAA+B,YAAY;MAiB/B,8BAA8B,IAGvC,SAKH,+BAA+B,eAAe;MAkBlC,gCAAgC,IAGzC,SAKH,+BAA+B,iBAAiB;MAkBpC,mCAAmC,IAG5C,SAKH,+BAA+B,oBAAoB;MAkBvC,gCAAgC,IAGzC,SAKH,+BAA+B,iBAAiB;MAkBpC,mCAAmC,IAG5C,SAKH,+BAA+B,oBAAoB;;MCtbvC,WAAWI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/PrismicProvider.tsx","../src/usePrismicContext.ts","../src/lib/__PRODUCTION__.ts","../src/lib/invariant.ts","../src/usePrismicClient.ts","../src/lib/isInternalURL.ts","../src/PrismicLink.tsx","../src/PrismicText.tsx","../src/PrismicRichText.tsx","../src/lib/pascalCase.ts","../src/SliceZone.tsx","../src/PrismicToolbar.tsx","../src/useStatefulPrismicClientMethod.ts","../src/usePrismicPreviewResolver.ts","../src/clientHooks.ts","../src/index.ts"],"sourcesContent":["import type * as prismic from \"@prismicio/client\";\n\nimport * as React from \"react\";\nimport { createContext, useMemo } from \"react\";\nimport * as prismicH from \"@prismicio/helpers\";\n\nimport { LinkProps } from \"./PrismicLink\";\nimport { JSXFunctionSerializer, JSXMapSerializer } from \"./types\";\n\n/**\n * React context value containing shared configuration for `@prismicio/react`\n * components and hooks.\n */\nexport type PrismicContextValue = {\n\t/**\n\t * A `@prismicio/client` instance used to fetch content from a Prismic\n\t * repository. This is used by `@prismicio/react` hooks, such as\n\t * `usePrismicDocuments()`.\n\t */\n\tclient?: prismic.Client;\n\n\t/**\n\t * A Link Resolver used to resolve links for `<PrismicLink>` and `<PrismicRichText>`.\n\t *\n\t * @remarks\n\t * If your app uses Route Resolvers when querying for your Prismic\n\t * repository's content, a Link Resolver does not need to be provided.\n\t * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: prismicH.LinkResolverFunction;\n\n\t/**\n\t * A map or function that maps a Rich Text block to a React component.\n\t *\n\t * @remarks\n\t * Prefer using a map serializer over the function serializer when possible.\n\t * The map serializer is simpler to maintain.\n\t * @example A map serializer.\n\t *\n\t * ```jsx\n\t * {\n\t * heading1: ({children}) => <Heading>{children}</Heading>\n\t * }\n\t * ```\n\t *\n\t * @example A function serializer.\n\t *\n\t * ```jsx\n\t * (type, node, content, children) => {\n\t * \tswitch (type) {\n\t * \t\tcase \"heading1\": {\n\t * \t\t\treturn <Heading>{chidlren}</Heading>;\n\t * \t\t}\n\t * \t}\n\t * };\n\t * ```\n\t */\n\trichTextComponents?: JSXMapSerializer | JSXFunctionSerializer;\n\n\t/**\n\t * The component rendered by `<PrismicLink>` for internal URLs. Defaults to `<a>`.\n\t */\n\tinternalLinkComponent?: React.ElementType<LinkProps>;\n\n\t/**\n\t * The component rendered by `<PrismicLink>` for external URLs. Defaults to `<a>`.\n\t */\n\texternalLinkComponent?: React.ElementType<LinkProps>;\n\n\t/**\n\t * Children for the component.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React context containing shared configuration for `@prismicio/react`\n * components and hooks.\n */\nexport const PrismicContext = createContext<PrismicContextValue>({});\n\n/**\n * Props for `<PrismicProvider>`.\n */\nexport type PrismicProviderProps = PrismicContextValue;\n\n/**\n * React context provider to share configuration for `@prismicio/react`\n * components and hooks.\n *\n * @returns A React context provider with shared configuration.\n */\nexport const PrismicProvider = ({\n\tclient,\n\tlinkResolver,\n\trichTextComponents,\n\tinternalLinkComponent,\n\texternalLinkComponent,\n\tchildren,\n}: PrismicProviderProps): JSX.Element => {\n\tconst value = useMemo<PrismicContextValue>(\n\t\t() => ({\n\t\t\tclient,\n\t\t\tlinkResolver,\n\t\t\trichTextComponents,\n\t\t\tinternalLinkComponent,\n\t\t\texternalLinkComponent,\n\t\t}),\n\t\t[\n\t\t\tclient,\n\t\t\tlinkResolver,\n\t\t\trichTextComponents,\n\t\t\tinternalLinkComponent,\n\t\t\texternalLinkComponent,\n\t\t],\n\t);\n\n\treturn (\n\t\t<PrismicContext.Provider value={value}>{children}</PrismicContext.Provider>\n\t);\n};\n","import { useContext } from \"react\";\n\nimport { PrismicContext, PrismicContextValue } from \"./PrismicProvider\";\n\n/**\n * React hook used to read shared configuration for `@prismicio/react`\n * components and hooks.\n *\n * @returns The closest `<PrismicProvider>` context value.\n */\nexport const usePrismicContext = (): PrismicContextValue => {\n\treturn useContext(PrismicContext) || {};\n};\n","// We need to polyfill process if it doesn't exist, such as in the browser.\nif (typeof process === \"undefined\") {\n\tglobalThis.process = { env: {} } as typeof process;\n}\n\n/**\n * `true` if in the production environment, `false` otherwise.\n *\n * This boolean can be used to perform actions only in development environments,\n * such as logging.\n */\nexport const __PRODUCTION__ = process.env.NODE_ENV === \"production\";\n","/**\n * MIT License\n *\n * Copyright (c) 2019 Alexander Reardon\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { __PRODUCTION__ } from \"./__PRODUCTION__\";\n\nconst prefix = \"Invariant failed\";\n\n// Throw an error if the condition fails\n// Strip out error messages for production\n// > Not providing an inline default argument for message as the result is smaller\nexport function invariant(\n\tcondition: unknown,\n\tmessage?: string,\n): asserts condition {\n\tif (condition) {\n\t\treturn;\n\t}\n\t// Condition not passed\n\n\t// In production we strip the message but still throw\n\tif (__PRODUCTION__) {\n\t\tthrow new Error(prefix);\n\t}\n\n\t// When not in production we allow the message to pass through\n\t// *This block will be removed in production builds*\n\tthrow new Error(`${prefix}: ${message || \"\"}`);\n}\n","import type * as prismic from \"@prismicio/client\";\n\nimport { invariant } from \"./lib/invariant\";\n\nimport { usePrismicContext } from \"./usePrismicContext\";\n\n/**\n * Retrieve the `@prismicio/client` instance provided to `<PrismicProvider>`\n * higher in the React tree.\n *\n * @param explicitClient - An optional `@prismicio/client` instance to override\n * the Client provided to `<PrismicProvider>`.\n *\n * @returns The `@prismicio/client` instance provided to `<PrismicProvider>`.\n */\nexport const usePrismicClient = (\n\texplicitClient?: prismic.Client,\n): prismic.Client => {\n\tconst context = usePrismicContext();\n\n\tconst client = explicitClient || context?.client;\n\tinvariant(\n\t\tclient,\n\t\t\"A @prismicio/client is required to query documents. Provide a client to the hook or to a <PrismicProvider> higher in your component tree.\",\n\t);\n\n\treturn client;\n};\n","/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n *\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url);\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url);\n\n\treturn isInternal && !isSpecialLink;\n};\n","import * as React from \"react\";\nimport * as prismicH from \"@prismicio/helpers\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { isInternalURL } from \"./lib/isInternalURL\";\n\nimport { usePrismicContext } from \"./usePrismicContext\";\n\n/**\n * Props provided to a component when rendered with `<PrismicLink>`.\n */\nexport interface LinkProps {\n\t/**\n\t * The URL to link.\n\t */\n\thref: string;\n\n\t/**\n\t * The `target` attribute for anchor elements. If the Prismic field is\n\t * configured to open in a new window, this prop defaults to `_blank`.\n\t */\n\ttarget?: string;\n\n\t/**\n\t * The `rel` attribute for anchor elements. If the `target` prop is set to\n\t * `\"_blank\"`, this prop defaults to `\"noopener noreferrer\"`.\n\t */\n\trel?: string;\n\n\t/**\n\t * Children for the component. *\n\t */\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Props for `<PrismicLink>`.\n */\nexport type PrismicLinkProps<\n\tInternalComponent extends React.ElementType<LinkProps> = React.ElementType<LinkProps>,\n\tExternalComponent extends React.ElementType<LinkProps> = React.ElementType<LinkProps>,\n\tLinkResolverFunction extends prismicH.LinkResolverFunction = prismicH.LinkResolverFunction,\n> = Omit<\n\tReact.ComponentProps<InternalComponent> &\n\t\tReact.ComponentProps<ExternalComponent>,\n\tkeyof LinkProps\n> & {\n\t/**\n\t * The Link Resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses Route Resolvers when querying for your Prismic\n\t * repository's content, a Link Resolver does not need to be provided.\n\t * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction;\n\n\t/**\n\t * The component rendered for internal URLs. Defaults to `<a>`.\n\t *\n\t * If your app uses a client-side router that requires a special Link\n\t * component, provide the Link component to this prop.\n\t */\n\tinternalComponent?: InternalComponent;\n\n\t/**\n\t * The component rendered for external URLs. Defaults to `<a>`.\n\t */\n\texternalComponent?: ExternalComponent;\n\n\t/**\n\t * The `target` attribute for anchor elements. If the Prismic field is\n\t * configured to open in a new window, this prop defaults to `_blank`.\n\t */\n\ttarget?: string | null;\n\n\t/**\n\t * The `rel` attribute for anchor elements. If the `target` prop is set to\n\t * `\"_blank\"`, this prop defaults to `\"noopener noreferrer\"`.\n\t */\n\trel?: string | null;\n\n\t/**\n\t * Children for the component. *\n\t */\n\tchildren?: React.ReactNode;\n} & (\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * The Prismic Link field containing the URL or document to link.\n\t\t\t\t *\n\t\t\t\t * @see Learn about Prismic Link fields {@link https://prismic.io/docs/core-concepts/link-content-relationship}\n\t\t\t\t */\n\t\t\t\tfield: prismicT.LinkField | null | undefined;\n\t\t }\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * The Prismic document to link.\n\t\t\t\t */\n\t\t\t\tdocument: prismicT.PrismicDocument | null | undefined;\n\t\t }\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * The URL to link.\n\t\t\t\t */\n\t\t\t\thref: string | null | undefined;\n\t\t }\n\t);\n\n/**\n * The default component rendered for internal URLs.\n */\nconst defaultInternalComponent = \"a\";\n\n/**\n * The default component rendered for external URLs.\n */\nconst defaultExternalComponent = \"a\";\n\n/**\n * React component that renders a link from a Prismic Link field.\n *\n * Different components can be rendered depending on whether the link is\n * internal or external. This is helpful when integrating with client-side\n * routers, such as a router-specific Link component.\n *\n * If a link is configured to open in a new window using `target=\"_blank\"`,\n * `rel=\"noopener noreferrer\"` is set by default.\n *\n * @param props - Props for the component.\n *\n * @returns The internal or external link component depending on whether the\n * link is internal or external.\n */\nexport const PrismicLink = <\n\tInternalComponent extends React.ElementType<LinkProps> = typeof defaultInternalComponent,\n\tExternalComponent extends React.ElementType<LinkProps> = typeof defaultExternalComponent,\n\tLinkResolverFunction extends prismicH.LinkResolverFunction = prismicH.LinkResolverFunction,\n>(\n\tprops: PrismicLinkProps<\n\t\tInternalComponent,\n\t\tExternalComponent,\n\t\tLinkResolverFunction\n\t>,\n): JSX.Element | null => {\n\tconst context = usePrismicContext();\n\n\tconst linkResolver = props.linkResolver || context.linkResolver;\n\n\tlet href: string | null | undefined;\n\tif (\"href\" in props) {\n\t\thref = props.href;\n\t} else if (\"document\" in props && props.document) {\n\t\thref = prismicH.asLink(props.document, linkResolver);\n\t} else if (\"field\" in props && props.field) {\n\t\thref = prismicH.asLink(props.field, linkResolver);\n\t}\n\n\tconst target =\n\t\tprops.target ||\n\t\t(\"field\" in props &&\n\t\t\tprops.field &&\n\t\t\t\"target\" in props.field &&\n\t\t\tprops.field.target) ||\n\t\tundefined;\n\n\tconst rel =\n\t\tprops.rel || (target === \"_blank\" ? \"noopener noreferrer\" : undefined);\n\n\tconst InternalComponent: React.ElementType<LinkProps> =\n\t\tprops.internalComponent ||\n\t\tcontext.internalLinkComponent ||\n\t\tdefaultInternalComponent;\n\n\tconst ExternalComponent: React.ElementType<LinkProps> =\n\t\tprops.externalComponent ||\n\t\tcontext.externalLinkComponent ||\n\t\tdefaultExternalComponent;\n\n\tconst isInternal = href && isInternalURL(href);\n\n\tconst Component = isInternal ? InternalComponent : ExternalComponent;\n\n\tconst passthroughProps: typeof props = Object.assign({}, props);\n\tdelete passthroughProps.linkResolver;\n\tdelete passthroughProps.internalComponent;\n\tdelete passthroughProps.externalComponent;\n\tdelete passthroughProps.rel;\n\tdelete passthroughProps.target;\n\tif (\"field\" in passthroughProps) {\n\t\tdelete passthroughProps.field;\n\t} else if (\"document\" in passthroughProps) {\n\t\tdelete passthroughProps.document;\n\t} else if (\"href\" in passthroughProps) {\n\t\tdelete passthroughProps.href;\n\t}\n\n\treturn href ? (\n\t\t<Component {...passthroughProps} href={href} target={target} rel={rel} />\n\t) : null;\n};\n","import * as React from \"react\";\nimport { useMemo } from \"react\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as prismicH from \"@prismicio/helpers\";\n\n/**\n * Props for `<PrismicText>`.\n */\nexport type PrismicTextProps = {\n\t/**\n\t * The Prismic Rich Text field to render.\n\t */\n\tfield: prismicT.RichTextField | null | undefined;\n\n\t/**\n\t * The separator used between blocks. Defaults to `\\n`.\n\t */\n\tseparator?: string;\n};\n\n/**\n * React component that renders content from a Prismic Rich Text field as plain text.\n *\n * @remarks\n * This component returns a React fragment with no wrapping element around the\n * content. If you need a wrapper, add a component around `<PrismicText>`.\n * @example Rendering a Rich Text field as plain text.\n *\n * ```jsx\n * <PrismicText field={document.data.content} />;\n * ```\n *\n * @param props - Props for the component.\n *\n * @returns The Rich Text field's content as plain text.\n *\n * @see Learn about Rich Text fields {@link https://prismic.io/docs/core-concepts/rich-text-title}\n */\nexport const PrismicText = (props: PrismicTextProps): JSX.Element | null => {\n\treturn useMemo(() => {\n\t\tif (props.field) {\n\t\t\tconst text = prismicH.asText(props.field, props.separator);\n\n\t\t\treturn <>{text}</>;\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}, [props.field, props.separator]);\n};\n","/* eslint-disable react/display-name */\n/* eslint-disable react/prop-types */\n\nimport * as React from \"react\";\nimport { Fragment, useMemo } from \"react\";\nimport * as prismicT from \"@prismicio/types\";\nimport * as prismicH from \"@prismicio/helpers\";\nimport * as prismicR from \"@prismicio/richtext\";\n\nimport { JSXFunctionSerializer, JSXMapSerializer } from \"./types\";\nimport { PrismicLink, PrismicLinkProps } from \"./PrismicLink\";\nimport { usePrismicContext } from \"./usePrismicContext\";\n\n/**\n * Props for `<PrismicRichText>`.\n */\nexport type PrismicRichTextProps = {\n\t/**\n\t * The Prismic Rich Text field to render.\n\t */\n\tfield: prismicT.RichTextField | null | undefined;\n\n\t/**\n\t * The Link Resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses Route Resolvers when querying for your Prismic\n\t * repository's content, a Link Resolver does not need to be provided.\n\t * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: PrismicLinkProps[\"linkResolver\"];\n\n\t/**\n\t * A function that maps a Rich Text block to a React component.\n\t *\n\t * @deprecated Use the `components` prop instead. Prefer using a map\n\t * serializer when possible.\n\t * @see Learn about Rich Text serializers {@link https://prismic.io/docs/core-concepts/html-serializer}\n\t */\n\thtmlSerializer?: JSXFunctionSerializer;\n\n\t/**\n\t * A map or function that maps a Rich Text block to a React component.\n\t *\n\t * @remarks\n\t * Prefer using a map serializer over the function serializer when possible.\n\t * The map serializer is simpler to maintain.\n\t * @example A map serializer.\n\t *\n\t * ```jsx\n\t * {\n\t * heading1: ({children}) => <Heading>{children}</Heading>\n\t * }\n\t * ```\n\t *\n\t * @example A function serializer.\n\t *\n\t * ```jsx\n\t * (type, node, content, children) => {\n\t * \tswitch (type) {\n\t * \t\tcase \"heading1\": {\n\t * \t\t\treturn <Heading>{chidlren}</Heading>;\n\t * \t\t}\n\t * \t}\n\t * };\n\t * ```\n\t */\n\tcomponents?: JSXMapSerializer | JSXFunctionSerializer;\n\n\t/**\n\t * The React component rendered for links when the URL is internal.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\tinternalLinkComponent?: PrismicLinkProps[\"internalComponent\"];\n\n\t/**\n\t * The React component rendered for links when the URL is external.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalLinkComponent?: PrismicLinkProps[\"externalComponent\"];\n};\n\ntype CreateDefaultSerializerArgs = {\n\tlinkResolver: prismicH.LinkResolverFunction<string> | undefined;\n\tinternalLinkComponent: PrismicRichTextProps[\"internalLinkComponent\"];\n\texternalLinkComponent: PrismicRichTextProps[\"externalLinkComponent\"];\n};\n\nconst createDefaultSerializer = (\n\targs: CreateDefaultSerializerArgs,\n): JSXFunctionSerializer =>\n\tprismicR.wrapMapSerializer({\n\t\theading1: ({ children, key }) => <h1 key={key}>{children}</h1>,\n\t\theading2: ({ children, key }) => <h2 key={key}>{children}</h2>,\n\t\theading3: ({ children, key }) => <h3 key={key}>{children}</h3>,\n\t\theading4: ({ children, key }) => <h4 key={key}>{children}</h4>,\n\t\theading5: ({ children, key }) => <h5 key={key}>{children}</h5>,\n\t\theading6: ({ children, key }) => <h6 key={key}>{children}</h6>,\n\t\tparagraph: ({ children, key }) => <p key={key}>{children}</p>,\n\t\tpreformatted: ({ node, key }) => <pre key={key}>{node.text}</pre>,\n\t\tstrong: ({ children, key }) => <strong key={key}>{children}</strong>,\n\t\tem: ({ children, key }) => <em key={key}>{children}</em>,\n\t\tlistItem: ({ children, key }) => <li key={key}>{children}</li>,\n\t\toListItem: ({ children, key }) => <li key={key}>{children}</li>,\n\t\tlist: ({ children, key }) => <ul key={key}>{children}</ul>,\n\t\toList: ({ children, key }) => <ol key={key}>{children}</ol>,\n\t\timage: ({ node, key }) => {\n\t\t\tconst img = (\n\t\t\t\t<img\n\t\t\t\t\tsrc={node.url}\n\t\t\t\t\talt={node.alt ?? undefined}\n\t\t\t\t\tdata-copyright={node.copyright ? node.copyright : undefined}\n\t\t\t\t/>\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<p key={key} className=\"block-img\">\n\t\t\t\t\t{node.linkTo ? (\n\t\t\t\t\t\t<PrismicLink\n\t\t\t\t\t\t\tlinkResolver={args.linkResolver}\n\t\t\t\t\t\t\tinternalComponent={args.internalLinkComponent}\n\t\t\t\t\t\t\texternalComponent={args.externalLinkComponent}\n\t\t\t\t\t\t\tfield={node.linkTo}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{img}\n\t\t\t\t\t\t</PrismicLink>\n\t\t\t\t\t) : (\n\t\t\t\t\t\timg\n\t\t\t\t\t)}\n\t\t\t\t</p>\n\t\t\t);\n\t\t},\n\t\tembed: ({ node, key }) => (\n\t\t\t<div\n\t\t\t\tkey={key}\n\t\t\t\tdata-oembed={node.oembed.embed_url}\n\t\t\t\tdata-oembed-type={node.oembed.type}\n\t\t\t\tdata-oembed-provider={node.oembed.provider_name}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: node.oembed.html ?? \"\" }}\n\t\t\t/>\n\t\t),\n\t\thyperlink: ({ node, children, key }) => (\n\t\t\t<PrismicLink\n\t\t\t\tkey={key}\n\t\t\t\tfield={node.data}\n\t\t\t\tlinkResolver={args.linkResolver}\n\t\t\t\tinternalComponent={args.internalLinkComponent}\n\t\t\t\texternalComponent={args.externalLinkComponent}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</PrismicLink>\n\t\t),\n\t\tlabel: ({ node, children, key }) => (\n\t\t\t<span key={key} className={node.data.label}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t),\n\t\tspan: ({ text, key }) => {\n\t\t\tconst result: React.ReactNode[] = [];\n\n\t\t\tlet i = 0;\n\t\t\tfor (const line of text.split(\"\\n\")) {\n\t\t\t\tif (i > 0) {\n\t\t\t\t\tresult.push(<br key={`${i}__break`} />);\n\t\t\t\t}\n\n\t\t\t\tresult.push(<Fragment key={`${i}__line`}>{line}</Fragment>);\n\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\treturn <Fragment key={key}>{result}</Fragment>;\n\t\t},\n\t});\n\n/**\n * React component that renders content from a Prismic Rich Text field. By\n * default, HTML elements are rendered for each piece of content. A `heading1`\n * block will render an `<h1>` HTML element, for example. Links will use\n * `<PrismicLink>` by default which can be customized using the\n * `internalLinkComponent` and `externalLinkComponent` props.\n *\n * To customize the components that are rendered, provide a map or function\n * serializer to the `components` prop.\n *\n * Components can also be provided in a centralized location using the\n * `<PrismicProvider>` React context provider.\n *\n * @remarks\n * This component returns a React fragment with no wrapping element around the\n * content. If you need a wrapper, add a component around `<PrismicRichText>`.\n * @example Rendering a Rich Text field using the default HTMl elements.\n *\n * ```jsx\n * <PrismicRichText field={document.data.content} />;\n * ```\n *\n * @example Rendering a Rich Text field using a custom set of React components.\n *\n * ```jsx\n * <PrismicRichText\n * \tfield={document.data.content}\n * \tcomponents={{\n * \t\theading1: ({ children }) => <Heading>{children}</Heading>,\n * \t}}\n * />;\n * ```\n *\n * @param props - Props for the component.\n *\n * @returns The Rich Text field's content as React components.\n *\n * @see Learn about Rich Text fields {@link https://prismic.io/docs/core-concepts/rich-text-title}\n * @see Learn about Rich Text serializers {@link https://prismic.io/docs/core-concepts/html-serializer}\n */\nexport const PrismicRichText = (\n\tprops: PrismicRichTextProps,\n): JSX.Element | null => {\n\tconst context = usePrismicContext();\n\n\treturn useMemo(() => {\n\t\tif (!props.field) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\tconst linkResolver = props.linkResolver || context.linkResolver;\n\t\t\tconst defaultSerializer = createDefaultSerializer({\n\t\t\t\tlinkResolver,\n\t\t\t\tinternalLinkComponent: props.internalLinkComponent,\n\t\t\t\texternalLinkComponent: props.externalLinkComponent,\n\t\t\t});\n\n\t\t\tconst serializer = prismicR.composeSerializers(\n\t\t\t\ttypeof props.components === \"object\"\n\t\t\t\t\t? prismicR.wrapMapSerializer(props.components)\n\t\t\t\t\t: props.components,\n\t\t\t\ttypeof context.richTextComponents === \"object\"\n\t\t\t\t\t? prismicR.wrapMapSerializer(context.richTextComponents)\n\t\t\t\t\t: context.richTextComponents,\n\t\t\t\tdefaultSerializer,\n\t\t\t);\n\n\t\t\tconst serialized = prismicR.serialize(props.field, serializer);\n\n\t\t\treturn <>{serialized}</>;\n\t\t}\n\t}, [\n\t\tprops.field,\n\t\tprops.internalLinkComponent,\n\t\tprops.externalLinkComponent,\n\t\tprops.components,\n\t\tprops.linkResolver,\n\t\tcontext.linkResolver,\n\t\tcontext.richTextComponents,\n\t]);\n};\n","import type { PascalCase } from \"type-fest\";\n\nexport const pascalCase = <Input extends string>(\n\tinput: Input,\n): PascalCase<Input> => {\n\tconst camelCased = input.replace(/(?:-|_)(\\w)/g, (_, c) => {\n\t\treturn c ? c.toUpperCase() : \"\";\n\t});\n\n\treturn (camelCased[0].toUpperCase() +\n\t\tcamelCased.slice(1)) as PascalCase<Input>;\n};\n","import * as React from \"react\";\nimport { useEffect, useMemo } from \"react\";\nimport * as prismicT from \"@prismicio/types\";\nimport type { PascalCase } from \"type-fest\";\n\nimport { __PRODUCTION__ } from \"./lib/__PRODUCTION__\";\nimport { pascalCase } from \"./lib/pascalCase\";\n\n/**\n * The minimum required properties to represent a Prismic Slice for the\n * `<SliceZone>` component.\n *\n * If using Prismic's REST API, use the `Slice` export from `@prismicio/types`\n * for a full interface.\n *\n * @typeParam SliceType - Type name of the Slice.\n */\nexport type SliceLike<SliceType extends string = string> = Pick<\n\tprismicT.Slice<SliceType>,\n\t\"slice_type\"\n>;\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/types` using `SliceLike`.\n *\n * If using Prismic's REST API, use the `SliceZone` export from\n * `@prismicio/types` for the full type.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n */\nexport type SliceZoneLike<TSlice extends SliceLike> = readonly TSlice[];\n\n/**\n * React props for a component rendering content from a Prismic Slice using the\n * `<SliceZone>` component.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `<SliceZone>` and made\n * available to all Slice components.\n */\nexport type SliceComponentProps<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = {\n\t/**\n\t * Slice data for this component.\n\t */\n\tslice: TSlice;\n\n\t/**\n\t * The index of the Slice in the Slice Zone.\n\t */\n\tindex: number;\n\n\t/**\n\t * All Slices from the Slice Zone to which the Slice belongs.\n\t */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<SliceLike>;\n\n\t/**\n\t * Arbitrary data passed to `<SliceZone>` and made available to all Slice components.\n\t */\n\tcontext: TContext;\n};\n\n/**\n * A React component to be rendered for each instance of its Slice.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceComponentType<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = React.ComponentType<SliceComponentProps<TSlice, TContext>>;\n\n/**\n * A record of Slice types mapped to a React component. The component will be\n * rendered for each instance of its Slice.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceZoneComponents<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> =\n\t// This is purposely not wrapped in Partial to ensure a component is provided\n\t// for all Slice types. <SliceZone> will render a default component if one is\n\t// not provided, but it *should* be a type error if an explicit component is\n\t// missing.\n\t//\n\t// If a developer purposely does not want to provide a component, they can\n\t// assign it to the TODOSliceComponent exported from this package. This\n\t// signals to future developers that it is a placeholder and should be\n\t// implemented.\n\t{\n\t\t[SliceType in keyof Record<\n\t\t\tTSlice[\"slice_type\"],\n\t\t\tnever\n\t\t>]: SliceComponentType<\n\t\t\tExtract<TSlice, SliceLike<SliceType>> extends never\n\t\t\t\t? SliceLike\n\t\t\t\t: Extract<TSlice, SliceLike<SliceType>>,\n\t\t\tTContext\n\t\t>;\n\t};\n\n/**\n * This Slice component can be used as a reminder to provide a proper implementation.\n *\n * This is also the default React component rendered when a component mapping\n * cannot be found in `<SliceZone>`.\n */\nexport const TODOSliceComponent = __PRODUCTION__\n\t? () => null\n\t: <TSlice extends SliceLike, TContext>({\n\t\t\tslice,\n\t }: SliceComponentProps<TSlice, TContext>): JSX.Element | null => {\n\t\t\tuseEffect(() => {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[SliceZone] Could not find a component for Slice type \"${slice.slice_type}\"`,\n\t\t\t\t\tslice,\n\t\t\t\t);\n\t\t\t}, [slice]);\n\n\t\t\treturn (\n\t\t\t\t<section\n\t\t\t\t\tdata-slice-zone-todo-component=\"\"\n\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t>\n\t\t\t\t\tCould not find a component for Slice type “{slice.slice_type}\n\t\t\t\t\t”\n\t\t\t\t</section>\n\t\t\t);\n\t };\n\n/**\n * Arguments for a `<SliceZone>` `resolver` function.\n */\ntype SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {\n\t/**\n\t * The Slice to resolve to a React component.\n\t */\n\tslice: TSlice;\n\n\t/**\n\t * The name of the Slice.\n\t */\n\tsliceName: PascalCase<TSlice[\"slice_type\"]>;\n\n\t/**\n\t * The index of the Slice in the Slice Zone.\n\t */\n\ti: number;\n};\n\n/**\n * A function that determines the rendered React component for each Slice in the\n * Slice Zone. If a nullish value is returned, the component will fallback to\n * the `components` or `defaultComponent` props to determine the rendered component.\n *\n * @deprecated Use the `components` prop instead.\n *\n * @param args - Arguments for the resolver function.\n *\n * @returns The React component to render for a Slice.\n */\nexport type SliceZoneResolver<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = (\n\targs: SliceZoneResolverArgs<TSlice>,\n) => SliceComponentType<TSlice, TContext> | undefined | null;\n\n/**\n * React props for the `<SliceZone>` component.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceZoneProps<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = {\n\t/**\n\t * List of Slice data from the Slice Zone.\n\t */\n\tslices?: SliceZoneLike<TSlice>;\n\n\t/**\n\t * A record mapping Slice types to React components.\n\t */\n\tcomponents?: SliceZoneComponents<TSlice, TContext>;\n\n\t/**\n\t * A function that determines the rendered React component for each Slice in\n\t * the Slice Zone.\n\t *\n\t * @deprecated Use the `components` prop instead.\n\t *\n\t * @param args - Arguments for the resolver function.\n\t *\n\t * @returns The React component to render for a Slice.\n\t */\n\tresolver?: SliceZoneResolver<TSlice, TContext>;\n\n\t/**\n\t * The React component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t */\n\tdefaultComponent?: SliceComponentType<TSlice, TContext>;\n\n\t/**\n\t * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext;\n};\n\n/**\n * Renders content from a Prismic Slice Zone using React components for each\n * type of Slice.\n *\n * If a component is not provided for a type of Slice, a default component can\n * be provided. A fallback component is provided by default that will not be\n * rendered in a production build of your app.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n *\n * @returns The Slice Zone's content as React components.\n *\n * @see Learn about Prismic Slices and Slice Zones {@link https://prismic.io/docs/core-concepts/slices}\n */\nexport const SliceZone = <TSlice extends SliceLike, TContext>({\n\tslices = [],\n\tcomponents = {} as SliceZoneComponents<TSlice, TContext>,\n\tresolver,\n\tdefaultComponent = TODOSliceComponent,\n\tcontext = {} as TContext,\n}: SliceZoneProps<TSlice, TContext>): JSX.Element => {\n\tconst renderedSlices = useMemo(() => {\n\t\treturn slices.map((slice, index) => {\n\t\t\tlet Comp = (components[slice.slice_type as keyof typeof components] ||\n\t\t\t\tdefaultComponent) as SliceComponentType<TSlice, TContext>;\n\n\t\t\t// TODO: Remove `resolver` in v3 in favor of `components`.\n\t\t\tif (resolver) {\n\t\t\t\tconst resolvedComp = resolver({\n\t\t\t\t\tslice,\n\t\t\t\t\tsliceName: pascalCase(slice.slice_type),\n\t\t\t\t\ti: index,\n\t\t\t\t});\n\n\t\t\t\tif (resolvedComp) {\n\t\t\t\t\tComp = resolvedComp;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst key = `${index}-${JSON.stringify(slice)}`;\n\n\t\t\treturn (\n\t\t\t\t<Comp\n\t\t\t\t\tkey={key}\n\t\t\t\t\tslice={slice}\n\t\t\t\t\tindex={index}\n\t\t\t\t\tslices={slices}\n\t\t\t\t\tcontext={context}\n\t\t\t\t/>\n\t\t\t);\n\t\t});\n\t}, [components, context, defaultComponent, slices, resolver]);\n\n\treturn <>{renderedSlices}</>;\n};\n","import { useEffect } from \"react\";\n\n/**\n * Props for `<PrismicToolbar>`.\n */\nexport type PrismicToolbarProps = {\n\t/**\n\t * The name of the Prismic repository. For example, `\"my-repo\"` if the\n\t * repository URL is `my-repo.prismic.io`.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The type of toolbar needed for the repository. Defaults to `\"new\"`.\n\t *\n\t * @see To check which version you need, view the Prismic Toolbar documentation {@link https://prismic.io/docs/technologies/previews-and-the-prismic-toolbar-reactjs}\n\t */\n\ttype?: \"new\" | \"legacy\";\n};\n\n/**\n * React component that injects the Prismic Toolbar into the app. This component\n * can be placed anywhere in the React tree.\n */\nexport const PrismicToolbar = ({\n\trepositoryName,\n\ttype = \"new\",\n}: PrismicToolbarProps): null => {\n\tconst src = `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${\n\t\ttype === \"new\" ? \"&new=true\" : \"\"\n\t}`;\n\n\tuseEffect(() => {\n\t\tconst existingScript = document.querySelector(`script[src=\"${src}\"]`);\n\n\t\tif (!existingScript) {\n\t\t\tconst script = document.createElement(\"script\");\n\t\t\tscript.src = src;\n\t\t\tscript.defer = true;\n\n\t\t\t// Used to distinguish the toolbar element from other elements.\n\t\t\tscript.dataset.prismicToolbar = \"\";\n\t\t\tscript.dataset.repositoryName = repositoryName;\n\t\t\tscript.dataset.type = type;\n\n\t\t\tdocument.body.appendChild(script);\n\t\t}\n\t}, [repositoryName, type, src]);\n\n\treturn null;\n};\n","import type * as prismic from \"@prismicio/client\";\n\nimport { useEffect, useMemo, useReducer } from \"react\";\n\nimport { PrismicClientHookState } from \"./types\";\nimport { usePrismicClient } from \"./usePrismicClient\";\n\ntype StateMachineState<TData> = {\n\tstate: PrismicClientHookState;\n\tdata?: TData;\n\terror?: Error;\n};\n\ntype StateMachineAction<TData> =\n\t| [type: \"start\"]\n\t| [type: \"succeed\", payload: TData]\n\t| [type: \"fail\", payload: Error];\n\nconst reducer = <TData>(\n\tstate: StateMachineState<TData>,\n\taction: StateMachineAction<TData>,\n): StateMachineState<TData> => {\n\tswitch (action[0]) {\n\t\tcase \"start\": {\n\t\t\treturn { state: \"loading\" };\n\t\t}\n\n\t\tcase \"succeed\": {\n\t\t\treturn { state: \"loaded\", data: action[1] };\n\t\t}\n\n\t\tcase \"fail\": {\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tstate: \"failed\",\n\t\t\t\terror: action[1],\n\t\t\t};\n\t\t}\n\t}\n};\n\nconst initialState: StateMachineState<never> = {\n\tstate: \"idle\",\n};\n\ntype UnwrapPromise<T> = T extends Promise<infer U> ? U : T;\n\ntype ClientPrototype = typeof prismic.Client.prototype;\n\ntype ClientMethod<MethodName extends keyof ClientPrototype> =\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tClientPrototype[MethodName] extends (...args: any[]) => any\n\t\t? ClientPrototype[MethodName]\n\t\t: never;\n\ntype ClientMethodName = keyof {\n\t[P in keyof prismic.Client as prismic.Client[P] extends (\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t...args: any[]\n\t) => // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tPromise<any>\n\t\t? P\n\t\t: never]: unknown;\n};\n\nexport type ClientMethodParameters<MethodName extends keyof ClientPrototype> =\n\tParameters<ClientMethod<MethodName>>;\n\nexport type HookOnlyParameters = {\n\tclient?: prismic.Client;\n\tskip?: boolean;\n};\n\n/**\n * Determines if a value is a `@prismicio/client` params object.\n *\n * @param value - The value to check.\n *\n * @returns `true` if `value` is a `@prismicio/client` params object, `false` otherwise.\n */\nconst isParams = (\n\tvalue: unknown,\n): value is ClientMethodParameters<\"get\">[0] & HookOnlyParameters => {\n\t// This is a *very* naive check.\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n};\n\n/**\n * The return value of a `@prismicio/client` React hook.\n *\n * @typeParam TData - Data returned by the client.\n */\nexport type ClientHookReturnType<TData = unknown> = [\n\t/**\n\t * Data returned by the client.\n\t */\n\tdata: TData | undefined,\n\n\t/**\n\t * The current state of the hook's client method call.\n\t */\n\tstate: Pick<StateMachineState<TData>, \"state\" | \"error\">,\n];\n\n/**\n * Creates a React hook that forwards arguments to a specific method of a\n * `@prismicio/client` instance. The created hook has its own internal state\n * manager to report async status, such as pending or error statuses.\n *\n * @param methodName - The `@prismicio/client` method to which hook arguments\n * will be forwarded.\n *\n * @returns A new React hook configured for the provided method.\n *\n * @internal\n */\nexport const useStatefulPrismicClientMethod = <\n\tTMethodName extends ClientMethodName,\n\tTArgs extends Parameters<ClientMethod<TMethodName>>,\n\tTData extends UnwrapPromise<ReturnType<ClientMethod<TMethodName>>>,\n>(\n\tmethodName: TMethodName,\n\targs: TArgs,\n\texplicitClient?: prismic.Client,\n): ClientHookReturnType<TData> => {\n\tconst lastArg = args[args.length - 1];\n\tconst {\n\t\tclient: lastArgExplicitClient,\n\t\tskip,\n\t\t...params\n\t} = isParams(lastArg) ? lastArg : ({} as HookOnlyParameters);\n\tconst argsWithoutParams = isParams(lastArg) ? args.slice(0, -1) : args;\n\n\tconst client = usePrismicClient(explicitClient || lastArgExplicitClient);\n\n\tconst [state, dispatch] = useReducer<\n\t\tReact.Reducer<StateMachineState<TData>, StateMachineAction<TData>>\n\t>(reducer, initialState);\n\n\tuseEffect(\n\t\t() => {\n\t\t\t// Used to prevent dispatching an action if the hook was cleaned up.\n\t\t\tlet didCancel = false;\n\n\t\t\tif (!skip) {\n\t\t\t\tif (!didCancel) {\n\t\t\t\t\tdispatch([\"start\"]);\n\t\t\t\t}\n\n\t\t\t\tclient[methodName]\n\t\t\t\t\t.call(\n\t\t\t\t\t\tclient,\n\t\t\t\t\t\t// @ts-expect-error - Merging method arg types is too complex\n\t\t\t\t\t\t...argsWithoutParams,\n\t\t\t\t\t\tparams,\n\t\t\t\t\t)\n\t\t\t\t\t.then((result) => {\n\t\t\t\t\t\tif (!didCancel) {\n\t\t\t\t\t\t\tdispatch([\"succeed\", result as TData]);\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tif (!didCancel) {\n\t\t\t\t\t\t\tdispatch([\"fail\", error]);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Ensure we don't dispatch an action if the hook is cleaned up.\n\t\t\t() => {\n\t\t\t\tdidCancel = true;\n\t\t\t};\n\t\t},\n\t\t// We must disable exhaustive-deps since we are using\n\t\t// JSON.stringify on params (effectively a deep equality check).\n\t\t// We want this effect to run again anytime params change.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[\n\t\t\tclient,\n\t\t\tmethodName,\n\t\t\tskip,\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t\tJSON.stringify(argsWithoutParams),\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t\tJSON.stringify(params),\n\t\t],\n\t);\n\n\treturn useMemo(\n\t\t() => [\n\t\t\tstate.data,\n\t\t\t{\n\t\t\t\tstate: state.state,\n\t\t\t\terror: state.error,\n\t\t\t},\n\t\t],\n\t\t[state],\n\t);\n};\n","import type * as prismic from \"@prismicio/client\";\n\nimport { useEffect } from \"react\";\n\nimport { usePrismicContext } from \"./usePrismicContext\";\nimport {\n\tClientHookReturnType,\n\tuseStatefulPrismicClientMethod,\n} from \"./useStatefulPrismicClientMethod\";\n\nexport type UsePrismicPreviewResolverArgs = {\n\t/**\n\t * An optional `@prismicio/client` instance to override the Client provided to\n\t * `<PrismicProvider>`\n\t */\n\tclient?: prismic.Client;\n\n\t/**\n\t * A function that maps a Prismic document to a URL within your app.\n\t */\n\tlinkResolver?: Parameters<\n\t\tprismic.Client[\"resolvePreviewURL\"]\n\t>[0][\"linkResolver\"];\n\n\t/**\n\t * A fallback URL if the Link Resolver does not return a value.\n\t */\n\tdefaultURL?: Parameters<prismic.Client[\"resolvePreviewURL\"]>[0][\"defaultURL\"];\n\n\t/**\n\t * The preview token (also known as a ref) that will be used to query preview\n\t * content from the Prismic repository.\n\t */\n\tpreviewToken?: Parameters<\n\t\tprismic.Client[\"resolvePreviewURL\"]\n\t>[0][\"previewToken\"];\n\n\t/**\n\t * The previewed document that will be used to determine the destination URL.\n\t */\n\tdocumentID?: Parameters<prismic.Client[\"resolvePreviewURL\"]>[0][\"documentID\"];\n\n\t/**\n\t * A function to automatically navigate to the resolved URL. If a function is\n\t * not provded, `usePreviewResolver` will not navigate to the URL.\n\t *\n\t * @param url - The resolved preview URL.\n\t */\n\tnavigate?: (url: string) => unknown;\n};\n\n/**\n * Resolve a preview session's URL. The resolved URL can be used to redirect to\n * the previewed document.\n *\n * If a `navigate` function is provided, the hook will automatically navigate to\n * the previewed document's URL.\n *\n * @param args - Arguments to configure how a URL is resolved.\n *\n * @returns A tuple containing the resolved URL and the hook's state.\n */\nexport const usePrismicPreviewResolver = (\n\targs: UsePrismicPreviewResolverArgs = {},\n): ClientHookReturnType<string> => {\n\tconst context = usePrismicContext();\n\n\tconst linkResolver = args.linkResolver || context.linkResolver;\n\n\tconst result = useStatefulPrismicClientMethod(\n\t\t\"resolvePreviewURL\",\n\t\t[\n\t\t\t{\n\t\t\t\tlinkResolver,\n\t\t\t\tdefaultURL: args.defaultURL || \"/\",\n\t\t\t\tpreviewToken: args.previewToken,\n\t\t\t\tdocumentID: args.documentID,\n\t\t\t},\n\t\t],\n\t\targs.client,\n\t);\n\n\tconst [resolvedURL] = result;\n\tconst { navigate } = args;\n\n\tuseEffect(() => {\n\t\tif (resolvedURL && navigate) {\n\t\t\tnavigate(resolvedURL);\n\t\t}\n\t}, [resolvedURL, navigate]);\n\n\treturn result;\n};\n","import type * as prismicT from \"@prismicio/types\";\n\nimport {\n\tClientHookReturnType,\n\tClientMethodParameters,\n\tHookOnlyParameters,\n\tuseStatefulPrismicClientMethod,\n} from \"./useStatefulPrismicClientMethod\";\n\n/**\n * A hook that queries content from the Prismic repository.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.get}\n */\nexport const usePrismicDocuments = <TDocument extends prismicT.PrismicDocument>(\n\t...args: [params?: ClientMethodParameters<\"get\">[0] & HookOnlyParameters]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"get\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns only the\n * first result, if any.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getFirst}\n */\nexport const useFirstPrismicDocument = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [params?: ClientMethodParameters<\"getFirst\">[0] & HookOnlyParameters]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getFirst\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns all\n * matching content. If no predicates are provided, all documents will be fetched.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAll}\n */\nexport const useAllPrismicDocumentsDangerously = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"dangerouslyGetAll\">[0] &\n\t\t\tHookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"dangerouslyGetAll\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific ID.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param id - ID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByID}\n */\nexport const usePrismicDocumentByID = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByID\">[0],\n\t\tparams?: ClientMethodParameters<\"getByID\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByIDs}\n */\nexport const usePrismicDocumentsByIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getAllByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByIDs\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific\n * UID and Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uid - UID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentByUID = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUID\">[0],\n\t\tuid: ClientMethodParameters<\"getByUID\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUID\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByUID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific UIDs\n * of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentsByUIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByUIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * UIDs of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const useAllPrismicDocumentsByUIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByUIDs\", args);\n\n/**\n * A hook that queries a singleton document from the Prismic repository for a\n * specific Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the singleton Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getSingle}\n */\nexport const useSinglePrismicDocument = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getSingle\">[0],\n\t\tparams?: ClientMethodParameters<\"getSingle\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getSingle\", args);\n\n/**\n * A hook that queries documents from the Prismic repository for a specific Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByType}\n */\nexport const usePrismicDocumentsByType = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByType\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository for a specific\n * Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByType}\n */\nexport const useAllPrismicDocumentsByType = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByType\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with a specific tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTag}\n */\nexport const usePrismicDocumentsByTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with a specific tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTag}\n */\nexport const useAllPrismicDocumentsByTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByTag\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with at least one of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsBySomeTags = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getBySomeTags\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with at least one of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsBySomeTags = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllBySomeTags\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsByEveryTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByEveryTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at `params.client`.\n *\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsByEveryTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByEveryTag\", args);\n","export { PrismicProvider } from \"./PrismicProvider\";\nexport type {\n\tPrismicProviderProps,\n\tPrismicContextValue,\n} from \"./PrismicProvider\";\n\nexport { usePrismicContext } from \"./usePrismicContext\";\n\nexport { usePrismicClient } from \"./usePrismicClient\";\n\nexport { PrismicLink } from \"./PrismicLink\";\nexport type { PrismicLinkProps, LinkProps } from \"./PrismicLink\";\n\nexport { PrismicText } from \"./PrismicText\";\nexport type { PrismicTextProps } from \"./PrismicText\";\n\nexport { PrismicRichText } from \"./PrismicRichText\";\nexport type { PrismicRichTextProps } from \"./PrismicRichText\";\n\nimport { Element } from \"@prismicio/richtext\";\nexport { Element };\n/**\n * @deprecated Renamed to `Element` (without an \"s\").\n */\n// TODO: Remove in v3.\nexport const Elements = Element;\n\nexport { SliceZone, TODOSliceComponent } from \"./SliceZone\";\nexport type {\n\tSliceComponentProps,\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n\tSliceZoneProps,\n\tSliceZoneResolver,\n} from \"./SliceZone\";\n\nexport { PrismicToolbar } from \"./PrismicToolbar\";\nexport type { PrismicToolbarProps } from \"./PrismicToolbar\";\n\nexport { usePrismicPreviewResolver } from \"./usePrismicPreviewResolver\";\nexport type { UsePrismicPreviewResolverArgs } from \"./usePrismicPreviewResolver\";\n\nexport {\n\tuseAllPrismicDocumentsDangerously,\n\tuseAllPrismicDocumentsByEveryTag,\n\tuseAllPrismicDocumentsByIDs,\n\tuseAllPrismicDocumentsBySomeTags,\n\tuseAllPrismicDocumentsByTag,\n\tuseAllPrismicDocumentsByType,\n\tuseAllPrismicDocumentsByUIDs,\n\tuseFirstPrismicDocument,\n\tusePrismicDocumentByID,\n\tusePrismicDocumentByUID,\n\tusePrismicDocuments,\n\tusePrismicDocumentsByEveryTag,\n\tusePrismicDocumentsByIDs,\n\tusePrismicDocumentsBySomeTags,\n\tusePrismicDocumentsByTag,\n\tusePrismicDocumentsByType,\n\tusePrismicDocumentsByUIDs,\n\tuseSinglePrismicDocument,\n} from \"./clientHooks\";\n\nexport type {\n\tJSXMapSerializer,\n\tJSXFunctionSerializer,\n\tPrismicClientHookState,\n} from \"./types\";\n"],"names":["createContext","useMemo","useContext","prismicH","prismicR","Fragment","useReducer","Element"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+Ea,iBAAiBA,oBAAmC;MAapD,kBAAkB,CAAC;AAAA,EAC/B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AKH,+BAA+B,aAAa;MAkBhC,+BAA+B,IAGxC,SAKH,+BAA+B,gBAAgB;MAiBnC,2BAA2B,IAGpC,SAKH,+BAA+B,YAAY;MAiB/B,8BAA8B,IAGvC,SAKH,+BAA+B,eAAe;MAkBlC,gCAAgC,IAGzC,SAKH,+BAA+B,iBAAiB;MAkBpC,mCAAmC,IAG5C,SAKH,+BAA+B,oBAAoB;MAkBvC,gCAAgC,IAGzC,SAKH,+BAA+B,iBAAiB;MAkBpC,mCAAmC,IAG5C,SAKH,+BAA+B,oBAAoB;;MCtbvC,WAAWM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { createContext, useMemo, useContext, Fragment, useEffect, useReducer } from 'react';
|
|
2
3
|
import * as prismicH from '@prismicio/helpers';
|
|
3
4
|
import * as prismicR from '@prismicio/richtext';
|
|
4
5
|
import { Element } from '@prismicio/richtext';
|
|
5
6
|
export { Element } from '@prismicio/richtext';
|
|
6
|
-
import { pascalCase } from 'tiny-case';
|
|
7
7
|
|
|
8
|
-
const PrismicContext =
|
|
8
|
+
const PrismicContext = createContext({});
|
|
9
9
|
const PrismicProvider = ({
|
|
10
10
|
client,
|
|
11
11
|
linkResolver,
|
|
@@ -14,7 +14,7 @@ const PrismicProvider = ({
|
|
|
14
14
|
externalLinkComponent,
|
|
15
15
|
children
|
|
16
16
|
}) => {
|
|
17
|
-
const value =
|
|
17
|
+
const value = useMemo(() => ({
|
|
18
18
|
client,
|
|
19
19
|
linkResolver,
|
|
20
20
|
richTextComponents,
|
|
@@ -33,7 +33,7 @@ const PrismicProvider = ({
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const usePrismicContext = () => {
|
|
36
|
-
return
|
|
36
|
+
return useContext(PrismicContext) || {};
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
if (typeof process === "undefined") {
|
|
@@ -106,7 +106,7 @@ const PrismicLink = (props) => {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
const PrismicText = (props) => {
|
|
109
|
-
return
|
|
109
|
+
return useMemo(() => {
|
|
110
110
|
if (props.field) {
|
|
111
111
|
const text = prismicH.asText(props.field, props.separator);
|
|
112
112
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, text);
|
|
@@ -206,19 +206,19 @@ const createDefaultSerializer = (args) => prismicR.wrapMapSerializer({
|
|
|
206
206
|
key: `${i}__break`
|
|
207
207
|
}));
|
|
208
208
|
}
|
|
209
|
-
result.push(/* @__PURE__ */ React.createElement(
|
|
209
|
+
result.push(/* @__PURE__ */ React.createElement(Fragment, {
|
|
210
210
|
key: `${i}__line`
|
|
211
211
|
}, line));
|
|
212
212
|
i++;
|
|
213
213
|
}
|
|
214
|
-
return /* @__PURE__ */ React.createElement(
|
|
214
|
+
return /* @__PURE__ */ React.createElement(Fragment, {
|
|
215
215
|
key
|
|
216
216
|
}, result);
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
const PrismicRichText = (props) => {
|
|
220
220
|
const context = usePrismicContext();
|
|
221
|
-
return
|
|
221
|
+
return useMemo(() => {
|
|
222
222
|
if (!props.field) {
|
|
223
223
|
return null;
|
|
224
224
|
} else {
|
|
@@ -243,10 +243,17 @@ const PrismicRichText = (props) => {
|
|
|
243
243
|
]);
|
|
244
244
|
};
|
|
245
245
|
|
|
246
|
+
const pascalCase = (input) => {
|
|
247
|
+
const camelCased = input.replace(/(?:-|_)(\w)/g, (_, c) => {
|
|
248
|
+
return c ? c.toUpperCase() : "";
|
|
249
|
+
});
|
|
250
|
+
return camelCased[0].toUpperCase() + camelCased.slice(1);
|
|
251
|
+
};
|
|
252
|
+
|
|
246
253
|
const TODOSliceComponent = __PRODUCTION__ ? () => null : ({
|
|
247
254
|
slice
|
|
248
255
|
}) => {
|
|
249
|
-
|
|
256
|
+
useEffect(() => {
|
|
250
257
|
console.warn(`[SliceZone] Could not find a component for Slice type "${slice.slice_type}"`, slice);
|
|
251
258
|
}, [slice]);
|
|
252
259
|
return /* @__PURE__ */ React.createElement("section", {
|
|
@@ -261,7 +268,7 @@ const SliceZone = ({
|
|
|
261
268
|
defaultComponent = TODOSliceComponent,
|
|
262
269
|
context = {}
|
|
263
270
|
}) => {
|
|
264
|
-
const renderedSlices =
|
|
271
|
+
const renderedSlices = useMemo(() => {
|
|
265
272
|
return slices.map((slice, index) => {
|
|
266
273
|
let Comp = components[slice.slice_type] || defaultComponent;
|
|
267
274
|
if (resolver) {
|
|
@@ -292,7 +299,7 @@ const PrismicToolbar = ({
|
|
|
292
299
|
type = "new"
|
|
293
300
|
}) => {
|
|
294
301
|
const src = `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${type === "new" ? "&new=true" : ""}`;
|
|
295
|
-
|
|
302
|
+
useEffect(() => {
|
|
296
303
|
const existingScript = document.querySelector(`script[src="${src}"]`);
|
|
297
304
|
if (!existingScript) {
|
|
298
305
|
const script = document.createElement("script");
|
|
@@ -303,7 +310,7 @@ const PrismicToolbar = ({
|
|
|
303
310
|
script.dataset.type = type;
|
|
304
311
|
document.body.appendChild(script);
|
|
305
312
|
}
|
|
306
|
-
}, [repositoryName, type]);
|
|
313
|
+
}, [repositoryName, type, src]);
|
|
307
314
|
return null;
|
|
308
315
|
};
|
|
309
316
|
|
|
@@ -339,8 +346,8 @@ const useStatefulPrismicClientMethod = (methodName, args, explicitClient) => {
|
|
|
339
346
|
} = isParams(lastArg) ? lastArg : {};
|
|
340
347
|
const argsWithoutParams = isParams(lastArg) ? args.slice(0, -1) : args;
|
|
341
348
|
const client = usePrismicClient(explicitClient || lastArgExplicitClient);
|
|
342
|
-
const [state, dispatch] =
|
|
343
|
-
|
|
349
|
+
const [state, dispatch] = useReducer(reducer, initialState);
|
|
350
|
+
useEffect(() => {
|
|
344
351
|
if (!skip) {
|
|
345
352
|
{
|
|
346
353
|
dispatch(["start"]);
|
|
@@ -362,7 +369,7 @@ const useStatefulPrismicClientMethod = (methodName, args, explicitClient) => {
|
|
|
362
369
|
JSON.stringify(argsWithoutParams),
|
|
363
370
|
JSON.stringify(params)
|
|
364
371
|
]);
|
|
365
|
-
return
|
|
372
|
+
return useMemo(() => [
|
|
366
373
|
state.data,
|
|
367
374
|
{
|
|
368
375
|
state: state.state,
|
|
@@ -384,7 +391,7 @@ const usePrismicPreviewResolver = (args = {}) => {
|
|
|
384
391
|
], args.client);
|
|
385
392
|
const [resolvedURL] = result;
|
|
386
393
|
const { navigate } = args;
|
|
387
|
-
|
|
394
|
+
useEffect(() => {
|
|
388
395
|
if (resolvedURL && navigate) {
|
|
389
396
|
navigate(resolvedURL);
|
|
390
397
|
}
|