@yinshan-tech/webrtc-react 0.1.1 → 0.8.0

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.
Files changed (39) hide show
  1. package/README.md +78 -66
  2. package/dist/CallWidget.d.ts +41 -0
  3. package/dist/CallWidget.js +266 -0
  4. package/dist/CallWidget.js.map +1 -0
  5. package/dist/OutboundCallButton.d.ts +20 -20
  6. package/dist/OutboundCallButton.js +57 -45
  7. package/dist/OutboundCallButton.js.map +1 -1
  8. package/dist/OutboundModeShell.d.ts +59 -0
  9. package/dist/OutboundModeShell.js +270 -0
  10. package/dist/OutboundModeShell.js.map +1 -0
  11. package/dist/SoftphoneProvider.d.ts +13 -0
  12. package/dist/SoftphoneProvider.js +21 -0
  13. package/dist/SoftphoneProvider.js.map +1 -0
  14. package/dist/ensureCallWidgetHost.d.ts +7 -0
  15. package/dist/ensureCallWidgetHost.js +57 -0
  16. package/dist/ensureCallWidgetHost.js.map +1 -0
  17. package/dist/hooks.d.ts +19 -0
  18. package/dist/hooks.js +67 -0
  19. package/dist/hooks.js.map +1 -0
  20. package/dist/index.d.ts +20 -12
  21. package/dist/index.js +14 -9
  22. package/dist/index.js.map +1 -1
  23. package/dist/injectSoftphoneStyles.d.ts +2 -0
  24. package/dist/injectSoftphoneStyles.js +15 -0
  25. package/dist/injectSoftphoneStyles.js.map +1 -0
  26. package/dist/styles.css +306 -5
  27. package/dist/stylesInject.d.ts +2 -0
  28. package/dist/stylesInject.js +3 -0
  29. package/dist/stylesInject.js.map +1 -0
  30. package/package.json +25 -15
  31. package/dist/OutboundCallModal.d.ts +0 -49
  32. package/dist/OutboundCallModal.js +0 -279
  33. package/dist/OutboundCallModal.js.map +0 -1
  34. package/dist/ensureCallModalHost.d.ts +0 -7
  35. package/dist/ensureCallModalHost.js +0 -104
  36. package/dist/ensureCallModalHost.js.map +0 -1
  37. package/dist/useWebRTCInitialization.d.ts +0 -6
  38. package/dist/useWebRTCInitialization.js +0 -17
  39. package/dist/useWebRTCInitialization.js.map +0 -1
package/dist/hooks.js ADDED
@@ -0,0 +1,67 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { useSoftphoneContext } from './SoftphoneProvider';
3
+ export function useSoftphone() {
4
+ return useSoftphoneContext();
5
+ }
6
+ /**
7
+ * Single subscriber for Softphone `notify` events.
8
+ * Mount once under SoftphoneProvider (e.g. SoftphoneRoot) — never per dial button.
9
+ */
10
+ export function useSoftphoneNotify(handler) {
11
+ const phone = useSoftphoneContext();
12
+ useEffect(() => {
13
+ return phone.subscribe((ev) => {
14
+ if (ev.type === 'notify') {
15
+ handler({ level: ev.level, code: ev.code, message: ev.message });
16
+ }
17
+ });
18
+ }, [phone, handler]);
19
+ }
20
+ export function useCallSnapshot() {
21
+ const phone = useSoftphoneContext();
22
+ const [call, setCall] = useState(() => phone.getCall());
23
+ useEffect(() => {
24
+ setCall(phone.getCall());
25
+ return phone.subscribe((ev) => {
26
+ if (ev.type === 'call') {
27
+ setCall(ev.call);
28
+ }
29
+ });
30
+ }, [phone]);
31
+ return call;
32
+ }
33
+ export function useRegistration() {
34
+ const phone = useSoftphoneContext();
35
+ const [status, setStatus] = useState(() => phone.getRegistration());
36
+ useEffect(() => {
37
+ setStatus(phone.getRegistration());
38
+ return phone.subscribe((ev) => {
39
+ if (ev.type === 'registration') {
40
+ setStatus(ev.status);
41
+ }
42
+ });
43
+ }, [phone]);
44
+ return status;
45
+ }
46
+ /** Connect softphone once on mount (optional). */
47
+ export function useSoftphoneConnect(options = {}) {
48
+ const { autoConnect = true } = options;
49
+ const phone = useSoftphoneContext();
50
+ const status = useRegistration();
51
+ const [error, setError] = useState(null);
52
+ useEffect(() => {
53
+ if (!autoConnect)
54
+ return;
55
+ let cancelled = false;
56
+ phone.connect().catch((err) => {
57
+ if (!cancelled) {
58
+ setError((err === null || err === void 0 ? void 0 : err.message) || 'connect failed');
59
+ }
60
+ });
61
+ return () => {
62
+ cancelled = true;
63
+ };
64
+ }, [phone, autoConnect]);
65
+ return { status, error };
66
+ }
67
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"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"}
package/dist/index.d.ts CHANGED
@@ -1,17 +1,25 @@
1
1
  /**
2
2
  * @yinshan-tech/webrtc-react
3
- * React UI (no antd) on top of @yinshan-tech/webrtc-sdk.
3
+ * React UI (no antd) on top of @yinshan-tech/webrtc-sdk Softphone.
4
4
  *
5
- * Typical usage:
6
- * createWebRTCKit({...}) // once, from @yinshan-tech/webrtc-sdk
7
- * <OutboundCallButton {...params}/> // global call modal auto-mounts
5
+ * const phone = createSoftphone({...})
6
+ * <SoftphoneProvider phone={phone}>
7
+ * <OutboundCallButton dialPayload={...} />
8
+ * <CallWidget />
9
+ * </SoftphoneProvider>
8
10
  */
11
+ export { SoftphoneProvider, useSoftphoneContext, tryUseSoftphoneContext } from './SoftphoneProvider';
12
+ export type { SoftphoneProviderProps } from './SoftphoneProvider';
9
13
  export { OutboundCallButton } from './OutboundCallButton';
