@elementor/editor-app-bar 4.0.0-591 → 4.0.0-598

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/index.js CHANGED
@@ -848,15 +848,33 @@ function isPublishEnabled(document2) {
848
848
 
849
849
  // src/extensions/documents-save/hooks/use-document-copy-and-share-props.ts
850
850
  var import_editor_documents4 = require("@elementor/editor-documents");
851
+ var import_events2 = require("@elementor/events");
851
852
  var import_icons8 = require("@elementor/icons");
852
853
  var import_i18n8 = require("@wordpress/i18n");
853
854
  function useDocumentCopyAndShareProps() {
854
855
  const document2 = (0, import_editor_documents4.__useActiveDocument)();
855
856
  const { copyAndShare } = (0, import_editor_documents4.__useActiveDocumentActions)();
857
+ const { dispatchEvent: dispatchEvent2, config } = (0, import_events2.useMixpanel)();
856
858
  return {
857
859
  icon: import_icons8.LinkIcon,
858
860
  title: (0, import_i18n8.__)("Copy and Share", "elementor"),
859
- onClick: copyAndShare,
861
+ onClick: () => {
862
+ const eventName = config?.names?.editorOne?.topBarPublishDropdown;
863
+ if (eventName) {
864
+ dispatchEvent2?.(eventName, {
865
+ app_type: config?.appTypes?.editor,
866
+ window_name: config?.appTypes?.editor,
867
+ interaction_type: config?.triggers?.click?.toLowerCase(),
868
+ target_type: config?.targetTypes?.dropdownItem,
869
+ target_name: config?.targetNames?.publishDropdown?.copyAndShare,
870
+ interaction_result: config?.interactionResults?.actionSelected,
871
+ target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(),
872
+ location_l1: config?.secondaryLocations?.publishDropdown?.replace(/\s+/g, "_").toLowerCase(),
873
+ location_l2: config?.targetTypes?.dropdownItem
874
+ });
875
+ }
876
+ copyAndShare();
877
+ },
860
878
  disabled: !document2 || document2.isSaving || document2.isSavingDraft || !("publish" === document2.status.value),
861
879
  visible: document2?.permissions?.showCopyAndShare
862
880
  };
@@ -864,45 +882,101 @@ function useDocumentCopyAndShareProps() {
864
882
 
865
883
  // src/extensions/documents-save/hooks/use-document-save-draft-props.ts
866
884
  var import_editor_documents5 = require("@elementor/editor-documents");
885
+ var import_events3 = require("@elementor/events");
867
886
  var import_icons9 = require("@elementor/icons");
868
887
  var import_i18n9 = require("@wordpress/i18n");
869
888
  function useDocumentSaveDraftProps() {
870
889
  const document2 = (0, import_editor_documents5.__useActiveDocument)();
871
890
  const { saveDraft } = (0, import_editor_documents5.__useActiveDocumentActions)();
891
+ const { dispatchEvent: dispatchEvent2, config } = (0, import_events3.useMixpanel)();
872
892
  return {
873
893
  icon: import_icons9.FileReportIcon,
874
894
  title: (0, import_i18n9.__)("Save Draft", "elementor"),
875
- onClick: saveDraft,
895
+ onClick: () => {
896
+ const eventName = config?.names?.editorOne?.topBarPublishDropdown;
897
+ if (eventName) {
898
+ dispatchEvent2?.(eventName, {
899
+ app_type: config?.appTypes?.editor,
900
+ window_name: config?.appTypes?.editor,
901
+ interaction_type: config?.triggers?.click?.toLowerCase(),
902
+ target_type: config?.targetTypes?.dropdownItem,
903
+ target_name: config?.targetNames?.publishDropdown?.saveDraft,
904
+ interaction_result: config?.interactionResults?.actionSelected,
905
+ target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(),
906
+ location_l1: config?.secondaryLocations?.publishDropdown?.replace(/\s+/g, "_").toLowerCase(),
907
+ location_l2: config?.targetTypes?.dropdownItem
908
+ });
909
+ }
910
+ saveDraft();
911
+ },
876
912
  disabled: !document2 || document2.isSaving || document2.isSavingDraft || !document2.isDirty
877
913
  };
878
914
  }
879
915
 
880
916
  // src/extensions/documents-save/hooks/use-document-save-template-props.ts
881
917
  var import_editor_documents6 = require("@elementor/editor-documents");
918
+ var import_events4 = require("@elementor/events");
882
919
  var import_icons10 = require("@elementor/icons");
883
920
  var import_i18n10 = require("@wordpress/i18n");
884
921
  function useDocumentSaveTemplateProps() {
885
922
  const { saveTemplate } = (0, import_editor_documents6.__useActiveDocumentActions)();
923
+ const { dispatchEvent: dispatchEvent2, config } = (0, import_events4.useMixpanel)();
886
924
  return {
887
925
  icon: import_icons10.FolderIcon,
888
926
  title: (0, import_i18n10.__)("Save as Template", "elementor"),
889
- onClick: saveTemplate
927
+ onClick: () => {
928
+ const eventName = config?.names?.editorOne?.topBarPublishDropdown;
929
+ if (eventName) {
930
+ dispatchEvent2?.(eventName, {
931
+ app_type: config?.appTypes?.editor,
932
+ window_name: config?.appTypes?.editor,
933
+ interaction_type: config?.triggers?.click?.toLowerCase(),
934
+ target_type: config?.targetTypes?.dropdownItem,
935
+ target_name: config?.targetNames?.publishDropdown?.saveAsTemplate,
936
+ interaction_result: config?.interactionResults?.actionSelected,
937
+ target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(),
938
+ location_l1: config?.secondaryLocations?.publishDropdown?.replace(/\s+/g, "_").toLowerCase(),
939
+ location_l2: config?.targetTypes?.dropdownItem
940
+ });
941
+ }
942
+ saveTemplate();
943
+ }
890
944
  };
891
945
  }
892
946
 
893
947
  // src/extensions/documents-save/hooks/use-document-view-page-props.ts
894
948
  var import_editor_documents7 = require("@elementor/editor-documents");
895
949
  var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
950
+ var import_events5 = require("@elementor/events");
896
951
  var import_icons11 = require("@elementor/icons");
897
952
  var import_i18n11 = require("@wordpress/i18n");
898
953
  function useDocumentViewPageProps() {
899
954
  const document2 = (0, import_editor_documents7.__useActiveDocument)();
955
+ const { dispatchEvent: dispatchEvent2, config } = (0, import_events5.useMixpanel)();
900
956
  return {
901
957
  icon: import_icons11.EyeIcon,
902
958
  title: (0, import_i18n11.__)("View Page", "elementor"),
903
- onClick: () => document2?.id && (0, import_editor_v1_adapters4.__privateRunCommand)("editor/documents/view", {
904
- id: document2.id
905
- })
959
+ onClick: () => {
960
+ const eventName = config?.names?.editorOne?.topBarPublishDropdown;
961
+ if (eventName) {
962
+ dispatchEvent2?.(eventName, {
963
+ app_type: config?.appTypes?.editor,
964
+ window_name: config?.appTypes?.editor,
965
+ interaction_type: config?.triggers?.click?.toLowerCase(),
966
+ target_type: config?.targetTypes?.dropdownItem,
967
+ target_name: config?.targetNames?.publishDropdown?.viewPage,
968
+ interaction_result: config?.interactionResults?.actionSelected,
969
+ target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(),
970
+ location_l1: config?.secondaryLocations?.publishDropdown?.replace(/\s+/g, "_").toLowerCase(),
971
+ location_l2: config?.targetTypes?.dropdownItem
972
+ });
973
+ }
974
+ if (document2?.id) {
975
+ (0, import_editor_v1_adapters4.__privateRunCommand)("editor/documents/view", {
976
+ id: document2.id
977
+ });
978
+ }
979
+ }
906
980
  };
907
981
  }
908
982