UNPKG

stream-chat-react-native-core

Version:

The official React Native and Expo components for Stream Chat, a service for building chat applications

49 lines 2.94 kB
Object.defineProperty(exports, "__esModule", { value: true }); exports.useOwnCapabilitiesContext = exports.allOwnCapabilities = exports.OwnCapabilitiesProvider = exports.OwnCapabilitiesContext = void 0; var _react = _interopRequireWildcard(require("react")); var _defaultBaseContextValue = require("../utils/defaultBaseContextValue"); var _isTestEnvironment = require("../utils/isTestEnvironment"); var _jsxRuntime = require("react/jsx-runtime"); var _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.tsx"; function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } var allOwnCapabilities = exports.allOwnCapabilities = { banChannelMembers: 'ban-channel-members', castPollVote: 'cast-poll-vote', deleteAnyMessage: 'delete-any-message', deleteOwnMessage: 'delete-own-message', flagMessage: 'flag-message', pinMessage: 'pin-message', queryPollVotes: 'query-poll-votes', quoteMessage: 'quote-message', readEvents: 'read-events', sendLinks: 'send-links', sendMessage: 'send-message', sendPoll: 'send-poll', sendReaction: 'send-reaction', sendReply: 'send-reply', sendTypingEvents: 'send-typing-events', updateAnyMessage: 'update-any-message', updateChannelMembers: 'update-channel-members', updateOwnMessage: 'update-own-message', uploadFile: 'upload-file' }; var OwnCapabilitiesContext = exports.OwnCapabilitiesContext = _react.default.createContext(_defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE); var OwnCapabilitiesProvider = ({ children, value }) => (0, _jsxRuntime.jsx)(OwnCapabilitiesContext.Provider, { value: value, children: children }); exports.OwnCapabilitiesProvider = OwnCapabilitiesProvider; var useOwnCapabilitiesContext = () => { var contextValue = (0, _react.useContext)(OwnCapabilitiesContext); if (contextValue === _defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE && !(0, _isTestEnvironment.isTestEnvironment)()) { throw new Error('The useOwnCapabilitiesContext hook was called outside the Channel Component. Make sure you have configured Channel component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#channel'); } return contextValue; }; exports.useOwnCapabilitiesContext = useOwnCapabilitiesContext; //# sourceMappingURL=OwnCapabilitiesContext.js.map