Skip to content

Latest commit

 

History

History
1844 lines (1098 loc) · 85.7 KB

File metadata and controls

1844 lines (1098 loc) · 85.7 KB

@commercetools-frontend/application-config

22.33.0

Minor Changes

  • #3610 c699f1b Thanks @mustafaasif2! - Extends the cloudIdentifier configuration property enabling Custom Applications and Custom Views to use the Azure EU environment

Patch Changes

22.32.2

Patch Changes

22.32.1

Patch Changes

22.32.0

Patch Changes

22.31.0

Patch Changes

22.30.3

Patch Changes

22.30.2

Patch Changes

22.30.1

Patch Changes

22.30.0

Patch Changes

22.29.0

Minor Changes

Patch Changes

22.28.0

Patch Changes

22.27.0

Patch Changes

22.26.0

Patch Changes

22.25.1

Patch Changes

22.25.0

Patch Changes

22.24.0

Patch Changes

22.23.3

Patch Changes

22.23.2

Patch Changes

22.23.1

Patch Changes

22.23.0

Patch Changes

22.22.0

Patch Changes

22.21.0

Patch Changes

22.20.0

Patch Changes

22.19.0

Patch Changes

22.18.0

Patch Changes

22.17.2

Patch Changes

22.17.1

Patch Changes

22.17.0

Minor Changes

Patch Changes

22.16.0

Patch Changes

22.15.1

Patch Changes

22.15.0

Patch Changes

22.14.3

Patch Changes

22.14.2

Patch Changes

22.14.1

Patch Changes

22.14.0

Patch Changes

22.13.2

Patch Changes

22.13.1

Patch Changes

22.13.0

Patch Changes

22.12.0

Minor Changes

  • #3292 5de8c88ed Thanks @CarlosCortizasCT! - Add new helper functions computeCustomViewPermissionsKeys and computeCustomViewResourceAccesses to compute the permission names for Custom Views.

  • #3291 d3f4c91f1 Thanks @kark! - Enhance the functionality of the mc-scripts config:sync command to support custom views.

Patch Changes

22.11.0

Patch Changes

22.10.0

Minor Changes

  • #3272 deed7bafc Thanks @CarlosCortizasCT! - We refactored the formatter functions to transform entry points to resource access names so it uses simplified names only for Custom Views (upcoming feature).

Patch Changes

22.9.1

Patch Changes

22.9.0

Patch Changes

22.8.4

Patch Changes

22.8.3

Patch Changes

22.8.2

Patch Changes

22.8.1

Patch Changes

22.8.0

Minor Changes

Patch Changes

22.7.1

Patch Changes

22.7.0

Minor Changes

Patch Changes

22.6.0

Patch Changes

22.5.0

Minor Changes

  • #3143 6b6f15623 Thanks @kark! - Enable reading applicationId value from Custom Application config and sending it as a new application_id claim (when team_id claim is also provided)

Patch Changes

22.4.0

Patch Changes

22.3.4

Patch Changes

22.3.3

Patch Changes

22.3.2

Patch Changes

22.3.1

Patch Changes

22.3.0

Minor Changes

  • #2976 9add8f46b Thanks @emmenko! - We migrate from Yarn to Pnpm as the package manager for the App Kit repository. As a result of it there were several packages that didn't specify all the needed dependencies. This is fixed now.

Patch Changes

22.2.1

Patch Changes

22.2.0

Patch Changes

22.1.0

Patch Changes

22.0.1

Patch Changes

22.0.0

