UNPKG

@azure/communication-react

Version:

React library for building modern communication user experiences utilizing Azure Communication Services

57 lines 2.12 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. /** * @private */ export const MAXIMUM_LENGTH_OF_MESSAGE = 8000; const EMPTY_MESSAGE_REGEX = /^\s*$/; /** * @private */ export const isMessageTooLong = (valueLength) => { return valueLength > MAXIMUM_LENGTH_OF_MESSAGE; }; /** * @private */ export const sanitizeText = (message) => { if (EMPTY_MESSAGE_REGEX.test(message)) { return ''; } else { return message; } }; /** * Determines whether the send box should be disabled. * * @param hasContent - Indicates whether the send box has content. * @param hasCompletedAttachmentUploads - Indicates whether attachment uploads have completed. * @param hasError - Indicates whether there is an error. * @param disabled - Indicates whether the send box is disabled. * @returns A boolean value indicating whether the send box should be disabled. */ export const isSendBoxButtonDisabled = ({ hasContent, hasError, disabled }) => { return ( // no content !hasContent || //error message exists hasError || disabled); }; /** * @internal */ export const modifyInlineImagesInContentString = (content, initialInlineImages, onCompleted) => __awaiter(void 0, void 0, void 0, function* () { let newContent = content; onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(newContent); }); //# sourceMappingURL=SendBoxUtils.js.map