@commercetools-frontend/application-shell 22.14.3 → 22.15.1
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-945f058b.esm.js → custom-view-dev-host-8ad0424b.esm.js} +1 -1
- package/dist/{custom-view-dev-host-98e7ce7d.cjs.prod.js → custom-view-dev-host-c621e927.cjs.prod.js} +1 -1
- package/dist/{custom-view-dev-host-52595f60.cjs.dev.js → custom-view-dev-host-f52ff048.cjs.dev.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-35f9f7c2.esm.js → index-3c5aa692.esm.js} +56 -30
- package/dist/{index-0d0e6d8b.cjs.dev.js → index-62c4ae6c.cjs.dev.js} +54 -28
- package/dist/{index-c29f8aa0.cjs.prod.js → index-93f24ea7.cjs.prod.js} +42 -19
- 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-6aa0b446.cjs.dev.js → oidc-callback-4b858a1c.cjs.dev.js} +70 -48
- package/dist/{oidc-callback-860db268.esm.js → oidc-callback-7282ab5f.esm.js} +69 -48
- package/dist/{oidc-callback-25005367.cjs.prod.js → oidc-callback-7a0c0ebd.cjs.prod.js} +66 -47
- package/dist/{project-container-0b7034a5.cjs.prod.js → project-container-36dd5cb7.cjs.prod.js} +5 -5
- package/dist/{project-container-8a000259.esm.js → project-container-91ea5d5b.esm.js} +5 -5
- package/dist/{project-container-22dd3ee8.cjs.dev.js → project-container-b01357ff.cjs.dev.js} +5 -5
- package/dist/{project-expired-7e9f4a37.cjs.dev.js → project-expired-395aa691.cjs.dev.js} +2 -2
- package/dist/{project-expired-abde10a9.cjs.prod.js → project-expired-68d68ce5.cjs.prod.js} +2 -2
- package/dist/{project-expired-175f09e7.esm.js → project-expired-fecabecd.esm.js} +2 -2
- package/dist/{project-not-found-89cc6d97.esm.js → project-not-found-2f7ba491.esm.js} +2 -2
- package/dist/{project-not-found-aeb6b4e5.cjs.prod.js → project-not-found-584171f8.cjs.prod.js} +2 -2
- package/dist/{project-not-found-fcb9f62d.cjs.dev.js → project-not-found-ccbfa096.cjs.dev.js} +2 -2
- package/dist/{project-not-initialized-1e4f45dc.esm.js → project-not-initialized-1538b60f.esm.js} +2 -2
- package/dist/{project-not-initialized-e8c5fae6.cjs.prod.js → project-not-initialized-7147556b.cjs.prod.js} +2 -2
- package/dist/{project-not-initialized-718a18d0.cjs.dev.js → project-not-initialized-748ad0e3.cjs.dev.js} +2 -2
- package/dist/{project-suspended-d028eced.cjs.dev.js → project-suspended-39509ed2.cjs.dev.js} +2 -2
- package/dist/{project-suspended-1f94c722.cjs.prod.js → project-suspended-7b293d78.cjs.prod.js} +2 -2
- package/dist/{project-suspended-0d49681f.esm.js → project-suspended-d0fac874.esm.js} +2 -2
- package/dist/{quick-access-ecbaedf9.cjs.prod.js → quick-access-906bec49.cjs.prod.js} +1 -1
- package/dist/{quick-access-08a2f835.cjs.dev.js → quick-access-df9876d1.cjs.dev.js} +1 -1
- package/dist/{quick-access-11418f11.esm.js → quick-access-ef201ca5.esm.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-7fb8c085.esm.js → redirect-to-logout-41de8896.esm.js} +3 -6
- package/dist/{redirect-to-logout-8cbbf5b3.cjs.dev.js → redirect-to-logout-656fddeb.cjs.dev.js} +3 -6
- package/dist/{redirect-to-logout-2418d058.cjs.prod.js → redirect-to-logout-bc9103b4.cjs.prod.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-7580242c.cjs.prod.js → requests-in-flight-loader-a360bbce.cjs.prod.js} +1 -1
- package/dist/{requests-in-flight-loader-41d05ebb.cjs.dev.js → requests-in-flight-loader-b0814ea3.cjs.dev.js} +1 -1
- package/dist/{requests-in-flight-loader-9400ad17.esm.js → requests-in-flight-loader-d067d347.esm.js} +1 -1
- package/dist/{service-page-project-switcher-3343ea60.cjs.prod.js → service-page-project-switcher-3456c835.cjs.prod.js} +1 -1
- package/dist/{service-page-project-switcher-c2446f31.cjs.dev.js → service-page-project-switcher-c58c8fa1.cjs.dev.js} +1 -1
- package/dist/{service-page-project-switcher-f7058ef7.esm.js → service-page-project-switcher-ce6f06c4.esm.js} +1 -1
- package/dist/{version-tracker-abf7b029.cjs.prod.js → version-tracker-16a3fd4b.cjs.prod.js} +1 -1
- package/dist/{version-tracker-0c067072.cjs.dev.js → version-tracker-9a743ce4.cjs.dev.js} +1 -1
- package/dist/{version-tracker-d3961598.esm.js → version-tracker-9f76b73e.esm.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
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var reactRouterDom = require('react-router-dom');
|
|
4
|
-
var uuid = require('uuid');
|
|
5
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
6
|
-
var constants = require('@commercetools-frontend/constants');
|
|
7
|
-
var urlUtils = require('@commercetools-frontend/url-utils');
|
|
8
|
-
var oidc = require('./oidc-b070ff6c.cjs.prod.js');
|
|
9
|
-
var useIsServedByProxy = require('./use-is-served-by-proxy-845cace5.cjs.prod.js');
|
|
10
|
-
var getMcOrigin = require('./get-mc-origin-8f7a578c.cjs.prod.js');
|
|
11
|
-
var redirector = require('./redirector-752b4efc.cjs.prod.js');
|
|
12
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
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('react');
|
|
29
|
-
require('qss');
|
|
30
|
-
|
|
31
|
-
const generateAndCacheNonceWithState = state => {
|
|
32
|
-
const nonce = uuid.v4();
|
|
33
|
-
// We store additional information within the given `nonce`
|
|
34
|
-
// to then retrieve it later when the IdP redirects back
|
|
35
|
-
// to our application. The URL will contain the `nonce` within
|
|
36
|
-
// the id_token and, once validated, we can retrieve and use
|
|
37
|
-
// the state object.
|
|
38
|
-
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
39
|
-
applicationShellConnectors.oidcStorage.setSessionState(nonce, state);
|
|
40
|
-
return nonce;
|
|
41
|
-
};
|
|
42
|
-
const RedirectToLogin = () => {
|
|
43
|
-
var _window$app$__DEVELOP;
|
|
44
|
-
const location = reactRouterDom.useLocation();
|
|
45
|
-
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
46
|
-
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) {
|
|
47
|
-
var _window$app$__DEVELOP2, _window$app$__DEVELOP3, _window$app$__DEVELOP4, _window$app$__DEVELOP5, _window$app$__DEVELOP6;
|
|
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 = applicationShellConnectors.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 ? "/".concat(nextProjectKey) : '/'
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
const requestedScope = oidc.buildOidcScope({
|
|
70
|
-
projectKey: nextProjectKey !== null && nextProjectKey !== void 0 ? nextProjectKey : undefined,
|
|
71
|
-
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,
|
|
72
|
-
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,
|
|
73
|
-
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,
|
|
74
|
-
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
|
|
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
|
-
applicationShellConnectors.oidcStorage.setSessionScope(requestedScope);
|
|
81
|
-
return jsxRuntime.jsx(redirector.Redirector, {
|
|
82
|
-
to: "",
|
|
83
|
-
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,
|
|
84
|
-
location: location,
|
|
85
|
-
queryParams: {
|
|
86
|
-
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
87
|
-
// Query parameters for OIDC-lik workflow.
|
|
88
|
-
client_id: window.app.applicationId,
|
|
89
|
-
response_type: oidc.OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
90
|
-
scope: requestedScope,
|
|
91
|
-
state: sessionId,
|
|
92
|
-
nonce: sessionId
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
97
|
-
return jsxRuntime.jsx(redirector.Redirector, {
|
|
98
|
-
to: "login",
|
|
99
|
-
origin: mcOrigin,
|
|
100
|
-
location: location,
|
|
101
|
-
queryParams: {
|
|
102
|
-
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
103
|
-
redirectTo: urlUtils.trimLeadingAndTrailingSlashes(urlUtils.joinPaths(window.location.origin, location.pathname))
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
108
|
-
|
|
109
|
-
exports["default"] = RedirectToLogin;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var reactRouterDom = require('react-router-dom');
|
|
4
|
-
var uuid = require('uuid');
|
|
5
|
-
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
6
|
-
var constants = require('@commercetools-frontend/constants');
|
|
7
|
-
var urlUtils = require('@commercetools-frontend/url-utils');
|
|
8
|
-
var oidc = require('./oidc-7c48215c.cjs.dev.js');
|
|
9
|
-
var useIsServedByProxy = require('./use-is-served-by-proxy-ed411f45.cjs.dev.js');
|
|
10
|
-
var getMcOrigin = require('./get-mc-origin-a86dff20.cjs.dev.js');
|
|
11
|
-
var redirector = require('./redirector-5daa8baa.cjs.dev.js');
|
|
12
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
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('react');
|
|
29
|
-
require('qss');
|
|
30
|
-
|
|
31
|
-
const generateAndCacheNonceWithState = state => {
|
|
32
|
-
const nonce = uuid.v4();
|
|
33
|
-
// We store additional information within the given `nonce`
|
|
34
|
-
// to then retrieve it later when the IdP redirects back
|
|
35
|
-
// to our application. The URL will contain the `nonce` within
|
|
36
|
-
// the id_token and, once validated, we can retrieve and use
|
|
37
|
-
// the state object.
|
|
38
|
-
// https://auth0.com/docs/protocols/oauth2/oauth-state#how-to-use-the-parameter-to-restore-application-state
|
|
39
|
-
applicationShellConnectors.oidcStorage.setSessionState(nonce, state);
|
|
40
|
-
return nonce;
|
|
41
|
-
};
|
|
42
|
-
const RedirectToLogin = () => {
|
|
43
|
-
var _window$app$__DEVELOP;
|
|
44
|
-
const location = reactRouterDom.useLocation();
|
|
45
|
-
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
46
|
-
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) {
|
|
47
|
-
var _window$app$__DEVELOP2, _window$app$__DEVELOP3, _window$app$__DEVELOP4, _window$app$__DEVELOP5, _window$app$__DEVELOP6;
|
|
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 = applicationShellConnectors.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 ? "/".concat(nextProjectKey) : '/'
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
const requestedScope = oidc.buildOidcScope({
|
|
70
|
-
projectKey: nextProjectKey !== null && nextProjectKey !== void 0 ? nextProjectKey : undefined,
|
|
71
|
-
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,
|
|
72
|
-
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,
|
|
73
|
-
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,
|
|
74
|
-
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
|
|
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
|
-
applicationShellConnectors.oidcStorage.setSessionScope(requestedScope);
|
|
81
|
-
return jsxRuntime.jsx(redirector.Redirector, {
|
|
82
|
-
to: "",
|
|
83
|
-
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,
|
|
84
|
-
location: location,
|
|
85
|
-
queryParams: {
|
|
86
|
-
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
87
|
-
// Query parameters for OIDC-lik workflow.
|
|
88
|
-
client_id: window.app.applicationId,
|
|
89
|
-
response_type: oidc.OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
90
|
-
scope: requestedScope,
|
|
91
|
-
state: sessionId,
|
|
92
|
-
nonce: sessionId
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
const mcOrigin = servedByProxy ? getMcOrigin.getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
97
|
-
return jsxRuntime.jsx(redirector.Redirector, {
|
|
98
|
-
to: "login",
|
|
99
|
-
origin: mcOrigin,
|
|
100
|
-
location: location,
|
|
101
|
-
queryParams: {
|
|
102
|
-
reason: constants.LOGOUT_REASONS.UNAUTHORIZED,
|
|
103
|
-
redirectTo: urlUtils.trimLeadingAndTrailingSlashes(urlUtils.joinPaths(window.location.origin, location.pathname))
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
108
|
-
|
|
109
|
-
exports["default"] = RedirectToLogin;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { useLocation } from 'react-router-dom';
|
|
2
|
-
import { v4 } from 'uuid';
|
|
3
|
-
import { oidcStorage } from '@commercetools-frontend/application-shell-connectors';
|
|
4
|
-
import { LOGOUT_REASONS } from '@commercetools-frontend/constants';
|
|
5
|
-
import { trimLeadingAndTrailingSlashes, joinPaths } from '@commercetools-frontend/url-utils';
|
|
6
|
-
import { b as buildOidcScope, a as OIDC_RESPONSE_TYPES } from './oidc-da8526e3.esm.js';
|
|
7
|
-
import { u as useIsServedByProxy } from './use-is-served-by-proxy-77984220.esm.js';
|
|
8
|
-
import { g as getMcOrigin } from './get-mc-origin-fecfee07.esm.js';
|
|
9
|
-
import { R as Redirector } from './redirector-db8b5cd2.esm.js';
|
|
10
|
-
import { jsx } from '@emotion/react/jsx-runtime';
|
|
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 'react';
|
|
27
|
-
import 'qss';
|
|
28
|
-
|
|
29
|
-
const generateAndCacheNonceWithState = state => {
|
|
30
|
-
const nonce = 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
|
-
oidcStorage.setSessionState(nonce, state);
|
|
38
|
-
return nonce;
|
|
39
|
-
};
|
|
40
|
-
const RedirectToLogin = () => {
|
|
41
|
-
var _window$app$__DEVELOP;
|
|
42
|
-
const location = useLocation();
|
|
43
|
-
const servedByProxy = useIsServedByProxy();
|
|
44
|
-
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) {
|
|
45
|
-
var _window$app$__DEVELOP2, _window$app$__DEVELOP3, _window$app$__DEVELOP4, _window$app$__DEVELOP5, _window$app$__DEVELOP6;
|
|
46
|
-
// We pick the project key from local storage. This assumes that the value
|
|
47
|
-
// as been previously set when the application starts up.
|
|
48
|
-
// This is necessary to allow switching projects and triggering a new login.
|
|
49
|
-
const nextProjectKey = oidcStorage.getActiveProjectKey();
|
|
50
|
-
|
|
51
|
-
// According to the OIDC spec, the `state` parameter is recommended to be sent
|
|
52
|
-
// to the authorization server to help mitigating Cross-Site Request Forgery.
|
|
53
|
-
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
54
|
-
// Using `state` or `nonce` is very similar but with subtle differences.
|
|
55
|
-
// Here we follow the approach described by Auth0 on how to use both, where
|
|
56
|
-
// we generate a `nonce`, store it in session storage together with some state,
|
|
57
|
-
// and send it to the authorization server as the `state` parameter.
|
|
58
|
-
// https://auth0.com/docs/protocols/oauth2/redirect-users
|
|
59
|
-
// Additionally, we still send the `nonce` parameter as well.
|
|
60
|
-
const sessionId = generateAndCacheNonceWithState({
|
|
61
|
-
applicationId: window.app.applicationId,
|
|
62
|
-
// Store query parameters to be used after the callback redirect
|
|
63
|
-
query: {
|
|
64
|
-
redirectTo: nextProjectKey ? "/".concat(nextProjectKey) : '/'
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
const requestedScope = buildOidcScope({
|
|
68
|
-
projectKey: nextProjectKey !== null && nextProjectKey !== void 0 ? nextProjectKey : undefined,
|
|
69
|
-
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,
|
|
70
|
-
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,
|
|
71
|
-
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,
|
|
72
|
-
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
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// Store session scopes, to be able to detect if requested scopes changed
|
|
76
|
-
// in the application config and invalidate the session.
|
|
77
|
-
// This is only valid for local development.
|
|
78
|
-
oidcStorage.setSessionScope(requestedScope);
|
|
79
|
-
return jsx(Redirector, {
|
|
80
|
-
to: "",
|
|
81
|
-
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,
|
|
82
|
-
location: location,
|
|
83
|
-
queryParams: {
|
|
84
|
-
reason: LOGOUT_REASONS.UNAUTHORIZED,
|
|
85
|
-
// Query parameters for OIDC-lik workflow.
|
|
86
|
-
client_id: window.app.applicationId,
|
|
87
|
-
response_type: OIDC_RESPONSE_TYPES.ID_TOKEN,
|
|
88
|
-
scope: requestedScope,
|
|
89
|
-
state: sessionId,
|
|
90
|
-
nonce: sessionId
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
const mcOrigin = servedByProxy ? getMcOrigin(window.app.mcApiUrl) : undefined;
|
|
95
|
-
return jsx(Redirector, {
|
|
96
|
-
to: "login",
|
|
97
|
-
origin: mcOrigin,
|
|
98
|
-
location: location,
|
|
99
|
-
queryParams: {
|
|
100
|
-
reason: LOGOUT_REASONS.UNAUTHORIZED,
|
|
101
|
-
redirectTo: trimLeadingAndTrailingSlashes(joinPaths(window.location.origin, location.pathname))
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
RedirectToLogin.displayName = 'RedirectToLogin';
|
|
106
|
-
|
|
107
|
-
export { RedirectToLogin as default };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('@emotion/react');
|
|
4
|
-
var Card = require('@commercetools-uikit/card');
|
|
5
|
-
var designSystem = require('@commercetools-uikit/design-system');
|
|
6
|
-
var notifications = require('@commercetools-uikit/notifications');
|
|
7
|
-
var Spacings = require('@commercetools-uikit/spacings');
|
|
8
|
-
var Text = require('@commercetools-uikit/text');
|
|
9
|
-
var useIsServedByProxy = require('./use-is-served-by-proxy-845cace5.cjs.prod.js');
|
|
10
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
11
|
-
require('@commercetools-frontend/application-shell-connectors');
|
|
12
|
-
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var Card__default = /*#__PURE__*/_interopDefault(Card);
|
|
16
|
-
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
17
|
-
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
18
|
-
|
|
19
|
-
const RedirectToProjectCreate = () => {
|
|
20
|
-
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
21
|
-
/**
|
|
22
|
-
* NOTE:
|
|
23
|
-
* This looks a bit unusual: redirecting in render.
|
|
24
|
-
* However, when doing it in `cDM` we loose time
|
|
25
|
-
* we we actually do never want to render anything or
|
|
26
|
-
* interact with anything rendered. Instead we should should
|
|
27
|
-
* redirect away. Using a constructor would result in the same.
|
|
28
|
-
* In turn this intends wo make explicit that we never want to
|
|
29
|
-
* render and instead just navigate away.
|
|
30
|
-
*/
|
|
31
|
-
if (servedByProxy === true) {
|
|
32
|
-
useIsServedByProxy.location.replace('/account/projects/new');
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return jsxRuntime.jsx("div", {
|
|
36
|
-
css: /*#__PURE__*/react.css("align-self:center;margin-top:", designSystem.customProperties.spacingXl, ";max-width:", designSystem.customProperties.constraint10, ";" + ("" ), "" ),
|
|
37
|
-
children: jsxRuntime.jsx(Card__default["default"], {
|
|
38
|
-
type: "flat",
|
|
39
|
-
theme: "dark",
|
|
40
|
-
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
41
|
-
children: [jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
42
|
-
as: "h1",
|
|
43
|
-
children: "Please create a project!"
|
|
44
|
-
}), jsxRuntime.jsx(notifications.ContentNotification, {
|
|
45
|
-
type: "info",
|
|
46
|
-
children: "You are running in development mode"
|
|
47
|
-
}), jsxRuntime.jsx(Text__default["default"].Body, {
|
|
48
|
-
children: "The Custom Application is not running behind the Merchant Center Proxy. Therefore, you are not being redirected to the account section to create a new project."
|
|
49
|
-
}), jsxRuntime.jsx(Text__default["default"].Body, {
|
|
50
|
-
children: "If you do need to create a project, we recommend to go to the Merchant Center production URL and create a project there. After that, you can access your new project from your local environment."
|
|
51
|
-
})]
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
57
|
-
|
|
58
|
-
exports.RedirectToProjectCreate = RedirectToProjectCreate;
|
|
59
|
-
exports["default"] = RedirectToProjectCreate;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('@emotion/react');
|
|
4
|
-
var Card = require('@commercetools-uikit/card');
|
|
5
|
-
var designSystem = require('@commercetools-uikit/design-system');
|
|
6
|
-
var notifications = require('@commercetools-uikit/notifications');
|
|
7
|
-
var Spacings = require('@commercetools-uikit/spacings');
|
|
8
|
-
var Text = require('@commercetools-uikit/text');
|
|
9
|
-
var useIsServedByProxy = require('./use-is-served-by-proxy-ed411f45.cjs.dev.js');
|
|
10
|
-
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
11
|
-
require('@commercetools-frontend/application-shell-connectors');
|
|
12
|
-
|
|
13
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var Card__default = /*#__PURE__*/_interopDefault(Card);
|
|
16
|
-
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
17
|
-
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
18
|
-
|
|
19
|
-
const RedirectToProjectCreate = () => {
|
|
20
|
-
const servedByProxy = useIsServedByProxy.useIsServedByProxy();
|
|
21
|
-
/**
|
|
22
|
-
* NOTE:
|
|
23
|
-
* This looks a bit unusual: redirecting in render.
|
|
24
|
-
* However, when doing it in `cDM` we loose time
|
|
25
|
-
* we we actually do never want to render anything or
|
|
26
|
-
* interact with anything rendered. Instead we should should
|
|
27
|
-
* redirect away. Using a constructor would result in the same.
|
|
28
|
-
* In turn this intends wo make explicit that we never want to
|
|
29
|
-
* render and instead just navigate away.
|
|
30
|
-
*/
|
|
31
|
-
if (servedByProxy === true) {
|
|
32
|
-
useIsServedByProxy.location.replace('/account/projects/new');
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return jsxRuntime.jsx("div", {
|
|
36
|
-
css: /*#__PURE__*/react.css("align-self:center;margin-top:", designSystem.customProperties.spacingXl, ";max-width:", designSystem.customProperties.constraint10, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:RedirectToProjectCreate;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJlZGlyZWN0LXRvLXByb2plY3QtY3JlYXRlLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE2QmMiLCJmaWxlIjoicmVkaXJlY3QtdG8tcHJvamVjdC1jcmVhdGUudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IENhcmQgZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvY2FyZCc7XG5pbXBvcnQgeyBjdXN0b21Qcm9wZXJ0aWVzIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvZGVzaWduLXN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C5cbiAgICAgICAgICA8L1RleHQuQm9keT5cbiAgICAgICAgICA8VGV4dC5Cb2R5PlxuICAgICAgICAgICAgSWYgeW91IGRvIG5lZWQgdG8gY3JlYXRlIGEgcHJvamVjdCwgd2UgcmVjb21tZW5kIHRvIGdvIHRvIHRoZVxuICAgICAgICAgICAgTWVyY2hhbnQgQ2VudGVyIHByb2R1Y3Rpb24gVVJMIGFuZCBjcmVhdGUgYSBwcm9qZWN0IHRoZXJlLiBBZnRlclxuICAgICAgICAgICAgdGhhdCwgeW91IGNhbiBhY2Nlc3MgeW91ciBuZXcgcHJvamVjdCBmcm9tIHlvdXIgbG9jYWwgZW52aXJvbm1lbnQuXG4gICAgICAgICAgPC9UZXh0LkJvZHk+XG4gICAgICAgIDwvU3BhY2luZ3MuU3RhY2s+XG4gICAgICA8L0NhcmQ+XG4gICAgPC9kaXY+XG4gICk7XG59O1xuUmVkaXJlY3RUb1Byb2plY3RDcmVhdGUuZGlzcGxheU5hbWUgPSAnUmVkaXJlY3RUb1Byb2plY3RDcmVhdGUnO1xuXG5leHBvcnQgZGVmYXVsdCBSZWRpcmVjdFRvUHJvamVjdENyZWF0ZTtcbiJdfQ== */"),
|
|
37
|
-
children: jsxRuntime.jsx(Card__default["default"], {
|
|
38
|
-
type: "flat",
|
|
39
|
-
theme: "dark",
|
|
40
|
-
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
41
|
-
children: [jsxRuntime.jsx(Text__default["default"].Headline, {
|
|
42
|
-
as: "h1",
|
|
43
|
-
children: "Please create a project!"
|
|
44
|
-
}), jsxRuntime.jsx(notifications.ContentNotification, {
|
|
45
|
-
type: "info",
|
|
46
|
-
children: "You are running in development mode"
|
|
47
|
-
}), jsxRuntime.jsx(Text__default["default"].Body, {
|
|
48
|
-
children: "The Custom Application is not running behind the Merchant Center Proxy. Therefore, you are not being redirected to the account section to create a new project."
|
|
49
|
-
}), jsxRuntime.jsx(Text__default["default"].Body, {
|
|
50
|
-
children: "If you do need to create a project, we recommend to go to the Merchant Center production URL and create a project there. After that, you can access your new project from your local environment."
|
|
51
|
-
})]
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
57
|
-
|
|
58
|
-
exports.RedirectToProjectCreate = RedirectToProjectCreate;
|
|
59
|
-
exports["default"] = RedirectToProjectCreate;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { css } from '@emotion/react';
|
|
2
|
-
import Card from '@commercetools-uikit/card';
|
|
3
|
-
import { customProperties } from '@commercetools-uikit/design-system';
|
|
4
|
-
import { ContentNotification } from '@commercetools-uikit/notifications';
|
|
5
|
-
import Spacings from '@commercetools-uikit/spacings';
|
|
6
|
-
import Text from '@commercetools-uikit/text';
|
|
7
|
-
import { u as useIsServedByProxy, l as location } from './use-is-served-by-proxy-77984220.esm.js';
|
|
8
|
-
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
9
|
-
import '@commercetools-frontend/application-shell-connectors';
|
|
10
|
-
|
|
11
|
-
const RedirectToProjectCreate = () => {
|
|
12
|
-
const servedByProxy = useIsServedByProxy();
|
|
13
|
-
/**
|
|
14
|
-
* NOTE:
|
|
15
|
-
* This looks a bit unusual: redirecting in render.
|
|
16
|
-
* However, when doing it in `cDM` we loose time
|
|
17
|
-
* we we actually do never want to render anything or
|
|
18
|
-
* interact with anything rendered. Instead we should should
|
|
19
|
-
* redirect away. Using a constructor would result in the same.
|
|
20
|
-
* In turn this intends wo make explicit that we never want to
|
|
21
|
-
* render and instead just navigate away.
|
|
22
|
-
*/
|
|
23
|
-
if (servedByProxy === true) {
|
|
24
|
-
location.replace('/account/projects/new');
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return jsx("div", {
|
|
28
|
-
css: /*#__PURE__*/css("align-self:center;margin-top:", customProperties.spacingXl, ";max-width:", customProperties.constraint10, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:RedirectToProjectCreate;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJlZGlyZWN0LXRvLXByb2plY3QtY3JlYXRlLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE2QmMiLCJmaWxlIjoicmVkaXJlY3QtdG8tcHJvamVjdC1jcmVhdGUudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IENhcmQgZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvY2FyZCc7XG5pbXBvcnQgeyBjdXN0b21Qcm9wZXJ0aWVzIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvZGVzaWduLXN5c3RlbSc7XG5pbXBvcnQgeyBDb250ZW50Tm90aWZpY2F0aW9uIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvbm90aWZpY2F0aW9ucyc7XG5pbXBvcnQgU3BhY2luZ3MgZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvc3BhY2luZ3MnO1xuaW1wb3J0IFRleHQgZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvdGV4dCc7XG5pbXBvcnQgdXNlSXNTZXJ2ZWRCeVByb3h5IGZyb20gJy4uLy4uL2hvb2tzL3VzZS1pcy1zZXJ2ZWQtYnktcHJveHknO1xuaW1wb3J0IHsgbG9jYXRpb24gfSBmcm9tICcuLi8uLi91dGlscy9sb2NhdGlvbic7XG5cbmV4cG9ydCBjb25zdCBSZWRpcmVjdFRvUHJvamVjdENyZWF0ZSA9ICgpID0+IHtcbiAgY29uc3Qgc2VydmVkQnlQcm94eSA9IHVzZUlzU2VydmVkQnlQcm94eSgpO1xuICAvKipcbiAgICogTk9URTpcbiAgICogICBUaGlzIGxvb2tzIGEgYml0IHVudXN1YW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RpcmVjdFRvUHJvamVjdENyZWF0ZTtcbiJdfQ== */"),
|
|
29
|
-
children: jsx(Card, {
|
|
30
|
-
type: "flat",
|
|
31
|
-
theme: "dark",
|
|
32
|
-
children: jsxs(Spacings.Stack, {
|
|
33
|
-
children: [jsx(Text.Headline, {
|
|
34
|
-
as: "h1",
|
|
35
|
-
children: "Please create a project!"
|
|
36
|
-
}), jsx(ContentNotification, {
|
|
37
|
-
type: "info",
|
|
38
|
-
children: "You are running in development mode"
|
|
39
|
-
}), jsx(Text.Body, {
|
|
40
|
-
children: "The Custom Application is not running behind the Merchant Center Proxy. Therefore, you are not being redirected to the account section to create a new project."
|
|
41
|
-
}), jsx(Text.Body, {
|
|
42
|
-
children: "If you do need to create a project, we recommend to go to the Merchant Center production URL and create a project there. After that, you can access your new project from your local environment."
|
|
43
|
-
})]
|
|
44
|
-
})
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
RedirectToProjectCreate.displayName = 'RedirectToProjectCreate';
|
|
49
|
-
|
|
50
|
-
export { RedirectToProjectCreate, RedirectToProjectCreate as default };
|