10
- export type { OutboundCallButtonProps, OutboundCallButtonRenderProps, } from './OutboundCallButton';
11
- export { OutboundCallModal } from './OutboundCallModal';
12
- export type { OutboundCallModalProps, OutboundCallModalTexts, OutboundCallModalRenderProps, } from './OutboundCallModal';
13
- export { ensureOutboundCallModalHost, destroyOutboundCallModalHost, } from './ensureCallModalHost';
14
- export { useWebRTCInitialization } from './useWebRTCInitialization';
15
- export type { UseWebRTCInitializationOptions } from './useWebRTCInitialization';
16
- export { startOutboundCall, subscribeCallState, getAllCallInfo } from '@yinshan-tech/webrtc-sdk';
17
- export type { OutboundCallParams, OutboundCallNotify, StartOutboundCallResult, CallInfo, } from '@yinshan-tech/webrtc-sdk';
14
+ export type { OutboundCallButtonProps, OutboundCallButtonRenderProps, SoftphoneNotify, } from './OutboundCallButton';
15
+ export { CallWidget } from './CallWidget';
16
+ export type { CallWidgetProps, CallWidgetTexts, CallWidgetRenderProps, } from './CallWidget';
17
+ export { OutboundModeShell } from './OutboundModeShell';
18
+ export type { OutboundMode, OutboundModeSessionProps, OutboundModeShellProps, OutboundModeShellTexts, OutboundModeShellRenderCtx, } from './OutboundModeShell';
19
+ export { ensureCallWidgetHost, destroyCallWidgetHost } from './ensureCallWidgetHost';
20
+ export type { EnsureCallWidgetHostOptions } from './ensureCallWidgetHost';
21
+ export { injectSoftphoneStyles } from './injectSoftphoneStyles';
22
+ export { useSoftphone, useCallSnapshot, useRegistration, useSoftphoneConnect, useSoftphoneNotify, } from './hooks';
23
+ export type { UseSoftphoneConnectOptions } from './hooks';
24
+ /** @deprecated alias — use CallWidget */
25
+ export { CallWidget as OutboundCallModal } from './CallWidget';
package/dist/index.js CHANGED
@@ -1,15 +1,20 @@
1
1
  /**
2
2
  * @yinshan-tech/webrtc-react
3
- * React UI (no antd) on top of @yinshan-tech/webrtc-sdk.
3
+ * React UI (no antd) on top of @yinshan-tech/webrtc-sdk Softphone.
4
4
  *
5
- * Typical usage:
6
- * createWebRTCKit({...}) // once, from @yinshan-tech/webrtc-sdk
7
- * <OutboundCallButton {...params}/> // global call modal auto-mounts
5
+ * const phone = createSoftphone({...})
6
+ * <SoftphoneProvider phone={phone}>
7
+ * <OutboundCallButton dialPayload={...} />
8
+ * <CallWidget />
9
+ * </SoftphoneProvider>
8
10
  */
11
+ export { SoftphoneProvider, useSoftphoneContext, tryUseSoftphoneContext } from './SoftphoneProvider';
9
12
  export { OutboundCallButton } from './OutboundCallButton';
10
- export { OutboundCallModal } from './OutboundCallModal';
11
- export { ensureOutboundCallModalHost, destroyOutboundCallModalHost, } from './ensureCallModalHost';
12
- export { useWebRTCInitialization } from './useWebRTCInitialization';
13
- // Convenience re-exports so UI callers rarely need the sdk package directly
14
- export { startOutboundCall, subscribeCallState, getAllCallInfo } from '@yinshan-tech/webrtc-sdk';
13
+ export { CallWidget } from './CallWidget';
14
+ export { OutboundModeShell } from './OutboundModeShell';
15
+ export { ensureCallWidgetHost, destroyCallWidgetHost } from './ensureCallWidgetHost';
16
+ export { injectSoftphoneStyles } from './injectSoftphoneStyles';
17
+ export { useSoftphone, useCallSnapshot, useRegistration, useSoftphoneConnect, useSoftphoneNotify, } from './hooks';
18
+ /** @deprecated alias — use CallWidget */
19
+ export { CallWidget as OutboundCallModal } from './CallWidget';
15
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAOxD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,4EAA4E;AAC5E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGrG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAO1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AASxD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAGjB,yCAAyC;AACzC,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** Inject Softphone CSS once (CallWidget / ensureCallWidgetHost). Idempotent. */
2
+ export declare function injectSoftphoneStyles(): void;
@@ -0,0 +1,15 @@
1
+ import { STYLES_CSS } from './stylesInject';
2
+ const STYLE_ID = 'wro-softphone-styles';
3
+ /** Inject Softphone CSS once (CallWidget / ensureCallWidgetHost). Idempotent. */
4
+ export function injectSoftphoneStyles() {
5
+ if (typeof document === 'undefined')
6
+ return;
7
+ let style = document.getElementById(STYLE_ID);
8
+ if (!style) {
9
+ style = document.createElement('style');
10
+ style.id = STYLE_ID;
11
+ document.head.appendChild(style);
12
+ }
13
+ style.textContent = STYLES_CSS;
14
+ }
15
+ //# sourceMappingURL=injectSoftphoneStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectSoftphoneStyles.js","sourceRoot":"","sources":["../src/injectSoftphoneStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AAExC,iFAAiF;AACjF,MAAM,UAAU,qBAAqB;IACnC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAC5C,IAAI,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAA4B,CAAC;IACzE,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACxC,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAClC;IACD,KAAK,CAAC,WAAW,GAAG,UAAU,CAAC;AACjC,CAAC"}
package/dist/styles.css CHANGED
@@ -7,7 +7,12 @@
7
7
  --wro-btn-padding: 6px 14px;
8
8
  --wro-btn-font-size: 14px;
9
9
  --wro-modal-z: 1000;
10
- font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
10
+ font-family:
11
+ system-ui,
12
+ -apple-system,
13
+ "Segoe UI",
14
+ Roboto,
15
+ sans-serif;
11
16
  }
12
17
 
13
18
  .wro-btn {
@@ -36,7 +41,9 @@
36
41
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 42%);
37
42
  color: #0f172a;
38
43
  border-radius: 20px;
