@go-mailer/easy-email-extensions 5.0.3 → 5.0.5
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/lib/AttributePanel/components/adapter/index.d.ts +1 -0
- package/lib/AttributePanel/components/attributes/ContainerBackgroundColor.d.ts +1 -1
- package/lib/AttributePanel/components/attributes/PersonalizationPanel.d.ts +4 -0
- package/lib/GoMailerLayout/GoMailerLayout.d.ts +8 -0
- package/lib/GoMailerLayout/PresetBlocks.d.ts +2 -0
- package/lib/GoMailerLayout/VideoBlock/Panel.d.ts +2 -0
- package/lib/GoMailerLayout/VideoBlock/index.d.ts +9 -0
- package/lib/GoMailerLayout/index.d.ts +2 -0
- package/lib/TwoColumnLayout/TwoColumnLayout.d.ts +9 -0
- package/lib/TwoColumnLayout/index.d.ts +2 -0
- package/lib/components/Form/NativeSlider/index.d.ts +11 -0
- package/lib/components/Form/RichTextToolBar/components/Personalization/index.d.ts +1 -1
- package/lib/components/Form/index.d.ts +3 -2
- package/lib/components/Providers/ExtensionProvider.d.ts +1 -1
- package/lib/hooks/useAIContext.d.ts +48 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +1 -1
- package/lib/index2.js +3313 -2696
- package/lib/index2.js.map +1 -1
- package/lib/style.css +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtensionProps } from '../components/Providers/ExtensionProvider';
|
|
3
|
+
export interface GoMailerLayoutProps extends ExtensionProps {
|
|
4
|
+
showSourceCode?: boolean;
|
|
5
|
+
jsonReadOnly?: boolean;
|
|
6
|
+
mjmlReadOnly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const GoMailerLayout: React.FC<GoMailerLayoutProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IBlockData } from '@go-mailer/easy-email-core';
|
|
2
|
+
export declare const VideoBlockType = "go-mailer-video";
|
|
3
|
+
export type IVideoBlock = IBlockData<{
|
|
4
|
+
src: string;
|
|
5
|
+
href: string;
|
|
6
|
+
width: string;
|
|
7
|
+
'container-background-color': string;
|
|
8
|
+
}, Record<string, never>>;
|
|
9
|
+
export declare const VideoBlock: import("@go-mailer/easy-email-core").IBlock<IVideoBlock>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtensionProps } from '../components/Providers/ExtensionProvider';
|
|
3
|
+
export interface TwoColumnLayoutProps extends ExtensionProps {
|
|
4
|
+
showSourceCode?: boolean;
|
|
5
|
+
jsonReadOnly?: boolean;
|
|
6
|
+
mjmlReadOnly?: boolean;
|
|
7
|
+
showBlockLayer?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const TwoColumnLayout: React.FC<TwoColumnLayoutProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface NativeSliderProps {
|
|
3
|
+
value?: number;
|
|
4
|
+
onChange?: (val: number) => void;
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
/** If true the value badge shows a % suffix instead of px */
|
|
9
|
+
percentMode?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function NativeSlider({ value, onChange, min, max, step, percentMode, }: NativeSliderProps): React.JSX.Element;
|
|
@@ -3,4 +3,4 @@ export interface FontFamilyProps {
|
|
|
3
3
|
execCommand: (cmd: string, value: any) => void;
|
|
4
4
|
getPopupContainer: () => HTMLElement;
|
|
5
5
|
}
|
|
6
|
-
export declare function Personalization(props: FontFamilyProps): React.JSX.Element;
|
|
6
|
+
export declare function Personalization(props: FontFamilyProps): React.JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { InputNumberProps, SwitchProps, TextAreaProps, CheckboxGroupProps, TreeSelectProps } from '@arco-design/web-react';
|
|
3
3
|
import { ImageUploaderProps } from './ImageUploader';
|
|
4
4
|
import { UploadFieldProps } from './UploadField';
|
|
5
5
|
import { SelectProps } from './Select';
|
|
@@ -13,13 +13,14 @@ import { InlineTextProps } from './InlineTextField';
|
|
|
13
13
|
import { AutoCompleteProps } from './AutoComplete';
|
|
14
14
|
import { InputSearchProps } from '@arco-design/web-react/es/Input';
|
|
15
15
|
import { ColorPickerField } from './ColorPickerField';
|
|
16
|
+
import { NativeSliderProps } from './NativeSlider';
|
|
16
17
|
export { RichTextField } from './RichTextField';
|
|
17
18
|
export declare const TextField: (props: import("./enhancer").EnhancerProps & Omit<InputProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
18
19
|
export declare const InputWithUnitField: (props: import("./enhancer").EnhancerProps & Omit<InputWithUnitProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
19
20
|
export declare const SearchField: (props: import("./enhancer").EnhancerProps & Omit<InputSearchProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
20
21
|
export declare const TextAreaField: (props: import("./enhancer").EnhancerProps & Omit<TextAreaProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
21
22
|
export declare const NumberField: (props: import("./enhancer").EnhancerProps & Omit<InputNumberProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
22
|
-
export declare const SliderField: (props: import("./enhancer").EnhancerProps & Omit<
|
|
23
|
+
export declare const SliderField: (props: import("./enhancer").EnhancerProps & Omit<NativeSliderProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
23
24
|
export declare const UploadField: (props: import("./enhancer").EnhancerProps & Omit<UploadFieldProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
24
25
|
export declare const ImageUploaderField: (props: import("./enhancer").EnhancerProps & Omit<ImageUploaderProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
25
26
|
export declare const SelectField: (props: import("./enhancer").EnhancerProps & Omit<SelectProps, "value" | "onChange" | "mutators">) => import("react").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { BlockLayerProps } from '../../BlockLayer';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface ExtensionProps extends BlockLayerProps {
|
|
4
4
|
children?: React.ReactNode | React.ReactElement;
|
|
5
|
-
categories
|
|
5
|
+
categories?: Array<{
|
|
6
6
|
label: string;
|
|
7
7
|
active?: boolean;
|
|
8
8
|
blocks: Array<{
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EditorContent } from '@go-mailer/easy-email-editor';
|
|
2
|
+
export interface AIBlockSummary {
|
|
3
|
+
/** Dot-path index into the email JSON tree, e.g. `"content.children.[0].children.[1]"`. */
|
|
4
|
+
idx: string;
|
|
5
|
+
/** MJML block type string, e.g. `"advanced_text"`, `"advanced_image"`. */
|
|
6
|
+
type: string;
|
|
7
|
+
/** Human-readable title if set on the block. */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Plain text extracted from HTML content fields (text blocks). */
|
|
10
|
+
plainText: string;
|
|
11
|
+
/** Alt text for image blocks, empty for others. */
|
|
12
|
+
alt: string;
|
|
13
|
+
/** Href for button/link blocks, empty for others. */
|
|
14
|
+
href: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AIEmailContext extends EditorContent {
|
|
17
|
+
/** Flat list of every block in the email with key content fields. */
|
|
18
|
+
blockSummaries: AIBlockSummary[];
|
|
19
|
+
/** Plain text of the entire email (all text blocks concatenated). */
|
|
20
|
+
emailPlainText: string;
|
|
21
|
+
/** Plain text of the currently focused block only. */
|
|
22
|
+
focusBlockPlainText: string;
|
|
23
|
+
/** The text the user has highlighted in the canvas right now. */
|
|
24
|
+
selectedText: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns a comprehensive snapshot of the current editor state, designed to
|
|
28
|
+
* be passed to an AI assistant. The returned object includes:
|
|
29
|
+
*
|
|
30
|
+
* - `emailTemplate` — full JSON tree (`IEmailTemplate`)
|
|
31
|
+
* - `focusIdx` — dot-path of the selected block
|
|
32
|
+
* - `focusBlock` — the selected block node
|
|
33
|
+
* - `focusBlockPlainText` — plain text extracted from the selected block
|
|
34
|
+
* - `selection` — `{ text, blockIdx }` for the highlighted text
|
|
35
|
+
* - `selectedText` — convenience alias for `selection.text`
|
|
36
|
+
* - `blockSummaries` — flat list of all blocks with extracted content
|
|
37
|
+
* - `emailPlainText` — full email as plain text (all blocks joined)
|
|
38
|
+
*
|
|
39
|
+
* Mount this inside `<EmailEditorProvider>`. The return value is memoized
|
|
40
|
+
* and only recalculates when relevant state changes.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* const ctx = useAIContext();
|
|
45
|
+
* // Pass ctx to your AI panel, or send ctx.emailPlainText to your LLM API.
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function useAIContext(): AIEmailContext;
|
package/lib/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export * from './SourceCodePanel';
|
|
|
6
6
|
export * from './InteractivePrompt';
|
|
7
7
|
export * from './SimpleLayout';
|
|
8
8
|
export * from './StandardLayout';
|
|
9
|
+
export * from './TwoColumnLayout';
|
|
10
|
+
export * from './GoMailerLayout';
|
|
9
11
|
export * from './MergeTagBadgePrompt';
|
|
10
12
|
export * from './components/Providers/ExtensionProvider';
|
|
11
13
|
export * from './constants';
|
|
@@ -15,3 +17,5 @@ export { getContextMergeTags } from './utils/getContextMergeTags';
|
|
|
15
17
|
export { getIconNameByBlockType, setIconsMap } from './utils/getIconNameByBlockType';
|
|
16
18
|
export { getBlockTitle } from './utils/getBlockTitle';
|
|
17
19
|
export { MjmlToJson } from './utils/MjmlToJson';
|
|
20
|
+
export { useAIContext } from './hooks/useAIContext';
|
|
21
|
+
export type { AIEmailContext, AIBlockSummary } from './hooks/useAIContext';
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { e as Align, A as AttributePanel, f as AttributesPanelWrapper,
|
|
1
|
+
export { e as Align, A as AttributePanel, f as AttributesPanelWrapper, af as AutoCompleteField, l as Background, o as BackgroundColor, d as BlockAttributeConfigurationManager, B as BlockLayer, Q as BlockMarketManager, R as BlockMaskWrapper, r as Border, v as BorderColor, y as BorderStyle, E as BorderWidth, ai as CheckboxField, J as ClassName, h as CollapseWrapper, C as Color, am as ColorPickerField, i as Condition, j as ContainerBackgroundColor, D as Decoration, P as DefaultPageConfigPanel, p as Direction, ak as EditGridTabField, aj as EditTabField, a1 as ExtensionContext, a2 as ExtensionProvider, F as FontFamily, w as FontSize, z as FontStyle, G as FontWeight, $ as GoMailerLayout, H as Height, ac as ImageUploaderField, al as InlineTextField, a6 as InputWithUnitField, X as InteractivePrompt, L as LetterSpacing, m as LineHeight, q as Link, t as Margin, a0 as MergeTagBadgePrompt, x as MergeTags, M as MjmlToJson, N as NavbarLinkPadding, a9 as NumberField, I as Padding, K as PresetColorsProvider, a4 as RICH_TEXT_TOOL_BAR, ag as RadioGroupField, ao as RichTextField, a7 as SearchField, ad as SelectField, S as SelectionRangeProvider, ap as ShadowDom, O as ShortcutToolbar, Y as SimpleLayout, aa as SliderField, U as SourceCodePanel, Z as StandardLayout, ah as SwitchField, T as TextAlign, a8 as TextAreaField, k as TextDecoration, a5 as TextField, n as TextTransform, ae as TreeSelectField, _ as TwoColumnLayout, ab as UploadField, V as VerticalAlign, W as Width, an as enhancer, b as getBlockTitle, g as getContextMergeTags, a as getIconNameByBlockType, s as setIconsMap, u as useAIContext, a3 as useExtensionProps } from "./index2.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "@go-mailer/easy-email-editor";
|
|
4
4
|
import "@go-mailer/easy-email-core";
|