@elementor/editor-audits 4.4.0-beta3 → 4.4.1
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +265 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -15
- package/src/audits/accessibility-statement.ts +1 -0
- package/src/audits/accessibility-widget.ts +1 -0
- package/src/audits/cookie-policy.ts +1 -0
- package/src/audits/google-consent-mode.ts +1 -0
- package/src/audits/images-alt-text.ts +1 -0
- package/src/audits/images-inefficient-format.ts +1 -0
- package/src/audits/images-too-large.ts +1 -0
- package/src/audits/scan-for-cookies.ts +1 -0
- package/src/components/audit-panel.tsx +6 -1
- package/src/components/fix-violation-with-angie.tsx +15 -15
- package/src/components/promotions.tsx +9 -2
- package/src/components/violation-cta-button.tsx +9 -1
- package/src/components/violation-row.tsx +28 -4
- package/src/constants.ts +13 -4
- package/src/hooks/focus-violation.ts +9 -5
- package/src/hooks/use-audit-report.ts +6 -1
- package/src/hooks/use-track-panel-viewed.ts +31 -0
- package/src/types.ts +1 -0
- package/src/utils/build-run-summary.ts +45 -0
- package/src/utils/tracking-names.ts +12 -0
- package/src/utils/tracking.ts +130 -0
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
38
38
|
|
|
39
39
|
// src/init.ts
|
|
40
40
|
var import_editor_floating_panels6 = require("@elementor/editor-floating-panels");
|
|
41
|
-
var
|
|
41
|
+
var import_store9 = require("@elementor/store");
|
|
42
42
|
|
|
43
43
|
// src/editor-app-bar.tsx
|
|
44
44
|
var import_editor_app_bar = require("@elementor/editor-app-bar");
|
|
@@ -130,7 +130,7 @@ var import_editor_floating_panels5 = require("@elementor/editor-floating-panels"
|
|
|
130
130
|
|
|
131
131
|
// src/components/audit-panel.tsx
|
|
132
132
|
var React21 = __toESM(require("react"));
|
|
133
|
-
var
|
|
133
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
134
134
|
var import_editor_floating_panels4 = require("@elementor/editor-floating-panels");
|
|
135
135
|
var import_ui20 = require("@elementor/ui");
|
|
136
136
|
var import_i18n17 = require("@wordpress/i18n");
|
|
@@ -139,14 +139,22 @@ var import_i18n17 = require("@wordpress/i18n");
|
|
|
139
139
|
var import_i18n = require("@wordpress/i18n");
|
|
140
140
|
var AUDIT_PANEL_ID = "audit-panel";
|
|
141
141
|
var REPORT_STORAGE_KEY_PREFIX = "elementor/audits/report";
|
|
142
|
-
var CREATE_WIDGET_EVENT = "elementor/editor/create-widget";
|
|
143
|
-
var ANGIE_FIX_ENTRY_POINT = "audit_violation";
|
|
144
142
|
var FEEDBACK_EXPERIMENT_NAME = "in_editor_feedback";
|
|
145
143
|
var FEEDBACK_ENTRY_POINT = "audit_panel";
|
|
146
144
|
var FEEDBACK_CLICKED_EVENT = "audit_feedback_clicked";
|
|
147
145
|
var FEEDBACK_SENT_EVENT = "audit_feedback_sent";
|
|
148
146
|
var FEEDBACK_CANCELLED_EVENT = "audit_feedback_cancelled";
|
|
149
147
|
var FEEDBACK_CLOSED_EVENT = "audit_feedback_closed";
|
|
148
|
+
var PANEL_VIEWED_EVENT = "page_audit_panel_viewed";
|
|
149
|
+
var PANEL_CLOSED_EVENT = "page_audit_panel_closed";
|
|
150
|
+
var RUN_STARTED_EVENT = "page_audit_run_started";
|
|
151
|
+
var RUN_COMPLETED_EVENT = "page_audit_run_completed";
|
|
152
|
+
var FINDING_CLICKED_EVENT = "page_audit_finding_clicked";
|
|
153
|
+
var TRACKING_WINDOW_NAME = "page_audit";
|
|
154
|
+
var TRACKING_TARGET_LOCATION = "panel";
|
|
155
|
+
var TRACKING_LOCATION_L1 = "audit_panel";
|
|
156
|
+
var FIRST_OPEN_MESSAGE_KEY = "page-audit-panel-opened";
|
|
157
|
+
var AUDIT_ID_PREFIX = "audits/";
|
|
150
158
|
var ALL_CATEGORIES = [
|
|
151
159
|
"best-practices",
|
|
152
160
|
"seo",
|
|
@@ -664,13 +672,125 @@ function persistReport(documentId, report) {
|
|
|
664
672
|
(0, import_session.setSessionStorageItem)(getStorageKey(documentId), report);
|
|
665
673
|
}
|
|
666
674
|
|
|
675
|
+
// src/utils/tracking.ts
|
|
676
|
+
var import_events = require("@elementor/events");
|
|
677
|
+
|
|
678
|
+
// src/utils/tracking-names.ts
|
|
679
|
+
function toTrackingSeverity(severity) {
|
|
680
|
+
return severity === "info" ? "suggestion" : severity;
|
|
681
|
+
}
|
|
682
|
+
function toCheckName(auditId) {
|
|
683
|
+
return auditId.replace(AUDIT_ID_PREFIX, "").replace(/-/g, "_");
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// src/utils/build-run-summary.ts
|
|
687
|
+
var SEVERITY_PRIORITY = ["error", "warning", "suggestion"];
|
|
688
|
+
function buildRunSummary(report) {
|
|
689
|
+
const requiredFixes = report.auditResults.filter(({ audit: audit25, result }) => result.status === "fail" && isScoredAudit(audit25)).map(({ audit: audit25 }) => ({ check: toCheckName(audit25.id), severity: toTrackingSeverity(audit25.severity) }));
|
|
690
|
+
const countBySeverity = (severity) => requiredFixes.filter((fix) => fix.severity === severity).length;
|
|
691
|
+
const highestSeverity = SEVERITY_PRIORITY.find((severity) => countBySeverity(severity) > 0);
|
|
692
|
+
return {
|
|
693
|
+
state: highestSeverity ?? "success",
|
|
694
|
+
metadata: {
|
|
695
|
+
score: report.overall,
|
|
696
|
+
fix_count: requiredFixes.length,
|
|
697
|
+
error_count: countBySeverity("error"),
|
|
698
|
+
warning_count: countBySeverity("warning"),
|
|
699
|
+
suggestion_count: countBySeverity("suggestion"),
|
|
700
|
+
required_fixes: requiredFixes
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
// src/utils/tracking.ts
|
|
706
|
+
var dispatch = (eventName, payload) => {
|
|
707
|
+
(0, import_events.getMixpanel)().dispatchEvent?.(eventName, {
|
|
708
|
+
window_name: TRACKING_WINDOW_NAME,
|
|
709
|
+
target_location: TRACKING_TARGET_LOCATION,
|
|
710
|
+
location_l1: TRACKING_LOCATION_L1,
|
|
711
|
+
...payload
|
|
712
|
+
});
|
|
713
|
+
};
|
|
714
|
+
var trackPanelViewed = ({
|
|
715
|
+
hasPriorReport,
|
|
716
|
+
isFirstOpen
|
|
717
|
+
}) => {
|
|
718
|
+
dispatch(PANEL_VIEWED_EVENT, {
|
|
719
|
+
interaction_type: "view",
|
|
720
|
+
target_type: "panel",
|
|
721
|
+
target_name: "page_audit_panel",
|
|
722
|
+
interaction_result: "panel_viewed",
|
|
723
|
+
metadata: { has_prior_report: hasPriorReport, is_first_open: isFirstOpen }
|
|
724
|
+
});
|
|
725
|
+
};
|
|
726
|
+
var trackPanelClosed = () => {
|
|
727
|
+
dispatch(PANEL_CLOSED_EVENT, {
|
|
728
|
+
interaction_type: "click",
|
|
729
|
+
target_type: "button",
|
|
730
|
+
target_name: "close",
|
|
731
|
+
interaction_result: "panel_closed"
|
|
732
|
+
});
|
|
733
|
+
};
|
|
734
|
+
var trackRunStarted = (trigger) => {
|
|
735
|
+
dispatch(RUN_STARTED_EVENT, {
|
|
736
|
+
interaction_type: "click",
|
|
737
|
+
target_type: "button",
|
|
738
|
+
target_name: trigger,
|
|
739
|
+
interaction_result: "run_initiated"
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
var trackRunOutcome = (interactionResult, details) => {
|
|
743
|
+
dispatch(RUN_COMPLETED_EVENT, {
|
|
744
|
+
interaction_type: "view",
|
|
745
|
+
target_type: "report",
|
|
746
|
+
target_name: "audit_report",
|
|
747
|
+
interaction_result: interactionResult,
|
|
748
|
+
...details
|
|
749
|
+
});
|
|
750
|
+
};
|
|
751
|
+
var trackRunCompleted = (report) => {
|
|
752
|
+
const { state, metadata } = buildRunSummary(report);
|
|
753
|
+
trackRunOutcome("run_completed", { state, metadata });
|
|
754
|
+
};
|
|
755
|
+
var trackRunFailed = () => {
|
|
756
|
+
trackRunOutcome("run_failed", {});
|
|
757
|
+
};
|
|
758
|
+
var trackFixWithApp = (audit25, violation, locationL2) => {
|
|
759
|
+
if (violation.appInstalled === void 0) {
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
trackFindingClicked({
|
|
763
|
+
audit: audit25,
|
|
764
|
+
locationL2,
|
|
765
|
+
actionType: "fix_with_app",
|
|
766
|
+
interactionResult: "app_opened",
|
|
767
|
+
appInstalled: violation.appInstalled
|
|
768
|
+
});
|
|
769
|
+
};
|
|
770
|
+
var trackFindingClicked = (click) => {
|
|
771
|
+
const { audit: audit25, locationL2, actionType, interactionResult } = click;
|
|
772
|
+
dispatch(FINDING_CLICKED_EVENT, {
|
|
773
|
+
interaction_type: "click",
|
|
774
|
+
target_type: "row",
|
|
775
|
+
target_name: "finding_row",
|
|
776
|
+
action_type: actionType,
|
|
777
|
+
target_value: toCheckName(audit25.id),
|
|
778
|
+
interaction_result: interactionResult,
|
|
779
|
+
state: toTrackingSeverity(audit25.severity),
|
|
780
|
+
location_l2: locationL2,
|
|
781
|
+
...click.actionType === "fix_with_app" && {
|
|
782
|
+
app_status: click.appInstalled ? "installed" : "not_installed"
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
};
|
|
786
|
+
|
|
667
787
|
// src/hooks/use-audit-report.ts
|
|
668
788
|
function useAuditReport() {
|
|
669
789
|
const status = (0, import_store4.__useSelector)((state) => selectStatus(state));
|
|
670
790
|
const report = (0, import_store4.__useSelector)((state) => selectReport(state));
|
|
671
791
|
const error = (0, import_store4.__useSelector)((state) => selectError(state));
|
|
672
792
|
const isStale = (0, import_store4.__useSelector)((state) => selectIsStale(state));
|
|
673
|
-
const
|
|
793
|
+
const dispatch3 = (0, import_store4.__useDispatch)();
|
|
674
794
|
const documentId = (0, import_editor_elements3.getHostDocumentId)() ?? 0;
|
|
675
795
|
(0, import_react.useEffect)(() => {
|
|
676
796
|
if (!documentId || report?.documentId === documentId) {
|
|
@@ -678,35 +798,63 @@ function useAuditReport() {
|
|
|
678
798
|
}
|
|
679
799
|
const persisted = getPersistedReport(documentId);
|
|
680
800
|
if (persisted) {
|
|
681
|
-
|
|
801
|
+
dispatch3(slice.actions.reportRestored(persisted));
|
|
682
802
|
} else if (report) {
|
|
683
|
-
|
|
803
|
+
dispatch3(slice.actions.reportCleared());
|
|
684
804
|
}
|
|
685
|
-
}, [documentId, report,
|
|
686
|
-
const run = async (documentIdToRun) => {
|
|
687
|
-
|
|
805
|
+
}, [documentId, report, dispatch3]);
|
|
806
|
+
const run = async (documentIdToRun, trigger) => {
|
|
807
|
+
dispatch3(slice.actions.runStarted());
|
|
808
|
+
trackRunStarted(trigger);
|
|
688
809
|
try {
|
|
689
810
|
const nextReport = await runPageAudit(documentIdToRun);
|
|
690
|
-
|
|
811
|
+
dispatch3(slice.actions.runSucceeded(nextReport));
|
|
691
812
|
persistReport(documentIdToRun, nextReport);
|
|
813
|
+
trackRunCompleted(nextReport);
|
|
692
814
|
} catch (e) {
|
|
693
815
|
if (e instanceof SessionExpiredError) {
|
|
694
|
-
|
|
816
|
+
dispatch3(slice.actions.runAborted());
|
|
817
|
+
trackRunFailed();
|
|
695
818
|
return;
|
|
696
819
|
}
|
|
697
|
-
|
|
820
|
+
dispatch3(slice.actions.runFailed(e instanceof Error ? e.message : "Unknown error"));
|
|
821
|
+
trackRunFailed();
|
|
698
822
|
}
|
|
699
823
|
};
|
|
700
824
|
return { status, report, error, isStale, run };
|
|
701
825
|
}
|
|
702
826
|
|
|
827
|
+
// src/hooks/use-track-panel-viewed.ts
|
|
828
|
+
var import_react2 = require("react");
|
|
829
|
+
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
830
|
+
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
831
|
+
var import_store6 = require("@elementor/store");
|
|
832
|
+
function useTrackPanelViewed() {
|
|
833
|
+
const { data: currentUser } = (0, import_editor_current_user.useCurrentUser)();
|
|
834
|
+
const [isFirstOpenMessageSuppressed, suppressFirstOpenMessage] = (0, import_editor_current_user.useSuppressedMessage)(FIRST_OPEN_MESSAGE_KEY);
|
|
835
|
+
const report = (0, import_store6.__useSelector)((state) => selectReport(state));
|
|
836
|
+
const [hasPriorReport] = (0, import_react2.useState)(() => {
|
|
837
|
+
const documentId = (0, import_editor_elements4.getHostDocumentId)() ?? 0;
|
|
838
|
+
return Boolean(report) || Boolean(documentId && getPersistedReport(documentId));
|
|
839
|
+
});
|
|
840
|
+
const hasTracked = (0, import_react2.useRef)(false);
|
|
841
|
+
(0, import_react2.useEffect)(() => {
|
|
842
|
+
if (!currentUser || hasTracked.current) {
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
hasTracked.current = true;
|
|
846
|
+
trackPanelViewed({ hasPriorReport, isFirstOpen: !isFirstOpenMessageSuppressed });
|
|
847
|
+
suppressFirstOpenMessage();
|
|
848
|
+
}, [currentUser, hasPriorReport, isFirstOpenMessageSuppressed, suppressFirstOpenMessage]);
|
|
849
|
+
}
|
|
850
|
+
|
|
703
851
|
// src/components/audit-feedback.tsx
|
|
704
852
|
var React2 = __toESM(require("react"));
|
|
705
|
-
var
|
|
853
|
+
var import_react3 = require("react");
|
|
706
854
|
var import_editor_floating_panels = require("@elementor/editor-floating-panels");
|
|
707
855
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
708
856
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
709
|
-
var
|
|
857
|
+
var import_events2 = require("@elementor/events");
|
|
710
858
|
var import_http_client2 = require("@elementor/http-client");
|
|
711
859
|
var import_icons2 = require("@elementor/icons");
|
|
712
860
|
var import_ui2 = require("@elementor/ui");
|
|
@@ -729,10 +877,10 @@ var notifyError = () => (0, import_editor_notifications.notify)({
|
|
|
729
877
|
message: (0, import_i18n2.__)("Something went wrong. Please try sending your feedback again.", "elementor")
|
|
730
878
|
});
|
|
731
879
|
function AuditFeedback() {
|
|
732
|
-
const [isOpen, setIsOpen] = (0,
|
|
733
|
-
const [feedbackText, setFeedbackText] = (0,
|
|
734
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
735
|
-
const { dispatchEvent: trackEvent = (...args) => void args } = (0,
|
|
880
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
881
|
+
const [feedbackText, setFeedbackText] = (0, import_react3.useState)("");
|
|
882
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react3.useState)(false);
|
|
883
|
+
const { dispatchEvent: trackEvent = (...args) => void args } = (0, import_events2.useMixpanel)();
|
|
736
884
|
const panelZIndex = (0, import_editor_floating_panels.useFloatingPanelZIndex)(AUDIT_PANEL_ID);
|
|
737
885
|
if (!(0, import_editor_v1_adapters.isExperimentActive)(FEEDBACK_EXPERIMENT_NAME)) {
|
|
738
886
|
return null;
|
|
@@ -870,7 +1018,7 @@ function WelcomePage() {
|
|
|
870
1018
|
|
|
871
1019
|
// src/components/report-shell.tsx
|
|
872
1020
|
var React19 = __toESM(require("react"));
|
|
873
|
-
var
|
|
1021
|
+
var import_react6 = require("react");
|
|
874
1022
|
var import_ui18 = require("@elementor/ui");
|
|
875
1023
|
|
|
876
1024
|
// src/components/pages/category-page.tsx
|
|
@@ -879,9 +1027,9 @@ var import_ui12 = require("@elementor/ui");
|
|
|
879
1027
|
var import_i18n11 = require("@wordpress/i18n");
|
|
880
1028
|
|
|
881
1029
|
// src/hooks/use-single-expanded-card.ts
|
|
882
|
-
var
|
|
1030
|
+
var import_react4 = require("react");
|
|
883
1031
|
function useSingleExpandedCard(initialId = null) {
|
|
884
|
-
const [expandedId, setExpandedId] = (0,
|
|
1032
|
+
const [expandedId, setExpandedId] = (0, import_react4.useState)(initialId);
|
|
885
1033
|
const toggle = (id) => {
|
|
886
1034
|
setExpandedId((current) => current === id ? null : id);
|
|
887
1035
|
};
|
|
@@ -900,12 +1048,12 @@ var CATEGORY_ICONS = {
|
|
|
900
1048
|
|
|
901
1049
|
// src/components/status-section.tsx
|
|
902
1050
|
var React6 = __toESM(require("react"));
|
|
903
|
-
var
|
|
1051
|
+
var import_react5 = require("react");
|
|
904
1052
|
var import_icons4 = require("@elementor/icons");
|
|
905
1053
|
var import_ui6 = require("@elementor/ui");
|
|
906
1054
|
var import_i18n6 = require("@wordpress/i18n");
|
|
907
1055
|
function StatusSection({ label, count, color = "default", defaultExpanded = false, children }) {
|
|
908
|
-
const [expanded, setExpanded] = (0,
|
|
1056
|
+
const [expanded, setExpanded] = (0, import_react5.useState)(defaultExpanded);
|
|
909
1057
|
if (React6.Children.count(children) === 0) {
|
|
910
1058
|
return null;
|
|
911
1059
|
}
|
|
@@ -948,21 +1096,21 @@ function SubpageHeader({ title, onBack, backLabel, icon }) {
|
|
|
948
1096
|
|
|
949
1097
|
// src/components/violation-row.tsx
|
|
950
1098
|
var React12 = __toESM(require("react"));
|
|
951
|
-
var
|
|
1099
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
952
1100
|
var import_editor_floating_panels2 = require("@elementor/editor-floating-panels");
|
|
953
1101
|
var import_icons10 = require("@elementor/icons");
|
|
954
1102
|
var import_ui11 = require("@elementor/ui");
|
|
955
1103
|
var import_i18n10 = require("@wordpress/i18n");
|
|
956
1104
|
|
|
957
1105
|
// src/hooks/focus-violation.ts
|
|
958
|
-
var
|
|
1106
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
959
1107
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
960
1108
|
var SCROLL_TO_VIEW_DELAY_MS = 200;
|
|
961
1109
|
function focusViolation(violation) {
|
|
962
1110
|
if (violation.elementId) {
|
|
963
|
-
const container = (0,
|
|
1111
|
+
const container = (0, import_editor_elements5.getContainer)(violation.elementId);
|
|
964
1112
|
if (container) {
|
|
965
|
-
(0,
|
|
1113
|
+
(0, import_editor_elements5.selectElement)(violation.elementId);
|
|
966
1114
|
const domElement = container.view?.getDomElement?.();
|
|
967
1115
|
if (domElement) {
|
|
968
1116
|
window.elementor?.helpers?.scrollToView?.(domElement, SCROLL_TO_VIEW_DELAY_MS);
|
|
@@ -971,25 +1119,27 @@ function focusViolation(violation) {
|
|
|
971
1119
|
if (violation.targetHint === "element-settings") {
|
|
972
1120
|
(0, import_editor_v1_adapters2.__privateRunCommand)("panel/editor/open");
|
|
973
1121
|
}
|
|
974
|
-
return;
|
|
1122
|
+
return container ? "element_focused" : null;
|
|
975
1123
|
}
|
|
976
1124
|
if (violation.externalUrl) {
|
|
977
1125
|
window.open(violation.externalUrl, "_blank");
|
|
978
|
-
return;
|
|
1126
|
+
return "external_url_opened";
|
|
979
1127
|
}
|
|
980
1128
|
if (violation.targetHint === "page-settings") {
|
|
981
1129
|
(0, import_editor_v1_adapters2.__privateOpenRoute)("panel/page-settings/settings");
|
|
982
|
-
return;
|
|
1130
|
+
return "page_settings_opened";
|
|
983
1131
|
}
|
|
984
1132
|
if (violation.targetHint === "site-settings") {
|
|
985
1133
|
(0, import_editor_v1_adapters2.__privateRunCommand)("panel/global/open");
|
|
986
|
-
return;
|
|
1134
|
+
return "site_settings_opened";
|
|
987
1135
|
}
|
|
988
1136
|
if (violation.targetHint === "site-identity-settings") {
|
|
989
1137
|
void (0, import_editor_v1_adapters2.__privateRunCommand)("panel/global/open").then(() => {
|
|
990
1138
|
(0, import_editor_v1_adapters2.__privateOpenRoute)("panel/global/settings-site-identity");
|
|
991
1139
|
});
|
|
1140
|
+
return "site_settings_opened";
|
|
992
1141
|
}
|
|
1142
|
+
return null;
|
|
993
1143
|
}
|
|
994
1144
|
|
|
995
1145
|
// src/utils/build-angie-prompt.ts
|
|
@@ -1018,24 +1168,22 @@ var import_editor_mcp = require("@elementor/editor-mcp");
|
|
|
1018
1168
|
var import_icons6 = require("@elementor/icons");
|
|
1019
1169
|
var import_ui8 = require("@elementor/ui");
|
|
1020
1170
|
var import_i18n9 = require("@wordpress/i18n");
|
|
1021
|
-
function FixViolationWithAngie({ prompt, panelZIndex, variant = "icon" }) {
|
|
1171
|
+
function FixViolationWithAngie({ audit: audit25, prompt, panelZIndex, variant = "icon" }) {
|
|
1172
|
+
if (!(0, import_editor_mcp.isAngieAvailable)()) {
|
|
1173
|
+
return null;
|
|
1174
|
+
}
|
|
1022
1175
|
const label = (0, import_i18n9.__)("Fix with Angie", "elementor");
|
|
1023
1176
|
const href = `#angie-prompt=${encodeURIComponent(prompt)}`;
|
|
1024
1177
|
const handleClick = (event) => {
|
|
1025
1178
|
event.stopPropagation();
|
|
1026
1179
|
event.preventDefault();
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
entry_point: ANGIE_FIX_ENTRY_POINT,
|
|
1035
|
-
prompt
|
|
1036
|
-
}
|
|
1037
|
-
})
|
|
1038
|
-
);
|
|
1180
|
+
(0, import_editor_mcp.sendPromptToAngie)(prompt);
|
|
1181
|
+
trackFindingClicked({
|
|
1182
|
+
audit: audit25,
|
|
1183
|
+
locationL2: "issues",
|
|
1184
|
+
actionType: "fix_with_angie",
|
|
1185
|
+
interactionResult: "angie_prompt_sent"
|
|
1186
|
+
});
|
|
1039
1187
|
};
|
|
1040
1188
|
if (variant === "button") {
|
|
1041
1189
|
return /* @__PURE__ */ React8.createElement(
|
|
@@ -1074,11 +1222,18 @@ function SeverityIcon({ severity }) {
|
|
|
1074
1222
|
var React10 = __toESM(require("react"));
|
|
1075
1223
|
var import_icons8 = require("@elementor/icons");
|
|
1076
1224
|
var import_ui9 = require("@elementor/ui");
|
|
1077
|
-
function ViolationCtaButton({
|
|
1225
|
+
function ViolationCtaButton({
|
|
1226
|
+
ctaLabel,
|
|
1227
|
+
externalUrl,
|
|
1228
|
+
variant = "outlined",
|
|
1229
|
+
withIcon = false,
|
|
1230
|
+
onOpen
|
|
1231
|
+
}) {
|
|
1078
1232
|
const handleClick = (event) => {
|
|
1079
1233
|
event.stopPropagation();
|
|
1080
1234
|
event.preventDefault();
|
|
1081
1235
|
window.open(externalUrl, "_blank", "noopener");
|
|
1236
|
+
onOpen?.();
|
|
1082
1237
|
};
|
|
1083
1238
|
return /* @__PURE__ */ React10.createElement(
|
|
1084
1239
|
import_ui9.Button,
|
|
@@ -1129,6 +1284,7 @@ function StatusIndicator({ audit: audit25, violations }) {
|
|
|
1129
1284
|
return /* @__PURE__ */ React12.createElement(import_icons10.CheckIcon, { fontSize: "small", color: "success" });
|
|
1130
1285
|
}
|
|
1131
1286
|
function GuidanceAction({
|
|
1287
|
+
audit: audit25,
|
|
1132
1288
|
violation,
|
|
1133
1289
|
sharedAngiePrompt,
|
|
1134
1290
|
panelZIndex
|
|
@@ -1142,7 +1298,8 @@ function GuidanceAction({
|
|
|
1142
1298
|
{
|
|
1143
1299
|
ctaLabel: violation.ctaLabel,
|
|
1144
1300
|
externalUrl: violation.externalUrl,
|
|
1145
|
-
withIcon: true
|
|
1301
|
+
withIcon: true,
|
|
1302
|
+
onOpen: () => trackFixWithApp(audit25, violation, "issues")
|
|
1146
1303
|
}
|
|
1147
1304
|
), hasPrimaryCta && violation.secondaryCtaLabel && violation.secondaryCtaUrl && /* @__PURE__ */ React12.createElement(
|
|
1148
1305
|
ViolationCtaButton,
|
|
@@ -1151,7 +1308,15 @@ function GuidanceAction({
|
|
|
1151
1308
|
externalUrl: violation.secondaryCtaUrl,
|
|
1152
1309
|
variant: "text"
|
|
1153
1310
|
}
|
|
1154
|
-
), sharedAngiePrompt && /* @__PURE__ */ React12.createElement(
|
|
1311
|
+
), sharedAngiePrompt && /* @__PURE__ */ React12.createElement(
|
|
1312
|
+
FixViolationWithAngie,
|
|
1313
|
+
{
|
|
1314
|
+
audit: audit25,
|
|
1315
|
+
prompt: sharedAngiePrompt,
|
|
1316
|
+
panelZIndex,
|
|
1317
|
+
variant: "button"
|
|
1318
|
+
}
|
|
1319
|
+
));
|
|
1155
1320
|
}
|
|
1156
1321
|
function getSharedAngiePrompt(violations) {
|
|
1157
1322
|
if (!violations || violations.length < 2) {
|
|
@@ -1171,9 +1336,20 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1171
1336
|
const isGuidanceFocusable = !!primaryViolation;
|
|
1172
1337
|
const panelZIndex = (0, import_editor_floating_panels2.useFloatingPanelZIndex)(AUDIT_PANEL_ID);
|
|
1173
1338
|
const sharedAngiePrompt = getSharedAngiePrompt(violations);
|
|
1339
|
+
const viewIssue = (violation) => {
|
|
1340
|
+
const interactionResult = focusViolation(violation);
|
|
1341
|
+
if (interactionResult) {
|
|
1342
|
+
trackFindingClicked({
|
|
1343
|
+
audit: audit25,
|
|
1344
|
+
locationL2: "issues",
|
|
1345
|
+
actionType: "view_issue",
|
|
1346
|
+
interactionResult
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1174
1350
|
const handleGuidanceClick = () => {
|
|
1175
1351
|
if (isGuidanceFocusable && primaryViolation) {
|
|
1176
|
-
|
|
1352
|
+
viewIssue(primaryViolation);
|
|
1177
1353
|
}
|
|
1178
1354
|
};
|
|
1179
1355
|
return /* @__PURE__ */ React12.createElement(import_ui11.Box, { sx: { borderBottom: 1, borderColor: "divider", paddingBlock: 0.5 } }, /* @__PURE__ */ React12.createElement(import_ui11.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React12.createElement(
|
|
@@ -1223,14 +1399,15 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1223
1399
|
primaryViolation && /* @__PURE__ */ React12.createElement(
|
|
1224
1400
|
GuidanceAction,
|
|
1225
1401
|
{
|
|
1402
|
+
audit: audit25,
|
|
1226
1403
|
violation: primaryViolation,
|
|
1227
1404
|
sharedAngiePrompt,
|
|
1228
1405
|
panelZIndex
|
|
1229
1406
|
}
|
|
1230
1407
|
)
|
|
1231
1408
|
))), violations && violations.length > 0 && /* @__PURE__ */ React12.createElement(import_ui11.Box, { role: "list", sx: { paddingBlockEnd: 1 } }, violations.map((violation, idx) => {
|
|
1232
|
-
const widgetIcon = violation.elementId ? (0,
|
|
1233
|
-
const elementTitle = violation.elementId ? (0,
|
|
1409
|
+
const widgetIcon = violation.elementId ? (0, import_editor_elements6.getElementIcon)(violation.elementId) : null;
|
|
1410
|
+
const elementTitle = violation.elementId ? (0, import_editor_elements6.getElementTitle)(violation.elementId) : null;
|
|
1234
1411
|
const displayLabel = elementTitle ?? violation.label;
|
|
1235
1412
|
const angiePromptContext = elementTitle ? `${elementTitle} - ${violation.label}` : violation.label;
|
|
1236
1413
|
const showsOwnFixAction = !!violation.angieFix && !sharedAngiePrompt;
|
|
@@ -1240,8 +1417,8 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1240
1417
|
key: idx,
|
|
1241
1418
|
role: "button",
|
|
1242
1419
|
tabIndex: 0,
|
|
1243
|
-
onClick: () =>
|
|
1244
|
-
onKeyDown: onKeyboardClick(() =>
|
|
1420
|
+
onClick: () => viewIssue(violation),
|
|
1421
|
+
onKeyDown: onKeyboardClick(() => viewIssue(violation)),
|
|
1245
1422
|
sx: {
|
|
1246
1423
|
display: "flex",
|
|
1247
1424
|
alignItems: "center",
|
|
@@ -1267,6 +1444,7 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1267
1444
|
/* @__PURE__ */ React12.createElement(
|
|
1268
1445
|
FixViolationWithAngie,
|
|
1269
1446
|
{
|
|
1447
|
+
audit: audit25,
|
|
1270
1448
|
prompt: violation.angiePrompt ?? buildAngiePrompt(angiePromptContext),
|
|
1271
1449
|
panelZIndex
|
|
1272
1450
|
}
|
|
@@ -1530,8 +1708,12 @@ function Promotions({ report }) {
|
|
|
1530
1708
|
ctaLabel: config.ctaLabel,
|
|
1531
1709
|
ctaDisabled: !ctaUrl,
|
|
1532
1710
|
onCtaClick: () => {
|
|
1533
|
-
if (ctaUrl) {
|
|
1534
|
-
|
|
1711
|
+
if (!ctaUrl) {
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
window.open(ctaUrl, "_blank", "noopener");
|
|
1715
|
+
if (run.result.status === "fail") {
|
|
1716
|
+
trackFixWithApp(run.audit, run.result.violations[0], "overview");
|
|
1535
1717
|
}
|
|
1536
1718
|
}
|
|
1537
1719
|
}
|
|
@@ -1584,7 +1766,7 @@ function isCategoryPage(page) {
|
|
|
1584
1766
|
return typeof page === "object" && "category" in page;
|
|
1585
1767
|
}
|
|
1586
1768
|
function ReportShell({ report }) {
|
|
1587
|
-
const [activePage, setActivePage] = (0,
|
|
1769
|
+
const [activePage, setActivePage] = (0, import_react6.useState)("overview");
|
|
1588
1770
|
const openCategory = (category) => setActivePage({ category });
|
|
1589
1771
|
const backToOverview = () => setActivePage("overview");
|
|
1590
1772
|
return /* @__PURE__ */ React19.createElement(import_ui18.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto" } }, activePage === "overview" && /* @__PURE__ */ React19.createElement(OverviewPage, { report, onCategoryClick: openCategory }), isCategoryPage(activePage) && /* @__PURE__ */ React19.createElement(CategoryPage, { category: activePage.category, report, onBack: backToOverview }));
|
|
@@ -1622,8 +1804,9 @@ function RescanButton({ hasScanned, isStale, disabled, onClick }) {
|
|
|
1622
1804
|
// src/components/audit-panel.tsx
|
|
1623
1805
|
function AuditPanel() {
|
|
1624
1806
|
const { status, report, error, isStale, run } = useAuditReport();
|
|
1625
|
-
|
|
1626
|
-
const
|
|
1807
|
+
useTrackPanelViewed();
|
|
1808
|
+
const hostDocumentId = (0, import_editor_elements7.getHostDocumentId)() ?? 0;
|
|
1809
|
+
const onRun = () => run(hostDocumentId, report ? "rescan" : "run_audit");
|
|
1627
1810
|
const lastScanLabel = report ? new Date(report.runAt).toLocaleTimeString() : null;
|
|
1628
1811
|
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
1629
1812
|
import_editor_floating_panels4.FloatingPanelHeader,
|
|
@@ -1631,7 +1814,8 @@ function AuditPanel() {
|
|
|
1631
1814
|
panelId: AUDIT_PANEL_ID,
|
|
1632
1815
|
title: (0, import_i18n17.__)("Page Audit", "elementor"),
|
|
1633
1816
|
badge: (0, import_i18n17.__)("Beta", "elementor"),
|
|
1634
|
-
titleVariant: "subtitle2"
|
|
1817
|
+
titleVariant: "subtitle2",
|
|
1818
|
+
onClose: trackPanelClosed
|
|
1635
1819
|
}
|
|
1636
1820
|
), /* @__PURE__ */ React21.createElement(
|
|
1637
1821
|
import_editor_floating_panels4.FloatingPanelBody,
|
|
@@ -1748,7 +1932,8 @@ var audit2 = {
|
|
|
1748
1932
|
externalUrl: isReady ? ctx.pageContext.ally_accessibility_statement_url : ctx.pageContext.ally_plugin_url,
|
|
1749
1933
|
ctaLabel: (0, import_i18n20.__)("Create", "elementor"),
|
|
1750
1934
|
secondaryCtaLabel: (0, import_i18n20.__)("Learn more", "elementor"),
|
|
1751
|
-
secondaryCtaUrl: "https://elementor.com/help/start-using-ally/#statement"
|
|
1935
|
+
secondaryCtaUrl: "https://elementor.com/help/start-using-ally/#statement",
|
|
1936
|
+
appInstalled: isReady
|
|
1752
1937
|
}
|
|
1753
1938
|
]
|
|
1754
1939
|
};
|
|
@@ -1791,7 +1976,8 @@ var audit3 = {
|
|
|
1791
1976
|
auditId: audit3.id,
|
|
1792
1977
|
label: (0, import_i18n21.__)("No accessibility widget is active on this site.", "elementor"),
|
|
1793
1978
|
externalUrl: isReady ? ctx.pageContext.ally_widget_settings_url : ctx.pageContext.ally_plugin_url,
|
|
1794
|
-
ctaLabel: (0, import_i18n21.__)("Activate", "elementor")
|
|
1979
|
+
ctaLabel: (0, import_i18n21.__)("Activate", "elementor"),
|
|
1980
|
+
appInstalled: isReady
|
|
1795
1981
|
}
|
|
1796
1982
|
]
|
|
1797
1983
|
};
|
|
@@ -1822,7 +2008,8 @@ var audit4 = {
|
|
|
1822
2008
|
auditId: audit4.id,
|
|
1823
2009
|
label: (0, import_i18n22.__)("Cookiez plugin is not installed or active.", "elementor"),
|
|
1824
2010
|
externalUrl: ctx.pageContext.cookiez_plugin_url,
|
|
1825
|
-
ctaLabel: (0, import_i18n22.__)("Set up cookie consent", "elementor")
|
|
2011
|
+
ctaLabel: (0, import_i18n22.__)("Set up cookie consent", "elementor"),
|
|
2012
|
+
appInstalled: ctx.pageContext.cookiez_plugin_active
|
|
1826
2013
|
}
|
|
1827
2014
|
]
|
|
1828
2015
|
};
|
|
@@ -1830,7 +2017,7 @@ var audit4 = {
|
|
|
1830
2017
|
};
|
|
1831
2018
|
|
|
1832
2019
|
// src/audits/deep-nesting.ts
|
|
1833
|
-
var
|
|
2020
|
+
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
1834
2021
|
var import_i18n23 = require("@wordpress/i18n");
|
|
1835
2022
|
var MAX_NESTING_DEPTH = 6;
|
|
1836
2023
|
function isNestingElement(node, widgetsCache) {
|
|
@@ -1854,7 +2041,7 @@ var audit5 = {
|
|
|
1854
2041
|
if (ctx.elements.tree.length === 0) {
|
|
1855
2042
|
return { status: "skipped", reason: (0, import_i18n23.__)("No elements", "elementor") };
|
|
1856
2043
|
}
|
|
1857
|
-
const widgetsCache = (0,
|
|
2044
|
+
const widgetsCache = (0, import_editor_elements8.getWidgetsCache)();
|
|
1858
2045
|
const violations = [];
|
|
1859
2046
|
walkElements(ctx.elements.tree, (node, parents) => {
|
|
1860
2047
|
if (!isNestingElement(node, widgetsCache)) {
|
|
@@ -1905,7 +2092,7 @@ var audit6 = {
|
|
|
1905
2092
|
};
|
|
1906
2093
|
|
|
1907
2094
|
// src/audits/deprecated-widgets.ts
|
|
1908
|
-
var
|
|
2095
|
+
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
1909
2096
|
var import_i18n25 = require("@wordpress/i18n");
|
|
1910
2097
|
var DEPRECATION_CONTROL_NAME = "deprecation_message";
|
|
1911
2098
|
var audit7 = {
|
|
@@ -1920,7 +2107,7 @@ var audit7 = {
|
|
|
1920
2107
|
severity: "warning",
|
|
1921
2108
|
weight: 7,
|
|
1922
2109
|
evaluate: (ctx) => {
|
|
1923
|
-
const widgetsCache = (0,
|
|
2110
|
+
const widgetsCache = (0, import_editor_elements9.getWidgetsCache)();
|
|
1924
2111
|
if (!widgetsCache) {
|
|
1925
2112
|
return { status: "skipped", reason: "widgets-cache-unavailable" };
|
|
1926
2113
|
}
|
|
@@ -2008,6 +2195,7 @@ var audit8 = {
|
|
|
2008
2195
|
auditId: audit8.id,
|
|
2009
2196
|
label,
|
|
2010
2197
|
ctaLabel: (0, import_i18n26.__)("Enable", "elementor"),
|
|
2198
|
+
appInstalled: true,
|
|
2011
2199
|
externalUrl: ctx.pageContext.cookiez_consent_mode_settings_url
|
|
2012
2200
|
}
|
|
2013
2201
|
]
|
|
@@ -2351,7 +2539,8 @@ var audit11 = {
|
|
|
2351
2539
|
targetHint: "element-settings",
|
|
2352
2540
|
label: (0, import_i18n29.__)("Image is missing alt text.", "elementor"),
|
|
2353
2541
|
externalUrl: isReady ? ctx.pageContext.ally_scan_url : ctx.pageContext.ally_plugin_url,
|
|
2354
|
-
ctaLabel: (0, import_i18n29.__)("Fix with Ally", "elementor")
|
|
2542
|
+
ctaLabel: (0, import_i18n29.__)("Fix with Ally", "elementor"),
|
|
2543
|
+
appInstalled: isReady
|
|
2355
2544
|
});
|
|
2356
2545
|
}
|
|
2357
2546
|
});
|
|
@@ -2400,7 +2589,8 @@ var audit12 = {
|
|
|
2400
2589
|
targetHint: "element-settings",
|
|
2401
2590
|
label: (0, import_i18n30.__)("Image isn't served in a modern format like WebP or AVIF.", "elementor"),
|
|
2402
2591
|
externalUrl: isReady ? ctx.pageContext.image_optimization_settings_url : ctx.pageContext.image_optimization_plugin_url,
|
|
2403
|
-
ctaLabel: (0, import_i18n30.__)("Optimize all", "elementor")
|
|
2592
|
+
ctaLabel: (0, import_i18n30.__)("Optimize all", "elementor"),
|
|
2593
|
+
appInstalled: isReady
|
|
2404
2594
|
}));
|
|
2405
2595
|
return violations.length === 0 ? { status: "pass" } : { status: "fail", violations, metadata: { inefficientImageFormatCount } };
|
|
2406
2596
|
}
|
|
@@ -2454,7 +2644,8 @@ var audit13 = {
|
|
|
2454
2644
|
kb
|
|
2455
2645
|
),
|
|
2456
2646
|
externalUrl: isReady ? ctx.pageContext.image_optimization_settings_url : ctx.pageContext.image_optimization_plugin_url,
|
|
2457
|
-
ctaLabel: (0, import_i18n31.__)("Optimize all", "elementor")
|
|
2647
|
+
ctaLabel: (0, import_i18n31.__)("Optimize all", "elementor"),
|
|
2648
|
+
appInstalled: isReady
|
|
2458
2649
|
}));
|
|
2459
2650
|
return violations.length === 0 ? { status: "pass" } : { status: "fail", violations, metadata: { oversizedImageCount } };
|
|
2460
2651
|
}
|
|
@@ -2895,7 +3086,8 @@ var audit22 = {
|
|
|
2895
3086
|
{
|
|
2896
3087
|
auditId: audit22.id,
|
|
2897
3088
|
label: (0, import_i18n40.__)("This page has not been scanned for cookies yet.", "elementor"),
|
|
2898
|
-
externalUrl: isReady ? ctx.pageContext.cookiez_scan_url : ctx.pageContext.cookiez_plugin_action_url
|
|
3089
|
+
externalUrl: isReady ? ctx.pageContext.cookiez_scan_url : ctx.pageContext.cookiez_plugin_action_url,
|
|
3090
|
+
appInstalled: isReady
|
|
2899
3091
|
}
|
|
2900
3092
|
]
|
|
2901
3093
|
};
|
|
@@ -3023,19 +3215,19 @@ function registerAllAudits() {
|
|
|
3023
3215
|
|
|
3024
3216
|
// src/sync-report-staleness.ts
|
|
3025
3217
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
3026
|
-
var
|
|
3218
|
+
var import_store8 = require("@elementor/store");
|
|
3027
3219
|
function syncReportStaleness() {
|
|
3028
3220
|
(0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.commandEndEvent)("document/save/set-is-modified"), (e) => {
|
|
3029
3221
|
const event = e;
|
|
3030
3222
|
if (event.args?.status) {
|
|
3031
|
-
(0,
|
|
3223
|
+
(0, import_store8.__dispatch)(slice.actions.reportStale());
|
|
3032
3224
|
}
|
|
3033
3225
|
});
|
|
3034
3226
|
}
|
|
3035
3227
|
|
|
3036
3228
|
// src/init.ts
|
|
3037
3229
|
function init() {
|
|
3038
|
-
(0,
|
|
3230
|
+
(0, import_store9.__registerSlice)(slice);
|
|
3039
3231
|
registerAllAudits();
|
|
3040
3232
|
(0, import_editor_floating_panels6.registerFloatingPanel)(auditPanel.panel);
|
|
3041
3233
|
registerAppBarAuditsToggle();
|