Major Changes

  • #3026 968c3c4d2 Thanks @emmenko! - Upgrade following dependencies to major versions:

    • jest to v29.x.
    • jsdom to v21.x.
    • eslint-plugin-jest to v27.x.

    Migration

    The package @commercetools-frontend/jest-preset-mc-app contains most of the updates and migration changes.

    We don't expect any specific migration effort besides updating all Jest dependencies to their latest version (including possible Jest plugins being used).

    However, there are a couple of possible necessary updates to consider:

    • Jest snapshots format changed a bit. You might need to update your snapshots by passing the option -u to the Jest command.
    • The ESLint plugin for Jest might yield some new errors due to its breaking changes. See changelog.

    For more detailed information about upgrading Jest, please refer to the official guides:

  • #3039 76ba54c16 Thanks @emmenko! - Drop support for Node.js v14. Make sure you use Node.js v16 or >=v18.

Patch Changes

21.25.2

Patch Changes

21.25.1

Patch Changes

21.25.0

Patch Changes

21.24.3

Patch Changes

21.24.2

Patch Changes

21.24.1

Patch Changes

21.24.0

Minor Changes

Patch Changes

21.23.10

Patch Changes

21.23.9

Patch Changes

21.23.8

Patch Changes

21.23.7

Patch Changes

21.23.6

Patch Changes

21.23.5

Patch Changes

21.23.4

Patch Changes

21.23.3

Patch Changes

21.23.2

Patch Changes

21.23.1

Patch Changes

21.23.0

Patch Changes

21.22.1

Patch Changes

21.22.0

Patch Changes

21.21.2

Patch Changes

21.21.1

Patch Changes

21.21.0

Minor Changes

  • #2799 033d95e08 Thanks @kark! - Enable configuring granular permissions in Custom Applications.

    Additional permissions are defined by adding permission groups in the Custom Application config. See docs.

Patch Changes

21.20.5

Patch Changes

21.20.4

Patch Changes

21.20.3

Patch Changes

21.20.2

Patch Changes

21.20.1

Patch Changes

21.20.0

Patch Changes

21.19.0

Patch Changes

21.18.1

Patch Changes

21.18.0

Patch Changes

  • #2834 84c29cebe Thanks @kark! - Enable proper type inference in entryPointUriPathToResourceAccesses and entryPointUriPathToPermissionKeys functions

  • #2862 836c86aa1 Thanks @emmenko! - Sanitize SVG icon only when comparing diffs, as the icon is sanitized in the API. Expose the sanitizeSvg logic from the @commercetools-frontend/application-config.

  • #2860 53d2c287f Thanks @CarlosCortizasCT! - Fix CSP headers processing at Custom Application build time when using a deployment URL without an ending backslash

  • Updated dependencies []:

21.17.0

Patch Changes

21.16.0

Patch Changes

21.15.0

Patch Changes

21.14.3

Patch Changes

21.14.2

Patch Changes

21.14.1

Patch Changes

  • #2796 91c0da4f9 Thanks @emmenko! - Allow to pass additional permission group names to the "entry point formatters". Additionally, refine the inferred types.

  • Updated dependencies []:

21.14.0

Patch Changes

21.13.1

Patch Changes

  • 482ad98ee Thanks @emmenko! - Nothing changed, the previous release 21.13.0 had an issue publishing to NPM so we're bumping versions to trigger a new release.

  • Updated dependencies [482ad98ee]:

21.13.0

Patch Changes

21.12.0

Patch Changes

21.11.0

Patch Changes

21.10.0

Patch Changes

21.9.0

Patch Changes

  • #2701 22fcb200 Thanks @emmenko! - Simplify JSON schema and move validation out of schema. Export some constant values.

21.8.1

Patch Changes

21.8.0

Minor Changes

  • #2615 d6bfecf1 Thanks @kark! - Provide better support for developing Custom Applications in TypeScript.

    A shared TSConfig file is now available to be used as a base config in your tsconfig.json file:

    {
      "extends": "@commercetools-frontend/application-config/tsconfig-mc-app.json"
    }

    Furthermore, we provide a client.d.ts declaration file with some basic type shims for importing media assets:

    • .mod.css and .module.css
    • .png
    • .svg

    You can include this using the TypeScript triple-slash directives:

    /// <reference types="@commercetools-frontend/application-config/client" />

    By default, this is included in the TypeScript starter template src/index.tsx entry point file.

    You can also include this in the tsconfig.json file in the compilerOptions.types field but we don't recommend to use that unless you are very familiar with the implications of using the types field.

