Skip to content

Commit

Permalink
Merge pull request #111 from mollie/release/v1.2.0
Browse files Browse the repository at this point in the history
[1.2.0] Custom application
  • Loading branch information
tdang1-shopmacher authored Dec 3, 2024
2 parents 8055001 + 40400db commit 0b2f21e
Show file tree
Hide file tree
Showing 117 changed files with 147,951 additions and 655 deletions.
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,61 @@ 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.2.0

Added

- Mollie custom application

Updated

- [getPaymentMethods](/docs/GetPaymentMethods.md) response has new returned format as follow

```Typescript
{
id: string,
name: Record<string, string>
description: Record<string, string>
image: string;
order: number;
}

// e.g.
{
id: 'paypal',
name: {
'en-GB': 'PayPal',
'de-DE': 'PayPal',
},
description: {
'en-GB': '',
'de-DE': '',
},
image: 'https://example.img/paypal.svg',
order: 1
}
```

## v1.1.2

Added

- Add configuration to enable authorization mode
- OAuth middleware for securing connector endpoint

## v1.1.1

Fixes

- Type converting issue in payment method listing endpoint

## v1.1.0

Added

- DockerImage for self hosting on AWS
- Installation endpoint for required configurations

## v1.0.4

Added
Expand All @@ -16,6 +71,7 @@ Added
Added

- Add docs for status checking endpoint
- Endpoints for checking connector statuses

## v1.0.2

Expand Down
2 changes: 2 additions & 0 deletions application/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLE_NEW_JSX_TRANSFORM="true"
FAST_REFRESH="true"
8 changes: 8 additions & 0 deletions application/.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ENABLE_NEW_JSX_TRANSFORM="true"
FAST_REFRESH="true"

ENTRY_POINT_URI_PATH="mollie"
PROJECT_KEY="your-project-key"
CLOUD_IDENTIFIER="gcp-eu"
CUSTOM_APPLICATION_ID="app-id"
APPLICATION_URL="http://localhost:3001"
23 changes: 23 additions & 0 deletions application/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
process.env.ENABLE_NEW_JSX_TRANSFORM = 'true';

/**
* @type {import("eslint").Linter.Config}
*/
module.exports = {
extends: ['@commercetools-frontend/eslint-config-mc-app'],
plugins: ['graphql', 'cypress'],
overrides: [
{
files: ['**/*.ctp.graphql'],
rules: {
'graphql/template-strings': [
'error',
{
env: 'literal',
schemaJson: require('./schemas/ctp.json'),
},
],
},
},
],
};
9 changes: 9 additions & 0 deletions application/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
public
dist
!.env

# Cypress
cypress/.env
cypress/screenshots/**
cypress/videos/**
1 change: 1 addition & 0 deletions application/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
4 changes: 4 additions & 0 deletions application/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
i18n/data/*.json
public
.cache
.yarn
19 changes: 19 additions & 0 deletions application/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"trailingComma": "es5",
"singleQuote": true,
"parser": "typescript",
"overrides": [
{
"files": "*.json",
"options": {
"parser": "json"
}
},
{
"files": "*.graphql",
"options": {
"parser": "graphql"
}
}
]
}
62 changes: 62 additions & 0 deletions application/@types-extensions/graphql-ctp/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/* THIS IS A GENERATED FILE */
/* eslint-disable import/no-duplicates */

declare module '*/fetch-channel-details.ctp.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const FetchChannelDetails: DocumentNode;

export default defaultDocument;
}

declare module '*/fetch-channels.ctp.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const FetchChannels: DocumentNode;

export default defaultDocument;
}

declare module '*/update-channel-details.ctp.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const UpdateChannelDetails: DocumentNode;

export default defaultDocument;
}

declare module '*/fetch-custom-objects.ctp.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const FetchCustomObjects: DocumentNode;

export default defaultDocument;
}

declare module '*/fetch-custom-object-details.ctp.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const UpdateCustomObjects: DocumentNode;
export default defaultDocument;
}

declare module '*/update-custom-object-details.ctp.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const UpdateCustomObjectDetails: DocumentNode;
export default defaultDocument;
}

declare module '*/remove-custom-object-details.ctp.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const RemoveCustomObjectDetails: DocumentNode;
export default defaultDocument;
}

