oasis-chat 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -2257,20 +2257,43 @@ async function ur(e, t, n) {
2257
2257
  return console.error("로그인 실패:", r), !1;
2258
2258
  }
2259
2259
  }
2260
- async function or() {
2261
- const e = await fetch("/src/app/components/organisms/ChatWindow.html");
2262
- if (!e.ok)
2263
- throw new Error(`Failed to load ChatWindow template: ${e.statusText}`);
2264
- return await e.text();
2265
- }
2260
+ const or = `<div class="chat-window-root" style="z-index: 1000;">
2261
+ <!-- 헤더 -->
2262
+ <div class="chat-window-header">
2263
+ <h3 class="chat-window-title">채팅</h3>
2264
+ <button
2265
+ class="chat-close-btn"
2266
+ style="font-size: 24px;"
2267
+ >×</button>
2268
+ </div>
2269
+
2270
+ <!-- 메시지 영역 -->
2271
+ <div class="chat-messages"></div>
2272
+
2273
+ <!-- 입력 영역 -->
2274
+ <div class="chat-window-footer">
2275
+ <div class="chat-input-container">
2276
+ <input
2277
+ type="text"
2278
+ placeholder="메시지를 입력하세요..."
2279
+ class="chat-input"
2280
+ />
2281
+ <button class="chat-send-btn">전송</button>
2282
+ </div>
2283
+ </div>
2284
+ </div>
2285
+
2286
+ `;
2266
2287
  function M(e, t) {
2267
2288
  e.className = g(t);
2268
2289
  }
2269
- async function lr(e) {
2290
+ function lr(e) {
2270
2291
  let t = !1;
2271
- const n = await or(), r = document.createElement("div");
2292
+ const n = or, r = document.createElement("div");
2272
2293
  r.innerHTML = n.trim();
2273
2294
  const s = r.firstElementChild;
2295
+ if (!s)
2296
+ throw new Error("Failed to create chat window: template is empty");
2274
2297
  M(s, [
2275
2298
  "absolute bottom-full right-0 mb-2 bg-blue-200",
2276
2299
  "w-96 h-[500px]",
@@ -2279,15 +2302,15 @@ async function lr(e) {
2279
2302
  "hidden"
2280
2303
  ]);
2281
2304
  const a = s.querySelector(".chat-window-header");
2282
- M(a, [
2305
+ a && M(a, [
2283
2306
  "flex items-center justify-between",
2284
2307
  "p-4 border-b border-gray-200",
2285
2308
  "bg-gray-50 rounded-t-lg"
2286
2309
  ]);
2287
2310
  const c = s.querySelector(".chat-window-title");
2288
- M(c, "text-lg font-semibold text-gray-800");
2311
+ c && M(c, "text-lg font-semibold text-gray-800");
2289
2312
  const u = s.querySelector(".chat-close-btn");
2290
- M(u, [
2313
+ u && M(u, [
2291
2314
  "w-8 h-8",
2292
2315
  "flex items-center justify-center",
2293
2316
  "text-gray-500 hover:text-gray-700",
@@ -2295,30 +2318,32 @@ async function lr(e) {
2295
2318
  "chat-close-btn"
2296
2319
  ]);
2297
2320
  const d = s.querySelector(".chat-messages");
2298
- M(d, [
2321
+ d && M(d, [
2299
2322
  "flex-1 overflow-y-auto p-4 space-y-4",
2300
2323
  "bg-white",
2301
2324
  "chat-messages"
2302
2325
  ]);
2303
2326
  const o = s.querySelector(".chat-window-footer");
2304
- M(o, ["p-4 border-t border-gray-200", "bg-gray-50 rounded-b-lg"]);
2327
+ o && M(o, ["p-4 border-t border-gray-200", "bg-gray-50 rounded-b-lg"]);
2305
2328
  const i = s.querySelector(".chat-input-container");
2306
- M(i, "flex gap-2");
2329
+ i && M(i, "flex gap-2");
2307
2330
  const z = s.querySelector(".chat-input");
2308
- M(z, [
2331
+ z && M(z, [
2309
2332
  "flex-1 px-4 py-2",
2310
2333
  "border border-gray-300 rounded-lg",
2311
2334
  "focus:outline-none focus:ring-2 focus:ring-blue-500",
2312
2335
  "chat-input"
2313
2336
  ]);
2314
2337
  const w = s.querySelector(".chat-send-btn");
2315
- M(w, [
2338
+ if (w && M(w, [
2316
2339
  "px-4 py-2",
2317
2340
  "bg-blue-500 text-white rounded-lg",
2318
2341
  "hover:bg-blue-600",
2319
2342
  "disabled:bg-gray-300 disabled:cursor-not-allowed",
2320
2343
  "chat-send-btn"
2321
- ]), u.addEventListener("click", () => {
2344
+ ]), !u || !d || !z || !w)
2345
+ throw new Error("Failed to create chat window: required elements not found");
2346
+ u.addEventListener("click", () => {
2322
2347
  s.classList.add("hidden"), t = !1;
2323
2348
  });
2324
2349
  const m = () => {
@@ -2372,8 +2397,8 @@ function Mr({ account_id: e, password: t, assistant_uuid: n } = {}) {
2372
2397
  const s = document.createElement("button");
2373
2398
  s.type = "button", s.className = g("relative bg-orange-200");
2374
2399
  const a = document.createElement("img");
2375
- return a.src = bt, a.alt = "Button", a.className = g("w-12 h-12", "rounded-full"), s.appendChild(a), r.appendChild(s), s.addEventListener("click", async (c) => {
2376
- c.preventDefault(), je || (je = await lr(r)), je.openChat();
2400
+ return a.src = bt, a.alt = "Button", a.className = g("w-12 h-12", "rounded-full"), s.appendChild(a), r.appendChild(s), s.addEventListener("click", (c) => {
2401
+ c.preventDefault(), je || (je = lr(r)), je.openChat();
2377
2402
  }), e && t && (async () => (s.disabled = !0, s.style.opacity = "0.5", s.style.cursor = "wait", zr(e, t).then((c) => {
2378
2403
  c ? (s.disabled = !1, s.style.opacity = "", s.style.cursor = "") : (console.error("로그인 실패"), s.disabled = !0, s.style.opacity = "0.3", s.title = "로그인 실패");
2379
2404
  }).catch((c) => {