"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.OnMeetView = void 0;
exports.destroy = destroy;
exports.initSdk = initSdk;
exports.openMeeting = openMeeting;
exports.setListener = setListener;
var _reactNative = require("react-native");
const LINKING_ERROR = `The package 'react-native-onmeeting-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
  ios: "- You have run 'pod install'\n",
  default: ''
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
const OnmeetingSdk = _reactNative.NativeModules.OnmeetingSdk ? _reactNative.NativeModules.OnmeetingSdk : new Proxy({}, {
  get() {
    throw new Error(LINKING_ERROR);
  }
});
const emitter = new _reactNative.NativeEventEmitter(OnmeetingSdk);
const OnMeetView = (0, _reactNative.requireNativeComponent)('OnmeetingSdk');
exports.OnMeetView = OnMeetView;
function initSdk() {
  return OnmeetingSdk.initSdk();
}
function openMeeting(publicKey, accessToken) {
  return OnmeetingSdk.openMeeting(publicKey, accessToken);
}
function destroy() {
  return OnmeetingSdk.destroy();
}
function setListener(options) {
  if (options) {
    emitter.addListener("onConferenceJoined", data => {
      if (typeof options.onConferenceJoined === "function") options.onConferenceJoined(data);
    });
    emitter.addListener("onConferenceTerminated", data => {
      if (typeof options.onConferenceTerminated === "function") options.onConferenceTerminated(data);
    });
    emitter.addListener("onConferenceWillJoin", data => {
      if (typeof options.onConferenceWillJoin === "function") options.onConferenceWillJoin(data);
    });
    emitter.addListener("onAudioMutedChanged", data => {
      if (typeof options.onAudioMutedChanged === "function") options.onAudioMutedChanged(data);
    });
    emitter.addListener("onParticipantJoined", data => {
      if (typeof options.onParticipantJoined === "function") options.onParticipantJoined(data);
    });
    emitter.addListener("onParticipantLeft", data => {
      if (typeof options.onParticipantLeft === "function") options.onParticipantLeft(data);
    });
    emitter.addListener("onEndpointTextMessageReceived", data => {
      if (typeof options.onEndpointTextMessageReceived === "function") options.onEndpointTextMessageReceived(data);
    });
    emitter.addListener("onScreenShareToggled", data => {
      if (typeof options.onScreenShareToggled === "function") options.onScreenShareToggled(data);
    });
    emitter.addListener("onParticipantsInfoRetrieved", data => {
      if (typeof options.onParticipantsInfoRetrieved === "function") options.onParticipantsInfoRetrieved(data);
    });
    emitter.addListener("onChatMessageReceived", data => {
      if (typeof options.onChatMessageReceived === "function") options.onChatMessageReceived(data);
    });
    emitter.addListener("onChatToggled", data => {
      if (typeof options.onChatToggled === "function") options.onChatToggled(data);
    });
    emitter.addListener("onVideoMutedChanged", data => {
      if (typeof options.onVideoMutedChanged === "function") options.onVideoMutedChanged(data);
    });
    emitter.addListener("onReadyToClose", data => {
      if (typeof options.onReadyToClose === "function") options.onReadyToClose(data);
    });
  }
}
//# sourceMappingURL=index.js.map