Patch Changes

21.7.0

Minor Changes

  • #2628 0b3ea758 Thanks @kark! - Expose a base tsconfig-mc-app.json file to be used in a Custom Application TypeScript project.

    In your tsconfig.json file, extend the base config from the @commercetools-frontend/application-config package:

    {
      "extends": "@commercetools-frontend/application-config/tsconfig-mc-app.json"
    }

21.6.0

Patch Changes

21.5.0

Patch Changes

  • #2578 3180de7f Thanks @emmenko! - Allow to extend the environment types of the ApplicationRuntimeConfig. This is useful if you want to have the additionalEnv properties typed.

    For example, given the following config:

    {
      "additionalEnv": {
        "trackingSentry": "https://[email protected]/000"
      }
    }

    You can extend the type as following:

    import type { ApplicationRuntimeConfig } from '@commercetools-frontend/application-config';
    
    type TMyApplicationRuntimeConfig = ApplicationRuntimeConfig<{
      trackingSentry: string;
    }>;

21.3.4

Patch Changes

21.3.3

Patch Changes

  • #2540 602822c0 Thanks @emmenko! - Fix computing submenu link uriPath when parsing local Custom Application config.

21.3.2

Patch Changes

21.3.0

Minor Changes

  • #2524 ea1bee4c Thanks @Rhotimee! - Expose a new function getConfigPath to return the absolute file path of the Custom Application config file.

Patch Changes

  • #2522 bf57dc32 Thanks @emmenko! - Parsing the application config now exposes a new field data that contains the mapped Custom Application data representation.

21.2.1

Patch Changes

21.1.2

Patch Changes

21.0.1

Patch Changes

21.0.0

Major Changes

  • #2430 bb1f7d75 Thanks @emmenko! - Following breaking changes were introduced:

    • New required fields in the Custom Application config.
    • Menu links structure in Custom Application config changed a bit.
    • The ENABLE_OIDC_FOR_DEVELOPMENT is now the default behavior.
    • The deprecated menu.json file and the DEV_ONLY_ props have been removed.

    Note that if you were testing your Custom Application with Cypress, you need to use the @commercetools-frontend/cypress package to be able to use the cy.loginByOidc command.

    For more information see Release notes v21.

Patch Changes

21.0.0-rc.7

Patch Changes

21.0.0-rc.5

Patch Changes

21.0.0-rc.4

Patch Changes

21.0.0-rc.1

Patch Changes

21.0.0-rc.0

Major Changes

  • #2430 b8fb4cbb Thanks @emmenko! - Following breaking changes were introduced:

    • New required fields in the Custom Application config.
    • Menu links structure in Custom Application config changed a bit.
    • The ENABLE_OIDC_FOR_DEVELOPMENT is now the default behavior.
    • The deprecated menu.json file and the DEV_ONLY_ props have been removed.

    Note that if you were testing your Custom Application with Cypress, you need to use the @commercetools-frontend/cypress package to be able to use the cy.loginByOidc command.

    For more information see Release notes v21.

Patch Changes

20.12.3

Patch Changes

20.12.1

Patch Changes

20.12.0

Minor Changes

  • #2416 f549637b Thanks @emmenko! - Add new SVG icons for Custom Applications. Test icon colors with VRT.

20.11.0

Minor Changes

  • #2403 59b72adf Thanks @Rhotimee! - Allow to use the "frame-src" directive for headers.csp in the Custom Application config.

20.10.6

Patch Changes

20.10.4

Patch Changes

20.10.3

Patch Changes

  • #2376 9d879503 Thanks @emmenko! - > For commercetools only.

    Allow to use OIDC login when developing against a local running MC API.

20.10.1

Patch Changes

20.9.4

