PromucFlow_constructor/app/client/src/actions/userActions.ts
tkAppsmith 8342d15b03
feat: added api to return 1 product message (#24704)
## Description
> Need an api to vend out messages for users alerting them of breaking
changes in upcoming releases.
#### PR fixes following issue(s)
Fixes #23064
#### Type of change
- New feature (non-breaking change which adds functionality)

## Testing
>
#### How Has This Been Tested?
- [x] Manual
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> This should be tested using curl by hitting the api endpoint endpoint
without any context and get a message in return that was configured in a
config file.
## 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
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] 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

---------

Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Hetu Nandu <hetu@appsmith.com>
2023-07-18 13:03:18 +05:30

138 lines
3.5 KiB
TypeScript

import {
ReduxActionErrorTypes,
ReduxActionTypes,
} from "@appsmith/constants/ReduxActionConstants";
import { CurrentUserDetailsRequestPayload } from "constants/userConstants";
import type {
TokenPasswordUpdateRequest,
UpdateUserRequest,
VerifyTokenRequest,
} from "@appsmith/api/UserApi";
import type { FeatureFlags } from "@appsmith/entities/FeatureFlag";
import type {
ProductAlertConfig,
ProductAlertState,
} from "reducers/uiReducers/usersReducer";
export const logoutUser = (payload?: { redirectURL: string }) => ({
type: ReduxActionTypes.LOGOUT_USER_INIT,
payload,
});
export const logoutUserSuccess = (isEmptyInstance: boolean) => ({
type: ReduxActionTypes.LOGOUT_USER_SUCCESS,
payload: isEmptyInstance,
});
export const logoutUserError = (error: any) => ({
type: ReduxActionErrorTypes.LOGOUT_USER_ERROR,
payload: {
error,
},
});
export const setCurrentUserDetails = () => ({
type: ReduxActionTypes.SET_CURRENT_USER_INIT,
payload: CurrentUserDetailsRequestPayload,
});
export const verifyInviteSuccess = () => ({
type: ReduxActionTypes.VERIFY_INVITE_SUCCESS,
});
export const verifyInvite = (payload: VerifyTokenRequest) => ({
type: ReduxActionTypes.VERIFY_INVITE_INIT,
payload,
});
export const verifyInviteError = (error: any) => ({
type: ReduxActionErrorTypes.VERIFY_INVITE_ERROR,
payload: { error },
});
export const invitedUserSignup = (
payload: TokenPasswordUpdateRequest & { resolve: any; reject: any },
) => ({
type: ReduxActionTypes.INVITED_USER_SIGNUP_INIT,
payload,
});
export const invitedUserSignupSuccess = () => ({
type: ReduxActionTypes.INVITED_USER_SIGNUP_SUCCESS,
});
export const invitedUserSignupError = (error: any) => ({
type: ReduxActionErrorTypes.INVITED_USER_SIGNUP_ERROR,
payload: {
error,
},
});
export const updateUserDetails = (payload: UpdateUserRequest) => ({
type: ReduxActionTypes.UPDATE_USER_DETAILS_INIT,
payload,
});
export const updateIntercomConsent = () => ({
type: ReduxActionTypes.UPDATE_USER_INTERCOM_CONSENT,
});
export const updatePhoto = (payload: {
file: File;
callback?: (id: string) => void;
}) => ({
type: ReduxActionTypes.UPLOAD_PROFILE_PHOTO,
payload,
});
export const removePhoto = (callback: (id: string) => void) => ({
type: ReduxActionTypes.REMOVE_PROFILE_PHOTO,
payload: { callback },
});
export const updatePhotoId = (payload: { photoId: string }) => ({
type: ReduxActionTypes.UPDATE_PHOTO_ID,
payload,
});
export const leaveWorkspace = (workspaceId: string) => {
return {
type: ReduxActionTypes.LEAVE_WORKSPACE_INIT,
payload: {
workspaceId,
},
};
};
export const fetchFeatureFlagsInit = () => ({
type: ReduxActionTypes.FETCH_FEATURE_FLAGS_INIT,
});
export const fetchFeatureFlagsSuccess = (payload: FeatureFlags) => ({
type: ReduxActionTypes.FETCH_FEATURE_FLAGS_SUCCESS,
payload,
});
export const fetchFeatureFlagsError = (error: any) => ({
type: ReduxActionErrorTypes.FETCH_FEATURE_FLAGS_ERROR,
payload: { error, show: false },
});
export const fetchProductAlertInit = () => ({
type: ReduxActionTypes.FETCH_PRODUCT_ALERT_INIT,
});
export const fetchProductAlertSuccess = (productAlert: ProductAlertState) => ({
type: ReduxActionTypes.FETCH_PRODUCT_ALERT_SUCCESS,
payload: productAlert,
});
export const fetchProductAlertFailure = (error: any) => ({
type: ReduxActionErrorTypes.FETCH_PRODUCT_ALERT_FAILED,
payload: { error, show: false },
});
export const updateProductAlertConfig = (config: ProductAlertConfig) => ({
type: ReduxActionTypes.UPDATE_PRODUCT_ALERT_CONFIG,
payload: config,
});