@remotion/studio 4.0.497 → 4.0.499

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.
Files changed (84) hide show
  1. package/dist/components/AssetSelectorItem.js +31 -3
  2. package/dist/components/Canvas.js +162 -7
  3. package/dist/components/Checkbox.js +1 -1
  4. package/dist/components/CompositionSelector.js +13 -10
  5. package/dist/components/CompositionSelectorItem.js +21 -13
  6. package/dist/components/ConfigureLicenseModal.d.ts +4 -0
  7. package/dist/components/ConfigureLicenseModal.js +194 -0
  8. package/dist/components/Editor.d.ts +0 -1
  9. package/dist/components/Editor.js +2 -3
  10. package/dist/components/EditorContent.js +1 -1
  11. package/dist/components/EditorRuler/Ruler.js +5 -3
  12. package/dist/components/ForceSpecificCursor.js +13 -1
  13. package/dist/components/InspectorPanel/CompositionInspector.js +2 -1
  14. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +4 -4
  15. package/dist/components/InspectorPanel/use-composition-actions.js +1 -1
  16. package/dist/components/LicenseKeyValidation.d.ts +17 -0
  17. package/dist/components/LicenseKeyValidation.js +113 -0
  18. package/dist/components/Modals.js +2 -1
  19. package/dist/components/NewComposition/InputDragger.d.ts +27 -0
  20. package/dist/components/NewComposition/InputDragger.js +151 -23
  21. package/dist/components/RenderButton.js +0 -1
  22. package/dist/components/RenderModal/WebRenderModal.js +14 -8
  23. package/dist/components/SelectedOutlineOverlay.js +1 -1
  24. package/dist/components/Splitter/SplitterContainer.d.ts +2 -0
  25. package/dist/components/Splitter/SplitterContainer.js +5 -1
  26. package/dist/components/Splitter/SplitterContext.d.ts +2 -0
  27. package/dist/components/Splitter/SplitterContext.js +2 -0
  28. package/dist/components/Splitter/SplitterElement.js +6 -1
  29. package/dist/components/Splitter/SplitterHandle.js +27 -2
  30. package/dist/components/Timeline/MaxTimelineTracks.d.ts +0 -1
  31. package/dist/components/Timeline/MaxTimelineTracks.js +3 -3
  32. package/dist/components/Timeline/Timeline.js +10 -9
  33. package/dist/components/Timeline/TimelineDragHandler.js +1 -1
  34. package/dist/components/Timeline/TimelineInOutDragHandler.js +25 -1
  35. package/dist/components/Timeline/TimelineLayerEye.js +4 -1
  36. package/dist/components/Timeline/TimelineSelection.js +1 -1
  37. package/dist/components/Timeline/TimelineSequence.js +12 -7
  38. package/dist/components/Timeline/TimelineSequenceItem.js +5 -5
  39. package/dist/components/Timeline/TimelineSequenceName.js +1 -0
  40. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +13 -1
  41. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +68 -12
  42. package/dist/components/Timeline/call-update-keyframe-settings.d.ts +17 -0
  43. package/dist/components/Timeline/call-update-keyframe-settings.js +43 -1
  44. package/dist/components/Timeline/update-selected-easing.js +26 -23
  45. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.d.ts +5 -0
  46. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +16 -9
  47. package/dist/components/Timeline/use-timeline-asset-drop.js +1 -1
  48. package/dist/components/Timeline/use-timeline-keyframe-drag.js +6 -4
  49. package/dist/components/TopPanel.js +2 -1
  50. package/dist/components/composition-drop-preview.d.ts +33 -0
  51. package/dist/components/composition-drop-preview.js +67 -0
  52. package/dist/components/drop-handler-data.d.ts +1 -1
  53. package/dist/components/drop-handler-data.js +27 -60
  54. package/dist/components/effect-drag-and-drop.d.ts +1 -1
  55. package/dist/components/effect-drag-and-drop.js +7 -55
  56. package/dist/components/element-drag-and-drop.d.ts +1 -1
  57. package/dist/components/element-drag-and-drop.js +5 -17
  58. package/dist/components/handle-drop.js +0 -1
  59. package/dist/components/import-assets.d.ts +7 -8
  60. package/dist/components/import-assets.js +2 -9
  61. package/dist/esm/{chunk-5wj95bdd.js → chunk-pk1zwsn1.js} +5972 -4763
  62. package/dist/esm/index.mjs +0 -19
  63. package/dist/esm/internals.mjs +5972 -4763
  64. package/dist/esm/previewEntry.mjs +10765 -9556
  65. package/dist/esm/renderEntry.mjs +1 -1
  66. package/dist/helpers/get-effective-translation.d.ts +13 -1
  67. package/dist/helpers/get-effective-translation.js +12 -6
  68. package/dist/helpers/interactivity-enabled.d.ts +1 -1
  69. package/dist/helpers/interactivity-enabled.js +2 -2
  70. package/dist/helpers/retry-payload.js +0 -1
  71. package/dist/helpers/ruler-canvas-size.d.ts +7 -0
  72. package/dist/helpers/ruler-canvas-size.js +14 -1
  73. package/dist/helpers/use-image-metadata.d.ts +1 -0
  74. package/dist/helpers/use-image-metadata.js +8 -5
  75. package/dist/helpers/use-media-metadata.d.ts +1 -0
  76. package/dist/helpers/use-media-metadata.js +8 -5
  77. package/dist/helpers/use-menu-structure.js +9 -3
  78. package/dist/state/modals.d.ts +3 -1
  79. package/dist/visual-controls/VisualControls.js +1 -1
  80. package/package.json +13 -12
  81. package/dist/components/RenderModal/WebRenderModalLicense.d.ts +0 -9
  82. package/dist/components/RenderModal/WebRenderModalLicense.js +0 -189
  83. package/dist/components/RenderModal/WebRenderModalLicenseKeyDetails.d.ts +0 -13
  84. package/dist/components/RenderModal/WebRenderModalLicenseKeyDetails.js +0 -60
