@prismicio/next 1.1.0-alpha.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/PrismicNextLink.d.ts +3 -3
  2. package/dist/PrismicPreview.cjs +5 -74
  3. package/dist/PrismicPreview.cjs.map +1 -1
  4. package/dist/PrismicPreview.d.ts +8 -11
  5. package/dist/PrismicPreview.js +5 -57
  6. package/dist/PrismicPreview.js.map +1 -1
  7. package/dist/PrismicPreviewClient.cjs +85 -0
  8. package/dist/PrismicPreviewClient.cjs.map +1 -0
  9. package/dist/PrismicPreviewClient.d.ts +4 -0
  10. package/dist/PrismicPreviewClient.js +85 -0
  11. package/dist/PrismicPreviewClient.js.map +1 -0
  12. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs +19 -0
  13. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs.map +1 -0
  14. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js +19 -0
  15. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js.map +1 -0
  16. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs +13 -0
  17. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs.map +1 -0
  18. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js +13 -0
  19. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js.map +1 -0
  20. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs +7 -0
  21. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs.map +1 -0
  22. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js +7 -0
  23. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js.map +1 -0
  24. package/dist/enableAutoPreviews.cjs +17 -6
  25. package/dist/enableAutoPreviews.cjs.map +1 -1
  26. package/dist/enableAutoPreviews.d.ts +11 -12
  27. package/dist/enableAutoPreviews.js +17 -6
  28. package/dist/enableAutoPreviews.js.map +1 -1
  29. package/dist/exitPreview.cjs +1 -1
  30. package/dist/exitPreview.cjs.map +1 -1
  31. package/dist/exitPreview.d.ts +11 -16
  32. package/dist/exitPreview.js +1 -1
  33. package/dist/exitPreview.js.map +1 -1
  34. package/dist/package.json.cjs +1 -1
  35. package/dist/package.json.js +1 -1
  36. package/dist/redirectToPreviewURL.cjs +13 -12
  37. package/dist/redirectToPreviewURL.cjs.map +1 -1
  38. package/dist/redirectToPreviewURL.d.ts +23 -21
  39. package/dist/redirectToPreviewURL.js +13 -12
  40. package/dist/redirectToPreviewURL.js.map +1 -1
  41. package/dist/setPreviewData.cjs.map +1 -1
  42. package/dist/setPreviewData.d.ts +9 -14
  43. package/dist/setPreviewData.js.map +1 -1
  44. package/dist/types.d.ts +52 -9
  45. package/package.json +5 -10
  46. package/src/PrismicPreview.tsx +13 -131
  47. package/src/PrismicPreviewClient.tsx +159 -0
  48. package/src/enableAutoPreviews.ts +73 -45
  49. package/src/exitPreview.ts +14 -26
  50. package/src/redirectToPreviewURL.ts +58 -64
  51. package/src/setPreviewData.ts +10 -14
  52. package/src/types.ts +58 -9
  53. package/dist/react-server/PrismicPreview.d.ts +0 -22
  54. package/dist/react-server/index.d.ts +0 -2
  55. package/dist/react-server/unsupported.cjs +0 -26
  56. package/dist/react-server/unsupported.cjs.map +0 -1
  57. package/dist/react-server/unsupported.d.ts +0 -6
  58. package/dist/react-server/unsupported.js +0 -26
  59. package/dist/react-server/unsupported.js.map +0 -1
  60. package/dist/react-server.cjs +0 -15
  61. package/dist/react-server.cjs.map +0 -1
  62. package/dist/react-server.js +0 -15
  63. package/dist/react-server.js.map +0 -1
  64. package/src/react-server/PrismicPreview.tsx +0 -74
  65. package/src/react-server/index.ts +0 -11
  66. package/src/react-server/unsupported.ts +0 -26
@@ -53,7 +53,7 @@ export declare const PrismicNextLink: React.ForwardRefExoticComponent<(Pick<Omit
53
53
  field: prismic.LinkField | null | undefined;
54
54
  document?: undefined;
55
55
  href?: undefined;
56
- }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver"> | Pick<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
56
+ }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "tw" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver"> | Pick<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
57
57
  href: string | import("url").UrlObject;
58
58
  as?: (string | import("url").UrlObject) | undefined;
59
59
  replace?: boolean | undefined;
@@ -88,7 +88,7 @@ export declare const PrismicNextLink: React.ForwardRefExoticComponent<(Pick<Omit
88
88
  field?: undefined;
89
89
  document: prismic.PrismicDocument | null | undefined;
90
90
  href?: undefined;
91
- }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver"> | Pick<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
91
+ }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "tw" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver"> | Pick<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
92
92
  href: string | import("url").UrlObject;
93
93
  as?: (string | import("url").UrlObject) | undefined;
94
94
  replace?: boolean | undefined;
@@ -123,4 +123,4 @@ export declare const PrismicNextLink: React.ForwardRefExoticComponent<(Pick<Omit
123
123
  field?: undefined;
124
124
  document?: undefined;
125
125
  href: React.ComponentProps<typeof Link>["href"];
126
- }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver">) & React.RefAttributes<HTMLAnchorElement>>;
126
+ }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "tw" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver">) & React.RefAttributes<HTMLAnchorElement>>;
@@ -1,81 +1,12 @@
1
- 'use client';
2
- 'use client';
3
1
  "use strict";
4
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
3
  const jsxRuntime = require("react/jsx-runtime");
6
- const React = require("react");
7
- const router = require("next/router");
8
4
  const Script = require("next/script");