Patch Changes

  • #2333 d7b712e4 Thanks @emmenko! - Localized label field of menu links is optional and defaults to empty array.

20.9.3

Patch Changes

20.9.2

Patch Changes

20.9.1

Patch Changes

20.9.0

Minor Changes

  • #2317 487fcca6 Thanks @emmenko! - Add support for defining the Custom Application config as JS files.

    Until now a Custom Application config file had to be defined as a JSON file with one of the following names:

    • .custom-application-configrc
    • .custom-application-config.json
    • custom-application-config.json

    On top of that, we built some "syntax features" to allow variable placeholders as a way to inject dynamic information into the static configuration file.

    However, there are still some use cases where the information you need to provide must be imported from another file, for example a constants file or something similar.

    To support such use cases, we now allow additional JS files to be used as a Custom Application config, specifically the following file extensions:

    • .js
    • .cjs
    • .mjs
    • .ts

    The file must obviously return the configuration object.

    NOTE that you can still use variable placeholders.

    For example:

    // constants.js
    const entryPointUriPath = 'test';
    module.exports = { entryPointUriPath };
    
    // custom-application-config.js
    const { entryPointUriPath } = require('./constants');
    
    const name = 'Test application';
    
    /**
     * @type {import('@commercetools-frontend/application-config').ConfigOptions}
     */
    const config = {
      name,
      cloudIdentifier: 'gcp-eu',
      entryPointUriPath,
      env: {
        production: {
          url: '${env:APP_URL}',
        },
      },
    };
    module.exports = config;

Patch Changes

20.8.0

Minor Changes

  • #2312 ca4e1441 Thanks @emmenko! - Introduce a new configuration option for defining menu links when developing a Custom Application.

    At the moment, menu links are expected to be defined in a menu.json file and loaded by the Custom Application using a special prop DEV_ONLY__loadNavbarMenuConfig passed to the <ApplicationShell>. Something like this:

    <ApplicationShell
      // ...
      DEV_ONLY__loadNavbarMenuConfig={() =>
        import('../../../menu.json').then((data) => data.default || data)
      }
    />

    This poses some issues and confusion:

    • The prop DEV_ONLY__loadNavbarMenuConfig is confusing, and users have to explicitly load the menu.json with code splitting, to avoid having the content in the production bundles.
    • The content of the menu.json is not validated at all, relying on try-error approaches from the users.
    • The menu.json is not really documented.
    • Having an extra menu.json file besides the custom-application-config.json is not ideal.

    Now we support defining the menu links in the custom-application-config.json itself, which aims to solve all the issues mentioned before. It also comes with some additional improvements such as:

    • Less configuration fields.
    • Support for two new variable placeholders:
      • intl: Given that menu labels are translated, you can reference a translation using the following syntax: ${intl:<local>:<translation_key>}, for example ${intl:en:Menu.Avengers}.
      • path: Reference a file to load the its content and inline it. This is usually useful for SVG icons. The path can be relative to the application folder, for example ${path:./app.svg}, or from a module, for example ${path:@commercetools-frontend/assets/application-icons/rocket.svg}.

    NOTE: This is an opt-in feature and is meant to replace the menu.json approach. For now it's fully backwards compatible.

    The menu links can be defined in the custom-application-config.json using the field menuLinks. You can check the JSON schema to inspect the supported fields.

    Example:

    {
      // ...
      "menuLinks": {
        "icon": "${path:@commercetools-frontend/assets/application-icons/rocket.svg}",
        "defaultLabel": "${intl:en:Menu.StateMachines}",
        "labelAllLocales": [
          {
            "locale": "en",
            "value": "${intl:en:Menu.StateMachines}"
          },
          {
            "locale": "de",
            "value": "${intl:de:Menu.StateMachines}"
          }
        ],
        "submenuLinks": [
          {
            "uriPath": "echo-server",
            "defaultLabel": "${intl:en:Menu.EchoServer}",
            "labelAllLocales": [
              {
                "locale": "en",
                "value": "${intl:en:Menu.EchoServer}"
              },
              {
                "locale": "de",
                "value": "${intl:de:Menu.EchoServer}"
              }
            ]
          }
        ]
      }
    }