@@ -212,7 +212,7 @@ var renderContent = (Root) => {
212
212
  renderToDOM(/* @__PURE__ */ jsx("div", {
213
213
  children: /* @__PURE__ */ jsx(DelayedSpinner, {})
214
214
  }));
215
- import("./chunk-5wj95bdd.js").then(({ StudioInternals }) => {
215
+ import("./chunk-pk1zwsn1.js").then(({ StudioInternals }) => {
216
216
  window.remotion_isStudio = true;
217
217
  window.remotion_isReadOnlyStudio = true;
218
218
  window.remotion_inputProps = "{}";
@@ -13,7 +13,19 @@ export declare const getEffectiveTranslation: ({ canvasSize, scale, compositionH
13
13
  x: number;
14
14
  y: number;
15
15
  };
16
- export declare const getCenterPointWhileScrolling: ({ size, clientX, clientY, compositionWidth, compositionHeight, scale, translation, }: {
16
+ export declare const getUnboundedCenterPointWhileScrolling: ({ size, clientX, clientY, compositionWidth, compositionHeight, scale, translation, }: {
17
+ size: Size;
18
+ clientX: number;
19
+ clientY: number;
20
+ compositionWidth: number;
21
+ compositionHeight: number;
22
+ scale: number;
23
+ translation: Translation;
24
+ }) => {
25
+ centerX: number;
26
+ centerY: number;
27
+ };
28
+ export declare const getCenterPointWhileScrolling: (options: {
17
29
  size: Size;
18
30
  clientX: number;
19
31
  clientY: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyZoomAroundFocalPoint = exports.getCenterPointWhileScrolling = exports.getEffectiveTranslation = void 0;
3
+ exports.applyZoomAroundFocalPoint = exports.getCenterPointWhileScrolling = exports.getUnboundedCenterPointWhileScrolling = exports.getEffectiveTranslation = void 0;
4
4
  const remotion_1 = require("remotion");
5
5
  const smooth_zoom_1 = require("./smooth-zoom");
6
6
  const studio_fit_padding_1 = require("./studio-fit-padding");
@@ -33,16 +33,22 @@ const getEffectiveTranslation = ({ canvasSize, scale, compositionHeight, composi
33
33
  };
34
34
  };
35
35
  exports.getEffectiveTranslation = getEffectiveTranslation;
36
- const getCenterPointWhileScrolling = ({ size, clientX, clientY, compositionWidth, compositionHeight, scale, translation, }) => {
36
+ const getUnboundedCenterPointWhileScrolling = ({ size, clientX, clientY, compositionWidth, compositionHeight, scale, translation, }) => {
37
37
  const mouseLeft = clientX - size.left;
38
38
  const mouseTop = clientY - size.top;
39
39
  const contentLeftPoint = size.width / 2 - (compositionWidth * scale) / 2 - translation.x;
40
40
  const contentTopPoint = size.height / 2 - (compositionHeight * scale) / 2 - translation.y;
41
- const offsetFromVideoLeft = Math.min(compositionWidth, Math.max(0, (mouseLeft - contentLeftPoint) / scale));
42
- const offsetFromVideoTop = Math.min(compositionHeight, Math.max(0, (mouseTop - contentTopPoint) / scale));
43
41
  return {
44
- centerX: offsetFromVideoLeft,
45
- centerY: offsetFromVideoTop,
42
+ centerX: (mouseLeft - contentLeftPoint) / scale,
43
+ centerY: (mouseTop - contentTopPoint) / scale,
44
+ };
45
+ };
46
+ exports.getUnboundedCenterPointWhileScrolling = getUnboundedCenterPointWhileScrolling;
47
+ const getCenterPointWhileScrolling = (options) => {
48
+ const { centerX, centerY } = (0, exports.getUnboundedCenterPointWhileScrolling)(options);
49
+ return {
50
+ centerX: Math.min(options.compositionWidth, Math.max(0, centerX)),
51
+ centerY: Math.min(options.compositionHeight, Math.max(0, centerY)),
46
52
  };
47
53
  };
48
54
  exports.getCenterPointWhileScrolling = getCenterPointWhileScrolling;
@@ -1 +1 @@
1
- export declare const studioInteractivityEnabled: boolean;
1
+ export declare const isStudioInteractivityEnabled: () => boolean;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.studioInteractivityEnabled = void 0;
3
+ exports.isStudioInteractivityEnabled = void 0;
4
4
  const studio_runtime_config_1 = require("./studio-runtime-config");
5
- exports.studioInteractivityEnabled = (0, studio_runtime_config_1.getStudioInteractivityEnabled)();
5
+ exports.isStudioInteractivityEnabled = studio_runtime_config_1.getStudioInteractivityEnabled;
@@ -182,7 +182,6 @@ const makeClientRetryPayload = (job) => {
182
182
  compositionId: job.compositionId,
183
183
  initialFrame: job.type === 'client-still' ? job.frame : 0,
184
184
  initialLogLevel: job.logLevel,
185
- initialLicenseKey: job.licenseKey,
186
185
  defaultProps: job.inputProps,
187
186
  inFrameMark: job.type === 'client-video' ? job.startFrame : null,
188
187
  outFrameMark: job.type === 'client-video' ? job.endFrame : null,
@@ -3,3 +3,10 @@ export declare const applyRulerInsetsToCanvasSize: ({ rulersAreVisible, size, }:
3
3
  readonly rulersAreVisible: boolean;
4
4
  readonly size: Size;
5
5
  }) => Size;
6
+ export declare const getRulerCanvasSize: ({ orientation, size, }: {
7
+ readonly orientation: "horizontal" | "vertical";
8
+ readonly size: Size;
9
+ }) => {
10
+ height: number;
11
+ width: number;
12
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyRulerInsetsToCanvasSize = void 0;
3
+ exports.getRulerCanvasSize = exports.applyRulerInsetsToCanvasSize = void 0;
4
4
  const editor_rulers_1 = require("../state/editor-rulers");
5
5
  const applyRulerInsetsToCanvasSize = ({ rulersAreVisible, size, }) => {
6
6
  if (!rulersAreVisible) {
@@ -15,3 +15,16 @@ const applyRulerInsetsToCanvasSize = ({ rulersAreVisible, size, }) => {
15
15
  };
16
16
  };
17
17
  exports.applyRulerInsetsToCanvasSize = applyRulerInsetsToCanvasSize;
18
+ const getRulerCanvasSize = ({ orientation, size, }) => {
19
+ if (orientation === 'vertical') {
20
+ return {
21
+ height: size.height,
22
+ width: editor_rulers_1.RULER_WIDTH,
23
+ };
24
+ }
25
+ return {
26
+ height: editor_rulers_1.RULER_WIDTH,
27
+ width: size.width,
28
+ };
29
+ };
30
+ exports.getRulerCanvasSize = getRulerCanvasSize;
@@ -3,6 +3,7 @@ export type ImageMetadata = {
3
3
  readonly width: number;
4
4
  readonly height: number;
5
5
  };
6
+ export declare const getCachedImageMetadata: (src: string) => ImageMetadata | null;
6
7
  export declare const getImageMetadataFromData: (data: Uint8Array<ArrayBufferLike>) => ImageMetadata | null;
7
8
  export declare const getImageMetadata: (src: string) => Promise<ImageMetadata | null>;
8
9
  export declare const useImageMetadata: (src: string | null) => ImageMetadata | null;
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useImageMetadata = exports.getImageMetadata = exports.getImageMetadataFromData = void 0;
3
+ exports.useImageMetadata = exports.getImageMetadata = exports.getImageMetadataFromData = exports.getCachedImageMetadata = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const react_1 = require("react");
6
6
  const cache = new Map();
7
7
  const pendingRequests = new Map();
8
+ const getCachedImageMetadata = (src) => {
9
+ var _a;
10
+ return (_a = cache.get(src)) !== null && _a !== void 0 ? _a : null;
11
+ };
12
+ exports.getCachedImageMetadata = getCachedImageMetadata;
8
13
  const formatImageType = (fileType) => {
9
14
  if (fileType === 'webp') {
10
15
  return 'WebP';
@@ -58,11 +63,9 @@ const getImageMetadata = (src) => {
58
63
  };
59
64
  exports.getImageMetadata = getImageMetadata;
60
65
  const useImageMetadata = (src) => {
61
- var _a;
62
- const [imageMetadata, setImageMetadata] = (0, react_1.useState)(src ? ((_a = cache.get(src)) !== null && _a !== void 0 ? _a : null) : null);
66
+ const [imageMetadata, setImageMetadata] = (0, react_1.useState)(src ? (0, exports.getCachedImageMetadata)(src) : null);
63
67
  (0, react_1.useEffect)(() => {
64
- var _a;
65
- const cached = src ? ((_a = cache.get(src)) !== null && _a !== void 0 ? _a : null) : null;
68
+ const cached = src ? (0, exports.getCachedImageMetadata)(src) : null;
66
69
  setImageMetadata(cached);
67
70
  if (!src || cached) {
68
71
  return;
@@ -12,5 +12,6 @@ export type MediaMetadata = {
12
12
  hasVideoTrack: boolean | null;
13
13
  hasAudioTrack: boolean | null;
14
14
  };
15
+ export declare const getCachedMediaMetadata: (src: string) => MediaMetadata | null;
15
16
  export declare const getMediaMetadata: (src: string) => Promise<MediaMetadata | null>;
16
17
  export declare const useMediaMetadata: (src: string | null) => MediaMetadata | null;
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useMediaMetadata = exports.getMediaMetadata = void 0;
3
+ exports.useMediaMetadata = exports.getMediaMetadata = exports.getCachedMediaMetadata = void 0;
4
4
  const media_utils_1 = require("@remotion/media-utils");
5
5
  const mediabunny_1 = require("mediabunny");
6
6
  const react_1 = require("react");
7
7
  const get_duration_or_compute_1 = require("./get-duration-or-compute");
8
8
  const cache = new Map();
9
9
  const pendingRequests = new Map();
10
+ const getCachedMediaMetadata = (src) => {
11
+ var _a;
12
+ return (_a = cache.get(src)) !== null && _a !== void 0 ? _a : null;
13
+ };
14
+ exports.getCachedMediaMetadata = getCachedMediaMetadata;
10
15
  const safeCall = async (fn) => {
11
16
  try {
12
17
  return await fn();
@@ -116,11 +121,9 @@ const getMediaMetadata = (src) => {
116
121
  };
117
122
  exports.getMediaMetadata = getMediaMetadata;
118
123
  const useMediaMetadata = (src) => {
119
- var _a;
120
- const [mediaMetadata, setMediaMetadata] = (0, react_1.useState)(src ? ((_a = cache.get(src)) !== null && _a !== void 0 ? _a : null) : null);
124
+ const [mediaMetadata, setMediaMetadata] = (0, react_1.useState)(src ? (0, exports.getCachedMediaMetadata)(src) : null);
121
125
  (0, react_1.useEffect)(() => {
122
- var _a;
123
- const cached = src ? ((_a = cache.get(src)) !== null && _a !== void 0 ? _a : null) : null;
126
+ const cached = src ? (0, exports.getCachedMediaMetadata)(src) : null;
124
127
  setMediaMetadata(cached);
125
128
  if (!src || cached) {
126
129
  return;
@@ -269,16 +269,22 @@ const useMenuStructure = (closeMenu, readOnlyStudio) => {
269
269
  {
270
270
  id: 'license',
271
271
  value: 'license',
272
- label: 'License',
272
+ label: 'Configure License...',
273
273
  onClick: () => {
274
+ var _a;
275
+ var _b;
274
276
  closeMenu();
275
- openExternal('https://github.com/remotion-dev/remotion/blob/main/LICENSE.md');
277
+ setSelectedModal({
278
+ type: 'configure-license',
279
+ initialPublicLicenseKey: (_b = (_a = window.remotion_renderDefaults) === null || _a === void 0 ? void 0 : _a.publicLicenseKey) !== null && _b !== void 0 ? _b : null,
280
+ });
276
281
  },
277
282
  type: 'item',
278
283
  keyHint: null,
279
284
  leftItem: null,
280
285
  subMenu: null,
281
- quickSwitcherLabel: 'Help: License',
286
+ quickSwitcherLabel: 'Configure License...',
287
+ disabled: readOnlyStudio || type !== 'connected',
282
288
  },
283
289
  {
284
290
  id: 'acknowledgements',
@@ -29,7 +29,6 @@ export type WebRenderModalState = {
29
29
  initialKeyframeIntervalInSeconds: number | null;
30
30
  initialTransparent: boolean | null;
31
31
  initialMuted: boolean | null;
32
- initialLicenseKey: string | null;
33
32
  initialMediaCacheSizeInBytes: number | null;
34
33
  initialPageResponsiveness: WebRendererPageResponsiveness;
35
34
  };
@@ -143,6 +142,9 @@ export type ModalState = {
143
142
  relativePath: string;
144
143
  } | {
145
144
  type: 'input-props-override';
145
+ } | {
146
+ type: 'configure-license';
147
+ initialPublicLicenseKey: string | null;
146
148
  } | RenderModalState | WebRenderModalState | {
147
149
  type: 'render-progress';
148
150
  jobId: string;
@@ -70,7 +70,7 @@ const VisualControlsProvider = ({ children }) => {
70
70
  if (!env.isStudio) {
71
71
  return value;
72
72
  }
73
- if (!interactivity_enabled_1.studioInteractivityEnabled) {
73
+ if (!(0, interactivity_enabled_1.isStudioInteractivityEnabled)()) {
74
74
  return value;
75
75
  }
76
76
  if (!z) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio"
4
4
  },
5
5
  "name": "@remotion/studio",
6
- "version": "4.0.497",
6
+ "version": "4.0.499",
7
7
  "description": "APIs for interacting with the Remotion Studio",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -24,27 +24,28 @@
24
24
  "react-dom": ">=16.8.0"
25
25
  },
26
26
  "dependencies": {
27
+ "@remotion/drag-and-drop": "4.0.499",
27
28
  "semver": "7.5.3",
28
- "remotion": "4.0.497",
29
- "@remotion/canvas-capture": "4.0.497",
30
- "@remotion/player": "4.0.497",
31
- "@remotion/media-utils": "4.0.497",
32
- "@remotion/renderer": "4.0.497",
33
- "@remotion/web-renderer": "4.0.497",
34
- "@remotion/studio-shared": "4.0.497",
35
- "@remotion/timeline-utils": "4.0.497",
36
- "@remotion/zod-types": "4.0.497",
29
+ "remotion": "4.0.499",
30
+ "@remotion/canvas-capture": "4.0.499",
31
+ "@remotion/player": "4.0.499",
32
+ "@remotion/media-utils": "4.0.499",
33
+ "@remotion/renderer": "4.0.499",
34
+ "@remotion/web-renderer": "4.0.499",
35
+ "@remotion/studio-shared": "4.0.499",
36
+ "@remotion/timeline-utils": "4.0.499",
37
+ "@remotion/zod-types": "4.0.499",
37
38
  "@jridgewell/trace-mapping": "0.3.31",
38
39
  "mediabunny": "1.50.8",
39
40
  "memfs": "3.4.3",
40
41
  "open": "8.4.2",
41
- "zod": "4.3.6"
42
+ "zod": "4.4.3"
42
43
  },
43
44
  "devDependencies": {
44
45
  "react": "19.2.3",
45
46
  "react-dom": "19.2.3",
46
47
  "@types/semver": "7.5.3",
47
- "@remotion/eslint-config-internal": "4.0.497",
48
+ "@remotion/eslint-config-internal": "4.0.499",
48
49
  "eslint": "9.19.0",
49
50
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
50
51
  },
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- type WebRenderModalLicenseProps = {
3
- readonly licenseKey: string | null;
4
- readonly setLicenseKey: React.Dispatch<React.SetStateAction<string | null>>;
5
- readonly initialPublicLicenseKey: string | null;
6
- };
7
- export declare const row: React.CSSProperties;
8
- export declare const WebRenderModalLicense: React.FC<WebRenderModalLicenseProps>;
9
- export {};
@@ -1,189 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebRenderModalLicense = exports.row = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const colors_1 = require("../../helpers/colors");
7
- const Checkbox_1 = require("../Checkbox");
8
- const layout_1 = require("../layout");
9
- const RemInput_1 = require("../NewComposition/RemInput");
10
- const ValidationMessage_1 = require("../NewComposition/ValidationMessage");
11
- const WebRenderModalLicenseKeyDetails_1 = require("./WebRenderModalLicenseKeyDetails");
12
- exports.row = {
13
- display: 'flex',
14
- flexDirection: 'row',
15
- paddingLeft: 16,
16
- paddingRight: 16,
17
- };
18
- const tabContainer = {
19
- flex: 1,
20
- };
21
- const descriptionStyle = {
22
- color: colors_1.LIGHT_TEXT,
23
- fontSize: 14,
24
- fontFamily: 'sans-serif',
25
- paddingLeft: 16,
26
- paddingRight: 16,
27
- paddingTop: 16,
28
- paddingBottom: 8,
29
- lineHeight: 1.5,
30
- };
31
- const paddedDescriptionStyle = {
32
- color: colors_1.LIGHT_TEXT,
33
- fontSize: 14,
34
- fontFamily: 'sans-serif',
35
- padding: 9,
36
- border: '1px solid ' + colors_1.BLACK_ALPHA_60,
37
- borderRadius: 8,
38
- lineHeight: 1.5,
39
- marginLeft: 16,
40
- marginRight: 16,
41
- };
42
- const descriptionLink = {
43
- color: colors_1.WHITE,
44
- fontSize: 14,
45
- };
46
- const checkboxLabel = {
47
- fontSize: 14,
48
- lineHeight: '40px',
49
- color: colors_1.LIGHT_TEXT,
50
- flex: 1,
51
- fontFamily: 'sans-serif',
52
- cursor: 'pointer',
53
- userSelect: 'none',
54
- };
55
- const inputStyle = {
56
- minWidth: 250,
57
- };
58
- const justifyCenter = {
59
- display: 'flex',
60
- alignItems: 'center',
61
- gap: 10,
62
- flex: 1,
63
- };
64
- const codeStyle = {
65
- fontSize: 14,
66
- fontFamily: 'monospace',
67
- color: colors_1.BLUE,
68
- };
69
- const codeLine = {
70
- fontSize: 14,
71
- fontFamily: 'monospace',
72
- color: colors_1.LIGHT_TEXT,
73
- backgroundColor: colors_1.INPUT_BACKGROUND,
74
- padding: 6,
75
- borderRadius: 3,
76
- marginTop: 6,
77
- overflowX: 'auto',
78
- maxWidth: '100%',
79
- };
80
- const codeLineSmall = {
81
- ...codeLine,
82
- fontSize: 11,
83
- };
84
- const LICENSE_KEY_LENGTH = 55;
85
- const LICENSE_KEY_PREFIX = 'rm_pub_';
86
- const validateLicenseKey = (key) => {
87
- if (key.length === 0) {
88
- return { valid: false, message: null, details: null };
89
- }
90
- if (!key.startsWith(LICENSE_KEY_PREFIX)) {
91
- return {
92
- valid: false,
93
- message: `License key must start with "${LICENSE_KEY_PREFIX}"`,
94
- details: null,
95
- };
96
- }
97
- const afterPrefix = key.slice(LICENSE_KEY_PREFIX.length);
98
- if (!/^[a-zA-Z0-9]*$/.test(afterPrefix)) {
99
- return {
100
- valid: false,
101
- message: 'License key must contain only alphanumeric characters after the prefix',
102
- details: null,
103
- };
104
- }
105
- if (key.length !== LICENSE_KEY_LENGTH) {
106
- return {
107
- valid: false,
108
- message: `License key must be ${LICENSE_KEY_LENGTH} characters long`,
109
- details: null,
110
- };
111
- }
112
- return { valid: true, message: null, details: null };
113
- };
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]);
154
- const onFreeLicenseChange = (0, react_1.useCallback)(() => {
155
- setLicenseKey('free-license');
156
- }, [setLicenseKey]);
157
- const onCompanyLicenseChange = (0, react_1.useCallback)(() => {
158
- setLicenseKey(initialPublicLicenseKey !== null && initialPublicLicenseKey !== void 0 ? initialPublicLicenseKey : '');
159
- }, [initialPublicLicenseKey, setLicenseKey]);
160
- const onLicenseKeyChange = (0, react_1.useCallback)((e) => {
161
- setLicenseKey(e.target.value);
162
- }, [setLicenseKey]);
163
- return (jsx_runtime_1.jsxs("div", { style: tabContainer, children: [
164
- 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", ' ', jsx_runtime_1.jsx("a", { style: descriptionLink, href: "https://remotion.dev/license", children: "LICENSE.md" }),
165
- "."] }), jsx_runtime_1.jsx("div", { style: exports.row, children: jsx_runtime_1.jsxs("div", { style: justifyCenter, children: [
166
- jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: licenseKey === 'free-license', onChange: onFreeLicenseChange, name: "free-license", rounded: true }), jsx_runtime_1.jsxs("div", { style: checkboxLabel, onClick: onFreeLicenseChange, children: ["I am eligible for the Free License, ", "don't", " print a warning"] })
167
- ] }) }), licenseKey === 'free-license' ? (jsx_runtime_1.jsxs("div", { style: paddedDescriptionStyle, children: ["Enjoy Remotion! Add the following to", ' ', jsx_runtime_1.jsx("code", { style: codeStyle, children: "remotion.config.ts" }),
168
- " to persist this setting:",
169
- jsx_runtime_1.jsx("div", { style: codeLine, children: "Config.setPublicLicenseKey('free-license');" })
170
- ] })) : null, jsx_runtime_1.jsx("div", { style: exports.row, children: jsx_runtime_1.jsxs("div", { style: justifyCenter, children: [
171
- jsx_runtime_1.jsx(Checkbox_1.Checkbox, { checked: licenseKey !== 'free-license' && licenseKey !== null, onChange: onCompanyLicenseChange, name: "company-license", rounded: true }), jsx_runtime_1.jsx("div", { style: checkboxLabel, onClick: onCompanyLicenseChange, children: "I have a Company License" })
172
- ] }) }), licenseKey !== 'free-license' && licenseKey !== null ? (jsx_runtime_1.jsxs("div", { style: paddedDescriptionStyle, children: ["Add your public license key from", ' ', jsx_runtime_1.jsx("a", { href: "https://remotion.pro/dashboard", target: "_blank", style: descriptionLink, children: "remotion.pro" }), ' ', "below.",
173
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), 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
174
- ? 'ok'
175
- : 'error', rightAlign: false, style: inputStyle, autoFocus: true }), licenseValidation.message ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
176
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(ValidationMessage_1.ValidationMessage, { message: licenseValidation.message, align: "flex-start", type: "error" })
177
- ] })) : null, licenseValidation.valid && licenseKey.length > 0 ? (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
178
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }),
179
- "Add the following to", ' ', jsx_runtime_1.jsx("code", { style: codeStyle, children: "remotion.config.ts" }),
180
- " to persist this setting:",
181
- jsx_runtime_1.jsx("div", { style: codeLineSmall, children: "Config.setPublicLicenseKey('" + licenseKey + "');" })
182
- ] })) : null, isLoading && (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
183
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }),
184
- "Loading license key details..."] })), licenseValidation.details && (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
185
- jsx_runtime_1.jsx(layout_1.Spacing, { y: 1, block: true }), jsx_runtime_1.jsx(WebRenderModalLicenseKeyDetails_1.WebRenderModalLicenseKeyDetails, { details: licenseValidation.details })
186
- ] }))] })) : null, licenseKey === null ? (jsx_runtime_1.jsxs("div", { style: descriptionStyle, children: ["If you are not eligible for the free license, you need to obtain a", ' ', jsx_runtime_1.jsx("a", { style: descriptionLink, target: "_blank", href: "https://remotion.pro/license", children: "Company License" }),
187
- "."] })) : null] }));
188
- };
189
- exports.WebRenderModalLicense = WebRenderModalLicense;
@@ -1,13 +0,0 @@
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 {};
@@ -1,60 +0,0 @@
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 (jsx_runtime_1.jsxs("div", { children: [
48
- jsx_runtime_1.jsxs("div", { style: bulletStyle, children: [
49
- jsx_runtime_1.jsx(check_circle_filled_1.CheckCircleFilled, { style: { ...icon, fill: colors_1.LIGHT_TEXT } }), jsx_runtime_1.jsxs("div", { style: textStyle, children: ["Belongs to\u00A0",
50
- jsx_runtime_1.jsx("a", { href: `${PRO_HOST}/projects/${details.projectSlug}`, target: "_blank", style: linkStyle, children: details.projectName }),
51
- "\u00A0-\u00A0",
52
- jsx_runtime_1.jsx("a", { href: `${PRO_HOST}/projects/${details.projectSlug}/usage#client-renders-usage`, target: "_blank", style: linkStyle, children: "View usage" })
53
- ] })
54
- ] }), details.hasActiveSubscription ? (jsx_runtime_1.jsxs("div", { style: bulletStyle, children: [
55
- jsx_runtime_1.jsx(check_circle_filled_1.CheckCircleFilled, { style: { ...icon, fill: colors_1.LIGHT_TEXT } }), jsx_runtime_1.jsx("div", { style: textStyle, children: "Active Company License" })
56
- ] })) : (jsx_runtime_1.jsxs("div", { style: bulletStyle, children: [
57
- jsx_runtime_1.jsx(ValidationMessage_1.WarningTriangle, { type: "warning", style: { ...icon, fill: colors_1.WARNING_COLOR } }), jsx_runtime_1.jsx("div", { style: textStyle, children: "No active Company License" })
58
- ] }))] }));
59
- };
60
- exports.WebRenderModalLicenseKeyDetails = WebRenderModalLicenseKeyDetails;