39
- box-shadow: 0 12px 40px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.06);
44
+ box-shadow:
45
+ 0 12px 40px rgba(15, 23, 42, 0.16),
46
+ 0 2px 8px rgba(15, 23, 42, 0.06);
40
47
  text-align: center;
41
48
  cursor: grab;
42
49
  user-select: none;
@@ -94,7 +101,7 @@
94
101
  border: 2px solid rgba(59, 130, 246, 0.45);
95
102
  border-radius: 50%;
96
103
  animation: wro-ring 1.6s ease-out infinite;
97
- content: '';
104
+ content: "";
98
105
  }
99
106
 
100
107
  .wro-call__avatar.is-connected {
@@ -188,7 +195,9 @@
188
195
  border-radius: 50%;
189
196
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
190
197
  cursor: pointer;
191
- transition: transform 0.15s ease, box-shadow 0.15s ease;
198
+ transition:
199
+ transform 0.15s ease,
200
+ box-shadow 0.15s ease;
192
201
  }
193
202
 
194
203
  .wro-call__circle:hover:not(:disabled) {
@@ -246,7 +255,9 @@
246
255
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
247
256
  cursor: grab;
248
257
  user-select: none;
249
- transition: box-shadow 0.2s ease, transform 0.2s ease;
258
+ transition:
259
+ box-shadow 0.2s ease,
260
+ transform 0.2s ease;
250
261
  }
251
262
 
252
263
  .wro-call-mini.is-dragging {
@@ -300,3 +311,293 @@
300
311
  opacity: 0;
301
312
  }
302
313
  }
