Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 138x 138x 182x 182x 182x 182x | import type { SegmentationPublicInput } from '../../types/SegmentationStateTypes';
import { defaultSegmentationStateManager } from './SegmentationStateManager';
import { triggerSegmentationModified } from './triggerSegmentationEvents';
import normalizeSegmentationInput from './helpers/normalizeSegmentationInput';
/**
* It takes a segmentation input and adds it to the segmentation state manager
* @param segmentationInput - The segmentation to add.
* @param suppressEvents - If true, the event will not be triggered.
*/
export function addSegmentations(
segmentationInputArray: SegmentationPublicInput[],
suppressEvents?: boolean
): void {
const segmentationStateManager = defaultSegmentationStateManager;
segmentationInputArray.forEach((segmentationInput) => {
const segmentation = normalizeSegmentationInput(segmentationInput);
segmentationStateManager.addSegmentation(segmentation);
Eif (!suppressEvents) {
triggerSegmentationModified(segmentation.segmentationId);
}
});
}
export default addSegmentations;
|