|
1 | 1 | // Make sure to import the helper functions from the `ssr` entry point.
|
2 | 2 | import { entryPointUriPathToPermissionKeys } from '@commercetools-frontend/application-shell/ssr';
|
3 | 3 |
|
4 |
| -export const entryPointUriPath = process.env.ENTRY_POINT_URI_PATH ?? 'mollie'; |
| 4 | +declare global { |
| 5 | + interface Window { |
| 6 | + app?: { |
| 7 | + [key: string]: string; |
| 8 | + entryPointUriPath: string; |
| 9 | + }; |
| 10 | + } |
| 11 | +} |
| 12 | + |
| 13 | +const getConfig = (processKey: string, windowKey: string) => { |
| 14 | + return typeof window === 'undefined' |
| 15 | + ? process.env[processKey] |
| 16 | + : window.app?.[windowKey]; |
| 17 | +}; |
| 18 | + |
| 19 | +export const entryPointUriPath = |
| 20 | + getConfig('ENTRY_POINT_URI_PATH', 'entryPointUriPath') ?? 'mollie'; |
| 21 | + |
5 | 22 | export const PERMISSIONS = entryPointUriPathToPermissionKeys(entryPointUriPath);
|
6 |
| -export const CLOUD_IDENTIFIER = process.env.CLOUD_IDENTIFIER ?? 'gcp-eu'; |
7 |
| -export const CUSTOM_APPLICATION_ID = process.env.CUSTOM_APPLICATION_ID ?? ''; |
| 23 | +export const CLOUD_IDENTIFIER = |
| 24 | + getConfig('CLOUD_IDENTIFIER', 'cloudIdentifier') ?? 'gcp-eu'; |
| 25 | +export const CUSTOM_APPLICATION_ID = |
| 26 | + getConfig('CUSTOM_APPLICATION_ID', 'customApplicationId') ?? ''; |
8 | 27 | export const APPLICATION_URL =
|
9 |
| - process.env.APPLICATION_URL ?? 'https://mollie.app'; |
| 28 | + getConfig('APPLICATION_URL', 'applicationUrl') ?? 'https://your-app-url.com'; |
| 29 | + |
10 | 30 | export const OBJECT_CONTAINER_NAME = 'sctm-app-methods';
|
11 | 31 | export const EXTENSION_KEY = 'sctm-payment-create-update-extension';
|
12 | 32 | export const EXTENSION_URL_PATH = '/processor';
|
|
0 commit comments