@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.
- package/App.d.ts +3 -10
- package/App.js +70 -84
- package/App.js.map +1 -1
- package/AppContainer.d.ts +23 -0
- package/AppContainer.js +9 -0
- package/AppContainer.js.map +1 -0
- package/apollo-client/InMemoryCache.js +16 -47
- package/apollo-client/InMemoryCache.js.map +1 -1
- package/apollo-client/IntrospectionFragmentMatcher.js +33 -50
- package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
- package/components/Image.js +11 -19
- package/components/Image.js.map +1 -1
- package/components/Routes.js +13 -23
- package/components/Routes.js.map +1 -1
- package/components/View.js +14 -26
- package/components/View.js.map +1 -1
- package/components/index.js +2 -19
- package/components/index.js.map +1 -1
- package/config/RouterConfig/Route.d.ts +30 -0
- package/config/RouterConfig/Route.js +42 -0
- package/config/RouterConfig/Route.js.map +1 -0
- package/config/RouterConfig.d.ts +32 -0
- package/config/RouterConfig.js +18 -0
- package/config/RouterConfig.js.map +1 -0
- package/config.js +9 -15
- package/config.js.map +1 -1
- package/contexts/Ui/index.js +28 -52
- package/contexts/Ui/index.js.map +1 -1
- package/core/DebounceRender.js +13 -24
- package/core/DebounceRender.js.map +1 -1
- package/core/Plugin.js +11 -19
- package/core/Plugin.js.map +1 -1
- package/core/Plugins.js +18 -24
- package/core/Plugins.js.map +1 -1
- package/core/Provider.js +9 -13
- package/core/Provider.js.map +1 -1
- package/core/Routes.js +14 -23
- package/core/Routes.js.map +1 -1
- package/core/createProvider.js +1 -7
- package/core/createProvider.js.map +1 -1
- package/core/createProviderPlugin.js +4 -10
- package/core/createProviderPlugin.js.map +1 -1
- package/hooks/useAutocomplete/index.js +1 -12
- package/hooks/useAutocomplete/index.js.map +1 -1
- package/hooks/useAutocomplete/useAutocomplete.js +9 -16
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
- package/hooks/useDataList/functions/getData.js +2 -11
- package/hooks/useDataList/functions/getData.js.map +1 -1
- package/hooks/useDataList/functions/getError.js +2 -11
- package/hooks/useDataList/functions/getError.js.map +1 -1
- package/hooks/useDataList/functions/getMeta.js +2 -11
- package/hooks/useDataList/functions/getMeta.js.map +1 -1
- package/hooks/useDataList/functions/index.js +3 -27
- package/hooks/useDataList/functions/index.js.map +1 -1
- package/hooks/useDataList/functions/searchDataByKey.js +4 -10
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
- package/hooks/useDataList/index.js +1 -12
- package/hooks/useDataList/index.js.map +1 -1
- package/hooks/useDataList/useDataList.js +78 -78
- package/hooks/useDataList/useDataList.js.map +1 -1
- package/hooks/useDataList/utils/index.js +2 -20
- package/hooks/useDataList/utils/index.js.map +1 -1
- package/hooks/useDataList/utils/prepareLoadListParams.js +9 -15
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +10 -14
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -1
- package/hooks/useDataList/utils/types.js +1 -5
- package/hooks/useHandler.js +7 -12
- package/hooks/useHandler.js.map +1 -1
- package/hooks/useHandlers.js +11 -17
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useRegisterLegacyPlugin.js +5 -11
- package/hooks/useRegisterLegacyPlugin.js.map +1 -1
- package/hooks/useUi.d.ts +1 -1
- package/hooks/useUi.js +4 -10
- package/hooks/useUi.js.map +1 -1
- package/i18n/i18n.js +5 -13
- package/i18n/i18n.js.map +1 -1
- package/i18n/index.js +1 -13
- package/i18n/index.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +17 -177
- package/index.js.map +1 -1
- package/package.json +10 -9
- package/plugins/AddQuerySelectionPlugin.js +62 -107
- package/plugins/AddQuerySelectionPlugin.js.map +1 -1
- package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
- package/plugins/ApolloDynamicLink.js +19 -46
- package/plugins/ApolloDynamicLink.js.map +1 -1
- package/plugins/ApolloLinkPlugin.js +18 -37
- package/plugins/ApolloLinkPlugin.js.map +1 -1
- package/plugins/ConsoleLinkPlugin.js +20 -41
- package/plugins/ConsoleLinkPlugin.js.map +1 -1
- package/plugins/LocaleHeaderLinkPlugin.js +23 -40
- package/plugins/LocaleHeaderLinkPlugin.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +39 -51
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +12 -18
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin.js +23 -40
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
- package/plugins/OmitTypenameLinkPlugin.js +11 -30
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
- package/plugins/RoutePlugin.js +12 -31
- package/plugins/RoutePlugin.js.map +1 -1
- package/plugins/TenantHeaderLinkPlugin.js +30 -47
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
- package/plugins/ViewPlugin.js +15 -36
- package/plugins/ViewPlugin.js.map +1 -1
- package/plugins/image.js +46 -53
- package/plugins/image.js.map +1 -1
- package/plugins/index.js +31 -53
- package/plugins/index.js.map +1 -1
- package/react-butterfiles/Files.js +208 -235
- package/react-butterfiles/Files.js.map +1 -1
- package/react-butterfiles/index.js +2 -8
- package/react-butterfiles/index.js.map +1 -1
- package/react-butterfiles/utils/generateId.js +1 -7
- package/react-butterfiles/utils/generateId.js.map +1 -1
- package/react-butterfiles/utils/readFileContent.js +4 -10
- package/react-butterfiles/utils/readFileContent.js.map +1 -1
- package/renderApp.js +4 -11
- package/renderApp.js.map +1 -1
- package/types.js +11 -11
- package/types.js.map +1 -1
- package/utils/createGenericContext.js +13 -22
- package/utils/createGenericContext.js.map +1 -1
- package/utils/createHashing.js +9 -15
- package/utils/createHashing.js.map +1 -1
- package/utils/getApiUrl.js +1 -8
- package/utils/getApiUrl.js.map +1 -1
- package/utils/getGqlApiUrl.js +3 -9
- package/utils/getGqlApiUrl.js.map +1 -1
- package/utils/getHeadlessCmsGqlApiUrl.js +7 -13
- package/utils/getHeadlessCmsGqlApiUrl.js.map +1 -1
- package/utils/getLocaleCode.js +6 -16
- package/utils/getLocaleCode.js.map +1 -1
- package/utils/getPrerenderId.js +1 -7
- package/utils/getPrerenderId.js.map +1 -1
- package/utils/getTenantId.js +7 -13
- package/utils/getTenantId.js.map +1 -1
- package/utils/index.js +10 -115
- package/utils/index.js.map +1 -1
- package/utils/isLocalhost.js +4 -12
- package/utils/isLocalhost.js.map +1 -1
- package/utils/isPrerendering.js +1 -7
- package/utils/isPrerendering.js.map +1 -1
- package/utils/legacyPluginToReactComponent.js +5 -11
- package/utils/legacyPluginToReactComponent.js.map +1 -1
- package/core/AddRoute.d.ts +0 -21
- package/core/AddRoute.js +0 -21
- package/core/AddRoute.js.map +0 -1
package/types.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { Plugin } from "@webiny/plugins/types";
|
|
2
|
+
export { Plugin };
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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":["
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
|
|
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 =
|
|
12
|
+
Provider.displayName = `${name}Provider`;
|
|
22
13
|
return {
|
|
23
|
-
Provider
|
|
24
|
-
useHook:
|
|
25
|
-
|
|
14
|
+
Provider,
|
|
15
|
+
useHook: () => {
|
|
16
|
+
const context = React.useContext(GenericContext);
|
|
26
17
|
if (!context) {
|
|
27
|
-
throw Error(
|
|
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":["
|
|
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":[]}
|
package/utils/createHashing.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
+
const hash = hexes.join("");
|
|
18
12
|
resolve(hash);
|
|
19
13
|
});
|
|
20
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createHashing","
|
|
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":[]}
|
package/utils/getApiUrl.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
"
|
|
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
|
|
package/utils/getApiUrl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getApiUrl","
|
|
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":[]}
|
package/utils/getGqlApiUrl.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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":["
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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:
|
|
13
|
-
read:
|
|
14
|
-
manage:
|
|
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":["
|
|
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":[]}
|
package/utils/getLocaleCode.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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":["
|
|
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":[]}
|
package/utils/getPrerenderId.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
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","
|
|
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":[]}
|
package/utils/getTenantId.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
27
|
+
const value = JSON.parse(tenant);
|
|
34
28
|
if (value) {
|
|
35
29
|
return value;
|
|
36
30
|
}
|
|
37
|
-
} catch
|
|
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 (
|
|
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;
|
package/utils/getTenantId.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
package/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
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":[]}
|
package/utils/isLocalhost.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
package/utils/isLocalhost.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["INCLUDES","isLocalhost","
|
|
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":[]}
|
package/utils/isPrerendering.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
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","
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
+
useRegisterLegacyPlugin(plugin);
|
|
14
8
|
return null;
|
|
15
9
|
};
|
|
16
10
|
Component.displayName = params.componentDisplayName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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":[]}
|
package/core/AddRoute.d.ts
DELETED
|
@@ -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
|
-
};
|