@webiny/app 5.43.2 → 6.0.0-alpha.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 (155) hide show
  1. package/App.d.ts +3 -10
  2. package/App.js +70 -84
  3. package/App.js.map +1 -1
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +9 -0
  6. package/AppContainer.js.map +1 -0
  7. package/apollo-client/InMemoryCache.js +16 -47
  8. package/apollo-client/InMemoryCache.js.map +1 -1
  9. package/apollo-client/IntrospectionFragmentMatcher.js +33 -50
  10. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
  11. package/components/Image.js +11 -19
  12. package/components/Image.js.map +1 -1
  13. package/components/Routes.js +13 -23
  14. package/components/Routes.js.map +1 -1
  15. package/components/View.js +14 -26
  16. package/components/View.js.map +1 -1
  17. package/components/index.js +2 -19
  18. package/components/index.js.map +1 -1
  19. package/config/RouterConfig/Route.d.ts +30 -0
  20. package/config/RouterConfig/Route.js +42 -0
  21. package/config/RouterConfig/Route.js.map +1 -0
  22. package/config/RouterConfig.d.ts +32 -0
  23. package/config/RouterConfig.js +18 -0
  24. package/config/RouterConfig.js.map +1 -0
  25. package/config.js +9 -15
  26. package/config.js.map +1 -1
  27. package/contexts/Ui/index.js +28 -52
  28. package/contexts/Ui/index.js.map +1 -1
  29. package/core/DebounceRender.js +13 -24
  30. package/core/DebounceRender.js.map +1 -1
  31. package/core/Plugin.js +11 -19
  32. package/core/Plugin.js.map +1 -1
  33. package/core/Plugins.js +18 -24
  34. package/core/Plugins.js.map +1 -1
  35. package/core/Provider.js +9 -13
  36. package/core/Provider.js.map +1 -1
  37. package/core/Routes.js +14 -23
  38. package/core/Routes.js.map +1 -1
  39. package/core/createProvider.js +1 -7
  40. package/core/createProvider.js.map +1 -1
  41. package/core/createProviderPlugin.js +4 -10
  42. package/core/createProviderPlugin.js.map +1 -1
  43. package/hooks/useAutocomplete/index.js +1 -12
  44. package/hooks/useAutocomplete/index.js.map +1 -1
  45. package/hooks/useAutocomplete/useAutocomplete.js +9 -16
  46. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  47. package/hooks/useDataList/functions/getData.js +2 -11
  48. package/hooks/useDataList/functions/getData.js.map +1 -1
  49. package/hooks/useDataList/functions/getError.js +2 -11
  50. package/hooks/useDataList/functions/getError.js.map +1 -1
  51. package/hooks/useDataList/functions/getMeta.js +2 -11
  52. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  53. package/hooks/useDataList/functions/index.js +3 -27
  54. package/hooks/useDataList/functions/index.js.map +1 -1
  55. package/hooks/useDataList/functions/searchDataByKey.js +4 -10
  56. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  57. package/hooks/useDataList/index.js +1 -12
  58. package/hooks/useDataList/index.js.map +1 -1
  59. package/hooks/useDataList/useDataList.js +78 -78
  60. package/hooks/useDataList/useDataList.js.map +1 -1
  61. package/hooks/useDataList/utils/index.js +2 -20
  62. package/hooks/useDataList/utils/index.js.map +1 -1
  63. package/hooks/useDataList/utils/prepareLoadListParams.js +9 -15
  64. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  65. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +10 -14
  66. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -1
  67. package/hooks/useDataList/utils/types.js +1 -5
  68. package/hooks/useHandler.js +7 -12
  69. package/hooks/useHandler.js.map +1 -1
  70. package/hooks/useHandlers.js +11 -17
  71. package/hooks/useHandlers.js.map +1 -1
  72. package/hooks/useRegisterLegacyPlugin.js +5 -11
  73. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  74. package/hooks/useUi.d.ts +1 -1
  75. package/hooks/useUi.js +4 -10
  76. package/hooks/useUi.js.map +1 -1
  77. package/i18n/i18n.js +5 -13
  78. package/i18n/i18n.js.map +1 -1
  79. package/i18n/index.js +1 -13
  80. package/i18n/index.js.map +1 -1
  81. package/index.d.ts +1 -1
  82. package/index.js +17 -177
  83. package/index.js.map +1 -1
  84. package/package.json +10 -9
  85. package/plugins/AddQuerySelectionPlugin.js +62 -107
  86. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  87. package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
  88. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  89. package/plugins/ApolloDynamicLink.js +19 -46
  90. package/plugins/ApolloDynamicLink.js.map +1 -1
  91. package/plugins/ApolloLinkPlugin.js +18 -37
  92. package/plugins/ApolloLinkPlugin.js.map +1 -1
  93. package/plugins/ConsoleLinkPlugin.js +20 -41
  94. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  95. package/plugins/LocaleHeaderLinkPlugin.js +23 -40
  96. package/plugins/LocaleHeaderLinkPlugin.js.map +1 -1
  97. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +39 -51
  98. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  99. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
  100. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  101. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +12 -18
  102. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  103. package/plugins/NetworkErrorLinkPlugin.js +23 -40
  104. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  105. package/plugins/OmitTypenameLinkPlugin.js +11 -30
  106. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  107. package/plugins/RoutePlugin.js +12 -31
  108. package/plugins/RoutePlugin.js.map +1 -1
  109. package/plugins/TenantHeaderLinkPlugin.js +30 -47
  110. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  111. package/plugins/ViewPlugin.js +15 -36
  112. package/plugins/ViewPlugin.js.map +1 -1
  113. package/plugins/image.js +46 -53
  114. package/plugins/image.js.map +1 -1
  115. package/plugins/index.js +31 -53
  116. package/plugins/index.js.map +1 -1
  117. package/react-butterfiles/Files.js +208 -235
  118. package/react-butterfiles/Files.js.map +1 -1
  119. package/react-butterfiles/index.js +2 -8
  120. package/react-butterfiles/index.js.map +1 -1
  121. package/react-butterfiles/utils/generateId.js +1 -7
  122. package/react-butterfiles/utils/generateId.js.map +1 -1
  123. package/react-butterfiles/utils/readFileContent.js +4 -10
  124. package/react-butterfiles/utils/readFileContent.js.map +1 -1
  125. package/renderApp.js +4 -11
  126. package/renderApp.js.map +1 -1
  127. package/types.js +11 -11
  128. package/types.js.map +1 -1
  129. package/utils/createGenericContext.js +13 -22
  130. package/utils/createGenericContext.js.map +1 -1
  131. package/utils/createHashing.js +9 -15
  132. package/utils/createHashing.js.map +1 -1
  133. package/utils/getApiUrl.js +1 -8
  134. package/utils/getApiUrl.js.map +1 -1
  135. package/utils/getGqlApiUrl.js +3 -9
  136. package/utils/getGqlApiUrl.js.map +1 -1
  137. package/utils/getHeadlessCmsGqlApiUrl.js +7 -13
  138. package/utils/getHeadlessCmsGqlApiUrl.js.map +1 -1
  139. package/utils/getLocaleCode.js +6 -16
  140. package/utils/getLocaleCode.js.map +1 -1
  141. package/utils/getPrerenderId.js +1 -7
  142. package/utils/getPrerenderId.js.map +1 -1
  143. package/utils/getTenantId.js +7 -13
  144. package/utils/getTenantId.js.map +1 -1
  145. package/utils/index.js +10 -115
  146. package/utils/index.js.map +1 -1
  147. package/utils/isLocalhost.js +4 -12
  148. package/utils/isLocalhost.js.map +1 -1
  149. package/utils/isPrerendering.js +1 -7
  150. package/utils/isPrerendering.js.map +1 -1
  151. package/utils/legacyPluginToReactComponent.js +5 -11
  152. package/utils/legacyPluginToReactComponent.js.map +1 -1
  153. package/core/AddRoute.d.ts +0 -21
  154. package/core/AddRoute.js +0 -21
  155. package/core/AddRoute.js.map +0 -1
