batchedits 1.0.0
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/README.md +47 -0
- package/dist/chunk-3KU2EPH2.mjs +53 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8 -0
- package/dist/cli.mjs +7 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +79 -0
- package/dist/index.mjs +10 -0
- package/dist/react.d.mts +12 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.js +130 -0
- package/dist/react.mjs +61 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# `batchedits`
|
|
2
|
+
|
|
3
|
+
Official JS SDK, React Embed Widgets, and CLI for **BatchEdits AI Bulk Video Editor**.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install batchedits
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## React Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { EditWithBatchEditsButton } from 'batchedits/react';
|
|
15
|
+
|
|
16
|
+
export function App() {
|
|
17
|
+
return (
|
|
18
|
+
<EditWithBatchEditsButton
|
|
19
|
+
videoUrl="https://example.com/video.mp4"
|
|
20
|
+
webhookUrl="https://example.com/api/webhooks/batchedits"
|
|
21
|
+
theme="gradient"
|
|
22
|
+
mode="popup"
|
|
23
|
+
onComplete={(data) => console.log('Edited video:', data.editedVideoUrl)}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Vanilla JavaScript Usage
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
import { openModal } from 'batchedits';
|
|
33
|
+
|
|
34
|
+
openModal({
|
|
35
|
+
videoUrl: 'https://example.com/video.mp4',
|
|
36
|
+
mode: 'popup',
|
|
37
|
+
onComplete: (data) => {
|
|
38
|
+
console.log('Video editing complete!', data.editedVideoUrl);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## CLI Usage
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx batchedits --help
|
|
47
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
var DEFAULT_HOST = "https://batchedits.com";
|
|
3
|
+
function buildEmbedUrl(options = {}) {
|
|
4
|
+
const host = options.host || DEFAULT_HOST;
|
|
5
|
+
const params = new URLSearchParams();
|
|
6
|
+
if (options.videoUrl) params.set("video_url", options.videoUrl);
|
|
7
|
+
if (options.styleId) params.set("style_id", options.styleId);
|
|
8
|
+
if (options.webhookUrl) params.set("webhook_url", options.webhookUrl);
|
|
9
|
+
if (options.mode) params.set("embed_mode", options.mode);
|
|
10
|
+
if (options.widgetType) params.set("widget_type", options.widgetType || "edit_button");
|
|
11
|
+
if (options.callbackUrl) params.set("callback_url", options.callbackUrl);
|
|
12
|
+
if (options.autoProcess) params.set("auto_process", "true");
|
|
13
|
+
const route = options.mode === "redirect" ? "/dashboard/edit" : "/embed/edit";
|
|
14
|
+
return `${host}${route}?${params.toString()}`;
|
|
15
|
+
}
|
|
16
|
+
function openModal(options = {}) {
|
|
17
|
+
const mode = options.mode || "popup";
|
|
18
|
+
const url = buildEmbedUrl(options);
|
|
19
|
+
if (mode === "redirect") {
|
|
20
|
+
if (typeof window !== "undefined") window.location.href = url;
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
if (mode === "popup" && typeof window !== "undefined") {
|
|
24
|
+
const width = 1150;
|
|
25
|
+
const height = 780;
|
|
26
|
+
const left = Math.max(0, (window.screen.width - width) / 2);
|
|
27
|
+
const top = Math.max(0, (window.screen.height - height) / 2);
|
|
28
|
+
const popup = window.open(
|
|
29
|
+
url,
|
|
30
|
+
"BatchEditsWindow",
|
|
31
|
+
`width=${width},height=${height},top=${top},left=${left},resizable=yes,scrollbars=yes`
|
|
32
|
+
);
|
|
33
|
+
const handleMessage = (e) => {
|
|
34
|
+
if (e.data && typeof e.data === "object" && e.data.type === "BATCHEDITS_EDIT_COMPLETE") {
|
|
35
|
+
if (typeof options.onComplete === "function") options.onComplete(e.data);
|
|
36
|
+
window.removeEventListener("message", handleMessage);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
window.addEventListener("message", handleMessage);
|
|
40
|
+
if (popup && popup.focus) popup.focus();
|
|
41
|
+
return popup;
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function init() {
|
|
46
|
+
console.log("BatchEdits SDK Initialized.");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
buildEmbedUrl,
|
|
51
|
+
openModal,
|
|
52
|
+
init
|
|
53
|
+
};
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// src/cli.ts
|
|
5
|
+
console.log("\u{1F680} BatchEdits CLI v1.0.0");
|
|
6
|
+
console.log("Commands available:");
|
|
7
|
+
console.log(" batchedits edit <videoUrl> - Launch BatchEdits CLI video editor");
|
|
8
|
+
console.log(" batchedits init - Generate BatchEdits config");
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
console.log("\u{1F680} BatchEdits CLI v1.0.0");
|
|
5
|
+
console.log("Commands available:");
|
|
6
|
+
console.log(" batchedits edit <videoUrl> - Launch BatchEdits CLI video editor");
|
|
7
|
+
console.log(" batchedits init - Generate BatchEdits config");
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface BatchEditsModalOptions {
|
|
2
|
+
videoUrl?: string;
|
|
3
|
+
styleId?: string;
|
|
4
|
+
webhookUrl?: string;
|
|
5
|
+
mode?: "popup" | "iframe" | "redirect";
|
|
6
|
+
widgetType?: string;
|
|
7
|
+
host?: string;
|
|
8
|
+
callbackUrl?: string;
|
|
9
|
+
autoProcess?: boolean;
|
|
10
|
+
onComplete?: (data: any) => void;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare function buildEmbedUrl(options?: BatchEditsModalOptions): string;
|
|
14
|
+
declare function openModal(options?: BatchEditsModalOptions): Window | null;
|
|
15
|
+
declare function init(): void;
|
|
16
|
+
|
|
17
|
+
export { type BatchEditsModalOptions, buildEmbedUrl, init, openModal };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface BatchEditsModalOptions {
|
|
2
|
+
videoUrl?: string;
|
|
3
|
+
styleId?: string;
|
|
4
|
+
webhookUrl?: string;
|
|
5
|
+
mode?: "popup" | "iframe" | "redirect";
|
|
6
|
+
widgetType?: string;
|
|
7
|
+
host?: string;
|
|
8
|
+
callbackUrl?: string;
|
|
9
|
+
autoProcess?: boolean;
|
|
10
|
+
onComplete?: (data: any) => void;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare function buildEmbedUrl(options?: BatchEditsModalOptions): string;
|
|
14
|
+
declare function openModal(options?: BatchEditsModalOptions): Window | null;
|
|
15
|
+
declare function init(): void;
|
|
16
|
+
|
|
17
|
+
export { type BatchEditsModalOptions, buildEmbedUrl, init, openModal };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
buildEmbedUrl: () => buildEmbedUrl,
|
|
24
|
+
init: () => init,
|
|
25
|
+
openModal: () => openModal
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
var DEFAULT_HOST = "https://batchedits.com";
|
|
29
|
+
function buildEmbedUrl(options = {}) {
|
|
30
|
+
const host = options.host || DEFAULT_HOST;
|
|
31
|
+
const params = new URLSearchParams();
|
|
32
|
+
if (options.videoUrl) params.set("video_url", options.videoUrl);
|
|
33
|
+
if (options.styleId) params.set("style_id", options.styleId);
|
|
34
|
+
if (options.webhookUrl) params.set("webhook_url", options.webhookUrl);
|
|
35
|
+
if (options.mode) params.set("embed_mode", options.mode);
|
|
36
|
+
if (options.widgetType) params.set("widget_type", options.widgetType || "edit_button");
|
|
37
|
+
if (options.callbackUrl) params.set("callback_url", options.callbackUrl);
|
|
38
|
+
if (options.autoProcess) params.set("auto_process", "true");
|
|
39
|
+
const route = options.mode === "redirect" ? "/dashboard/edit" : "/embed/edit";
|
|
40
|
+
return `${host}${route}?${params.toString()}`;
|
|
41
|
+
}
|
|
42
|
+
function openModal(options = {}) {
|
|
43
|
+
const mode = options.mode || "popup";
|
|
44
|
+
const url = buildEmbedUrl(options);
|
|
45
|
+
if (mode === "redirect") {
|
|
46
|
+
if (typeof window !== "undefined") window.location.href = url;
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
if (mode === "popup" && typeof window !== "undefined") {
|
|
50
|
+
const width = 1150;
|
|
51
|
+
const height = 780;
|
|
52
|
+
const left = Math.max(0, (window.screen.width - width) / 2);
|
|
53
|
+
const top = Math.max(0, (window.screen.height - height) / 2);
|
|
54
|
+
const popup = window.open(
|
|
55
|
+
url,
|
|
56
|
+
"BatchEditsWindow",
|
|
57
|
+
`width=${width},height=${height},top=${top},left=${left},resizable=yes,scrollbars=yes`
|
|
58
|
+
);
|
|
59
|
+
const handleMessage = (e) => {
|
|
60
|
+
if (e.data && typeof e.data === "object" && e.data.type === "BATCHEDITS_EDIT_COMPLETE") {
|
|
61
|
+
if (typeof options.onComplete === "function") options.onComplete(e.data);
|
|
62
|
+
window.removeEventListener("message", handleMessage);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
window.addEventListener("message", handleMessage);
|
|
66
|
+
if (popup && popup.focus) popup.focus();
|
|
67
|
+
return popup;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
function init() {
|
|
72
|
+
console.log("BatchEdits SDK Initialized.");
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
buildEmbedUrl,
|
|
77
|
+
init,
|
|
78
|
+
openModal
|
|
79
|
+
});
|
package/dist/index.mjs
ADDED
package/dist/react.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BatchEditsModalOptions } from './index.mjs';
|
|
3
|
+
|
|
4
|
+
interface EditWithBatchEditsButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, BatchEditsModalOptions {
|
|
5
|
+
text?: string;
|
|
6
|
+
theme?: "dark" | "light" | "gradient" | "minimal";
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
}
|
|
9
|
+
declare function EditWithBatchEditsButton({ videoUrl, styleId, webhookUrl, mode, theme, size, text, host, onComplete, onClose, className, onClick, ...props }: EditWithBatchEditsButtonProps): React.JSX.Element;
|
|
10
|
+
declare const BatchEditsButton: typeof EditWithBatchEditsButton;
|
|
11
|
+
|
|
12
|
+
export { BatchEditsButton, EditWithBatchEditsButton, type EditWithBatchEditsButtonProps };
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BatchEditsModalOptions } from './index.js';
|
|
3
|
+
|
|
4
|
+
interface EditWithBatchEditsButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, BatchEditsModalOptions {
|
|
5
|
+
text?: string;
|
|
6
|
+
theme?: "dark" | "light" | "gradient" | "minimal";
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
}
|
|
9
|
+
declare function EditWithBatchEditsButton({ videoUrl, styleId, webhookUrl, mode, theme, size, text, host, onComplete, onClose, className, onClick, ...props }: EditWithBatchEditsButtonProps): React.JSX.Element;
|
|
10
|
+
declare const BatchEditsButton: typeof EditWithBatchEditsButton;
|
|
11
|
+
|
|
12
|
+
export { BatchEditsButton, EditWithBatchEditsButton, type EditWithBatchEditsButtonProps };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/react.tsx
|
|
21
|
+
var react_exports = {};
|
|
22
|
+
__export(react_exports, {
|
|
23
|
+
BatchEditsButton: () => BatchEditsButton,
|
|
24
|
+
EditWithBatchEditsButton: () => EditWithBatchEditsButton
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(react_exports);
|
|
27
|
+
|
|
28
|
+
// src/index.ts
|
|
29
|
+
var DEFAULT_HOST = "https://batchedits.com";
|
|
30
|
+
function buildEmbedUrl(options = {}) {
|
|
31
|
+
const host = options.host || DEFAULT_HOST;
|
|
32
|
+
const params = new URLSearchParams();
|
|
33
|
+
if (options.videoUrl) params.set("video_url", options.videoUrl);
|
|
34
|
+
if (options.styleId) params.set("style_id", options.styleId);
|
|
35
|
+
if (options.webhookUrl) params.set("webhook_url", options.webhookUrl);
|
|
36
|
+
if (options.mode) params.set("embed_mode", options.mode);
|
|
37
|
+
if (options.widgetType) params.set("widget_type", options.widgetType || "edit_button");
|
|
38
|
+
if (options.callbackUrl) params.set("callback_url", options.callbackUrl);
|
|
39
|
+
if (options.autoProcess) params.set("auto_process", "true");
|
|
40
|
+
const route = options.mode === "redirect" ? "/dashboard/edit" : "/embed/edit";
|
|
41
|
+
return `${host}${route}?${params.toString()}`;
|
|
42
|
+
}
|
|
43
|
+
function openModal(options = {}) {
|
|
44
|
+
const mode = options.mode || "popup";
|
|
45
|
+
const url = buildEmbedUrl(options);
|
|
46
|
+
if (mode === "redirect") {
|
|
47
|
+
if (typeof window !== "undefined") window.location.href = url;
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (mode === "popup" && typeof window !== "undefined") {
|
|
51
|
+
const width = 1150;
|
|
52
|
+
const height = 780;
|
|
53
|
+
const left = Math.max(0, (window.screen.width - width) / 2);
|
|
54
|
+
const top = Math.max(0, (window.screen.height - height) / 2);
|
|
55
|
+
const popup = window.open(
|
|
56
|
+
url,
|
|
57
|
+
"BatchEditsWindow",
|
|
58
|
+
`width=${width},height=${height},top=${top},left=${left},resizable=yes,scrollbars=yes`
|
|
59
|
+
);
|
|
60
|
+
const handleMessage = (e) => {
|
|
61
|
+
if (e.data && typeof e.data === "object" && e.data.type === "BATCHEDITS_EDIT_COMPLETE") {
|
|
62
|
+
if (typeof options.onComplete === "function") options.onComplete(e.data);
|
|
63
|
+
window.removeEventListener("message", handleMessage);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
window.addEventListener("message", handleMessage);
|
|
67
|
+
if (popup && popup.focus) popup.focus();
|
|
68
|
+
return popup;
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/react.tsx
|
|
74
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
75
|
+
function EditWithBatchEditsButton({
|
|
76
|
+
videoUrl,
|
|
77
|
+
styleId,
|
|
78
|
+
webhookUrl,
|
|
79
|
+
mode = "popup",
|
|
80
|
+
theme = "dark",
|
|
81
|
+
size = "md",
|
|
82
|
+
text = "Edit with BatchEdits",
|
|
83
|
+
host = "https://batchedits.com",
|
|
84
|
+
onComplete,
|
|
85
|
+
onClose,
|
|
86
|
+
className,
|
|
87
|
+
onClick,
|
|
88
|
+
...props
|
|
89
|
+
}) {
|
|
90
|
+
const handleClick = (e) => {
|
|
91
|
+
if (onClick) onClick(e);
|
|
92
|
+
if (e.defaultPrevented) return;
|
|
93
|
+
openModal({
|
|
94
|
+
videoUrl,
|
|
95
|
+
styleId,
|
|
96
|
+
webhookUrl,
|
|
97
|
+
mode,
|
|
98
|
+
host,
|
|
99
|
+
onComplete,
|
|
100
|
+
onClose
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
const sizeClasses = {
|
|
104
|
+
sm: "padding: 6px 12px; font-size: 12px; gap: 6px; border-radius: 6px;",
|
|
105
|
+
md: "padding: 9px 18px; font-size: 14px; gap: 8px; border-radius: 8px;",
|
|
106
|
+
lg: "padding: 12px 24px; font-size: 16px; gap: 10px; border-radius: 12px;"
|
|
107
|
+
};
|
|
108
|
+
const themeStyle = theme === "light" ? "background:#ffffff;color:#09090b;border:1px solid #e4e4e7;" : theme === "gradient" ? "background:linear-gradient(135deg,#f97316 0%,#ea580c 50%,#eab308 100%);color:#ffffff;border:none;" : theme === "minimal" ? "background:transparent;color:currentColor;border:1px solid currentColor;" : "background:#18181b;color:#ffffff;border:1px solid rgba(255,255,255,0.15);";
|
|
109
|
+
const defaultCss = "display:inline-flex;align-items:center;justify-content:center;font-family:-apple-system,BlinkMacSystemFont,sans-serif;font-weight:600;cursor:pointer;user-select:none;box-shadow:0 2px 4px rgba(0,0,0,0.1);transition:transform 0.15s ease;";
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
type: "button",
|
|
114
|
+
onClick: handleClick,
|
|
115
|
+
style: { cssText: `${defaultCss} ${themeStyle} ${sizeClasses[size]}` },
|
|
116
|
+
className,
|
|
117
|
+
...props,
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z" }) }),
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
var BatchEditsButton = EditWithBatchEditsButton;
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
BatchEditsButton,
|
|
129
|
+
EditWithBatchEditsButton
|
|
130
|
+
});
|
package/dist/react.mjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
openModal
|
|
3
|
+
} from "./chunk-3KU2EPH2.mjs";
|
|
4
|
+
|
|
5
|
+
// src/react.tsx
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
function EditWithBatchEditsButton({
|
|
8
|
+
videoUrl,
|
|
9
|
+
styleId,
|
|
10
|
+
webhookUrl,
|
|
11
|
+
mode = "popup",
|
|
12
|
+
theme = "dark",
|
|
13
|
+
size = "md",
|
|
14
|
+
text = "Edit with BatchEdits",
|
|
15
|
+
host = "https://batchedits.com",
|
|
16
|
+
onComplete,
|
|
17
|
+
onClose,
|
|
18
|
+
className,
|
|
19
|
+
onClick,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const handleClick = (e) => {
|
|
23
|
+
if (onClick) onClick(e);
|
|
24
|
+
if (e.defaultPrevented) return;
|
|
25
|
+
openModal({
|
|
26
|
+
videoUrl,
|
|
27
|
+
styleId,
|
|
28
|
+
webhookUrl,
|
|
29
|
+
mode,
|
|
30
|
+
host,
|
|
31
|
+
onComplete,
|
|
32
|
+
onClose
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const sizeClasses = {
|
|
36
|
+
sm: "padding: 6px 12px; font-size: 12px; gap: 6px; border-radius: 6px;",
|
|
37
|
+
md: "padding: 9px 18px; font-size: 14px; gap: 8px; border-radius: 8px;",
|
|
38
|
+
lg: "padding: 12px 24px; font-size: 16px; gap: 10px; border-radius: 12px;"
|
|
39
|
+
};
|
|
40
|
+
const themeStyle = theme === "light" ? "background:#ffffff;color:#09090b;border:1px solid #e4e4e7;" : theme === "gradient" ? "background:linear-gradient(135deg,#f97316 0%,#ea580c 50%,#eab308 100%);color:#ffffff;border:none;" : theme === "minimal" ? "background:transparent;color:currentColor;border:1px solid currentColor;" : "background:#18181b;color:#ffffff;border:1px solid rgba(255,255,255,0.15);";
|
|
41
|
+
const defaultCss = "display:inline-flex;align-items:center;justify-content:center;font-family:-apple-system,BlinkMacSystemFont,sans-serif;font-weight:600;cursor:pointer;user-select:none;box-shadow:0 2px 4px rgba(0,0,0,0.1);transition:transform 0.15s ease;";
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
onClick: handleClick,
|
|
47
|
+
style: { cssText: `${defaultCss} ${themeStyle} ${sizeClasses[size]}` },
|
|
48
|
+
className,
|
|
49
|
+
...props,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z" }) }),
|
|
52
|
+
/* @__PURE__ */ jsx("span", { children: text })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
var BatchEditsButton = EditWithBatchEditsButton;
|
|
58
|
+
export {
|
|
59
|
+
BatchEditsButton,
|
|
60
|
+
EditWithBatchEditsButton
|
|
61
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "batchedits",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official SDK, React Embed Widgets, and CLI for BatchEdits AI Bulk Video Editor",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"batchedits": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./react": {
|
|
18
|
+
"types": "./dist/react.d.ts",
|
|
19
|
+
"import": "./dist/react.mjs",
|
|
20
|
+
"require": "./dist/react.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsup src/index.ts src/react.tsx src/cli.ts --format cjs,esm --dts --clean",
|
|
28
|
+
"prepublishOnly": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"batchedits",
|
|
32
|
+
"video-editor",
|
|
33
|
+
"auto-captions",
|
|
34
|
+
"react-widget",
|
|
35
|
+
"embed",
|
|
36
|
+
"cli"
|
|
37
|
+
],
|
|
38
|
+
"author": "BatchEdits",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"react": ">=16.8.0",
|
|
42
|
+
"react-dom": ">=16.8.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"react": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"react-dom": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/react": "^18.0.0",
|
|
54
|
+
"tsup": "^8.0.0",
|
|
55
|
+
"typescript": "^5.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|