314
+
315
+ /* OutboundModeShell — dark workbench chrome */
316
+ .wro-shell {
317
+ --wro-shell-bg: #1a2332;
318
+ --wro-shell-panel: #243044;
319
+ --wro-shell-text: #e8eef7;
320
+ --wro-shell-muted: #8b9bb4;
321
+ --wro-shell-accent: #2dd4bf;
322
+ --wro-shell-green: #22c55e;
323
+ position: fixed;
324
+ top: 20px;
325
+ right: 20px;
326
+ z-index: var(--wro-modal-z);
327
+ width: 360px;
328
+ padding: 0 0 16px;
329
+ color: var(--wro-shell-text);
330
+ background: var(--wro-shell-bg);
331
+ border-radius: 12px;
332
+ box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
333
+ cursor: grab;
334
+ user-select: none;
335
+ }
336
+
337
+ .wro-shell.is-dragging {
338
+ cursor: grabbing;
339
+ }
340
+
341
+ .wro-shell__header {
342
+ display: flex;
343
+ align-items: center;
344
+ justify-content: space-between;
345
+ padding: 12px 14px;
346
+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);
347
+ }
348
+
349
+ .wro-shell__title {
350
+ display: inline-flex;
351
+ gap: 8px;
352
+ align-items: center;
353
+ color: var(--wro-shell-accent);
354
+ font-weight: 600;
355
+ font-size: 14px;
356
+ }
357
+
358
+ .wro-shell__title-icon {
359
+ display: inline-flex;
360
+ color: var(--wro-shell-accent);
361
+ }
362
+
363
+ .wro-shell__title-icon svg {
364
+ width: 16px;
365
+ height: 16px;
366
+ }
367
+
368
+ .wro-shell__icon-btn {
369
+ display: inline-flex;
370
+ align-items: center;
371
+ justify-content: center;
372
+ width: 28px;
373
+ height: 28px;
374
+ padding: 0;
375
+ color: var(--wro-shell-muted);
376
+ background: transparent;
377
+ border: none;
378
+ border-radius: 6px;
379
+ cursor: pointer;
380
+ }
381
+
382
+ .wro-shell__icon-btn:hover {
383
+ color: var(--wro-shell-text);
384
+ background: rgba(255, 255, 255, 0.06);
385
+ }
386
+
387
+ .wro-shell__mode-bar {
388
+ display: flex;
389
+ flex-direction: column;
390
+ gap: 10px;
391
+ padding: 12px 14px 0;
392
+ }
393
+
394
+ .wro-shell__agent-status {
395
+ display: flex;
396
+ align-items: center;
397
+ justify-content: space-between;
398
+ color: var(--wro-shell-muted);
399
+ font-size: 13px;
400
+ }
401
+
402
+ .wro-shell__agent-status-value {
403
+ color: var(--wro-shell-green);
404
+ font-weight: 600;
405
+ }
406
+
407
+ .wro-shell__mode-actions {
408
+ display: flex;
409
+ gap: 8px;
410
+ }
411
+
412
+ .wro-shell__mode-actions > * {
413
+ flex: 1;
414
+ }
415
+
416
+ .wro-shell__call-status {
417
+ display: flex;
418
+ flex-wrap: wrap;
419
+ gap: 6px;
420
+ align-items: center;
421
+ justify-content: center;
422
+ margin-top: 16px;
423
+ padding: 0 16px;
424
+ text-align: center;
425
+ }
426
+
427
+ .wro-shell__state {
428
+ color: var(--wro-shell-muted);
429
+ font-size: 14px;
430
+ }
431
+
432
+ .wro-shell__state.is-calling {
433
+ color: var(--wro-shell-accent);
434
+ }
435
+
436
+ .wro-shell__state.is-connected {
437
+ color: var(--wro-shell-green);
438
+ }
439
+
440
+ .wro-shell__state.is-failed {
441
+ color: #f87171;
442
+ }
443
+
444
+ .wro-shell__number {
445
+ margin-top: 8px;
446
+ padding: 0 16px;
447
+ color: #fff;
448
+ font-weight: 700;
449
+ font-size: 26px;
450
+ line-height: 1.2;
451
+ text-align: center;
452
+ letter-spacing: 0.5px;
453
+ }
454
+
455
+ .wro-shell__name {
456
+ margin-top: 6px;
457
+ padding: 0 16px;
458
+ overflow: hidden;
459
+ color: var(--wro-shell-muted);
460
+ font-size: 13px;
461
+ text-align: center;
462
+ white-space: nowrap;
463
+ text-overflow: ellipsis;
464
+ }
465
+
466
+ .wro-shell__idle-hint {
467
+ min-height: 8px;
468
+ margin-top: 12px;
469
+ }
470
+
471
+ .wro-shell__duration {
472
+ margin-top: 14px;
473
+ color: var(--wro-shell-green);
474
+ font-weight: 700;
475
+ font-size: 28px;
476
+ font-variant-numeric: tabular-nums;
477
+ text-align: center;
478
+ letter-spacing: 1px;
479
+ }
480
+
481
+ .wro-shell__actions {
482
+ display: flex;
483
+ gap: 20px;
484
+ justify-content: center;
485
+ margin-top: 14px;
486
+ }
487
+
488
+ .wro-shell__circle {
489
+ display: inline-flex;
490
+ align-items: center;
491
+ justify-content: center;
492
+ width: 52px;
493
+ height: 52px;
494
+ padding: 0;
495
+ color: #fff;
496
+ border: none;
497
+ border-radius: 50%;
498
+ cursor: pointer;
499
+ }
500
+
501
+ .wro-shell__circle.is-unmuted {
502
+ background: #16a34a;
503
+ }
504
+
505
+ .wro-shell__circle.is-muted {
506
+ background: #dc2626;
507
+ }
508
+
509
+ .wro-shell__circle.is-hangup {
510
+ background: #ef4444;
511
+ }
512
+
513
+ .wro-shell__circle:disabled {
514
+ opacity: 0.45;
515
+ cursor: not-allowed;
516
+ }
517
+
518
+ .wro-shell__hangup-icon {
519
+ display: inline-flex;
520
+ transform: rotate(135deg);
521
+ }
522
+
523
+ .wro-shell__batch {
524
+ margin: 16px 14px 0;
525
+ padding: 12px;
526
+ background: var(--wro-shell-panel);
527
+ border-radius: 8px;
528
+ }
529
+
530
+ .wro-shell__batch-head {
531
+ display: flex;
532
+ align-items: center;
533
+ justify-content: space-between;
534
+ margin-bottom: 8px;
535
+ color: var(--wro-shell-accent);
536
+ font-size: 13px;
537
+ }
538
+
539
+ .wro-shell__batch-bar {
540
+ height: 6px;
541
+ overflow: hidden;
542
+ background: rgba(255, 255, 255, 0.08);
543
+ border-radius: 999px;
544
+ }
545
+
546
+ .wro-shell__batch-bar-fill {
547
+ height: 100%;
548
+ background: var(--wro-shell-accent);
549
+ border-radius: 999px;
550
+ transition: width 0.2s ease;
551
+ }
552
+
553
+ .wro-shell__batch-stats {
554
+ display: flex;
555
+ justify-content: space-between;
556
+ margin-top: 8px;
557
+ color: var(--wro-shell-muted);
558
+ font-size: 12px;
559
+ }
560
+
561
+ .wro-shell-mini {
562
+ position: fixed;
563
+ top: 20px;
564
+ right: 20px;
565
+ z-index: var(--wro-modal-z);
566
+ display: flex;
567
+ flex-direction: column;
568
+ gap: 4px;
569
+ width: 220px;
570
+ min-height: 64px;
571
+ padding: 12px 14px;
572
+ color: var(--wro-shell-text, #e8eef7);
573
+ background: #1a2332;
574
+ border: 1px solid rgba(255, 255, 255, 0.08);
575
+ border-radius: 12px;
576
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
577
+ cursor: grab;
578
+ user-select: none;
579
+ }
580
+
581
+ .wro-shell-mini.is-dragging {
582
+ cursor: grabbing;
583
+ }
584
+
585
+ .wro-shell-mini__name {
586
+ overflow: hidden;
587
+ font-weight: 600;
588
+ font-size: 14px;
589
+ white-space: nowrap;
590
+ text-overflow: ellipsis;
591
+ }
592
+
593
+ .wro-shell-mini__duration {
594
+ color: #22c55e;
595
+ font-weight: 700;
596
+ font-size: 16px;
597
+ font-variant-numeric: tabular-nums;
598
+ }
599
+
600
+ .wro-shell-mini__status {
601
+ color: #2dd4bf;
602
+ font-size: 12px;
603
+ }
@@ -0,0 +1,2 @@
1
+ /** Auto-generated from styles.css — do not edit. */
2
+ export declare const STYLES_CSS = "/* @yinshan-tech/webrtc-react \u2014 override via CSS variables / className */\n\n.wro-root {\n --wro-btn-bg: #ef4444;\n --wro-btn-color: #fff;\n --wro-btn-radius: 8px;\n --wro-btn-padding: 6px 14px;\n --wro-btn-font-size: 14px;\n --wro-modal-z: 1000;\n font-family:\n system-ui,\n -apple-system,\n \"Segoe UI\",\n Roboto,\n sans-serif;\n}\n\n.wro-btn {\n background: var(--wro-btn-bg);\n color: var(--wro-btn-color);\n border: none;\n border-radius: var(--wro-btn-radius);\n padding: var(--wro-btn-padding);\n font-size: var(--wro-btn-font-size);\n cursor: pointer;\n}\n\n.wro-btn:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n\n/* Floating call card (no full-screen mask) */\n.wro-call {\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: var(--wro-modal-z);\n width: 320px;\n padding: 20px 24px 28px;\n background: linear-gradient(180deg, #f8fafc 0%, #ffffff 42%);\n color: #0f172a;\n border-radius: 20px;\n box-shadow:\n 0 12px 40px rgba(15, 23, 42, 0.16),\n 0 2px 8px rgba(15, 23, 42, 0.06);\n text-align: center;\n cursor: grab;\n user-select: none;\n}\n\n.wro-call.is-dragging {\n cursor: grabbing;\n}\n\n.wro-call button {\n cursor: pointer;\n}\n\n.wro-call__minimize {\n position: absolute;\n top: 10px;\n right: 10px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: rgba(0, 0, 0, 0.45);\n background: transparent;\n border: none;\n border-radius: 8px;\n cursor: pointer;\n}\n\n.wro-call__minimize:hover {\n color: rgba(0, 0, 0, 0.85);\n background: rgba(0, 0, 0, 0.06);\n}\n\n.wro-call__avatar {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 72px;\n height: 72px;\n margin: 8px auto 16px;\n color: #fff;\n font-weight: 600;\n font-size: 28px;\n background: linear-gradient(145deg, #3b82f6 0%, #1d4ed8 100%);\n border-radius: 50%;\n box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);\n}\n\n.wro-call__avatar.is-calling::after {\n position: absolute;\n inset: -6px;\n border: 2px solid rgba(59, 130, 246, 0.45);\n border-radius: 50%;\n animation: wro-ring 1.6s ease-out infinite;\n content: \"\";\n}\n\n.wro-call__avatar.is-connected {\n background: linear-gradient(145deg, #22c55e 0%, #15803d 100%);\n box-shadow: 0 8px 20px rgba(34, 197, 94, 0.28);\n}\n\n.wro-call__avatar.is-failed {\n background: linear-gradient(145deg, #f87171 0%, #dc2626 100%);\n box-shadow: 0 8px 20px rgba(239, 68, 68, 0.28);\n}\n\n.wro-call__avatar.is-ended {\n background: linear-gradient(145deg, #94a3b8 0%, #64748b 100%);\n box-shadow: none;\n}\n\n.wro-call__name {\n max-width: 100%;\n margin-bottom: 8px;\n overflow: hidden;\n font-weight: 600;\n font-size: 20px;\n line-height: 1.3;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.wro-call__status {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 36px;\n margin-bottom: 8px;\n}\n\n.wro-call__state {\n font-size: 14px;\n color: #64748b;\n}\n\n.wro-call__state.is-calling {\n color: #2563eb;\n animation: wro-blink 1.5s ease-in-out infinite;\n}\n\n.wro-call__state.is-failed {\n color: #dc2626;\n}\n\n.wro-call__state.is-timeout {\n color: #d97706;\n}\n\n.wro-call__state.is-ended {\n color: #64748b;\n}\n\n.wro-call__duration {\n color: #16a34a;\n font-weight: 700;\n font-size: 28px;\n font-variant-numeric: tabular-nums;\n letter-spacing: 1px;\n}\n\n.wro-call__actions {\n display: flex;\n gap: 28px;\n justify-content: center;\n margin-top: 16px;\n cursor: grab;\n}\n\n.wro-call__action {\n display: flex;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n}\n\n.wro-call__circle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 56px;\n height: 56px;\n padding: 0;\n color: #fff;\n border: none;\n border-radius: 50%;\n box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);\n cursor: pointer;\n transition:\n transform 0.15s ease,\n box-shadow 0.15s ease;\n}\n\n.wro-call__circle:hover:not(:disabled) {\n transform: translateY(-1px);\n box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);\n}\n\n.wro-call__circle:disabled {\n background: #fecaca !important;\n box-shadow: none;\n cursor: not-allowed;\n}\n\n.wro-call__circle.is-unmuted {\n background: #16a34a;\n}\n\n.wro-call__circle.is-muted {\n background: #dc2626;\n}\n\n.wro-call__circle.is-hangup {\n background: #ef4444;\n}\n\n.wro-call__circle.is-hangup:hover:not(:disabled) {\n background: #dc2626;\n}\n\n.wro-call__hangup-icon {\n display: inline-flex;\n transform: rotate(135deg);\n}\n\n.wro-call__label {\n color: #475569;\n font-size: 13px;\n line-height: 1;\n}\n\n.wro-call-mini {\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: var(--wro-modal-z);\n display: flex;\n flex-direction: column;\n gap: 4px;\n width: 220px;\n min-height: 64px;\n padding: 12px 14px;\n background: #fff;\n border: 1px solid #e2e8f0;\n border-radius: 12px;\n box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);\n cursor: grab;\n user-select: none;\n transition:\n box-shadow 0.2s ease,\n transform 0.2s ease;\n}\n\n.wro-call-mini.is-dragging {\n cursor: grabbing;\n transition: none;\n}\n\n.wro-call-mini:hover {\n box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);\n transform: translateY(-1px);\n}\n\n.wro-call-mini__name {\n overflow: hidden;\n color: #0f172a;\n font-weight: 600;\n font-size: 14px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.wro-call-mini__duration {\n color: #16a34a;\n font-weight: 700;\n font-size: 16px;\n font-variant-numeric: tabular-nums;\n}\n\n.wro-call-mini__status {\n color: #2563eb;\n font-size: 12px;\n}\n\n@keyframes wro-blink {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.45;\n }\n}\n\n@keyframes wro-ring {\n 0% {\n transform: scale(0.92);\n opacity: 0.7;\n }\n 100% {\n transform: scale(1.18);\n opacity: 0;\n }\n}\n\n/* OutboundModeShell \u2014 dark workbench chrome */\n.wro-shell {\n --wro-shell-bg: #1a2332;\n --wro-shell-panel: #243044;\n --wro-shell-text: #e8eef7;\n --wro-shell-muted: #8b9bb4;\n --wro-shell-accent: #2dd4bf;\n --wro-shell-green: #22c55e;\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: var(--wro-modal-z);\n width: 360px;\n padding: 0 0 16px;\n color: var(--wro-shell-text);\n background: var(--wro-shell-bg);\n border-radius: 12px;\n box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);\n cursor: grab;\n user-select: none;\n}\n\n.wro-shell.is-dragging {\n cursor: grabbing;\n}\n\n.wro-shell__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 14px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.06);\n}\n\n.wro-shell__title {\n display: inline-flex;\n gap: 8px;\n align-items: center;\n color: var(--wro-shell-accent);\n font-weight: 600;\n font-size: 14px;\n}\n\n.wro-shell__title-icon {\n display: inline-flex;\n color: var(--wro-shell-accent);\n}\n\n.wro-shell__title-icon svg {\n width: 16px;\n height: 16px;\n}\n\n.wro-shell__icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--wro-shell-muted);\n background: transparent;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n}\n\n.wro-shell__icon-btn:hover {\n color: var(--wro-shell-text);\n background: rgba(255, 255, 255, 0.06);\n}\n\n.wro-shell__mode-bar {\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 12px 14px 0;\n}\n\n.wro-shell__agent-status {\n display: flex;\n align-items: center;\n justify-content: space-between;\n color: var(--wro-shell-muted);\n font-size: 13px;\n}\n\n.wro-shell__agent-status-value {\n color: var(--wro-shell-green);\n font-weight: 600;\n}\n\n.wro-shell__mode-actions {\n display: flex;\n gap: 8px;\n}\n\n.wro-shell__mode-actions > * {\n flex: 1;\n}\n\n.wro-shell__call-status {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n align-items: center;\n justify-content: center;\n margin-top: 16px;\n padding: 0 16px;\n text-align: center;\n}\n\n.wro-shell__state {\n color: var(--wro-shell-muted);\n font-size: 14px;\n}\n\n.wro-shell__state.is-calling {\n color: var(--wro-shell-accent);\n}\n\n.wro-shell__state.is-connected {\n color: var(--wro-shell-green);\n}\n\n.wro-shell__state.is-failed {\n color: #f87171;\n}\n\n.wro-shell__number {\n margin-top: 8px;\n padding: 0 16px;\n color: #fff;\n font-weight: 700;\n font-size: 26px;\n line-height: 1.2;\n text-align: center;\n letter-spacing: 0.5px;\n}\n\n.wro-shell__name {\n margin-top: 6px;\n padding: 0 16px;\n overflow: hidden;\n color: var(--wro-shell-muted);\n font-size: 13px;\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.wro-shell__idle-hint {\n min-height: 8px;\n margin-top: 12px;\n}\n\n.wro-shell__duration {\n margin-top: 14px;\n color: var(--wro-shell-green);\n font-weight: 700;\n font-size: 28px;\n font-variant-numeric: tabular-nums;\n text-align: center;\n letter-spacing: 1px;\n}\n\n.wro-shell__actions {\n display: flex;\n gap: 20px;\n justify-content: center;\n margin-top: 14px;\n}\n\n.wro-shell__circle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 52px;\n height: 52px;\n padding: 0;\n color: #fff;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n}\n\n.wro-shell__circle.is-unmuted {\n background: #16a34a;\n}\n\n.wro-shell__circle.is-muted {\n background: #dc2626;\n}\n\n.wro-shell__circle.is-hangup {\n background: #ef4444;\n}\n\n.wro-shell__circle:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n\n.wro-shell__hangup-icon {\n display: inline-flex;\n transform: rotate(135deg);\n}\n\n.wro-shell__batch {\n margin: 16px 14px 0;\n padding: 12px;\n background: var(--wro-shell-panel);\n border-radius: 8px;\n}\n\n.wro-shell__batch-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 8px;\n color: var(--wro-shell-accent);\n font-size: 13px;\n}\n\n.wro-shell__batch-bar {\n height: 6px;\n overflow: hidden;\n background: rgba(255, 255, 255, 0.08);\n border-radius: 999px;\n}\n\n.wro-shell__batch-bar-fill {\n height: 100%;\n background: var(--wro-shell-accent);\n border-radius: 999px;\n transition: width 0.2s ease;\n}\n\n.wro-shell__batch-stats {\n display: flex;\n justify-content: space-between;\n margin-top: 8px;\n color: var(--wro-shell-muted);\n font-size: 12px;\n}\n\n.wro-shell-mini {\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: var(--wro-modal-z);\n display: flex;\n flex-direction: column;\n gap: 4px;\n width: 220px;\n min-height: 64px;\n padding: 12px 14px;\n color: var(--wro-shell-text, #e8eef7);\n background: #1a2332;\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 12px;\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);\n cursor: grab;\n user-select: none;\n}\n\n.wro-shell-mini.is-dragging {\n cursor: grabbing;\n}\n\n.wro-shell-mini__name {\n overflow: hidden;\n font-weight: 600;\n font-size: 14px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.wro-shell-mini__duration {\n color: #22c55e;\n font-weight: 700;\n font-size: 16px;\n font-variant-numeric: tabular-nums;\n}\n\n.wro-shell-mini__status {\n color: #2dd4bf;\n font-size: 12px;\n}\n";
@@ -0,0 +1,3 @@
1
+ /** Auto-generated from styles.css — do not edit. */
2
+ export const STYLES_CSS = "/* @yinshan-tech/webrtc-react — override via CSS variables / className */\n\n.wro-root {\n --wro-btn-bg: #ef4444;\n --wro-btn-color: #fff;\n --wro-btn-radius: 8px;\n --wro-btn-padding: 6px 14px;\n --wro-btn-font-size: 14px;\n --wro-modal-z: 1000;\n font-family:\n system-ui,\n -apple-system,\n \"Segoe UI\",\n Roboto,\n sans-serif;\n}\n\n.wro-btn {\n background: var(--wro-btn-bg);\n color: var(--wro-btn-color);\n border: none;\n border-radius: var(--wro-btn-radius);\n padding: var(--wro-btn-padding);\n font-size: var(--wro-btn-font-size);\n cursor: pointer;\n}\n\n.wro-btn:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n\n/* Floating call card (no full-screen mask) */\n.wro-call {\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: var(--wro-modal-z);\n width: 320px;\n padding: 20px 24px 28px;\n background: linear-gradient(180deg, #f8fafc 0%, #ffffff 42%);\n color: #0f172a;\n border-radius: 20px;\n box-shadow:\n 0 12px 40px rgba(15, 23, 42, 0.16),\n 0 2px 8px rgba(15, 23, 42, 0.06);\n text-align: center;\n cursor: grab;\n user-select: none;\n}\n\n.wro-call.is-dragging {\n cursor: grabbing;\n}\n\n.wro-call button {\n cursor: pointer;\n}\n\n.wro-call__minimize {\n position: absolute;\n top: 10px;\n right: 10px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: rgba(0, 0, 0, 0.45);\n background: transparent;\n border: none;\n border-radius: 8px;\n cursor: pointer;\n}\n\n.wro-call__minimize:hover {\n color: rgba(0, 0, 0, 0.85);\n background: rgba(0, 0, 0, 0.06);\n}\n\n.wro-call__avatar {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 72px;\n height: 72px;\n margin: 8px auto 16px;\n color: #fff;\n font-weight: 600;\n font-size: 28px;\n background: linear-gradient(145deg, #3b82f6 0%, #1d4ed8 100%);\n border-radius: 50%;\n box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);\n}\n\n.wro-call__avatar.is-calling::after {\n position: absolute;\n inset: -6px;\n border: 2px solid rgba(59, 130, 246, 0.45);\n border-radius: 50%;\n animation: wro-ring 1.6s ease-out infinite;\n content: \"\";\n}\n\n.wro-call__avatar.is-connected {\n background: linear-gradient(145deg, #22c55e 0%, #15803d 100%);\n box-shadow: 0 8px 20px rgba(34, 197, 94, 0.28);\n}\n\n.wro-call__avatar.is-failed {\n background: linear-gradient(145deg, #f87171 0%, #dc2626 100%);\n box-shadow: 0 8px 20px rgba(239, 68, 68, 0.28);\n}\n\n.wro-call__avatar.is-ended {\n background: linear-gradient(145deg, #94a3b8 0%, #64748b 100%);\n box-shadow: none;\n}\n\n.wro-call__name {\n max-width: 100%;\n margin-bottom: 8px;\n overflow: hidden;\n font-weight: 600;\n font-size: 20px;\n line-height: 1.3;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.wro-call__status {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 36px;\n margin-bottom: 8px;\n}\n\n.wro-call__state {\n font-size: 14px;\n color: #64748b;\n}\n\n.wro-call__state.is-calling {\n color: #2563eb;\n animation: wro-blink 1.5s ease-in-out infinite;\n}\n\n.wro-call__state.is-failed {\n color: #dc2626;\n}\n\n.wro-call__state.is-timeout {\n color: #d97706;\n}\n\n.wro-call__state.is-ended {\n color: #64748b;\n}\n\n.wro-call__duration {\n color: #16a34a;\n font-weight: 700;\n font-size: 28px;\n font-variant-numeric: tabular-nums;\n letter-spacing: 1px;\n}\n\n.wro-call__actions {\n display: flex;\n gap: 28px;\n justify-content: center;\n margin-top: 16px;\n cursor: grab;\n}\n\n.wro-call__action {\n display: flex;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n}\n\n.wro-call__circle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 56px;\n height: 56px;\n padding: 0;\n color: #fff;\n border: none;\n border-radius: 50%;\n box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);\n cursor: pointer;\n transition:\n transform 0.15s ease,\n box-shadow 0.15s ease;\n}\n\n.wro-call__circle:hover:not(:disabled) {\n transform: translateY(-1px);\n box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);\n}\n\n.wro-call__circle:disabled {\n background: #fecaca !important;\n box-shadow: none;\n cursor: not-allowed;\n}\n\n.wro-call__circle.is-unmuted {\n background: #16a34a;\n}\n\n.wro-call__circle.is-muted {\n background: #dc2626;\n}\n\n.wro-call__circle.is-hangup {\n background: #ef4444;\n}\n\n.wro-call__circle.is-hangup:hover:not(:disabled) {\n background: #dc2626;\n}\n\n.wro-call__hangup-icon {\n display: inline-flex;\n transform: rotate(135deg);\n}\n\n.wro-call__label {\n color: #475569;\n font-size: 13px;\n line-height: 1;\n}\n\n.wro-call-mini {\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: var(--wro-modal-z);\n display: flex;\n flex-direction: column;\n gap: 4px;\n width: 220px;\n min-height: 64px;\n padding: 12px 14px;\n background: #fff;\n border: 1px solid #e2e8f0;\n border-radius: 12px;\n box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);\n cursor: grab;\n user-select: none;\n transition:\n box-shadow 0.2s ease,\n transform 0.2s ease;\n}\n\n.wro-call-mini.is-dragging {\n cursor: grabbing;\n transition: none;\n}\n\n.wro-call-mini:hover {\n box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);\n transform: translateY(-1px);\n}\n\n.wro-call-mini__name {\n overflow: hidden;\n color: #0f172a;\n font-weight: 600;\n font-size: 14px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.wro-call-mini__duration {\n color: #16a34a;\n font-weight: 700;\n font-size: 16px;\n font-variant-numeric: tabular-nums;\n}\n\n.wro-call-mini__status {\n color: #2563eb;\n font-size: 12px;\n}\n\n@keyframes wro-blink {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.45;\n }\n}\n\n@keyframes wro-ring {\n 0% {\n transform: scale(0.92);\n opacity: 0.7;\n }\n 100% {\n transform: scale(1.18);\n opacity: 0;\n }\n}\n\n/* OutboundModeShell — dark workbench chrome */\n.wro-shell {\n --wro-shell-bg: #1a2332;\n --wro-shell-panel: #243044;\n --wro-shell-text: #e8eef7;\n --wro-shell-muted: #8b9bb4;\n --wro-shell-accent: #2dd4bf;\n --wro-shell-green: #22c55e;\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: var(--wro-modal-z);\n width: 360px;\n padding: 0 0 16px;\n color: var(--wro-shell-text);\n background: var(--wro-shell-bg);\n border-radius: 12px;\n box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);\n cursor: grab;\n user-select: none;\n}\n\n.wro-shell.is-dragging {\n cursor: grabbing;\n}\n\n.wro-shell__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 14px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.06);\n}\n\n.wro-shell__title {\n display: inline-flex;\n gap: 8px;\n align-items: center;\n color: var(--wro-shell-accent);\n font-weight: 600;\n font-size: 14px;\n}\n\n.wro-shell__title-icon {\n display: inline-flex;\n color: var(--wro-shell-accent);\n}\n\n.wro-shell__title-icon svg {\n width: 16px;\n height: 16px;\n}\n\n.wro-shell__icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--wro-shell-muted);\n background: transparent;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n}\n\n.wro-shell__icon-btn:hover {\n color: var(--wro-shell-text);\n background: rgba(255, 255, 255, 0.06);\n}\n\n.wro-shell__mode-bar {\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 12px 14px 0;\n}\n\n.wro-shell__agent-status {\n display: flex;\n align-items: center;\n justify-content: space-between;\n color: var(--wro-shell-muted);\n font-size: 13px;\n}\n\n.wro-shell__agent-status-value {\n color: var(--wro-shell-green);\n font-weight: 600;\n}\n\n.wro-shell__mode-actions {\n display: flex;\n gap: 8px;\n}\n\n.wro-shell__mode-actions > * {\n flex: 1;\n}\n\n.wro-shell__call-status {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n align-items: center;\n justify-content: center;\n margin-top: 16px;\n padding: 0 16px;\n text-align: center;\n}\n\n.wro-shell__state {\n color: var(--wro-shell-muted);\n font-size: 14px;\n}\n\n.wro-shell__state.is-calling {\n color: var(--wro-shell-accent);\n}\n\n.wro-shell__state.is-connected {\n color: var(--wro-shell-green);\n}\n\n.wro-shell__state.is-failed {\n color: #f87171;\n}\n\n.wro-shell__number {\n margin-top: 8px;\n padding: 0 16px;\n color: #fff;\n font-weight: 700;\n font-size: 26px;\n line-height: 1.2;\n text-align: center;\n letter-spacing: 0.5px;\n}\n\n.wro-shell__name {\n margin-top: 6px;\n padding: 0 16px;\n overflow: hidden;\n color: var(--wro-shell-muted);\n font-size: 13px;\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.wro-shell__idle-hint {\n min-height: 8px;\n margin-top: 12px;\n}\n\n.wro-shell__duration {\n margin-top: 14px;\n color: var(--wro-shell-green);\n font-weight: 700;\n font-size: 28px;\n font-variant-numeric: tabular-nums;\n text-align: center;\n letter-spacing: 1px;\n}\n\n.wro-shell__actions {\n display: flex;\n gap: 20px;\n justify-content: center;\n margin-top: 14px;\n}\n\n.wro-shell__circle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 52px;\n height: 52px;\n padding: 0;\n color: #fff;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n}\n\n.wro-shell__circle.is-unmuted {\n background: #16a34a;\n}\n\n.wro-shell__circle.is-muted {\n background: #dc2626;\n}\n\n.wro-shell__circle.is-hangup {\n background: #ef4444;\n}\n\n.wro-shell__circle:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n\n.wro-shell__hangup-icon {\n display: inline-flex;\n transform: rotate(135deg);\n}\n\n.wro-shell__batch {\n margin: 16px 14px 0;\n padding: 12px;\n background: var(--wro-shell-panel);\n border-radius: 8px;\n}\n\n.wro-shell__batch-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 8px;\n color: var(--wro-shell-accent);\n font-size: 13px;\n}\n\n.wro-shell__batch-bar {\n height: 6px;\n overflow: hidden;\n background: rgba(255, 255, 255, 0.08);\n border-radius: 999px;\n}\n\n.wro-shell__batch-bar-fill {\n height: 100%;\n background: var(--wro-shell-accent);\n border-radius: 999px;\n transition: width 0.2s ease;\n}\n\n.wro-shell__batch-stats {\n display: flex;\n justify-content: space-between;\n margin-top: 8px;\n color: var(--wro-shell-muted);\n font-size: 12px;\n}\n\n.wro-shell-mini {\n position: fixed;\n top: 20px;\n right: 20px;\n z-index: var(--wro-modal-z);\n display: flex;\n flex-direction: column;\n gap: 4px;\n width: 220px;\n min-height: 64px;\n padding: 12px 14px;\n color: var(--wro-shell-text, #e8eef7);\n background: #1a2332;\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 12px;\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);\n cursor: grab;\n user-select: none;\n}\n\n.wro-shell-mini.is-dragging {\n cursor: grabbing;\n}\n\n.wro-shell-mini__name {\n overflow: hidden;\n font-weight: 600;\n font-size: 14px;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.wro-shell-mini__duration {\n color: #22c55e;\n font-weight: 700;\n font-size: 16px;\n font-variant-numeric: tabular-nums;\n}\n\n.wro-shell-mini__status {\n color: #2dd4bf;\n font-size: 12px;\n}\n";
3
+ //# sourceMappingURL=stylesInject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stylesInject.js","sourceRoot":"","sources":["../src/stylesInject.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,+rWAA+rW,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@yinshan-tech/webrtc-react",
3
- "version": "0.1.1",
4
- "description": "React UI for @yinshan-tech/webrtc-sdk: OutboundCallButton, OutboundCallModal, hooks (no antd)",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
3
+ "version": "0.8.0",
4
+ "description": "React UI for @yinshan-tech/webrtc-sdk Softphone: button, call widget, hooks (no antd)",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./styles.css": "./dist/styles.css"
15
+ },
7
16
  "sideEffects": [
8
17
  "./dist/styles.css"
9
18
  ],