9
- const getPrismicPreviewCookie = require("./lib/getPrismicPreviewCookie.cjs");
10
- const getPreviewCookieRepositoryName = require("./lib/getPreviewCookieRepositoryName.cjs");
11
- function _interopNamespaceDefault(e) {
12
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
13
- if (e) {
14
- for (const k in e) {
15
- if (k !== "default") {
16
- const d = Object.getOwnPropertyDescriptor(e, k);
17
- Object.defineProperty(n, k, d.get ? d : {
18
- enumerable: true,
19
- get: () => e[k]
20
- });
21
- }
22
- }
23
- }
24
- n.default = e;
25
- return Object.freeze(n);
26
- }
27
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
28
- function PrismicPreview({ repositoryName, children, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" }) {
29
- const router$1 = router.useRouter();
30
- const resolvedUpdatePreviewURL = router$1.basePath + updatePreviewURL;
31
- const resolvedExitPreviewURL = router$1.basePath + exitPreviewURL;
32
- React__namespace.useEffect(() => {
33
- const startPreviewMode = async () => {
34
- const res = await globalThis.fetch(resolvedUpdatePreviewURL);
35
- if (res.redirected) {
36
- globalThis.location.reload();
37
- } else {
38
- console.error(`[<PrismicPreview>] Failed to start or update Preview Mode using the "${resolvedUpdatePreviewURL}" API endpoint. Does it exist?`);
39
- }
40
- };
41
- const handlePrismicPreviewUpdate = async (event) => {
42
- event.preventDefault();
43
- await startPreviewMode();
44
- };
45
- const handlePrismicPreviewEnd = async (event) => {
46
- event.preventDefault();
47
- const res = await globalThis.fetch(resolvedExitPreviewURL);
48
- if (res.ok) {
49
- globalThis.location.reload();
50
- } else {
51
- console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${resolvedExitPreviewURL}" API endpoint. Does it exist?`);
52
- }
53
- };
54
- if (router$1.isPreview) {
55
- window.addEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
56
- window.addEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
57
- } else {
58
- const prismicPreviewCookie = getPrismicPreviewCookie.getPrismicPreviewCookie(globalThis.document.cookie);
59
- if (prismicPreviewCookie) {
60
- const locationIsDescendantOfBasePath = window.location.href.startsWith(window.location.origin + router$1.basePath);
61
- const prismicPreviewCookieRepositoryName = getPreviewCookieRepositoryName.getPreviewCookieRepositoryName(prismicPreviewCookie);
62
- if (locationIsDescendantOfBasePath && prismicPreviewCookieRepositoryName === repositoryName) {
63
- startPreviewMode();
64
- }
65
- }
66
- }
67
- return () => {
68
- window.removeEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
69
- window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
70
- };
71
- }, [
72
- repositoryName,
73
- resolvedExitPreviewURL,
74
- resolvedUpdatePreviewURL,
75
- router$1.isPreview,
76
- router$1.basePath
77
- ]);
78
- return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, jsxRuntime.jsx(Script, { src: `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}&new=true`, strategy: "lazyOnload" })] });
5
+ const PrismicPreviewClient = require("./PrismicPreviewClient.cjs");
6
+ const getToolbarSrc = require('./_node_modules/@prismicio/client/dist/getToolbarSrc.cjs');
7
+ function PrismicPreview({ repositoryName, children, ...props }) {
8
+ const toolbarSrc = getToolbarSrc.getToolbarSrc(repositoryName);
9
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, jsxRuntime.jsx(PrismicPreviewClient.PrismicPreviewClient, { repositoryName, ...props }), jsxRuntime.jsx(Script, { src: toolbarSrc, strategy: "lazyOnload" })] });
79
10
  }
80
11
  exports.PrismicPreview = PrismicPreview;
81
12
  //# sourceMappingURL=PrismicPreview.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.cjs","sources":["../../src/PrismicPreview.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { useRouter } from \"next/router\";\nimport Script from \"next/script\";\n\nimport { getPrismicPreviewCookie } from \"./lib/getPrismicPreviewCookie\";\nimport { getPreviewCookieRepositoryName } from \"./lib/getPreviewCookieRepositoryName\";\n\n/**\n * Props for `<PrismicPreview>`.\n */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t *\n\t * **Note**: If your `next.config.js` file contains a `basePath`, it is\n\t * automatically included.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t *\n\t * **Note**: If your `next.config.js` file contains a `basePath`, it is\n\t * automatically included.\n\t */\n\texitPreviewURL?: string;\n\n\t/**\n\t * Children to render adjacent to the Prismic Toolbar. The Prismic Toolbar\n\t * will be rendered last.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically update the Next.js preview\n * cookie and refresh the page.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport function PrismicPreview({\n\trepositoryName,\n\tchildren,\n\tupdatePreviewURL = \"/api/preview\",\n\texitPreviewURL = \"/api/exit-preview\",\n}: PrismicPreviewProps): JSX.Element {\n\tconst router = useRouter();\n\n\tconst resolvedUpdatePreviewURL = router.basePath + updatePreviewURL;\n\tconst resolvedExitPreviewURL = router.basePath + exitPreviewURL;\n\n\tReact.useEffect(() => {\n\t\t/**\n\t\t * Starts Preview Mode and refreshes the page's props.\n\t\t */\n\t\tconst startPreviewMode = async () => {\n\t\t\t// Start Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedUpdatePreviewURL);\n\n\t\t\t// We check for `res.redirected` rather than `res.ok`\n\t\t\t// since the update preview endpoint may redirect to a\n\t\t\t// 404 page. As long as it redirects, we know the\n\t\t\t// endpoint exists and at least attempted to set\n\t\t\t// preview data.\n\t\t\tif (res.redirected) {\n\t\t\t\tglobalThis.location.reload();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to start or update Preview Mode using the \"${resolvedUpdatePreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst handlePrismicPreviewUpdate = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\tawait startPreviewMode();\n\t\t};\n\n\t\tconst handlePrismicPreviewEnd = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\t// Exit Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedExitPreviewURL);\n\n\t\t\tif (res.ok) {\n\t\t\t\tglobalThis.location.reload();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${resolvedExitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tif (router.isPreview) {\n\t\t\t// Register Prismic Toolbar event handlers.\n\t\t\twindow.addEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.addEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t} else {\n\t\t\tconst prismicPreviewCookie = getPrismicPreviewCookie(\n\t\t\t\tglobalThis.document.cookie,\n\t\t\t);\n\n\t\t\tif (prismicPreviewCookie) {\n\t\t\t\t// If a Prismic preview cookie is present, but Next.js Preview\n\t\t\t\t// Mode is not active, we must activate Preview Mode manually.\n\t\t\t\t//\n\t\t\t\t// This will happen when a visitor accesses the page using a\n\t\t\t\t// Prismic preview share link.\n\n\t\t\t\t/**\n\t\t\t\t * Determines if the current location is a descendant of the app's base\n\t\t\t\t * path.\n\t\t\t\t *\n\t\t\t\t * This is used to prevent infinite refrehes; when\n\t\t\t\t * `isDescendantOfBasePath` is `false`, `router.isPreview` is also\n\t\t\t\t * `false`.\n\t\t\t\t *\n\t\t\t\t * If the app does not have a base path, this should always be `true`.\n\t\t\t\t */\n\t\t\t\tconst locationIsDescendantOfBasePath = window.location.href.startsWith(\n\t\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t\t);\n\n\t\t\t\tconst prismicPreviewCookieRepositoryName =\n\t\t\t\t\tgetPreviewCookieRepositoryName(prismicPreviewCookie);\n\n\t\t\t\tif (\n\t\t\t\t\tlocationIsDescendantOfBasePath &&\n\t\t\t\t\tprismicPreviewCookieRepositoryName === repositoryName\n\t\t\t\t) {\n\t\t\t\t\tstartPreviewMode();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// On cleanup, unregister Prismic Toolbar event handlers.\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.removeEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t};\n\t}, [\n\t\trepositoryName,\n\t\tresolvedExitPreviewURL,\n\t\tresolvedUpdatePreviewURL,\n\t\trouter.isPreview,\n\t\trouter.basePath,\n\t]);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script\n\t\t\t\tsrc={`https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}&new=true`}\n\t\t\t\tstrategy=\"lazyOnload\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDgB;AAMf;AAEM;AACA;AAENA;AAIC;AAEC;AAOA;AACC;;AAEQ;AACyH;AAEjI;AAGI;AAEL;AAEA;;AAGK;AAEL;AAGA;AAEA;AACC;;AAEQ;AAC4G;AAEpH;AAGF;AAEQ;AAIA;AAA6D;AAEpE;AAIA;AAiBO;AAIA;AAIL;;;AAIA;AACD;AAIF;AACQ;AAIA;AAAgE;AAAA;AAEtE;AACF;AACA;AACA;AACO;AACA;AAGR;AASD;;"}
