@commercetools-frontend/application-shell 22.14.3 → 22.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-application-shell.cjs.dev.js +1 -1
- package/dist/commercetools-frontend-application-shell.cjs.prod.js +1 -1
- package/dist/commercetools-frontend-application-shell.esm.js +1 -1
- package/dist/{custom-view-dev-host-52595f60.cjs.dev.js → custom-view-dev-host-0f62a220.cjs.dev.js} +1 -1
- package/dist/{custom-view-dev-host-98e7ce7d.cjs.prod.js → custom-view-dev-host-714c9d65.cjs.prod.js} +1 -1
- package/dist/{custom-view-dev-host-945f058b.esm.js → custom-view-dev-host-e3c2a970.esm.js} +1 -1
- package/dist/declarations/src/components/authenticated/oidc-callback.async.d.ts +1 -1
- package/dist/declarations/src/components/authenticated/oidc-callback.d.ts +1 -1
- package/dist/declarations/src/components/navbar/menu-items.d.ts +4 -4
- package/dist/declarations/src/components/navbar/use-navbar-state-manager.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-login/index.d.ts +1 -1
- package/dist/declarations/src/components/redirect-to-login/redirect-to-login.d.ts +1 -1
- package/dist/declarations/src/components/redirector/index.d.ts +1 -1
- package/dist/declarations/src/components/redirector/redirector.d.ts +6 -5
- package/dist/{index-c29f8aa0.cjs.prod.js → index-08c8fcb3.cjs.prod.js} +42 -19
- package/dist/{index-35f9f7c2.esm.js → index-4eee2222.esm.js} +56 -30
- package/dist/{index-0d0e6d8b.cjs.dev.js → index-97ddc7b1.cjs.dev.js} +54 -28
- package/dist/navbar-5a1b9a06.esm.js +1223 -0
- package/dist/navbar-a5342082.cjs.dev.js +1256 -0
- package/dist/{navbar-be902d73.cjs.prod.js → navbar-d60f807a.cjs.prod.js} +38 -8
- package/dist/{oidc-callback-860db268.esm.js → oidc-callback-621a8bd2.esm.js} +69 -48
- package/dist/{oidc-callback-25005367.cjs.prod.js → oidc-callback-f70d9fd1.cjs.prod.js} +66 -47
- package/dist/{oidc-callback-6aa0b446.cjs.dev.js → oidc-callback-fa62a3ca.cjs.dev.js} +70 -48
- package/dist/{project-container-22dd3ee8.cjs.dev.js → project-container-2751a67a.cjs.dev.js} +5 -5
- package/dist/{project-container-8a000259.esm.js → project-container-b2a1fd66.esm.js} +5 -5
- package/dist/{project-container-0b7034a5.cjs.prod.js → project-container-e657827e.cjs.prod.js} +5 -5
- package/dist/{project-expired-abde10a9.cjs.prod.js → project-expired-085f8e5a.cjs.prod.js} +2 -2
- package/dist/{project-expired-175f09e7.esm.js → project-expired-09e4078a.esm.js} +2 -2
- package/dist/{project-expired-7e9f4a37.cjs.dev.js → project-expired-cb7e26ef.cjs.dev.js} +2 -2
- package/dist/{project-not-found-89cc6d97.esm.js → project-not-found-13cd7767.esm.js} +2 -2
- package/dist/{project-not-found-aeb6b4e5.cjs.prod.js → project-not-found-2f6dc5d2.cjs.prod.js} +2 -2
- package/dist/{project-not-found-fcb9f62d.cjs.dev.js → project-not-found-7646a1ee.cjs.dev.js} +2 -2
- package/dist/{project-not-initialized-1e4f45dc.esm.js → project-not-initialized-74f4384a.esm.js} +2 -2
- package/dist/{project-not-initialized-e8c5fae6.cjs.prod.js → project-not-initialized-9694ef3e.cjs.prod.js} +2 -2
- package/dist/{project-not-initialized-718a18d0.cjs.dev.js → project-not-initialized-e40d16f2.cjs.dev.js} +2 -2
- package/dist/{project-suspended-d028eced.cjs.dev.js → project-suspended-55f2ac4f.cjs.dev.js} +2 -2
- package/dist/{project-suspended-1f94c722.cjs.prod.js → project-suspended-f5463061.cjs.prod.js} +2 -2
- package/dist/{project-suspended-0d49681f.esm.js → project-suspended-f9999215.esm.js} +2 -2
- package/dist/{quick-access-11418f11.esm.js → quick-access-6cd9b3ba.esm.js} +1 -1
- package/dist/{quick-access-08a2f835.cjs.dev.js → quick-access-8314ffe5.cjs.dev.js} +1 -1
- package/dist/{quick-access-ecbaedf9.cjs.prod.js → quick-access-c9f75955.cjs.prod.js} +1 -1
- package/dist/redirect-to-login-5e148cff.esm.js +118 -0
- package/dist/redirect-to-login-d2287ced.cjs.dev.js +120 -0
- package/dist/redirect-to-login-e4f2ca07.cjs.prod.js +120 -0
- package/dist/{redirect-to-logout-8cbbf5b3.cjs.dev.js → redirect-to-logout-a4bc80a6.cjs.dev.js} +3 -6
- package/dist/{redirect-to-logout-2418d058.cjs.prod.js → redirect-to-logout-cdcb00b1.cjs.prod.js} +3 -6
- package/dist/{redirect-to-logout-7fb8c085.esm.js → redirect-to-logout-ed7cd66d.esm.js} +3 -6
- package/dist/redirect-to-project-create-1d0c6b01.esm.js +59 -0
- package/dist/redirect-to-project-create-67d7cd03.cjs.dev.js +67 -0
- package/dist/redirect-to-project-create-c962f72f.cjs.prod.js +67 -0
- package/dist/{redirector-752b4efc.cjs.prod.js → redirector-15844d9b.cjs.prod.js} +22 -12
- package/dist/{redirector-db8b5cd2.esm.js → redirector-54a03b75.esm.js} +23 -14
- package/dist/{redirector-5daa8baa.cjs.dev.js → redirector-fcdeaba7.cjs.dev.js} +22 -12
- package/dist/{requests-in-flight-loader-41d05ebb.cjs.dev.js → requests-in-flight-loader-097bfc28.cjs.dev.js} +1 -1
- package/dist/{requests-in-flight-loader-9400ad17.esm.js → requests-in-flight-loader-e5951187.esm.js} +1 -1
- package/dist/{requests-in-flight-loader-7580242c.cjs.prod.js → requests-in-flight-loader-f584e80c.cjs.prod.js} +1 -1
- package/dist/{service-page-project-switcher-c2446f31.cjs.dev.js → service-page-project-switcher-8f694816.cjs.dev.js} +1 -1
- package/dist/{service-page-project-switcher-f7058ef7.esm.js → service-page-project-switcher-90efcfbc.esm.js} +1 -1
- package/dist/{service-page-project-switcher-3343ea60.cjs.prod.js → service-page-project-switcher-cc8cab71.cjs.prod.js} +1 -1
- package/dist/{version-tracker-d3961598.esm.js → version-tracker-46a3f021.esm.js} +1 -1
- package/dist/{version-tracker-0c067072.cjs.dev.js → version-tracker-9976ad26.cjs.dev.js} +1 -1
- package/dist/{version-tracker-abf7b029.cjs.prod.js → version-tracker-a3eb5a8e.cjs.prod.js} +1 -1
- package/package.json +16 -16
- package/dist/navbar-8409df86.cjs.dev.js +0 -1226
- package/dist/navbar-e4559c93.esm.js +0 -1193
- package/dist/redirect-to-login-573b012a.cjs.prod.js +0 -109
- package/dist/redirect-to-login-dffecd53.cjs.dev.js +0 -109
- package/dist/redirect-to-login-e569bd46.esm.js +0 -107
- package/dist/redirect-to-project-create-2266c427.cjs.prod.js +0 -59
- package/dist/redirect-to-project-create-7b476aa6.cjs.dev.js +0 -59
- package/dist/redirect-to-project-create-c5323504.esm.js +0 -50
|
@@ -0,0 +1,118 @@
|
|
|
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-da8526e3.esm.js';
|
|
8
|
+
import { u as useIsServedByProxy } from './use-is-served-by-proxy-77984220.esm.js';
|
|
9
|
+
import { g as getMcOrigin } from './get-mc-origin-fecfee07.esm.js';
|
|
10
|
+
import { u as useRedirector } from './redirector-54a03b75.esm.js';
|
|
11
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
12
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
13
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
14
|
+
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
15
|
+
import '@babel/runtime-corejs3/core-js-stable/url';
|
|
16
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/reverse';
|
|
17
|
+
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
18
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
19
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
20
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
21
|
+
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
22
|
+
import '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
23
|
+
import '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
24
|
+
import '@babel/runtime-corejs3/helpers/defineProperty';
|
|
25
|
+
import 'prop-types';
|
|
26
|
+
import 'qss';
|
|
27
|
+
|
|
28
|
+
const generateAndCacheNonceWithState = state => {
|
|
29
|
+
const nonce = v4();
|
|
30
|
+
// We store additional information within the given `nonce`
|
|
31
|
+
// to then retrieve it later when the IdP redirects back
|
|
32
|
+
// to our application. The URL will contain the `nonce` within
|
|
33
|
+
// the id_token and, once validated, we can retrieve and use
|
|
34
|
+
// the state object.
|
|
35
|
+
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
36
|
+
oidcStorage.setSessionState(nonce, state);
|
|
37
|
+
return nonce;
|
|
38
|
+
};
|
|
39
|
+
const RedirectToLogin = () => {
|
|
40
|
+
const location = useLocation();
|
|
41
|
+
const servedByProxy = useIsServedByProxy();
|
|
42
|
+
const redirector = useRedirector();
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
var _window$app$__DEVELOP;
|
|
45
|
+
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP !== void 0 && _window$app$__DEVELOP.authorizeUrl) {
|
|
46
|
+
var _window$app$__DEVELOP2, _window$app$__DEVELOP3, _window$app$__DEVELOP4, _window$app$__DEVELOP5, _window$app$__DEVELOP6;
|
|
47
|
+
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
48
|
+
// a new authorization flow.
|
|
49
|
+
oidcStorage.clearSession();
|
|
50
|
+
|
|
51
|
+
// We pick the project key from local storage. This assumes that the value
|
|
52
|
+
// as been previously set when the application starts up.
|
|
53
|
+
// This is necessary to allow switching projects and triggering a new login.
|
|
54
|
+
const nextProjectKey = oidcStorage.getActiveProjectKey();
|
|
55
|
+
|
|
56
|
+
// According to the OIDC spec, the `state` parameter is recommended to be sent
|
|
57
|
+
// to the authorization server to help mitigating Cross-Site Request Forgery.
|
|
58
|
+
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
59
|
+
// Using `state` or `nonce` is very similar but with subtle differences.
|
|
60
|
+
// Here we follow the approach described by Auth0 on how to use both, where
|
|
61
|
+
// we generate a `nonce`, store it in session storage together with some state,
|
|
62
|
+
// and send it to the authorization server as the `state` parameter.
|
|
63
|
+
// https://auth0.com/docs/protocols/oauth2/redirect-users
|
|
64
|
+
// Additionally, we still send the `nonce` parameter as well.
|
|
65
|
+
const sessionId = generateAndCacheNonceWithState({
|
|
66
|
+
applicationId: window.app.applicationId,
|
|
67
|
+
// Store query parameters to be used after the callback redirect
|
|
68
|
+
query: {
|
|
69
|
+
redirectTo: nextProjectKey ? "/".concat(nextProjectKey) : '/'
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const requestedScope = buildOidcScope({
|
|
73
|
+
projectKey: nextProjectKey !== null && nextProjectKey !== void 0 ? nextProjectKey : undefined,
|
|
74
|
+
oAuthScopes: (_window$app$__DEVELOP2 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP2 === void 0 || (_window$app$__DEVELOP2 = _window$app$__DEVELOP2.oidc) === null || _window$app$__DEVELOP2 === void 0 ? void 0 : _window$app$__DEVELOP2.oAuthScopes,
|
|
75
|
+
additionalOAuthScopes: (_window$app$__DEVELOP3 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP3 === void 0 || (_window$app$__DEVELOP3 = _window$app$__DEVELOP3.oidc) === null || _window$app$__DEVELOP3 === void 0 ? void 0 : _window$app$__DEVELOP3.additionalOAuthScopes,
|
|
76
|
+
teamId: (_window$app$__DEVELOP4 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP4 === void 0 || (_window$app$__DEVELOP4 = _window$app$__DEVELOP4.oidc) === null || _window$app$__DEVELOP4 === void 0 ? void 0 : _window$app$__DEVELOP4.teamId,
|
|
77
|
+
applicationId: (_window$app$__DEVELOP5 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP5 === void 0 || (_window$app$__DEVELOP5 = _window$app$__DEVELOP5.oidc) === null || _window$app$__DEVELOP5 === void 0 ? void 0 : _window$app$__DEVELOP5.applicationId
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Store session scopes, to be able to detect if requested scopes changed
|
|
81
|
+
// in the application config and invalidate the session.
|
|
82
|
+
// This is only valid for local development.
|
|
83
|
+
oidcStorage.setSessionScope(requestedScope);
|
|
84
|
+
redirector({
|
|
85
|
+
to: '',
|
|
86
|
+
origin: (_window$app$__DEVELOP6 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP6 === void 0 || (_window$app$__DEVELOP6 = _window$app$__DEVELOP6.oidc) === null || _window$app$__DEVELOP6 === void 0 ? void 0 : _window$app$__DEVELOP6.authorizeUrl,
|
|
87
|
+
location: location,
|
|
88
|
+
queryParams: {
|
|
89
|
+
reason: LOGOUT_REASONS.UNAUTHORIZED,
|
|
90
|
+
// Query parameters for OIDC-lik workflow.
|
|
91
|
+
client_id: window.app.applicationId,
|
|
92
|
+
response_type: OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
93
|
+
scope: requestedScope,
|
|
94
|
+
state: sessionId,
|
|
95
|
+
nonce: sessionId
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const mcOrigin = servedByProxy ? getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
101
|
+
redirector({
|
|
102
|
+
to: 'login',
|
|
103
|
+
origin: mcOrigin,
|
|
104
|
+
location: location,
|
|
105
|
+
queryParams: {
|
|
106
|
+
reason: LOGOUT_REASONS.UNAUTHORIZED,
|
|
107
|
+
redirectTo: trimLeadingAndTrailingSlashes(joinPaths(window.location.origin, location.pathname))
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Only execute once!
|
|
112
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
|
+
}, []);
|
|
114
|
+
return null;
|
|
115
|
+
};
|
|
116
|
+
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
117
|
+
|
|
118
|
+
export { RedirectToLogin as default };
|
|
@@ -0,0 +1,120 @@
|
|
|
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-7c48215c.cjs.dev.js');
|
|
10
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-ed411f45.cjs.dev.js');
|
|
11
|
+
var getMcOrigin = require('./get-mc-origin-a86dff20.cjs.dev.js');
|
|
12
|
+
var redirector = require('./redirector-fcdeaba7.cjs.dev.js');
|
|
13
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
14
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
15
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
16
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
17
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
18
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
26
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
27
|
+
require('prop-types');
|
|
28
|
+
require('qss');
|
|
29
|
+
|
|
30
|
+
const generateAndCacheNonceWithState = state => {
|
|
31
|
+
const nonce = uuid.v4();
|
|
32
|
+
// We store additional information within the given `nonce`
|
|
33
|
+
// to then retrieve it later when the IdP redirects back
|
|
34
|
+
// to our application. The URL will contain the `nonce` within
|
|
35
|
+
// the id_token and, once validated, we can retrieve and use
|
|
36
|
+
// the state object.
|
|
37
|
+
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
38
|
+
applicationShellConnectors.oidcStorage.setSessionState(nonce, state);
|
|
39
|
+
return nonce;
|
|
40
|
+
};
|
|
41
|
+
const RedirectToLogin = () => {
|
|
42
|
+
const location = reactRouterDom.useLocation();
|
|
43
|
+
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
44
|
+
const redirector$1 = redirector.useRedirector();
|
|
45
|
+
react.useEffect(() => {
|
|
46
|
+
var _window$app$__DEVELOP;
|
|
47
|
+
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP !== void 0 && _window$app$__DEVELOP.authorizeUrl) {
|
|
48
|
+
var _window$app$__DEVELOP2, _window$app$__DEVELOP3, _window$app$__DEVELOP4, _window$app$__DEVELOP5, _window$app$__DEVELOP6;
|
|
49
|
+
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
50
|
+
// a new authorization flow.
|
|
51
|
+
applicationShellConnectors.oidcStorage.clearSession();
|
|
52
|
+
|
|
53
|
+
// We pick the project key from local storage. This assumes that the value
|
|
54
|
+
// as been previously set when the application starts up.
|
|
55
|
+
// This is necessary to allow switching projects and triggering a new login.
|
|
56
|
+
const nextProjectKey = applicationShellConnectors.oidcStorage.getActiveProjectKey();
|
|
57
|
+
|
|
58
|
+
// According to the OIDC spec, the `state` parameter is recommended to be sent
|
|
59
|
+
// to the authorization server to help mitigating Cross-Site Request Forgery.
|
|
60
|
+
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
61
|
+
// Using `state` or `nonce` is very similar but with subtle differences.
|
|
62
|
+
// Here we follow the approach described by Auth0 on how to use both, where
|
|
63
|
+
// we generate a `nonce`, store it in session storage together with some state,
|
|
64
|
+
// and send it to the authorization server as the `state` parameter.
|
|
65
|
+
// https://auth0.com/docs/protocols/oauth2/redirect-users
|
|
66
|
+
// Additionally, we still send the `nonce` parameter as well.
|
|
67
|
+
const sessionId = generateAndCacheNonceWithState({
|
|
68
|
+
applicationId: window.app.applicationId,
|
|
69
|
+
// Store query parameters to be used after the callback redirect
|
|
70
|
+
query: {
|
|
71
|
+
redirectTo: nextProjectKey ? "/".concat(nextProjectKey) : '/'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const requestedScope = oidc.buildOidcScope({
|
|
75
|
+
projectKey: nextProjectKey !== null && nextProjectKey !== void 0 ? nextProjectKey : undefined,
|
|
76
|
+
oAuthScopes: (_window$app$__DEVELOP2 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP2 === void 0 || (_window$app$__DEVELOP2 = _window$app$__DEVELOP2.oidc) === null || _window$app$__DEVELOP2 === void 0 ? void 0 : _window$app$__DEVELOP2.oAuthScopes,
|
|
77
|
+
additionalOAuthScopes: (_window$app$__DEVELOP3 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP3 === void 0 || (_window$app$__DEVELOP3 = _window$app$__DEVELOP3.oidc) === null || _window$app$__DEVELOP3 === void 0 ? void 0 : _window$app$__DEVELOP3.additionalOAuthScopes,
|
|
78
|
+
teamId: (_window$app$__DEVELOP4 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP4 === void 0 || (_window$app$__DEVELOP4 = _window$app$__DEVELOP4.oidc) === null || _window$app$__DEVELOP4 === void 0 ? void 0 : _window$app$__DEVELOP4.teamId,
|
|
79
|
+
applicationId: (_window$app$__DEVELOP5 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP5 === void 0 || (_window$app$__DEVELOP5 = _window$app$__DEVELOP5.oidc) === null || _window$app$__DEVELOP5 === void 0 ? void 0 : _window$app$__DEVELOP5.applicationId
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Store session scopes, to be able to detect if requested scopes changed
|
|
83
|
+
// in the application config and invalidate the session.
|
|
84
|
+
// This is only valid for local development.
|
|
85
|
+
applicationShellConnectors.oidcStorage.setSessionScope(requestedScope);
|
|
86
|
+
redirector$1({
|
|
87
|
+
to: '',
|
|
88
|
+
origin: (_window$app$__DEVELOP6 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP6 === void 0 || (_window$app$__DEVELOP6 = _window$app$__DEVELOP6.oidc) === null || _window$app$__DEVELOP6 === void 0 ? void 0 : _window$app$__DEVELOP6.authorizeUrl,
|
|
89
|
+
location: location,
|
|
90
|
+
queryParams: {
|
|
91
|
+
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
92
|
+
// Query parameters for OIDC-lik workflow.
|
|
93
|
+
client_id: window.app.applicationId,
|
|
94
|
+
response_type: oidc.OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
95
|
+
scope: requestedScope,
|
|
96
|
+
state: sessionId,
|
|
97
|
+
nonce: sessionId
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
103
|
+
redirector$1({
|
|
104
|
+
to: 'login',
|
|
105
|
+
origin: mcOrigin,
|
|
106
|
+
location: location,
|
|
107
|
+
queryParams: {
|
|
108
|
+
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
109
|
+
redirectTo: urlUtils.trimLeadingAndTrailingSlashes(urlUtils.joinPaths(window.location.origin, location.pathname))
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Only execute once!
|
|
114
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
|
+
}, []);
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
118
|
+
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
119
|
+
|
|
120
|
+
exports["default"] = RedirectToLogin;
|
|
@@ -0,0 +1,120 @@
|
|
|
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-b070ff6c.cjs.prod.js');
|
|
10
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-845cace5.cjs.prod.js');
|
|
11
|
+
var getMcOrigin = require('./get-mc-origin-8f7a578c.cjs.prod.js');
|
|
12
|
+
var redirector = require('./redirector-15844d9b.cjs.prod.js');
|
|
13
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
14
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
15
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
16
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
17
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
18
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
19
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
20
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
21
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
22
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
23
|
+
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
24
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
25
|
+
require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
26
|
+
require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
27
|
+
require('prop-types');
|
|
28
|
+
require('qss');
|
|
29
|
+
|
|
30
|
+
const generateAndCacheNonceWithState = state => {
|
|
31
|
+
const nonce = uuid.v4();
|
|
32
|
+
// We store additional information within the given `nonce`
|
|
33
|
+
// to then retrieve it later when the IdP redirects back
|
|
34
|
+
// to our application. The URL will contain the `nonce` within
|
|
35
|
+
// the id_token and, once validated, we can retrieve and use
|
|
36
|
+
// the state object.
|
|
37
|
+
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
38
|
+
applicationShellConnectors.oidcStorage.setSessionState(nonce, state);
|
|
39
|
+
return nonce;
|
|
40
|
+
};
|
|
41
|
+
const RedirectToLogin = () => {
|
|
42
|
+
const location = reactRouterDom.useLocation();
|
|
43
|
+
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
44
|
+
const redirector$1 = redirector.useRedirector();
|
|
45
|
+
react.useEffect(() => {
|
|
46
|
+
var _window$app$__DEVELOP;
|
|
47
|
+
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP !== void 0 && _window$app$__DEVELOP.authorizeUrl) {
|
|
48
|
+
var _window$app$__DEVELOP2, _window$app$__DEVELOP3, _window$app$__DEVELOP4, _window$app$__DEVELOP5, _window$app$__DEVELOP6;
|
|
49
|
+
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
50
|
+
// a new authorization flow.
|
|
51
|
+
applicationShellConnectors.oidcStorage.clearSession();
|
|
52
|
+
|
|
53
|
+
// We pick the project key from local storage. This assumes that the value
|
|
54
|
+
// as been previously set when the application starts up.
|
|
55
|
+
// This is necessary to allow switching projects and triggering a new login.
|
|
56
|
+
const nextProjectKey = applicationShellConnectors.oidcStorage.getActiveProjectKey();
|
|
57
|
+
|
|
58
|
+
// According to the OIDC spec, the `state` parameter is recommended to be sent
|
|
59
|
+
// to the authorization server to help mitigating Cross-Site Request Forgery.
|
|
60
|
+
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
61
|
+
// Using `state` or `nonce` is very similar but with subtle differences.
|
|
62
|
+
// Here we follow the approach described by Auth0 on how to use both, where
|
|
63
|
+
// we generate a `nonce`, store it in session storage together with some state,
|
|
64
|
+
// and send it to the authorization server as the `state` parameter.
|
|
65
|
+
// https://auth0.com/docs/protocols/oauth2/redirect-users
|
|
66
|
+
// Additionally, we still send the `nonce` parameter as well.
|
|
67
|
+
const sessionId = generateAndCacheNonceWithState({
|
|
68
|
+
applicationId: window.app.applicationId,
|
|
69
|
+
// Store query parameters to be used after the callback redirect
|
|
70
|
+
query: {
|
|
71
|
+
redirectTo: nextProjectKey ? "/".concat(nextProjectKey) : '/'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const requestedScope = oidc.buildOidcScope({
|
|
75
|
+
projectKey: nextProjectKey !== null && nextProjectKey !== void 0 ? nextProjectKey : undefined,
|
|
76
|
+
oAuthScopes: (_window$app$__DEVELOP2 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP2 === void 0 || (_window$app$__DEVELOP2 = _window$app$__DEVELOP2.oidc) === null || _window$app$__DEVELOP2 === void 0 ? void 0 : _window$app$__DEVELOP2.oAuthScopes,
|
|
77
|
+
additionalOAuthScopes: (_window$app$__DEVELOP3 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP3 === void 0 || (_window$app$__DEVELOP3 = _window$app$__DEVELOP3.oidc) === null || _window$app$__DEVELOP3 === void 0 ? void 0 : _window$app$__DEVELOP3.additionalOAuthScopes,
|
|
78
|
+
teamId: (_window$app$__DEVELOP4 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP4 === void 0 || (_window$app$__DEVELOP4 = _window$app$__DEVELOP4.oidc) === null || _window$app$__DEVELOP4 === void 0 ? void 0 : _window$app$__DEVELOP4.teamId,
|
|
79
|
+
applicationId: (_window$app$__DEVELOP5 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP5 === void 0 || (_window$app$__DEVELOP5 = _window$app$__DEVELOP5.oidc) === null || _window$app$__DEVELOP5 === void 0 ? void 0 : _window$app$__DEVELOP5.applicationId
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Store session scopes, to be able to detect if requested scopes changed
|
|
83
|
+
// in the application config and invalidate the session.
|
|
84
|
+
// This is only valid for local development.
|
|
85
|
+
applicationShellConnectors.oidcStorage.setSessionScope(requestedScope);
|
|
86
|
+
redirector$1({
|
|
87
|
+
to: '',
|
|
88
|
+
origin: (_window$app$__DEVELOP6 = window.app.__DEVELOPMENT__) === null || _window$app$__DEVELOP6 === void 0 || (_window$app$__DEVELOP6 = _window$app$__DEVELOP6.oidc) === null || _window$app$__DEVELOP6 === void 0 ? void 0 : _window$app$__DEVELOP6.authorizeUrl,
|
|
89
|
+
location: location,
|
|
90
|
+
queryParams: {
|
|
91
|
+
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
92
|
+
// Query parameters for OIDC-lik workflow.
|
|
93
|
+
client_id: window.app.applicationId,
|
|
94
|
+
response_type: oidc.OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
95
|
+
scope: requestedScope,
|
|
96
|
+
state: sessionId,
|
|
97
|
+
nonce: sessionId
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
103
|
+
redirector$1({
|
|
104
|
+
to: 'login',
|
|
105
|
+
origin: mcOrigin,
|
|
106
|
+
location: location,
|
|
107
|
+
queryParams: {
|
|
108
|
+
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
109
|
+
redirectTo: urlUtils.trimLeadingAndTrailingSlashes(urlUtils.joinPaths(window.location.origin, location.pathname))
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Only execute once!
|
|
114
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
|
+
}, []);
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
118
|
+
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
119
|
+
|
|
120
|
+
exports["default"] = RedirectToLogin;
|
package/dist/{redirect-to-logout-8cbbf5b3.cjs.dev.js → redirect-to-logout-a4bc80a6.cjs.dev.js}
RENAMED
|
@@ -10,13 +10,13 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
|
|
|
10
10
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
11
11
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
12
12
|
var reactRouterDom = require('react-router-dom');
|
|
13
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
14
13
|
var constants = require('@commercetools-frontend/constants');
|
|
15
14
|
var useIsServedByProxy = require('./use-is-served-by-proxy-ed411f45.cjs.dev.js');
|
|
16
15
|
var getMcOrigin = require('./get-mc-origin-a86dff20.cjs.dev.js');
|
|
17
|
-
var dist_commercetoolsFrontendApplicationShell = require('./index-
|
|
18
|
-
var redirector = require('./redirector-
|
|
16
|
+
var dist_commercetoolsFrontendApplicationShell = require('./index-97ddc7b1.cjs.dev.js');
|
|
17
|
+
var redirector = require('./redirector-fcdeaba7.cjs.dev.js');
|
|
19
18
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
19
|
+
require('@commercetools-frontend/application-shell-connectors');
|
|
20
20
|
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
21
21
|
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
22
22
|
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
@@ -107,9 +107,6 @@ const RedirectToLogout = props => {
|
|
|
107
107
|
const location = reactRouterDom.useLocation();
|
|
108
108
|
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
109
109
|
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP !== void 0 && _window$app$__DEVELOP.authorizeUrl) {
|
|
110
|
-
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
111
|
-
// a new authorization flow.
|
|
112
|
-
applicationShellConnectors.oidcStorage.clearSession();
|
|
113
110
|
return jsxRuntime.jsx(dist_commercetoolsFrontendApplicationShell.RedirectToLogin, {});
|
|
114
111
|
}
|
|
115
112
|
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
package/dist/{redirect-to-logout-2418d058.cjs.prod.js → redirect-to-logout-cdcb00b1.cjs.prod.js}
RENAMED
|
@@ -10,13 +10,13 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
|
|
|
10
10
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
11
11
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
12
12
|
var reactRouterDom = require('react-router-dom');
|
|
13
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
14
13
|
var constants = require('@commercetools-frontend/constants');
|
|
15
14
|
var useIsServedByProxy = require('./use-is-served-by-proxy-845cace5.cjs.prod.js');
|
|
16
15
|
var getMcOrigin = require('./get-mc-origin-8f7a578c.cjs.prod.js');
|
|
17
|
-
var dist_commercetoolsFrontendApplicationShell = require('./index-
|
|
18
|
-
var redirector = require('./redirector-
|
|
16
|
+
var dist_commercetoolsFrontendApplicationShell = require('./index-08c8fcb3.cjs.prod.js');
|
|
17
|
+
var redirector = require('./redirector-15844d9b.cjs.prod.js');
|
|
19
18
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
19
|
+
require('@commercetools-frontend/application-shell-connectors');
|
|
20
20
|
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
21
21
|
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
22
22
|
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
@@ -107,9 +107,6 @@ const RedirectToLogout = props => {
|
|
|
107
107
|
const location = reactRouterDom.useLocation();
|
|
108
108
|
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
109
109
|
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP !== void 0 && _window$app$__DEVELOP.authorizeUrl) {
|
|
110
|
-
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
111
|
-
// a new authorization flow.
|
|
112
|
-
applicationShellConnectors.oidcStorage.clearSession();
|
|
113
110
|
return jsxRuntime.jsx(dist_commercetoolsFrontendApplicationShell.RedirectToLogin, {});
|
|
114
111
|
}
|
|
115
112
|
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
@@ -8,13 +8,13 @@ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/obje
|
|
|
8
8
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
10
|
import { useLocation } from 'react-router-dom';
|
|
11
|
-
import { oidcStorage } from '@commercetools-frontend/application-shell-connectors';
|
|
12
11
|
import { LOGOUT_REASONS } from '@commercetools-frontend/constants';
|
|
13
12
|
import { u as useIsServedByProxy } from './use-is-served-by-proxy-77984220.esm.js';
|
|
14
13
|
import { g as getMcOrigin } from './get-mc-origin-fecfee07.esm.js';
|
|
15
|
-
import { R as RedirectToLogin } from './index-
|
|
16
|
-
import { R as Redirector } from './redirector-
|
|
14
|
+
import { R as RedirectToLogin } from './index-4eee2222.esm.js';
|
|
15
|
+
import { R as Redirector } from './redirector-54a03b75.esm.js';
|
|
17
16
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
17
|
+
import '@commercetools-frontend/application-shell-connectors';
|
|
18
18
|
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
19
19
|
import '@babel/runtime-corejs3/core-js-stable/url';
|
|
20
20
|
import '@babel/runtime-corejs3/core-js-stable/instance/reverse';
|
|
@@ -94,9 +94,6 @@ const RedirectToLogout = props => {
|
|
|
94
94
|
const location = useLocation();
|
|
95
95
|
const servedByProxy = useIsServedByProxy();
|
|
96
96
|
if ((_window$app$__DEVELOP = window.app.__DEVELOPMENT__) !== null && _window$app$__DEVELOP !== void 0 && (_window$app$__DEVELOP = _window$app$__DEVELOP.oidc) !== null && _window$app$__DEVELOP !== void 0 && _window$app$__DEVELOP.authorizeUrl) {
|
|
97
|
-
// Remove the `sessionToken` from storage, so that the AppShell can initiate
|
|
98
|
-
// a new authorization flow.
|
|
99
|
-
oidcStorage.clearSession();
|
|
100
97
|
return jsx(RedirectToLogin, {});
|
|
101
98
|
}
|
|
102
99
|
const mcOrigin = servedByProxy ? getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { PageContentNarrow } from '@commercetools-frontend/application-components';
|
|
3
|
+
import { ContentNotification } from '@commercetools-uikit/notifications';
|
|
4
|
+
import Spacings from '@commercetools-uikit/spacings';
|
|
5
|
+
import Text from '@commercetools-uikit/text';
|
|
6
|
+
import { u as useIsServedByProxy, l as location } from './use-is-served-by-proxy-77984220.esm.js';
|
|
7
|
+
import { g as getMcOrigin } from './get-mc-origin-fecfee07.esm.js';
|
|
8
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
9
|
+
import '@commercetools-frontend/application-shell-connectors';
|
|
10
|
+
import '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
11
|
+
import '@babel/runtime-corejs3/core-js-stable/url';
|
|
12
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/reverse';
|
|
13
|
+
|
|
14
|
+
const RedirectToProjectCreate = () => {
|
|
15
|
+
const servedByProxy = useIsServedByProxy();
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (servedByProxy === true) {
|
|
18
|
+
location.replace('/account/projects/new');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}, [servedByProxy]);
|
|
22
|
+
if (servedByProxy) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const mcUrl = getMcOrigin(window.app.mcApiUrl);
|
|
26
|
+
return jsx("div", {
|
|
27
|
+
children: jsx(Spacings.Inset, {
|
|
28
|
+
scale: "xl",
|
|
29
|
+
children: jsx(PageContentNarrow, {
|
|
30
|
+
children: jsxs(Spacings.Stack, {
|
|
31
|
+
children: [jsx(Text.Headline, {
|
|
32
|
+
as: "h1",
|
|
33
|
+
children: "Please create a project!"
|
|
34
|
+
}), jsx(ContentNotification, {
|
|
35
|
+
type: "warning",
|
|
36
|
+
children: "You are running in development mode"
|
|
37
|
+
}), jsxs(Text.Body, {
|
|
38
|
+
children: ["The application is not running behind the", ' ', jsx("a", {
|
|
39
|
+
href: "https://docs.commercetools.com/custom-applications/concepts/merchant-center-proxy-router",
|
|
40
|
+
target: "_blank",
|
|
41
|
+
rel: "noopener noreferrer",
|
|
42
|
+
children: "Merchant Center Proxy"
|
|
43
|
+
}), ' ', "in production and thus cannot be redirected to the account section to create a new project."]
|
|
44
|
+
}), jsxs(Text.Body, {
|
|
45
|
+
children: ["Instead, we recommend to go to the", ' ', jsx("a", {
|
|
46
|
+
href: mcUrl,
|
|
47
|
+
target: "_blank",
|
|
48
|
+
rel: "noopener noreferrer",
|
|
49
|
+
children: "Merchant Center production URL"
|
|
50
|
+
}), ' ', "and create a project there. After that, you can access your new project from your local environment."]
|
|
51
|
+
})]
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
58
|
+
|
|
59
|
+
export { RedirectToProjectCreate, RedirectToProjectCreate as default };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
5
|
+
var notifications = require('@commercetools-uikit/notifications');
|
|
6
|
+
var Spacings = require('@commercetools-uikit/spacings');
|
|
7
|
+
var Text = require('@commercetools-uikit/text');
|
|
8
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-ed411f45.cjs.dev.js');
|
|
9
|
+
var getMcOrigin = require('./get-mc-origin-a86dff20.cjs.dev.js');
|
|
10
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
11
|
+
require('@commercetools-frontend/application-shell-connectors');
|
|
12
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
13
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
14
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
15
|
+
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
19
|
+
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
20
|
+
|
|
21
|
+
const RedirectToProjectCreate = () => {
|
|
22
|
+
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
23
|
+
react.useEffect(() => {
|
|
24
|
+
if (servedByProxy === true) {
|
|
25
|
+
useIsServedByProxy.location.replace('/account/projects/new');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}, [servedByProxy]);
|
|
29
|
+
if (servedByProxy) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const mcUrl = getMcOrigin.getMcOrigin(window.app.mcApiUrl);
|
|
33
|
+
return jsxRuntime.jsx("div", {
|
|
34
|
+
children: jsxRuntime.jsx(Spacings__default["default"].Inset, {
|
|
35
|
+
scale: "xl",
|
|
36
|
+
children: jsxRuntime.jsx(applicationComponents.PageContentNarrow, {
|
|
37
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
38
|
+
children: [jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
39
|
+
as: "h1",
|
|
40
|
+
children: "Please create a project!"
|
|
41
|
+
}), jsxRuntime.jsx(notifications.ContentNotification, {
|
|
42
|
+
type: "warning",
|
|
43
|
+
children: "You are running in development mode"
|
|
44
|
+
}), jsxRuntime.jsxs(Text__default["default"].Body, {
|
|
45
|
+
children: ["The application is not running behind the", ' ', jsxRuntime.jsx("a", {
|
|
46
|
+
href: "https://docs.commercetools.com/custom-applications/concepts/merchant-center-proxy-router",
|
|
47
|
+
target: "_blank",
|
|
48
|
+
rel: "noopener noreferrer",
|
|
49
|
+
children: "Merchant Center Proxy"
|
|
50
|
+
}), ' ', "in production and thus cannot be redirected to the account section to create a new project."]
|
|
51
|
+
}), jsxRuntime.jsxs(Text__default["default"].Body, {
|
|
52
|
+
children: ["Instead, we recommend to go to the", ' ', jsxRuntime.jsx("a", {
|
|
53
|
+
href: mcUrl,
|
|
54
|
+
target: "_blank",
|
|
55
|
+
rel: "noopener noreferrer",
|
|
56
|
+
children: "Merchant Center production URL"
|
|
57
|
+
}), ' ', "and create a project there. After that, you can access your new project from your local environment."]
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
65
|
+
|
|
66
|
+
exports.RedirectToProjectCreate = RedirectToProjectCreate;
|
|
67
|
+
exports["default"] = RedirectToProjectCreate;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
5
|
+
var notifications = require('@commercetools-uikit/notifications');
|
|
6
|
+
var Spacings = require('@commercetools-uikit/spacings');
|
|
7
|
+
var Text = require('@commercetools-uikit/text');
|
|
8
|
+
var useIsServedByProxy = require('./use-is-served-by-proxy-845cace5.cjs.prod.js');
|
|
9
|
+
var getMcOrigin = require('./get-mc-origin-8f7a578c.cjs.prod.js');
|
|
10
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
11
|
+
require('@commercetools-frontend/application-shell-connectors');
|
|
12
|
+
require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
13
|
+
require('@babel/runtime-corejs3/core-js-stable/url');
|
|
14
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/reverse');
|
|
15
|
+
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
19
|
+
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
20
|
+
|
|
21
|
+
const RedirectToProjectCreate = () => {
|
|
22
|
+
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
23
|
+
react.useEffect(() => {
|
|
24
|
+
if (servedByProxy === true) {
|
|
25
|
+
useIsServedByProxy.location.replace('/account/projects/new');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}, [servedByProxy]);
|
|
29
|
+
if (servedByProxy) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const mcUrl = getMcOrigin.getMcOrigin(window.app.mcApiUrl);
|
|
33
|
+
return jsxRuntime.jsx("div", {
|
|
34
|
+
children: jsxRuntime.jsx(Spacings__default["default"].Inset, {
|
|
35
|
+
scale: "xl",
|
|
36
|
+
children: jsxRuntime.jsx(applicationComponents.PageContentNarrow, {
|
|
37
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
38
|
+
children: [jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
39
|
+
as: "h1",
|
|
40
|
+
children: "Please create a project!"
|
|
41
|
+
}), jsxRuntime.jsx(notifications.ContentNotification, {
|
|
42
|
+
type: "warning",
|
|
43
|
+
children: "You are running in development mode"
|
|
44
|
+
}), jsxRuntime.jsxs(Text__default["default"].Body, {
|
|
45
|
+
children: ["The application is not running behind the", ' ', jsxRuntime.jsx("a", {
|
|
46
|
+
href: "https://docs.commercetools.com/custom-applications/concepts/merchant-center-proxy-router",
|
|
47
|
+
target: "_blank",
|
|
48
|
+
rel: "noopener noreferrer",
|
|
49
|
+
children: "Merchant Center Proxy"
|
|
50
|
+
}), ' ', "in production and thus cannot be redirected to the account section to create a new project."]
|
|
51
|
+
}), jsxRuntime.jsxs(Text__default["default"].Body, {
|
|
52
|
+
children: ["Instead, we recommend to go to the", ' ', jsxRuntime.jsx("a", {
|
|
53
|
+
href: mcUrl,
|
|
54
|
+
target: "_blank",
|
|
55
|
+
rel: "noopener noreferrer",
|
|
56
|
+
children: "Merchant Center production URL"
|
|
57
|
+
}), ' ', "and create a project there. After that, you can access your new project from your local environment."]
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
65
|
+
|
|
66
|
+
exports.RedirectToProjectCreate = RedirectToProjectCreate;
|
|
67
|
+
exports["default"] = RedirectToProjectCreate;
|