@remotion/studio 4.0.403 → 4.0.404
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/RenderModal/WebRenderModalLicense.js +46 -9
- package/dist/components/RenderModal/WebRenderModalLicenseKeyDetails.d.ts +13 -0
- package/dist/components/RenderModal/WebRenderModalLicenseKeyDetails.js +49 -0
- package/dist/esm/{chunk-64385d31.js → chunk-5yga8730.js} +442 -278
- package/dist/esm/internals.mjs +442 -278
- package/dist/esm/previewEntry.mjs +456 -292
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/icons/check-circle-filled.d.ts +2 -0
- package/dist/icons/check-circle-filled.js +6 -0
- package/package.json +9 -9
|
@@ -8,6 +8,7 @@ const Checkbox_1 = require("../Checkbox");
|
|
|
8
8
|
const RemInput_1 = require("../NewComposition/RemInput");
|
|
9
9
|
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
10
10
|
const layout_1 = require("../layout");
|
|
11
|
+
const WebRenderModalLicenseKeyDetails_1 = require("./WebRenderModalLicenseKeyDetails");
|
|
11
12
|
exports.row = {
|
|
12
13
|
display: 'flex',
|
|
13
14
|
flexDirection: 'row',
|
|
@@ -84,12 +85,13 @@ const LICENSE_KEY_LENGTH = 55;
|
|
|
84
85
|
const LICENSE_KEY_PREFIX = 'rm_pub_';
|
|
85
86
|
const validateLicenseKey = (key) => {
|
|
86
87
|
if (key.length === 0) {
|
|
87
|
-
return { valid: false, message: null };
|
|
88
|
+
return { valid: false, message: null, details: null };
|
|
88
89
|
}
|
|
89
90
|
if (!key.startsWith(LICENSE_KEY_PREFIX)) {
|
|
90
91
|
return {
|
|
91
92
|
valid: false,
|
|
92
93
|
message: `License key must start with "${LICENSE_KEY_PREFIX}"`,
|
|
94
|
+
details: null,
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
97
|
const afterPrefix = key.slice(LICENSE_KEY_PREFIX.length);
|
|
@@ -97,17 +99,58 @@ const validateLicenseKey = (key) => {
|
|
|
97
99
|
return {
|
|
98
100
|
valid: false,
|
|
99
101
|
message: 'License key must contain only alphanumeric characters after the prefix',
|
|
102
|
+
details: null,
|
|
100
103
|
};
|
|
101
104
|
}
|
|
102
105
|
if (key.length !== LICENSE_KEY_LENGTH) {
|
|
103
106
|
return {
|
|
104
107
|
valid: false,
|
|
105
108
|
message: `License key must be ${LICENSE_KEY_LENGTH} characters long`,
|
|
109
|
+
details: null,
|
|
106
110
|
};
|
|
107
111
|
}
|
|
108
|
-
return { valid: true, message: null };
|
|
112
|
+
return { valid: true, message: null, details: null };
|
|
109
113
|
};
|
|
110
114
|
const WebRenderModalLicense = ({ licenseKey, setLicenseKey, initialPublicLicenseKey, }) => {
|
|
115
|
+
const [licenseValidation, setLicenseValidation] = (0, react_1.useState)({ valid: true, message: null, details: null });
|
|
116
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
117
|
+
(0, react_1.useEffect)(() => {
|
|
118
|
+
if (licenseKey === null || licenseKey === 'free-license') {
|
|
119
|
+
return setLicenseValidation({
|
|
120
|
+
valid: true,
|
|
121
|
+
message: null,
|
|
122
|
+
details: null,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const validation = validateLicenseKey(licenseKey);
|
|
126
|
+
if (!validation.valid) {
|
|
127
|
+
return setLicenseValidation(validation);
|
|
128
|
+
}
|
|
129
|
+
setLicenseValidation({ valid: true, message: null, details: null });
|
|
130
|
+
setIsLoading(true);
|
|
131
|
+
(0, WebRenderModalLicenseKeyDetails_1.fetchLicenseKeyDetails)(licenseKey)
|
|
132
|
+
.then((details) => {
|
|
133
|
+
setIsLoading(false);
|
|
134
|
+
if (details.isValid) {
|
|
135
|
+
setLicenseValidation({ valid: true, message: null, details });
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
setLicenseValidation({
|
|
139
|
+
valid: false,
|
|
140
|
+
message: 'License key is invalid or has been reset',
|
|
141
|
+
details: null,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
.catch(() => {
|
|
146
|
+
setIsLoading(false);
|
|
147
|
+
setLicenseValidation({
|
|
148
|
+
valid: false,
|
|
149
|
+
message: 'Failed to fetch license key details',
|
|
150
|
+
details: null,
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}, [licenseKey]);
|
|
111
154
|
const onFreeLicenseChange = (0, react_1.useCallback)(() => {
|
|
112
155
|
setLicenseKey('free-license');
|
|
113
156
|
}, [setLicenseKey]);
|
|
@@ -117,14 +160,8 @@ const WebRenderModalLicense = ({ licenseKey, setLicenseKey, initialPublicLicense
|
|
|
117
160
|
const onLicenseKeyChange = (0, react_1.useCallback)((e) => {
|
|
118
161
|
setLicenseKey(e.target.value);
|
|
119
162
|
}, [setLicenseKey]);
|
|
120
|
-
const licenseValidation = (0, react_1.useMemo)(() => {
|
|
121
|
-
if (licenseKey === null || licenseKey === 'free-license') {
|
|
122
|
-
return { valid: true, message: null };
|
|
123
|
-
}
|
|
124
|
-
return validateLicenseKey(licenseKey);
|
|
125
|
-
}, [licenseKey]);
|
|
126
163
|
return ((0, jsx_runtime_1.jsxs)("div", { style: tabContainer, children: [(0, jsx_runtime_1.jsxs)("div", { style: descriptionStyle, children: ["Remotion is free if you are an individual or company with a headcount of 3 or less. See", ' ', (0, jsx_runtime_1.jsx)("a", { style: descriptionLink, href: "https://remotion.dev/license", children: "LICENSE.md" }), "."] }), (0, jsx_runtime_1.jsx)("div", { style: exports.row, children: (0, jsx_runtime_1.jsxs)("div", { style: justifyCenter, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: licenseKey === 'free-license', onChange: onFreeLicenseChange, name: "free-license", rounded: true }), (0, jsx_runtime_1.jsxs)("div", { style: checkboxLabel, onClick: onFreeLicenseChange, children: ["I am eligible for the Free License, ", "don't", " print a warning"] })] }) }), licenseKey === 'free-license' ? ((0, jsx_runtime_1.jsxs)("div", { style: paddedDescriptionStyle, children: ["Enjoy Remotion! Add the following to", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeStyle, children: "remotion.config.ts" }), " to persist this setting:", (0, jsx_runtime_1.jsx)("div", { style: codeLine, children: "Config.setPublicLicenseKey('free-license');" })] })) : null, (0, jsx_runtime_1.jsx)("div", { style: exports.row, children: (0, jsx_runtime_1.jsxs)("div", { style: justifyCenter, children: [(0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { checked: licenseKey !== 'free-license' && licenseKey !== null, onChange: onCompanyLicenseChange, name: "company-license", rounded: true }), (0, jsx_runtime_1.jsx)("div", { style: checkboxLabel, onClick: onCompanyLicenseChange, children: "I have a Company License" })] }) }), licenseKey !== 'free-license' && licenseKey !== null ? ((0, jsx_runtime_1.jsxs)("div", { style: paddedDescriptionStyle, children: ["Add your public license from", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://remotion.pro/dashboard", target: "_blank", style: descriptionLink, children: "remotion.pro" }), ' ', "key below.", (0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(RemInput_1.RemotionInput, { value: licenseKey, onChange: onLicenseKeyChange, placeholder: "remotion.pro public license key (starts with rm_pub_)", status: licenseValidation.valid || licenseKey.length === 0
|
|
127
164
|
? 'ok'
|
|
128
|
-
: 'error', rightAlign: false, style: inputStyle, autoFocus: true }), licenseValidation.message ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: licenseValidation.message, align: "flex-start", type: "error" })] })) : null, licenseValidation.valid && licenseKey.length > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), "Add the following to", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeStyle, children: "remotion.config.ts" }), " to persist this setting:", (0, jsx_runtime_1.jsx)("div", { style: codeLineSmall, children: "Config.setPublicLicenseKey('" + licenseKey + "');" })] })) : null] })) : null, licenseKey === null ? ((0, jsx_runtime_1.jsxs)("div", { style: descriptionStyle, children: ["If you are not eligible for the free license, you need to obtain a", ' ', (0, jsx_runtime_1.jsx)("a", { style: descriptionLink, target: "_blank", href: "https://remotion.pro/license", children: "Company License" }), "."] })) : null] }));
|
|
165
|
+
: 'error', rightAlign: false, style: inputStyle, autoFocus: true }), licenseValidation.message ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(ValidationMessage_1.ValidationMessage, { message: licenseValidation.message, align: "flex-start", type: "error" })] })) : null, licenseValidation.valid && licenseKey.length > 0 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), "Add the following to", ' ', (0, jsx_runtime_1.jsx)("code", { style: codeStyle, children: "remotion.config.ts" }), " to persist this setting:", (0, jsx_runtime_1.jsx)("div", { style: codeLineSmall, children: "Config.setPublicLicenseKey('" + licenseKey + "');" })] })) : null, isLoading && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), "Loading license key details..."] })), licenseValidation.details && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(layout_1.Spacing, { y: 1, block: true }), (0, jsx_runtime_1.jsx)(WebRenderModalLicenseKeyDetails_1.WebRenderModalLicenseKeyDetails, { details: licenseValidation.details })] }))] })) : null, licenseKey === null ? ((0, jsx_runtime_1.jsxs)("div", { style: descriptionStyle, children: ["If you are not eligible for the free license, you need to obtain a", ' ', (0, jsx_runtime_1.jsx)("a", { style: descriptionLink, target: "_blank", href: "https://remotion.pro/license", children: "Company License" }), "."] })) : null] }));
|
|
129
166
|
};
|
|
130
167
|
exports.WebRenderModalLicense = WebRenderModalLicense;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type LicenseKeyDetails = {
|
|
3
|
+
readonly isValid: boolean;
|
|
4
|
+
readonly hasActiveSubscription: boolean;
|
|
5
|
+
readonly projectName: string;
|
|
6
|
+
readonly projectSlug: string;
|
|
7
|
+
};
|
|
8
|
+
type WebRenderModalLicenseKeyDetailsProps = {
|
|
9
|
+
readonly details: LicenseKeyDetails;
|
|
10
|
+
};
|
|
11
|
+
export declare const fetchLicenseKeyDetails: (licenseKey: string) => Promise<LicenseKeyDetails>;
|
|
12
|
+
export declare const WebRenderModalLicenseKeyDetails: React.FC<WebRenderModalLicenseKeyDetailsProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebRenderModalLicenseKeyDetails = exports.fetchLicenseKeyDetails = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const colors_1 = require("../../helpers/colors");
|
|
6
|
+
const check_circle_filled_1 = require("../../icons/check-circle-filled");
|
|
7
|
+
const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
|
|
8
|
+
const textStyle = {
|
|
9
|
+
color: colors_1.LIGHT_TEXT,
|
|
10
|
+
fontSize: 14,
|
|
11
|
+
fontFamily: 'sans-serif',
|
|
12
|
+
lineHeight: 1.5,
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
};
|
|
16
|
+
const linkStyle = {
|
|
17
|
+
fontSize: 14,
|
|
18
|
+
fontFamily: 'sans-serif',
|
|
19
|
+
lineHeight: 1.5,
|
|
20
|
+
cursor: 'pointer',
|
|
21
|
+
};
|
|
22
|
+
const bulletStyle = {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
gap: 6,
|
|
26
|
+
};
|
|
27
|
+
const icon = {
|
|
28
|
+
width: 14,
|
|
29
|
+
height: 14,
|
|
30
|
+
flexShrink: 0,
|
|
31
|
+
};
|
|
32
|
+
const PRO_HOST = 'https://remotion.pro';
|
|
33
|
+
const fetchLicenseKeyDetails = async (licenseKey) => {
|
|
34
|
+
const response = await fetch(`${PRO_HOST}/api/validate-license-key`, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
licenseKey,
|
|
38
|
+
}),
|
|
39
|
+
headers: {
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return response.json();
|
|
44
|
+
};
|
|
45
|
+
exports.fetchLicenseKeyDetails = fetchLicenseKeyDetails;
|
|
46
|
+
const WebRenderModalLicenseKeyDetails = ({ details }) => {
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: bulletStyle, children: [(0, jsx_runtime_1.jsx)(check_circle_filled_1.CheckCircleFilled, { style: { ...icon, fill: colors_1.LIGHT_TEXT } }), (0, jsx_runtime_1.jsxs)("div", { style: textStyle, children: ["Belongs to\u00A0", (0, jsx_runtime_1.jsx)("a", { href: `${PRO_HOST}/projects/${details.projectSlug}`, target: "_blank", style: linkStyle, children: details.projectName }), "\u00A0-\u00A0", (0, jsx_runtime_1.jsx)("a", { href: `${PRO_HOST}/projects/${details.projectSlug}/usage#client-renders-usage`, target: "_blank", style: linkStyle, children: "View usage" })] })] }), details.hasActiveSubscription ? ((0, jsx_runtime_1.jsxs)("div", { style: bulletStyle, children: [(0, jsx_runtime_1.jsx)(check_circle_filled_1.CheckCircleFilled, { style: { ...icon, fill: colors_1.LIGHT_TEXT } }), (0, jsx_runtime_1.jsx)("div", { style: textStyle, children: "Active Company License" })] })) : ((0, jsx_runtime_1.jsxs)("div", { style: bulletStyle, children: [(0, jsx_runtime_1.jsx)(ValidationMessage_1.WarningTriangle, { type: "warning", style: { ...icon, fill: colors_1.WARNING_COLOR } }), (0, jsx_runtime_1.jsx)("div", { style: textStyle, children: "No active Company License" })] }))] }));
|
|
48
|
+
};
|
|
49
|
+
exports.WebRenderModalLicenseKeyDetails = WebRenderModalLicenseKeyDetails;
|