Patch Changes

20.7.0

Patch Changes

20.5.2

Patch Changes

20.5.1

Patch Changes

20.4.0

Patch Changes

20.3.3

Patch Changes

  • #2244 118efedd Thanks @tdeekens! - Allow configuration of Strict-Transport-Security header through custom application config.

    Similar to the Feature-Policies header use the strictTransportSecurity property of the custom application config to add to the defaults.

    headers: {
      strictTransportSecurity: ['includeSubDomains'];
    }

20.3.1

Patch Changes

20.3.0

Patch Changes

20.1.2

Patch Changes

20.0.1

Patch Changes

19.3.1

Patch Changes

19.1.0

Minor Changes

  • #2143 53b27b0b Thanks @tdeekens! - Adds support for specifying the Permissions-Policy header supported in Chrome 90.

    Similar to the Feature-Policies header an application config now support a permissionsPolicies field.

    headers: {
      permissionPolicies: {
        mircophone: '()';
      }
    }

    More information about supported permission policies can be found here.

19.0.1

Patch Changes

19.0.0

Major Changes

  • #2041 a240f657 Thanks @emmenko! - - Changes required Node.js engine version to >=12 || >=14 in package.json.

18.7.0

Patch Changes

18.6.0

Patch Changes

18.5.6

Patch Changes

18.5.2

Patch Changes

18.5.1

Patch Changes

18.4.1

Patch Changes

18.4.0

Patch Changes

18.1.4

Patch Changes

18.1.0

Patch Changes

17.10.1

Patch Changes

17.10.0

Minor Changes

  • d86c2e8 #1934 Thanks @emmenko! - Introduce a new experimental opt-in feature to authenticate the application for local development, using an OIDC-like workflow.

    Disclaimer: this is an opt-in experimental feature. Use it at your own risk. We want to test this feature internally first. Until then, we discourage you to try it out.

    The feature can be enabled by setting the ENABLE_OIDC_FOR_DEVELOPMENT=true environment variable.

    In addition to that, we have a new package @commercetools-frontend/cypress, to include some useful commands for testing Custom Applications.

Patch Changes

  • 2d6dbaa #1980 Thanks @emmenko! - Use MC_API_URL env variable and allow passing empty strings to the application config.

17.9.0

