mirror of
https://ghproxy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-07-21 12:16:59 +08:00
* add: preview images for bulk-alt-text * add: bulk alt text banner * fix: padding * add: bulk alt text banner component * add: icons * add: support for aborting the fetch request * add: bulk alt text manager * update: husky * fix: optimized images * update: memoize images * fix: imports * add: focustrap * add: mixpanel events * update: add logic to save alt text when editing manually * fix: abort controller reference and cleanup * fix: improve key stability in image grid rendering * refactor: add PropTypes validation and memoization to ImageCard component * feat: add error handling for ImageCard component using ErrorBoundary * fix: auto selection logic for card with bulk generation * add: loading and generation states * refactor: restructure bulk alt text components and enhance progress handling and decentralized logic * refactor: extract logic from progress bar to hook * add: quota exceeded alert * add: promotional banner for generate button * update: Generate button for selection mode * fix: button alignment * update: hide banner for 2 or less images * fix: box shadow * add: mixpanel events * update: rename variable * add: bulk upgrade url * update: link handling for upgrade * fix: box shadow * add: border radius to dialog * update: improved accessibility notifications * fix: height and padding for banner * update: add more context to image card * add: ARIA labels * add: focus on card * add: decode URI component * fix: accessibility issues * add: encoding for file names * fix: styled components * update: made progress bar sticky * update: add logic to disable button on bulk generation * fix: style * fix: closing the dialog while generating * add: error handling * fix: mark prop as not required * Fix: Prevent MUI from adding aria-hidden to dialog parent elements [APP-2261] * add: error handling for quota api error * fix: prop requirement * add: close handler to dialog * fix: ui * fix: icons * fix: width of dialog * fix: width of bulk dialog --------- Co-authored-by: Kniazevych <pavlok@elementor.red>
222 lines
4.4 KiB
JavaScript
222 lines
4.4 KiB
JavaScript
import API from '@ea11y-apps/global/api';
|
|
|
|
const v1Prefix = '/ea11y/v1';
|
|
|
|
export class APIScanner extends API {
|
|
static async registerPage(pageData, summary) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/remediation/register`,
|
|
data: {
|
|
...pageData,
|
|
summary,
|
|
},
|
|
});
|
|
}
|
|
|
|
static async addScanResults(data) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/scanner/scan-results`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async triggerSave(data) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/remediation/trigger-save`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async submitAltText(url, text) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/remediation/set-alt-text`,
|
|
data: {
|
|
url,
|
|
alt_text: text,
|
|
},
|
|
});
|
|
}
|
|
|
|
static async submitRemediation(data) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/remediation/item`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateRemediation(data) {
|
|
return APIScanner.request({
|
|
method: 'PATCH',
|
|
path: `${v1Prefix}/remediation/item`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateRemediationContent(data) {
|
|
return APIScanner.request({
|
|
method: 'PUT',
|
|
path: `${v1Prefix}/remediation/item`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async deleteRemediation(data) {
|
|
return APIScanner.request({
|
|
method: 'DELETE',
|
|
path: `${v1Prefix}/remediation/item`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async generateAltText(data, signal = null) {
|
|
const config = {
|
|
method: 'POST',
|
|
path: `${v1Prefix}/scanner/generate-alt-text`,
|
|
data,
|
|
};
|
|
if (signal) {
|
|
config.signal = signal;
|
|
}
|
|
return APIScanner.request(config);
|
|
}
|
|
|
|
static async resolveWithAI(data) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/scanner/resolve-with-ai`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async resolveIssue(scanId) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/scanner/resolve-issue`,
|
|
data: { scanId },
|
|
});
|
|
}
|
|
|
|
static async getRemediations(url) {
|
|
return APIScanner.request({
|
|
method: 'GET',
|
|
path: `${v1Prefix}/remediation/items?url=${encodeURIComponent(url)}`,
|
|
});
|
|
}
|
|
|
|
static async setRemediationAsGlobal(data) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/remediation/global-item`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateGlobalRemediationForPage(data) {
|
|
return APIScanner.request({
|
|
method: 'PUT',
|
|
path: `${v1Prefix}/remediation/global-item`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateGlobalRemediationForAllPages(data) {
|
|
return APIScanner.request({
|
|
method: 'PATCH',
|
|
path: `${v1Prefix}/remediation/global-item`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async deleteGlobalRemediation(data) {
|
|
return APIScanner.request({
|
|
method: 'DELETE',
|
|
path: `${v1Prefix}/remediation/global-item`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateRemediationStatusForPage(data) {
|
|
return APIScanner.request({
|
|
method: 'PATCH',
|
|
path: `${v1Prefix}/remediation/items`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateGlobalRemediationGroupForPage(data) {
|
|
return APIScanner.request({
|
|
method: 'PUT',
|
|
path: `${v1Prefix}/remediation/global-items-group`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateAllGlobalRemediationForAllPages(data) {
|
|
return APIScanner.request({
|
|
method: 'PATCH',
|
|
path: `${v1Prefix}/remediation/global-items`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateAllGlobalRemediationForPage(data) {
|
|
return APIScanner.request({
|
|
method: 'PUT',
|
|
path: `${v1Prefix}/remediation/global-items`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async updateGlobalRemediationGroupForAllPages(data) {
|
|
return APIScanner.request({
|
|
method: 'PATCH',
|
|
path: `${v1Prefix}/remediation/global-items-group`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async deleteRemediationForPage(data) {
|
|
return APIScanner.request({
|
|
method: 'DELETE',
|
|
path: `${v1Prefix}/remediation/items`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async deleteGlobalRemediations(data) {
|
|
return APIScanner.request({
|
|
method: 'DELETE',
|
|
path: `${v1Prefix}/remediation/global-items`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async setHeadingLevel(data) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/remediation/heading-level`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async dismissHeadingIssue(data) {
|
|
return APIScanner.request({
|
|
method: 'POST',
|
|
path: `${v1Prefix}/remediation/dismiss-heading-issue`,
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async clearCache(data) {
|
|
return APIScanner.request({
|
|
method: 'DELETE',
|
|
path: `${v1Prefix}/remediation/clear-cache`,
|
|
data,
|
|
});
|
|
}
|
|
}
|