@quitting/ui 1.3.0 → 1.3.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"global-methods.d.ts","sourceRoot":"","sources":["../src/global-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAyElD,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAA;IAGpB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;IAI1E,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CACvC;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,cAAc,QA6GxF;AAGD,eAAO,MAAM,IAAI;iBAEF,MAAM;iBAKA,MAAM,SAAQ,QAAQ;mBAwCpB;QAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;CAqB7D,CAAA"}
1
+ {"version":3,"file":"global-methods.d.ts","sourceRoot":"","sources":["../src/global-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE9B,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AA2ElD,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAA;IAGpB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;IAI1E,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CACvC;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,cAAc,QAqHxF;AAGD,eAAO,MAAM,IAAI;iBAEF,MAAM;iBAKA,MAAM,SAAQ,QAAQ;mBAwCpB;QAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;CAqB7D,CAAA"}
package/dist/im-ui.es.js CHANGED
@@ -2142,15 +2142,15 @@ var he = {
2142
2142
  ])], !0)
2143
2143
  ], 2));
2144
2144
  }
2145
- }), [["__scopeId", "data-v-91f8ce15"]]), $, pr, mr = /* @__PURE__ */ new Map(), hr = !1;
2146
- function gr() {
2147
- return hr || !!$.call?.currentSession || !!$.meeting?.currentSession;
2148
- }
2145
+ }), [["__scopeId", "data-v-91f8ce15"]]), $, pr, mr = null, hr = /* @__PURE__ */ new Map(), gr = !1;
2149
2146
  function _r() {
2147
+ return gr || !!$.call?.currentSession || !!$.meeting?.currentSession;
2148
+ }
2149
+ function vr() {
2150
2150
  let e = document.querySelector("div.im-invite-stack");
2151
2151
  return e || (e = document.createElement("div"), e.className = "im-invite-stack", e.style.position = "fixed", e.style.top = "24px", e.style.right = "24px", e.style.zIndex = "10000", e.style.display = "flex", e.style.flexDirection = "column", e.style.gap = "12px", e.style.pointerEvents = "none", document.body.appendChild(e), e);
2152
2152
  }
