@elementor/editor-audits 4.4.0-beta3 → 4.4.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.
- 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.mjs
CHANGED
|
@@ -92,7 +92,7 @@ import { createFloatingPanel } from "@elementor/editor-floating-panels";
|
|
|
92
92
|
|
|
93
93
|
// src/components/audit-panel.tsx
|
|
94
94
|
import * as React21 from "react";
|
|
95
|
-
import { getHostDocumentId as
|
|
95
|
+
import { getHostDocumentId as getHostDocumentId4 } from "@elementor/editor-elements";
|
|
96
96
|
import { FloatingPanelBody, FloatingPanelFooter, FloatingPanelHeader } from "@elementor/editor-floating-panels";
|
|
97
97
|
import { Box as Box15, Typography as Typography12 } from "@elementor/ui";
|
|
98
98
|
import { __ as __17 } from "@wordpress/i18n";
|
|
@@ -101,14 +101,22 @@ import { __ as __17 } from "@wordpress/i18n";
|
|
|
101
101
|
import { __ } from "@wordpress/i18n";
|
|
102
102
|
var AUDIT_PANEL_ID = "audit-panel";
|
|
103
103
|
var REPORT_STORAGE_KEY_PREFIX = "elementor/audits/report";
|
|
104
|
-
var CREATE_WIDGET_EVENT = "elementor/editor/create-widget";
|
|
105
|
-
var ANGIE_FIX_ENTRY_POINT = "audit_violation";
|
|
106
104
|
var FEEDBACK_EXPERIMENT_NAME = "in_editor_feedback";
|
|
107
105
|
var FEEDBACK_ENTRY_POINT = "audit_panel";
|
|
108
106
|
var FEEDBACK_CLICKED_EVENT = "audit_feedback_clicked";
|
|
109
107
|
var FEEDBACK_SENT_EVENT = "audit_feedback_sent";
|
|
110
108
|
var FEEDBACK_CANCELLED_EVENT = "audit_feedback_cancelled";
|
|
111
109
|
var FEEDBACK_CLOSED_EVENT = "audit_feedback_closed";
|
|
110
|
+
var PANEL_VIEWED_EVENT = "page_audit_panel_viewed";
|
|
111
|
+
var PANEL_CLOSED_EVENT = "page_audit_panel_closed";
|
|
112
|
+
var RUN_STARTED_EVENT = "page_audit_run_started";
|
|
113
|
+
var RUN_COMPLETED_EVENT = "page_audit_run_completed";
|
|
114
|
+
var FINDING_CLICKED_EVENT = "page_audit_finding_clicked";
|
|
115
|
+
var TRACKING_WINDOW_NAME = "page_audit";
|
|
116
|
+
var TRACKING_TARGET_LOCATION = "panel";
|
|
117
|
+
var TRACKING_LOCATION_L1 = "audit_panel";
|
|
118
|
+
var FIRST_OPEN_MESSAGE_KEY = "page-audit-panel-opened";
|
|
119
|
+
var AUDIT_ID_PREFIX = "audits/";
|
|
112
120
|
var ALL_CATEGORIES = [
|
|
113
121
|
"best-practices",
|
|
114
122
|
"seo",
|
|
@@ -636,13 +644,125 @@ function persistReport(documentId, report) {
|
|
|
636
644
|
setSessionStorageItem(getStorageKey(documentId), report);
|
|
637
645
|
}
|
|
638
646
|
|
|
647
|
+
// src/utils/tracking.ts
|
|
648
|
+
import { getMixpanel } from "@elementor/events";
|
|
649
|
+
|
|
650
|
+
// src/utils/tracking-names.ts
|
|
651
|
+
function toTrackingSeverity(severity) {
|
|
652
|
+
return severity === "info" ? "suggestion" : severity;
|
|
653
|
+
}
|
|
654
|
+
function toCheckName(auditId) {
|
|
655
|
+
return auditId.replace(AUDIT_ID_PREFIX, "").replace(/-/g, "_");
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// src/utils/build-run-summary.ts
|
|
659
|
+
var SEVERITY_PRIORITY = ["error", "warning", "suggestion"];
|
|
660
|
+
function buildRunSummary(report) {
|
|
661
|
+
const requiredFixes = report.auditResults.filter(({ audit: audit25, result }) => result.status === "fail" && isScoredAudit(audit25)).map(({ audit: audit25 }) => ({ check: toCheckName(audit25.id), severity: toTrackingSeverity(audit25.severity) }));
|
|
662
|
+
const countBySeverity = (severity) => requiredFixes.filter((fix) => fix.severity === severity).length;
|
|
663
|
+
const highestSeverity = SEVERITY_PRIORITY.find((severity) => countBySeverity(severity) > 0);
|
|
664
|
+
return {
|
|
665
|
+
state: highestSeverity ?? "success",
|
|
666
|
+
metadata: {
|
|
667
|
+
score: report.overall,
|
|
668
|
+
fix_count: requiredFixes.length,
|
|
669
|
+
error_count: countBySeverity("error"),
|
|
670
|
+
warning_count: countBySeverity("warning"),
|
|
671
|
+
suggestion_count: countBySeverity("suggestion"),
|
|
672
|
+
required_fixes: requiredFixes
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// src/utils/tracking.ts
|
|
678
|
+
var dispatch = (eventName, payload) => {
|
|
679
|
+
getMixpanel().dispatchEvent?.(eventName, {
|
|
680
|
+
window_name: TRACKING_WINDOW_NAME,
|
|
681
|
+
target_location: TRACKING_TARGET_LOCATION,
|
|
682
|
+
location_l1: TRACKING_LOCATION_L1,
|
|
683
|
+
...payload
|
|
684
|
+
});
|
|
685
|
+
};
|
|
686
|
+
var trackPanelViewed = ({
|
|
687
|
+
hasPriorReport,
|
|
688
|
+
isFirstOpen
|
|
689
|
+
}) => {
|
|
690
|
+
dispatch(PANEL_VIEWED_EVENT, {
|
|
691
|
+
interaction_type: "view",
|
|
692
|
+
target_type: "panel",
|
|
693
|
+
target_name: "page_audit_panel",
|
|
694
|
+
interaction_result: "panel_viewed",
|
|
695
|
+
metadata: { has_prior_report: hasPriorReport, is_first_open: isFirstOpen }
|
|
696
|
+
});
|
|
697
|
+
};
|
|
698
|
+
var trackPanelClosed = () => {
|
|
699
|
+
dispatch(PANEL_CLOSED_EVENT, {
|
|
700
|
+
interaction_type: "click",
|
|
701
|
+
target_type: "button",
|
|
702
|
+
target_name: "close",
|
|
703
|
+
interaction_result: "panel_closed"
|
|
704
|
+
});
|
|
705
|
+
};
|
|
706
|
+
var trackRunStarted = (trigger) => {
|
|
707
|
+
dispatch(RUN_STARTED_EVENT, {
|
|
708
|
+
interaction_type: "click",
|
|
709
|
+
target_type: "button",
|
|
710
|
+
target_name: trigger,
|
|
711
|
+
interaction_result: "run_initiated"
|
|
712
|
+
});
|
|
713
|
+
};
|
|
714
|
+
var trackRunOutcome = (interactionResult, details) => {
|
|
715
|
+
dispatch(RUN_COMPLETED_EVENT, {
|
|
716
|
+
interaction_type: "view",
|
|
717
|
+
target_type: "report",
|
|
718
|
+
target_name: "audit_report",
|
|
719
|
+
interaction_result: interactionResult,
|
|
720
|
+
...details
|
|
721
|
+
});
|
|
722
|
+
};
|
|
723
|
+
var trackRunCompleted = (report) => {
|
|
724
|
+
const { state, metadata } = buildRunSummary(report);
|
|
725
|
+
trackRunOutcome("run_completed", { state, metadata });
|
|
726
|
+
};
|
|
727
|
+
var trackRunFailed = () => {
|
|
728
|
+
trackRunOutcome("run_failed", {});
|
|
729
|
+
};
|
|
730
|
+
var trackFixWithApp = (audit25, violation, locationL2) => {
|
|
731
|
+
if (violation.appInstalled === void 0) {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
trackFindingClicked({
|
|
735
|
+
audit: audit25,
|
|
736
|
+
locationL2,
|
|
737
|
+
actionType: "fix_with_app",
|
|
738
|
+
interactionResult: "app_opened",
|
|
739
|
+
appInstalled: violation.appInstalled
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
var trackFindingClicked = (click) => {
|
|
743
|
+
const { audit: audit25, locationL2, actionType, interactionResult } = click;
|
|
744
|
+
dispatch(FINDING_CLICKED_EVENT, {
|
|
745
|
+
interaction_type: "click",
|
|
746
|
+
target_type: "row",
|
|
747
|
+
target_name: "finding_row",
|
|
748
|
+
action_type: actionType,
|
|
749
|
+
target_value: toCheckName(audit25.id),
|
|
750
|
+
interaction_result: interactionResult,
|
|
751
|
+
state: toTrackingSeverity(audit25.severity),
|
|
752
|
+
location_l2: locationL2,
|
|
753
|
+
...click.actionType === "fix_with_app" && {
|
|
754
|
+
app_status: click.appInstalled ? "installed" : "not_installed"
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
};
|
|
758
|
+
|
|
639
759
|
// src/hooks/use-audit-report.ts
|
|
640
760
|
function useAuditReport() {
|
|
641
761
|
const status = useSelector2((state) => selectStatus(state));
|
|
642
762
|
const report = useSelector2((state) => selectReport(state));
|
|
643
763
|
const error = useSelector2((state) => selectError(state));
|
|
644
764
|
const isStale = useSelector2((state) => selectIsStale(state));
|
|
645
|
-
const
|
|
765
|
+
const dispatch3 = useDispatch();
|
|
646
766
|
const documentId = getHostDocumentId2() ?? 0;
|
|
647
767
|
useEffect(() => {
|
|
648
768
|
if (!documentId || report?.documentId === documentId) {
|
|
@@ -650,31 +770,59 @@ function useAuditReport() {
|
|
|
650
770
|
}
|
|
651
771
|
const persisted = getPersistedReport(documentId);
|
|
652
772
|
if (persisted) {
|
|
653
|
-
|
|
773
|
+
dispatch3(slice.actions.reportRestored(persisted));
|
|
654
774
|
} else if (report) {
|
|
655
|
-
|
|
775
|
+
dispatch3(slice.actions.reportCleared());
|
|
656
776
|
}
|
|
657
|
-
}, [documentId, report,
|
|
658
|
-
const run = async (documentIdToRun) => {
|
|
659
|
-
|
|
777
|
+
}, [documentId, report, dispatch3]);
|
|
778
|
+
const run = async (documentIdToRun, trigger) => {
|
|
779
|
+
dispatch3(slice.actions.runStarted());
|
|
780
|
+
trackRunStarted(trigger);
|
|
660
781
|
try {
|
|
661
782
|
const nextReport = await runPageAudit(documentIdToRun);
|
|
662
|
-
|
|
783
|
+
dispatch3(slice.actions.runSucceeded(nextReport));
|
|
663
784
|
persistReport(documentIdToRun, nextReport);
|
|
785
|
+
trackRunCompleted(nextReport);
|
|
664
786
|
} catch (e) {
|
|
665
787
|
if (e instanceof SessionExpiredError) {
|
|
666
|
-
|
|
788
|
+
dispatch3(slice.actions.runAborted());
|
|
789
|
+
trackRunFailed();
|
|
667
790
|
return;
|
|
668
791
|
}
|
|
669
|
-
|
|
792
|
+
dispatch3(slice.actions.runFailed(e instanceof Error ? e.message : "Unknown error"));
|
|
793
|
+
trackRunFailed();
|
|
670
794
|
}
|
|
671
795
|
};
|
|
672
796
|
return { status, report, error, isStale, run };
|
|
673
797
|
}
|
|
674
798
|
|
|
799
|
+
// src/hooks/use-track-panel-viewed.ts
|
|
800
|
+
import { useEffect as useEffect2, useRef, useState } from "react";
|
|
801
|
+
import { useCurrentUser, useSuppressedMessage } from "@elementor/editor-current-user";
|
|
802
|
+
import { getHostDocumentId as getHostDocumentId3 } from "@elementor/editor-elements";
|
|
803
|
+
import { __useSelector as useSelector3 } from "@elementor/store";
|
|
804
|
+
function useTrackPanelViewed() {
|
|
805
|
+
const { data: currentUser } = useCurrentUser();
|
|
806
|
+
const [isFirstOpenMessageSuppressed, suppressFirstOpenMessage] = useSuppressedMessage(FIRST_OPEN_MESSAGE_KEY);
|
|
807
|
+
const report = useSelector3((state) => selectReport(state));
|
|
808
|
+
const [hasPriorReport] = useState(() => {
|
|
809
|
+
const documentId = getHostDocumentId3() ?? 0;
|
|
810
|
+
return Boolean(report) || Boolean(documentId && getPersistedReport(documentId));
|
|
811
|
+
});
|
|
812
|
+
const hasTracked = useRef(false);
|
|
813
|
+
useEffect2(() => {
|
|
814
|
+
if (!currentUser || hasTracked.current) {
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
hasTracked.current = true;
|
|
818
|
+
trackPanelViewed({ hasPriorReport, isFirstOpen: !isFirstOpenMessageSuppressed });
|
|
819
|
+
suppressFirstOpenMessage();
|
|
820
|
+
}, [currentUser, hasPriorReport, isFirstOpenMessageSuppressed, suppressFirstOpenMessage]);
|
|
821
|
+
}
|
|
822
|
+
|
|
675
823
|
// src/components/audit-feedback.tsx
|
|
676
824
|
import * as React2 from "react";
|
|
677
|
-
import { useState } from "react";
|
|
825
|
+
import { useState as useState2 } from "react";
|
|
678
826
|
import { useFloatingPanelZIndex } from "@elementor/editor-floating-panels";
|
|
679
827
|
import { notify } from "@elementor/editor-notifications";
|
|
680
828
|
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
@@ -713,9 +861,9 @@ var notifyError = () => notify({
|
|
|
713
861
|
message: __2("Something went wrong. Please try sending your feedback again.", "elementor")
|
|
714
862
|
});
|
|
715
863
|
function AuditFeedback() {
|
|
716
|
-
const [isOpen, setIsOpen] =
|
|
717
|
-
const [feedbackText, setFeedbackText] =
|
|
718
|
-
const [isSubmitting, setIsSubmitting] =
|
|
864
|
+
const [isOpen, setIsOpen] = useState2(false);
|
|
865
|
+
const [feedbackText, setFeedbackText] = useState2("");
|
|
866
|
+
const [isSubmitting, setIsSubmitting] = useState2(false);
|
|
719
867
|
const { dispatchEvent: trackEvent = (...args) => void args } = useMixpanel();
|
|
720
868
|
const panelZIndex = useFloatingPanelZIndex(AUDIT_PANEL_ID);
|
|
721
869
|
if (!isExperimentActive(FEEDBACK_EXPERIMENT_NAME)) {
|
|
@@ -854,7 +1002,7 @@ function WelcomePage() {
|
|
|
854
1002
|
|
|
855
1003
|
// src/components/report-shell.tsx
|
|
856
1004
|
import * as React19 from "react";
|
|
857
|
-
import { useState as
|
|
1005
|
+
import { useState as useState5 } from "react";
|
|
858
1006
|
import { Box as Box14 } from "@elementor/ui";
|
|
859
1007
|
|
|
860
1008
|
// src/components/pages/category-page.tsx
|
|
@@ -863,9 +1011,9 @@ import { Box as Box8 } from "@elementor/ui";
|
|
|
863
1011
|
import { __ as __11 } from "@wordpress/i18n";
|
|
864
1012
|
|
|
865
1013
|
// src/hooks/use-single-expanded-card.ts
|
|
866
|
-
import { useState as
|
|
1014
|
+
import { useState as useState3 } from "react";
|
|
867
1015
|
function useSingleExpandedCard(initialId = null) {
|
|
868
|
-
const [expandedId, setExpandedId] =
|
|
1016
|
+
const [expandedId, setExpandedId] = useState3(initialId);
|
|
869
1017
|
const toggle = (id) => {
|
|
870
1018
|
setExpandedId((current) => current === id ? null : id);
|
|
871
1019
|
};
|
|
@@ -884,12 +1032,12 @@ var CATEGORY_ICONS = {
|
|
|
884
1032
|
|
|
885
1033
|
// src/components/status-section.tsx
|
|
886
1034
|
import * as React6 from "react";
|
|
887
|
-
import { useState as
|
|
1035
|
+
import { useState as useState4 } from "react";
|
|
888
1036
|
import { ChevronDownIcon } from "@elementor/icons";
|
|
889
1037
|
import { Box as Box4, Chip, Collapse, IconButton as IconButton2 } from "@elementor/ui";
|
|
890
1038
|
import { __ as __6 } from "@wordpress/i18n";
|
|
891
1039
|
function StatusSection({ label, count, color = "default", defaultExpanded = false, children }) {
|
|
892
|
-
const [expanded, setExpanded] =
|
|
1040
|
+
const [expanded, setExpanded] = useState4(defaultExpanded);
|
|
893
1041
|
if (React6.Children.count(children) === 0) {
|
|
894
1042
|
return null;
|
|
895
1043
|
}
|
|
@@ -955,25 +1103,27 @@ function focusViolation(violation) {
|
|
|
955
1103
|
if (violation.targetHint === "element-settings") {
|
|
956
1104
|
runCommand("panel/editor/open");
|
|
957
1105
|
}
|
|
958
|
-
return;
|
|
1106
|
+
return container ? "element_focused" : null;
|
|
959
1107
|
}
|
|
960
1108
|
if (violation.externalUrl) {
|
|
961
1109
|
window.open(violation.externalUrl, "_blank");
|
|
962
|
-
return;
|
|
1110
|
+
return "external_url_opened";
|
|
963
1111
|
}
|
|
964
1112
|
if (violation.targetHint === "page-settings") {
|
|
965
1113
|
openRoute("panel/page-settings/settings");
|
|
966
|
-
return;
|
|
1114
|
+
return "page_settings_opened";
|
|
967
1115
|
}
|
|
968
1116
|
if (violation.targetHint === "site-settings") {
|
|
969
1117
|
runCommand("panel/global/open");
|
|
970
|
-
return;
|
|
1118
|
+
return "site_settings_opened";
|
|
971
1119
|
}
|
|
972
1120
|
if (violation.targetHint === "site-identity-settings") {
|
|
973
1121
|
void runCommand("panel/global/open").then(() => {
|
|
974
1122
|
openRoute("panel/global/settings-site-identity");
|
|
975
1123
|
});
|
|
1124
|
+
return "site_settings_opened";
|
|
976
1125
|
}
|
|
1126
|
+
return null;
|
|
977
1127
|
}
|
|
978
1128
|
|
|
979
1129
|
// src/utils/build-angie-prompt.ts
|
|
@@ -1002,24 +1152,22 @@ import { isAngieAvailable, sendPromptToAngie } from "@elementor/editor-mcp";
|
|
|
1002
1152
|
import { AngieIcon } from "@elementor/icons";
|
|
1003
1153
|
import { Button as Button3, IconButton as IconButton4, Tooltip as Tooltip2 } from "@elementor/ui";
|
|
1004
1154
|
import { __ as __9 } from "@wordpress/i18n";
|
|
1005
|
-
function FixViolationWithAngie({ prompt, panelZIndex, variant = "icon" }) {
|
|
1155
|
+
function FixViolationWithAngie({ audit: audit25, prompt, panelZIndex, variant = "icon" }) {
|
|
1156
|
+
if (!isAngieAvailable()) {
|
|
1157
|
+
return null;
|
|
1158
|
+
}
|
|
1006
1159
|
const label = __9("Fix with Angie", "elementor");
|
|
1007
1160
|
const href = `#angie-prompt=${encodeURIComponent(prompt)}`;
|
|
1008
1161
|
const handleClick = (event) => {
|
|
1009
1162
|
event.stopPropagation();
|
|
1010
1163
|
event.preventDefault();
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
entry_point: ANGIE_FIX_ENTRY_POINT,
|
|
1019
|
-
prompt
|
|
1020
|
-
}
|
|
1021
|
-
})
|
|
1022
|
-
);
|
|
1164
|
+
sendPromptToAngie(prompt);
|
|
1165
|
+
trackFindingClicked({
|
|
1166
|
+
audit: audit25,
|
|
1167
|
+
locationL2: "issues",
|
|
1168
|
+
actionType: "fix_with_angie",
|
|
1169
|
+
interactionResult: "angie_prompt_sent"
|
|
1170
|
+
});
|
|
1023
1171
|
};
|
|
1024
1172
|
if (variant === "button") {
|
|
1025
1173
|
return /* @__PURE__ */ React8.createElement(
|
|
@@ -1058,11 +1206,18 @@ function SeverityIcon({ severity }) {
|
|
|
1058
1206
|
import * as React10 from "react";
|
|
1059
1207
|
import { WandIcon } from "@elementor/icons";
|
|
1060
1208
|
import { Button as Button4 } from "@elementor/ui";
|
|
1061
|
-
function ViolationCtaButton({
|
|
1209
|
+
function ViolationCtaButton({
|
|
1210
|
+
ctaLabel,
|
|
1211
|
+
externalUrl,
|
|
1212
|
+
variant = "outlined",
|
|
1213
|
+
withIcon = false,
|
|
1214
|
+
onOpen
|
|
1215
|
+
}) {
|
|
1062
1216
|
const handleClick = (event) => {
|
|
1063
1217
|
event.stopPropagation();
|
|
1064
1218
|
event.preventDefault();
|
|
1065
1219
|
window.open(externalUrl, "_blank", "noopener");
|
|
1220
|
+
onOpen?.();
|
|
1066
1221
|
};
|
|
1067
1222
|
return /* @__PURE__ */ React10.createElement(
|
|
1068
1223
|
Button4,
|
|
@@ -1113,6 +1268,7 @@ function StatusIndicator({ audit: audit25, violations }) {
|
|
|
1113
1268
|
return /* @__PURE__ */ React12.createElement(CheckIcon, { fontSize: "small", color: "success" });
|
|
1114
1269
|
}
|
|
1115
1270
|
function GuidanceAction({
|
|
1271
|
+
audit: audit25,
|
|
1116
1272
|
violation,
|
|
1117
1273
|
sharedAngiePrompt,
|
|
1118
1274
|
panelZIndex
|
|
@@ -1126,7 +1282,8 @@ function GuidanceAction({
|
|
|
1126
1282
|
{
|
|
1127
1283
|
ctaLabel: violation.ctaLabel,
|
|
1128
1284
|
externalUrl: violation.externalUrl,
|
|
1129
|
-
withIcon: true
|
|
1285
|
+
withIcon: true,
|
|
1286
|
+
onOpen: () => trackFixWithApp(audit25, violation, "issues")
|
|
1130
1287
|
}
|
|
1131
1288
|
), hasPrimaryCta && violation.secondaryCtaLabel && violation.secondaryCtaUrl && /* @__PURE__ */ React12.createElement(
|
|
1132
1289
|
ViolationCtaButton,
|
|
@@ -1135,7 +1292,15 @@ function GuidanceAction({
|
|
|
1135
1292
|
externalUrl: violation.secondaryCtaUrl,
|
|
1136
1293
|
variant: "text"
|
|
1137
1294
|
}
|
|
1138
|
-
), sharedAngiePrompt && /* @__PURE__ */ React12.createElement(
|
|
1295
|
+
), sharedAngiePrompt && /* @__PURE__ */ React12.createElement(
|
|
1296
|
+
FixViolationWithAngie,
|
|
1297
|
+
{
|
|
1298
|
+
audit: audit25,
|
|
1299
|
+
prompt: sharedAngiePrompt,
|
|
1300
|
+
panelZIndex,
|
|
1301
|
+
variant: "button"
|
|
1302
|
+
}
|
|
1303
|
+
));
|
|
1139
1304
|
}
|
|
1140
1305
|
function getSharedAngiePrompt(violations) {
|
|
1141
1306
|
if (!violations || violations.length < 2) {
|
|
@@ -1155,9 +1320,20 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1155
1320
|
const isGuidanceFocusable = !!primaryViolation;
|
|
1156
1321
|
const panelZIndex = useFloatingPanelZIndex2(AUDIT_PANEL_ID);
|
|
1157
1322
|
const sharedAngiePrompt = getSharedAngiePrompt(violations);
|
|
1323
|
+
const viewIssue = (violation) => {
|
|
1324
|
+
const interactionResult = focusViolation(violation);
|
|
1325
|
+
if (interactionResult) {
|
|
1326
|
+
trackFindingClicked({
|
|
1327
|
+
audit: audit25,
|
|
1328
|
+
locationL2: "issues",
|
|
1329
|
+
actionType: "view_issue",
|
|
1330
|
+
interactionResult
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1158
1334
|
const handleGuidanceClick = () => {
|
|
1159
1335
|
if (isGuidanceFocusable && primaryViolation) {
|
|
1160
|
-
|
|
1336
|
+
viewIssue(primaryViolation);
|
|
1161
1337
|
}
|
|
1162
1338
|
};
|
|
1163
1339
|
return /* @__PURE__ */ React12.createElement(Box7, { sx: { borderBottom: 1, borderColor: "divider", paddingBlock: 0.5 } }, /* @__PURE__ */ React12.createElement(Box7, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React12.createElement(
|
|
@@ -1207,6 +1383,7 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1207
1383
|
primaryViolation && /* @__PURE__ */ React12.createElement(
|
|
1208
1384
|
GuidanceAction,
|
|
1209
1385
|
{
|
|
1386
|
+
audit: audit25,
|
|
1210
1387
|
violation: primaryViolation,
|
|
1211
1388
|
sharedAngiePrompt,
|
|
1212
1389
|
panelZIndex
|
|
@@ -1224,8 +1401,8 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1224
1401
|
key: idx,
|
|
1225
1402
|
role: "button",
|
|
1226
1403
|
tabIndex: 0,
|
|
1227
|
-
onClick: () =>
|
|
1228
|
-
onKeyDown: onKeyboardClick(() =>
|
|
1404
|
+
onClick: () => viewIssue(violation),
|
|
1405
|
+
onKeyDown: onKeyboardClick(() => viewIssue(violation)),
|
|
1229
1406
|
sx: {
|
|
1230
1407
|
display: "flex",
|
|
1231
1408
|
alignItems: "center",
|
|
@@ -1251,6 +1428,7 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1251
1428
|
/* @__PURE__ */ React12.createElement(
|
|
1252
1429
|
FixViolationWithAngie,
|
|
1253
1430
|
{
|
|
1431
|
+
audit: audit25,
|
|
1254
1432
|
prompt: violation.angiePrompt ?? buildAngiePrompt(angiePromptContext),
|
|
1255
1433
|
panelZIndex
|
|
1256
1434
|
}
|
|
@@ -1514,8 +1692,12 @@ function Promotions({ report }) {
|
|
|
1514
1692
|
ctaLabel: config.ctaLabel,
|
|
1515
1693
|
ctaDisabled: !ctaUrl,
|
|
1516
1694
|
onCtaClick: () => {
|
|
1517
|
-
if (ctaUrl) {
|
|
1518
|
-
|
|
1695
|
+
if (!ctaUrl) {
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
window.open(ctaUrl, "_blank", "noopener");
|
|
1699
|
+
if (run.result.status === "fail") {
|
|
1700
|
+
trackFixWithApp(run.audit, run.result.violations[0], "overview");
|
|
1519
1701
|
}
|
|
1520
1702
|
}
|
|
1521
1703
|
}
|
|
@@ -1568,7 +1750,7 @@ function isCategoryPage(page) {
|
|
|
1568
1750
|
return typeof page === "object" && "category" in page;
|
|
1569
1751
|
}
|
|
1570
1752
|
function ReportShell({ report }) {
|
|
1571
|
-
const [activePage, setActivePage] =
|
|
1753
|
+
const [activePage, setActivePage] = useState5("overview");
|
|
1572
1754
|
const openCategory = (category) => setActivePage({ category });
|
|
1573
1755
|
const backToOverview = () => setActivePage("overview");
|
|
1574
1756
|
return /* @__PURE__ */ React19.createElement(Box14, { 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 }));
|
|
@@ -1606,8 +1788,9 @@ function RescanButton({ hasScanned, isStale, disabled, onClick }) {
|
|
|
1606
1788
|
// src/components/audit-panel.tsx
|
|
1607
1789
|
function AuditPanel() {
|
|
1608
1790
|
const { status, report, error, isStale, run } = useAuditReport();
|
|
1609
|
-
|
|
1610
|
-
const
|
|
1791
|
+
useTrackPanelViewed();
|
|
1792
|
+
const hostDocumentId = getHostDocumentId4() ?? 0;
|
|
1793
|
+
const onRun = () => run(hostDocumentId, report ? "rescan" : "run_audit");
|
|
1611
1794
|
const lastScanLabel = report ? new Date(report.runAt).toLocaleTimeString() : null;
|
|
1612
1795
|
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
1613
1796
|
FloatingPanelHeader,
|
|
@@ -1615,7 +1798,8 @@ function AuditPanel() {
|
|
|
1615
1798
|
panelId: AUDIT_PANEL_ID,
|
|
1616
1799
|
title: __17("Page Audit", "elementor"),
|
|
1617
1800
|
badge: __17("Beta", "elementor"),
|
|
1618
|
-
titleVariant: "subtitle2"
|
|
1801
|
+
titleVariant: "subtitle2",
|
|
1802
|
+
onClose: trackPanelClosed
|
|
1619
1803
|
}
|
|
1620
1804
|
), /* @__PURE__ */ React21.createElement(
|
|
1621
1805
|
FloatingPanelBody,
|
|
@@ -1732,7 +1916,8 @@ var audit2 = {
|
|
|
1732
1916
|
externalUrl: isReady ? ctx.pageContext.ally_accessibility_statement_url : ctx.pageContext.ally_plugin_url,
|
|
1733
1917
|
ctaLabel: __20("Create", "elementor"),
|
|
1734
1918
|
secondaryCtaLabel: __20("Learn more", "elementor"),
|
|
1735
|
-
secondaryCtaUrl: "https://elementor.com/help/start-using-ally/#statement"
|
|
1919
|
+
secondaryCtaUrl: "https://elementor.com/help/start-using-ally/#statement",
|
|
1920
|
+
appInstalled: isReady
|
|
1736
1921
|
}
|
|
1737
1922
|
]
|
|
1738
1923
|
};
|
|
@@ -1775,7 +1960,8 @@ var audit3 = {
|
|
|
1775
1960
|
auditId: audit3.id,
|
|
1776
1961
|
label: __21("No accessibility widget is active on this site.", "elementor"),
|
|
1777
1962
|
externalUrl: isReady ? ctx.pageContext.ally_widget_settings_url : ctx.pageContext.ally_plugin_url,
|
|
1778
|
-
ctaLabel: __21("Activate", "elementor")
|
|
1963
|
+
ctaLabel: __21("Activate", "elementor"),
|
|
1964
|
+
appInstalled: isReady
|
|
1779
1965
|
}
|
|
1780
1966
|
]
|
|
1781
1967
|
};
|
|
@@ -1806,7 +1992,8 @@ var audit4 = {
|
|
|
1806
1992
|
auditId: audit4.id,
|
|
1807
1993
|
label: __22("Cookiez plugin is not installed or active.", "elementor"),
|
|
1808
1994
|
externalUrl: ctx.pageContext.cookiez_plugin_url,
|
|
1809
|
-
ctaLabel: __22("Set up cookie consent", "elementor")
|
|
1995
|
+
ctaLabel: __22("Set up cookie consent", "elementor"),
|
|
1996
|
+
appInstalled: ctx.pageContext.cookiez_plugin_active
|
|
1810
1997
|
}
|
|
1811
1998
|
]
|
|
1812
1999
|
};
|
|
@@ -1992,6 +2179,7 @@ var audit8 = {
|
|
|
1992
2179
|
auditId: audit8.id,
|
|
1993
2180
|
label,
|
|
1994
2181
|
ctaLabel: __26("Enable", "elementor"),
|
|
2182
|
+
appInstalled: true,
|
|
1995
2183
|
externalUrl: ctx.pageContext.cookiez_consent_mode_settings_url
|
|
1996
2184
|
}
|
|
1997
2185
|
]
|
|
@@ -2335,7 +2523,8 @@ var audit11 = {
|
|
|
2335
2523
|
targetHint: "element-settings",
|
|
2336
2524
|
label: __29("Image is missing alt text.", "elementor"),
|
|
2337
2525
|
externalUrl: isReady ? ctx.pageContext.ally_scan_url : ctx.pageContext.ally_plugin_url,
|
|
2338
|
-
ctaLabel: __29("Fix with Ally", "elementor")
|
|
2526
|
+
ctaLabel: __29("Fix with Ally", "elementor"),
|
|
2527
|
+
appInstalled: isReady
|
|
2339
2528
|
});
|
|
2340
2529
|
}
|
|
2341
2530
|
});
|
|
@@ -2384,7 +2573,8 @@ var audit12 = {
|
|
|
2384
2573
|
targetHint: "element-settings",
|
|
2385
2574
|
label: __30("Image isn't served in a modern format like WebP or AVIF.", "elementor"),
|
|
2386
2575
|
externalUrl: isReady ? ctx.pageContext.image_optimization_settings_url : ctx.pageContext.image_optimization_plugin_url,
|
|
2387
|
-
ctaLabel: __30("Optimize all", "elementor")
|
|
2576
|
+
ctaLabel: __30("Optimize all", "elementor"),
|
|
2577
|
+
appInstalled: isReady
|
|
2388
2578
|
}));
|
|
2389
2579
|
return violations.length === 0 ? { status: "pass" } : { status: "fail", violations, metadata: { inefficientImageFormatCount } };
|
|
2390
2580
|
}
|
|
@@ -2438,7 +2628,8 @@ var audit13 = {
|
|
|
2438
2628
|
kb
|
|
2439
2629
|
),
|
|
2440
2630
|
externalUrl: isReady ? ctx.pageContext.image_optimization_settings_url : ctx.pageContext.image_optimization_plugin_url,
|
|
2441
|
-
ctaLabel: __31("Optimize all", "elementor")
|
|
2631
|
+
ctaLabel: __31("Optimize all", "elementor"),
|
|
2632
|
+
appInstalled: isReady
|
|
2442
2633
|
}));
|
|
2443
2634
|
return violations.length === 0 ? { status: "pass" } : { status: "fail", violations, metadata: { oversizedImageCount } };
|
|
2444
2635
|
}
|
|
@@ -2879,7 +3070,8 @@ var audit22 = {
|
|
|
2879
3070
|
{
|
|
2880
3071
|
auditId: audit22.id,
|
|
2881
3072
|
label: __40("This page has not been scanned for cookies yet.", "elementor"),
|
|
2882
|
-
externalUrl: isReady ? ctx.pageContext.cookiez_scan_url : ctx.pageContext.cookiez_plugin_action_url
|
|
3073
|
+
externalUrl: isReady ? ctx.pageContext.cookiez_scan_url : ctx.pageContext.cookiez_plugin_action_url,
|
|
3074
|
+
appInstalled: isReady
|
|
2883
3075
|
}
|
|
2884
3076
|
]
|
|
2885
3077
|
};
|
|
@@ -3007,12 +3199,12 @@ function registerAllAudits() {
|
|
|
3007
3199
|
|
|
3008
3200
|
// src/sync-report-staleness.ts
|
|
3009
3201
|
import { __privateListenTo as listenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
3010
|
-
import { __dispatch as
|
|
3202
|
+
import { __dispatch as dispatch2 } from "@elementor/store";
|
|
3011
3203
|
function syncReportStaleness() {
|
|
3012
3204
|
listenTo(commandEndEvent("document/save/set-is-modified"), (e) => {
|
|
3013
3205
|
const event = e;
|
|
3014
3206
|
if (event.args?.status) {
|
|
3015
|
-
|
|
3207
|
+
dispatch2(slice.actions.reportStale());
|
|
3016
3208
|
}
|
|
3017
3209
|
});
|
|
3018
3210
|
}
|