1
+ {"version":3,"file":"PrismicPreview.cjs","sources":["../../src/PrismicPreview.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\nimport Script from \"next/script\";\n\nimport { PrismicPreviewClient } from \"./PrismicPreviewClient\";\n\n/**\n * Props for `<PrismicPreview>`.\n */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * **Only used in the Pages Directory (/pages).**\n\t *\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * **Only used in the Pages Directory (/pages).**\n\t *\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t */\n\texitPreviewURL?: string;\n\n\t/**\n\t * Children to render adjacent to the Prismic Toolbar.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically refresh the page with the\n * changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport function PrismicPreview({\n\trepositoryName,\n\tchildren,\n\t...props\n}: PrismicPreviewProps): JSX.Element {\n\tconst toolbarSrc = prismic.getToolbarSrc(repositoryName);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<PrismicPreviewClient repositoryName={repositoryName} {...props} />\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n}\n"],"names":["prismic.getToolbarSrc","_jsxs","_Fragment","_jsx","PrismicPreviewClient"],"mappings":";;;;;;AA+CM,SAAU,eAAe,EAC9B,gBACA,UACA,GAAG,SACkB;AACf,QAAA,aAAaA,4BAAsB,cAAc;AAGtD,SAAAC,WAAA,KACEC,qBAAA,EAAA,UAAA,CAAA,UACDC,eAACC,qBAAAA,sBAAoB,EAAC,gBAA8B,GAAM,MAAK,CAAA,GAC/DD,WAAA,IAAC,QAAM,EAAC,KAAK,YAAY,UAAS,aAAY,CAAA,CAAG,EAAA,CAC/C;AAEL;;"}
@@ -9,34 +9,31 @@ export type PrismicPreviewProps = {
9
9
  */
10
10
  repositoryName: string;
11
11
  /**
12
+ * **Only used in the Pages Directory (/pages).**
13
+ *
12
14
  * The URL of your app's Prismic preview endpoint (default: `/api/preview`).
13
15
  * This URL will be fetched on preview update events.
14
- *
15
- * **Note**: If your `next.config.js` file contains a `basePath`, it is
16
- * automatically included.
17
16
  */
18
17
  updatePreviewURL?: string;
19
18
  /**
19
+ * **Only used in the Pages Directory (/pages).**
20
+ *
20
21
  * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).
21
22
  * This URL will be fetched on preview exit events.
22
- *
23
- * **Note**: If your `next.config.js` file contains a `basePath`, it is
24
- * automatically included.
25
23
  */
26
24
  exitPreviewURL?: string;
27
25
  /**
28
- * Children to render adjacent to the Prismic Toolbar. The Prismic Toolbar
29
- * will be rendered last.
26
+ * Children to render adjacent to the Prismic Toolbar.
30
27
  */
31
28
  children?: React.ReactNode;
32
29
  };
33
30
  /**
34
31
  * React component that sets up Prismic Previews using the Prismic Toolbar. When
35
32
  * the Prismic Toolbar send events to the browser, such as on preview updates
36
- * and exiting, this component will automatically update the Next.js preview
37
- * cookie and refresh the page.
33
+ * and exiting, this component will automatically refresh the page with the
34
+ * changes.
38
35
  *
39
36
  * This component can be wrapped around your app or added anywhere in your app's
40
37
  * tree. It must be rendered on every page.
41
38
  */
42
- export declare function PrismicPreview({ repositoryName, children, updatePreviewURL, exitPreviewURL, }: PrismicPreviewProps): JSX.Element;
39
+ export declare function PrismicPreview({ repositoryName, children, ...props }: PrismicPreviewProps): JSX.Element;
@@ -1,62 +1,10 @@
1
- 'use client';
2
- 'use client';
3
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
4
- import * as React from "react";
5
- import { useRouter } from "next/router";
6
2
  import Script from "next/script";
