diff --git a/CHANGELOG.md b/CHANGELOG.md index 1520755..fa5224b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## v1.4.3 + +Fixed + +- Failed to get the process key during custom application initialization + ## v1.4.2 - Support for payment methods `in3`, `alma`, `payconiq` diff --git a/application/custom-application-config.ts b/application/custom-application-config.ts index 5a8d35f..d6c8751 100644 --- a/application/custom-application-config.ts +++ b/application/custom-application-config.ts @@ -32,11 +32,6 @@ const config = { labelAllLocales: [], permissions: [PERMISSIONS.Manage], }, - headers: { - csp: { - 'connect-src': ['*.euope-west1.gcp.commercetoolsr.app'], - }, - }, }; export default config; diff --git a/application/package.json b/application/package.json index d7bc7fc..5e497c4 100644 --- a/application/package.json +++ b/application/package.json @@ -1,6 +1,6 @@ { "name": "shopmacher-mollie-application", - "version": "1.4.2", + "version": "1.4.3", "description": "Integration application between commercetools and mollie payment service provider", "private": true, "scripts": { diff --git a/application/src/constants.ts b/application/src/constants.ts index 70b0581..360a2c2 100644 --- a/application/src/constants.ts +++ b/application/src/constants.ts @@ -1,19 +1,39 @@ // Make sure to import the helper functions from the `ssr` entry point. import { entryPointUriPathToPermissionKeys } from '@commercetools-frontend/application-shell/ssr'; -export const entryPointUriPath = process.env.ENTRY_POINT_URI_PATH ?? 'mollie'; +declare global { + interface Window { + app?: { + [key: string]: string; + entryPointUriPath: string; + }; + } +} + +const getConfig = (processKey: string, windowKey: string) => { + return typeof window === 'undefined' + ? process.env[processKey] + : window.app?.[windowKey]; +}; + +export const entryPointUriPath = + getConfig('ENTRY_POINT_URI_PATH', 'entryPointUriPath') ?? 'mollie'; + export const PERMISSIONS = entryPointUriPathToPermissionKeys(entryPointUriPath); -export const CLOUD_IDENTIFIER = process.env.CLOUD_IDENTIFIER ?? 'gcp-eu'; -export const CUSTOM_APPLICATION_ID = process.env.CUSTOM_APPLICATION_ID ?? ''; +export const CLOUD_IDENTIFIER = + getConfig('CLOUD_IDENTIFIER', 'cloudIdentifier') ?? 'gcp-eu'; +export const CUSTOM_APPLICATION_ID = + getConfig('CUSTOM_APPLICATION_ID', 'customApplicationId') ?? ''; export const APPLICATION_URL = - process.env.APPLICATION_URL ?? 'https://mollie.app'; + getConfig('APPLICATION_URL', 'applicationUrl') ?? 'https://your-app-url.com'; + export const OBJECT_CONTAINER_NAME = 'sctm-app-methods'; export const EXTENSION_KEY = 'sctm-payment-create-update-extension'; export const EXTENSION_URL_PATH = '/processor'; export const APPLICATION_URL_PATH = '/application/methods'; export const USER_AGENT = { - name: 'ShopmacherMollieCommercetoolsConnector/1.4.2', - version: '1.4.2', - libraryName: 'ShopmacherMollieCommercetoolsConnector/1.4.2', + name: 'ShopmacherMollieCommercetoolsConnector/1.4.3', + version: '1.4.3', + libraryName: 'ShopmacherMollieCommercetoolsConnector/1.4.3', contactEmail: 'info@mollie.com', }; diff --git a/processor/package-lock.json b/processor/package-lock.json index f11a8cf..9b0e424 100644 --- a/processor/package-lock.json +++ b/processor/package-lock.json @@ -1,12 +1,12 @@ { "name": "shopmacher-mollie-processor", - "version": "1.4.2", + "version": "1.4.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "shopmacher-mollie-processor", - "version": "1.4.2", + "version": "1.4.3", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -9325,4 +9325,4 @@ } } } -} \ No newline at end of file +} diff --git a/processor/package.json b/processor/package.json index 024bde8..2001242 100644 --- a/processor/package.json +++ b/processor/package.json @@ -1,7 +1,7 @@ { "name": "shopmacher-mollie-processor", "description": "Integration between commercetools and mollie payment service provider", - "version": "1.4.2", + "version": "1.4.3", "main": "index.js", "private": true, "scripts": {