@webiny/app 0.0.0-mt-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.
Files changed (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/apollo-client/InMemoryCache.d.ts +7 -0
  4. package/apollo-client/InMemoryCache.js +59 -0
  5. package/components/Image.d.ts +3 -0
  6. package/components/Image.js +28 -0
  7. package/components/Routes.d.ts +2 -0
  8. package/components/Routes.js +35 -0
  9. package/components/View.d.ts +8 -0
  10. package/components/View.js +23 -0
  11. package/components/index.d.ts +1 -0
  12. package/components/index.js +1 -0
  13. package/contexts/Ui/index.d.ts +27 -0
  14. package/contexts/Ui/index.js +69 -0
  15. package/hooks/useAutocomplete/index.d.ts +1 -0
  16. package/hooks/useAutocomplete/index.js +1 -0
  17. package/hooks/useAutocomplete/useAutocomplete.d.ts +6 -0
  18. package/hooks/useAutocomplete/useAutocomplete.js +27 -0
  19. package/hooks/useDataList/functions/getData.d.ts +2 -0
  20. package/hooks/useDataList/functions/getData.js +4 -0
  21. package/hooks/useDataList/functions/getError.d.ts +2 -0
  22. package/hooks/useDataList/functions/getError.js +4 -0
  23. package/hooks/useDataList/functions/getMeta.d.ts +2 -0
  24. package/hooks/useDataList/functions/getMeta.js +4 -0
  25. package/hooks/useDataList/functions/index.d.ts +3 -0
  26. package/hooks/useDataList/functions/index.js +3 -0
  27. package/hooks/useDataList/functions/searchDataByKey.d.ts +2 -0
  28. package/hooks/useDataList/functions/searchDataByKey.js +21 -0
  29. package/hooks/useDataList/index.d.ts +1 -0
  30. package/hooks/useDataList/index.js +1 -0
  31. package/hooks/useDataList/useDataList.d.ts +36 -0
  32. package/hooks/useDataList/useDataList.js +193 -0
  33. package/hooks/useDataList/utils/index.d.ts +2 -0
  34. package/hooks/useDataList/utils/index.js +2 -0
  35. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +4 -0
  36. package/hooks/useDataList/utils/prepareLoadListParams.js +34 -0
  37. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +5 -0
  38. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +22 -0
  39. package/hooks/useDataList/utils/types.d.ts +34 -0
  40. package/hooks/useDataList/utils/types.js +1 -0
  41. package/hooks/useHandler.d.ts +1 -0
  42. package/hooks/useHandler.js +12 -0
  43. package/hooks/useHandlers.d.ts +11 -0
  44. package/hooks/useHandlers.js +19 -0
  45. package/hooks/useUi.d.ts +2 -0
  46. package/hooks/useUi.js +5 -0
  47. package/i18n/i18n.d.ts +2 -0
  48. package/i18n/i18n.js +5 -0
  49. package/i18n/index.d.ts +1 -0
  50. package/i18n/index.js +1 -0
  51. package/package.json +70 -0
  52. package/plugins/AddQuerySelectionPlugin.d.ts +15 -0
  53. package/plugins/AddQuerySelectionPlugin.js +101 -0
  54. package/plugins/ApolloCacheObjectIdPlugin.d.ts +15 -0
  55. package/plugins/ApolloCacheObjectIdPlugin.js +40 -0
  56. package/plugins/ApolloDynamicLink.d.ts +5 -0
  57. package/plugins/ApolloDynamicLink.js +62 -0
  58. package/plugins/ApolloLinkPlugin.d.ts +13 -0
  59. package/plugins/ApolloLinkPlugin.js +43 -0
  60. package/plugins/ConsoleLinkPlugin.d.ts +8 -0
  61. package/plugins/ConsoleLinkPlugin.js +47 -0
  62. package/plugins/LocaleHeaderLinkPlugin.d.ts +14 -0
  63. package/plugins/LocaleHeaderLinkPlugin.js +61 -0
  64. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +6 -0
  65. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +76 -0
  66. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +3 -0
  67. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +9 -0
  68. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.svg +1 -0
  69. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +5 -0
  70. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +27 -0
  71. package/plugins/NetworkErrorLinkPlugin.d.ts +7 -0
  72. package/plugins/NetworkErrorLinkPlugin.js +45 -0
  73. package/plugins/OmitTypenameLinkPlugin.d.ts +8 -0
  74. package/plugins/OmitTypenameLinkPlugin.js +41 -0
  75. package/plugins/RoutePlugin.d.ts +12 -0
  76. package/plugins/RoutePlugin.js +36 -0
  77. package/plugins/TenantHeaderLinkPlugin.d.ts +14 -0
  78. package/plugins/TenantHeaderLinkPlugin.js +71 -0
  79. package/plugins/ViewPlugin.d.ts +14 -0
  80. package/plugins/ViewPlugin.js +41 -0
  81. package/plugins/image.d.ts +3 -0
  82. package/plugins/image.js +165 -0
  83. package/plugins/index.d.ts +20 -0
  84. package/plugins/index.js +73 -0
  85. package/types.d.ts +62 -0
  86. package/types.js +2 -0
@@ -0,0 +1,61 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
6
+ import _createSuper from "@babel/runtime/helpers/createSuper";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+ import { setContext } from "apollo-link-context";
9
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
10
+
11
+ /**
12
+ * Append `x-i18n-locale` header from URL query (necessary for prerendering service).
13
+ */
14
+ export var LocaleHeaderLinkPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
15
+ _inherits(LocaleHeaderLinkPlugin, _ApolloLinkPlugin);
16
+
17
+ var _super = _createSuper(LocaleHeaderLinkPlugin);
18
+
19
+ function LocaleHeaderLinkPlugin(locale) {
20
+ var _this;
21
+
22
+ _classCallCheck(this, LocaleHeaderLinkPlugin);
23
+
24
+ _this = _super.call(this);
25
+
26
+ _defineProperty(_assertThisInitialized(_this), "locale", void 0);
27
+
28
+ if (!locale) {
29
+ var query = new URLSearchParams(location.search);
30
+ locale = query.get("__locale") || window.__PS_RENDER_LOCALE__;
31
+ }
32
+
33
+ _this.locale = locale;
34
+ return _this;
35
+ }
36
+
37
+ _createClass(LocaleHeaderLinkPlugin, [{
38
+ key: "createLink",
39
+ value: function createLink() {
40
+ var _this2 = this;
41
+
42
+ return setContext(function (_, _ref) {
43
+ var headers = _ref.headers;
44
+
45
+ if (_this2.locale) {
46
+ return {
47
+ headers: _objectSpread(_objectSpread({}, headers), {}, {
48
+ "x-i18n-locale": "content:".concat(_this2.locale, ";")
49
+ })
50
+ };
51
+ }
52
+
53
+ return {
54
+ headers: headers
55
+ };
56
+ });
57
+ }
58
+ }]);
59
+
60
+ return LocaleHeaderLinkPlugin;
61
+ }(ApolloLinkPlugin);
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const ErrorOverlay: ({ query, networkError }: {
3
+ query: any;
4
+ networkError: any;
5
+ }) => JSX.Element;
6
+ export default ErrorOverlay;
@@ -0,0 +1,76 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+
4
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
5
+
6
+ import React, { useState } from "react";
7
+ import get from "lodash/get";
8
+ import { IconButton } from "@webiny/ui/Button";
9
+ import { Typography } from "@webiny/ui/Typography";
10
+ import { i18n } from "../../i18n";
11
+ import { OverlayWrapper, Pre } from "./StyledComponents";
12
+ import { ReactComponent as CloseIcon } from "@svgr/webpack!./assets/close_24px.svg";
13
+ var t = i18n.ns("app/graphql/error-overlay");
14
+ var ENVIRONMENT_VARIABLES_ARTICLE_LINK = "https://www.webiny.com/docs/how-to-guides/environment-variables";
15
+
16
+ var ErrorOverlay = function ErrorOverlay(_ref) {
17
+ var query = _ref.query,
18
+ networkError = _ref.networkError;
19
+
20
+ var _useState = useState(true),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ open = _useState2[0],
23
+ setOpen = _useState2[1]; // Log error in browser's developer console for further inspection.
24
+
25
+
26
+ console.error({
27
+ networkError: networkError
28
+ });
29
+
30
+ if (!open) {
31
+ return null;
32
+ }
33
+
34
+ var stackTrace = get(networkError, "result.error.stack");
35
+ return /*#__PURE__*/React.createElement(OverlayWrapper, null, /*#__PURE__*/React.createElement("div", {
36
+ className: "inner"
37
+ }, /*#__PURE__*/React.createElement("div", {
38
+ className: "header"
39
+ }, /*#__PURE__*/React.createElement("div", {
40
+ className: "header__title"
41
+ }, /*#__PURE__*/React.createElement(Typography, {
42
+ use: "headline4"
43
+ }, networkError.message)), /*#__PURE__*/React.createElement("div", {
44
+ className: "header__action"
45
+ }, /*#__PURE__*/React.createElement(IconButton, {
46
+ icon: /*#__PURE__*/React.createElement(CloseIcon, null),
47
+ onClick: function onClick() {
48
+ return setOpen(false);
49
+ }
50
+ }))), /*#__PURE__*/React.createElement("div", {
51
+ className: "body"
52
+ }, /*#__PURE__*/React.createElement("div", {
53
+ className: "body__summary"
54
+ }, /*#__PURE__*/React.createElement(Typography, {
55
+ use: "subtitle1"
56
+ }, t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Error occurred while executing operation:"])))), /*#__PURE__*/React.createElement(Pre, null, /*#__PURE__*/React.createElement("code", null, query))), stackTrace && /*#__PURE__*/React.createElement("div", {
57
+ className: "body__description"
58
+ }, /*#__PURE__*/React.createElement(Typography, {
59
+ use: "subtitle1"
60
+ }, t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Complete stack trace:"])))), /*#__PURE__*/React.createElement(Pre, null, /*#__PURE__*/React.createElement("code", null, stackTrace)))), /*#__PURE__*/React.createElement("div", {
61
+ className: "footer"
62
+ }, /*#__PURE__*/React.createElement(Typography, {
63
+ use: "body2"
64
+ }, t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n This screen is only visible if {message} environment variable is set.\n Read more about it in the {link}. "])))({
65
+ message: /*#__PURE__*/React.createElement("span", {
66
+ className: "highlight"
67
+ }, "`REACT_APP_DEBUG=true`"),
68
+ link: /*#__PURE__*/React.createElement("a", {
69
+ href: ENVIRONMENT_VARIABLES_ARTICLE_LINK,
70
+ target: "_blank",
71
+ rel: "noreferrer noopener"
72
+ }, "environment variables article")
73
+ }), /*#__PURE__*/React.createElement("br", null), t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["Open your browser's developer console to further inspect this error."])))))));
74
+ };
75
+
76
+ export default ErrorOverlay;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const OverlayWrapper: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "className" | "title" | "style" | "children" | "slot" | "id" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "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" | "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" | "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">, object>;
3
+ export declare const Pre: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLPreElement>, HTMLPreElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLPreElement>, HTMLPreElement>, "className" | "title" | "style" | "children" | "slot" | "id" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "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" | "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" | "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">, object>;
@@ -0,0 +1,9 @@
1
+ import styled from "@emotion/styled";
2
+ export var OverlayWrapper = /*#__PURE__*/styled("div", {
3
+ target: "e1rvk94r0",
4
+ label: "OverlayWrapper"
5
+ })("\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 105; // The highest z-index value is 100 for Dialogs\n \n .inner {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: white;\n padding: 1rem;\n }\n \n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 1rem;\n .header__title {\n color: var(--mdc-theme-error);\n }\n }\n \n .body {\n flex-grow: 1;\n .body__summary {\n margin-bottom: 1rem;\n }\n }\n \n .footer {\n color: var(--mdc-theme-text-secondary-on-background);\n \n .highlight {\n background-color: rgba(251, 245, 180, 0.5);\n padding: 0 4px;\n border-radius: 6px;\n font-family: monospace;\n }\n }\n");
6
+ export var Pre = /*#__PURE__*/styled("pre", {
7
+ target: "e1rvk94r1",
8
+ label: "Pre"
9
+ })("\n position: relative;\n display: block;\n padding: 0.5em;\n margin-top: 0.5em;\n margin-bottom: 0.5em;\n overflow-x: auto;\n white-space: pre-wrap;\n border-radius: 0.25rem;\n background-color: rgba(251, 245, 180, 0.3);\n color: inherit;\n \n code {\n font-family: monospace;\n font-size: 0.85rem;\n line-height: 1rem;\n }\n");
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M18.3 5.71c-.39-.39-1.02-.39-1.41 0L12 10.59 7.11 5.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z"/></svg>
@@ -0,0 +1,5 @@
1
+ declare const createErrorOverlay: ({ query, networkError }: {
2
+ query: any;
3
+ networkError: any;
4
+ }) => void;
5
+ export default createErrorOverlay;
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { render } from "react-dom";
3
+ import ErrorOverlay from "./ErrorOverlay";
4
+
5
+ var createErrorOverlay = function createErrorOverlay(_ref) {
6
+ var query = _ref.query,
7
+ networkError = _ref.networkError;
8
+
9
+ // If the element already present in DOM, return immediately.
10
+ if (document.getElementById("overlay-root")) {
11
+ return;
12
+ } // Create root element to hold React tree.
13
+
14
+
15
+ var container = document.createElement("div");
16
+ container.id = "overlay-root"; // Insert root element into body.
17
+
18
+ var body = document.getElementsByTagName("body")[0];
19
+ body.appendChild(container); // Mount the ErrorOverlay component into root element.
20
+
21
+ render( /*#__PURE__*/React.createElement(ErrorOverlay, {
22
+ query: query,
23
+ networkError: networkError
24
+ }), container);
25
+ };
26
+
27
+ export default createErrorOverlay;
@@ -0,0 +1,7 @@
1
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
2
+ /**
3
+ * This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.
4
+ */
5
+ export declare class NetworkErrorLinkPlugin extends ApolloLinkPlugin {
6
+ createLink(): import("apollo-link").ApolloLink;
7
+ }
@@ -0,0 +1,45 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/createSuper";
5
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
6
+ import { onError } from "apollo-link-error";
7
+ import { print } from "graphql/language";
8
+ import createErrorOverlay from "./NetworkErrorLinkPlugin/createErrorOverlay";
9
+ import { boolean } from "boolean";
10
+ /**
11
+ * This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.
12
+ */
13
+
14
+ export var NetworkErrorLinkPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
15
+ _inherits(NetworkErrorLinkPlugin, _ApolloLinkPlugin);
16
+
17
+ var _super = _createSuper(NetworkErrorLinkPlugin);
18
+
19
+ function NetworkErrorLinkPlugin() {
20
+ _classCallCheck(this, NetworkErrorLinkPlugin);
21
+
22
+ return _super.apply(this, arguments);
23
+ }
24
+
25
+ _createClass(NetworkErrorLinkPlugin, [{
26
+ key: "createLink",
27
+ value: function createLink() {
28
+ return onError(function (_ref) {
29
+ var networkError = _ref.networkError,
30
+ operation = _ref.operation;
31
+ var debug = boolean(process.env.REACT_APP_DEBUG);
32
+
33
+ if (networkError && debug) {
34
+ createErrorOverlay({
35
+ query: print(operation.query),
36
+ networkError: networkError
37
+ });
38
+ } // TODO: also print graphQLErrors
39
+
40
+ });
41
+ }
42
+ }]);
43
+
44
+ return NetworkErrorLinkPlugin;
45
+ }(ApolloLinkPlugin);
@@ -0,0 +1,8 @@
1
+ import { ApolloLink } from "apollo-link";
2
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
3
+ /**
4
+ * This link removes `__typename` from the variables being sent to the API.
5
+ */
6
+ export declare class OmitTypenameLinkPlugin extends ApolloLinkPlugin {
7
+ createLink(): ApolloLink;
8
+ }
@@ -0,0 +1,41 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/createSuper";
5
+ import { ApolloLink } from "apollo-link";
6
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
7
+
8
+ function omitTypename(key, value) {
9
+ return key === "__typename" ? undefined : value;
10
+ }
11
+ /**
12
+ * This link removes `__typename` from the variables being sent to the API.
13
+ */
14
+
15
+
16
+ export var OmitTypenameLinkPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
17
+ _inherits(OmitTypenameLinkPlugin, _ApolloLinkPlugin);
18
+
19
+ var _super = _createSuper(OmitTypenameLinkPlugin);
20
+
21
+ function OmitTypenameLinkPlugin() {
22
+ _classCallCheck(this, OmitTypenameLinkPlugin);
23
+
24
+ return _super.apply(this, arguments);
25
+ }
26
+
27
+ _createClass(OmitTypenameLinkPlugin, [{
28
+ key: "createLink",
29
+ value: function createLink() {
30
+ return new ApolloLink(function (operation, forward) {
31
+ if (operation.variables) {
32
+ operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);
33
+ }
34
+
35
+ return forward(operation);
36
+ });
37
+ }
38
+ }]);
39
+
40
+ return OmitTypenameLinkPlugin;
41
+ }(ApolloLinkPlugin);
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { Plugin } from "@webiny/plugins";
3
+ interface Config {
4
+ route: React.ReactElement;
5
+ }
6
+ export declare class RoutePlugin extends Plugin {
7
+ static readonly type = "route";
8
+ private _config;
9
+ constructor(config?: Config);
10
+ get route(): Config["route"];
11
+ }
12
+ export {};
@@ -0,0 +1,36 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+ import { Plugin } from "@webiny/plugins";
8
+ export var RoutePlugin = /*#__PURE__*/function (_Plugin) {
9
+ _inherits(RoutePlugin, _Plugin);
10
+
11
+ var _super = _createSuper(RoutePlugin);
12
+
13
+ function RoutePlugin(config) {
14
+ var _this;
15
+
16
+ _classCallCheck(this, RoutePlugin);
17
+
18
+ _this = _super.call(this);
19
+
20
+ _defineProperty(_assertThisInitialized(_this), "_config", void 0);
21
+
22
+ _this._config = config || {};
23
+ return _this;
24
+ }
25
+
26
+ _createClass(RoutePlugin, [{
27
+ key: "route",
28
+ get: function get() {
29
+ return this._config.route;
30
+ }
31
+ }]);
32
+
33
+ return RoutePlugin;
34
+ }(Plugin);
35
+
36
+ _defineProperty(RoutePlugin, "type", "route");
@@ -0,0 +1,14 @@
1
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
2
+ declare global {
3
+ interface Window {
4
+ __PS_RENDER_TENANT__: string;
5
+ }
6
+ }
7
+ /**
8
+ * Append `x-tenant` header from URL query (necessary for prerendering service).
9
+ */
10
+ export declare class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
11
+ private tenant;
12
+ constructor(tenant?: string);
13
+ createLink(): import("apollo-link").ApolloLink;
14
+ }
@@ -0,0 +1,71 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
6
+ import _createSuper from "@babel/runtime/helpers/createSuper";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+ import { setContext } from "apollo-link-context";
9
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
10
+
11
+ /**
12
+ * Append `x-tenant` header from URL query (necessary for prerendering service).
13
+ */
14
+ export var TenantHeaderLinkPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
15
+ _inherits(TenantHeaderLinkPlugin, _ApolloLinkPlugin);
16
+
17
+ var _super = _createSuper(TenantHeaderLinkPlugin);
18
+
19
+ function TenantHeaderLinkPlugin(tenant) {
20
+ var _this;
21
+
22
+ _classCallCheck(this, TenantHeaderLinkPlugin);
23
+
24
+ _this = _super.call(this);
25
+
26
+ _defineProperty(_assertThisInitialized(_this), "tenant", void 0);
27
+
28
+ _this.name = "tenant-header-link";
29
+
30
+ if (!tenant) {
31
+ var query = new URLSearchParams(location.search);
32
+ tenant = query.get("__tenant") || window.__PS_RENDER_TENANT__;
33
+ }
34
+
35
+ _this.tenant = tenant;
36
+ console.log("Detected tenant", _this.tenant);
37
+ return _this;
38
+ }
39
+
40
+ _createClass(TenantHeaderLinkPlugin, [{
41
+ key: "createLink",
42
+ value: function createLink() {
43
+ var _this2 = this;
44
+
45
+ return setContext(function (_, _ref) {
46
+ var headers = _ref.headers;
47
+
48
+ // If tenant header is already set, do not overwrite it.
49
+ if (headers && "x-tenant" in headers) {
50
+ return {
51
+ headers: headers
52
+ };
53
+ }
54
+
55
+ if (_this2.tenant) {
56
+ return {
57
+ headers: _objectSpread(_objectSpread({}, headers), {}, {
58
+ "x-tenant": _this2.tenant
59
+ })
60
+ };
61
+ }
62
+
63
+ return {
64
+ headers: headers
65
+ };
66
+ });
67
+ }
68
+ }]);
69
+
70
+ return TenantHeaderLinkPlugin;
71
+ }(ApolloLinkPlugin);
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { Plugin } from "@webiny/plugins";
3
+ interface Config<Props> {
4
+ name: string;
5
+ render(props: Props): React.ReactElement | null;
6
+ }
7
+ export declare class ViewPlugin<Props = any> extends Plugin {
8
+ static readonly type = "view";
9
+ private _config;
10
+ constructor(config?: Config<Props>);
11
+ get key(): string;
12
+ render(props: Props): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
13
+ }
14
+ export {};
@@ -0,0 +1,41 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+ import { Plugin } from "@webiny/plugins";
8
+ export var ViewPlugin = /*#__PURE__*/function (_Plugin) {
9
+ _inherits(ViewPlugin, _Plugin);
10
+
11
+ var _super = _createSuper(ViewPlugin);
12
+
13
+ function ViewPlugin(config) {
14
+ var _this;
15
+
16
+ _classCallCheck(this, ViewPlugin);
17
+
18
+ _this = _super.call(this);
19
+
20
+ _defineProperty(_assertThisInitialized(_this), "_config", void 0);
21
+
22
+ _this._config = config || {};
23
+ return _this;
24
+ }
25
+
26
+ _createClass(ViewPlugin, [{
27
+ key: "key",
28
+ get: function get() {
29
+ return this._config.name;
30
+ }
31
+ }, {
32
+ key: "render",
33
+ value: function render(props) {
34
+ return this._config.render(props);
35
+ }
36
+ }]);
37
+
38
+ return ViewPlugin;
39
+ }(Plugin);
40
+
41
+ _defineProperty(ViewPlugin, "type", "view");
@@ -0,0 +1,3 @@
1
+ import { ImageComponentPlugin } from "../types";
2
+ declare const _default: () => ImageComponentPlugin;
3
+ export default _default;