package/types.js CHANGED
@@ -1,14 +1,14 @@
1
- "use strict";
1
+ import { Plugin } from "@webiny/plugins/types";
2
+ export { Plugin };
2
3
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Plugin", {
7
- enumerable: true,
8
- get: function get() {
9
- return _types.Plugin;
10
- }
11
- });
12
- var _types = require("@webiny/plugins/types");
4
+ /**
5
+ * "getImageSrc" has to be defined as a separate property, so its functionality can be reused outside of
6
+ * the Image component. This is ideal in cases where manual creation of image src is needed.
7
+ */
8
+
9
+ /**
10
+ * Enables registering new routes.
11
+ * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#route
12
+ */
13
13
 
14
14
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require"],"sources":["types.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ApolloClient } from \"apollo-client\";\nimport { CSSProperties } from \"react\";\n\nexport type GenericRecordKey = string | number | symbol;\n\nexport type GenericRecord<K extends GenericRecordKey = GenericRecordKey, V = any> = Record<K, V>;\n\nexport type UploadOptions = {\n apolloClient: ApolloClient<object>;\n onProgress?: (params: { sent: number; total: number; percentage: number }) => void;\n};\n\nexport type UiStatePlugin = Plugin & {\n type: \"ui-state\";\n render(): React.ReactElement;\n};\n\nexport interface UploadedFile {\n id: string;\n name: string;\n type: string;\n size: number;\n key: string;\n}\n\nexport type FileUploaderPlugin = Plugin & {\n type: \"file-uploader\";\n name: \"file-uploader\";\n upload(file: File, options: UploadOptions): Promise<UploadedFile>;\n};\n\nexport { Plugin };\n\nexport interface ImageProps {\n src: string;\n preset?: string;\n transform?: {\n [key: string]: any;\n };\n // \"auto\" is a special keyword - if present, plugins insert their own srcSet.\n srcSet?: { [key: string]: any } | \"auto\";\n className?: string;\n title?: string;\n alt?: string;\n style?: CSSProperties;\n width?: string | number;\n height?: string | number;\n}\n\n/**\n * \"getImageSrc\" has to be defined as a separate property, so its functionality can be reused outside of\n * the Image component. This is ideal in cases where manual creation of image src is needed.\n */\nexport type ImageComponentPlugin = Plugin & {\n type: \"image-component\";\n render: (props: ImageProps) => React.ReactElement;\n getImageSrc: (props?: Record<string, any>) => string;\n presets: { [key: string]: any };\n};\n\n/**\n * Enables registering new routes.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#route\n */\nexport type RoutePlugin = Plugin & {\n type: \"route\";\n route: React.ReactElement;\n};\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin"],"sources":["types.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ApolloClient } from \"apollo-client\";\nimport { CSSProperties } from \"react\";\n\nexport type GenericRecordKey = string | number | symbol;\n\nexport type GenericRecord<K extends GenericRecordKey = GenericRecordKey, V = any> = Record<K, V>;\n\nexport type UploadOptions = {\n apolloClient: ApolloClient<object>;\n onProgress?: (params: { sent: number; total: number; percentage: number }) => void;\n};\n\nexport type UiStatePlugin = Plugin & {\n type: \"ui-state\";\n render(): React.ReactElement;\n};\n\nexport interface UploadedFile {\n id: string;\n name: string;\n type: string;\n size: number;\n key: string;\n}\n\nexport type FileUploaderPlugin = Plugin & {\n type: \"file-uploader\";\n name: \"file-uploader\";\n upload(file: File, options: UploadOptions): Promise<UploadedFile>;\n};\n\nexport { Plugin };\n\nexport interface ImageProps {\n src: string;\n preset?: string;\n transform?: {\n [key: string]: any;\n };\n // \"auto\" is a special keyword - if present, plugins insert their own srcSet.\n srcSet?: { [key: string]: any } | \"auto\";\n className?: string;\n title?: string;\n alt?: string;\n style?: CSSProperties;\n width?: string | number;\n height?: string | number;\n}\n\n/**\n * \"getImageSrc\" has to be defined as a separate property, so its functionality can be reused outside of\n * the Image component. This is ideal in cases where manual creation of image src is needed.\n */\nexport type ImageComponentPlugin = Plugin & {\n type: \"image-component\";\n render: (props: ImageProps) => React.ReactElement;\n getImageSrc: (props?: Record<string, any>) => string;\n presets: { [key: string]: any };\n};\n\n/**\n * Enables registering new routes.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#route\n */\nexport type RoutePlugin = Plugin & {\n type: \"route\";\n route: React.ReactElement;\n};\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,uBAAuB;AAgC9C,SAASA,MAAM;;AAkBf;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,30 +1,21 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.createGenericContext = createGenericContext;
9
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _excluded = ["children"];
12
- function createGenericContext(name) {
13
- var GenericContext = /*#__PURE__*/(0, _react.createContext)(undefined);
14
- function Provider(_ref) {
15
- var children = _ref.children,
16
- props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
17
- return /*#__PURE__*/_react.default.createElement(GenericContext.Provider, {
1
+ import React, { createContext } from "react";
2
+ export function createGenericContext(name) {
3
+ const GenericContext = /*#__PURE__*/createContext(undefined);
4
+ function Provider({
5
+ children,
6
+ ...props
7
+ }) {
8
+ return /*#__PURE__*/React.createElement(GenericContext.Provider, {
18
9
  value: props
19
10
  }, children);
20
11
  }
21
- Provider.displayName = "".concat(name, "Provider");
12
+ Provider.displayName = `${name}Provider`;
22
13
  return {
23
- Provider: Provider,
24
- useHook: function useHook() {
25
- var context = _react.default.useContext(GenericContext);
14
+ Provider,
15
+ useHook: () => {
16
+ const context = React.useContext(GenericContext);
26
17
  if (!context) {
27
- throw Error("Context provider for \"".concat(name, "\" is missing in the component tree!"));
18
+ throw Error(`Context provider for "${name}" is missing in the component tree!`);
28
19
  }
29
20
  return context;
30
21
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_excluded","createGenericContext","name","GenericContext","createContext","undefined","Provider","_ref","children","props","_objectWithoutProperties2","default","createElement","value","displayName","concat","useHook","context","React","useContext","Error"],"sources":["createGenericContext.tsx"],"sourcesContent":["import React, { createContext } from \"react\";\n\nexport type CreateGenericContext<T = any> = T;\n\ntype GenericContextProviderProps<T> = T & {\n children: React.ReactNode;\n};\n\nexport function createGenericContext<T>(name: string) {\n const GenericContext = createContext<CreateGenericContext | undefined>(undefined);\n\n function Provider({ children, ...props }: GenericContextProviderProps<T>) {\n return <GenericContext.Provider value={props}>{children}</GenericContext.Provider>;\n }\n\n Provider.displayName = `${name}Provider`;\n\n return {\n Provider,\n useHook: () => {\n const context = React.useContext<CreateGenericContext<T>>(\n GenericContext as unknown as React.Context<CreateGenericContext<T>>\n );\n\n if (!context) {\n throw Error(`Context provider for \"${name}\" is missing in the component tree!`);\n }\n\n return context;\n }\n };\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA6C,IAAAC,SAAA;AAQtC,SAASC,oBAAoBA,CAAIC,IAAY,EAAE;EAClD,IAAMC,cAAc,gBAAG,IAAAC,oBAAa,EAAmCC,SAAS,CAAC;EAEjF,SAASC,QAAQA,CAAAC,IAAA,EAAyD;IAAA,IAAtDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;MAAKC,KAAK,OAAAC,yBAAA,CAAAC,OAAA,EAAAJ,IAAA,EAAAP,SAAA;IAClC,oBAAOH,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACT,cAAc,CAACG,QAAQ;MAACO,KAAK,EAAEJ;IAAM,GAAED,QAAkC,CAAC;EACtF;EAEAF,QAAQ,CAACQ,WAAW,MAAAC,MAAA,CAAMb,IAAI,aAAU;EAExC,OAAO;IACHI,QAAQ,EAARA,QAAQ;IACRU,OAAO,EAAE,SAATA,OAAOA,CAAA,EAAQ;MACX,IAAMC,OAAO,GAAGC,cAAK,CAACC,UAAU,CAC5BhB,cACJ,CAAC;MAED,IAAI,CAACc,OAAO,EAAE;QACV,MAAMG,KAAK,2BAAAL,MAAA,CAA0Bb,IAAI,yCAAqC,CAAC;MACnF;MAEA,OAAOe,OAAO;IAClB;EACJ,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"names":["React","createContext","createGenericContext","name","GenericContext","undefined","Provider","children","props","createElement","value","displayName","useHook","context","useContext","Error"],"sources":["createGenericContext.tsx"],"sourcesContent":["import React, { createContext } from \"react\";\n\nexport type CreateGenericContext<T = any> = T;\n\ntype GenericContextProviderProps<T> = T & {\n children: React.ReactNode;\n};\n\nexport function createGenericContext<T>(name: string) {\n const GenericContext = createContext<CreateGenericContext | undefined>(undefined);\n\n function Provider({ children, ...props }: GenericContextProviderProps<T>) {\n return <GenericContext.Provider value={props}>{children}</GenericContext.Provider>;\n }\n\n Provider.displayName = `${name}Provider`;\n\n return {\n Provider,\n useHook: () => {\n const context = React.useContext<CreateGenericContext<T>>(\n GenericContext as unknown as React.Context<CreateGenericContext<T>>\n );\n\n if (!context) {\n throw Error(`Context provider for \"${name}\" is missing in the component tree!`);\n }\n\n return context;\n }\n };\n}\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAQ5C,OAAO,SAASC,oBAAoBA,CAAIC,IAAY,EAAE;EAClD,MAAMC,cAAc,gBAAGH,aAAa,CAAmCI,SAAS,CAAC;EAEjF,SAASC,QAAQA,CAAC;IAAEC,QAAQ;IAAE,GAAGC;EAAsC,CAAC,EAAE;IACtE,oBAAOR,KAAA,CAAAS,aAAA,CAACL,cAAc,CAACE,QAAQ;MAACI,KAAK,EAAEF;IAAM,GAAED,QAAkC,CAAC;EACtF;EAEAD,QAAQ,CAACK,WAAW,GAAG,GAAGR,IAAI,UAAU;EAExC,OAAO;IACHG,QAAQ;IACRM,OAAO,EAAEA,CAAA,KAAM;MACX,MAAMC,OAAO,GAAGb,KAAK,CAACc,UAAU,CAC5BV,cACJ,CAAC;MAED,IAAI,CAACS,OAAO,EAAE;QACV,MAAME,KAAK,CAAC,yBAAyBZ,IAAI,qCAAqC,CAAC;MACnF;MAEA,OAAOU,OAAO;IAClB;EACJ,CAAC;AACL","ignoreList":[]}
@@ -1,20 +1,14 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createHashing = void 0;
7
- var createHashing = exports.createHashing = function createHashing(algorithm) {
8
- return async function (value) {
9
- var data = JSON.stringify(value);
10
- return new Promise(function (resolve) {
11
- window.crypto.subtle.digest(algorithm, new TextEncoder().encode(data)).then(function (encoded) {
12
- var hexes = [];
13
- var view = new DataView(encoded);
14
- for (var i = 0; i < view.byteLength; i += 4) {
1
+ export const createHashing = algorithm => {
2
+ return async value => {
3
+ const data = JSON.stringify(value);
4
+ return new Promise(resolve => {
5
+ window.crypto.subtle.digest(algorithm, new TextEncoder().encode(data)).then(encoded => {
6
+ const hexes = [];
7
+ const view = new DataView(encoded);
8
+ for (let i = 0; i < view.byteLength; i += 4) {
15
9
  hexes.push(("00000000" + view.getUint32(i).toString(16)).slice(-8));
16
10
  }
17
- var hash = hexes.join("");
11
+ const hash = hexes.join("");
18
12
  resolve(hash);
19
13
  });
20
14
  });
@@ -1 +1 @@
1
- {"version":3,"names":["createHashing","exports","algorithm","value","data","JSON","stringify","Promise","resolve","window","crypto","subtle","digest","TextEncoder","encode","then","encoded","hexes","view","DataView","i","byteLength","push","getUint32","toString","slice","hash","join"],"sources":["createHashing.ts"],"sourcesContent":["export type IHashingAlgorithm = \"SHA-1\" | \"SHA-256\" | \"SHA-512\";\n\nexport const createHashing = (algorithm: IHashingAlgorithm) => {\n return async (value: unknown) => {\n const data = JSON.stringify(value);\n return new Promise<string>(resolve => {\n window.crypto.subtle.digest(algorithm, new TextEncoder().encode(data)).then(encoded => {\n const hexes: string[] = [];\n const view = new DataView(encoded);\n for (let i = 0; i < view.byteLength; i += 4) {\n hexes.push((\"00000000\" + view.getUint32(i).toString(16)).slice(-8));\n }\n const hash = hexes.join(\"\");\n resolve(hash);\n });\n });\n };\n};\n"],"mappings":";;;;;;AAEO,IAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,SAAhBA,aAAaA,CAAIE,SAA4B,EAAK;EAC3D,OAAO,gBAAOC,KAAc,EAAK;IAC7B,IAAMC,IAAI,GAAGC,IAAI,CAACC,SAAS,CAACH,KAAK,CAAC;IAClC,OAAO,IAAII,OAAO,CAAS,UAAAC,OAAO,EAAI;MAClCC,MAAM,CAACC,MAAM,CAACC,MAAM,CAACC,MAAM,CAACV,SAAS,EAAE,IAAIW,WAAW,CAAC,CAAC,CAACC,MAAM,CAACV,IAAI,CAAC,CAAC,CAACW,IAAI,CAAC,UAAAC,OAAO,EAAI;QACnF,IAAMC,KAAe,GAAG,EAAE;QAC1B,IAAMC,IAAI,GAAG,IAAIC,QAAQ,CAACH,OAAO,CAAC;QAClC,KAAK,IAAII,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,UAAU,EAAED,CAAC,IAAI,CAAC,EAAE;UACzCH,KAAK,CAACK,IAAI,CAAC,CAAC,UAAU,GAAGJ,IAAI,CAACK,SAAS,CAACH,CAAC,CAAC,CAACI,QAAQ,CAAC,EAAE,CAAC,EAAEC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE;QACA,IAAMC,IAAI,GAAGT,KAAK,CAACU,IAAI,CAAC,EAAE,CAAC;QAC3BnB,OAAO,CAACkB,IAAI,CAAC;MACjB,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createHashing","algorithm","value","data","JSON","stringify","Promise","resolve","window","crypto","subtle","digest","TextEncoder","encode","then","encoded","hexes","view","DataView","i","byteLength","push","getUint32","toString","slice","hash","join"],"sources":["createHashing.ts"],"sourcesContent":["export type IHashingAlgorithm = \"SHA-1\" | \"SHA-256\" | \"SHA-512\";\n\nexport const createHashing = (algorithm: IHashingAlgorithm) => {\n return async (value: unknown) => {\n const data = JSON.stringify(value);\n return new Promise<string>(resolve => {\n window.crypto.subtle.digest(algorithm, new TextEncoder().encode(data)).then(encoded => {\n const hexes: string[] = [];\n const view = new DataView(encoded);\n for (let i = 0; i < view.byteLength; i += 4) {\n hexes.push((\"00000000\" + view.getUint32(i).toString(16)).slice(-8));\n }\n const hash = hexes.join(\"\");\n resolve(hash);\n });\n });\n };\n};\n"],"mappings":"AAEA,OAAO,MAAMA,aAAa,GAAIC,SAA4B,IAAK;EAC3D,OAAO,MAAOC,KAAc,IAAK;IAC7B,MAAMC,IAAI,GAAGC,IAAI,CAACC,SAAS,CAACH,KAAK,CAAC;IAClC,OAAO,IAAII,OAAO,CAASC,OAAO,IAAI;MAClCC,MAAM,CAACC,MAAM,CAACC,MAAM,CAACC,MAAM,CAACV,SAAS,EAAE,IAAIW,WAAW,CAAC,CAAC,CAACC,MAAM,CAACV,IAAI,CAAC,CAAC,CAACW,IAAI,CAACC,OAAO,IAAI;QACnF,MAAMC,KAAe,GAAG,EAAE;QAC1B,MAAMC,IAAI,GAAG,IAAIC,QAAQ,CAACH,OAAO,CAAC;QAClC,KAAK,IAAII,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,UAAU,EAAED,CAAC,IAAI,CAAC,EAAE;UACzCH,KAAK,CAACK,IAAI,CAAC,CAAC,UAAU,GAAGJ,IAAI,CAACK,SAAS,CAACH,CAAC,CAAC,CAACI,QAAQ,CAAC,EAAE,CAAC,EAAEC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE;QACA,MAAMC,IAAI,GAAGT,KAAK,CAACU,IAAI,CAAC,EAAE,CAAC;QAC3BnB,OAAO,CAACkB,IAAI,CAAC;MACjB,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,11 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getApiUrl = void 0;
7
- var getApiUrl = exports.getApiUrl = function getApiUrl() {
8
- var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
1
+ export const getApiUrl = (path = "") => {
9
2
  return process.env.REACT_APP_API_URL + path;
10
3
  };
11
4
 
@@ -1 +1 @@
1
- {"version":3,"names":["getApiUrl","exports","path","arguments","length","undefined","process","env","REACT_APP_API_URL"],"sources":["getApiUrl.ts"],"sourcesContent":["export const getApiUrl = (path = \"\"): string => {\n return process.env.REACT_APP_API_URL + path;\n};\n"],"mappings":";;;;;;AAAO,IAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,SAAZA,SAASA,CAAA,EAA0B;EAAA,IAAtBE,IAAI,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAC/B,OAAOG,OAAO,CAACC,GAAG,CAACC,iBAAiB,GAAGN,IAAI;AAC/C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getApiUrl","path","process","env","REACT_APP_API_URL"],"sources":["getApiUrl.ts"],"sourcesContent":["export const getApiUrl = (path = \"\"): string => {\n return process.env.REACT_APP_API_URL + path;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAGA,CAACC,IAAI,GAAG,EAAE,KAAa;EAC5C,OAAOC,OAAO,CAACC,GAAG,CAACC,iBAAiB,GAAGH,IAAI;AAC/C,CAAC","ignoreList":[]}
@@ -1,12 +1,6 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getGqlApiUrl = void 0;
7
- var _getApiUrl = require("./getApiUrl");
8
- var getGqlApiUrl = exports.getGqlApiUrl = function getGqlApiUrl() {
9
- return (0, _getApiUrl.getApiUrl)("/graphql");
1
+ import { getApiUrl } from "./getApiUrl";
2
+ export const getGqlApiUrl = () => {
3
+ return getApiUrl("/graphql");
10
4
  };
11
5
 
12
6
  //# sourceMappingURL=getGqlApiUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_getApiUrl","require","getGqlApiUrl","exports","getApiUrl"],"sources":["getGqlApiUrl.ts"],"sourcesContent":["import { getApiUrl } from \"./getApiUrl\";\n\nexport const getGqlApiUrl = (): string => {\n return getApiUrl(\"/graphql\");\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,IAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,SAAfA,YAAYA,CAAA,EAAiB;EACtC,OAAO,IAAAE,oBAAS,EAAC,UAAU,CAAC;AAChC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getApiUrl","getGqlApiUrl"],"sources":["getGqlApiUrl.ts"],"sourcesContent":["import { getApiUrl } from \"./getApiUrl\";\n\nexport const getGqlApiUrl = (): string => {\n return getApiUrl(\"/graphql\");\n};\n"],"mappings":"AAAA,SAASA,SAAS;AAElB,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAc;EACtC,OAAOD,SAAS,CAAC,UAAU,CAAC;AAChC,CAAC","ignoreList":[]}
@@ -1,17 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getHeadlessCmsGqlApiUrl = void 0;
7
- var _getApiUrl = require("./getApiUrl");
8
- var _getLocaleCode = require("./getLocaleCode");
9
- var getHeadlessCmsGqlApiUrl = exports.getHeadlessCmsGqlApiUrl = function getHeadlessCmsGqlApiUrl() {
10
- var locale = (0, _getLocaleCode.getLocaleCode)();
1
+ import { getApiUrl } from "./getApiUrl";
2
+ import { getLocaleCode } from "./getLocaleCode";
3
+ export const getHeadlessCmsGqlApiUrl = () => {
4
+ const locale = getLocaleCode();
11
5
  return {
12
- preview: (0, _getApiUrl.getApiUrl)("/cms/preview/".concat(locale)),
13
- read: (0, _getApiUrl.getApiUrl)("/cms/read/".concat(locale)),
14
- manage: (0, _getApiUrl.getApiUrl)("/cms/manage/".concat(locale))
6
+ preview: getApiUrl(`/cms/preview/${locale}`),
7
+ read: getApiUrl(`/cms/read/${locale}`),
8
+ manage: getApiUrl(`/cms/manage/${locale}`)
15
9
  };
16
10
  };
17
11
 
@@ -1 +1 @@
1
- {"version":3,"names":["_getApiUrl","require","_getLocaleCode","getHeadlessCmsGqlApiUrl","exports","locale","getLocaleCode","preview","getApiUrl","concat","read","manage"],"sources":["getHeadlessCmsGqlApiUrl.ts"],"sourcesContent":["import { getApiUrl } from \"./getApiUrl\";\nimport { getLocaleCode } from \"./getLocaleCode\";\n\nexport const getHeadlessCmsGqlApiUrl = (): { preview: string; read: string; manage: string } => {\n const locale = getLocaleCode();\n return {\n preview: getApiUrl(`/cms/preview/${locale}`),\n read: getApiUrl(`/cms/read/${locale}`),\n manage: getApiUrl(`/cms/manage/${locale}`)\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEO,IAAME,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,SAA1BA,uBAAuBA,CAAA,EAA4D;EAC5F,IAAME,MAAM,GAAG,IAAAC,4BAAa,EAAC,CAAC;EAC9B,OAAO;IACHC,OAAO,EAAE,IAAAC,oBAAS,kBAAAC,MAAA,CAAiBJ,MAAM,CAAE,CAAC;IAC5CK,IAAI,EAAE,IAAAF,oBAAS,eAAAC,MAAA,CAAcJ,MAAM,CAAE,CAAC;IACtCM,MAAM,EAAE,IAAAH,oBAAS,iBAAAC,MAAA,CAAgBJ,MAAM,CAAE;EAC7C,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getApiUrl","getLocaleCode","getHeadlessCmsGqlApiUrl","locale","preview","read","manage"],"sources":["getHeadlessCmsGqlApiUrl.ts"],"sourcesContent":["import { getApiUrl } from \"./getApiUrl\";\nimport { getLocaleCode } from \"./getLocaleCode\";\n\nexport const getHeadlessCmsGqlApiUrl = (): { preview: string; read: string; manage: string } => {\n const locale = getLocaleCode();\n return {\n preview: getApiUrl(`/cms/preview/${locale}`),\n read: getApiUrl(`/cms/read/${locale}`),\n manage: getApiUrl(`/cms/manage/${locale}`)\n };\n};\n"],"mappings":"AAAA,SAASA,SAAS;AAClB,SAASC,aAAa;AAEtB,OAAO,MAAMC,uBAAuB,GAAGA,CAAA,KAAyD;EAC5F,MAAMC,MAAM,GAAGF,aAAa,CAAC,CAAC;EAC9B,OAAO;IACHG,OAAO,EAAEJ,SAAS,CAAC,gBAAgBG,MAAM,EAAE,CAAC;IAC5CE,IAAI,EAAEL,SAAS,CAAC,aAAaG,MAAM,EAAE,CAAC;IACtCG,MAAM,EAAEN,SAAS,CAAC,eAAeG,MAAM,EAAE;EAC7C,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,15 +1,7 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.getLocaleCode = void 0;
8
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
- var _isLocalhost = require("./isLocalhost");
10
- var getLocaleCode = exports.getLocaleCode = function getLocaleCode() {
1
+ import { isLocalhost } from "./isLocalhost";
2
+ export const getLocaleCode = () => {
11
3
  // 1. Get locale via the `__locale` query param. Useful when doing page previews.
12
- var locale = new URLSearchParams(location.search).get("__locale");
4
+ let locale = new URLSearchParams(location.search).get("__locale");
13
5
  if (locale) {
14
6
  return locale;
15
7
  }
@@ -21,20 +13,18 @@ var getLocaleCode = exports.getLocaleCode = function getLocaleCode() {
21
13
  }
22
14
 
23
15
  // 3. Get locale via `window.localStorage.webiny_i18n_locale`. Used within the Admin app.
24
- var localesByContext = window.localStorage.webiny_i18n_locale;
16
+ const localesByContext = window.localStorage.webiny_i18n_locale;
25
17
  if (localesByContext) {
26
18
  // The `localesByContext` is a string that contains locales for all available
27
19
  // "locale contexts", for example: `default:en-US;content:en-US;`. Here, we
28
20
  // want to extract the locale for the "content" locale context.
29
- var _localesByContext$mat = localesByContext.match(/content:(.*?);/),
30
- _localesByContext$mat2 = (0, _slicedToArray2.default)(_localesByContext$mat, 2),
31
- matchedLocale = _localesByContext$mat2[1];
21
+ const [, matchedLocale] = localesByContext.match(/content:(.*?);/);
32
22
  return matchedLocale;
33
23
  }
34
24
 
35
25
  // 4. Finally, for development purposes, we take the `WEBINY_WEBSITE_LOCALE_CODE`
36
26
  // and `WEBINY_ADMIN_LOCALE_CODE` environment variables into consideration.
37
- if ((0, _isLocalhost.isLocalhost)()) {
27
+ if (isLocalhost()) {
38
28
  return process.env.WEBINY_WEBSITE_LOCALE_CODE || process.env.WEBINY_ADMIN_LOCALE_CODE || null;
39
29
  }
40
30
  return null;
@@ -1 +1 @@
1
- {"version":3,"names":["_isLocalhost","require","getLocaleCode","exports","locale","URLSearchParams","location","search","get","window","__PS_RENDER_LOCALE__","localesByContext","localStorage","webiny_i18n_locale","_localesByContext$mat","match","_localesByContext$mat2","_slicedToArray2","default","matchedLocale","isLocalhost","process","env","WEBINY_WEBSITE_LOCALE_CODE","WEBINY_ADMIN_LOCALE_CODE"],"sources":["getLocaleCode.ts"],"sourcesContent":["import { isLocalhost } from \"./isLocalhost\";\n\ndeclare global {\n interface Window {\n __PS_RENDER_LOCALE__: string;\n }\n}\n\nexport const getLocaleCode = (): string | null => {\n // 1. Get locale via the `__locale` query param. Useful when doing page previews.\n let locale = new URLSearchParams(location.search).get(\"__locale\");\n if (locale) {\n return locale;\n }\n\n // 2. Get locale via `window.__PS_RENDER_LOCALE__`. Used with prerendered pages.\n locale = window.__PS_RENDER_LOCALE__;\n if (locale) {\n return locale;\n }\n\n // 3. Get locale via `window.localStorage.webiny_i18n_locale`. Used within the Admin app.\n const localesByContext = window.localStorage.webiny_i18n_locale;\n if (localesByContext) {\n // The `localesByContext` is a string that contains locales for all available\n // \"locale contexts\", for example: `default:en-US;content:en-US;`. Here, we\n // want to extract the locale for the \"content\" locale context.\n const [, matchedLocale] = localesByContext.match(/content:(.*?);/);\n return matchedLocale;\n }\n\n // 4. Finally, for development purposes, we take the `WEBINY_WEBSITE_LOCALE_CODE`\n // and `WEBINY_ADMIN_LOCALE_CODE` environment variables into consideration.\n if (isLocalhost()) {\n return (\n process.env.WEBINY_WEBSITE_LOCALE_CODE || process.env.WEBINY_ADMIN_LOCALE_CODE || null\n );\n }\n\n return null;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQO,IAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,SAAhBA,aAAaA,CAAA,EAAwB;EAC9C;EACA,IAAIE,MAAM,GAAG,IAAIC,eAAe,CAACC,QAAQ,CAACC,MAAM,CAAC,CAACC,GAAG,CAAC,UAAU,CAAC;EACjE,IAAIJ,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACAA,MAAM,GAAGK,MAAM,CAACC,oBAAoB;EACpC,IAAIN,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACA,IAAMO,gBAAgB,GAAGF,MAAM,CAACG,YAAY,CAACC,kBAAkB;EAC/D,IAAIF,gBAAgB,EAAE;IAClB;IACA;IACA;IACA,IAAAG,qBAAA,GAA0BH,gBAAgB,CAACI,KAAK,CAAC,gBAAgB,CAAC;MAAAC,sBAAA,OAAAC,eAAA,CAAAC,OAAA,EAAAJ,qBAAA;MAAzDK,aAAa,GAAAH,sBAAA;IACtB,OAAOG,aAAa;EACxB;;EAEA;EACA;EACA,IAAI,IAAAC,wBAAW,EAAC,CAAC,EAAE;IACf,OACIC,OAAO,CAACC,GAAG,CAACC,0BAA0B,IAAIF,OAAO,CAACC,GAAG,CAACE,wBAAwB,IAAI,IAAI;EAE9F;EAEA,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["isLocalhost","getLocaleCode","locale","URLSearchParams","location","search","get","window","__PS_RENDER_LOCALE__","localesByContext","localStorage","webiny_i18n_locale","matchedLocale","match","process","env","WEBINY_WEBSITE_LOCALE_CODE","WEBINY_ADMIN_LOCALE_CODE"],"sources":["getLocaleCode.ts"],"sourcesContent":["import { isLocalhost } from \"./isLocalhost\";\n\ndeclare global {\n interface Window {\n __PS_RENDER_LOCALE__: string;\n }\n}\n\nexport const getLocaleCode = (): string | null => {\n // 1. Get locale via the `__locale` query param. Useful when doing page previews.\n let locale = new URLSearchParams(location.search).get(\"__locale\");\n if (locale) {\n return locale;\n }\n\n // 2. Get locale via `window.__PS_RENDER_LOCALE__`. Used with prerendered pages.\n locale = window.__PS_RENDER_LOCALE__;\n if (locale) {\n return locale;\n }\n\n // 3. Get locale via `window.localStorage.webiny_i18n_locale`. Used within the Admin app.\n const localesByContext = window.localStorage.webiny_i18n_locale;\n if (localesByContext) {\n // The `localesByContext` is a string that contains locales for all available\n // \"locale contexts\", for example: `default:en-US;content:en-US;`. Here, we\n // want to extract the locale for the \"content\" locale context.\n const [, matchedLocale] = localesByContext.match(/content:(.*?);/);\n return matchedLocale;\n }\n\n // 4. Finally, for development purposes, we take the `WEBINY_WEBSITE_LOCALE_CODE`\n // and `WEBINY_ADMIN_LOCALE_CODE` environment variables into consideration.\n if (isLocalhost()) {\n return (\n process.env.WEBINY_WEBSITE_LOCALE_CODE || process.env.WEBINY_ADMIN_LOCALE_CODE || null\n );\n }\n\n return null;\n};\n"],"mappings":"AAAA,SAASA,WAAW;AAQpB,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAqB;EAC9C;EACA,IAAIC,MAAM,GAAG,IAAIC,eAAe,CAACC,QAAQ,CAACC,MAAM,CAAC,CAACC,GAAG,CAAC,UAAU,CAAC;EACjE,IAAIJ,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACAA,MAAM,GAAGK,MAAM,CAACC,oBAAoB;EACpC,IAAIN,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACA,MAAMO,gBAAgB,GAAGF,MAAM,CAACG,YAAY,CAACC,kBAAkB;EAC/D,IAAIF,gBAAgB,EAAE;IAClB;IACA;IACA;IACA,MAAM,GAAGG,aAAa,CAAC,GAAGH,gBAAgB,CAACI,KAAK,CAAC,gBAAgB,CAAC;IAClE,OAAOD,aAAa;EACxB;;EAEA;EACA;EACA,IAAIZ,WAAW,CAAC,CAAC,EAAE;IACf,OACIc,OAAO,CAACC,GAAG,CAACC,0BAA0B,IAAIF,OAAO,CAACC,GAAG,CAACE,wBAAwB,IAAI,IAAI;EAE9F;EAEA,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getPrerenderId = void 0;
7
- var getPrerenderId = exports.getPrerenderId = function getPrerenderId() {
1
+ export const getPrerenderId = () => {
8
2
  return window["__PS_RENDER_ID__"] || null;
9
3
  };
10
4
 
@@ -1 +1 @@
1
- {"version":3,"names":["getPrerenderId","exports","window"],"sources":["getPrerenderId.ts"],"sourcesContent":["declare global {\n interface Window {\n __PS_RENDER_ID__: string;\n }\n}\n\nexport const getPrerenderId = (): string | null => {\n return window[\"__PS_RENDER_ID__\"] || null;\n};\n"],"mappings":";;;;;;AAMO,IAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAA,EAAwB;EAC/C,OAAOE,MAAM,CAAC,kBAAkB,CAAC,IAAI,IAAI;AAC7C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getPrerenderId","window"],"sources":["getPrerenderId.ts"],"sourcesContent":["declare global {\n interface Window {\n __PS_RENDER_ID__: string;\n }\n}\n\nexport const getPrerenderId = (): string | null => {\n return window[\"__PS_RENDER_ID__\"] || null;\n};\n"],"mappings":"AAMA,OAAO,MAAMA,cAAc,GAAGA,CAAA,KAAqB;EAC/C,OAAOC,MAAM,CAAC,kBAAkB,CAAC,IAAI,IAAI;AAC7C,CAAC","ignoreList":[]}
@@ -1,15 +1,9 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTenantId = void 0;
7
- var _isLocalhost = require("./isLocalhost");
8
- var getTenantId = exports.getTenantId = function getTenantId() {
9
- var urlSearchParams = new URLSearchParams(location.search);
1
+ import { isLocalhost } from "./isLocalhost";
2
+ export const getTenantId = () => {
3
+ const urlSearchParams = new URLSearchParams(location.search);
10
4
 
11
5
  // 1. Get tenant via the `__tenant` query param. Useful when doing page previews.
12
- var tenant = urlSearchParams.get("__tenant");
6
+ let tenant = urlSearchParams.get("__tenant");
13
7
  if (tenant) {
14
8
  return tenant;
15
9
  }
@@ -30,11 +24,11 @@ var getTenantId = exports.getTenantId = function getTenantId() {
30
24
  tenant = window.localStorage.webiny_tenant;
31
25
  if (tenant) {
32
26
  try {
33
- var value = JSON.parse(tenant);
27
+ const value = JSON.parse(tenant);
34
28
  if (value) {
35
29
  return value;
36
30
  }
37
- } catch (_unused) {
31
+ } catch {
38
32
  // do nothing
39
33
  }
40
34
  return tenant;
@@ -42,7 +36,7 @@ var getTenantId = exports.getTenantId = function getTenantId() {
42
36
 
43
37
  // 4. Finally, for development purposes, we take the `WEBINY_WEBSITE_TENANT_ID`
44
38
  // and `WEBINY_ADMIN_TENANT_ID` environment variables into consideration.
45
- if ((0, _isLocalhost.isLocalhost)()) {
39
+ if (isLocalhost()) {
46
40
  return process.env.WEBINY_WEBSITE_TENANT_ID || process.env.WEBINY_ADMIN_TENANT_ID || null;
47
41
  }
48
42
  return null;
@@ -1 +1 @@
1
- {"version":3,"names":["_isLocalhost","require","getTenantId","exports","urlSearchParams","URLSearchParams","location","search","tenant","get","window","__PS_RENDER_TENANT__","localStorage","webiny_tenant","value","JSON","parse","_unused","isLocalhost","process","env","WEBINY_WEBSITE_TENANT_ID","WEBINY_ADMIN_TENANT_ID"],"sources":["getTenantId.ts"],"sourcesContent":["import { isLocalhost } from \"~/utils/isLocalhost\";\n\ndeclare global {\n interface Window {\n __PS_RENDER_TENANT__: string;\n }\n}\n\nexport const getTenantId = (): string | null => {\n const urlSearchParams = new URLSearchParams(location.search);\n\n // 1. Get tenant via the `__tenant` query param. Useful when doing page previews.\n let tenant = urlSearchParams.get(\"__tenant\");\n if (tenant) {\n return tenant;\n }\n\n // 1. Get tenant via the `tenantId` query param. Useful within the Admin app.\n tenant = urlSearchParams.get(\"tenantId\");\n if (tenant) {\n return tenant;\n }\n\n // 2. Get tenant via `window.__PS_RENDER_TENANT__`. Used with prerendered pages.\n tenant = window.__PS_RENDER_TENANT__;\n if (tenant) {\n return tenant;\n }\n\n // 3. Get tenant via `window.localStorage.webiny_tenant`. Used within the Admin app.\n tenant = window.localStorage.webiny_tenant;\n if (tenant) {\n try {\n const value = JSON.parse(tenant);\n if (value) {\n return value;\n }\n } catch {\n // do nothing\n }\n return tenant;\n }\n\n // 4. Finally, for development purposes, we take the `WEBINY_WEBSITE_TENANT_ID`\n // and `WEBINY_ADMIN_TENANT_ID` environment variables into consideration.\n if (isLocalhost()) {\n return process.env.WEBINY_WEBSITE_TENANT_ID || process.env.WEBINY_ADMIN_TENANT_ID || null;\n }\n\n return null;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQO,IAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,SAAdA,WAAWA,CAAA,EAAwB;EAC5C,IAAME,eAAe,GAAG,IAAIC,eAAe,CAACC,QAAQ,CAACC,MAAM,CAAC;;EAE5D;EACA,IAAIC,MAAM,GAAGJ,eAAe,CAACK,GAAG,CAAC,UAAU,CAAC;EAC5C,IAAID,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACAA,MAAM,GAAGJ,eAAe,CAACK,GAAG,CAAC,UAAU,CAAC;EACxC,IAAID,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACAA,MAAM,GAAGE,MAAM,CAACC,oBAAoB;EACpC,IAAIH,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACAA,MAAM,GAAGE,MAAM,CAACE,YAAY,CAACC,aAAa;EAC1C,IAAIL,MAAM,EAAE;IACR,IAAI;MACA,IAAMM,KAAK,GAAGC,IAAI,CAACC,KAAK,CAACR,MAAM,CAAC;MAChC,IAAIM,KAAK,EAAE;QACP,OAAOA,KAAK;MAChB;IACJ,CAAC,CAAC,OAAAG,OAAA,EAAM;MACJ;IAAA;IAEJ,OAAOT,MAAM;EACjB;;EAEA;EACA;EACA,IAAI,IAAAU,wBAAW,EAAC,CAAC,EAAE;IACf,OAAOC,OAAO,CAACC,GAAG,CAACC,wBAAwB,IAAIF,OAAO,CAACC,GAAG,CAACE,sBAAsB,IAAI,IAAI;EAC7F;EAEA,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["isLocalhost","getTenantId","urlSearchParams","URLSearchParams","location","search","tenant","get","window","__PS_RENDER_TENANT__","localStorage","webiny_tenant","value","JSON","parse","process","env","WEBINY_WEBSITE_TENANT_ID","WEBINY_ADMIN_TENANT_ID"],"sources":["getTenantId.ts"],"sourcesContent":["import { isLocalhost } from \"~/utils/isLocalhost\";\n\ndeclare global {\n interface Window {\n __PS_RENDER_TENANT__: string;\n }\n}\n\nexport const getTenantId = (): string | null => {\n const urlSearchParams = new URLSearchParams(location.search);\n\n // 1. Get tenant via the `__tenant` query param. Useful when doing page previews.\n let tenant = urlSearchParams.get(\"__tenant\");\n if (tenant) {\n return tenant;\n }\n\n // 1. Get tenant via the `tenantId` query param. Useful within the Admin app.\n tenant = urlSearchParams.get(\"tenantId\");\n if (tenant) {\n return tenant;\n }\n\n // 2. Get tenant via `window.__PS_RENDER_TENANT__`. Used with prerendered pages.\n tenant = window.__PS_RENDER_TENANT__;\n if (tenant) {\n return tenant;\n }\n\n // 3. Get tenant via `window.localStorage.webiny_tenant`. Used within the Admin app.\n tenant = window.localStorage.webiny_tenant;\n if (tenant) {\n try {\n const value = JSON.parse(tenant);\n if (value) {\n return value;\n }\n } catch {\n // do nothing\n }\n return tenant;\n }\n\n // 4. Finally, for development purposes, we take the `WEBINY_WEBSITE_TENANT_ID`\n // and `WEBINY_ADMIN_TENANT_ID` environment variables into consideration.\n if (isLocalhost()) {\n return process.env.WEBINY_WEBSITE_TENANT_ID || process.env.WEBINY_ADMIN_TENANT_ID || null;\n }\n\n return null;\n};\n"],"mappings":"AAAA,SAASA,WAAW;AAQpB,OAAO,MAAMC,WAAW,GAAGA,CAAA,KAAqB;EAC5C,MAAMC,eAAe,GAAG,IAAIC,eAAe,CAACC,QAAQ,CAACC,MAAM,CAAC;;EAE5D;EACA,IAAIC,MAAM,GAAGJ,eAAe,CAACK,GAAG,CAAC,UAAU,CAAC;EAC5C,IAAID,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACAA,MAAM,GAAGJ,eAAe,CAACK,GAAG,CAAC,UAAU,CAAC;EACxC,IAAID,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACAA,MAAM,GAAGE,MAAM,CAACC,oBAAoB;EACpC,IAAIH,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;;EAEA;EACAA,MAAM,GAAGE,MAAM,CAACE,YAAY,CAACC,aAAa;EAC1C,IAAIL,MAAM,EAAE;IACR,IAAI;MACA,MAAMM,KAAK,GAAGC,IAAI,CAACC,KAAK,CAACR,MAAM,CAAC;MAChC,IAAIM,KAAK,EAAE;QACP,OAAOA,KAAK;MAChB;IACJ,CAAC,CAAC,MAAM;MACJ;IAAA;IAEJ,OAAON,MAAM;EACjB;;EAEA;EACA;EACA,IAAIN,WAAW,CAAC,CAAC,EAAE;IACf,OAAOe,OAAO,CAACC,GAAG,CAACC,wBAAwB,IAAIF,OAAO,CAACC,GAAG,CAACE,sBAAsB,IAAI,IAAI;EAC7F;EAEA,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
package/utils/index.js CHANGED
@@ -1,117 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _createHashing = require("./createHashing");
7
- Object.keys(_createHashing).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _createHashing[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _createHashing[key];
14
- }
15
- });
16
- });
17
- var _getApiUrl = require("./getApiUrl");
18
- Object.keys(_getApiUrl).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _getApiUrl[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _getApiUrl[key];
25
- }
26
- });
27
- });
28
- var _getGqlApiUrl = require("./getGqlApiUrl");
29
- Object.keys(_getGqlApiUrl).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _getGqlApiUrl[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function get() {
35
- return _getGqlApiUrl[key];
36
- }
37
- });
38
- });
39
- var _getHeadlessCmsGqlApiUrl = require("./getHeadlessCmsGqlApiUrl");
40
- Object.keys(_getHeadlessCmsGqlApiUrl).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _getHeadlessCmsGqlApiUrl[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function get() {
46
- return _getHeadlessCmsGqlApiUrl[key];
47
- }
48
- });
49
- });
50
- var _getLocaleCode = require("./getLocaleCode");
51
- Object.keys(_getLocaleCode).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _getLocaleCode[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function get() {
57
- return _getLocaleCode[key];
58
- }
59
- });
60
- });
61
- var _getPrerenderId = require("./getPrerenderId");
62
- Object.keys(_getPrerenderId).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _getPrerenderId[key]) return;
65
- Object.defineProperty(exports, key, {
66
- enumerable: true,
67
- get: function get() {
68
- return _getPrerenderId[key];
69
- }
70
- });
71
- });
72
- var _getTenantId = require("./getTenantId");
73
- Object.keys(_getTenantId).forEach(function (key) {
74
- if (key === "default" || key === "__esModule") return;
75
- if (key in exports && exports[key] === _getTenantId[key]) return;
76
- Object.defineProperty(exports, key, {
77
- enumerable: true,
78
- get: function get() {
79
- return _getTenantId[key];
80
- }
81
- });
82
- });
83
- var _isLocalhost = require("./isLocalhost");
84
- Object.keys(_isLocalhost).forEach(function (key) {
85
- if (key === "default" || key === "__esModule") return;
86
- if (key in exports && exports[key] === _isLocalhost[key]) return;
87
- Object.defineProperty(exports, key, {
88
- enumerable: true,
89
- get: function get() {
90
- return _isLocalhost[key];
91
- }
92
- });
93
- });
94
- var _isPrerendering = require("./isPrerendering");
95
- Object.keys(_isPrerendering).forEach(function (key) {
96
- if (key === "default" || key === "__esModule") return;
97
- if (key in exports && exports[key] === _isPrerendering[key]) return;
98
- Object.defineProperty(exports, key, {
99
- enumerable: true,
100
- get: function get() {
101
- return _isPrerendering[key];
102
- }
103
- });
104
- });
105
- var _legacyPluginToReactComponent = require("./legacyPluginToReactComponent");
106
- Object.keys(_legacyPluginToReactComponent).forEach(function (key) {
107
- if (key === "default" || key === "__esModule") return;
108
- if (key in exports && exports[key] === _legacyPluginToReactComponent[key]) return;
109
- Object.defineProperty(exports, key, {
110
- enumerable: true,
111
- get: function get() {
112
- return _legacyPluginToReactComponent[key];
113
- }
114
- });
115
- });
1
+ export * from "./createHashing";
2
+ export * from "./getApiUrl";
3
+ export * from "./getGqlApiUrl";
4
+ export * from "./getHeadlessCmsGqlApiUrl";
5
+ export * from "./getLocaleCode";
6
+ export * from "./getPrerenderId";
7
+ export * from "./getTenantId";
8
+ export * from "./isLocalhost";
9
+ export * from "./isPrerendering";
10
+ export * from "./legacyPluginToReactComponent";
116
11
 
117
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_createHashing","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getApiUrl","_getGqlApiUrl","_getHeadlessCmsGqlApiUrl","_getLocaleCode","_getPrerenderId","_getTenantId","_isLocalhost","_isPrerendering","_legacyPluginToReactComponent"],"sources":["index.ts"],"sourcesContent":["export * from \"./createHashing\";\nexport * from \"./getApiUrl\";\nexport * from \"./getGqlApiUrl\";\nexport * from \"./getHeadlessCmsGqlApiUrl\";\nexport * from \"./getLocaleCode\";\nexport * from \"./getPrerenderId\";\nexport * from \"./getTenantId\";\nexport * from \"./isLocalhost\";\nexport * from \"./isPrerendering\";\nexport * from \"./legacyPluginToReactComponent\";\n"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,aAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,aAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,aAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,aAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,wBAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,wBAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,wBAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAG,wBAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,cAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,cAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,cAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAI,cAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,eAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,eAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,eAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAK,eAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,YAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,YAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,YAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAM,YAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,YAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,YAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,YAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAO,YAAA,CAAAX,GAAA;IAAA;EAAA;AAAA;AACA,IAAAY,eAAA,GAAAhB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAc,eAAA,EAAAb,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAY,eAAA,CAAAZ,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAQ,eAAA,CAAAZ,GAAA;IAAA;EAAA;AAAA;AACA,IAAAa,6BAAA,GAAAjB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAe,6BAAA,EAAAd,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAa,6BAAA,CAAAb,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAS,6BAAA,CAAAb,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./createHashing\";\nexport * from \"./getApiUrl\";\nexport * from \"./getGqlApiUrl\";\nexport * from \"./getHeadlessCmsGqlApiUrl\";\nexport * from \"./getLocaleCode\";\nexport * from \"./getPrerenderId\";\nexport * from \"./getTenantId\";\nexport * from \"./isLocalhost\";\nexport * from \"./isPrerendering\";\nexport * from \"./legacyPluginToReactComponent\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,15 +1,7 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isLocalhost = void 0;
7
- var INCLUDES = ["localhost", "127.0.0.1"];
8
- var isLocalhost = exports.isLocalhost = function isLocalhost() {
9
- var href = window.location.href;
10
- return INCLUDES.some(function (current) {
11
- return href.includes(current);
12
- });
1
+ const INCLUDES = ["localhost", "127.0.0.1"];
2
+ export const isLocalhost = () => {
3
+ const href = window.location.href;
4
+ return INCLUDES.some(current => href.includes(current));
13
5
  };
14
6
 
15
7
  //# sourceMappingURL=isLocalhost.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["INCLUDES","isLocalhost","exports","href","window","location","some","current","includes"],"sources":["isLocalhost.ts"],"sourcesContent":["const INCLUDES = [\"localhost\", \"127.0.0.1\"];\n\nexport const isLocalhost = () => {\n const href = window.location.href;\n return INCLUDES.some(current => href.includes(current));\n};\n"],"mappings":";;;;;;AAAA,IAAMA,QAAQ,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC;AAEpC,IAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,SAAdA,WAAWA,CAAA,EAAS;EAC7B,IAAME,IAAI,GAAGC,MAAM,CAACC,QAAQ,CAACF,IAAI;EACjC,OAAOH,QAAQ,CAACM,IAAI,CAAC,UAAAC,OAAO;IAAA,OAAIJ,IAAI,CAACK,QAAQ,CAACD,OAAO,CAAC;EAAA,EAAC;AAC3D,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["INCLUDES","isLocalhost","href","window","location","some","current","includes"],"sources":["isLocalhost.ts"],"sourcesContent":["const INCLUDES = [\"localhost\", \"127.0.0.1\"];\n\nexport const isLocalhost = () => {\n const href = window.location.href;\n return INCLUDES.some(current => href.includes(current));\n};\n"],"mappings":"AAAA,MAAMA,QAAQ,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC;AAE3C,OAAO,MAAMC,WAAW,GAAGA,CAAA,KAAM;EAC7B,MAAMC,IAAI,GAAGC,MAAM,CAACC,QAAQ,CAACF,IAAI;EACjC,OAAOF,QAAQ,CAACK,IAAI,CAACC,OAAO,IAAIJ,IAAI,CAACK,QAAQ,CAACD,OAAO,CAAC,CAAC;AAC3D,CAAC","ignoreList":[]}
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isPrerendering = void 0;
7
- var isPrerendering = exports.isPrerendering = function isPrerendering() {
1
+ export const isPrerendering = () => {
8
2
  return "__PS_RENDER__" in window;
9
3
  };
10
4
 
@@ -1 +1 @@
1
- {"version":3,"names":["isPrerendering","exports","window"],"sources":["isPrerendering.ts"],"sourcesContent":["export const isPrerendering = (): boolean => {\n return \"__PS_RENDER__\" in window;\n};\n"],"mappings":";;;;;;AAAO,IAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAA,EAAkB;EACzC,OAAO,eAAe,IAAIE,MAAM;AACpC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["isPrerendering","window"],"sources":["isPrerendering.ts"],"sourcesContent":["export const isPrerendering = (): boolean => {\n return \"__PS_RENDER__\" in window;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAGA,CAAA,KAAe;EACzC,OAAO,eAAe,IAAIC,MAAM;AACpC,CAAC","ignoreList":[]}
@@ -1,16 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.legacyPluginToReactComponent = void 0;
7
- var _useRegisterLegacyPlugin = require("../hooks/useRegisterLegacyPlugin");
8
- var legacyPluginToReactComponent = exports.legacyPluginToReactComponent = function legacyPluginToReactComponent(params) {
9
- var Component = function Component(props) {
10
- var plugin = Object.assign({
1
+ import { useRegisterLegacyPlugin } from "../hooks/useRegisterLegacyPlugin";
2
+ export const legacyPluginToReactComponent = function (params) {
3
+ const Component = props => {
4
+ const plugin = Object.assign({
11
5
  type: params.pluginType
12
6
  }, params.mapProps ? params.mapProps(props) : props);
13
- (0, _useRegisterLegacyPlugin.useRegisterLegacyPlugin)(plugin);
7
+ useRegisterLegacyPlugin(plugin);
14
8
  return null;
15
9
  };
16
10
  Component.displayName = params.componentDisplayName;
@@ -1 +1 @@
1
- {"version":3,"names":["_useRegisterLegacyPlugin","require","legacyPluginToReactComponent","exports","params","Component","props","plugin","Object","assign","type","pluginType","mapProps","useRegisterLegacyPlugin","displayName","componentDisplayName"],"sources":["legacyPluginToReactComponent.ts"],"sourcesContent":["import React from \"react\";\nimport { useRegisterLegacyPlugin } from \"~/hooks/useRegisterLegacyPlugin\";\n\nexport interface LegacyPluginToReactComponentParams<TProps extends Record<string, any>> {\n pluginType: string;\n componentDisplayName: string;\n mapProps?: (props: TProps) => TProps;\n}\n\nexport const legacyPluginToReactComponent = function <TProps extends Record<string, any>>(\n params: LegacyPluginToReactComponentParams<TProps>\n) {\n const Component: React.ComponentType<TProps> = props => {\n const plugin = Object.assign(\n { type: params.pluginType },\n params.mapProps ? params.mapProps(props) : props\n );\n useRegisterLegacyPlugin(plugin);\n return null;\n };\n\n Component.displayName = params.componentDisplayName;\n\n return Component;\n};\n"],"mappings":";;;;;;AACA,IAAAA,wBAAA,GAAAC,OAAA;AAQO,IAAMC,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,GAAG,SAA/BA,4BAA4BA,CACrCE,MAAkD,EACpD;EACE,IAAMC,SAAsC,GAAG,SAAzCA,SAAsCA,CAAGC,KAAK,EAAI;IACpD,IAAMC,MAAM,GAAGC,MAAM,CAACC,MAAM,CACxB;MAAEC,IAAI,EAAEN,MAAM,CAACO;IAAW,CAAC,EAC3BP,MAAM,CAACQ,QAAQ,GAAGR,MAAM,CAACQ,QAAQ,CAACN,KAAK,CAAC,GAAGA,KAC/C,CAAC;IACD,IAAAO,gDAAuB,EAACN,MAAM,CAAC;IAC/B,OAAO,IAAI;EACf,CAAC;EAEDF,SAAS,CAACS,WAAW,GAAGV,MAAM,CAACW,oBAAoB;EAEnD,OAAOV,SAAS;AACpB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useRegisterLegacyPlugin","legacyPluginToReactComponent","params","Component","props","plugin","Object","assign","type","pluginType","mapProps","displayName","componentDisplayName"],"sources":["legacyPluginToReactComponent.ts"],"sourcesContent":["import React from \"react\";\nimport { useRegisterLegacyPlugin } from \"~/hooks/useRegisterLegacyPlugin\";\n\nexport interface LegacyPluginToReactComponentParams<TProps extends Record<string, any>> {\n pluginType: string;\n componentDisplayName: string;\n mapProps?: (props: TProps) => TProps;\n}\n\nexport const legacyPluginToReactComponent = function <TProps extends Record<string, any>>(\n params: LegacyPluginToReactComponentParams<TProps>\n) {\n const Component: React.ComponentType<TProps> = props => {\n const plugin = Object.assign(\n { type: params.pluginType },\n params.mapProps ? params.mapProps(props) : props\n );\n useRegisterLegacyPlugin(plugin);\n return null;\n };\n\n Component.displayName = params.componentDisplayName;\n\n return Component;\n};\n"],"mappings":"AACA,SAASA,uBAAuB;AAQhC,OAAO,MAAMC,4BAA4B,GAAG,SAAAA,CACxCC,MAAkD,EACpD;EACE,MAAMC,SAAsC,GAAGC,KAAK,IAAI;IACpD,MAAMC,MAAM,GAAGC,MAAM,CAACC,MAAM,CACxB;MAAEC,IAAI,EAAEN,MAAM,CAACO;IAAW,CAAC,EAC3BP,MAAM,CAACQ,QAAQ,GAAGR,MAAM,CAACQ,QAAQ,CAACN,KAAK,CAAC,GAAGA,KAC/C,CAAC;IACDJ,uBAAuB,CAACK,MAAM,CAAC;IAC/B,OAAO,IAAI;EACf,CAAC;EAEDF,SAAS,CAACQ,WAAW,GAAGT,MAAM,CAACU,oBAAoB;EAEnD,OAAOT,SAAS;AACpB,CAAC","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- import React from "react";
2
- import { RouteProps } from "@webiny/react-router";
3
- export declare const AddRoute: ((props: RouteProps) => null) & {
4
- original: (props: RouteProps) => null;
5
- originalName: string;
6
- displayName: string;
7
- } & {
8
- original: ((props: RouteProps) => null) & {
9
- original: (props: RouteProps) => null;
10
- originalName: string;
11
- displayName: string;
12
- };
13
- originalName: string;
14
- displayName: string;
15
- } & {
16
- createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<((props: RouteProps) => null) & {
17
- original: (props: RouteProps) => null;
18
- originalName: string;
19
- displayName: string;
20
- }>) => (props: unknown) => React.JSX.Element;
21
- };