@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,117 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var reactRouterDom = require('react-router-dom');
|
|
5
|
+
var uuid = require('uuid');
|
|
6
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
7
|
+
var constants = require('@commercetools-frontend/constants');
|
|
8
|
+
var urlUtils = require('@commercetools-frontend/url-utils');
|
|
9
|
+
var oidc = require('./oidc-d74e6aa2.cjs.prod.js');
|
|
10
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-480e8de8.cjs.prod.js');
|
|
11
|
+
var getMcOrigin = require('./get-mc-origin-8f7a578c.cjs.prod.js');
|
|
12
|
+
var redirector = require('./redirector-0c72d0a4.cjs.prod.js');
|
|
13
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
14
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
15
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
16
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
17
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
18
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
25
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
26
|
+
require('qss');
|
|
27
|
+
require('./location-537e0660.cjs.prod.js');
|
|
28
|
+
|
|
29
|
+
const generateAndCacheNonceWithState = state => {
|
|
30
|
+
const nonce = uuid.v4();
|
|
31
|
+
// We store additional information within the given `nonce`
|
|
32
|
+
// to then retrieve it later when the IdP redirects back
|
|
33
|
+
// to our application. The URL will contain the `nonce` within
|
|
34
|
+
// the id_token and, once validated, we can retrieve and use
|
|
35
|
+
// the state object.
|
|
36
|
+
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
37
|
+
applicationShellConnectors.oidcStorage.setSessionState(nonce, state);
|
|
38
|
+
return nonce;
|
|
39
|
+
};
|
|
40
|
+
const RedirectToLogin = () => {
|
|
41
|
+
const location = reactRouterDom.useLocation();
|
|
42
|
+
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
43
|
+
const redirector$1 = redirector.useRedirector();
|
|
44
|
+
react.useEffect(() => {
|
|
45
|
+
if (window.app.__DEVELOPMENT__?.oidc?.authorizeUrl) {
|
|
46
|
+
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
47
|
+
// a new authorization flow.
|
|
48
|
+
applicationShellConnectors.oidcStorage.clearSession();
|
|
49
|
+
|
|
50
|
+
// We pick the project key from local storage. This assumes that the value
|
|
51
|
+
// as been previously set when the application starts up.
|
|
52
|
+
// This is necessary to allow switching projects and triggering a new login.
|
|
53
|
+
const nextProjectKey = applicationShellConnectors.oidcStorage.getActiveProjectKey();
|
|
54
|
+
|
|
55
|
+
// According to the OIDC spec, the `state` parameter is recommended to be sent
|
|
56
|
+
// to the authorization server to help mitigating Cross-Site Request Forgery.
|
|
57
|
+
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
58
|
+
// Using `state` or `nonce` is very similar but with subtle differences.
|
|
59
|
+
// Here we follow the approach described by Auth0 on how to use both, where
|
|
60
|
+
// we generate a `nonce`, store it in session storage together with some state,
|
|
61
|
+
// and send it to the authorization server as the `state` parameter.
|
|
62
|
+
// https://auth0.com/docs/protocols/oauth2/redirect-users
|
|
63
|
+
// Additionally, we still send the `nonce` parameter as well.
|
|
64
|
+
const sessionId = generateAndCacheNonceWithState({
|
|
65
|
+
applicationId: window.app.applicationId,
|
|
66
|
+
// Store query parameters to be used after the callback redirect
|
|
67
|
+
query: {
|
|
68
|
+
redirectTo: nextProjectKey ? `/${nextProjectKey}` : '/'
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const requestedScope = oidc.buildOidcScope({
|
|
72
|
+
projectKey: nextProjectKey ?? undefined,
|
|
73
|
+
oAuthScopes: window.app.__DEVELOPMENT__?.oidc?.oAuthScopes,
|
|
74
|
+
additionalOAuthScopes: window.app.__DEVELOPMENT__?.oidc?.additionalOAuthScopes,
|
|
75
|
+
teamId: window.app.__DEVELOPMENT__?.oidc?.teamId,
|
|
76
|
+
applicationId: window.app.__DEVELOPMENT__?.oidc?.applicationId
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Store session scopes, to be able to detect if requested scopes changed
|
|
80
|
+
// in the application config and invalidate the session.
|
|
81
|
+
// This is only valid for local development.
|
|
82
|
+
applicationShellConnectors.oidcStorage.setSessionScope(requestedScope);
|
|
83
|
+
redirector$1({
|
|
84
|
+
to: '',
|
|
85
|
+
origin: window.app.__DEVELOPMENT__?.oidc?.authorizeUrl,
|
|
86
|
+
location: location,
|
|
87
|
+
queryParams: {
|
|
88
|
+
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
89
|
+
// Query parameters for OIDC-lik workflow.
|
|
90
|
+
client_id: window.app.applicationId,
|
|
91
|
+
response_type: oidc.OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
92
|
+
scope: requestedScope,
|
|
93
|
+
state: sessionId,
|
|
94
|
+
nonce: sessionId
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
100
|
+
redirector$1({
|
|
101
|
+
to: 'login',
|
|
102
|
+
origin: mcOrigin,
|
|
103
|
+
location: location,
|
|
104
|
+
queryParams: {
|
|
105
|
+
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
106
|
+
redirectTo: urlUtils.trimLeadingAndTrailingSlashes(urlUtils.joinPaths(window.location.origin, location.pathname))
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Only execute once!
|
|
111
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
|
+
}, []);
|
|
113
|
+
return null;
|
|
114
|
+
};
|
|
115
|
+
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
116
|
+
|
|
117
|
+
exports["default"] = RedirectToLogin;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useLocation } from 'react-router-dom';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
4
|
+
import { oidcStorage } from '@commercetools-frontend/application-shell-connectors';
|
|
5
|
+
import { LOGOUT_REASONS } from '@commercetools-frontend/constants';
|
|
6
|
+
import { trimLeadingAndTrailingSlashes, joinPaths } from '@commercetools-frontend/url-utils';
|
|
7
|
+
import { b as buildOidcScope, a as OIDC_RESPONSE_TYPES } from './oidc-b2520905.esm.js';
|
|
8
|
+
import { u as useIsServedByProxy } from './use-is-served-by-proxy-a383da4b.esm.js';
|
|
9
|
+
import { g as getMcOrigin } from './get-mc-origin-fecfee07.esm.js';
|
|
10
|
+
import { u as useRedirector } from './redirector-d856975f.esm.js';
|
|
11
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
12
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
13
|
+
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
14
|
+
import '@babel/runtime-corejs3/core-js-stable/url';
|
|
15
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/reverse';
|
|
16
|
+
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
17
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
18
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
19
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
20
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
21
|
+
import '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
22
|
+
import '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
23
|
+
import '@babel/runtime-corejs3/helpers/defineProperty';
|
|
24
|
+
import 'qss';
|
|
25
|
+
import './location-f21dbc25.esm.js';
|
|
26
|
+
|
|
27
|
+
const generateAndCacheNonceWithState = state => {
|
|
28
|
+
const nonce = v4();
|
|
29
|
+
// We store additional information within the given `nonce`
|
|
30
|
+
// to then retrieve it later when the IdP redirects back
|
|
31
|
+
// to our application. The URL will contain the `nonce` within
|
|
32
|
+
// the id_token and, once validated, we can retrieve and use
|
|
33
|
+
// the state object.
|
|
34
|
+
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
35
|
+
oidcStorage.setSessionState(nonce, state);
|
|
36
|
+
return nonce;
|
|
37
|
+
};
|
|
38
|
+
const RedirectToLogin = () => {
|
|
39
|
+
const location = useLocation();
|
|
40
|
+
const servedByProxy = useIsServedByProxy();
|
|
41
|
+
const redirector = useRedirector();
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (window.app.__DEVELOPMENT__?.oidc?.authorizeUrl) {
|
|
44
|
+
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
45
|
+
// a new authorization flow.
|
|
46
|
+
oidcStorage.clearSession();
|
|
47
|
+
|
|
48
|
+
// We pick the project key from local storage. This assumes that the value
|
|
49
|
+
// as been previously set when the application starts up.
|
|
50
|
+
// This is necessary to allow switching projects and triggering a new login.
|
|
51
|
+
const nextProjectKey = oidcStorage.getActiveProjectKey();
|
|
52
|
+
|
|
53
|
+
// According to the OIDC spec, the `state` parameter is recommended to be sent
|
|
54
|
+
// to the authorization server to help mitigating Cross-Site Request Forgery.
|
|
55
|
+
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
56
|
+
// Using `state` or `nonce` is very similar but with subtle differences.
|
|
57
|
+
// Here we follow the approach described by Auth0 on how to use both, where
|
|
58
|
+
// we generate a `nonce`, store it in session storage together with some state,
|
|
59
|
+
// and send it to the authorization server as the `state` parameter.
|
|
60
|
+
// https://auth0.com/docs/protocols/oauth2/redirect-users
|
|
61
|
+
// Additionally, we still send the `nonce` parameter as well.
|
|
62
|
+
const sessionId = generateAndCacheNonceWithState({
|
|
63
|
+
applicationId: window.app.applicationId,
|
|
64
|
+
// Store query parameters to be used after the callback redirect
|
|
65
|
+
query: {
|
|
66
|
+
redirectTo: nextProjectKey ? `/${nextProjectKey}` : '/'
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const requestedScope = buildOidcScope({
|
|
70
|
+
projectKey: nextProjectKey ?? undefined,
|
|
71
|
+
oAuthScopes: window.app.__DEVELOPMENT__?.oidc?.oAuthScopes,
|
|
72
|
+
additionalOAuthScopes: window.app.__DEVELOPMENT__?.oidc?.additionalOAuthScopes,
|
|
73
|
+
teamId: window.app.__DEVELOPMENT__?.oidc?.teamId,
|
|
74
|
+
applicationId: window.app.__DEVELOPMENT__?.oidc?.applicationId
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Store session scopes, to be able to detect if requested scopes changed
|
|
78
|
+
// in the application config and invalidate the session.
|
|
79
|
+
// This is only valid for local development.
|
|
80
|
+
oidcStorage.setSessionScope(requestedScope);
|
|
81
|
+
redirector({
|
|
82
|
+
to: '',
|
|
83
|
+
origin: window.app.__DEVELOPMENT__?.oidc?.authorizeUrl,
|
|
84
|
+
location: location,
|
|
85
|
+
queryParams: {
|
|
86
|
+
reason: LOGOUT_REASONS.UNAUTHORIZED,
|
|
87
|
+
// Query parameters for OIDC-lik workflow.
|
|
88
|
+
client_id: window.app.applicationId,
|
|
89
|
+
response_type: OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
90
|
+
scope: requestedScope,
|
|
91
|
+
state: sessionId,
|
|
92
|
+
nonce: sessionId
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const mcOrigin = servedByProxy ? getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
98
|
+
redirector({
|
|
99
|
+
to: 'login',
|
|
100
|
+
origin: mcOrigin,
|
|
101
|
+
location: location,
|
|
102
|
+
queryParams: {
|
|
103
|
+
reason: LOGOUT_REASONS.UNAUTHORIZED,
|
|
104
|
+
redirectTo: trimLeadingAndTrailingSlashes(joinPaths(window.location.origin, location.pathname))
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Only execute once!
|
|
109
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
|
+
}, []);
|
|
111
|
+
return null;
|
|
112
|
+
};
|
|
113
|
+
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
114
|
+
|
|
115
|
+
export { RedirectToLogin as default };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var reactRouterDom = require('react-router-dom');
|
|
5
|
+
var uuid = require('uuid');
|
|
6
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
7
|
+
var constants = require('@commercetools-frontend/constants');
|
|
8
|
+
var urlUtils = require('@commercetools-frontend/url-utils');
|
|
9
|
+
var oidc = require('./oidc-8827f9fe.cjs.dev.js');
|
|
10
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-28f19a6f.cjs.dev.js');
|
|
11
|
+
var getMcOrigin = require('./get-mc-origin-a86dff20.cjs.dev.js');
|
|
12
|
+
var redirector = require('./redirector-72ccfbc2.cjs.dev.js');
|
|
13
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
14
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
15
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
16
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
17
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
18
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
25
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
26
|
+
require('qss');
|
|
27
|
+
require('./location-c835b8df.cjs.dev.js');
|
|
28
|
+
|
|
29
|
+
const generateAndCacheNonceWithState = state => {
|
|
30
|
+
const nonce = uuid.v4();
|
|
31
|
+
// We store additional information within the given `nonce`
|
|
32
|
+
// to then retrieve it later when the IdP redirects back
|
|
33
|
+
// to our application. The URL will contain the `nonce` within
|
|
34
|
+
// the id_token and, once validated, we can retrieve and use
|
|
35
|
+
// the state object.
|
|
36
|
+
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
37
|
+
applicationShellConnectors.oidcStorage.setSessionState(nonce, state);
|
|
38
|
+
return nonce;
|
|
39
|
+
};
|
|
40
|
+
const RedirectToLogin = () => {
|
|
41
|
+
const location = reactRouterDom.useLocation();
|
|
42
|
+
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
43
|
+
const redirector$1 = redirector.useRedirector();
|
|
44
|
+
react.useEffect(() => {
|
|
45
|
+
if (window.app.__DEVELOPMENT__?.oidc?.authorizeUrl) {
|
|
46
|
+
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
47
|
+
// a new authorization flow.
|
|
48
|
+
applicationShellConnectors.oidcStorage.clearSession();
|
|
49
|
+
|
|
50
|
+
// We pick the project key from local storage. This assumes that the value
|
|
51
|
+
// as been previously set when the application starts up.
|
|
52
|
+
// This is necessary to allow switching projects and triggering a new login.
|
|
53
|
+
const nextProjectKey = applicationShellConnectors.oidcStorage.getActiveProjectKey();
|
|
54
|
+
|
|
55
|
+
// According to the OIDC spec, the `state` parameter is recommended to be sent
|
|
56
|
+
// to the authorization server to help mitigating Cross-Site Request Forgery.
|
|
57
|
+
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
58
|
+
// Using `state` or `nonce` is very similar but with subtle differences.
|
|
59
|
+
// Here we follow the approach described by Auth0 on how to use both, where
|
|
60
|
+
// we generate a `nonce`, store it in session storage together with some state,
|
|
61
|
+
// and send it to the authorization server as the `state` parameter.
|
|
62
|
+
// https://auth0.com/docs/protocols/oauth2/redirect-users
|
|
63
|
+
// Additionally, we still send the `nonce` parameter as well.
|
|
64
|
+
const sessionId = generateAndCacheNonceWithState({
|
|
65
|
+
applicationId: window.app.applicationId,
|
|
66
|
+
// Store query parameters to be used after the callback redirect
|
|
67
|
+
query: {
|
|
68
|
+
redirectTo: nextProjectKey ? `/${nextProjectKey}` : '/'
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const requestedScope = oidc.buildOidcScope({
|
|
72
|
+
projectKey: nextProjectKey ?? undefined,
|
|
73
|
+
oAuthScopes: window.app.__DEVELOPMENT__?.oidc?.oAuthScopes,
|
|
74
|
+
additionalOAuthScopes: window.app.__DEVELOPMENT__?.oidc?.additionalOAuthScopes,
|
|
75
|
+
teamId: window.app.__DEVELOPMENT__?.oidc?.teamId,
|
|
76
|
+
applicationId: window.app.__DEVELOPMENT__?.oidc?.applicationId
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Store session scopes, to be able to detect if requested scopes changed
|
|
80
|
+
// in the application config and invalidate the session.
|
|
81
|
+
// This is only valid for local development.
|
|
82
|
+
applicationShellConnectors.oidcStorage.setSessionScope(requestedScope);
|
|
83
|
+
redirector$1({
|
|
84
|
+
to: '',
|
|
85
|
+
origin: window.app.__DEVELOPMENT__?.oidc?.authorizeUrl,
|
|
86
|
+
location: location,
|
|
87
|
+
queryParams: {
|
|
88
|
+
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
89
|
+
// Query parameters for OIDC-lik workflow.
|
|
90
|
+
client_id: window.app.applicationId,
|
|
91
|
+
response_type: oidc.OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
92
|
+
scope: requestedScope,
|
|
93
|
+
state: sessionId,
|
|
94
|
+
nonce: sessionId
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
100
|
+
redirector$1({
|
|
101
|
+
to: 'login',
|
|
102
|
+
origin: mcOrigin,
|
|
103
|
+
location: location,
|
|
104
|
+
queryParams: {
|
|
105
|
+
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
106
|
+
redirectTo: urlUtils.trimLeadingAndTrailingSlashes(urlUtils.joinPaths(window.location.origin, location.pathname))
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Only execute once!
|
|
111
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
|
+
}, []);
|
|
113
|
+
return null;
|
|
114
|
+
};
|
|
115
|
+
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
116
|
+
|
|
117
|
+
exports["default"] = RedirectToLogin;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
4
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
5
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
6
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
7
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
8
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
9
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
10
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
11
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
12
|
+
var reactRouterDom = require('react-router-dom');
|
|
13
|
+
var constants = require('@commercetools-frontend/constants');
|
|
14
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-28f19a6f.cjs.dev.js');
|
|
15
|
+
var getMcOrigin = require('./get-mc-origin-a86dff20.cjs.dev.js');
|
|
16
|
+
var dist_commercetoolsFrontendApplicationShell = require('./index-f0f4fbcd.cjs.dev.js');
|
|
17
|
+
var redirector = require('./redirector-72ccfbc2.cjs.dev.js');
|
|
18
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
19
|
+
require('@commercetools-frontend/application-shell-connectors');
|
|
20
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
23
|
+
require('react');
|
|
24
|
+
require('./index-614accc4.cjs.dev.js');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
26
|
+
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
27
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
28
|
+
require('@babel/runtime-corejs3/core-js-stable/reflect/has');
|
|
29
|
+
require('@reduxjs/toolkit');
|
|
30
|
+
require('lodash/mapValues');
|
|
31
|
+
require('omit-empty-es');
|
|
32
|
+
require('redux');
|
|
33
|
+
require('redux-thunk');
|
|
34
|
+
require('@commercetools-frontend/notifications');
|
|
35
|
+
require('@commercetools-frontend/sdk');
|
|
36
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
|
|
37
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
38
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
39
|
+
require('@commercetools-frontend/sentry');
|
|
40
|
+
require('@commercetools-frontend/react-notifications');
|
|
41
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/starts-with');
|
|
42
|
+
require('redux-logger');
|
|
43
|
+
require('@emotion/styled/base');
|
|
44
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
45
|
+
require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
46
|
+
require('@emotion/react');
|
|
47
|
+
require('@commercetools-frontend/application-components');
|
|
48
|
+
require('@commercetools-frontend/i18n');
|
|
49
|
+
require('./oidc-8827f9fe.cjs.dev.js');
|
|
50
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
51
|
+
require('@commercetools-uikit/design-system');
|
|
52
|
+
require('@commercetools-uikit/spacings');
|
|
53
|
+
require('react-intl');
|
|
54
|
+
require('@commercetools-uikit/flat-button');
|
|
55
|
+
require('@commercetools-uikit/icons');
|
|
56
|
+
require('./location-c835b8df.cjs.dev.js');
|
|
57
|
+
require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
58
|
+
require('memoize-one');
|
|
59
|
+
require('react-select');
|
|
60
|
+
require('@commercetools-uikit/accessible-hidden');
|
|
61
|
+
require('@commercetools-uikit/select-input');
|
|
62
|
+
require('@commercetools-uikit/text');
|
|
63
|
+
require('@commercetools-frontend/assets/images/ct-logo.svg');
|
|
64
|
+
require('@commercetools-uikit/loading-spinner');
|
|
65
|
+
require('@commercetools-frontend/browser-history');
|
|
66
|
+
require('@commercetools-frontend/l10n');
|
|
67
|
+
require('@babel/runtime-corejs3/core-js-stable/reflect/construct');
|
|
68
|
+
require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
69
|
+
require('@babel/runtime-corejs3/helpers/createClass');
|
|
70
|
+
require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
|
|
71
|
+
require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
72
|
+
require('@babel/runtime-corejs3/helpers/inherits');
|
|
73
|
+
require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
|
|
74
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/flags');
|
|
75
|
+
require('@apollo/client/react');
|
|
76
|
+
require('@flopflip/combine-adapters');
|
|
77
|
+
require('@flopflip/http-adapter');
|
|
78
|
+
require('@flopflip/launchdarkly-adapter');
|
|
79
|
+
require('@flopflip/react-broadcast');
|
|
80
|
+
require('@flopflip/types');
|
|
81
|
+
require('react-redux');
|
|
82
|
+
require('@commercetools-uikit/design-system/materials/resets.css');
|
|
83
|
+
require('@commercetools-frontend/application-config/ssr');
|
|
84
|
+
require('@commercetools-frontend/permissions');
|
|
85
|
+
require('@flopflip/memory-adapter');
|
|
86
|
+
require('@babel/runtime-corejs3/core-js-stable/json/stringify');
|
|
87
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
88
|
+
require('@commercetools-frontend/actions-global');
|
|
89
|
+
require('qss');
|
|
90
|
+
|
|
91
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
92
|
+
|
|
93
|
+
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
94
|
+
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
95
|
+
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
96
|
+
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
97
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
98
|
+
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
99
|
+
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
100
|
+
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
101
|
+
|
|
102
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
103
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
104
|
+
// When the application redirects to this route, we always force a hard redirect
|
|
105
|
+
// to the logout route of the authentication service.
|
|
106
|
+
const RedirectToLogout = props => {
|
|
107
|
+
const location = reactRouterDom.useLocation();
|
|
108
|
+
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
109
|
+
if (window.app.__DEVELOPMENT__?.oidc?.authorizeUrl) {
|
|
110
|
+
return jsxRuntime.jsx(dist_commercetoolsFrontendApplicationShell.RedirectToLogin, {});
|
|
111
|
+
}
|
|
112
|
+
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
113
|
+
return jsxRuntime.jsx(redirector.Redirector, {
|
|
114
|
+
to: "logout",
|
|
115
|
+
origin: mcOrigin,
|
|
116
|
+
location: location,
|
|
117
|
+
queryParams: _objectSpread({
|
|
118
|
+
reason: props.reason ?? constants.LOGOUT_REASONS.USER
|
|
119
|
+
}, servedByProxy ? {} : {
|
|
120
|
+
// This will be used after being logged in, to redirect to this location.
|
|
121
|
+
redirectTo: window.location.origin
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
exports["default"] = RedirectToLogout;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
2
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
3
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
5
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
7
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
|
+
import { useLocation } from 'react-router-dom';
|
|
11
|
+
import { LOGOUT_REASONS } from '@commercetools-frontend/constants';
|
|
12
|
+
import { u as useIsServedByProxy } from './use-is-served-by-proxy-a383da4b.esm.js';
|
|
13
|
+
import { g as getMcOrigin } from './get-mc-origin-fecfee07.esm.js';
|
|
14
|
+
import { R as RedirectToLogin } from './index-8637a317.esm.js';
|
|
15
|
+
import { R as Redirector } from './redirector-d856975f.esm.js';
|
|
16
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
17
|
+
import '@commercetools-frontend/application-shell-connectors';
|
|
18
|
+
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
19
|
+
import '@babel/runtime-corejs3/core-js-stable/url';
|
|
20
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/reverse';
|
|
21
|
+
import 'react';
|
|
22
|
+
import './index-86039df7.esm.js';
|
|
23
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
24
|
+
import '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
25
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
26
|
+
import '@babel/runtime-corejs3/core-js-stable/reflect/has';
|
|
27
|
+
import '@reduxjs/toolkit';
|
|
28
|
+
import 'lodash/mapValues';
|
|
29
|
+
import 'omit-empty-es';
|
|
30
|
+
import 'redux';
|
|
31
|
+
import 'redux-thunk';
|
|
32
|
+
import '@commercetools-frontend/notifications';
|
|
33
|
+
import '@commercetools-frontend/sdk';
|
|
34
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
|
35
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
36
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
37
|
+
import '@commercetools-frontend/sentry';
|
|
38
|
+
import '@commercetools-frontend/react-notifications';
|
|
39
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
|
|
40
|
+
import 'redux-logger';
|
|
41
|
+
import '@emotion/styled/base';
|
|
42
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/find';
|
|
43
|
+
import '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
44
|
+
import '@emotion/react';
|
|
45
|
+
import '@commercetools-frontend/application-components';
|
|
46
|
+
import '@commercetools-frontend/i18n';
|
|
47
|
+
import './oidc-b2520905.esm.js';
|
|
48
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
49
|
+
import '@commercetools-uikit/design-system';
|
|
50
|
+
import '@commercetools-uikit/spacings';
|
|
51
|
+
import 'react-intl';
|
|
52
|
+
import '@commercetools-uikit/flat-button';
|
|
53
|
+
import '@commercetools-uikit/icons';
|
|
54
|
+
import './location-f21dbc25.esm.js';
|
|
55
|
+
import '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
56
|
+
import 'memoize-one';
|
|
57
|
+
import 'react-select';
|
|
58
|
+
import '@commercetools-uikit/accessible-hidden';
|
|
59
|
+
import '@commercetools-uikit/select-input';
|
|
60
|
+
import '@commercetools-uikit/text';
|
|
61
|
+
import '@commercetools-frontend/assets/images/ct-logo.svg';
|
|
62
|
+
import '@commercetools-uikit/loading-spinner';
|
|
63
|
+
import '@commercetools-frontend/browser-history';
|
|
64
|
+
import '@commercetools-frontend/l10n';
|
|
65
|
+
import '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
|
66
|
+
import '@babel/runtime-corejs3/helpers/classCallCheck';
|
|
67
|
+
import '@babel/runtime-corejs3/helpers/createClass';
|
|
68
|
+
import '@babel/runtime-corejs3/helpers/possibleConstructorReturn';
|
|
69
|
+
import '@babel/runtime-corejs3/helpers/getPrototypeOf';
|
|
70
|
+
import '@babel/runtime-corejs3/helpers/inherits';
|
|
71
|
+
import '@babel/runtime-corejs3/core-js-stable/object/from-entries';
|
|
72
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/flags';
|
|
73
|
+
import '@apollo/client/react';
|
|
74
|
+
import '@flopflip/combine-adapters';
|
|
75
|
+
import '@flopflip/http-adapter';
|
|
76
|
+
import '@flopflip/launchdarkly-adapter';
|
|
77
|
+
import '@flopflip/react-broadcast';
|
|
78
|
+
import '@flopflip/types';
|
|
79
|
+
import 'react-redux';
|
|
80
|
+
import '@commercetools-uikit/design-system/materials/resets.css';
|
|
81
|
+
import '@commercetools-frontend/application-config/ssr';
|
|
82
|
+
import '@commercetools-frontend/permissions';
|
|
83
|
+
import '@flopflip/memory-adapter';
|
|
84
|
+
import '@babel/runtime-corejs3/core-js-stable/json/stringify';
|
|
85
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
86
|
+
import '@commercetools-frontend/actions-global';
|
|
87
|
+
import 'qss';
|
|
88
|
+
|
|
89
|
+
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; }
|
|
90
|
+
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; }
|
|
91
|
+
// When the application redirects to this route, we always force a hard redirect
|
|
92
|
+
// to the logout route of the authentication service.
|
|
93
|
+
const RedirectToLogout = props => {
|
|
94
|
+
const location = useLocation();
|
|
95
|
+
const servedByProxy = useIsServedByProxy();
|
|
96
|
+
if (window.app.__DEVELOPMENT__?.oidc?.authorizeUrl) {
|
|
97
|
+
return jsx(RedirectToLogin, {});
|
|
98
|
+
}
|
|
99
|
+
const mcOrigin = servedByProxy ? getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
100
|
+
return jsx(Redirector, {
|
|
101
|
+
to: "logout",
|
|
102
|
+
origin: mcOrigin,
|
|
103
|
+
location: location,
|
|
104
|
+
queryParams: _objectSpread({
|
|
105
|
+
reason: props.reason ?? LOGOUT_REASONS.USER
|
|
106
|
+
}, servedByProxy ? {} : {
|
|
107
|
+
// This will be used after being logged in, to redirect to this location.
|
|
108
|
+
redirectTo: window.location.origin
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export { RedirectToLogout as default };
|