@commercetools-frontend/application-shell 0.0.0-CRAFT-1791-20251006162610
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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/application-entry-point-10a5e1a5.esm.js +82 -0
- package/dist/application-entry-point-8c4b8e53.cjs.prod.js +86 -0
- package/dist/application-entry-point-c87294b0.cjs.dev.js +96 -0
- package/dist/box-09bf50e1.cjs.prod.js +30 -0
- package/dist/box-4857aa65.cjs.dev.js +30 -0
- package/dist/box-9cf180c1.esm.js +17 -0
- package/dist/cart-645074db.cjs.prod.js +30 -0
- package/dist/cart-b0044279.cjs.dev.js +30 -0
- package/dist/cart-bb491ca1.esm.js +17 -0
- package/dist/commercetools-frontend-application-shell.cjs.d.ts +2 -0
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +214 -0
- package/dist/commercetools-frontend-application-shell.cjs.js +7 -0
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +214 -0
- package/dist/commercetools-frontend-application-shell.esm.js +82 -0
- package/dist/connected-square-2d046cb8.cjs.prod.js +30 -0
- package/dist/connected-square-a2fea344.cjs.dev.js +30 -0
- package/dist/connected-square-fe6a790f.esm.js +17 -0
- package/dist/custom-view-dev-host-864a12e2.cjs.dev.js +197 -0
- package/dist/custom-view-dev-host-8e2f6aa7.cjs.prod.js +197 -0
- package/dist/custom-view-dev-host-d9c410aa.esm.js +186 -0
- package/dist/declarations/src/components/application-page-title/application-page-title.d.ts +24 -0
- package/dist/declarations/src/components/application-page-title/index.d.ts +1 -0
- package/dist/declarations/src/components/application-shell/application-shell.d.ts +45 -0
- package/dist/declarations/src/components/application-shell/index.d.ts +1 -0
- package/dist/declarations/src/components/application-shell-provider/application-shell-provider.d.ts +17 -0
- package/dist/declarations/src/components/application-shell-provider/index.d.ts +1 -0
- package/dist/declarations/src/components/application-shell-provider/utils.d.ts +3 -0
- package/dist/declarations/src/components/configure-intl-provider/configure-intl-provider.d.ts +12 -0
- package/dist/declarations/src/components/configure-intl-provider/index.d.ts +1 -0
- package/dist/declarations/src/components/custom-view-shell/custom-view-shell.d.ts +12 -0
- package/dist/declarations/src/components/custom-view-shell/index.d.ts +1 -0
- package/dist/declarations/src/components/error-apologizer/index.d.ts +5 -0
- package/dist/declarations/src/components/fetch-user/fetch-user.d.ts +16 -0
- package/dist/declarations/src/components/fetch-user/index.d.ts +1 -0
- package/dist/declarations/src/components/inject-reducers/index.d.ts +1 -0
- package/dist/declarations/src/components/inject-reducers/inject-reducers.d.ts +13 -0
- package/dist/declarations/src/components/redirect-to-login/index.d.ts +5 -0
- package/dist/declarations/src/components/redirect-to-logout/index.d.ts +4 -0
- package/dist/declarations/src/components/route-catch-all/index.d.ts +2 -0
- package/dist/declarations/src/components/setup-flop-flip-provider/index.d.ts +1 -0
- package/dist/declarations/src/components/setup-flop-flip-provider/setup-flop-flip-provider.d.ts +17 -0
- package/dist/declarations/src/components/suspended-route/index.d.ts +3 -0
- package/dist/declarations/src/components/suspended-route/protected-route.d.ts +7 -0
- package/dist/declarations/src/components/suspended-route/suspended-protected-route.d.ts +7 -0
- package/dist/declarations/src/components/suspended-route/suspended-route.d.ts +10 -0
- package/dist/declarations/src/configure-store.d.ts +22 -0
- package/dist/declarations/src/export-types.d.ts +8 -0
- package/dist/declarations/src/hooks/use-routes-creator/index.d.ts +1 -0
- package/dist/declarations/src/hooks/use-routes-creator/use-routes-creator.d.ts +22 -0
- package/dist/declarations/src/index.d.ts +33 -0
- package/dist/declarations/src/ssr/index.d.ts +2 -0
- package/dist/declarations/src/test-utils/custom-views-utils.d.ts +21 -0
- package/dist/declarations/src/test-utils/index.d.ts +2 -0
- package/dist/declarations/src/test-utils/test-utils.d.ts +87 -0
- package/dist/declarations/src/types/generated/mc.d.ts +742 -0
- package/dist/declarations/src/utils/get-previous-project-key/get-previous-project-key.d.ts +2 -0
- package/dist/declarations/src/utils/get-previous-project-key/index.d.ts +1 -0
- package/dist/declarations/src/utils/oidc.d.ts +10 -0
- package/dist/declarations/src/utils/setup-global-error-listener/index.d.ts +1 -0
- package/dist/declarations/src/utils/setup-global-error-listener/setup-global-error-listener.d.ts +1 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/dist/declarations-connectors/dist/commercetools-frontend-application-shell-connectors.cjs.d.ts +2 -0
- package/dist/declarations-connectors/src/components/application-context/application-context.d.ts +109 -0
- package/dist/declarations-connectors/src/components/application-context/index.d.ts +10 -0
- package/dist/declarations-connectors/src/components/application-context/normalizers.d.ts +48 -0
- package/dist/declarations-connectors/src/components/custom-view-context/custom-view-context.d.ts +19 -0
- package/dist/declarations-connectors/src/components/custom-view-context/index.d.ts +4 -0
- package/dist/declarations-connectors/src/components/project-extension-image-regex/index.d.ts +3 -0
- package/dist/declarations-connectors/src/components/project-extension-image-regex/project-extension-image-regex.d.ts +37 -0
- package/dist/declarations-connectors/src/configure-apollo.d.ts +7 -0
- package/dist/declarations-connectors/src/export-types.d.ts +21 -0
- package/dist/declarations-connectors/src/hooks/apollo-hooks/apollo-hooks.d.ts +12 -0
- package/dist/declarations-connectors/src/hooks/apollo-hooks/index.d.ts +1 -0
- package/dist/declarations-connectors/src/hooks/custom-views/use-custom-view-parent-data-refresher.d.ts +5 -0
- package/dist/declarations-connectors/src/index.d.ts +12 -0
- package/dist/declarations-connectors/src/types/generated/mc.d.ts +742 -0
- package/dist/declarations-connectors/src/types/generated/settings.d.ts +2116 -0
- package/dist/declarations-connectors/src/utils/apollo-client-runtime-cache.d.ts +4 -0
- package/dist/declarations-connectors/src/utils/apollo-context.d.ts +16 -0
- package/dist/declarations-connectors/src/utils/get-correlation-id/get-correlation-id.d.ts +3 -0
- package/dist/declarations-connectors/src/utils/get-correlation-id/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/get-mc-api-url/get-mc-api-url.d.ts +3 -0
- package/dist/declarations-connectors/src/utils/get-mc-api-url/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/http-client.d.ts +107 -0
- package/dist/declarations-connectors/src/utils/index.d.ts +7 -0
- package/dist/declarations-connectors/src/utils/logger.d.ts +10 -0
- package/dist/declarations-connectors/src/utils/oidc-storage.d.ts +12 -0
- package/dist/declarations-connectors/src/utils/select-project-key-from-url/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-project-key-from-url/select-project-key-from-url.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-team-id-from-storage/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-team-id-from-storage/select-team-id-from-storage.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-user-id/index.d.ts +1 -0
- package/dist/declarations-connectors/src/utils/select-user-id/select-user-id.d.ts +1 -0
- package/dist/declarations-connectors/src/version.d.ts +2 -0
- package/dist/error-apologizer-76f087f4.esm.js +39 -0
- package/dist/error-apologizer-84dc825c.cjs.prod.js +53 -0
- package/dist/error-apologizer-f6793491.cjs.dev.js +53 -0
- package/dist/gear-4f7cde98.cjs.prod.js +30 -0
- package/dist/gear-ee90ba83.esm.js +17 -0
- package/dist/gear-f2668579.cjs.dev.js +30 -0
- package/dist/get-mc-origin-8f7a578c.cjs.prod.js +51 -0
- package/dist/get-mc-origin-a86dff20.cjs.dev.js +51 -0
- package/dist/get-mc-origin-fecfee07.esm.js +44 -0
- package/dist/heart-01f01038.cjs.prod.js +30 -0
- package/dist/heart-86f780f3.esm.js +17 -0
- package/dist/heart-e49dd92a.cjs.dev.js +30 -0
- package/dist/index-245e2980.cjs.prod.js +237 -0
- package/dist/index-60cd194b.cjs.prod.js +2053 -0
- package/dist/index-614accc4.cjs.dev.js +237 -0
- package/dist/index-86039df7.esm.js +211 -0
- package/dist/index-8637a317.esm.js +2072 -0
- package/dist/index-f0f4fbcd.cjs.dev.js +2134 -0
- package/dist/list-with-search-027ab8eb.cjs.dev.js +30 -0
- package/dist/list-with-search-6462447e.cjs.prod.js +30 -0
- package/dist/list-with-search-d2901e34.esm.js +17 -0
- package/dist/location-537e0660.cjs.prod.js +32 -0
- package/dist/location-c835b8df.cjs.dev.js +32 -0
- package/dist/location-f21dbc25.esm.js +30 -0
- package/dist/navbar-022383bd.cjs.dev.js +1364 -0
- package/dist/navbar-844d350d.esm.js +1332 -0
- package/dist/navbar-acc2cd1b.cjs.prod.js +1225 -0
- package/dist/oidc-8827f9fe.cjs.dev.js +98 -0
- package/dist/oidc-b2520905.esm.js +84 -0
- package/dist/oidc-callback-2800b1f0.cjs.prod.js +243 -0
- package/dist/oidc-callback-5213e755.cjs.dev.js +246 -0
- package/dist/oidc-callback-619f18d9.esm.js +232 -0
- package/dist/oidc-d74e6aa2.cjs.prod.js +98 -0
- package/dist/paperclip-005ec544.cjs.dev.js +30 -0
- package/dist/paperclip-a820ee87.esm.js +17 -0
- package/dist/paperclip-fe72a70d.cjs.prod.js +30 -0
- package/dist/plugin-81ae1044.cjs.prod.js +30 -0
- package/dist/plugin-c7bf9e53.esm.js +17 -0
- package/dist/plugin-feb22442.cjs.dev.js +30 -0
- package/dist/project-container-22619059.cjs.prod.js +378 -0
- package/dist/project-container-96f2d671.cjs.dev.js +378 -0
- package/dist/project-container-ef2dfb60.esm.js +357 -0
- package/dist/project-expired-8c4cd8a0.cjs.dev.js +137 -0
- package/dist/project-expired-9994ed78.cjs.prod.js +137 -0
- package/dist/project-expired-dc881501.esm.js +123 -0
- package/dist/project-not-found-3933434f.cjs.prod.js +130 -0
- package/dist/project-not-found-3a76e8d7.cjs.dev.js +130 -0
- package/dist/project-not-found-57a3a216.esm.js +116 -0
- package/dist/project-not-initialized-2eebb2c7.esm.js +123 -0
- package/dist/project-not-initialized-3cfd0aed.cjs.dev.js +137 -0
- package/dist/project-not-initialized-91af2604.cjs.prod.js +137 -0
- package/dist/project-suspended-0c98a90e.cjs.dev.js +135 -0
- package/dist/project-suspended-dddbda8b.cjs.prod.js +135 -0
- package/dist/project-suspended-eeb5f62e.esm.js +121 -0
- package/dist/quick-access-1475bad4.cjs.dev.js +1893 -0
- package/dist/quick-access-ba70983f.cjs.prod.js +1875 -0
- package/dist/quick-access-d2f9b458.esm.js +1865 -0
- package/dist/redirect-to-login-12f467b8.cjs.prod.js +117 -0
- package/dist/redirect-to-login-2944c890.esm.js +115 -0
- package/dist/redirect-to-login-3bee13ba.cjs.dev.js +117 -0
- package/dist/redirect-to-logout-4587f4ed.cjs.dev.js +126 -0
- package/dist/redirect-to-logout-7bb3eb45.esm.js +113 -0
- package/dist/redirect-to-logout-a96985ce.cjs.prod.js +126 -0
- package/dist/redirect-to-project-create-9249e554.esm.js +60 -0
- package/dist/redirect-to-project-create-e4ff7797.cjs.prod.js +68 -0
- package/dist/redirect-to-project-create-f4f01842.cjs.dev.js +68 -0
- package/dist/redirector-0c72d0a4.cjs.prod.js +61 -0
- package/dist/redirector-72ccfbc2.cjs.dev.js +61 -0
- package/dist/redirector-d856975f.esm.js +46 -0
- package/dist/requests-in-flight-loader-0594117d.cjs.dev.js +122 -0
- package/dist/requests-in-flight-loader-59e8fb86.esm.js +107 -0
- package/dist/requests-in-flight-loader-a8288906.cjs.prod.js +122 -0
- package/dist/rocket-3372731a.cjs.dev.js +30 -0
- package/dist/rocket-bacf24be.esm.js +17 -0
- package/dist/rocket-cb99be06.cjs.prod.js +30 -0
- package/dist/route-catch-all-7803b1fd.esm.js +42 -0
- package/dist/route-catch-all-8e71a93c.cjs.prod.js +44 -0
- package/dist/route-catch-all-b979e1fd.cjs.dev.js +44 -0
- package/dist/service-page-project-switcher-37faf2fb.cjs.prod.js +37 -0
- package/dist/service-page-project-switcher-47296fb1.esm.js +39 -0
- package/dist/service-page-project-switcher-6cdff717.cjs.dev.js +45 -0
- package/dist/speedometer-26f52e73.cjs.prod.js +30 -0
- package/dist/speedometer-4c8e0b9c.esm.js +17 -0
- package/dist/speedometer-c1ec5a1d.cjs.dev.js +30 -0
- package/dist/star-6b9a91d2.cjs.dev.js +30 -0
- package/dist/star-af90a9c6.esm.js +17 -0
- package/dist/star-e4902bbb.cjs.prod.js +30 -0
- package/dist/tag-multi-1c065f61.cjs.prod.js +30 -0
- package/dist/tag-multi-4c2742de.esm.js +17 -0
- package/dist/tag-multi-abef3e15.cjs.dev.js +30 -0
- package/dist/tree-structure-3ec98cce.cjs.prod.js +30 -0
- package/dist/tree-structure-96ab0b7e.cjs.dev.js +30 -0
- package/dist/tree-structure-ca0498a0.esm.js +17 -0
- package/dist/use-applications-menu-14a5a1f4.cjs.prod.js +172 -0
- package/dist/use-applications-menu-1514af11.esm.js +157 -0
- package/dist/use-applications-menu-823a2492.cjs.dev.js +172 -0
- package/dist/use-is-served-by-proxy-28f19a6f.cjs.dev.js +10 -0
- package/dist/use-is-served-by-proxy-480e8de8.cjs.prod.js +10 -0
- package/dist/use-is-served-by-proxy-a383da4b.esm.js +8 -0
- package/dist/user-filled-26f333b2.cjs.prod.js +30 -0
- package/dist/user-filled-34aeebcc.cjs.dev.js +30 -0
- package/dist/user-filled-61d8a81b.esm.js +17 -0
- package/dist/user-settings-menu-6113cdd3.cjs.dev.js +338 -0
- package/dist/user-settings-menu-d75f4958.cjs.prod.js +326 -0
- package/dist/user-settings-menu-f98bea89.esm.js +313 -0
- package/dist/world-22189397.cjs.prod.js +30 -0
- package/dist/world-500baeb2.cjs.dev.js +30 -0
- package/dist/world-523efd61.esm.js +17 -0
- package/package.json +144 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.d.ts +2 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.dev.js +20 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.js +7 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.prod.js +20 -0
- package/ssr/dist/commercetools-frontend-application-shell-ssr.esm.js +4 -0
- package/ssr/package.json +4 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.d.ts +2 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +554 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.js +7 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +554 -0
- package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +502 -0
- package/test-utils/package.json +4 -0
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
2
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
3
|
+
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
4
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
5
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
6
|
+
import _valuesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/values';
|
|
7
|
+
import _flagsInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/flags';
|
|
8
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
9
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
10
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
11
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
12
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
13
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
14
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
15
|
+
import { act, createElement, Suspense } from 'react';
|
|
16
|
+
import { ApolloProvider } from '@apollo/client/react';
|
|
17
|
+
import { MockedProvider } from '@apollo/client/testing';
|
|
18
|
+
import { TestProviderFlopFlip } from '@flopflip/react-broadcast';
|
|
19
|
+
import * as rtl from '@testing-library/react';
|
|
20
|
+
export * from '@testing-library/react';
|
|
21
|
+
import { createMemoryHistory } from 'history';
|
|
22
|
+
import { IntlProvider } from 'react-intl';
|
|
23
|
+
import { Provider } from 'react-redux';
|
|
24
|
+
import { Router } from 'react-router-dom';
|
|
25
|
+
import invariant from 'tiny-invariant';
|
|
26
|
+
import { entryPointUriPathToPermissionKeys } from '@commercetools-frontend/application-config/ssr';
|
|
27
|
+
import { ApplicationContextProvider, createApolloClient, CustomViewContextProvider } from '@commercetools-frontend/application-shell-connectors';
|
|
28
|
+
import { createEnhancedHistory } from '@commercetools-frontend/browser-history';
|
|
29
|
+
import { DOMAINS, CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/constants';
|
|
30
|
+
import { NotificationProviderForCustomComponent, NotificationsList } from '@commercetools-frontend/react-notifications';
|
|
31
|
+
import { createTestMiddleware } from '@commercetools-frontend/sdk/test-utils';
|
|
32
|
+
import { A as ApplicationEntryPoint } from '../../dist/application-entry-point-10a5e1a5.esm.js';
|
|
33
|
+
import { c as createReduxStore } from '../../dist/index-86039df7.esm.js';
|
|
34
|
+
import { jsx, Fragment, jsxs } from '@emotion/react/jsx-runtime';
|
|
35
|
+
import '@commercetools-frontend/application-components';
|
|
36
|
+
import '@commercetools-frontend/permissions';
|
|
37
|
+
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
38
|
+
import '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
39
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
40
|
+
import '@babel/runtime-corejs3/core-js-stable/reflect/has';
|
|
41
|
+
import '@reduxjs/toolkit';
|
|
42
|
+
import 'lodash/mapValues';
|
|
43
|
+
import 'omit-empty-es';
|
|
44
|
+
import 'redux';
|
|
45
|
+
import 'redux-thunk';
|
|
46
|
+
import '@commercetools-frontend/notifications';
|
|
47
|
+
import '@commercetools-frontend/sdk';
|
|
48
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
49
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
50
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
51
|
+
import '@commercetools-frontend/sentry';
|
|
52
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
53
|
+
import 'redux-logger';
|
|
54
|
+
|
|
55
|
+
const _excluded = ["children"],
|
|
56
|
+
_excluded2 = ["children"];
|
|
57
|
+
function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
58
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context8, _context9; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context8 = ownKeys$1(Object(t), !0)).call(_context8, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context9 = ownKeys$1(Object(t))).call(_context9, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
59
|
+
const defaultProject = {
|
|
60
|
+
key: 'test-with-big-data',
|
|
61
|
+
version: 43,
|
|
62
|
+
name: 'Test with big data',
|
|
63
|
+
countries: ['de', 'en'],
|
|
64
|
+
currencies: ['EUR', 'GBP'],
|
|
65
|
+
languages: ['de', 'en-GB', 'en'],
|
|
66
|
+
owner: {
|
|
67
|
+
id: 'organization-id-1',
|
|
68
|
+
name: 'Organization Name'
|
|
69
|
+
},
|
|
70
|
+
initialized: true,
|
|
71
|
+
expiry: {
|
|
72
|
+
isActive: false,
|
|
73
|
+
daysLeft: undefined
|
|
74
|
+
},
|
|
75
|
+
suspension: {
|
|
76
|
+
isActive: false,
|
|
77
|
+
reason: undefined
|
|
78
|
+
},
|
|
79
|
+
isProductionProject: false,
|
|
80
|
+
allAppliedPermissions: [],
|
|
81
|
+
allAppliedActionRights: [],
|
|
82
|
+
allAppliedDataFences: [],
|
|
83
|
+
allPermissionsForAllApplications: {
|
|
84
|
+
allAppliedPermissions: [],
|
|
85
|
+
allAppliedActionRights: [],
|
|
86
|
+
allAppliedDataFences: [],
|
|
87
|
+
allAppliedMenuVisibilities: []
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const defaultUser = {
|
|
91
|
+
id: 'user-id-1',
|
|
92
|
+
email: 'sheldon.cooper@caltech.edu',
|
|
93
|
+
createdAt: '2020-01-01T12:29:33.916Z',
|
|
94
|
+
firstName: 'Sheldon',
|
|
95
|
+
lastName: 'Cooper',
|
|
96
|
+
language: 'en',
|
|
97
|
+
timeZone: 'Etc/UTC',
|
|
98
|
+
numberFormat: 'en',
|
|
99
|
+
defaultProjectKey: defaultProject.key,
|
|
100
|
+
businessRole: 'Other',
|
|
101
|
+
projects: {
|
|
102
|
+
total: 1,
|
|
103
|
+
results: [defaultProject]
|
|
104
|
+
},
|
|
105
|
+
gravatarHash: 'aaa',
|
|
106
|
+
launchdarklyTrackingGroup: 'commercetools',
|
|
107
|
+
launchdarklyTrackingSubgroup: 'dev',
|
|
108
|
+
launchdarklyTrackingId: '111',
|
|
109
|
+
launchdarklyTrackingTeam: undefined,
|
|
110
|
+
launchdarklyTrackingCloudEnvironment: 'ctp_production_gcp_europe-west1_v1'
|
|
111
|
+
};
|
|
112
|
+
const defaultEnvironment = {
|
|
113
|
+
applicationId: '__local',
|
|
114
|
+
applicationName: 'my-app',
|
|
115
|
+
entryPointUriPath: 'random-entry-point',
|
|
116
|
+
frontendHost: 'localhost:3001',
|
|
117
|
+
mcApiUrl: 'https://mc-api.europe-west1.gcp.commercetools.com',
|
|
118
|
+
location: 'eu',
|
|
119
|
+
env: 'production',
|
|
120
|
+
cdnUrl: 'http://localhost:3001',
|
|
121
|
+
servedByProxy: false
|
|
122
|
+
};
|
|
123
|
+
const LoadingFallback = () => jsx(Fragment, {
|
|
124
|
+
children: 'Loading...'
|
|
125
|
+
});
|
|
126
|
+
LoadingFallback.displayName = 'LoadingFallback';
|
|
127
|
+
|
|
128
|
+
// For backwards compatibility we need to denormalize the given `permissions` option
|
|
129
|
+
// (which is now deprecated) to `allAppliedPermissions`, in order to pass the value
|
|
130
|
+
// to the `project` prop in the application context provider.
|
|
131
|
+
|
|
132
|
+
const denormalizePermissions = permissions => {
|
|
133
|
+
var _context;
|
|
134
|
+
if (!permissions) return [];
|
|
135
|
+
return _reduceInstanceProperty(_context = _Object$keys(permissions)).call(_context, (allAppliedPermissions, permissionKey) => [...allAppliedPermissions, {
|
|
136
|
+
name: permissionKey,
|
|
137
|
+
value: permissions[permissionKey]
|
|
138
|
+
}], []);
|
|
139
|
+
};
|
|
140
|
+
// For backwards compatibility we need to denormalize the given `actionRights` option
|
|
141
|
+
// (which is now deprecated) to `allAppliedActionRights`, in order to pass the value
|
|
142
|
+
// to the `project` prop in the application context provider.
|
|
143
|
+
|
|
144
|
+
const denormalizeActionRights = actionRights => {
|
|
145
|
+
var _context2;
|
|
146
|
+
if (!actionRights) return [];
|
|
147
|
+
return _reduceInstanceProperty(_context2 = _Object$keys(actionRights)).call(_context2, (allAppliedActionRights, actionRightGroup) => {
|
|
148
|
+
var _context3;
|
|
149
|
+
return [...allAppliedActionRights, ..._reduceInstanceProperty(_context3 = _Object$keys(actionRights[actionRightGroup])).call(_context3, (allActionRightsByGroup, actionRightKey) => [...allActionRightsByGroup, {
|
|
150
|
+
group: actionRightGroup,
|
|
151
|
+
name: actionRightKey,
|
|
152
|
+
value: actionRights[actionRightGroup][actionRightKey]
|
|
153
|
+
}], [])];
|
|
154
|
+
}, []);
|
|
155
|
+
};
|
|
156
|
+
// For backwards compatibility we need to denormalize the given `dataFences` option
|
|
157
|
+
// (which is now deprecated) to `allAppliedDataFences`, in order to pass the value
|
|
158
|
+
// to the `project` prop in the application context provider.
|
|
159
|
+
|
|
160
|
+
const denormalizeDataFences = dataFences => {
|
|
161
|
+
var _context4;
|
|
162
|
+
if (!dataFences) return [];
|
|
163
|
+
return _reduceInstanceProperty(_context4 = _Object$keys(dataFences)).call(_context4, (allAppliedDataFences, dataFenceGroupKey) => {
|
|
164
|
+
var _context5;
|
|
165
|
+
switch (dataFenceGroupKey) {
|
|
166
|
+
case 'store':
|
|
167
|
+
return [...allAppliedDataFences, ..._reduceInstanceProperty(_context5 = _Object$keys(dataFences.store)).call(_context5, (allResources, resourceType) => {
|
|
168
|
+
var _context6;
|
|
169
|
+
return [...allResources, ..._reduceInstanceProperty(_context6 = _Object$keys(dataFences.store[resourceType])).call(_context6, (allPermissions, permissionKey) => {
|
|
170
|
+
var _context7;
|
|
171
|
+
return [...allPermissions, ..._mapInstanceProperty(_context7 = _valuesInstanceProperty(dataFences.store[resourceType][permissionKey])).call(_context7, value => ({
|
|
172
|
+
__typename: 'StoreDataFence',
|
|
173
|
+
type: 'store',
|
|
174
|
+
value,
|
|
175
|
+
group: resourceType,
|
|
176
|
+
name: permissionKey
|
|
177
|
+
}))];
|
|
178
|
+
}, [])];
|
|
179
|
+
}, [])];
|
|
180
|
+
default:
|
|
181
|
+
return allAppliedDataFences;
|
|
182
|
+
}
|
|
183
|
+
}, []);
|
|
184
|
+
};
|
|
185
|
+
const mapResourceAccessToAppliedPermissions = resourceAccesses => _mapInstanceProperty(resourceAccesses).call(resourceAccesses, resourceAccess => ({
|
|
186
|
+
name: `can${resourceAccess}`,
|
|
187
|
+
value: true
|
|
188
|
+
}));
|
|
189
|
+
const wrapIfNeeded = (children, wrapper) => wrapper ? /*#__PURE__*/createElement(wrapper, null, children) : children;
|
|
190
|
+
const ApolloProviderWrapper = props => {
|
|
191
|
+
const apolloClient = props.apolloClient ?? createApolloClient();
|
|
192
|
+
const enableApolloMocks = Boolean(props.mocks && props.mocks.length > 0);
|
|
193
|
+
if (!enableApolloMocks) {
|
|
194
|
+
return (
|
|
195
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
196
|
+
jsx(ApolloProvider, {
|
|
197
|
+
client: apolloClient,
|
|
198
|
+
children: props.children
|
|
199
|
+
})
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
return jsx(MockedProvider, {
|
|
203
|
+
mocks: props.mocks
|
|
204
|
+
// The `addTypename` field is a private field of the cache in TS
|
|
205
|
+
// but we should be able to still access it.
|
|
206
|
+
// This is to ensure the `addTypename` behavior is the same between the
|
|
207
|
+
// Apollo cache and the mocked provider.
|
|
208
|
+
// @ts-expect-error
|
|
209
|
+
,
|
|
210
|
+
addTypename: apolloClient.cache.addTypename ?? true,
|
|
211
|
+
cache: apolloClient.cache,
|
|
212
|
+
children: props.children
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// This function renders any component within the application context, as if it
|
|
217
|
+
// was rendered inside <ApplicationShell />.
|
|
218
|
+
// The context is not completely set up yet, some things are missing:
|
|
219
|
+
// - Tracking on context
|
|
220
|
+
// - react-intl's information from addLocaleData
|
|
221
|
+
// - possibly more that I'm not aware of right now
|
|
222
|
+
//
|
|
223
|
+
// We can add these things as we go and when we need them.
|
|
224
|
+
|
|
225
|
+
function createApplicationProviders() {
|
|
226
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
227
|
+
_ref$disableAutomatic = _ref.disableAutomaticEntryPointRoutes,
|
|
228
|
+
disableAutomaticEntryPointRoutes = _ref$disableAutomatic === void 0 ? false : _ref$disableAutomatic,
|
|
229
|
+
_ref$disableRoutePerm = _ref.disableRoutePermissionCheck,
|
|
230
|
+
disableRoutePermissionCheck = _ref$disableRoutePerm === void 0 ? false : _ref$disableRoutePerm,
|
|
231
|
+
_ref$locale = _ref.locale,
|
|
232
|
+
locale = _ref$locale === void 0 ? 'en' : _ref$locale,
|
|
233
|
+
mocks = _ref.mocks,
|
|
234
|
+
apolloClient = _ref.apolloClient,
|
|
235
|
+
route = _ref.route,
|
|
236
|
+
history = _ref.history,
|
|
237
|
+
_ref$flags = _flagsInstanceProperty(_ref),
|
|
238
|
+
flags = _ref$flags === void 0 ? {} : _ref$flags,
|
|
239
|
+
environment = _ref.environment,
|
|
240
|
+
user = _ref.user,
|
|
241
|
+
project = _ref.project,
|
|
242
|
+
_ref$dataLocale = _ref.dataLocale,
|
|
243
|
+
dataLocale = _ref$dataLocale === void 0 ? 'en' : _ref$dataLocale;
|
|
244
|
+
const mergedUser = user === null ? undefined : _objectSpread$1(_objectSpread$1({}, defaultUser), user);
|
|
245
|
+
const mergedProject = project === null ? undefined : _objectSpread$1(_objectSpread$1({}, defaultProject), project);
|
|
246
|
+
const mergedEnvironment = _objectSpread$1(_objectSpread$1({}, defaultEnvironment), environment);
|
|
247
|
+
|
|
248
|
+
// Provide default permissions to render the application route.
|
|
249
|
+
if (mergedProject) {
|
|
250
|
+
if (mergedProject.allAppliedPermissions.length === 0) {
|
|
251
|
+
const defaultPermissionKeys = entryPointUriPathToPermissionKeys(mergedEnvironment.entryPointUriPath);
|
|
252
|
+
mergedProject.allAppliedPermissions = mapResourceAccessToAppliedPermissions([defaultPermissionKeys.View]);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
let initialRoute = route;
|
|
256
|
+
if (!route && mergedProject) {
|
|
257
|
+
initialRoute = `/${mergedProject.key}/${mergedEnvironment.entryPointUriPath}`;
|
|
258
|
+
}
|
|
259
|
+
const memoryHistory = history ?? createEnhancedHistory(createMemoryHistory({
|
|
260
|
+
initialEntries: [initialRoute || '/'],
|
|
261
|
+
getUserConfirmation: (_message, callback) => callback(true)
|
|
262
|
+
}));
|
|
263
|
+
const ApplicationProviders = props => jsx(IntlProvider, {
|
|
264
|
+
locale: locale,
|
|
265
|
+
children: jsx(ApolloProviderWrapper, {
|
|
266
|
+
apolloClient: apolloClient,
|
|
267
|
+
mocks: mocks,
|
|
268
|
+
children: jsx(TestProviderFlopFlip, {
|
|
269
|
+
flags: flags,
|
|
270
|
+
children: jsx(ApplicationContextProvider, {
|
|
271
|
+
user: mergedUser,
|
|
272
|
+
project: mergedProject,
|
|
273
|
+
environment: mergedEnvironment,
|
|
274
|
+
projectDataLocale: dataLocale,
|
|
275
|
+
children: jsx(Router, {
|
|
276
|
+
history: memoryHistory,
|
|
277
|
+
children: jsx(Suspense, {
|
|
278
|
+
fallback: jsx(LoadingFallback, {}),
|
|
279
|
+
children: jsx(ApplicationEntryPoint, {
|
|
280
|
+
environment: mergedEnvironment,
|
|
281
|
+
disableRoutePermissionCheck: disableRoutePermissionCheck,
|
|
282
|
+
render: disableAutomaticEntryPointRoutes ?
|
|
283
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
284
|
+
() => jsx(Fragment, {
|
|
285
|
+
children: props.children
|
|
286
|
+
}) : undefined,
|
|
287
|
+
children: disableAutomaticEntryPointRoutes ? undefined :
|
|
288
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
289
|
+
props.children
|
|
290
|
+
})
|
|
291
|
+
})
|
|
292
|
+
})
|
|
293
|
+
})
|
|
294
|
+
})
|
|
295
|
+
})
|
|
296
|
+
});
|
|
297
|
+
return {
|
|
298
|
+
ApplicationProviders,
|
|
299
|
+
mergedUser,
|
|
300
|
+
mergedProject,
|
|
301
|
+
mergedEnvironment,
|
|
302
|
+
history: memoryHistory
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Inspired by
|
|
307
|
+
// https://github.com/kentcdodds/react-testing-library-course/blob/2a5b1560656790bb1d9c055fba3845780b2c2c97/src/__tests__/react-router-03.js
|
|
308
|
+
function renderApp(ui) {
|
|
309
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
310
|
+
const _createApplicationPro = createApplicationProviders(options),
|
|
311
|
+
ApplicationProviders = _createApplicationPro.ApplicationProviders,
|
|
312
|
+
mergedUser = _createApplicationPro.mergedUser,
|
|
313
|
+
mergedProject = _createApplicationPro.mergedProject,
|
|
314
|
+
mergedEnvironment = _createApplicationPro.mergedEnvironment,
|
|
315
|
+
history = _createApplicationPro.history;
|
|
316
|
+
|
|
317
|
+
// eslint-disable-next-line testing-library/render-result-naming-convention
|
|
318
|
+
const rendered = rtl.render(ui, _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
319
|
+
// eslint-disable-next-line react/display-name
|
|
320
|
+
wrapper: _ref2 => {
|
|
321
|
+
let children = _ref2.children,
|
|
322
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
323
|
+
return jsx(ApplicationProviders, _objectSpread$1(_objectSpread$1({}, props), {}, {
|
|
324
|
+
children: wrapIfNeeded(children, options.wrapper)
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
}));
|
|
328
|
+
return _objectSpread$1(_objectSpread$1({}, rendered), {}, {
|
|
329
|
+
// adding `history` to the returned utilities to allow us
|
|
330
|
+
// to reference it in our tests (just try to avoid using
|
|
331
|
+
// this to test implementation details).
|
|
332
|
+
history,
|
|
333
|
+
// Adding user, project & environment so tests know about the merge results
|
|
334
|
+
// Note that these objects do not resemble the application context, they are
|
|
335
|
+
// only intended to communicate the test setup back to the tests.
|
|
336
|
+
user: mergedUser,
|
|
337
|
+
project: mergedProject,
|
|
338
|
+
environment: mergedEnvironment
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function createReduxProviders() {
|
|
342
|
+
let _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
343
|
+
_ref3$store = _ref3.store,
|
|
344
|
+
store = _ref3$store === void 0 ? undefined : _ref3$store,
|
|
345
|
+
_ref3$storeState = _ref3.storeState,
|
|
346
|
+
storeState = _ref3$storeState === void 0 ? undefined : _ref3$storeState,
|
|
347
|
+
_ref3$sdkMocks = _ref3.sdkMocks,
|
|
348
|
+
sdkMocks = _ref3$sdkMocks === void 0 ? [] : _ref3$sdkMocks,
|
|
349
|
+
_ref3$mapNotification = _ref3.mapNotificationToComponent,
|
|
350
|
+
mapNotificationToComponent = _ref3$mapNotification === void 0 ? () => null : _ref3$mapNotification;
|
|
351
|
+
!!(store && storeState) ? process.env.NODE_ENV !== "production" ? invariant(false, '@commercetools-frontend/application-shell/test-utils: You provided both `store` and `storeState`. Please provide only one of them.') : invariant(false) : void 0;
|
|
352
|
+
!!(store && sdkMocks.length > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, '@commercetools-frontend/application-shell/test-utils: You provided both `store` and `sdkMocks`. Please provide only one of them.') : invariant(false) : void 0;
|
|
353
|
+
|
|
354
|
+
// Determine the redux store to use in tests.
|
|
355
|
+
// - When the user passed in a "store", we use that store and ignore
|
|
356
|
+
// sdkMocks and storeState.
|
|
357
|
+
// - When the user passed in no sdkMocks, we create a store using the
|
|
358
|
+
// provided storeState. If storeState is undefined, then the defaults kick
|
|
359
|
+
// in anyways.
|
|
360
|
+
// - Lastly, when sdkMocks were provided (and no store was provided), we
|
|
361
|
+
// create a store which applies a special middleware to allow mocking sdk
|
|
362
|
+
// responses. We further initialize the store with the provided storeState.
|
|
363
|
+
// If storeState is undefined, then the defaults kick in anyways.
|
|
364
|
+
const reduxStore = (() => {
|
|
365
|
+
if (store) return store;
|
|
366
|
+
if (sdkMocks.length === 0) return createReduxStore(storeState);
|
|
367
|
+
const testingMiddleware = createTestMiddleware(sdkMocks);
|
|
368
|
+
return createReduxStore(storeState, [testingMiddleware]);
|
|
369
|
+
})();
|
|
370
|
+
const ReduxProviders = props => jsx(NotificationProviderForCustomComponent, {
|
|
371
|
+
mapNotificationToComponent: mapNotificationToComponent,
|
|
372
|
+
children: jsx(Provider, {
|
|
373
|
+
store: reduxStore,
|
|
374
|
+
children: jsxs("div", {
|
|
375
|
+
children: [jsx(NotificationsList, {
|
|
376
|
+
domain: DOMAINS.GLOBAL
|
|
377
|
+
}), jsx(NotificationsList, {
|
|
378
|
+
domain: DOMAINS.PAGE
|
|
379
|
+
}), jsx(NotificationsList, {
|
|
380
|
+
domain: DOMAINS.SIDE
|
|
381
|
+
}), props.children]
|
|
382
|
+
})
|
|
383
|
+
})
|
|
384
|
+
});
|
|
385
|
+
return {
|
|
386
|
+
ReduxProviders,
|
|
387
|
+
reduxStore
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// Test setup for rendering with Redux
|
|
392
|
+
// We expose a sophisticated function because we plan to get rid of Redux
|
|
393
|
+
// Use this function only when your test actually needs Redux
|
|
394
|
+
function renderAppWithRedux(ui) {
|
|
395
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
396
|
+
const _createReduxProviders = createReduxProviders(options),
|
|
397
|
+
ReduxProviders = _createReduxProviders.ReduxProviders,
|
|
398
|
+
reduxStore = _createReduxProviders.reduxStore;
|
|
399
|
+
// eslint-disable-next-line testing-library/render-result-naming-convention
|
|
400
|
+
const rendered = renderApp(ui, _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
401
|
+
// eslint-disable-next-line react/display-name
|
|
402
|
+
wrapper: _ref4 => {
|
|
403
|
+
let children = _ref4.children,
|
|
404
|
+
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
405
|
+
return jsx(ReduxProviders, _objectSpread$1(_objectSpread$1({}, props), {}, {
|
|
406
|
+
children: wrapIfNeeded(children, options.wrapper)
|
|
407
|
+
}));
|
|
408
|
+
}
|
|
409
|
+
}));
|
|
410
|
+
return _objectSpread$1(_objectSpread$1({}, rendered), {}, {
|
|
411
|
+
// adding `store` to the returned utilities to allow us
|
|
412
|
+
// to reference it in our tests (just try to avoid using
|
|
413
|
+
// this to test implementation details).
|
|
414
|
+
store: reduxStore
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function renderHook(callback) {
|
|
418
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
419
|
+
const _createReduxProviders2 = createReduxProviders(options),
|
|
420
|
+
ReduxProviders = _createReduxProviders2.ReduxProviders,
|
|
421
|
+
reduxStore = _createReduxProviders2.reduxStore;
|
|
422
|
+
const _createApplicationPro2 = createApplicationProviders(options),
|
|
423
|
+
ApplicationProviders = _createApplicationPro2.ApplicationProviders,
|
|
424
|
+
mergedUser = _createApplicationPro2.mergedUser,
|
|
425
|
+
mergedProject = _createApplicationPro2.mergedProject,
|
|
426
|
+
mergedEnvironment = _createApplicationPro2.mergedEnvironment,
|
|
427
|
+
history = _createApplicationPro2.history;
|
|
428
|
+
const rendered = rtl.renderHook(callback, _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
429
|
+
wrapper: _ref5 => {
|
|
430
|
+
let children = _ref5.children;
|
|
431
|
+
return jsx(ApplicationProviders, {
|
|
432
|
+
children: jsx(ReduxProviders, {
|
|
433
|
+
children: wrapIfNeeded(children, options.wrapper)
|
|
434
|
+
})
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}));
|
|
438
|
+
return _objectSpread$1(_objectSpread$1({}, rendered), {}, {
|
|
439
|
+
store: reduxStore,
|
|
440
|
+
history,
|
|
441
|
+
user: mergedUser,
|
|
442
|
+
project: mergedProject,
|
|
443
|
+
environment: mergedEnvironment
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// namespace for hooks related helpers
|
|
448
|
+
const hooks = {
|
|
449
|
+
renderHook
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// Custom events for async focus and blur.
|
|
453
|
+
// This helps abstracting the act() call from the tests.
|
|
454
|
+
|
|
455
|
+
const customFireEvent = rtl.fireEvent;
|
|
456
|
+
customFireEvent.asyncFocus = element => {
|
|
457
|
+
return act(async () => element.focus());
|
|
458
|
+
};
|
|
459
|
+
customFireEvent.asyncBlur = element => {
|
|
460
|
+
return act(async () => element.blur());
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
464
|
+
let TCustomViewType = /*#__PURE__*/function (TCustomViewType) {
|
|
465
|
+
TCustomViewType["CustomPanel"] = "CustomPanel";
|
|
466
|
+
return TCustomViewType;
|
|
467
|
+
}({});
|
|
468
|
+
|
|
469
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
470
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
471
|
+
const testCustomViewData = {
|
|
472
|
+
id: 'custom-view-id',
|
|
473
|
+
defaultLabel: 'My View',
|
|
474
|
+
labelAllLocales: [],
|
|
475
|
+
url: 'https://my-view.com',
|
|
476
|
+
type: TCustomViewType.CustomPanel,
|
|
477
|
+
locators: ['products.product_details.general'],
|
|
478
|
+
permissions: [{
|
|
479
|
+
name: 'view',
|
|
480
|
+
oAuthScopes: ['view_products']
|
|
481
|
+
}]
|
|
482
|
+
};
|
|
483
|
+
const renderCustomView = props => {
|
|
484
|
+
return renderAppWithRedux(jsx(CustomViewContextProvider, {
|
|
485
|
+
hostUrl: props.customViewHostUrl ?? 'https://mc.ct.com/my-project/products/product-id-1',
|
|
486
|
+
customViewConfig: _objectSpread(_objectSpread({}, testCustomViewData), props.customViewConfig),
|
|
487
|
+
children: props.children
|
|
488
|
+
}), {
|
|
489
|
+
apolloClient: props.apolloClient,
|
|
490
|
+
locale: props.locale,
|
|
491
|
+
project: {
|
|
492
|
+
key: props.projectKey,
|
|
493
|
+
allAppliedPermissions: props.projectAllAppliedPermissions || []
|
|
494
|
+
},
|
|
495
|
+
environment: _objectSpread(_objectSpread({}, props.environment || {}), {}, {
|
|
496
|
+
entryPointUriPath: CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH
|
|
497
|
+
}),
|
|
498
|
+
user: props.user
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
export { customFireEvent, denormalizeActionRights, denormalizeDataFences, denormalizePermissions, hooks, mapResourceAccessToAppliedPermissions, renderApp, renderAppWithRedux, renderCustomView };
|