Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Download on script completion on Chrome.
- Download file date string.
- Download via popup on Edge.
- Close notification dialog when script downloaded directly.

## 0.1.2 - 2025-06-17

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rec.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Download on script completion on Chrome.
- Download file date string.
- Download via popup on Edge.
- Close notification dialog when script downloaded directly.

## 0.1.2 - 2025-06-17

Expand Down
6 changes: 0 additions & 6 deletions source/Background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
REPORT_OBJECT,
RESET_ZEST_SCRIPT,
SESSION_STORAGE,
SET_SAVE_SCRIPT_ENABLE,
STOP_RECORDING,
ZEST_SCRIPT,
} from '../utils/constants';
Expand Down Expand Up @@ -249,11 +248,6 @@ async function handleMessage(
}
break;
}
case SET_SAVE_SCRIPT_ENABLE:
Browser.storage.sync.set({
zapenablesavescript: zestScript.getZestStatementCount() > 0,
});
break;

default:
// Handle unknown request type
Expand Down
23 changes: 10 additions & 13 deletions source/Popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
GET_ZEST_SCRIPT,
IS_FULL_EXTENSION,
RESET_ZEST_SCRIPT,
SET_SAVE_SCRIPT_ENABLE,
STOP_RECORDING,
UPDATE_TITLE,
ZAP_START_RECORDING,
Expand Down Expand Up @@ -57,9 +56,6 @@ const loginUrlInput = document.getElementById(
const scriptNameInput = document.getElementById(
'script-name-input'
) as HTMLInputElement;
const saveScriptButton = document.getElementById(
'save-script'
) as HTMLButtonElement;

function sendMessageToContentScript(message: string, data = ''): void {
Browser.tabs.query({active: true, currentWindow: true}).then((tabs) => {
Expand Down Expand Up @@ -90,14 +86,12 @@ function startedAnimation(): void {

async function restoreState(): Promise<void> {
console.log('Restore state');
await Browser.runtime.sendMessage({type: SET_SAVE_SCRIPT_ENABLE});
optionsIcon.title = OPTIONS;
downloadIcon.title = DOWNLOAD;
Browser.storage.sync
.get({
zaprecordingactive: false,
zapscriptname: '',
zapenablesavescript: false,
})
.then((items) => {
if (items.zaprecordingactive) {
Expand All @@ -111,11 +105,6 @@ async function restoreState(): Promise<void> {
} else {
done?.classList.add('invisible');
}
if (!items.zapenablesavescript) {
saveScriptButton.classList.add('disabled');
} else {
saveScriptButton.classList.remove('disabled');
}
});
}

Expand Down Expand Up @@ -189,7 +178,14 @@ function openHelpPage(): void {
closePopup();
}

function downloadZestScript(zestScriptJSON: string, title: string): void {
function downloadZestScript(
zestScriptJSON: string,
title: string,
statementCount: number
): void {
if (statementCount === 0) {
return;
}
if (title === '') {
scriptNameInput?.focus();
return;
Expand All @@ -211,11 +207,12 @@ async function handleSaveScript(): Promise<void> {
zaprecordingactive: false,
});
if (storageItems.zaprecordingactive) {
sendMessageToContentScript(ZAP_STOP_RECORDING);
await Browser.runtime.sendMessage({type: STOP_RECORDING});
}
Browser.runtime.sendMessage({type: GET_ZEST_SCRIPT}).then((items) => {
const msg = items as ZestScriptMessage;
downloadZestScript(msg.script, msg.title);
downloadZestScript(msg.script, msg.title, msg.statementCount);
});
}

Expand Down
5 changes: 0 additions & 5 deletions source/Popup/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,6 @@ html {
color: var(--primary);
}
&:hover {color: var(--primary);}

&.disabled {
pointer-events: none;
opacity: 0.5;
}
}

@keyframes waves {
Expand Down
7 changes: 6 additions & 1 deletion source/types/zestScript/ZestScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Browser from 'webextension-polyfill';
interface ZestScriptMessage {
script: string;
title: string;
statementCount: number;
}

class ZestScript {
Expand Down Expand Up @@ -93,7 +94,11 @@ class ZestScript {
return new Promise((resolve) => {
Browser.storage.sync.get({zapscriptname: this.title}).then((items) => {
this.title = items.zapscriptname as string;
resolve({script: this.toJSON(), title: this.title});
resolve({
script: this.toJSON(),
title: this.title,
statementCount: this.getZestStatementCount(),
});
});
});
}
Expand Down
1 change: 0 additions & 1 deletion source/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const DEFAULT_WINDOW_HANDLE = 'windowHandle1';

export const ZAP_STOP_RECORDING = 'zapStopRecording';
export const ZAP_START_RECORDING = 'zapStartRecording';
export const SET_SAVE_SCRIPT_ENABLE = 'setSaveScriptEnable';
export const ZEST_SCRIPT = 'zestScript';

export const STOP_RECORDING = 'stopRecording';
Expand Down