easy-email-pro-core 0.2.0 → 0.3.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.
@@ -1 +1 @@
1
- export declare const CONTENT_EDITABLE_CLASSNAME = "beacas_preview_content_editable";
1
+ export declare const CONTENT_EDITABLE_CLASSNAME = "easy_email_pro_preview_content_editable";
@@ -1,4 +1,3 @@
1
- export * from "./regexp";
2
1
  export * from "./blockType";
3
2
  export * from "./blockCategory";
4
3
  export * from "./editor";
@@ -1,4 +1,4 @@
1
- export { useEmailRenderContext, EmailRenderProvider, } from "./utils/BeacasCore/contexts/EmailRenderContext";
1
+ export { useEmailRenderContext, EmailRenderProvider, } from "./utils/EditorCore/contexts/EmailRenderContext";
2
2
  export * from "./utils";
3
3
  export * from "./blocks";
4
4
  export * from "./constants";
@@ -48,7 +48,7 @@ export interface VariableItem {
48
48
  label: string;
49
49
  value: string;
50
50
  type: string;
51
- key: string;
51
+ name: string;
52
52
  }
53
53
  export type PageElement = BasicElement<{
54
54
  width?: string;
@@ -11,7 +11,10 @@ type EmailRenderInputProps = {
11
11
  keepEmptyAttributes: boolean;
12
12
  mergetagsData?: Record<string, any>;
13
13
  };
14
- export declare const useEmailRenderContext: () => EmailRenderInputProps;
14
+ type EmailRenderProps = EmailRenderInputProps & {
15
+ pageVariables: Record<string, any>;
16
+ };
17
+ export declare const useEmailRenderContext: () => EmailRenderProps;
15
18
  export declare const EmailRenderProvider: React.FC<EmailRenderInputProps & {
16
19
  children: React.ReactNode;
17
20
  }>;
@@ -0,0 +1,16 @@
1
+ import { TextNode, Element as NodeElement, PageElement } from "../../typings";
2
+ import { JsonToMjmlOption } from "../isProductionMode";
3
+ import { getUniversalElements, transformUniversalElements } from "./universalElement";
4
+ export declare class EditorCore {
5
+ static version: string;
6
+ static toMJML(options: JsonToMjmlOption): string;
7
+ static elementToMjml(node: NodeElement, options: Omit<JsonToMjmlOption, "element"> & {
8
+ pageElement: NodeElement;
9
+ }): string;
10
+ static mjmlToBlockElement(mjml: string): NodeElement | TextNode;
11
+ static isPageDataVariable(text: string): boolean;
12
+ static getPageDataVariables: (page: PageElement) => Record<string, any>;
13
+ static renderWithPageVariables: <T extends string | Object>(obj: T, data?: Record<string, any>) => T;
14
+ static getUniversalElements: typeof getUniversalElements;
15
+ static transformUniversalElements: typeof transformUniversalElements;
16
+ }
@@ -0,0 +1,11 @@
1
+ import { Element as NodeElement } from "../../typings";
2
+ export declare function getUniversalElements(data: {
3
+ content: NodeElement;
4
+ }): Record<string, {
5
+ idx: string;
6
+ blockData: NodeElement;
7
+ }[]>;
8
+ export declare function transformUniversalElements<T extends {
9
+ content: NodeElement;
10
+ universalElements: Record<string, NodeElement>;
11
+ }>(data: T): T["content"];
@@ -31,7 +31,6 @@ export declare class NodeUtils {
31
31
  static isPlaceholderElement: (node: TextNode | Node) => node is PlaceholderElement;
32
32
  static isTextListElement: (node: TextNode | Node) => node is StandardTextListElement;
33
33
  static isTextListItemElement: (node: TextNode | Node) => node is StandardTextListElement;
34
- static isMergeTag(value: string): boolean;
35
34
  static isParentCategory(cat: ElementCategoryType, parentCat: ElementCategoryType): boolean;
36
35
  static isParentCategoryType(childType: Element["type"], parentType: Element["type"]): boolean;
37
36
  }
@@ -4,6 +4,6 @@ export * from "./mergeBlock";
4
4
  export * from "./I18nManager";
5
5
  export * from "./BlockManager";
6
6
  export * from "./NodeUtils";
7
- export * from "./BeacasCore";
7
+ export * from "./EditorCore";
8
8
  export * from "./plugins";
9
9
  export * from "./getAdapterAttributesString";
@@ -24,6 +24,7 @@ export declare abstract class TemplateEnginePlugin {
24
24
  static type: PluginType;
25
25
  abstract generateIterationTemplate(option: LogicIteration, content: React.ReactNode): React.ReactNode;
26
26
  abstract generateConditionTemplate(option: LogicCondition | string, content: React.ReactNode, fallback?: React.ReactNode): React.ReactNode;
27
+ abstract isVariable(variable: string): boolean;
27
28
  abstract generateVariable(variable: string, defaultValue?: string): string;
28
29
  abstract renderWithData(html: string, data: Record<string, any>): string;
29
30
  }
@@ -35,9 +36,11 @@ export declare class PluginManager {
35
36
  static enabledResponsive: boolean;
36
37
  static generateResponsive: ResponsivePlugin["generateResponsive"];
37
38
  static generateIterationTemplate: TemplateEnginePlugin["generateIterationTemplate"];
39
+ static isVariable: TemplateEnginePlugin["isVariable"];
38
40
  static generateConditionTemplate: TemplateEnginePlugin["generateConditionTemplate"];
39
41
  static generateVariable: TemplateEnginePlugin["generateVariable"];
40
42
  static renderWithData: TemplateEnginePlugin["renderWithData"];
43
+ static registerPlugins(plugins: Array<new () => Plugin>): void;
41
44
  static registerPlugin(Plug: new () => Plugin): void;
42
45
  }
43
46
  export {};
@@ -1,9 +1,12 @@
1
1
  import { LogicCondition, LogicIteration } from "../../typings";
2
2
  import { TemplateEnginePlugin } from "./PluginManager";
3
3
  import React from "react";
4
+ export declare const MERGE_TAG_PATTERN: RegExp;
5
+ export declare const MERGE_TAG_PATTERN_GLOBAL: RegExp;
4
6
  export declare class TemplateEngine extends TemplateEnginePlugin {
5
7
  generateIterationTemplate(option: LogicIteration, content: React.ReactNode): React.ReactNode;
6
8
  generateConditionTemplate(option: LogicCondition | string, content: React.ReactNode, fallback?: React.ReactNode): React.ReactNode;
7
9
  generateVariable(variable: string, defaultValue?: string): string;
10
+ isVariable(value: string): boolean;
8
11
  renderWithData(html: string, data: Record<string, any>): string;
9
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-core",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"
@@ -1,2 +0,0 @@
1
- export declare const MERGE_TAG_PATTERN: RegExp;
2
- export declare const MERGE_TAG_PATTERN_GLOBAL: RegExp;
@@ -1,14 +0,0 @@
1
- import { TextNode, Element as BeacasElement, PageElement } from "../../typings";
2
- import { JsonToMjmlOption } from "../isProductionMode";
3
- import { getUniversalElements, transformUniversalElements } from "./universalElement";
4
- export declare class BeacasCore {
5
- static version: string;
6
- static toMJML(options: JsonToMjmlOption): string;
7
- static elementToMjml(node: BeacasElement, options: Omit<JsonToMjmlOption, "element"> & {
8
- pageElement: BeacasElement;
9
- }): string;
10
- static mjmlToBlockElement(mjml: string): BeacasElement | TextNode;
11
- static getPageDataVariables: (page: PageElement) => Record<string, any>;
12
- static getUniversalElements: typeof getUniversalElements;
13
- static transformUniversalElements: typeof transformUniversalElements;
14
- }
@@ -1,11 +0,0 @@
1
- import { Element as BeacasElement } from "../../typings";
2
- export declare function getUniversalElements(data: {
3
- content: BeacasElement;
4
- }): Record<string, {
5
- idx: string;
6
- blockData: BeacasElement;
7
- }[]>;
8
- export declare function transformUniversalElements<T extends {
9
- content: BeacasElement;
10
- universalElements: Record<string, BeacasElement>;
11
- }>(data: T): T["content"];