2153
- async function vr(e) {
2153
+ async function yr(e) {
2154
2154
  let t = $.users;
2155
2155
  if (t?.resolve) {
2156
2156
  let n = await t.resolve(e).catch(() => void 0);
@@ -2158,13 +2158,13 @@ async function vr(e) {
2158
2158
  }
2159
2159
  return e;
2160
2160
  }
2161
- function yr(e, t, n) {
2162
- $ = e, pr = n, te(t), B(e), n?.autoPopups !== !1 && ($.on("call:invite", (e) => {
2163
- if (gr()) {
2161
+ function br(e, t, n) {
2162
+ $ = e, pr = n, te(t), B(e), mr !== e && (mr = e, n?.autoPopups !== !1 && ($.on("call:invite", (e) => {
2163
+ if (_r()) {
2164
2164
  $.transport.callEnd(e.callId, "busy").catch(() => {});
2165
2165
  return;
2166
2166
  }
2167
- hr = !0, R(je, {
2167
+ gr = !0, R(je, {
2168
2168
  mode: "incoming",
2169
2169
  peerUid: e.from,
2170
2170
  callType: e.callType,
@@ -2176,11 +2176,11 @@ function yr(e, t, n) {
2176
2176
  });
2177
2177
  },
2178
2178
  onClose: () => {
2179
- hr = !1;
2179
+ gr = !1;
2180
2180
  }
2181
2181
  });
2182
2182
  }), $.on("meeting:invite", async (e) => {
2183
- if ($.meeting?.currentSession) return;
2183
+ if ($.meeting?.currentSession || $.realtime.state !== "connected") return;
2184
2184
  try {
2185
2185
  if (!((await $.transport.meetingPendingInvites()).invites || []).some((t) => t.meetingId === e.meetingId)) {
2186
2186
  console.warn("[im-ui] stale meeting_invite 丢弃(会议已结束)", e.meetingId);
@@ -2189,10 +2189,10 @@ function yr(e, t, n) {
2189
2189
  } catch (e) {
2190
2190
  console.warn("[im-ui] invite 校验失败,默认透传", e);
2191
2191
  }
2192
- z(mr.get(e.meetingId) || null), mr.delete(e.meetingId);
2192
+ z(hr.get(e.meetingId) || null), hr.delete(e.meetingId);
2193
2193
  let t = R(Kn, {
2194
2194
  invite: e,
2195
- conflict: gr(),
2195
+ conflict: _r(),
2196
2196
  onAccepted: () => {
2197
2197
  let e = $.meeting?.currentSession;
2198
2198
  R(Ln, {
@@ -2203,14 +2203,14 @@ function yr(e, t, n) {
2203
2203
  });
2204
2204
  },
2205
2205
  onClose: () => {
2206
- mr.delete(e.meetingId);
2206
+ hr.delete(e.meetingId);
2207
2207
  }
2208
- }, _r());
2209
- mr.set(e.meetingId, t);
2208
+ }, vr());
2209
+ hr.set(e.meetingId, t);
2210
2210
  }), $.on("meeting:dissolved", (e) => {
2211
- z(mr.get(e.meetingId) || null), mr.delete(e.meetingId);
2211
+ z(hr.get(e.meetingId) || null), hr.delete(e.meetingId);
2212
2212
  }), $.on("meeting:kicked", (e) => {
2213
- z(mr.get(e.meetingId) || null), mr.delete(e.meetingId);
2213
+ z(hr.get(e.meetingId) || null), hr.delete(e.meetingId);
2214
2214
  })), $.on("session:kicked", (e) => {
2215
2215
  alert(`您的账号在其他 ${e.clientType === 4 ? "Web" : e.clientType === 1 ? "PC" : "移动端"} 登录,已强制下线`), window.location.reload();
2216
2216
  }), window.addEventListener("beforeunload", () => {
@@ -2221,9 +2221,9 @@ function yr(e, t, n) {
2221
2221
  });
2222
2222
  let t = $?.meeting?.currentSession;
2223
2223
  t && $.transport.sendBeacon(`/meeting/${t.meetingId}/leave`, {});
2224
- });
2224
+ }));
2225
2225
  }
2226
- var br = {
2226
+ var xr = {
2227
2227
  chat(e) {
2228
2228
  R(fr, { to: e });
2229
2229
  },
@@ -2235,14 +2235,14 @@ var br = {
2235
2235
  de.error(fe(e, "发起通话失败"));
2236
2236
  return;
2237
2237
  }
2238
- hr = !0;
2238
+ gr = !0;
2239
2239
  let r = null;
2240
2240
  r = R(je, {
2241
2241
  mode: "outgoing",
2242
2242
  peerUid: e,
2243
2243
  callType: t,
2244
2244
  onConnected: () => {
2245
- z(r), r = null, hr = !1, n.connect().then(() => {
2245
+ z(r), r = null, gr = !1, n.connect().then(() => {
2246
2246
  n.enableDevices().catch((e) => console.warn("[im] 主叫 enableDevices 异常", e)), R(Se, {
2247
2247
  mode: "caller",
2248
2248
  callType: t
@@ -2255,31 +2255,31 @@ var br = {
2255
2255
  },
2256
2256
  async meeting(e) {
2257
2257
  if (!e?.invitees) {
2258
- if (xr) return;
2259
- xr = R(Qn, {
2258
+ if (Sr) return;
2259
+ Sr = R(Qn, {
2260
2260
  onConfirm: (e, t) => {
2261
- br.meeting({
2261
+ xr.meeting({
2262
2262
  invitees: e,
2263
2263
  title: t
2264
2264
  });
2265
2265
  },
2266
2266
  onClose: () => {
2267
- xr = null;
2267
+ Sr = null;
2268
2268
  }
2269
2269
  });
2270
2270
  return;
2271
2271
  }
2272
- if (!Sr) {
2273
- Sr = !0;
2272
+ if (!Cr) {
2273
+ Cr = !0;
2274
2274
  try {
2275
- await Cr(e.invitees, e.title || "即时会议");
2275
+ await wr(e.invitees, e.title || "即时会议");
2276
2276
  } finally {
2277
- Sr = !1;
2277
+ Cr = !1;
2278
2278
  }
2279
2279
  }
2280
2280
  }
2281
- }, xr = null, Sr = !1;
2282
- async function Cr(e, t) {
2281
+ }, Sr = null, Cr = !1;
2282
+ async function wr(e, t) {
2283
2283
  let n;
2284
2284
  try {
2285
2285
  n = await $.meeting.create(e, t);
@@ -2290,7 +2290,7 @@ async function Cr(e, t) {
2290
2290
  let r = n.busyInvitees || [];
2291
2291
  if (e.length > 0 && r.length >= e.length) {
2292
2292
  $.meeting.currentSession?.leave($.transport).catch(() => {});
2293
- let e = (await Promise.all(r.map(vr))).join("、");
2293
+ let e = (await Promise.all(r.map(yr))).join("、");
2294
2294
  de.error(`${e} 均正忙,会议未能创建`);
2295
2295
  return;
2296
2296
  }
@@ -2300,16 +2300,16 @@ async function Cr(e, t) {
2300
2300
  resolveUser: pr?.resolveUser,
2301
2301
  invitePicker: pr?.invitePicker
2302
2302
  }), r.length > 0) {
2303
- let e = (await Promise.all(r.map(vr))).join("、");
2303
+ let e = (await Promise.all(r.map(yr))).join("、");
2304
2304
  de.info(`${e} 正忙,未能邀请加入会议`);
2305
2305
  }
2306
2306
  }
2307
2307
  //#endregion
2308
2308
  //#region src/components/CallOutgoing.vue?vue&type=script&setup=true&lang.ts
2309
- var wr = { class: "call-out-window" }, Tr = { class: "call-out-header" }, Er = { class: "call-out-body" }, Dr = { class: "call-out-name" }, Or = { class: "call-out-status" }, kr = {
2309
+ var Tr = { class: "call-out-window" }, Er = { class: "call-out-header" }, Dr = { class: "call-out-body" }, Or = { class: "call-out-name" }, kr = { class: "call-out-status" }, Ar = {
2310
2310
  key: 0,
2311
2311
  class: "ringing-dots"
2312
- }, Ar = { class: "call-out-actions" }, jr = /*#__PURE__*/ H(/* @__PURE__ */ d({
2312
+ }, jr = { class: "call-out-actions" }, Mr = /*#__PURE__*/ H(/* @__PURE__ */ d({
2313
2313
  __name: "CallOutgoing",
2314
2314
  props: {
2315
2315
  calleeUid: {},
@@ -2354,12 +2354,12 @@ var wr = { class: "call-out-window" }, Tr = { class: "call-out-header" }, Er = {
2354
2354
  }, t * 1e3);
2355
2355
  }), y(() => {
2356
2356
  u.forEach((e) => e()), d && clearTimeout(d);
2357
- }), (t, n) => P((S(), o("div", wr, [
2358
- s("div", Tr, [s("span", null, D(e.callType === "video" ? "视频通话" : "语音通话"), 1)]),
2359
- s("div", Er, [
2357
+ }), (t, n) => P((S(), o("div", Tr, [
2358
+ s("div", Er, [s("span", null, D(e.callType === "video" ? "视频通话" : "语音通话"), 1)]),
2359
+ s("div", Dr, [
2360
2360
  s("div", { class: g(["call-out-avatar", i.value === "ringing" ? "ringing" : i.value]) }, D((e.calleeName || e.calleeUid)[0].toUpperCase()), 3),
2361
- s("div", Dr, D(e.calleeName || e.calleeUid), 1),
2362
- s("div", Or, [i.value === "ringing" ? (S(), o("span", kr, [...n[0] ||= [
2361
+ s("div", Or, D(e.calleeName || e.calleeUid), 1),
2362
+ s("div", kr, [i.value === "ringing" ? (S(), o("span", Ar, [...n[0] ||= [
2363
2363
  l(" 呼叫中", -1),
2364
2364
  s("span", { class: "dot" }, "·", -1),
2365
2365
  s("span", { class: "dot" }, "·", -1),
@@ -2369,14 +2369,14 @@ var wr = { class: "call-out-window" }, Tr = { class: "call-out-header" }, Er = {
2369
2369
  class: g(i.value)
2370
2370
  }, D(c.value), 3))])
2371
2371
  ]),
2372
- s("div", Ar, [i.value === "ringing" ? (S(), o("button", {
2372
+ s("div", jr, [i.value === "ringing" ? (S(), o("button", {
2373
2373
  key: 0,
2374
2374
  class: "cancel-btn",
2375
2375
  onClick: m
2376
2376
  }, "取消")) : a("", !0)])
2377
2377
  ])), [[O(he), ".call-out-header"]]);
2378
2378
  }
2379
- }), [["__scopeId", "data-v-625d9e2f"]]), Mr = { class: "im-incoming-ring" }, Nr = ["src"], Pr = { class: "im-ring-content" }, Fr = { class: "im-ring-avatar" }, Ir = { class: "im-ring-info" }, Lr = { class: "im-ring-name" }, Rr = { class: "im-ring-type" }, zr = /*#__PURE__*/ H(/* @__PURE__ */ d({
2379
+ }), [["__scopeId", "data-v-625d9e2f"]]), Nr = { class: "im-incoming-ring" }, Pr = ["src"], Fr = { class: "im-ring-content" }, Ir = { class: "im-ring-avatar" }, Lr = { class: "im-ring-info" }, Rr = { class: "im-ring-name" }, zr = { class: "im-ring-type" }, Br = /*#__PURE__*/ H(/* @__PURE__ */ d({
2380
2380
  __name: "IncomingRing",
2381
2381
  props: {
2382
2382
  invite: {},
@@ -2420,19 +2420,19 @@ var wr = { class: "call-out-window" }, Tr = { class: "call-out-header" }, Er = {
2420
2420
  async function p() {
2421
2421
  l(), await a()?.call?.end("rejected", n.invite.callId), r("close");
2422
2422
  }
2423
- return (t, n) => (S(), o("div", Mr, [s("audio", {
2423
+ return (t, n) => (S(), o("div", Nr, [s("audio", {
2424
2424
  ref_key: "ringAudio",
2425
2425
  ref: i,
2426
2426
  src: O(we),
2427
2427
  loop: "",
2428
2428
  preload: "auto"
2429
- }, null, 8, Nr), s("div", Pr, [
2430
- s("div", Fr, [u(G, {
2429
+ }, null, 8, Pr), s("div", Fr, [
2430
+ s("div", Ir, [u(G, {
2431
2431
  name: "answer",
2432
2432
  size: 24,
2433
2433
  color: "#fff"
2434
2434
  })]),
2435
- s("div", Ir, [s("div", Lr, D(e.invite.from), 1), s("div", Rr, D(e.invite.callType === "video" ? "视频通话" : "语音通话"), 1)]),
2435
+ s("div", Lr, [s("div", Rr, D(e.invite.from), 1), s("div", zr, D(e.invite.callType === "video" ? "视频通话" : "语音通话"), 1)]),
2436
2436
  s("div", { class: "im-ring-actions" }, [s("button", {
2437
2437
  class: "im-reject",
2438
2438
  onClick: p
@@ -2442,17 +2442,17 @@ var wr = { class: "call-out-window" }, Tr = { class: "call-out-header" }, Er = {
2442
2442
  }, "接听")])
2443
2443
  ])]));
2444
2444
  }
2445
- }), [["__scopeId", "data-v-18096666"]]), Br = { install(e, t) {
2445
+ }), [["__scopeId", "data-v-18096666"]]), Vr = { install(e, t) {
2446
2446
  if (!t?.client) throw Error("ImUI 安装时必须传入 client(已初始化的 ImClient)");
2447
- e.component("ImIcon", G), e.component("ImCallWindow", Se), e.component("ImCallDialog", je), e.component("ImCallOutgoing", jr), e.component("ImMeetWindow", Ln), e.component("ImIncomingRing", zr), e.component("ImMeetingInvite", Kn), e.component("ImChatPanel", fr), e.component("ImUserPickerList", mn), e.component("ImUserPickerDialog", xn), e.component("ImMeetingCreateDialog", Qn), yr(t.client, e, {
2447
+ e.component("ImIcon", G), e.component("ImCallWindow", Se), e.component("ImCallDialog", je), e.component("ImCallOutgoing", Mr), e.component("ImMeetWindow", Ln), e.component("ImIncomingRing", Br), e.component("ImMeetingInvite", Kn), e.component("ImChatPanel", fr), e.component("ImUserPickerList", mn), e.component("ImUserPickerDialog", xn), e.component("ImMeetingCreateDialog", Qn), br(t.client, e, {
2448
2448
  autoPopups: t.autoPopups,
2449
2449
  resolveUser: t.resolveUser
2450
2450
  });
2451
2451
  } };
2452
- function Vr(e, t, n) {
2453
- yr(e, t, n);
2452
+ function Hr(e, t, n) {
2453
+ br(e, t, n);
2454
2454
  }
2455
2455
  //#endregion
2456
- export { je as CallDialog, jr as CallOutgoing, Se as CallWindow, fr as ChatPanel, G as Icon, de as ImToast, br as ImUI, Br as ImUIPlugin, Br as default, zr as IncomingRing, Ln as MeetWindow, Qn as MeetingCreateDialog, Kn as MeetingInvite, xn as UserPickerDialog, mn as UserPickerList, fe as friendlyApiError, Vr as setupImUI };
2456
+ export { je as CallDialog, Mr as CallOutgoing, Se as CallWindow, fr as ChatPanel, G as Icon, de as ImToast, xr as ImUI, Vr as ImUIPlugin, Vr as default, Br as IncomingRing, Ln as MeetWindow, Qn as MeetingCreateDialog, Kn as MeetingInvite, xn as UserPickerDialog, mn as UserPickerList, fe as friendlyApiError, Hr as setupImUI };
2457
2457
 
2458
2458
  //# sourceMappingURL=im-ui.es.js.map