Skip to content

Commit 6f65a88

Browse files
added request license modal
1 parent 1053d19 commit 6f65a88

File tree

4 files changed

+650
-3
lines changed

4 files changed

+650
-3
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import axios from "axios";
2+
3+
export interface LicenseRequestData {
4+
contactData: {
5+
companyName: string;
6+
address: string;
7+
registerNumber: string;
8+
contactName: string;
9+
contactEmail: string;
10+
contactPhone: string;
11+
taxId?: string;
12+
vatId?: string;
13+
organizationId: string;
14+
deploymentIds: string[];
15+
};
16+
licenseType: 'per-api-calls' | 'per-instance';
17+
licenseData: {
18+
apiCallLimit?: number;
19+
instanceCount?: number;
20+
currentApiUsage?: number;
21+
lastMonthApiUsage?: number;
22+
};
23+
organizationId: string;
24+
deploymentIds: string[];
25+
submittedAt: string;
26+
submittedBy: string;
27+
}
28+
29+
export interface LicenseRequestResponse {
30+
success: boolean;
31+
message: string;
32+
requestId?: string;
33+
estimatedResponseTime?: string;
34+
}
35+
36+
/**
37+
* Submit a license request to flow.lowcoder.cloud
38+
* @param data The license request data
39+
* @returns Promise with the response
40+
*/
41+
export const submitLicenseRequest = async (data: LicenseRequestData): Promise<LicenseRequestResponse> => {
42+
try {
43+
// TODO: Replace with actual endpoint when available
44+
const response = await axios.post('https://flow.lowcoder.cloud/api/license-requests', data, {
45+
headers: {
46+
'Content-Type': 'application/json',
47+
},
48+
timeout: 30000, // 30 second timeout
49+
});
50+
51+
return response.data;
52+
} catch (error) {
53+
console.error('License request submission failed:', error);
54+
55+
// For now, simulate a successful response since the endpoint doesn't exist yet
56+
if (axios.isAxiosError(error) && error.code === 'ECONNREFUSED') {
57+
// Simulate successful submission for development/testing
58+
return {
59+
success: true,
60+
message: 'License request submitted successfully (simulated)',
61+
requestId: `sim-${Date.now()}`,
62+
estimatedResponseTime: '24-48 hours',
63+
};
64+
}
65+
66+
throw new Error('Failed to submit license request. Please try again later.');
67+
}
68+
};
69+
70+
/**
71+
* Get the status of a license request
72+
* @param requestId The request ID
73+
* @returns Promise with the status
74+
*/
75+
export const getLicenseRequestStatus = async (requestId: string): Promise<any> => {
76+
try {
77+
// TODO: Replace with actual endpoint when available
78+
const response = await axios.get(`https://flow.lowcoder.cloud/api/license-requests/${requestId}`);
79+
return response.data;
80+
} catch (error) {
81+
console.error('Failed to get license request status:', error);
82+
throw new Error('Failed to get request status');
83+
}
84+
};

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,6 +2475,42 @@ export const en = {
24752475
"readMoreButton" : "Enterprise Edition Details",
24762476
"requestLicense" : "Request Enterprise Edition Licenses",
24772477
"requestLicensesBtton" : "Unlock Enterprise Features",
2478+
"licenseRequest": {
2479+
"title": "Request Enterprise Licenses",
2480+
"companyDetails": "Company Details",
2481+
"licenseSelection": "License Selection",
2482+
"reviewSubmit": "Review & Submit",
2483+
"requestSubmitted": "Request Submitted",
2484+
"companyName": "Company Name",
2485+
"address": "Address",
2486+
"registerNumber": "Register Number",
2487+
"contactPerson": "Contact Person",
2488+
"contactEmail": "Contact Email",
2489+
"contactPhone": "Contact Phone",
2490+
"taxId": "Tax ID",
2491+
"vatId": "VAT ID",
2492+
"licenseType": "License Type",
2493+
"perApiCalls": "Per API Calls",
2494+
"perInstance": "Per Instance",
2495+
"apiCallLimit": "Monthly API Call Limit",
2496+
"instanceCount": "Number of Instances",
2497+
"additionalNotes": "Additional Notes",
2498+
"currentUsage": "Current Usage",
2499+
"lastMonthUsage": "Last Month Usage",
2500+
"currentDeployments": "Current Deployments",
2501+
"payBasedOnUsage": "Pay based on API usage volume",
2502+
"payPerInstance": "Pay per deployment instance",
2503+
"thankYouMessage": "Your license request has been submitted successfully. Our team will review your request and contact you within 24-48 hours.",
2504+
"nextSteps": "Next Steps",
2505+
"nextStepsDescription": "While you wait for your license, you can:",
2506+
"reviewDocs": "Review our Enterprise Edition documentation",
2507+
"downloadRelease": "Download the latest Enterprise Edition release",
2508+
"checkInstallGuide": "Check out our installation guide",
2509+
"submitRequest": "Submit Request",
2510+
"back": "Back",
2511+
"next": "Next",
2512+
"close": "Close"
2513+
},
24782514
"AuditLogsTitle": "Audit Logs",
24792515
"AuditLogsIntroTitle": "Powerful visibility into your workspace activity",
24802516
"AuditLogsIntro1": "Audit Logs enable administrators to track exactly what happens across the entire Lowcoder platform. From user sign-ins to app modifications, every relevant action is captured and stored.",

0 commit comments

Comments
 (0)