ugcinc 4.1.0 → 4.1.1
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/automations/nodes/account.d.ts +3 -15
- package/dist/automations/nodes/account.js +1 -2
- package/dist/automations/nodes/auto-caption.d.ts +21 -62
- package/dist/automations/nodes/auto-caption.js +16 -13
- package/dist/automations/nodes/auto-post.d.ts +9 -68
- package/dist/automations/nodes/auto-post.js +4 -6
- package/dist/automations/nodes/branch.d.ts +9 -46
- package/dist/automations/nodes/branch.js +1 -5
- package/dist/automations/nodes/collect.d.ts +5 -14
- package/dist/automations/nodes/collect.js +4 -9
- package/dist/automations/nodes/compose-workflow.d.ts +2 -15
- package/dist/automations/nodes/compose-workflow.js +33 -14
- package/dist/automations/nodes/create-dm.d.ts +18 -79
- package/dist/automations/nodes/create-dm.js +28 -30
- package/dist/automations/nodes/custom-model.d.ts +3 -4
- package/dist/automations/nodes/deduplicate.d.ts +1 -2
- package/dist/automations/nodes/destructure.d.ts +3 -3
- package/dist/automations/nodes/destructure.js +1 -1
- package/dist/automations/nodes/for-each.d.ts +1 -2
- package/dist/automations/nodes/generate-image.d.ts +1 -2
- package/dist/automations/nodes/generate-video.d.ts +1 -2
- package/dist/automations/nodes/if.d.ts +1 -2
- package/dist/automations/nodes/image-composer.d.ts +34 -21
- package/dist/automations/nodes/image-composer.js +40 -0
- package/dist/automations/nodes/index.d.ts +299 -7
- package/dist/automations/nodes/index.js +6 -7
- package/dist/automations/nodes/internal.d.ts +8 -0
- package/dist/automations/nodes/internal.js +10 -0
- package/dist/automations/nodes/llm.d.ts +1 -2
- package/dist/automations/nodes/manual-trigger.d.ts +9 -29
- package/dist/automations/nodes/manual-trigger.js +1 -1
- package/dist/automations/nodes/media.d.ts +3 -7
- package/dist/automations/nodes/not.d.ts +1 -2
- package/dist/automations/nodes/output.d.ts +3 -17
- package/dist/automations/nodes/random-route.d.ts +3 -31
- package/dist/automations/nodes/random-route.js +5 -5
- package/dist/automations/nodes/random.d.ts +3 -3
- package/dist/automations/nodes/random.js +3 -3
- package/dist/automations/nodes/recurrence.d.ts +3 -43
- package/dist/automations/nodes/recurrence.js +1 -1
- package/dist/automations/nodes/save-to-media.d.ts +3 -20
- package/dist/automations/nodes/save-to-media.js +1 -1
- package/dist/automations/nodes/screenshot-animation.d.ts +1 -2
- package/dist/automations/nodes/social-audio.d.ts +1 -2
- package/dist/automations/nodes/text.d.ts +1 -2
- package/dist/automations/nodes/transcript.d.ts +1 -2
- package/dist/automations/nodes/types.d.ts +44 -20
- package/dist/automations/nodes/types.js +1 -1
- package/dist/automations/nodes/video-composer.d.ts +1 -10
- package/dist/automations/nodes/video-composer.js +65 -19
- package/dist/automations/nodes/video-import.d.ts +1 -19
- package/dist/automations/nodes/video-import.js +2 -16
- package/dist/automations/types.d.ts +45 -158
- package/dist/automations/types.js +4 -76
- package/dist/graph-controller.d.ts +28 -11
- package/dist/graph-controller.js +53 -20
- package/dist/index.d.ts +7 -23
- package/dist/index.js +5 -2
- package/dist/render/compositions/IMessageDmComposition/types.d.ts +6 -6
- package/dist/render/compositions/ImageEditorComposition.js +2 -8
- package/dist/render/compositions/VideoEditorComposition.js +2 -24
- package/dist/render/types/element.d.ts +0 -33
- package/dist/render/types/index.d.ts +1 -1
- package/dist/render.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,96 +1,35 @@
|
|
|
1
|
+
import { type InputType } from './types';
|
|
1
2
|
type DmPlatform = 'imessage' | 'instagram';
|
|
2
|
-
/**
|
|
3
|
-
* Message in a Create DM conversation
|
|
4
|
-
*/
|
|
5
3
|
export interface CreateDmMessage {
|
|
6
|
-
/** Who sent this message */
|
|
7
4
|
sender: 'user' | 'recipient';
|
|
8
|
-
/** Message text content */
|
|
9
5
|
text: string;
|
|
10
|
-
/** Whether this message has an associated image (story reply for IG, sender image for iMessage) */
|
|
11
6
|
hasImage?: boolean;
|
|
12
7
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Create DM node configuration - renders fake DM conversations for iMessage or Instagram
|
|
15
|
-
*/
|
|
16
|
-
export interface CreateDmNodeConfig {
|
|
17
|
-
/** Platform to render */
|
|
18
|
-
platform: 'imessage' | 'instagram';
|
|
19
|
-
/** Whether platform comes from input port */
|
|
20
|
-
platformIsVariable?: boolean;
|
|
21
|
-
/** Light or dark mode */
|
|
22
|
-
lightMode: boolean;
|
|
23
|
-
/** Whether light mode comes from input port */
|
|
24
|
-
lightModeIsVariable?: boolean;
|
|
25
|
-
/** Username displayed in header */
|
|
26
|
-
username: string;
|
|
27
|
-
/** Whether username comes from input port */
|
|
28
|
-
usernameIsVariable?: boolean;
|
|
29
|
-
/** Status bar time */
|
|
30
|
-
time: string;
|
|
31
|
-
/** Whether status bar time comes from input port */
|
|
32
|
-
timeIsVariable?: boolean;
|
|
33
|
-
/** Profile picture URL (fallback if profilePic input not connected) */
|
|
34
|
-
profilePicUrl?: string;
|
|
35
|
-
/** Whether profile pic comes from input port */
|
|
36
|
-
profilePicIsVariable?: boolean;
|
|
37
|
-
/** Whether messages come from input port */
|
|
38
|
-
messagesIsVariable?: boolean;
|
|
39
|
-
/** Static messages (used when messagesIsVariable is false) */
|
|
40
|
-
messages?: CreateDmMessage[];
|
|
41
|
-
/** Image attachment URL (story reply for IG, sender image for iMessage) */
|
|
42
|
-
imageAttachmentUrl?: string;
|
|
43
|
-
/** Whether image attachment comes from input port */
|
|
44
|
-
imageAttachmentIsVariable?: boolean;
|
|
45
|
-
/** iMessage-specific settings */
|
|
46
|
-
imessage?: {
|
|
47
|
-
senderBubbleColor?: string;
|
|
48
|
-
showReadReceipt: boolean;
|
|
49
|
-
readReceiptText: string;
|
|
50
|
-
/** Whether read receipt time comes from input port */
|
|
51
|
-
readReceiptTimeIsVariable?: boolean;
|
|
52
|
-
unreadBadgeText: string;
|
|
53
|
-
/** Whether unread badge comes from input port */
|
|
54
|
-
unreadBadgeIsVariable?: boolean;
|
|
55
|
-
messageHeaderTimestampText: string;
|
|
56
|
-
/** Whether message header time comes from input port */
|
|
57
|
-
messageHeaderTimeIsVariable?: boolean;
|
|
58
|
-
};
|
|
59
|
-
/** Instagram-specific settings */
|
|
60
|
-
instagram?: {
|
|
61
|
-
userHasStory: boolean;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
8
|
declare const definition: import("./types").NodeDefinition<"generator", {
|
|
65
9
|
platform: DmPlatform;
|
|
66
|
-
|
|
10
|
+
platformInputType: InputType;
|
|
67
11
|
lightMode: boolean;
|
|
68
|
-
|
|
12
|
+
lightModeInputType: InputType;
|
|
69
13
|
username: string;
|
|
70
|
-
|
|
14
|
+
usernameInputType: InputType;
|
|
71
15
|
time: string;
|
|
72
|
-
|
|
16
|
+
timeInputType: InputType;
|
|
73
17
|
profilePicUrl: string;
|
|
74
|
-
|
|
75
|
-
messagesIsVariable: boolean;
|
|
18
|
+
profilePicInputType: InputType;
|
|
76
19
|
messages: CreateDmMessage[];
|
|
20
|
+
messagesInputType: InputType;
|
|
77
21
|
imageAttachmentUrl: string | undefined;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
89
|
-
instagram: {
|
|
90
|
-
userHasStory: boolean;
|
|
91
|
-
};
|
|
22
|
+
imageAttachmentInputType: InputType;
|
|
23
|
+
imessageSenderBubbleColor: string | undefined;
|
|
24
|
+
imessageShowReadReceipt: boolean;
|
|
25
|
+
imessageReadReceiptText: string;
|
|
26
|
+
imessageReadReceiptTimeInputType: InputType;
|
|
27
|
+
imessageUnreadBadgeText: string;
|
|
28
|
+
imessageUnreadBadgeInputType: InputType;
|
|
29
|
+
imessageMessageHeaderTimestampText: string;
|
|
30
|
+
imessageMessageHeaderTimeInputType: InputType;
|
|
31
|
+
instagramUserHasStory: boolean;
|
|
92
32
|
outputMode: "per-input";
|
|
93
33
|
selectionMode: null;
|
|
94
|
-
}>;
|
|
34
|
+
}, false>;
|
|
95
35
|
export default definition;
|
|
96
|
-
export type CreateDmConfig = typeof definition.defaults;
|
|
@@ -11,71 +11,69 @@ const definition = (0, types_1.defineNode)({
|
|
|
11
11
|
selectionModes: null,
|
|
12
12
|
defaults: {
|
|
13
13
|
platform: 'instagram',
|
|
14
|
-
|
|
14
|
+
platformInputType: 'static',
|
|
15
15
|
lightMode: true,
|
|
16
|
-
|
|
16
|
+
lightModeInputType: 'static',
|
|
17
17
|
username: '',
|
|
18
|
-
|
|
18
|
+
usernameInputType: 'static',
|
|
19
19
|
time: '9:41',
|
|
20
|
-
|
|
20
|
+
timeInputType: 'static',
|
|
21
21
|
profilePicUrl: 'https://ugcinc.co/logo.png',
|
|
22
|
-
|
|
23
|
-
messagesIsVariable: false,
|
|
22
|
+
profilePicInputType: 'static',
|
|
24
23
|
messages: [
|
|
25
24
|
{ sender: 'user', text: 'Wow, this dm automation is realistic right 🤯' },
|
|
26
25
|
{ sender: 'recipient', text: "I know, it's like we're really in imessage" },
|
|
27
26
|
{ sender: 'recipient', text: 'Just be thankful we\'re not on android 😭😭😭' },
|
|
28
27
|
],
|
|
28
|
+
messagesInputType: 'static',
|
|
29
29
|
imageAttachmentUrl: undefined,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
userHasStory: false,
|
|
43
|
-
},
|
|
30
|
+
imageAttachmentInputType: 'static',
|
|
31
|
+
// iMessage-specific
|
|
32
|
+
imessageSenderBubbleColor: undefined,
|
|
33
|
+
imessageShowReadReceipt: false,
|
|
34
|
+
imessageReadReceiptText: 'Read',
|
|
35
|
+
imessageReadReceiptTimeInputType: 'static',
|
|
36
|
+
imessageUnreadBadgeText: '67',
|
|
37
|
+
imessageUnreadBadgeInputType: 'static',
|
|
38
|
+
imessageMessageHeaderTimestampText: '',
|
|
39
|
+
imessageMessageHeaderTimeInputType: 'static',
|
|
40
|
+
// Instagram-specific
|
|
41
|
+
instagramUserHasStory: false,
|
|
44
42
|
outputMode: 'per-input',
|
|
45
43
|
selectionMode: null,
|
|
46
44
|
},
|
|
47
45
|
computePorts: ({ config }) => {
|
|
48
46
|
const inputs = [];
|
|
49
|
-
if (config?.
|
|
47
|
+
if (config?.platformInputType === 'variable') {
|
|
50
48
|
inputs.push({ id: 'platform', type: 'text', isArray: false, required: true });
|
|
51
49
|
}
|
|
52
|
-
if (config?.
|
|
50
|
+
if (config?.lightModeInputType === 'variable') {
|
|
53
51
|
inputs.push({ id: 'light-mode', type: 'boolean', isArray: false, required: false });
|
|
54
52
|
}
|
|
55
|
-
if (config?.
|
|
53
|
+
if (config?.usernameInputType === 'variable') {
|
|
56
54
|
inputs.push({ id: 'username', type: 'text', isArray: false, required: true });
|
|
57
55
|
}
|
|
58
|
-
if (config?.
|
|
56
|
+
if (config?.timeInputType === 'variable') {
|
|
59
57
|
inputs.push({ id: 'time', type: 'text', isArray: false, required: false });
|
|
60
58
|
}
|
|
61
|
-
if (config?.
|
|
59
|
+
if (config?.profilePicInputType === 'variable') {
|
|
62
60
|
inputs.push({ id: 'profile-pic', type: 'image', isArray: false, required: false });
|
|
63
61
|
}
|
|
64
|
-
if (config?.
|
|
62
|
+
if (config?.messagesInputType === 'variable') {
|
|
65
63
|
inputs.push({ id: 'messages', type: 'object', isArray: true, required: true });
|
|
66
64
|
}
|
|
67
|
-
if (config?.
|
|
65
|
+
if (config?.imageAttachmentInputType === 'variable') {
|
|
68
66
|
inputs.push({ id: 'image-attachment', type: 'image', isArray: false, required: false });
|
|
69
67
|
}
|
|
70
68
|
// iMessage-specific
|
|
71
69
|
if (config?.platform === 'imessage') {
|
|
72
|
-
if (config.
|
|
70
|
+
if (config.imessageShowReadReceipt && config.imessageReadReceiptTimeInputType === 'variable') {
|
|
73
71
|
inputs.push({ id: 'read-receipt-time', type: 'text', isArray: false, required: false });
|
|
74
72
|
}
|
|
75
|
-
if (config.
|
|
73
|
+
if (config.imessageUnreadBadgeInputType === 'variable') {
|
|
76
74
|
inputs.push({ id: 'unread-badge', type: 'text', isArray: false, required: false });
|
|
77
75
|
}
|
|
78
|
-
if (config.
|
|
76
|
+
if (config.imessageMessageHeaderTimeInputType === 'variable') {
|
|
79
77
|
inputs.push({ id: 'message-header-time', type: 'text', isArray: false, required: false });
|
|
80
78
|
}
|
|
81
79
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
type CustomModelOutputType = 'image' | 'video' | 'audio';
|
|
2
|
-
interface CustomModelInputParam {
|
|
1
|
+
export type CustomModelOutputType = 'image' | 'video' | 'audio';
|
|
2
|
+
export interface CustomModelInputParam {
|
|
3
3
|
name: string;
|
|
4
4
|
type: string;
|
|
5
5
|
required: boolean;
|
|
@@ -14,6 +14,5 @@ declare const definition: import("./types").NodeDefinition<"generator", {
|
|
|
14
14
|
apiKey: string | undefined;
|
|
15
15
|
outputMode: "per-input";
|
|
16
16
|
selectionMode: null;
|
|
17
|
-
}>;
|
|
17
|
+
}, false>;
|
|
18
18
|
export default definition;
|
|
19
|
-
export type CustomModelConfig = typeof definition.defaults;
|
|
@@ -3,6 +3,5 @@ declare const definition: import("./types").NodeDefinition<"generator", {
|
|
|
3
3
|
deduplication: DeduplicationLevel;
|
|
4
4
|
outputMode: "per-input";
|
|
5
5
|
selectionMode: null;
|
|
6
|
-
}>;
|
|
6
|
+
}, false>;
|
|
7
7
|
export default definition;
|
|
8
|
-
export type DeduplicateConfig = typeof definition.defaults;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type InputType } from './types';
|
|
1
2
|
type IndexExpression = {
|
|
2
3
|
type: 'single';
|
|
3
4
|
index: number;
|
|
@@ -12,14 +13,13 @@ type IndexExpression = {
|
|
|
12
13
|
interface DestructureSelection {
|
|
13
14
|
portId: string;
|
|
14
15
|
indexExpr: IndexExpression;
|
|
15
|
-
|
|
16
|
+
inputType?: InputType;
|
|
16
17
|
propertyPath?: string;
|
|
17
18
|
}
|
|
18
19
|
declare const definition: import("./types").NodeDefinition<"generator", {
|
|
19
20
|
selections: DestructureSelection[];
|
|
20
21
|
outputMode: "per-input";
|
|
21
22
|
selectionMode: null;
|
|
22
|
-
}>;
|
|
23
|
+
}, false>;
|
|
23
24
|
export default definition;
|
|
24
25
|
export type { DestructureSelection, IndexExpression };
|
|
25
|
-
export type DestructureConfig = typeof definition.defaults;
|
|
@@ -40,7 +40,7 @@ const definition = (0, types_1.defineNode)({
|
|
|
40
40
|
}
|
|
41
41
|
for (const selection of selections) {
|
|
42
42
|
// If variable, add input port for index expression
|
|
43
|
-
if (selection.
|
|
43
|
+
if (selection.inputType === 'variable') {
|
|
44
44
|
inputs.push({
|
|
45
45
|
id: `idx-${selection.portId}`,
|
|
46
46
|
type: 'text',
|
|
@@ -17,7 +17,6 @@ declare const definition: import("./types").NodeDefinition<"generator", {
|
|
|
17
17
|
exposeIndex: boolean;
|
|
18
18
|
outputMode: "per-input";
|
|
19
19
|
selectionMode: null;
|
|
20
|
-
}>;
|
|
20
|
+
}, false>;
|
|
21
21
|
export default definition;
|
|
22
22
|
export type { ForEachOutputProperty, ForEachInputPort };
|
|
23
|
-
export type ForEachConfig = typeof definition.defaults;
|
|
@@ -9,8 +9,7 @@ declare const definition: import("./types").NodeDefinition<"generator", {
|
|
|
9
9
|
apiKey: string | undefined;
|
|
10
10
|
outputMode: "per-input";
|
|
11
11
|
selectionMode: null;
|
|
12
|
-
}>;
|
|
12
|
+
}, false>;
|
|
13
13
|
export default definition;
|
|
14
14
|
export { isEditModel };
|
|
15
15
|
export type { ImageGenerationTextModel, ImageGenerationEditModel, ImageGenerationModel };
|
|
16
|
-
export type GenerateImageConfig = typeof definition.defaults;
|
|
@@ -9,8 +9,7 @@ declare const definition: import("./types").NodeDefinition<"generator", {
|
|
|
9
9
|
apiKey: string | undefined;
|
|
10
10
|
outputMode: "per-input";
|
|
11
11
|
selectionMode: null;
|
|
12
|
-
}>;
|
|
12
|
+
}, false>;
|
|
13
13
|
export default definition;
|
|
14
14
|
export { isImageToVideoModel };
|
|
15
15
|
export type { VideoGenerationTextToVideoModel, VideoGenerationImageToVideoModel, VideoGenerationModel };
|
|
16
|
-
export type GenerateVideoConfig = typeof definition.defaults;
|
|
@@ -15,8 +15,7 @@ declare const definition: import("./types").NodeDefinition<"generator", {
|
|
|
15
15
|
passthroughInputs: IfPassthroughInput[];
|
|
16
16
|
outputMode: "per-input";
|
|
17
17
|
selectionMode: null;
|
|
18
|
-
}>;
|
|
18
|
+
}, false>;
|
|
19
19
|
export default definition;
|
|
20
20
|
export { IfLogicOperators };
|
|
21
21
|
export type { IfLogicOperator, IfBooleanInput, IfPassthroughInput };
|
|
22
|
-
export type IfConfig = typeof definition.defaults;
|
|
@@ -1,5 +1,36 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ImageEditorElement, DimensionPresetKey, FitMode, DynamicCropConfig } from '../../render/types';
|
|
2
|
+
/**
|
|
3
|
+
* Image editor node configuration
|
|
4
|
+
*
|
|
5
|
+
* This is the complete configuration for an image editor node,
|
|
6
|
+
* including canvas dimensions, elements, and crop settings.
|
|
7
|
+
*/
|
|
8
|
+
export interface ImageEditorNodeConfig {
|
|
9
|
+
/** Canvas width in pixels */
|
|
10
|
+
width: number;
|
|
11
|
+
/** Canvas height in pixels */
|
|
12
|
+
height: number;
|
|
13
|
+
/** Aspect ratio string (e.g., "9:16") */
|
|
14
|
+
aspectRatio: string;
|
|
15
|
+
/** Dimension preset key */
|
|
16
|
+
dimensionPreset: DimensionPresetKey;
|
|
17
|
+
/** Elements to render */
|
|
18
|
+
elements: ImageEditorElement[];
|
|
19
|
+
/** Background type: 'image' for image input, 'color' for solid color */
|
|
20
|
+
backgroundType?: 'image' | 'color';
|
|
21
|
+
/** Background color (hex) when backgroundType is 'color' */
|
|
22
|
+
backgroundColor?: string;
|
|
23
|
+
/** How the background image fits the canvas */
|
|
24
|
+
backgroundFit?: FitMode;
|
|
25
|
+
/** Cached background image URL for consistent preview */
|
|
26
|
+
previewBackgroundUrl?: string;
|
|
27
|
+
/** Cached image URLs for image elements (keyed by inputId) */
|
|
28
|
+
previewImageUrls?: Record<string, string>;
|
|
29
|
+
/** Cached text values for text elements (keyed by textInputId) */
|
|
30
|
+
previewTextValues?: Record<string, string>;
|
|
31
|
+
/** Dynamic cropping configuration */
|
|
32
|
+
dynamicCrop?: DynamicCropConfig;
|
|
33
|
+
}
|
|
3
34
|
declare const definition: import("./types").NodeDefinition<"generator", {
|
|
4
35
|
imageEditor: {
|
|
5
36
|
width: number;
|
|
@@ -11,23 +42,5 @@ declare const definition: import("./types").NodeDefinition<"generator", {
|
|
|
11
42
|
};
|
|
12
43
|
outputMode: "per-input";
|
|
13
44
|
selectionMode: null;
|
|
14
|
-
}>;
|
|
45
|
+
}, false>;
|
|
15
46
|
export default definition;
|
|
16
|
-
export type ImageComposerConfig = typeof definition.defaults;
|
|
17
|
-
/**
|
|
18
|
-
* Input to the image-composer node executor
|
|
19
|
-
*/
|
|
20
|
-
export interface ImageEditorNodeInput extends Record<string, unknown> {
|
|
21
|
-
type: 'image-composer';
|
|
22
|
-
config: ImageEditorNodeConfig;
|
|
23
|
-
imageUrls: Record<string, string>;
|
|
24
|
-
textValues: Record<string, string>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Output from the image-composer node executor
|
|
28
|
-
*/
|
|
29
|
-
export interface ImageEditorNodeOutput extends Record<string, unknown>, NodeOutputValues {
|
|
30
|
-
width?: number;
|
|
31
|
-
height?: number;
|
|
32
|
-
aspectRatio?: string;
|
|
33
|
-
}
|
|
@@ -91,5 +91,45 @@ const definition = (0, types_1.defineNode)({
|
|
|
91
91
|
],
|
|
92
92
|
};
|
|
93
93
|
},
|
|
94
|
+
resolvePreview: (config) => {
|
|
95
|
+
const editorConfig = config?.imageEditor;
|
|
96
|
+
if (!editorConfig)
|
|
97
|
+
return null;
|
|
98
|
+
const sources = {};
|
|
99
|
+
const textContent = {};
|
|
100
|
+
// Add background URL if available
|
|
101
|
+
if (editorConfig.previewBackgroundUrl) {
|
|
102
|
+
sources['background'] = editorConfig.previewBackgroundUrl;
|
|
103
|
+
}
|
|
104
|
+
// Resolve image elements: inputId -> element.id
|
|
105
|
+
// Resolve text elements: textInputId -> element.id
|
|
106
|
+
for (const elem of editorConfig.elements) {
|
|
107
|
+
if (elem.type === 'image' && elem.inputId) {
|
|
108
|
+
const url = editorConfig.previewImageUrls?.[elem.inputId];
|
|
109
|
+
if (url) {
|
|
110
|
+
sources[elem.id] = url;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (elem.type === 'text' && elem.textInputId) {
|
|
114
|
+
const text = editorConfig.previewTextValues?.[elem.textInputId];
|
|
115
|
+
if (text) {
|
|
116
|
+
textContent[elem.id] = text;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
renderConfig: {
|
|
122
|
+
elements: editorConfig.elements,
|
|
123
|
+
width: editorConfig.width,
|
|
124
|
+
height: editorConfig.height,
|
|
125
|
+
backgroundType: editorConfig.backgroundType,
|
|
126
|
+
backgroundColor: editorConfig.backgroundColor,
|
|
127
|
+
backgroundFit: editorConfig.backgroundFit,
|
|
128
|
+
dynamicCrop: editorConfig.dynamicCrop,
|
|
129
|
+
},
|
|
130
|
+
sources,
|
|
131
|
+
textContent,
|
|
132
|
+
};
|
|
133
|
+
},
|
|
94
134
|
});
|
|
95
135
|
exports.default = definition;
|