Minor Changes

  • 4f7e081 #1948 Thanks @emmenko! - Allow to pass the application routes as children of <ApplicationShell>, instead of using the render prop. When doing so, the application entry point routes are automatically configured according to the entryPointUriPath defined in the custom-application-config.json.

    Note that it's still possible to use the render prop. However, for most of the cases it should suffice to rely on the pre-configured routes.

    const AsyncApplicationRoutes = React.lazy(
      () => import('../../routes' /* webpackChunkName: "starter-routes" */)
    );
    
    -export const ApplicationStarter = () => (
    -  <Switch>
    -    {
    -      /* For development, it's useful to redirect to the actual
    -      application routes when you open the browser at http://localhost:3001 */
    -      process.env.NODE_ENV === 'production' ? null : (
    -        <Redirect
    -          exact={true}
    -          from="/:projectKey"
    -          to="/:projectKey/examples-starter"
    -        />
    -      )
    -    }
    -    <Route
    -      path="/:projectKey/examples-starter"
    -      component={AsyncApplicationRoutes}
    -    />
    -    {/* Catch-all route */}
    -    <RouteCatchAll />
    -  </Switch>
    -);
    -ApplicationStarter.displayName = 'ApplicationStarter';
    
    const EntryPoint = () => (
      <ApplicationShell
        environment={window.app}
        onRegisterErrorListeners={({ dispatch }) => {
          Sdk.Get.errorHandler = (error) =>
            globalActions.handleActionError(error, 'sdk')(dispatch);
        }}
        applicationMessages={loadMessages}
        DEV_ONLY__loadNavbarMenuConfig={() =>
          import('../../../menu.json').then((data) => data.default || data)
        }
        featureFlags={FEATURE_FLAGS}
    -    render={() => <ApplicationStarter />}
    -  />
    +  >
    +    <AsyncApplicationRoutes />
    +  </ApplicationShell>
    );

    Furthermore, the test-utils of the @commercetools-frontend/application-shell have now a new option to enable this opt-in behavior of rendering the application with pre-configured routes. To enable this option, pass the disableAutomaticEntryPointRoutes: false to the renderApp or renderAppWithRedux functions.

    Note that you also need to provide the environment.entryPointUriPath in order for the routes to be correctly configured.

    -renderApp(<ApplicationStarter />, {
    +renderApp(<AsyncApplicationRoutes />, {
      route: '/my-project/examples-starter'
    +  environment: {
    +    entryPointUriPath: 'examples-starter',
    +  },
    +  disableAutomaticEntryPointRoutes: false,
    });

17.8.0

Patch Changes

17.7.3

Patch Changes

17.7.1

Patch Changes

17.7.0

Minor Changes

  • d74addd #1914 Thanks @adnasa! - add experimental application-components/product-picker, generate new types in application-config, application-shell

Patch Changes

17.6.2

Patch Changes

17.6.0

Patch Changes

17.4.1

Patch Changes

17.4.0

Patch Changes

  • 09cc4b4 #1880 Thanks @emmenko! - Make the applicationId a combination of the Custom Application id and entryPointUriPath.

17.3.0

Patch Changes

17.2.1

Patch Changes

17.2.0

Patch Changes

17.0.1

Patch Changes

17.0.0

Major Changes

  • 633d8c7 #1805 Thanks @emmenko! - Remove the CLI flag --use-local-assets. The default behavior of mc-scripts compile-html now is to compile the assets locally, which is the only reasonable thing to do.

    Furthermore, the @commercetools-frontend/mc-http-server package has been deprecated and won't be published anymore. With the compile-html command there is no need to have a pre-configured HTTP server anymore.

    When running the mc-scripts compile-html command, the index.html is compiled for production usage and it lives in the public folder, together with the other static assets. This is all you need to deploy your application. You can decide to deploy the Custom Application statically to one of the popular cloud providers, or serve the files on your own using a static server.

    For example, to run locally the Custom Application using the production bundles:

    NODE_ENV=production MC_APP_ENV=development dotenv -- \
      mc-scripts compile-html \
      --transformer @commercetools-frontend/mc-dev-authentication/transformer-local.js
    
    mc-scripts serve

16.17.0

Patch Changes

16.16.1

Patch Changes

16.16.0

Patch Changes

16.15.8

Patch Changes

16.15.4

Patch Changes

  • 0182cd3 #1645 Thanks @emmenko! - refactor(application-config): be more strict on deriving the prod env based on the MC_APP_ENV.

    TL;DR: in case the MC_APP_ENV is defined, we consider that it's a production environment unless it's one of development or test. This allows to use for example the staging value, which from the application perspective is still considered a production environment.

16.15.2

Patch Changes

16.15.1

Patch Changes

  • 96b3af7 #1636 Thanks @emmenko! - Fix parsing of application config to preserve full URLs when inferring CSP directives. Furthermore, every environment variable referenced within the application config that has an empty value will be parsed as-is and it will not be rejected. Additionally, the fields passed to the additionalEnv object that are empty will be removed from the resulting environment and window.app.

16.15.0

Minor Changes

  • 728024c #1626 Thanks @emmenko! - This release introduces the usage of a new configuration file format and marks the deprecation of the env.json and headers.json files.

    For all the necessary information about migrating to the new configuration file, please read the release notes.

Patch Changes

  • 33baf25 #1634 Thanks @emmenko! - Update description of schema properties of the application config