-
-
Notifications
You must be signed in to change notification settings - Fork 7
483 implement javascript feature into extension to support custom javascript #625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dharmesh-hemaram
merged 6 commits into
main
from
483-implement-javascript-feature-into-extension-to-support-custom-javascript
Jul 27, 2025
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
384b3c5
lets review
dharmesh-hemaram 9ae31c7
lets reviews
dharmesh-hemaram da7c200
remove script result from console
dharmesh-hemaram bc16848
Add user scripts availability check and notification handling
dharmesh-hemaram dddcb34
Fixed linting and testing
dharmesh-hemaram e96dfee
Enhance action handling by adding isAction utility and updating defau…
dharmesh-hemaram File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { EActionStatus, IUserScript } from '@dhruv-techapps/acf-common'; | ||
import { IUserScriptsExecuteResponse } from '@dhruv-techapps/core-extension'; | ||
import { UserScriptsService } from '@dhruv-techapps/core-service'; | ||
import { I18N_COMMON } from './i18n'; | ||
|
||
const USER_SCRIPTS_I18N = { | ||
TITLE: chrome.i18n.getMessage('@USER_SCRIPT__TITLE') | ||
}; | ||
|
||
const UserScriptProcessor = (() => { | ||
const start = async (action: IUserScript): Promise<EActionStatus> => { | ||
const executeRequest = { | ||
ext: window.ext, | ||
code: action.value | ||
}; | ||
return await UserScriptsService.execute(executeRequest) | ||
dharmesh-hemaram marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.then((response: IUserScriptsExecuteResponse) => { | ||
if (response.error) { | ||
console.error(`${USER_SCRIPTS_I18N.TITLE} #${window.ext.__currentAction}`, `❌ ${I18N_COMMON.ERROR}`); | ||
return EActionStatus.SKIPPED; | ||
} | ||
console.debug(`${USER_SCRIPTS_I18N.TITLE} #${window.ext.__currentAction}`, `✅ ${I18N_COMMON.COMPLETED}`); | ||
return EActionStatus.DONE; | ||
}) | ||
.catch((error) => { | ||
console.error('Error executing UserScript:', error); | ||
return EActionStatus.SKIPPED; | ||
}); | ||
}; | ||
|
||
return { start }; | ||
})(); | ||
|
||
export default UserScriptProcessor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
apps/acf-options-page/src/app/configs/action/action-options-dropdown.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { DropdownToggle } from '@acf-options-page/components'; | ||
import { TRandomUUID } from '@dhruv-techapps/core-common'; | ||
import { Dropdown } from 'react-bootstrap'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
interface ActionOptionsDropdownProps { | ||
index: number; | ||
actionId: TRandomUUID; | ||
disabled?: boolean; | ||
removeActionConfirm: (actionId: TRandomUUID, index: number) => void; | ||
showAddon: (actionId: TRandomUUID) => void; | ||
showSettings: (actionId: TRandomUUID) => void; | ||
showCondition: (actionId: TRandomUUID) => void; | ||
onAddClick: (actionId: TRandomUUID, position: 1 | 0) => void; | ||
onDisableClick: (actionId: TRandomUUID, disabled?: boolean) => void; | ||
} | ||
|
||
export const ActionOptionsDropdown: React.FC<ActionOptionsDropdownProps> = (props) => { | ||
const { index, actionId, disabled, showAddon, showSettings, showCondition, onAddClick, onDisableClick } = props; | ||
const { t } = useTranslation(); | ||
return ( | ||
<Dropdown id='action-dropdown-wrapper' className='d-inline-block'> | ||
<Dropdown.Toggle as={DropdownToggle} id='action-dropdown' aria-label='Action more option'> | ||
<i className='bi bi-three-dots' /> | ||
</Dropdown.Toggle> | ||
<Dropdown.Menu> | ||
<Dropdown.Item data-testid='action-addon' onClick={() => showAddon(actionId)}> | ||
{t('action.addon')} | ||
</Dropdown.Item> | ||
<Dropdown.Item data-testid='action-settings' onClick={() => showSettings(actionId)}> | ||
{t('action.settings')} | ||
</Dropdown.Item> | ||
{index !== 0 && ( | ||
<Dropdown.Item data-testid='action-statement' onClick={() => showCondition(actionId)}> | ||
{t('modal.actionCondition.title')} | ||
</Dropdown.Item> | ||
)} | ||
<Dropdown.Divider /> | ||
<Dropdown.Item data-testid='action-add' onClick={() => onAddClick(actionId, 0)}> | ||
<i className='bi bi-plus-lg me-2' /> {t('action.addBefore')} | ||
</Dropdown.Item> | ||
<Dropdown.Item data-testid='action-add' onClick={() => onAddClick(actionId, 1)}> | ||
<i className='bi bi-plus-lg me-2' /> {t('action.addAfter')} | ||
</Dropdown.Item> | ||
<Dropdown.Divider /> | ||
<Dropdown.Item data-testid='action-disable' onClick={() => onDisableClick(actionId, disabled)}> | ||
{t(`action.${disabled ? 'enable' : 'disable'}`)} | ||
</Dropdown.Item> | ||
</Dropdown.Menu> | ||
</Dropdown> | ||
); | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.