<template>
  <div class="chat-aggregate-wrapper">
    <iframe
      v-if="chatUrl"
      :src="chatUrl"
      class="chat-iframe"
      frameborder="0"
    />
  </div>
</template>

<script>
export default {
  name: 'ChatAggregate',
  data() {
    return {
      chatUrl: ''
    }
  },
  created() {
    const tenantCode = localStorage.getItem('tenantCode') || '';
    const baseApi = process.env.VUE_APP_BASE_API || '/prod-api';
    const params = new URLSearchParams();
    if (tenantCode) params.set('tenantCode', tenantCode);
    params.set('baseApi', baseApi);
    params.set('frontendType', 'admin');
    this.chatUrl = `/chat-aggregate.html?${params.toString()}`;
  }
}
</script>

<style scoped>
.chat-aggregate-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}
.chat-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
</style>
