PromucFlow_constructor/app/client/src/actions/jsActionActions.ts
Ankita Kinger f379b65be4
chore: Splitting analytic events (#26197)
## Description

Splitting analytic events as part of adding events for SCIM

#### PR fixes following issue(s)
Fixes [#25891](https://github.com/appsmithorg/appsmith/issues/25891)

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing

#### How Has This Been Tested?
- [x] Manual
- [ ] Jest
- [ ] Cypress

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-08-09 15:15:01 +05:30

163 lines
3.5 KiB
TypeScript

import type {
ReduxAction,
EvaluationReduxAction,
} from "@appsmith/constants/ReduxActionConstants";
import {
ReduxActionTypes,
ReduxActionErrorTypes,
} from "@appsmith/constants/ReduxActionConstants";
import type { JSCollection } from "entities/JSCollection";
import type { CreateJSCollectionRequest } from "api/JSActionAPI";
import type { EventLocation } from "@appsmith/utils/analyticsUtilTypes";
export type FetchJSCollectionsPayload = {
applicationId: string;
};
export const fetchJSCollections = ({
applicationId,
}: {
applicationId: string;
}): EvaluationReduxAction<unknown> => {
return {
type: ReduxActionTypes.FETCH_JS_ACTIONS_INIT,
payload: { applicationId },
};
};
export const createJSCollectionRequest = (payload: {
request: CreateJSCollectionRequest;
from: EventLocation;
}) => {
return {
type: ReduxActionTypes.CREATE_JS_ACTION_INIT,
payload,
};
};
export const createJSCollectionSuccess = (payload: JSCollection) => {
return {
type: ReduxActionTypes.CREATE_JS_ACTION_SUCCESS,
payload,
};
};
export const copyJSCollectionRequest = (payload: {
id: string;
destinationPageId: string;
name: string;
}) => {
return {
type: ReduxActionTypes.COPY_JS_ACTION_INIT,
payload,
};
};
export const copyJSCollectionSuccess = (payload: JSCollection) => {
return {
type: ReduxActionTypes.COPY_JS_ACTION_SUCCESS,
payload,
};
};
export const copyJSCollectionError = (payload: {
id: string;
destinationPageId: string;
}) => {
return {
type: ReduxActionErrorTypes.COPY_JS_ACTION_ERROR,
payload,
};
};
export const moveJSCollectionRequest = (payload: {
id: string;
destinationPageId: string;
name: string;
}) => {
return {
type: ReduxActionTypes.MOVE_JS_ACTION_INIT,
payload,
};
};
export const moveJSCollectionSuccess = (payload: JSCollection) => {
return {
type: ReduxActionTypes.MOVE_JS_ACTION_SUCCESS,
payload,
};
};
export const moveJSCollectionError = (payload: {
id: string;
originalPageId: string;
}) => {
return {
type: ReduxActionErrorTypes.MOVE_JS_ACTION_ERROR,
payload,
};
};
export const deleteJSCollection = (payload: { id: string; name: string }) => {
return {
type: ReduxActionTypes.DELETE_JS_ACTION_INIT,
payload,
};
};
export const deleteJSCollectionSuccess = (payload: { id: string }) => {
return {
type: ReduxActionTypes.DELETE_JS_ACTION_SUCCESS,
payload,
};
};
export const deleteJSCollectionError = (payload: { id: string }) => {
return {
type: ReduxActionErrorTypes.DELETE_JS_ACTION_ERROR,
payload,
};
};
export const saveJSObjectName = (payload: { id: string; name: string }) => ({
type: ReduxActionTypes.SAVE_JS_COLLECTION_NAME_INIT,
payload: payload,
});
export const fetchJSCollectionsForPage = (pageId: string) => {
return {
type: ReduxActionTypes.FETCH_JS_ACTIONS_FOR_PAGE_INIT,
payload: { pageId },
};
};
export const fetchJSCollectionsForPageSuccess = (actions: JSCollection[]) => {
return {
type: ReduxActionTypes.FETCH_JS_ACTIONS_FOR_PAGE_SUCCESS,
payload: actions,
};
};
export const fetchJSCollectionsForPageError = () => {
return {
type: ReduxActionErrorTypes.FETCH_JS_ACTIONS_FOR_PAGE_ERROR,
};
};
export const fetchJSCollectionsForView = ({
applicationId,
}: {
applicationId: string;
}): ReduxAction<FetchJSCollectionsPayload> => {
return {
type: ReduxActionTypes.FETCH_JS_ACTIONS_VIEW_MODE_INIT,
payload: { applicationId },
};
};
export default {
fetchJSCollections,
deleteJSCollection,
deleteJSCollectionSuccess,
};