easy-email-pro-theme 0.12.0 → 0.13.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.
Files changed (2) hide show
  1. package/lib/index.js +18 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -848,23 +848,39 @@ const EditorContextProvider = (props) => {
848
848
  const lastAdapterNonPageValues = useRef({});
849
849
  const mergetagsDataRef = useRefState(mergetagsData);
850
850
  const [inited, setInited] = useState(false);
851
+ const [hasAuth, setHasAuth] = useState(false);
851
852
  useEffect(() => {
852
853
  if (isEqual$3(props.mergetagsData, mergetagsDataRef.current))
853
854
  return;
854
855
  setMergetagsData(cloneDeep(props.mergetagsData) || {});
855
856
  }, [mergetagsDataRef, props.mergetagsData]);
856
857
  const pageElement = editor.children[0];
858
+ useEffect(() => {
859
+ EditorCore.auth(props.clientId).then(() => {
860
+ setHasAuth(true);
861
+ }).catch(() => {
862
+ const errorMessage = `<div style="position: fixed;z-index: 9999999999;bottom: 40px;right: 40px;background-color: #ffffff;width: 320px;padding: 20px;box-sizing: border-box;box-shadow: 1px 1px 5px 0px #ccc;">
863
+ <div style="font-weight:bold">Authorization Terminated</div>
864
+ <div>We regret to inform you that your authorization has been terminated.</div>
865
+ <div>Please contact us: <a target="_blank" style="font-weight: bold;color: rgb(0, 120, 212);cursor:pointer;" href="mailto:962491243@qq.com">962491243@qq.com</a></div>
866
+
867
+ </div>`;
868
+ const div = document.createElement("div");
869
+ div.innerHTML = errorMessage;
870
+ document.body.appendChild(div);
871
+ });
872
+ }, [props.clientId]);
857
873
  useEffect(() => {
858
874
  const timer = setInterval(() => {
859
875
  const inited2 = getInited(editor);
860
- if (inited2) {
876
+ if (inited2 && hasAuth) {
861
877
  setInited(true);
862
878
  } else {
863
879
  setInited(false);
864
880
  }
865
881
  }, 100);
866
882
  return () => timer && clearInterval(timer);
867
- }, [editor]);
883
+ }, [editor, hasAuth]);
868
884
  const { lock } = useEditorState();
869
885
  const { universalElementSetting } = useEditorProps();
870
886
  const valid = !lock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-email-pro-theme",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib"