UNPKG

@wordpress/editor

Version:
81 lines (79 loc) 3.28 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // packages/editor/src/utils/sync-error-messages.ts var sync_error_messages_exports = {}; __export(sync_error_messages_exports, { AUTHENTICATION_FAILED: () => AUTHENTICATION_FAILED, CONNECTION_EXPIRED: () => CONNECTION_EXPIRED, CONNECTION_LIMIT_EXCEEDED: () => CONNECTION_LIMIT_EXCEEDED, DOCUMENT_SIZE_LIMIT_EXCEEDED: () => DOCUMENT_SIZE_LIMIT_EXCEEDED, UNKNOWN_ERROR: () => UNKNOWN_ERROR, getSyncErrorMessages: () => getSyncErrorMessages }); module.exports = __toCommonJS(sync_error_messages_exports); var import_i18n = require("@wordpress/i18n"); var AUTHENTICATION_FAILED = "authentication-failed"; var CONNECTION_EXPIRED = "connection-expired"; var CONNECTION_LIMIT_EXCEEDED = "connection-limit-exceeded"; var DOCUMENT_SIZE_LIMIT_EXCEEDED = "document-size-limit-exceeded"; var UNKNOWN_ERROR = "unknown-error"; var ERROR_MESSAGES = { [AUTHENTICATION_FAILED]: { title: (0, import_i18n.__)("Unable to connect"), description: (0, import_i18n.__)( "Real-time collaboration couldn't verify your permissions. Check that you have access to edit this post or contact your site administrator." ) }, [CONNECTION_EXPIRED]: { title: (0, import_i18n.__)("Connection expired"), description: (0, import_i18n.__)( "Your connection to real-time collaboration has timed out. Editing is paused to prevent conflicts with other editors." ) }, [CONNECTION_LIMIT_EXCEEDED]: { title: (0, import_i18n.__)("Too many editors connected"), description: (0, import_i18n.__)( "Real-time collaboration has reached its connection limit. Try again later or contact your site administrator." ) }, // DOCUMENT_SIZE_LIMIT_EXCEEDED is not included here because it results in // collaboration being disabled entirely. [UNKNOWN_ERROR]: { title: (0, import_i18n.__)("Connection lost"), description: (0, import_i18n.__)( "The connection to real-time collaboration was interrupted. Editing is paused to prevent conflicts with other editors." ) } }; function getSyncErrorMessages(error) { if (error?.code && ERROR_MESSAGES[error?.code]) { return ERROR_MESSAGES[error.code]; } return ERROR_MESSAGES[UNKNOWN_ERROR]; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { AUTHENTICATION_FAILED, CONNECTION_EXPIRED, CONNECTION_LIMIT_EXCEEDED, DOCUMENT_SIZE_LIMIT_EXCEEDED, UNKNOWN_ERROR, getSyncErrorMessages }); //# sourceMappingURL=sync-error-messages.cjs.map