From 5ed4d19059ec4dacd90c1b4fe30a169d61827a57 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Tue, 19 Dec 2023 14:58:30 +0200 Subject: [PATCH] feat: Add opt-in enterprise license trial checkbox (no-changelog) (#7826) image --------- Co-authored-by: Omar Ajoue --- .../components/N8nFormInputs/FormInputs.vue | 1 + packages/editor-ui/src/api/usage.ts | 21 ++++- .../src/components/PersonalizationModal.vue | 85 ++++++++++++++++++- .../src/plugins/i18n/locales/en.json | 7 ++ packages/editor-ui/src/stores/usage.store.ts | 19 ++++- packages/editor-ui/src/utils/apiUtils.ts | 5 +- 6 files changed, 133 insertions(+), 5 deletions(-) diff --git a/packages/design-system/src/components/N8nFormInputs/FormInputs.vue b/packages/design-system/src/components/N8nFormInputs/FormInputs.vue index 2f41b59008..cade81d9d1 100644 --- a/packages/design-system/src/components/N8nFormInputs/FormInputs.vue +++ b/packages/design-system/src/components/N8nFormInputs/FormInputs.vue @@ -124,6 +124,7 @@ export default defineComponent({ [name]: value, }; this.$emit('update', { name, value }); + this.$emit('update:modelValue', this.values); }, onValidate(name: string, valid: boolean) { this.validity = { diff --git a/packages/editor-ui/src/api/usage.ts b/packages/editor-ui/src/api/usage.ts index 139af9b0d8..07551d9584 100644 --- a/packages/editor-ui/src/api/usage.ts +++ b/packages/editor-ui/src/api/usage.ts @@ -1,4 +1,4 @@ -import { makeRestApiRequest } from '@/utils/apiUtils'; +import { makeRestApiRequest, request } from '@/utils/apiUtils'; import type { IRestApiContext, UsageState } from '@/Interface'; export const getLicense = async (context: IRestApiContext): Promise => { @@ -15,3 +15,22 @@ export const activateLicenseKey = async ( export const renewLicense = async (context: IRestApiContext): Promise => { return makeRestApiRequest(context, 'POST', '/license/renew'); }; + +export const requestLicenseTrial = async (data: { + licenseType: 'enterprise'; + firstName: string; + lastName: string; + email: string; + instanceUrl: string; +}): Promise => { + return request({ + method: 'POST', + baseURL: 'https://enterprise.n8n.io', + endpoint: '/enterprise-trial', + data, + withCredentials: false, + headers: { + 'Content-Type': 'application/json', + }, + }); +}; diff --git a/packages/editor-ui/src/components/PersonalizationModal.vue b/packages/editor-ui/src/components/PersonalizationModal.vue index 2a9aaed678..626e19693e 100644 --- a/packages/editor-ui/src/components/PersonalizationModal.vue +++ b/packages/editor-ui/src/components/PersonalizationModal.vue @@ -15,6 +15,7 @@