@elementor/editor-audits 4.4.0-beta2 → 4.4.0-beta3
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 +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +59 -261
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -247
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -16
- package/src/audits/accessibility-statement.ts +0 -1
- package/src/audits/accessibility-widget.ts +0 -1
- package/src/audits/cookie-policy.ts +0 -1
- package/src/audits/google-consent-mode.ts +0 -1
- package/src/audits/images-alt-text.ts +0 -1
- package/src/audits/images-inefficient-format.ts +0 -1
- package/src/audits/images-too-large.ts +0 -1
- package/src/audits/scan-for-cookies.ts +0 -1
- package/src/components/audit-panel.tsx +1 -6
- package/src/components/fix-violation-with-angie.tsx +1 -10
- package/src/components/promotions.tsx +2 -9
- package/src/components/violation-cta-button.tsx +1 -9
- package/src/components/violation-row.tsx +4 -28
- package/src/constants.ts +0 -13
- package/src/hooks/focus-violation.ts +5 -9
- package/src/hooks/use-audit-report.ts +1 -6
- package/src/types.ts +0 -1
- package/src/hooks/use-track-panel-viewed.ts +0 -31
- package/src/utils/build-run-summary.ts +0 -45
- package/src/utils/tracking-names.ts +0 -12
- package/src/utils/tracking.ts +0 -130
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
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_store7 = 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_elements6 = 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");
|
|
@@ -147,16 +147,6 @@ var FEEDBACK_CLICKED_EVENT = "audit_feedback_clicked";
|
|
|
147
147
|
var FEEDBACK_SENT_EVENT = "audit_feedback_sent";
|
|
148
148
|
var FEEDBACK_CANCELLED_EVENT = "audit_feedback_cancelled";
|
|
149
149
|
var FEEDBACK_CLOSED_EVENT = "audit_feedback_closed";
|
|
150
|
-
var PANEL_VIEWED_EVENT = "page_audit_panel_viewed";
|
|
151
|
-
var PANEL_CLOSED_EVENT = "page_audit_panel_closed";
|
|
152
|
-
var RUN_STARTED_EVENT = "page_audit_run_started";
|
|
153
|
-
var RUN_COMPLETED_EVENT = "page_audit_run_completed";
|
|
154
|
-
var FINDING_CLICKED_EVENT = "page_audit_finding_clicked";
|
|
155
|
-
var TRACKING_WINDOW_NAME = "page_audit";
|
|
156
|
-
var TRACKING_TARGET_LOCATION = "panel";
|
|
157
|
-
var TRACKING_LOCATION_L1 = "audit_panel";
|
|
158
|
-
var FIRST_OPEN_MESSAGE_KEY = "page-audit-panel-opened";
|
|
159
|
-
var AUDIT_ID_PREFIX = "audits/";
|
|
160
150
|
var ALL_CATEGORIES = [
|
|
161
151
|
"best-practices",
|
|
162
152
|
"seo",
|
|
@@ -674,125 +664,13 @@ function persistReport(documentId, report) {
|
|
|
674
664
|
(0, import_session.setSessionStorageItem)(getStorageKey(documentId), report);
|
|
675
665
|
}
|
|
676
666
|
|
|
677
|
-
// src/utils/tracking.ts
|
|
678
|
-
var import_events = require("@elementor/events");
|
|
679
|
-
|
|
680
|
-
// src/utils/tracking-names.ts
|
|
681
|
-
function toTrackingSeverity(severity) {
|
|
682
|
-
return severity === "info" ? "suggestion" : severity;
|
|
683
|
-
}
|
|
684
|
-
function toCheckName(auditId) {
|
|
685
|
-
return auditId.replace(AUDIT_ID_PREFIX, "").replace(/-/g, "_");
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
// src/utils/build-run-summary.ts
|
|
689
|
-
var SEVERITY_PRIORITY = ["error", "warning", "suggestion"];
|
|
690
|
-
function buildRunSummary(report) {
|
|
691
|
-
const requiredFixes = report.auditResults.filter(({ audit: audit25, result }) => result.status === "fail" && isScoredAudit(audit25)).map(({ audit: audit25 }) => ({ check: toCheckName(audit25.id), severity: toTrackingSeverity(audit25.severity) }));
|
|
692
|
-
const countBySeverity = (severity) => requiredFixes.filter((fix) => fix.severity === severity).length;
|
|
693
|
-
const highestSeverity = SEVERITY_PRIORITY.find((severity) => countBySeverity(severity) > 0);
|
|
694
|
-
return {
|
|
695
|
-
state: highestSeverity ?? "success",
|
|
696
|
-
metadata: {
|
|
697
|
-
score: report.overall,
|
|
698
|
-
fix_count: requiredFixes.length,
|
|
699
|
-
error_count: countBySeverity("error"),
|
|
700
|
-
warning_count: countBySeverity("warning"),
|
|
701
|
-
suggestion_count: countBySeverity("suggestion"),
|
|
702
|
-
required_fixes: requiredFixes
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
// src/utils/tracking.ts
|
|
708
|
-
var dispatch = (eventName, payload) => {
|
|
709
|
-
(0, import_events.getMixpanel)().dispatchEvent?.(eventName, {
|
|
710
|
-
window_name: TRACKING_WINDOW_NAME,
|
|
711
|
-
target_location: TRACKING_TARGET_LOCATION,
|
|
712
|
-
location_l1: TRACKING_LOCATION_L1,
|
|
713
|
-
...payload
|
|
714
|
-
});
|
|
715
|
-
};
|
|
716
|
-
var trackPanelViewed = ({
|
|
717
|
-
hasPriorReport,
|
|
718
|
-
isFirstOpen
|
|
719
|
-
}) => {
|
|
720
|
-
dispatch(PANEL_VIEWED_EVENT, {
|
|
721
|
-
interaction_type: "view",
|
|
722
|
-
target_type: "panel",
|
|
723
|
-
target_name: "page_audit_panel",
|
|
724
|
-
interaction_result: "panel_viewed",
|
|
725
|
-
metadata: { has_prior_report: hasPriorReport, is_first_open: isFirstOpen }
|
|
726
|
-
});
|
|
727
|
-
};
|
|
728
|
-
var trackPanelClosed = () => {
|
|
729
|
-
dispatch(PANEL_CLOSED_EVENT, {
|
|
730
|
-
interaction_type: "click",
|
|
731
|
-
target_type: "button",
|
|
732
|
-
target_name: "close",
|
|
733
|
-
interaction_result: "panel_closed"
|
|
734
|
-
});
|
|
735
|
-
};
|
|
736
|
-
var trackRunStarted = (trigger) => {
|
|
737
|
-
dispatch(RUN_STARTED_EVENT, {
|
|
738
|
-
interaction_type: "click",
|
|
739
|
-
target_type: "button",
|
|
740
|
-
target_name: trigger,
|
|
741
|
-
interaction_result: "run_initiated"
|
|
742
|
-
});
|
|
743
|
-
};
|
|
744
|
-
var trackRunOutcome = (interactionResult, details) => {
|
|
745
|
-
dispatch(RUN_COMPLETED_EVENT, {
|
|
746
|
-
interaction_type: "view",
|
|
747
|
-
target_type: "report",
|
|
748
|
-
target_name: "audit_report",
|
|
749
|
-
interaction_result: interactionResult,
|
|
750
|
-
...details
|
|
751
|
-
});
|
|
752
|
-
};
|
|
753
|
-
var trackRunCompleted = (report) => {
|
|
754
|
-
const { state, metadata } = buildRunSummary(report);
|
|
755
|
-
trackRunOutcome("run_completed", { state, metadata });
|
|
756
|
-
};
|
|
757
|
-
var trackRunFailed = () => {
|
|
758
|
-
trackRunOutcome("run_failed", {});
|
|
759
|
-
};
|
|
760
|
-
var trackFixWithApp = (audit25, violation, locationL2) => {
|
|
761
|
-
if (violation.appInstalled === void 0) {
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
trackFindingClicked({
|
|
765
|
-
audit: audit25,
|
|
766
|
-
locationL2,
|
|
767
|
-
actionType: "fix_with_app",
|
|
768
|
-
interactionResult: "app_opened",
|
|
769
|
-
appInstalled: violation.appInstalled
|
|
770
|
-
});
|
|
771
|
-
};
|
|
772
|
-
var trackFindingClicked = (click) => {
|
|
773
|
-
const { audit: audit25, locationL2, actionType, interactionResult } = click;
|
|
774
|
-
dispatch(FINDING_CLICKED_EVENT, {
|
|
775
|
-
interaction_type: "click",
|
|
776
|
-
target_type: "row",
|
|
777
|
-
target_name: "finding_row",
|
|
778
|
-
action_type: actionType,
|
|
779
|
-
target_value: toCheckName(audit25.id),
|
|
780
|
-
interaction_result: interactionResult,
|
|
781
|
-
state: toTrackingSeverity(audit25.severity),
|
|
782
|
-
location_l2: locationL2,
|
|
783
|
-
...click.actionType === "fix_with_app" && {
|
|
784
|
-
app_status: click.appInstalled ? "installed" : "not_installed"
|
|
785
|
-
}
|
|
786
|
-
});
|
|
787
|
-
};
|
|
788
|
-
|
|
789
667
|
// src/hooks/use-audit-report.ts
|
|
790
668
|
function useAuditReport() {
|
|
791
669
|
const status = (0, import_store4.__useSelector)((state) => selectStatus(state));
|
|
792
670
|
const report = (0, import_store4.__useSelector)((state) => selectReport(state));
|
|
793
671
|
const error = (0, import_store4.__useSelector)((state) => selectError(state));
|
|
794
672
|
const isStale = (0, import_store4.__useSelector)((state) => selectIsStale(state));
|
|
795
|
-
const
|
|
673
|
+
const dispatch2 = (0, import_store4.__useDispatch)();
|
|
796
674
|
const documentId = (0, import_editor_elements3.getHostDocumentId)() ?? 0;
|
|
797
675
|
(0, import_react.useEffect)(() => {
|
|
798
676
|
if (!documentId || report?.documentId === documentId) {
|
|
@@ -800,63 +678,35 @@ function useAuditReport() {
|
|
|
800
678
|
}
|
|
801
679
|
const persisted = getPersistedReport(documentId);
|
|
802
680
|
if (persisted) {
|
|
803
|
-
|
|
681
|
+
dispatch2(slice.actions.reportRestored(persisted));
|
|
804
682
|
} else if (report) {
|
|
805
|
-
|
|
683
|
+
dispatch2(slice.actions.reportCleared());
|
|
806
684
|
}
|
|
807
|
-
}, [documentId, report,
|
|
808
|
-
const run = async (documentIdToRun
|
|
809
|
-
|
|
810
|
-
trackRunStarted(trigger);
|
|
685
|
+
}, [documentId, report, dispatch2]);
|
|
686
|
+
const run = async (documentIdToRun) => {
|
|
687
|
+
dispatch2(slice.actions.runStarted());
|
|
811
688
|
try {
|
|
812
689
|
const nextReport = await runPageAudit(documentIdToRun);
|
|
813
|
-
|
|
690
|
+
dispatch2(slice.actions.runSucceeded(nextReport));
|
|
814
691
|
persistReport(documentIdToRun, nextReport);
|
|
815
|
-
trackRunCompleted(nextReport);
|
|
816
692
|
} catch (e) {
|
|
817
693
|
if (e instanceof SessionExpiredError) {
|
|
818
|
-
|
|
819
|
-
trackRunFailed();
|
|
694
|
+
dispatch2(slice.actions.runAborted());
|
|
820
695
|
return;
|
|
821
696
|
}
|
|
822
|
-
|
|
823
|
-
trackRunFailed();
|
|
697
|
+
dispatch2(slice.actions.runFailed(e instanceof Error ? e.message : "Unknown error"));
|
|
824
698
|
}
|
|
825
699
|
};
|
|
826
700
|
return { status, report, error, isStale, run };
|
|
827
701
|
}
|
|
828
702
|
|
|
829
|
-
// src/hooks/use-track-panel-viewed.ts
|
|
830
|
-
var import_react2 = require("react");
|
|
831
|
-
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
832
|
-
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
833
|
-
var import_store6 = require("@elementor/store");
|
|
834
|
-
function useTrackPanelViewed() {
|
|
835
|
-
const { data: currentUser } = (0, import_editor_current_user.useCurrentUser)();
|
|
836
|
-
const [isFirstOpenMessageSuppressed, suppressFirstOpenMessage] = (0, import_editor_current_user.useSuppressedMessage)(FIRST_OPEN_MESSAGE_KEY);
|
|
837
|
-
const report = (0, import_store6.__useSelector)((state) => selectReport(state));
|
|
838
|
-
const [hasPriorReport] = (0, import_react2.useState)(() => {
|
|
839
|
-
const documentId = (0, import_editor_elements4.getHostDocumentId)() ?? 0;
|
|
840
|
-
return Boolean(report) || Boolean(documentId && getPersistedReport(documentId));
|
|
841
|
-
});
|
|
842
|
-
const hasTracked = (0, import_react2.useRef)(false);
|
|
843
|
-
(0, import_react2.useEffect)(() => {
|
|
844
|
-
if (!currentUser || hasTracked.current) {
|
|
845
|
-
return;
|
|
846
|
-
}
|
|
847
|
-
hasTracked.current = true;
|
|
848
|
-
trackPanelViewed({ hasPriorReport, isFirstOpen: !isFirstOpenMessageSuppressed });
|
|
849
|
-
suppressFirstOpenMessage();
|
|
850
|
-
}, [currentUser, hasPriorReport, isFirstOpenMessageSuppressed, suppressFirstOpenMessage]);
|
|
851
|
-
}
|
|
852
|
-
|
|
853
703
|
// src/components/audit-feedback.tsx
|
|
854
704
|
var React2 = __toESM(require("react"));
|
|
855
|
-
var
|
|
705
|
+
var import_react2 = require("react");
|
|
856
706
|
var import_editor_floating_panels = require("@elementor/editor-floating-panels");
|
|
857
707
|
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
858
708
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
859
|
-
var
|
|
709
|
+
var import_events = require("@elementor/events");
|
|
860
710
|
var import_http_client2 = require("@elementor/http-client");
|
|
861
711
|
var import_icons2 = require("@elementor/icons");
|
|
862
712
|
var import_ui2 = require("@elementor/ui");
|
|
@@ -879,10 +729,10 @@ var notifyError = () => (0, import_editor_notifications.notify)({
|
|
|
879
729
|
message: (0, import_i18n2.__)("Something went wrong. Please try sending your feedback again.", "elementor")
|
|
880
730
|
});
|
|
881
731
|
function AuditFeedback() {
|
|
882
|
-
const [isOpen, setIsOpen] = (0,
|
|
883
|
-
const [feedbackText, setFeedbackText] = (0,
|
|
884
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
885
|
-
const { dispatchEvent: trackEvent = (...args) => void args } = (0,
|
|
732
|
+
const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
|
|
733
|
+
const [feedbackText, setFeedbackText] = (0, import_react2.useState)("");
|
|
734
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react2.useState)(false);
|
|
735
|
+
const { dispatchEvent: trackEvent = (...args) => void args } = (0, import_events.useMixpanel)();
|
|
886
736
|
const panelZIndex = (0, import_editor_floating_panels.useFloatingPanelZIndex)(AUDIT_PANEL_ID);
|
|
887
737
|
if (!(0, import_editor_v1_adapters.isExperimentActive)(FEEDBACK_EXPERIMENT_NAME)) {
|
|
888
738
|
return null;
|
|
@@ -1020,7 +870,7 @@ function WelcomePage() {
|
|
|
1020
870
|
|
|
1021
871
|
// src/components/report-shell.tsx
|
|
1022
872
|
var React19 = __toESM(require("react"));
|
|
1023
|
-
var
|
|
873
|
+
var import_react5 = require("react");
|
|
1024
874
|
var import_ui18 = require("@elementor/ui");
|
|
1025
875
|
|
|
1026
876
|
// src/components/pages/category-page.tsx
|
|
@@ -1029,9 +879,9 @@ var import_ui12 = require("@elementor/ui");
|
|
|
1029
879
|
var import_i18n11 = require("@wordpress/i18n");
|
|
1030
880
|
|
|
1031
881
|
// src/hooks/use-single-expanded-card.ts
|
|
1032
|
-
var
|
|
882
|
+
var import_react3 = require("react");
|
|
1033
883
|
function useSingleExpandedCard(initialId = null) {
|
|
1034
|
-
const [expandedId, setExpandedId] = (0,
|
|
884
|
+
const [expandedId, setExpandedId] = (0, import_react3.useState)(initialId);
|
|
1035
885
|
const toggle = (id) => {
|
|
1036
886
|
setExpandedId((current) => current === id ? null : id);
|
|
1037
887
|
};
|
|
@@ -1050,12 +900,12 @@ var CATEGORY_ICONS = {
|
|
|
1050
900
|
|
|
1051
901
|
// src/components/status-section.tsx
|
|
1052
902
|
var React6 = __toESM(require("react"));
|
|
1053
|
-
var
|
|
903
|
+
var import_react4 = require("react");
|
|
1054
904
|
var import_icons4 = require("@elementor/icons");
|
|
1055
905
|
var import_ui6 = require("@elementor/ui");
|
|
1056
906
|
var import_i18n6 = require("@wordpress/i18n");
|
|
1057
907
|
function StatusSection({ label, count, color = "default", defaultExpanded = false, children }) {
|
|
1058
|
-
const [expanded, setExpanded] = (0,
|
|
908
|
+
const [expanded, setExpanded] = (0, import_react4.useState)(defaultExpanded);
|
|
1059
909
|
if (React6.Children.count(children) === 0) {
|
|
1060
910
|
return null;
|
|
1061
911
|
}
|
|
@@ -1098,21 +948,21 @@ function SubpageHeader({ title, onBack, backLabel, icon }) {
|
|
|
1098
948
|
|
|
1099
949
|
// src/components/violation-row.tsx
|
|
1100
950
|
var React12 = __toESM(require("react"));
|
|
1101
|
-
var
|
|
951
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
1102
952
|
var import_editor_floating_panels2 = require("@elementor/editor-floating-panels");
|
|
1103
953
|
var import_icons10 = require("@elementor/icons");
|
|
1104
954
|
var import_ui11 = require("@elementor/ui");
|
|
1105
955
|
var import_i18n10 = require("@wordpress/i18n");
|
|
1106
956
|
|
|
1107
957
|
// src/hooks/focus-violation.ts
|
|
1108
|
-
var
|
|
958
|
+
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1109
959
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
1110
960
|
var SCROLL_TO_VIEW_DELAY_MS = 200;
|
|
1111
961
|
function focusViolation(violation) {
|
|
1112
962
|
if (violation.elementId) {
|
|
1113
|
-
const container = (0,
|
|
963
|
+
const container = (0, import_editor_elements4.getContainer)(violation.elementId);
|
|
1114
964
|
if (container) {
|
|
1115
|
-
(0,
|
|
965
|
+
(0, import_editor_elements4.selectElement)(violation.elementId);
|
|
1116
966
|
const domElement = container.view?.getDomElement?.();
|
|
1117
967
|
if (domElement) {
|
|
1118
968
|
window.elementor?.helpers?.scrollToView?.(domElement, SCROLL_TO_VIEW_DELAY_MS);
|
|
@@ -1121,27 +971,25 @@ function focusViolation(violation) {
|
|
|
1121
971
|
if (violation.targetHint === "element-settings") {
|
|
1122
972
|
(0, import_editor_v1_adapters2.__privateRunCommand)("panel/editor/open");
|
|
1123
973
|
}
|
|
1124
|
-
return
|
|
974
|
+
return;
|
|
1125
975
|
}
|
|
1126
976
|
if (violation.externalUrl) {
|
|
1127
977
|
window.open(violation.externalUrl, "_blank");
|
|
1128
|
-
return
|
|
978
|
+
return;
|
|
1129
979
|
}
|
|
1130
980
|
if (violation.targetHint === "page-settings") {
|
|
1131
981
|
(0, import_editor_v1_adapters2.__privateOpenRoute)("panel/page-settings/settings");
|
|
1132
|
-
return
|
|
982
|
+
return;
|
|
1133
983
|
}
|
|
1134
984
|
if (violation.targetHint === "site-settings") {
|
|
1135
985
|
(0, import_editor_v1_adapters2.__privateRunCommand)("panel/global/open");
|
|
1136
|
-
return
|
|
986
|
+
return;
|
|
1137
987
|
}
|
|
1138
988
|
if (violation.targetHint === "site-identity-settings") {
|
|
1139
989
|
void (0, import_editor_v1_adapters2.__privateRunCommand)("panel/global/open").then(() => {
|
|
1140
990
|
(0, import_editor_v1_adapters2.__privateOpenRoute)("panel/global/settings-site-identity");
|
|
1141
991
|
});
|
|
1142
|
-
return "site_settings_opened";
|
|
1143
992
|
}
|
|
1144
|
-
return null;
|
|
1145
993
|
}
|
|
1146
994
|
|
|
1147
995
|
// src/utils/build-angie-prompt.ts
|
|
@@ -1170,7 +1018,7 @@ var import_editor_mcp = require("@elementor/editor-mcp");
|
|
|
1170
1018
|
var import_icons6 = require("@elementor/icons");
|
|
1171
1019
|
var import_ui8 = require("@elementor/ui");
|
|
1172
1020
|
var import_i18n9 = require("@wordpress/i18n");
|
|
1173
|
-
function FixViolationWithAngie({
|
|
1021
|
+
function FixViolationWithAngie({ prompt, panelZIndex, variant = "icon" }) {
|
|
1174
1022
|
const label = (0, import_i18n9.__)("Fix with Angie", "elementor");
|
|
1175
1023
|
const href = `#angie-prompt=${encodeURIComponent(prompt)}`;
|
|
1176
1024
|
const handleClick = (event) => {
|
|
@@ -1178,12 +1026,6 @@ function FixViolationWithAngie({ audit: audit25, prompt, panelZIndex, variant =
|
|
|
1178
1026
|
event.preventDefault();
|
|
1179
1027
|
if ((0, import_editor_mcp.isAngieAvailable)()) {
|
|
1180
1028
|
(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
|
-
});
|
|
1187
1029
|
return;
|
|
1188
1030
|
}
|
|
1189
1031
|
window.dispatchEvent(
|
|
@@ -1232,18 +1074,11 @@ function SeverityIcon({ severity }) {
|
|
|
1232
1074
|
var React10 = __toESM(require("react"));
|
|
1233
1075
|
var import_icons8 = require("@elementor/icons");
|
|
1234
1076
|
var import_ui9 = require("@elementor/ui");
|
|
1235
|
-
function ViolationCtaButton({
|
|
1236
|
-
ctaLabel,
|
|
1237
|
-
externalUrl,
|
|
1238
|
-
variant = "outlined",
|
|
1239
|
-
withIcon = false,
|
|
1240
|
-
onOpen
|
|
1241
|
-
}) {
|
|
1077
|
+
function ViolationCtaButton({ ctaLabel, externalUrl, variant = "outlined", withIcon = false }) {
|
|
1242
1078
|
const handleClick = (event) => {
|
|
1243
1079
|
event.stopPropagation();
|
|
1244
1080
|
event.preventDefault();
|
|
1245
1081
|
window.open(externalUrl, "_blank", "noopener");
|
|
1246
|
-
onOpen?.();
|
|
1247
1082
|
};
|
|
1248
1083
|
return /* @__PURE__ */ React10.createElement(
|
|
1249
1084
|
import_ui9.Button,
|
|
@@ -1294,7 +1129,6 @@ function StatusIndicator({ audit: audit25, violations }) {
|
|
|
1294
1129
|
return /* @__PURE__ */ React12.createElement(import_icons10.CheckIcon, { fontSize: "small", color: "success" });
|
|
1295
1130
|
}
|
|
1296
1131
|
function GuidanceAction({
|
|
1297
|
-
audit: audit25,
|
|
1298
1132
|
violation,
|
|
1299
1133
|
sharedAngiePrompt,
|
|
1300
1134
|
panelZIndex
|
|
@@ -1308,8 +1142,7 @@ function GuidanceAction({
|
|
|
1308
1142
|
{
|
|
1309
1143
|
ctaLabel: violation.ctaLabel,
|
|
1310
1144
|
externalUrl: violation.externalUrl,
|
|
1311
|
-
withIcon: true
|
|
1312
|
-
onOpen: () => trackFixWithApp(audit25, violation, "issues")
|
|
1145
|
+
withIcon: true
|
|
1313
1146
|
}
|
|
1314
1147
|
), hasPrimaryCta && violation.secondaryCtaLabel && violation.secondaryCtaUrl && /* @__PURE__ */ React12.createElement(
|
|
1315
1148
|
ViolationCtaButton,
|
|
@@ -1318,15 +1151,7 @@ function GuidanceAction({
|
|
|
1318
1151
|
externalUrl: violation.secondaryCtaUrl,
|
|
1319
1152
|
variant: "text"
|
|
1320
1153
|
}
|
|
1321
|
-
), sharedAngiePrompt && /* @__PURE__ */ React12.createElement(
|
|
1322
|
-
FixViolationWithAngie,
|
|
1323
|
-
{
|
|
1324
|
-
audit: audit25,
|
|
1325
|
-
prompt: sharedAngiePrompt,
|
|
1326
|
-
panelZIndex,
|
|
1327
|
-
variant: "button"
|
|
1328
|
-
}
|
|
1329
|
-
));
|
|
1154
|
+
), sharedAngiePrompt && /* @__PURE__ */ React12.createElement(FixViolationWithAngie, { prompt: sharedAngiePrompt, panelZIndex, variant: "button" }));
|
|
1330
1155
|
}
|
|
1331
1156
|
function getSharedAngiePrompt(violations) {
|
|
1332
1157
|
if (!violations || violations.length < 2) {
|
|
@@ -1346,20 +1171,9 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1346
1171
|
const isGuidanceFocusable = !!primaryViolation;
|
|
1347
1172
|
const panelZIndex = (0, import_editor_floating_panels2.useFloatingPanelZIndex)(AUDIT_PANEL_ID);
|
|
1348
1173
|
const sharedAngiePrompt = getSharedAngiePrompt(violations);
|
|
1349
|
-
const viewIssue = (violation) => {
|
|
1350
|
-
const interactionResult = focusViolation(violation);
|
|
1351
|
-
if (interactionResult) {
|
|
1352
|
-
trackFindingClicked({
|
|
1353
|
-
audit: audit25,
|
|
1354
|
-
locationL2: "issues",
|
|
1355
|
-
actionType: "view_issue",
|
|
1356
|
-
interactionResult
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
};
|
|
1360
1174
|
const handleGuidanceClick = () => {
|
|
1361
1175
|
if (isGuidanceFocusable && primaryViolation) {
|
|
1362
|
-
|
|
1176
|
+
focusViolation(primaryViolation);
|
|
1363
1177
|
}
|
|
1364
1178
|
};
|
|
1365
1179
|
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(
|
|
@@ -1409,15 +1223,14 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1409
1223
|
primaryViolation && /* @__PURE__ */ React12.createElement(
|
|
1410
1224
|
GuidanceAction,
|
|
1411
1225
|
{
|
|
1412
|
-
audit: audit25,
|
|
1413
1226
|
violation: primaryViolation,
|
|
1414
1227
|
sharedAngiePrompt,
|
|
1415
1228
|
panelZIndex
|
|
1416
1229
|
}
|
|
1417
1230
|
)
|
|
1418
1231
|
))), violations && violations.length > 0 && /* @__PURE__ */ React12.createElement(import_ui11.Box, { role: "list", sx: { paddingBlockEnd: 1 } }, violations.map((violation, idx) => {
|
|
1419
|
-
const widgetIcon = violation.elementId ? (0,
|
|
1420
|
-
const elementTitle = violation.elementId ? (0,
|
|
1232
|
+
const widgetIcon = violation.elementId ? (0, import_editor_elements5.getElementIcon)(violation.elementId) : null;
|
|
1233
|
+
const elementTitle = violation.elementId ? (0, import_editor_elements5.getElementTitle)(violation.elementId) : null;
|
|
1421
1234
|
const displayLabel = elementTitle ?? violation.label;
|
|
1422
1235
|
const angiePromptContext = elementTitle ? `${elementTitle} - ${violation.label}` : violation.label;
|
|
1423
1236
|
const showsOwnFixAction = !!violation.angieFix && !sharedAngiePrompt;
|
|
@@ -1427,8 +1240,8 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1427
1240
|
key: idx,
|
|
1428
1241
|
role: "button",
|
|
1429
1242
|
tabIndex: 0,
|
|
1430
|
-
onClick: () =>
|
|
1431
|
-
onKeyDown: onKeyboardClick(() =>
|
|
1243
|
+
onClick: () => focusViolation(violation),
|
|
1244
|
+
onKeyDown: onKeyboardClick(() => focusViolation(violation)),
|
|
1432
1245
|
sx: {
|
|
1433
1246
|
display: "flex",
|
|
1434
1247
|
alignItems: "center",
|
|
@@ -1454,7 +1267,6 @@ function ViolationRow({ audit: audit25, expanded, onToggleExpand, skipReason, vi
|
|
|
1454
1267
|
/* @__PURE__ */ React12.createElement(
|
|
1455
1268
|
FixViolationWithAngie,
|
|
1456
1269
|
{
|
|
1457
|
-
audit: audit25,
|
|
1458
1270
|
prompt: violation.angiePrompt ?? buildAngiePrompt(angiePromptContext),
|
|
1459
1271
|
panelZIndex
|
|
1460
1272
|
}
|
|
@@ -1718,12 +1530,8 @@ function Promotions({ report }) {
|
|
|
1718
1530
|
ctaLabel: config.ctaLabel,
|
|
1719
1531
|
ctaDisabled: !ctaUrl,
|
|
1720
1532
|
onCtaClick: () => {
|
|
1721
|
-
if (
|
|
1722
|
-
|
|
1723
|
-
}
|
|
1724
|
-
window.open(ctaUrl, "_blank", "noopener");
|
|
1725
|
-
if (run.result.status === "fail") {
|
|
1726
|
-
trackFixWithApp(run.audit, run.result.violations[0], "overview");
|
|
1533
|
+
if (ctaUrl) {
|
|
1534
|
+
window.open(ctaUrl, "_blank");
|
|
1727
1535
|
}
|
|
1728
1536
|
}
|
|
1729
1537
|
}
|
|
@@ -1776,7 +1584,7 @@ function isCategoryPage(page) {
|
|
|
1776
1584
|
return typeof page === "object" && "category" in page;
|
|
1777
1585
|
}
|
|
1778
1586
|
function ReportShell({ report }) {
|
|
1779
|
-
const [activePage, setActivePage] = (0,
|
|
1587
|
+
const [activePage, setActivePage] = (0, import_react5.useState)("overview");
|
|
1780
1588
|
const openCategory = (category) => setActivePage({ category });
|
|
1781
1589
|
const backToOverview = () => setActivePage("overview");
|
|
1782
1590
|
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 }));
|
|
@@ -1814,9 +1622,8 @@ function RescanButton({ hasScanned, isStale, disabled, onClick }) {
|
|
|
1814
1622
|
// src/components/audit-panel.tsx
|
|
1815
1623
|
function AuditPanel() {
|
|
1816
1624
|
const { status, report, error, isStale, run } = useAuditReport();
|
|
1817
|
-
|
|
1818
|
-
const
|
|
1819
|
-
const onRun = () => run(hostDocumentId, report ? "rescan" : "run_audit");
|
|
1625
|
+
const hostDocumentId = (0, import_editor_elements6.getHostDocumentId)() ?? 0;
|
|
1626
|
+
const onRun = () => run(hostDocumentId);
|
|
1820
1627
|
const lastScanLabel = report ? new Date(report.runAt).toLocaleTimeString() : null;
|
|
1821
1628
|
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
1822
1629
|
import_editor_floating_panels4.FloatingPanelHeader,
|
|
@@ -1824,8 +1631,7 @@ function AuditPanel() {
|
|
|
1824
1631
|
panelId: AUDIT_PANEL_ID,
|
|
1825
1632
|
title: (0, import_i18n17.__)("Page Audit", "elementor"),
|
|
1826
1633
|
badge: (0, import_i18n17.__)("Beta", "elementor"),
|
|
1827
|
-
titleVariant: "subtitle2"
|
|
1828
|
-
onClose: trackPanelClosed
|
|
1634
|
+
titleVariant: "subtitle2"
|
|
1829
1635
|
}
|
|
1830
1636
|
), /* @__PURE__ */ React21.createElement(
|
|
1831
1637
|
import_editor_floating_panels4.FloatingPanelBody,
|
|
@@ -1942,8 +1748,7 @@ var audit2 = {
|
|
|
1942
1748
|
externalUrl: isReady ? ctx.pageContext.ally_accessibility_statement_url : ctx.pageContext.ally_plugin_url,
|
|
1943
1749
|
ctaLabel: (0, import_i18n20.__)("Create", "elementor"),
|
|
1944
1750
|
secondaryCtaLabel: (0, import_i18n20.__)("Learn more", "elementor"),
|
|
1945
|
-
secondaryCtaUrl: "https://elementor.com/help/start-using-ally/#statement"
|
|
1946
|
-
appInstalled: isReady
|
|
1751
|
+
secondaryCtaUrl: "https://elementor.com/help/start-using-ally/#statement"
|
|
1947
1752
|
}
|
|
1948
1753
|
]
|
|
1949
1754
|
};
|
|
@@ -1986,8 +1791,7 @@ var audit3 = {
|
|
|
1986
1791
|
auditId: audit3.id,
|
|
1987
1792
|
label: (0, import_i18n21.__)("No accessibility widget is active on this site.", "elementor"),
|
|
1988
1793
|
externalUrl: isReady ? ctx.pageContext.ally_widget_settings_url : ctx.pageContext.ally_plugin_url,
|
|
1989
|
-
ctaLabel: (0, import_i18n21.__)("Activate", "elementor")
|
|
1990
|
-
appInstalled: isReady
|
|
1794
|
+
ctaLabel: (0, import_i18n21.__)("Activate", "elementor")
|
|
1991
1795
|
}
|
|
1992
1796
|
]
|
|
1993
1797
|
};
|
|
@@ -2018,8 +1822,7 @@ var audit4 = {
|
|
|
2018
1822
|
auditId: audit4.id,
|
|
2019
1823
|
label: (0, import_i18n22.__)("Cookiez plugin is not installed or active.", "elementor"),
|
|
2020
1824
|
externalUrl: ctx.pageContext.cookiez_plugin_url,
|
|
2021
|
-
ctaLabel: (0, import_i18n22.__)("Set up cookie consent", "elementor")
|
|
2022
|
-
appInstalled: ctx.pageContext.cookiez_plugin_active
|
|
1825
|
+
ctaLabel: (0, import_i18n22.__)("Set up cookie consent", "elementor")
|
|
2023
1826
|
}
|
|
2024
1827
|
]
|
|
2025
1828
|
};
|
|
@@ -2027,7 +1830,7 @@ var audit4 = {
|
|
|
2027
1830
|
};
|
|
2028
1831
|
|
|
2029
1832
|
// src/audits/deep-nesting.ts
|
|
2030
|
-
var
|
|
1833
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
2031
1834
|
var import_i18n23 = require("@wordpress/i18n");
|
|
2032
1835
|
var MAX_NESTING_DEPTH = 6;
|
|
2033
1836
|
function isNestingElement(node, widgetsCache) {
|
|
@@ -2051,7 +1854,7 @@ var audit5 = {
|
|
|
2051
1854
|
if (ctx.elements.tree.length === 0) {
|
|
2052
1855
|
return { status: "skipped", reason: (0, import_i18n23.__)("No elements", "elementor") };
|
|
2053
1856
|
}
|
|
2054
|
-
const widgetsCache = (0,
|
|
1857
|
+
const widgetsCache = (0, import_editor_elements7.getWidgetsCache)();
|
|
2055
1858
|
const violations = [];
|
|
2056
1859
|
walkElements(ctx.elements.tree, (node, parents) => {
|
|
2057
1860
|
if (!isNestingElement(node, widgetsCache)) {
|
|
@@ -2102,7 +1905,7 @@ var audit6 = {
|
|
|
2102
1905
|
};
|
|
2103
1906
|
|
|
2104
1907
|
// src/audits/deprecated-widgets.ts
|
|
2105
|
-
var
|
|
1908
|
+
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
2106
1909
|
var import_i18n25 = require("@wordpress/i18n");
|
|
2107
1910
|
var DEPRECATION_CONTROL_NAME = "deprecation_message";
|
|
2108
1911
|
var audit7 = {
|
|
@@ -2117,7 +1920,7 @@ var audit7 = {
|
|
|
2117
1920
|
severity: "warning",
|
|
2118
1921
|
weight: 7,
|
|
2119
1922
|
evaluate: (ctx) => {
|
|
2120
|
-
const widgetsCache = (0,
|
|
1923
|
+
const widgetsCache = (0, import_editor_elements8.getWidgetsCache)();
|
|
2121
1924
|
if (!widgetsCache) {
|
|
2122
1925
|
return { status: "skipped", reason: "widgets-cache-unavailable" };
|
|
2123
1926
|
}
|
|
@@ -2205,7 +2008,6 @@ var audit8 = {
|
|
|
2205
2008
|
auditId: audit8.id,
|
|
2206
2009
|
label,
|
|
2207
2010
|
ctaLabel: (0, import_i18n26.__)("Enable", "elementor"),
|
|
2208
|
-
appInstalled: true,
|
|
2209
2011
|
externalUrl: ctx.pageContext.cookiez_consent_mode_settings_url
|
|
2210
2012
|
}
|
|
2211
2013
|
]
|
|
@@ -2549,8 +2351,7 @@ var audit11 = {
|
|
|
2549
2351
|
targetHint: "element-settings",
|
|
2550
2352
|
label: (0, import_i18n29.__)("Image is missing alt text.", "elementor"),
|
|
2551
2353
|
externalUrl: isReady ? ctx.pageContext.ally_scan_url : ctx.pageContext.ally_plugin_url,
|
|
2552
|
-
ctaLabel: (0, import_i18n29.__)("Fix with Ally", "elementor")
|
|
2553
|
-
appInstalled: isReady
|
|
2354
|
+
ctaLabel: (0, import_i18n29.__)("Fix with Ally", "elementor")
|
|
2554
2355
|
});
|
|
2555
2356
|
}
|
|
2556
2357
|
});
|
|
@@ -2599,8 +2400,7 @@ var audit12 = {
|
|
|
2599
2400
|
targetHint: "element-settings",
|
|
2600
2401
|
label: (0, import_i18n30.__)("Image isn't served in a modern format like WebP or AVIF.", "elementor"),
|
|
2601
2402
|
externalUrl: isReady ? ctx.pageContext.image_optimization_settings_url : ctx.pageContext.image_optimization_plugin_url,
|
|
2602
|
-
ctaLabel: (0, import_i18n30.__)("Optimize all", "elementor")
|
|
2603
|
-
appInstalled: isReady
|
|
2403
|
+
ctaLabel: (0, import_i18n30.__)("Optimize all", "elementor")
|
|
2604
2404
|
}));
|
|
2605
2405
|
return violations.length === 0 ? { status: "pass" } : { status: "fail", violations, metadata: { inefficientImageFormatCount } };
|
|
2606
2406
|
}
|
|
@@ -2654,8 +2454,7 @@ var audit13 = {
|
|
|
2654
2454
|
kb
|
|
2655
2455
|
),
|
|
2656
2456
|
externalUrl: isReady ? ctx.pageContext.image_optimization_settings_url : ctx.pageContext.image_optimization_plugin_url,
|
|
2657
|
-
ctaLabel: (0, import_i18n31.__)("Optimize all", "elementor")
|
|
2658
|
-
appInstalled: isReady
|
|
2457
|
+
ctaLabel: (0, import_i18n31.__)("Optimize all", "elementor")
|
|
2659
2458
|
}));
|
|
2660
2459
|
return violations.length === 0 ? { status: "pass" } : { status: "fail", violations, metadata: { oversizedImageCount } };
|
|
2661
2460
|
}
|
|
@@ -3096,8 +2895,7 @@ var audit22 = {
|
|
|
3096
2895
|
{
|
|
3097
2896
|
auditId: audit22.id,
|
|
3098
2897
|
label: (0, import_i18n40.__)("This page has not been scanned for cookies yet.", "elementor"),
|
|
3099
|
-
externalUrl: isReady ? ctx.pageContext.cookiez_scan_url : ctx.pageContext.cookiez_plugin_action_url
|
|
3100
|
-
appInstalled: isReady
|
|
2898
|
+
externalUrl: isReady ? ctx.pageContext.cookiez_scan_url : ctx.pageContext.cookiez_plugin_action_url
|
|
3101
2899
|
}
|
|
3102
2900
|
]
|
|
3103
2901
|
};
|
|
@@ -3225,19 +3023,19 @@ function registerAllAudits() {
|
|
|
3225
3023
|
|
|
3226
3024
|
// src/sync-report-staleness.ts
|
|
3227
3025
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
3228
|
-
var
|
|
3026
|
+
var import_store6 = require("@elementor/store");
|
|
3229
3027
|
function syncReportStaleness() {
|
|
3230
3028
|
(0, import_editor_v1_adapters3.__privateListenTo)((0, import_editor_v1_adapters3.commandEndEvent)("document/save/set-is-modified"), (e) => {
|
|
3231
3029
|
const event = e;
|
|
3232
3030
|
if (event.args?.status) {
|
|
3233
|
-
(0,
|
|
3031
|
+
(0, import_store6.__dispatch)(slice.actions.reportStale());
|
|
3234
3032
|
}
|
|
3235
3033
|
});
|
|
3236
3034
|
}
|
|
3237
3035
|
|
|
3238
3036
|
// src/init.ts
|
|
3239
3037
|
function init() {
|
|
3240
|
-
(0,
|
|
3038
|
+
(0, import_store7.__registerSlice)(slice);
|
|
3241
3039
|
registerAllAudits();
|
|
3242
3040
|
(0, import_editor_floating_panels6.registerFloatingPanel)(auditPanel.panel);
|
|
3243
3041
|
registerAppBarAuditsToggle();
|