IO-3255 Clean up front end components for pm.
This commit is contained in:
@@ -123,3 +123,8 @@ export const setImexShopId = (imexshopid) => ({
|
||||
type: UserActionTypes.SET_IMEX_SHOP_ID,
|
||||
payload: imexshopid
|
||||
});
|
||||
|
||||
export const setPartsManagementOnly = (partsManagementOnly) => ({
|
||||
type: UserActionTypes.SET_PARTS_MANAGEMENT_ONLY,
|
||||
payload: partsManagementOnly
|
||||
});
|
||||
@@ -7,6 +7,7 @@ const INITIAL_STATE = {
|
||||
//language: "en-US"
|
||||
},
|
||||
bodyshop: null,
|
||||
partsManagementOnly: null,
|
||||
loginLoading: false,
|
||||
fingerprint: null,
|
||||
error: null,
|
||||
@@ -125,7 +126,11 @@ const userReducer = (state = INITIAL_STATE, action) => {
|
||||
...state,
|
||||
imexshopid: action.payload
|
||||
};
|
||||
|
||||
case UserActionTypes.SET_PARTS_MANAGEMENT_ONLY:
|
||||
return {
|
||||
...state,
|
||||
partsManagementOnly: action.payload
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import {
|
||||
setInstanceConflict,
|
||||
setInstanceId,
|
||||
setLocalFingerprint,
|
||||
setPartsManagementOnly,
|
||||
signInFailure,
|
||||
signInSuccess,
|
||||
signOutFailure,
|
||||
@@ -344,13 +345,13 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
||||
payload.features?.allAccess === true
|
||||
? window.$crisp.push(["set", "session:segments", [["allAccess"]]])
|
||||
: (() => {
|
||||
const featureKeys = Object.keys(payload.features).filter(
|
||||
(key) =>
|
||||
payload.features[key] === true ||
|
||||
(typeof payload.features[key] === "string" && !isNaN(Date.parse(payload.features[key])))
|
||||
);
|
||||
window.$crisp.push(["set", "session:segments", [["basic", ...featureKeys]]]);
|
||||
})();
|
||||
const featureKeys = Object.keys(payload.features).filter(
|
||||
(key) =>
|
||||
payload.features[key] === true ||
|
||||
(typeof payload.features[key] === "string" && !isNaN(Date.parse(payload.features[key])))
|
||||
);
|
||||
window.$crisp.push(["set", "session:segments", [["basic", ...featureKeys]]]);
|
||||
})();
|
||||
|
||||
InstanceRenderManager({
|
||||
executeFunction: true,
|
||||
@@ -359,6 +360,10 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
|
||||
window.$zoho.salesiq.visitor.info({ "Shop Name": payload.shopname });
|
||||
}
|
||||
});
|
||||
|
||||
//Set whether it is for parts management only.
|
||||
|
||||
yield put(setPartsManagementOnly(true || payload.features.partsManagementOnly));
|
||||
} catch (error) {
|
||||
console.warn("Couldnt find $crisp.", error.message);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { create } from "lodash";
|
||||
import { createSelector } from "reselect";
|
||||
|
||||
const selectUser = (state) => state.user;
|
||||
@@ -17,3 +18,7 @@ export const selectAuthLevel = createSelector([selectUser], (user) => user.authL
|
||||
export const selectLoginLoading = createSelector([selectUser], (user) => user.loginLoading);
|
||||
|
||||
export const selectCurrentEula = createSelector([selectUser], (user) => user.currentEula);
|
||||
export const selectPartsManagementOnly = createSelector(
|
||||
[selectUser],
|
||||
(user) => user.partsManagementOnly
|
||||
);
|
||||
@@ -33,6 +33,7 @@ const UserActionTypes = {
|
||||
CHECK_ACTION_CODE_FAILURE: "CHECK_ACTION_CODE_FAILURE",
|
||||
SET_CURRENT_EULA: "SET_CURRENT_EULA",
|
||||
EULA_ACCEPTED: "EULA_ACCEPTED",
|
||||
SET_IMEX_SHOP_ID: "SET_IMEX_SHOP_ID"
|
||||
SET_IMEX_SHOP_ID: "SET_IMEX_SHOP_ID",
|
||||
SET_PARTS_MANAGEMENT_ONLY: "SET_PARTS_MANAGEMENT_ONLY",
|
||||
};
|
||||
export default UserActionTypes;
|
||||
|
||||
Reference in New Issue
Block a user