easy-email-pro-theme 1.38.1 → 1.38.2

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/index.js CHANGED
@@ -15913,7 +15913,7 @@ const FontSize$2 = () => {
15913
15913
  }
15914
15914
  setFontSizeValue(fontSizeValue2);
15915
15915
  }, [editor, textNode, textNode == null ? void 0 : textNode.fontSize]);
15916
- const optionsList2 = useMemo$1(() => {
15916
+ const optionsList = useMemo$1(() => {
15917
15917
  const list = [...fontSizeList || options$6];
15918
15918
  if (fontSizeValue) {
15919
15919
  list.push(fontSizeValue);
@@ -15965,7 +15965,7 @@ const FontSize$2 = () => {
15965
15965
  autoAlignPopupMinWidth: true
15966
15966
  }
15967
15967
  },
15968
- optionsList2.map((option, index2) => {
15968
+ optionsList.map((option, index2) => {
15969
15969
  return /* @__PURE__ */ React__default.createElement(Select$1.Option, { key: index2, value: option.value }, option.label);
15970
15970
  })
15971
15971
  ), /* @__PURE__ */ React__default.createElement("style", null, `
@@ -15997,7 +15997,7 @@ const FontFamily$2 = () => {
15997
15997
  }
15998
15998
  setFontFamilyValue(fontFamilyValue2);
15999
15999
  }, [editor, textNode, textNode == null ? void 0 : textNode.fontFamily]);
16000
- const optionsList2 = useMemo$1(() => {
16000
+ const optionsList = useMemo$1(() => {
16001
16001
  const list = [...fontList];
16002
16002
  if (fontFamilyValue) {
16003
16003
  list.unshift({ label: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, fontFamilyValue), value: fontFamilyValue });
@@ -16049,7 +16049,7 @@ const FontFamily$2 = () => {
16049
16049
  autoAlignPopupMinWidth: true
16050
16050
  }
16051
16051
  },
16052
- optionsList2.map((option, index2) => {
16052
+ optionsList.map((option, index2) => {
16053
16053
  return /* @__PURE__ */ React__default.createElement(Select$1.Option, { key: index2, value: option.value }, option.label);
16054
16054
  })
16055
16055
  ), /* @__PURE__ */ React__default.createElement("style", null, `
@@ -41993,7 +41993,7 @@ const FontSize = ({ path: path2, name }) => {
41993
41993
  const { setFieldValue } = useEditorContext();
41994
41994
  const { selectedNodePath } = useSelectedNode();
41995
41995
  const element = useElementDefault({ path: path2, type: null });
41996
- const optionsList2 = useMemo$1(() => {
41996
+ const optionsList = useMemo$1(() => {
41997
41997
  const list = [...fontSizeList || options$1];
41998
41998
  return [...new Set(list)].sort().map((item2) => ({ label: item2, value: item2 }));
41999
41999
  }, [fontSizeList]);
@@ -42012,7 +42012,7 @@ const FontSize = ({ path: path2, name }) => {
42012
42012
  autoAlignPopupMinWidth: true
42013
42013
  }
42014
42014
  },
42015
- optionsList2.map((option, index2) => {
42015
+ optionsList.map((option, index2) => {
42016
42016
  return /* @__PURE__ */ React__default.createElement(Select$1.Option, { key: index2, value: option.value }, option.label);
42017
42017
  })
42018
42018
  ));
@@ -43567,156 +43567,160 @@ const AIPromptModal = (props) => {
43567
43567
  ]);
43568
43568
  };
43569
43569
  const SvgMagic = (props) => /* @__PURE__ */ React$2.createElement("svg", __spreadValues({ className: "bi bi-magic", fill: "currentColor", height: 16, viewBox: "0 0 16 16", width: 16, xmlns: "http://www.w3.org/2000/svg" }, props), /* @__PURE__ */ React$2.createElement("path", { d: "M9.5 2.672a.5.5 0 1 0 1 0V.843a.5.5 0 0 0-1 0v1.829Zm4.5.035A.5.5 0 0 0 13.293 2L12 3.293a.5.5 0 1 0 .707.707L14 2.707ZM7.293 4A.5.5 0 1 0 8 3.293L6.707 2A.5.5 0 0 0 6 2.707L7.293 4Zm-.621 2.5a.5.5 0 1 0 0-1H4.843a.5.5 0 1 0 0 1h1.829Zm8.485 0a.5.5 0 1 0 0-1h-1.829a.5.5 0 0 0 0 1h1.829ZM13.293 10A.5.5 0 1 0 14 9.293L12.707 8a.5.5 0 1 0-.707.707L13.293 10ZM9.5 11.157a.5.5 0 0 0 1 0V9.328a.5.5 0 0 0-1 0v1.829Zm1.854-5.097a.5.5 0 0 0 0-.706l-.708-.708a.5.5 0 0 0-.707 0L8.646 5.94a.5.5 0 0 0 0 .707l.708.708a.5.5 0 0 0 .707 0l1.293-1.293Zm-3 3a.5.5 0 0 0 0-.706l-.708-.708a.5.5 0 0 0-.707 0L.646 13.94a.5.5 0 0 0 0 .707l.708.708a.5.5 0 0 0 .707 0L8.354 9.06Z" }));
43570
- const optionsList = [
43571
- {
43572
- label: "Ask AI",
43573
- value: "Ask AI",
43574
- getMessages(text) {
43575
- return [
43576
- {
43577
- role: "system",
43578
- content: "Answer the question based on the context below."
43579
- },
43580
- {
43581
- role: "system",
43582
- content: "The response should be in HTML format."
43583
- },
43584
- {
43585
- role: "system",
43586
- content: "The response should preserve any HTML formatting, links, and styles in the context."
43570
+ function AIAssistant({ isCollapsed }) {
43571
+ const isEnabled = EditorAuth.getFeatureEnabled("AI_ASSISTANT");
43572
+ if (!isEnabled) {
43573
+ throw new Error(`Current plan do not support AIAssistant`);
43574
+ }
43575
+ const optionsList = useMemo$1(
43576
+ () => [
43577
+ {
43578
+ label: t("Ask AI"),
43579
+ value: "Ask AI",
43580
+ getMessages(text) {
43581
+ return [
43582
+ {
43583
+ role: "system",
43584
+ content: "Answer the question based on the context below."
43585
+ },
43586
+ {
43587
+ role: "system",
43588
+ content: "The response should be in HTML format."
43589
+ },
43590
+ {
43591
+ role: "system",
43592
+ content: "The response should preserve any HTML formatting, links, and styles in the context."
43593
+ }
43594
+ ];
43587
43595
  }
43588
- ];
43589
- }
43590
- },
43591
- {
43592
- label: "Summarize content",
43593
- value: "Summarize content",
43594
- getMessages(text) {
43595
- return [
43596
- {
43597
- role: "system",
43598
- content: "Answer the question based on the context below."
43599
- },
43600
- {
43601
- role: "system",
43602
- content: "The response should be in HTML format."
43603
- },
43604
- {
43605
- role: "system",
43606
- content: "The response should preserve any HTML formatting, links, and styles in the context."
43607
- },
43608
- {
43609
- role: "user",
43610
- content: `Question: Provide the key points and concepts in this content in a succinct summary. Context: ${text}`
43596
+ },
43597
+ {
43598
+ label: t("Summarize content"),
43599
+ value: "Summarize content",
43600
+ getMessages(text) {
43601
+ return [
43602
+ {
43603
+ role: "system",
43604
+ content: "Answer the question based on the context below."
43605
+ },
43606
+ {
43607
+ role: "system",
43608
+ content: "The response should be in HTML format."
43609
+ },
43610
+ {
43611
+ role: "system",
43612
+ content: "The response should preserve any HTML formatting, links, and styles in the context."
43613
+ },
43614
+ {
43615
+ role: "user",
43616
+ content: `Question: Provide the key points and concepts in this content in a succinct summary. Context: ${text}`
43617
+ }
43618
+ ];
43611
43619
  }
43612
- ];
43613
- }
43614
- },
43615
- {
43616
- label: "Improve writing",
43617
- value: "Improve writing",
43618
- getMessages(text) {
43619
- return [
43620
- {
43621
- role: "system",
43622
- content: "Answer the question based on the context below."
43623
- },
43624
- {
43625
- role: "system",
43626
- content: "The response should be in HTML format."
43627
- },
43628
- {
43629
- role: "system",
43630
- content: "The response should preserve any HTML formatting, links, and styles in the context."
43631
- },
43632
- {
43633
- role: "user",
43634
- content: `Question: Rewrite this content with no spelling mistakes, proper grammar, and with more descriptive language, using best writing practices without losing the original meaning. Context: ${text}`
43620
+ },
43621
+ {
43622
+ label: t("Improve writing"),
43623
+ value: "Improve writing",
43624
+ getMessages(text) {
43625
+ return [
43626
+ {
43627
+ role: "system",
43628
+ content: "Answer the question based on the context below."
43629
+ },
43630
+ {
43631
+ role: "system",
43632
+ content: "The response should be in HTML format."
43633
+ },
43634
+ {
43635
+ role: "system",
43636
+ content: "The response should preserve any HTML formatting, links, and styles in the context."
43637
+ },
43638
+ {
43639
+ role: "user",
43640
+ content: `Question: Rewrite this content with no spelling mistakes, proper grammar, and with more descriptive language, using best writing practices without losing the original meaning. Context: ${text}`
43641
+ }
43642
+ ];
43635
43643
  }
43636
- ];
43637
- }
43638
- },
43639
- {
43640
- label: "Simplify language",
43641
- value: "Simplify language",
43642
- getMessages(text) {
43643
- return [
43644
- {
43645
- role: "system",
43646
- content: "Answer the question based on the context below."
43647
- },
43648
- {
43649
- role: "system",
43650
- content: "The response should be in HTML format."
43651
- },
43652
- {
43653
- role: "system",
43654
- content: "The response should preserve any HTML formatting, links, and styles in the context."
43655
- },
43656
- {
43657
- role: "user",
43658
- content: `Question: Rewrite this content with simplified language and reduce the complexity of the writing, so that the content is easier to understand. Context: ${text}`
43644
+ },
43645
+ {
43646
+ label: t("Simplify language"),
43647
+ value: "Simplify language",
43648
+ getMessages(text) {
43649
+ return [
43650
+ {
43651
+ role: "system",
43652
+ content: "Answer the question based on the context below."
43653
+ },
43654
+ {
43655
+ role: "system",
43656
+ content: "The response should be in HTML format."
43657
+ },
43658
+ {
43659
+ role: "system",
43660
+ content: "The response should preserve any HTML formatting, links, and styles in the context."
43661
+ },
43662
+ {
43663
+ role: "user",
43664
+ content: `Question: Rewrite this content with simplified language and reduce the complexity of the writing, so that the content is easier to understand. Context: ${text}`
43665
+ }
43666
+ ];
43659
43667
  }
43660
- ];
43661
- }
43662
- },
43663
- {
43664
- label: "Expand upon",
43665
- value: "Expand upon",
43666
- getMessages(text) {
43667
- return [
43668
- {
43669
- role: "system",
43670
- content: "Answer the question based on the context below."
43671
- },
43672
- {
43673
- role: "system",
43674
- content: "The response should be in HTML format."
43675
- },
43676
- {
43677
- role: "system",
43678
- content: "The response should preserve any HTML formatting, links, and styles in the context."
43679
- },
43680
- {
43681
- role: "user",
43682
- content: `Question: Expand upon this content with descriptive language and more detailed explanations, to make the writing easier to understand and increase the length of the content. Context: ${text}`
43668
+ },
43669
+ {
43670
+ label: t("Expand upon"),
43671
+ value: "Expand upon",
43672
+ getMessages(text) {
43673
+ return [
43674
+ {
43675
+ role: "system",
43676
+ content: "Answer the question based on the context below."
43677
+ },
43678
+ {
43679
+ role: "system",
43680
+ content: "The response should be in HTML format."
43681
+ },
43682
+ {
43683
+ role: "system",
43684
+ content: "The response should preserve any HTML formatting, links, and styles in the context."
43685
+ },
43686
+ {
43687
+ role: "user",
43688
+ content: `Question: Expand upon this content with descriptive language and more detailed explanations, to make the writing easier to understand and increase the length of the content. Context: ${text}`
43689
+ }
43690
+ ];
43683
43691
  }
43684
- ];
43685
- }
43686
- },
43687
- {
43688
- label: "Trim content",
43689
- value: "Trim content",
43690
- getMessages(text) {
43691
- return [
43692
- {
43693
- role: "system",
43694
- content: "Answer the question based on the context below."
43695
- },
43696
- {
43697
- role: "system",
43698
- content: "The response should be in HTML format."
43699
- },
43700
- {
43701
- role: "system",
43702
- content: "The response should preserve any HTML formatting, links, and styles in the context."
43703
- },
43704
- {
43705
- role: "user",
43706
- content: `Question: Remove any repetitive, redundant, or non-essential writing in this content without changing the meaning or losing any key information. Context: ${text}`
43692
+ },
43693
+ {
43694
+ label: t("Trim content"),
43695
+ value: "Trim content",
43696
+ getMessages(text) {
43697
+ return [
43698
+ {
43699
+ role: "system",
43700
+ content: "Answer the question based on the context below."
43701
+ },
43702
+ {
43703
+ role: "system",
43704
+ content: "The response should be in HTML format."
43705
+ },
43706
+ {
43707
+ role: "system",
43708
+ content: "The response should preserve any HTML formatting, links, and styles in the context."
43709
+ },
43710
+ {
43711
+ role: "user",
43712
+ content: `Question: Remove any repetitive, redundant, or non-essential writing in this content without changing the meaning or losing any key information. Context: ${text}`
43713
+ }
43714
+ ];
43707
43715
  }
43708
- ];
43709
- }
43710
- }
43711
- ];
43712
- function AIAssistant({ isCollapsed }) {
43713
- const isEnabled = EditorAuth.getFeatureEnabled("AI_ASSISTANT");
43714
- if (!isEnabled) {
43715
- throw new Error(`Current plan do not support AIAssistant`);
43716
- }
43716
+ }
43717
+ ],
43718
+ []
43719
+ );
43717
43720
  const editor = useSlate();
43718
43721
  const [visible, setVisible] = useState(false);
43719
43722
  const [refElement, setRefElement] = useState(null);
43723
+ const [options2, setOptions] = useState(optionsList);
43720
43724
  const { selectedNodePath } = useSelectedNode();
43721
43725
  const [loading, setLoading] = useState(false);
43722
43726
  const [rawHTML, setRawHTML] = useState("");
@@ -43730,6 +43734,11 @@ function AIAssistant({ isCollapsed }) {
43730
43734
  setSelectedText(text);
43731
43735
  }
43732
43736
  }, [editor, isCollapsed, selectedNodePath]);
43737
+ useEffect(() => {
43738
+ if (AIAssistantProps == null ? void 0 : AIAssistantProps.options) {
43739
+ setOptions(AIAssistantProps == null ? void 0 : AIAssistantProps.options);
43740
+ }
43741
+ }, [AIAssistantProps == null ? void 0 : AIAssistantProps.options]);
43733
43742
  const ref2 = useRef(null);
43734
43743
  const onClose = useEventCallback(() => {
43735
43744
  setPrompt([]);
@@ -43737,14 +43746,14 @@ function AIAssistant({ isCollapsed }) {
43737
43746
  setRawHTML("");
43738
43747
  setVisible(false);
43739
43748
  });
43740
- const onGenerate = useEventCallback((options2) => __async(this, null, function* () {
43749
+ const onGenerate = useEventCallback((options22) => __async(this, null, function* () {
43741
43750
  var _a;
43742
43751
  if (!AIAssistantProps)
43743
43752
  return;
43744
43753
  setLoading(true);
43745
43754
  try {
43746
43755
  const postPrompt = [...prompt];
43747
- if (options2 == null ? void 0 : options2.retry) {
43756
+ if (options22 == null ? void 0 : options22.retry) {
43748
43757
  const isAssistant = ((_a = postPrompt[postPrompt.length - 1]) == null ? void 0 : _a.role) === "assistant";
43749
43758
  if (isAssistant) {
43750
43759
  postPrompt.pop();
@@ -43762,7 +43771,7 @@ function AIAssistant({ isCollapsed }) {
43762
43771
  setLoading(false);
43763
43772
  }));
43764
43773
  const onSelectPrompt = useEventCallback((value) => __async(this, null, function* () {
43765
- const matchPrompt = optionsList.find((item2) => item2.value === value);
43774
+ const matchPrompt = options2.find((item2) => item2.value === value);
43766
43775
  if (!matchPrompt)
43767
43776
  return;
43768
43777
  const messages = matchPrompt.getMessages(selectedText);
@@ -43846,7 +43855,7 @@ function AIAssistant({ isCollapsed }) {
43846
43855
  },
43847
43856
  onChange: onSelectPrompt
43848
43857
  },
43849
- optionsList.map((option, index2) => {
43858
+ options2.map((option, index2) => {
43850
43859
  return /* @__PURE__ */ React__default.createElement(Select$1.Option, { key: index2, value: option.value }, option.label);
43851
43860
  })
43852
43861
  ), refElement && /* @__PURE__ */ React__default.createElement(
@@ -86,6 +86,14 @@ export interface PluginsCustomEditorTypes {
86
86
  role: string;
87
87
  content: string;
88
88
  }>;
89
+ options?: Array<{
90
+ label: string;
91
+ value: string;
92
+ getMessages(text: string): {
93
+ role: string;
94
+ content: string;
95
+ }[];
96
+ }>;
89
97
  };
90
98
  controller?: boolean;
91
99
  showPreview?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-theme",
3
- "version": "1.38.1",
3
+ "version": "1.38.2",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"