7
- import { getPrismicPreviewCookie } from "./lib/getPrismicPreviewCookie.js";
8
- import { getPreviewCookieRepositoryName } from "./lib/getPreviewCookieRepositoryName.js";
9
- function PrismicPreview({ repositoryName, children, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" }) {
10
- const router = useRouter();
11
- const resolvedUpdatePreviewURL = router.basePath + updatePreviewURL;
12
- const resolvedExitPreviewURL = router.basePath + exitPreviewURL;
13
- React.useEffect(() => {
14
- const startPreviewMode = async () => {
15
- const res = await globalThis.fetch(resolvedUpdatePreviewURL);
16
- if (res.redirected) {
17
- globalThis.location.reload();
18
- } else {
19
- console.error(`[<PrismicPreview>] Failed to start or update Preview Mode using the "${resolvedUpdatePreviewURL}" API endpoint. Does it exist?`);
20
- }
21
- };
22
- const handlePrismicPreviewUpdate = async (event) => {
23
- event.preventDefault();
24
- await startPreviewMode();
25
- };
26
- const handlePrismicPreviewEnd = async (event) => {
27
- event.preventDefault();
28
- const res = await globalThis.fetch(resolvedExitPreviewURL);
29
- if (res.ok) {
30
- globalThis.location.reload();
31
- } else {
32
- console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${resolvedExitPreviewURL}" API endpoint. Does it exist?`);
33
- }
34
- };
35
- if (router.isPreview) {
36
- window.addEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
37
- window.addEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
38
- } else {
39
- const prismicPreviewCookie = getPrismicPreviewCookie(globalThis.document.cookie);
40
- if (prismicPreviewCookie) {
41
- const locationIsDescendantOfBasePath = window.location.href.startsWith(window.location.origin + router.basePath);
42
- const prismicPreviewCookieRepositoryName = getPreviewCookieRepositoryName(prismicPreviewCookie);
43
- if (locationIsDescendantOfBasePath && prismicPreviewCookieRepositoryName === repositoryName) {
44
- startPreviewMode();
45
- }
46
- }
47
- }
48
- return () => {
49
- window.removeEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
50
- window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
51
- };
52
- }, [
53
- repositoryName,
54
- resolvedExitPreviewURL,
55
- resolvedUpdatePreviewURL,
56
- router.isPreview,
57
- router.basePath
58
- ]);
59
- return jsxs(Fragment, { children: [children, jsx(Script, { src: `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}&new=true`, strategy: "lazyOnload" })] });
3
+ import { PrismicPreviewClient } from "./PrismicPreviewClient.js";
4
+ import { getToolbarSrc } from './_node_modules/@prismicio/client/dist/getToolbarSrc.js';
5
+ function PrismicPreview({ repositoryName, children, ...props }) {
6
+ const toolbarSrc = getToolbarSrc(repositoryName);
7
+ return jsxs(Fragment, { children: [children, jsx(PrismicPreviewClient, { repositoryName, ...props }), jsx(Script, { src: toolbarSrc, strategy: "lazyOnload" })] });
60
8
  }
61
9
  export {
62
10
  PrismicPreview
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.js","sources":["../../src/PrismicPreview.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { useRouter } from \"next/router\";\nimport Script from \"next/script\";\n\nimport { getPrismicPreviewCookie } from \"./lib/getPrismicPreviewCookie\";\nimport { getPreviewCookieRepositoryName } from \"./lib/getPreviewCookieRepositoryName\";\n\n/**\n * Props for `<PrismicPreview>`.\n */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t *\n\t * **Note**: If your `next.config.js` file contains a `basePath`, it is\n\t * automatically included.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t *\n\t * **Note**: If your `next.config.js` file contains a `basePath`, it is\n\t * automatically included.\n\t */\n\texitPreviewURL?: string;\n\n\t/**\n\t * Children to render adjacent to the Prismic Toolbar. The Prismic Toolbar\n\t * will be rendered last.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically update the Next.js preview\n * cookie and refresh the page.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport function PrismicPreview({\n\trepositoryName,\n\tchildren,\n\tupdatePreviewURL = \"/api/preview\",\n\texitPreviewURL = \"/api/exit-preview\",\n}: PrismicPreviewProps): JSX.Element {\n\tconst router = useRouter();\n\n\tconst resolvedUpdatePreviewURL = router.basePath + updatePreviewURL;\n\tconst resolvedExitPreviewURL = router.basePath + exitPreviewURL;\n\n\tReact.useEffect(() => {\n\t\t/**\n\t\t * Starts Preview Mode and refreshes the page's props.\n\t\t */\n\t\tconst startPreviewMode = async () => {\n\t\t\t// Start Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedUpdatePreviewURL);\n\n\t\t\t// We check for `res.redirected` rather than `res.ok`\n\t\t\t// since the update preview endpoint may redirect to a\n\t\t\t// 404 page. As long as it redirects, we know the\n\t\t\t// endpoint exists and at least attempted to set\n\t\t\t// preview data.\n\t\t\tif (res.redirected) {\n\t\t\t\tglobalThis.location.reload();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to start or update Preview Mode using the \"${resolvedUpdatePreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst handlePrismicPreviewUpdate = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\tawait startPreviewMode();\n\t\t};\n\n\t\tconst handlePrismicPreviewEnd = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\t// Exit Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedExitPreviewURL);\n\n\t\t\tif (res.ok) {\n\t\t\t\tglobalThis.location.reload();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${resolvedExitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tif (router.isPreview) {\n\t\t\t// Register Prismic Toolbar event handlers.\n\t\t\twindow.addEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.addEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t} else {\n\t\t\tconst prismicPreviewCookie = getPrismicPreviewCookie(\n\t\t\t\tglobalThis.document.cookie,\n\t\t\t);\n\n\t\t\tif (prismicPreviewCookie) {\n\t\t\t\t// If a Prismic preview cookie is present, but Next.js Preview\n\t\t\t\t// Mode is not active, we must activate Preview Mode manually.\n\t\t\t\t//\n\t\t\t\t// This will happen when a visitor accesses the page using a\n\t\t\t\t// Prismic preview share link.\n\n\t\t\t\t/**\n\t\t\t\t * Determines if the current location is a descendant of the app's base\n\t\t\t\t * path.\n\t\t\t\t *\n\t\t\t\t * This is used to prevent infinite refrehes; when\n\t\t\t\t * `isDescendantOfBasePath` is `false`, `router.isPreview` is also\n\t\t\t\t * `false`.\n\t\t\t\t *\n\t\t\t\t * If the app does not have a base path, this should always be `true`.\n\t\t\t\t */\n\t\t\t\tconst locationIsDescendantOfBasePath = window.location.href.startsWith(\n\t\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t\t);\n\n\t\t\t\tconst prismicPreviewCookieRepositoryName =\n\t\t\t\t\tgetPreviewCookieRepositoryName(prismicPreviewCookie);\n\n\t\t\t\tif (\n\t\t\t\t\tlocationIsDescendantOfBasePath &&\n\t\t\t\t\tprismicPreviewCookieRepositoryName === repositoryName\n\t\t\t\t) {\n\t\t\t\t\tstartPreviewMode();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// On cleanup, unregister Prismic Toolbar event handlers.\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.removeEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t};\n\t}, [\n\t\trepositoryName,\n\t\tresolvedExitPreviewURL,\n\t\tresolvedUpdatePreviewURL,\n\t\trouter.isPreview,\n\t\trouter.basePath,\n\t]);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script\n\t\t\t\tsrc={`https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}&new=true`}\n\t\t\t\tstrategy=\"lazyOnload\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;;AAqDgB;AAMf;AAEM;AACA;AAEN;AAIC;AAEC;AAOA;AACC;;AAEQ;AACyH;AAEjI;AAGI;AAEL;AAEA;;AAGK;AAEL;AAGA;AAEA;AACC;;AAEQ;AAC4G;AAEpH;AAGF;AAEQ;AAIA;AAA6D;AAEpE;AAIA;AAiBO;AAIA;AAIL;;;AAIA;AACD;AAIF;AACQ;AAIA;AAAgE;AAAA;AAEtE;AACF;AACA;AACA;AACO;AACA;AAGR;AASD;;;;"}
1
+ {"version":3,"file":"PrismicPreview.js","sources":["../../src/PrismicPreview.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\nimport Script from \"next/script\";\n\nimport { PrismicPreviewClient } from \"./PrismicPreviewClient\";\n\n/**\n * Props for `<PrismicPreview>`.\n */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * **Only used in the Pages Directory (/pages).**\n\t *\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * **Only used in the Pages Directory (/pages).**\n\t *\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t */\n\texitPreviewURL?: string;\n\n\t/**\n\t * Children to render adjacent to the Prismic Toolbar.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically refresh the page with the\n * changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport function PrismicPreview({\n\trepositoryName,\n\tchildren,\n\t...props\n}: PrismicPreviewProps): JSX.Element {\n\tconst toolbarSrc = prismic.getToolbarSrc(repositoryName);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<PrismicPreviewClient repositoryName={repositoryName} {...props} />\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n}\n"],"names":["prismic.getToolbarSrc","_jsxs","_Fragment","_jsx"],"mappings":";;;;AA+CM,SAAU,eAAe,EAC9B,gBACA,UACA,GAAG,SACkB;AACf,QAAA,aAAaA,cAAsB,cAAc;AAGtD,SAAAC,KACEC,UAAA,EAAA,UAAA,CAAA,UACDC,IAAC,sBAAoB,EAAC,gBAA8B,GAAM,MAAK,CAAA,GAC/DA,IAAC,QAAM,EAAC,KAAK,YAAY,UAAS,aAAY,CAAA,CAAG,EAAA,CAC/C;AAEL;"}
@@ -0,0 +1,85 @@
1
+ 'use client';
2
+ 'use client';
3
+ "use strict";
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
+ const React = require("react");
6
+ const router = require("next/router");
7
+ const navigation = require("next/navigation");
8
+ const getPrismicPreviewCookie = require("./lib/getPrismicPreviewCookie.cjs");
9
+ const getPreviewCookieRepositoryName = require("./lib/getPreviewCookieRepositoryName.cjs");
10
+ function PrismicPreviewClient({ repositoryName, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" }) {
11
+ let isAppRouter = true;
12
+ let isPreviewMode = false;
13
+ let basePath = "";
14
+ let refresh;
15
+ try {
16
+ const router$1 = router.useRouter();
17
+ isAppRouter = false;
18
+ basePath = router$1.basePath;
19
+ isPreviewMode = router$1.isPreview;
20
+ refresh = () => router$1.replace(router$1.asPath, void 0, { scroll: false });
21
+ } catch {
22
+ const router2 = navigation.useRouter();
23
+ refresh = router2.refresh;
24
+ }
25
+ React.useEffect(() => {
26
+ const startPreviewMode = async () => {
27
+ const resolvedUpdatePreviewURL = basePath + updatePreviewURL;
28
+ const res = await globalThis.fetch(resolvedUpdatePreviewURL);
29
+ if (res.redirected) {
30
+ refresh();
31
+ } else {
32
+ console.error(`[<PrismicPreview>] Failed to start or update Preview Mode using the "${resolvedUpdatePreviewURL}" API endpoint. Does it exist?`);
33
+ }
34
+ };
35
+ const handlePrismicPreviewUpdate = async (event) => {
36
+ event.preventDefault();
37
+ if (isAppRouter) {
38
+ refresh();
39
+ } else {
40
+ await startPreviewMode();
41
+ }
42
+ };
43
+ const handlePrismicPreviewEnd = async (event) => {
44
+ event.preventDefault();
45
+ if (isAppRouter) {
46
+ refresh();
47
+ } else {
48
+ const resolvedExitPreviewURL = basePath + exitPreviewURL;
49
+ const res = await globalThis.fetch(resolvedExitPreviewURL);
50
+ if (res.ok) {
51
+ refresh();
52
+ } else {
53
+ console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${resolvedExitPreviewURL}" API endpoint. Does it exist?`);
54
+ }
55
+ }
56
+ };
57
+ window.addEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
58
+ window.addEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
59
+ if (!isPreviewMode) {
60
+ const prismicPreviewCookie = getPrismicPreviewCookie.getPrismicPreviewCookie(globalThis.document.cookie);
61
+ if (prismicPreviewCookie) {
62
+ const locationIsDescendantOfBasePath = window.location.href.startsWith(window.location.origin + basePath);
63
+ const prismicPreviewCookieRepositoryName = getPreviewCookieRepositoryName.getPreviewCookieRepositoryName(prismicPreviewCookie);
64
+ if (locationIsDescendantOfBasePath && prismicPreviewCookieRepositoryName === repositoryName) {
65
+ startPreviewMode();
66
+ }
67
+ }
68
+ }
69
+ return () => {
70
+ window.removeEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
71
+ window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
72
+ };
73
+ }, [
74
+ basePath,
75
+ exitPreviewURL,
76
+ isAppRouter,
77
+ isPreviewMode,
78
+ refresh,
79
+ repositoryName,
80
+ updatePreviewURL
81
+ ]);
82
+ return null;
83
+ }
84
+ exports.PrismicPreviewClient = PrismicPreviewClient;
85
+ //# sourceMappingURL=PrismicPreviewClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicPreviewClient.cjs","sources":["../../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { useRouter as usePagesRouter } from \"next/router\";\nimport { useRouter } from \"next/navigation\";\n\nimport { getPrismicPreviewCookie } from \"./lib/getPrismicPreviewCookie\";\nimport { getPreviewCookieRepositoryName } from \"./lib/getPreviewCookieRepositoryName\";\n\nimport { PrismicPreviewProps } from \"./PrismicPreview\";\n\ntype PrismicPreviewClientProps = Omit<PrismicPreviewProps, \"children\">;\n\nexport function PrismicPreviewClient({\n\trepositoryName,\n\tupdatePreviewURL = \"/api/preview\",\n\texitPreviewURL = \"/api/exit-preview\",\n}: PrismicPreviewClientProps): null {\n\tlet isAppRouter = true;\n\tlet isPreviewMode = false;\n\tlet basePath = \"\";\n\tlet refresh: () => void;\n\n\ttry {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst router = usePagesRouter();\n\n\t\tisAppRouter = false;\n\t\tbasePath = router.basePath;\n\t\tisPreviewMode = router.isPreview;\n\t\trefresh = () => router.replace(router.asPath, undefined, { scroll: false });\n\t} catch {\n\t\t// Assume we are in App Router. Ignore the error.\n\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst router = useRouter();\n\n\t\trefresh = router.refresh;\n\t}\n\n\tuseEffect(() => {\n\t\t/**\n\t\t * Starts Preview Mode and refreshes the page's props.\n\t\t */\n\t\tconst startPreviewMode = async () => {\n\t\t\tconst resolvedUpdatePreviewURL = basePath + updatePreviewURL;\n\n\t\t\t// Start Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedUpdatePreviewURL);\n\n\t\t\t// We check for `res.redirected` rather than `res.ok`\n\t\t\t// since the update preview endpoint may redirect to a\n\t\t\t// 404 page. As long as it redirects, we know the\n\t\t\t// endpoint exists and at least attempted to set\n\t\t\t// preview data.\n\t\t\tif (res.redirected) {\n\t\t\t\trefresh();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to start or update Preview Mode using the \"${resolvedUpdatePreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst handlePrismicPreviewUpdate = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\tif (isAppRouter) {\n\t\t\t\trefresh();\n\t\t\t} else {\n\t\t\t\tawait startPreviewMode();\n\t\t\t}\n\t\t};\n\n\t\tconst handlePrismicPreviewEnd = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\tif (isAppRouter) {\n\t\t\t\trefresh();\n\t\t\t} else {\n\t\t\t\tconst resolvedExitPreviewURL = basePath + exitPreviewURL;\n\n\t\t\t\t// Exit Next.js Preview Mode via the given preview API endpoint.\n\t\t\t\tconst res = await globalThis.fetch(resolvedExitPreviewURL);\n\n\t\t\t\tif (res.ok) {\n\t\t\t\t\t// TODO: Can we do better than a full page reload?\n\t\t\t\t\t// globalThis.location.reload();\n\t\t\t\t\trefresh();\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${resolvedExitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", handlePrismicPreviewUpdate);\n\t\twindow.addEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\n\t\tif (!isPreviewMode) {\n\t\t\tconst prismicPreviewCookie = getPrismicPreviewCookie(\n\t\t\t\tglobalThis.document.cookie,\n\t\t\t);\n\n\t\t\tif (prismicPreviewCookie) {\n\t\t\t\t// If a Prismic preview cookie is present, but Next.js Preview\n\t\t\t\t// Mode is not active, we must activate Preview Mode manually.\n\t\t\t\t//\n\t\t\t\t// This will happen when a visitor accesses the page using a\n\t\t\t\t// Prismic preview share link.\n\n\t\t\t\t/**\n\t\t\t\t * Determines if the current location is a descendant of the app's base\n\t\t\t\t * path.\n\t\t\t\t *\n\t\t\t\t * This is used to prevent infinite refrehes; when\n\t\t\t\t * `isDescendantOfBasePath` is `false`, `router.isPreview` is also\n\t\t\t\t * `false`.\n\t\t\t\t *\n\t\t\t\t * If the app does not have a base path, this should always be `true`.\n\t\t\t\t */\n\t\t\t\tconst locationIsDescendantOfBasePath = window.location.href.startsWith(\n\t\t\t\t\twindow.location.origin + basePath,\n\t\t\t\t);\n\n\t\t\t\tconst prismicPreviewCookieRepositoryName =\n\t\t\t\t\tgetPreviewCookieRepositoryName(prismicPreviewCookie);\n\n\t\t\t\tif (\n\t\t\t\t\tlocationIsDescendantOfBasePath &&\n\t\t\t\t\tprismicPreviewCookieRepositoryName === repositoryName\n\t\t\t\t) {\n\t\t\t\t\tstartPreviewMode();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.removeEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t};\n\t}, [\n\t\tbasePath,\n\t\texitPreviewURL,\n\t\tisAppRouter,\n\t\tisPreviewMode,\n\t\trefresh,\n\t\trepositoryName,\n\t\tupdatePreviewURL,\n\t]);\n\n\treturn null;\n}\n"],"names":["useEffect"],"mappings":";;;;;;;;;AAagB;AAKf;AACA;AACA;AACI;AAEA;AAEH;AAEc;AACd;AACA;AACU;AAAgE;AAK1E;AAEA;AAAiB;AAGlBA;AAIC;AACC;AAGA;AAOA;;;AAGS;AACyH;AAEjI;AAGI;AAEL;AAEA;;;AAGC;;AACA;AAGI;AAEL;AAEA;;;AAGC;AAGA;AAEA;;;AAKS;AAC4G;AAEpH;AACD;AAGK;AACA;AAEP;AACC;AAIA;AAiBO;AAIA;AAIL;;;AAIA;AACD;AAGF;AACQ;AAIA;AAAgE;AAAA;AAEtE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAGM;AACR;;"}
@@ -0,0 +1,4 @@
1
+ import { PrismicPreviewProps } from "./PrismicPreview";
2
+ type PrismicPreviewClientProps = Omit<PrismicPreviewProps, "children">;
3
+ export declare function PrismicPreviewClient({ repositoryName, updatePreviewURL, exitPreviewURL, }: PrismicPreviewClientProps): null;
4
+ export {};
@@ -0,0 +1,85 @@
1
+ 'use client';
2
+ 'use client';
3
+ import { useEffect } from "react";
4
+ import { useRouter } from "next/router";
5
+ import { useRouter as useRouter$1 } from "next/navigation";
6
+ import { getPrismicPreviewCookie } from "./lib/getPrismicPreviewCookie.js";
7
+ import { getPreviewCookieRepositoryName } from "./lib/getPreviewCookieRepositoryName.js";
8
+ function PrismicPreviewClient({ repositoryName, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" }) {
9
+ let isAppRouter = true;
10
+ let isPreviewMode = false;
11
+ let basePath = "";
12
+ let refresh;
13
+ try {
14
+ const router = useRouter();
15
+ isAppRouter = false;
16
+ basePath = router.basePath;
17
+ isPreviewMode = router.isPreview;
18
+ refresh = () => router.replace(router.asPath, void 0, { scroll: false });
19
+ } catch {
20
+ const router = useRouter$1();
21
+ refresh = router.refresh;
22
+ }
23
+ useEffect(() => {
24
+ const startPreviewMode = async () => {
25
+ const resolvedUpdatePreviewURL = basePath + updatePreviewURL;
26
+ const res = await globalThis.fetch(resolvedUpdatePreviewURL);
27
+ if (res.redirected) {
28
+ refresh();
29
+ } else {
30
+ console.error(`[<PrismicPreview>] Failed to start or update Preview Mode using the "${resolvedUpdatePreviewURL}" API endpoint. Does it exist?`);
31
+ }
32
+ };
33
+ const handlePrismicPreviewUpdate = async (event) => {
34
+ event.preventDefault();
35
+ if (isAppRouter) {
36
+ refresh();
37
+ } else {
38
+ await startPreviewMode();
39
+ }
40
+ };
41
+ const handlePrismicPreviewEnd = async (event) => {
42
+ event.preventDefault();
43
+ if (isAppRouter) {
44
+ refresh();
45
+ } else {
46
+ const resolvedExitPreviewURL = basePath + exitPreviewURL;
47
+ const res = await globalThis.fetch(resolvedExitPreviewURL);
48
+ if (res.ok) {
49
+ refresh();
50
+ } else {
51
+ console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${resolvedExitPreviewURL}" API endpoint. Does it exist?`);
52
+ }
53
+ }
54
+ };
55
+ window.addEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
56
+ window.addEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
57
+ if (!isPreviewMode) {
58
+ const prismicPreviewCookie = getPrismicPreviewCookie(globalThis.document.cookie);
59
+ if (prismicPreviewCookie) {
60
+ const locationIsDescendantOfBasePath = window.location.href.startsWith(window.location.origin + basePath);
61
+ const prismicPreviewCookieRepositoryName = getPreviewCookieRepositoryName(prismicPreviewCookie);
62
+ if (locationIsDescendantOfBasePath && prismicPreviewCookieRepositoryName === repositoryName) {
63
+ startPreviewMode();
64
+ }
65
+ }
66
+ }
67
+ return () => {
68
+ window.removeEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
69
+ window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
70
+ };
71
+ }, [
72
+ basePath,
73
+ exitPreviewURL,
74
+ isAppRouter,
75
+ isPreviewMode,
76
+ refresh,
77
+ repositoryName,
78
+ updatePreviewURL
79
+ ]);
80
+ return null;
81
+ }
82
+ export {
83
+ PrismicPreviewClient
84
+ };
85
+ //# sourceMappingURL=PrismicPreviewClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicPreviewClient.js","sources":["../../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { useRouter as usePagesRouter } from \"next/router\";\nimport { useRouter } from \"next/navigation\";\n\nimport { getPrismicPreviewCookie } from \"./lib/getPrismicPreviewCookie\";\nimport { getPreviewCookieRepositoryName } from \"./lib/getPreviewCookieRepositoryName\";\n\nimport { PrismicPreviewProps } from \"./PrismicPreview\";\n\ntype PrismicPreviewClientProps = Omit<PrismicPreviewProps, \"children\">;\n\nexport function PrismicPreviewClient({\n\trepositoryName,\n\tupdatePreviewURL = \"/api/preview\",\n\texitPreviewURL = \"/api/exit-preview\",\n}: PrismicPreviewClientProps): null {\n\tlet isAppRouter = true;\n\tlet isPreviewMode = false;\n\tlet basePath = \"\";\n\tlet refresh: () => void;\n\n\ttry {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst router = usePagesRouter();\n\n\t\tisAppRouter = false;\n\t\tbasePath = router.basePath;\n\t\tisPreviewMode = router.isPreview;\n\t\trefresh = () => router.replace(router.asPath, undefined, { scroll: false });\n\t} catch {\n\t\t// Assume we are in App Router. Ignore the error.\n\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst router = useRouter();\n\n\t\trefresh = router.refresh;\n\t}\n\n\tuseEffect(() => {\n\t\t/**\n\t\t * Starts Preview Mode and refreshes the page's props.\n\t\t */\n\t\tconst startPreviewMode = async () => {\n\t\t\tconst resolvedUpdatePreviewURL = basePath + updatePreviewURL;\n\n\t\t\t// Start Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedUpdatePreviewURL);\n\n\t\t\t// We check for `res.redirected` rather than `res.ok`\n\t\t\t// since the update preview endpoint may redirect to a\n\t\t\t// 404 page. As long as it redirects, we know the\n\t\t\t// endpoint exists and at least attempted to set\n\t\t\t// preview data.\n\t\t\tif (res.redirected) {\n\t\t\t\trefresh();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to start or update Preview Mode using the \"${resolvedUpdatePreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst handlePrismicPreviewUpdate = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\tif (isAppRouter) {\n\t\t\t\trefresh();\n\t\t\t} else {\n\t\t\t\tawait startPreviewMode();\n\t\t\t}\n\t\t};\n\n\t\tconst handlePrismicPreviewEnd = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\tif (isAppRouter) {\n\t\t\t\trefresh();\n\t\t\t} else {\n\t\t\t\tconst resolvedExitPreviewURL = basePath + exitPreviewURL;\n\n\t\t\t\t// Exit Next.js Preview Mode via the given preview API endpoint.\n\t\t\t\tconst res = await globalThis.fetch(resolvedExitPreviewURL);\n\n\t\t\t\tif (res.ok) {\n\t\t\t\t\t// TODO: Can we do better than a full page reload?\n\t\t\t\t\t// globalThis.location.reload();\n\t\t\t\t\trefresh();\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${resolvedExitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", handlePrismicPreviewUpdate);\n\t\twindow.addEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\n\t\tif (!isPreviewMode) {\n\t\t\tconst prismicPreviewCookie = getPrismicPreviewCookie(\n\t\t\t\tglobalThis.document.cookie,\n\t\t\t);\n\n\t\t\tif (prismicPreviewCookie) {\n\t\t\t\t// If a Prismic preview cookie is present, but Next.js Preview\n\t\t\t\t// Mode is not active, we must activate Preview Mode manually.\n\t\t\t\t//\n\t\t\t\t// This will happen when a visitor accesses the page using a\n\t\t\t\t// Prismic preview share link.\n\n\t\t\t\t/**\n\t\t\t\t * Determines if the current location is a descendant of the app's base\n\t\t\t\t * path.\n\t\t\t\t *\n\t\t\t\t * This is used to prevent infinite refrehes; when\n\t\t\t\t * `isDescendantOfBasePath` is `false`, `router.isPreview` is also\n\t\t\t\t * `false`.\n\t\t\t\t *\n\t\t\t\t * If the app does not have a base path, this should always be `true`.\n\t\t\t\t */\n\t\t\t\tconst locationIsDescendantOfBasePath = window.location.href.startsWith(\n\t\t\t\t\twindow.location.origin + basePath,\n\t\t\t\t);\n\n\t\t\t\tconst prismicPreviewCookieRepositoryName =\n\t\t\t\t\tgetPreviewCookieRepositoryName(prismicPreviewCookie);\n\n\t\t\t\tif (\n\t\t\t\t\tlocationIsDescendantOfBasePath &&\n\t\t\t\t\tprismicPreviewCookieRepositoryName === repositoryName\n\t\t\t\t) {\n\t\t\t\t\tstartPreviewMode();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.removeEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t};\n\t}, [\n\t\tbasePath,\n\t\texitPreviewURL,\n\t\tisAppRouter,\n\t\tisPreviewMode,\n\t\trefresh,\n\t\trepositoryName,\n\t\tupdatePreviewURL,\n\t]);\n\n\treturn null;\n}\n"],"names":[],"mappings":";;;;;;;AAagB;AAKf;AACA;AACA;AACI;AAEA;AAEH;AAEc;AACd;AACA;AACU;AAAgE;AAK1E;AAEA;AAAiB;AAGlB;AAIC;AACC;AAGA;AAOA;;;AAGS;AACyH;AAEjI;AAGI;AAEL;AAEA;;;AAGC;;AACA;AAGI;AAEL;AAEA;;;AAGC;AAGA;AAEA;;;AAKS;AAC4G;AAEpH;AACD;AAGK;AACA;AAEP;AACC;AAIA;AAiBO;AAIA;AAIL;;;AAIA;AACD;AAGF;AACQ;AAIA;AAAgE;AAAA;AAEtE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAGM;AACR;;;;"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var __defProp = Object.defineProperty;
4
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
+ var __publicField = (obj, key, value) => {
6
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ return value;
8
+ };
9
+ class PrismicError extends Error {
10
+ constructor(message = "An invalid API response was returned", url, response) {
11
+ super(message);
12
+ __publicField(this, "url");
13
+ __publicField(this, "response");
14
+ this.url = url;
15
+ this.response = response;
16
+ }
17
+ }
18
+ exports.PrismicError = PrismicError;
19
+ //# sourceMappingURL=PrismicError.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicError.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/errors/PrismicError.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\nclass PrismicError extends Error {\n constructor(message = \"An invalid API response was returned\", url, response) {\n super(message);\n __publicField(this, \"url\");\n __publicField(this, \"response\");\n this.url = url;\n this.response = response;\n }\n}\nexport {\n PrismicError\n};\n//# sourceMappingURL=PrismicError.js.map\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU;AACvC,kBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AACpE,SAAO;AACT;AACA,MAAM,qBAAqB,MAAM;AAAA,EAC/B,YAAY,UAAU,wCAAwC,KAAK,UAAU;AAC3E,UAAM,OAAO;AACb,kBAAc,MAAM,KAAK;AACzB,kBAAc,MAAM,UAAU;AAC9B,SAAK,MAAM;AACX,SAAK,WAAW;AAAA,EACjB;AACH;;","x_google_ignoreList":[0]}
@@ -0,0 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ class PrismicError extends Error {
8
+ constructor(message = "An invalid API response was returned", url, response) {
9
+ super(message);
10
+ __publicField(this, "url");
11
+ __publicField(this, "response");
12
+ this.url = url;
13
+ this.response = response;
14
+ }
15
+ }
16
+ export {
17
+ PrismicError
18
+ };
19
+ //# sourceMappingURL=PrismicError.js.map