@@ -12,27 +21,28 @@
12
21
  "README.md"
13
22
  ],
14
23
  "scripts": {
15
- "build": "rm -rf dist && tsc -p tsconfig.json && cp src/styles.css dist/styles.css",
16
- "prepare": "node -e \"require(\\\"fs\\\").accessSync(\\\"dist/index.js\\\")\" || npm run build"
24
+ "prebuild": "node scripts/embed-css.mjs",
25
+ "build": "rm -rf dist && npm run prebuild && tsc -p tsconfig.json && cp src/styles.css dist/styles.css",
26
+ "prepare": "npm run build",
27
+ "prepublishOnly": "npm run build"
17
28
  },
18
29
  "peerDependencies": {
19
- "react": ">=16.8.0",
20
- "react-dom": ">=16.8.0",
21
- "@yinshan-tech/webrtc-sdk": "^0.1.1"
30
+ "@yinshan-tech/webrtc-sdk": "^0.8.0",
31
+ "react": ">=18.0.0",
32
+ "react-dom": ">=18.0.0"
22
33
  },
23
34
  "devDependencies": {
24
- "@types/react": "^17.0.0",
25
- "@types/react-dom": "^17.0.0",
35
+ "@types/react": "^18.3.0",
36
+ "@types/react-dom": "^18.3.0",
37
+ "@yinshan-tech/webrtc-sdk": "file:../webrtc-sdk",
26
38
  "typescript": "^4.8.3"
27
39
  },
28
40
  "keywords": [
29
41
  "webrtc",
42
+ "softphone",
30
43
  "outbound",
31
44
  "react",
32
45
  "call-center"
33
46
  ],
34
- "license": "UNLICENSED",
35
- "publishConfig": {
36
- "access": "public"
37
- }
47
+ "license": "UNLICENSED"
38
48
  }