declare module '*/fetch-extension-destination.ctp.graphql' {
import { DocumentNode } from 'graphql';
const defaultDocument: DocumentNode;
export const FetchExtensionDestination: DocumentNode;
export default defaultDocument;
}
11 changes: 11 additions & 0 deletions application/@types/commercetools__sync-actions/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declare module '@commercetools/sync-actions' {
export type SyncAction = { action: string; [x: string]: unknown };
function buildActions<NextDraft, OriginalDraft>(
nextDraft: NextDraft,
originalDraft: OriginalDraft
): SyncAction[];
export type Syncer = {
buildActions: typeof buildActions;
};
export function createSyncChannels(): Syncer;
}
16 changes: 16 additions & 0 deletions application/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<p align="center">
<a href="https://commercetools.com/">
<img alt="commercetools logo" src="https://unpkg.com/@commercetools-frontend/assets/logos/commercetools_primary-logo_horizontal_RGB.png">
</a>
<b>Custom Application starter template in TypeScript</b>
</p>

This is the [TypeScript](https://www.typescriptlang.org/) version of the starter template to [develop Custom Applications](https://docs.commercetools.com/merchant-center-customizations/custom-applications) for the Merchant Center.

# Installing the template

Read the [Getting started](https://docs.commercetools.com/merchant-center-customizations/custom-applications) documentation for more information.

# Developing the Custom Application

Learn more about [developing a Custom Application](https://docs.commercetools.com/merchant-center-customizations/development) and [how to use the CLI](https://docs.commercetools.com/merchant-center-customizations/api-reference/cli).
22 changes: 22 additions & 0 deletions application/assets/mollie.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions application/custom-application-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {
PERMISSIONS,
entryPointUriPath,
CLOUD_IDENTIFIER,
CUSTOM_APPLICATION_ID,
APPLICATION_URL,
} from './src/constants';

/**
* @type {import('@commercetools-frontend/application-config').ConfigOptionsForCustomApplication}
*/
const config = {
name: 'Mollie',
entryPointUriPath,
cloudIdentifier: CLOUD_IDENTIFIER,
env: {
development: {
initialProjectKey: 'shopm-adv-windev',
},
production: {
applicationId: CUSTOM_APPLICATION_ID,
url: APPLICATION_URL,
},
},
oAuthScopes: {
view: ['view_key_value_documents'],
manage: ['manage_key_value_documents', 'manage_extensions'],
},
icon: '${path:./assets/mollie.svg}',
mainMenuLink: {
defaultLabel: 'Mollie',
labelAllLocales: [],
permissions: [PERMISSIONS.Manage],
},
headers: {
csp: {
'connect-src': ['*.euope-west1.gcp.commercetoolsr.app'],
},
},
};

export default config;
37 changes: 37 additions & 0 deletions application/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import path from 'path';
import { defineConfig } from 'cypress';
import { customApplicationConfig } from '@commercetools-frontend/cypress/task';

export default defineConfig({
retries: 1,
video: false,
viewportHeight: 1080,
viewportWidth: 1920,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
async setupNodeEvents(on, cypressConfig) {
// Load the config
if (!process.env.CI) {
const envPath = path.join(__dirname, 'cypress/.env');
console.log('Loading environment variables from', envPath);
const dotenv = await import('dotenv');
dotenv.config({ path: envPath });
}

on('task', { customApplicationConfig });
return {
...cypressConfig,
env: {
...cypressConfig.env,
LOGIN_USER: process.env.CYPRESS_LOGIN_USER,
LOGIN_PASSWORD: process.env.CYPRESS_LOGIN_PASSWORD,
PROJECT_KEY: process.env.CYPRESS_PROJECT_KEY,
PACKAGE_NAME: process.env.CYPRESS_PACKAGE_NAME,
LOCALE: process.env.CYPRESS_LOCALE || 'en-GB',
},
};
},
baseUrl: process.env.CYPRESS_BASE_URL || 'http://localhost:3001',
},
});
6 changes: 6 additions & 0 deletions application/cypress/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CYPRESS_LOGIN_USER=<your-user>
CYPRESS_LOGIN_PASSWORD=<your-password>
CYPRESS_PROJECT_KEY=<your-project-key>
CYPRESS_PACKAGE_NAME="application"
CYPRESS_BASE_URL="https://mc.europe-west1.gcp.commercetools.com/"
CYPRESS_LOCALE="en-GB"
Loading

0 comments on commit 0b2f21e

Please sign in to comment.