@pega/dx-component-builder-sdk
Version:
Utility for building custom UI components
29 lines (22 loc) • 549 B
text/typescript
import { v4 as uuidv4 } from 'uuid';
export const mapStateToProps: any = (_, ownProps) => {
const { getPConnect } = ownProps;
return {
visibility: getPConnect().getComputedVisibility(),
getPConnect
};
};
export const getKeyForMappedField = field => {
if (Array.isArray(field)) {
return field
.map(item => {
return getKeyForMappedField(item);
})
.join('__');
}
const pConnect = field?.getPConnect?.();
if (pConnect?.meta) {
return JSON.stringify(pConnect.meta);
}
return uuidv4();
};