@16x/webphone-sdk 3.0.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +2 -0
  3. package/README.md +113 -0
  4. package/dist/CCBarClient-BdbynNBi.js +2515 -0
  5. package/dist/CCBarClient-DKWdvgf5.cjs +1 -0
  6. package/dist/CCBarError-CIqJE8zK.cjs +1 -0
  7. package/dist/CCBarError-DSbPw2dA.js +14 -0
  8. package/dist/Diagnostics-BYVvmxil.cjs +1 -0
  9. package/dist/Diagnostics-Cw2HVrCD.js +123 -0
  10. package/dist/JsSipAdapter-GHzVSCDh.js +304 -0
  11. package/dist/JsSipAdapter-jtGdoXrm.cjs +1 -0
  12. package/dist/SharedWorkerProtocol-BqUafs8d.js +73 -0
  13. package/dist/SharedWorkerProtocol-CYN0AprP.cjs +1 -0
  14. package/dist/api/WebPhoneApi.d.ts +28 -0
  15. package/dist/api/contracts.d.ts +94 -0
  16. package/dist/auth/TokenManager.d.ts +22 -0
  17. package/dist/core/CCBarCall.d.ts +94 -0
  18. package/dist/core/CCBarClient.d.ts +113 -0
  19. package/dist/core/CallManager.d.ts +93 -0
  20. package/dist/core/callId.d.ts +1 -0
  21. package/dist/core/mediaBridge.d.ts +17 -0
  22. package/dist/createJsSipFactory-2X4FBIU2.cjs +75 -0
  23. package/dist/createJsSipFactory-yttVU3d6.js +9662 -0
  24. package/dist/diagnostics/Diagnostics.d.ts +74 -0
  25. package/dist/diagnostics/RingBuffer.d.ts +7 -0
  26. package/dist/diagnostics/index.cjs +1 -0
  27. package/dist/diagnostics/index.d.ts +4 -0
  28. package/dist/diagnostics/index.js +6 -0
  29. package/dist/diagnostics/redact.d.ts +5 -0
  30. package/dist/errors/CCBarError.d.ts +15 -0
  31. package/dist/events/TypedEventBus.d.ts +9 -0
  32. package/dist/index.cjs +1 -0
  33. package/dist/index.d.ts +21 -0
  34. package/dist/index.js +152 -0
  35. package/dist/index.umd.js +75 -0
  36. package/dist/legacy/CCBarSDK.d.ts +29 -0
  37. package/dist/legacy/index.cjs +1 -0
  38. package/dist/legacy/index.d.ts +8 -0
  39. package/dist/legacy/index.js +108 -0
  40. package/dist/redact-Bq26pObO.cjs +1 -0
  41. package/dist/redact-DB3CMbsK.js +21 -0
  42. package/dist/shared/SharedCallTransport.d.ts +55 -0
  43. package/dist/shared/SharedWorkerClient.d.ts +20 -0
  44. package/dist/shared/SharedWorkerEntry.d.ts +3 -0
  45. package/dist/shared/SharedWorkerFactory.d.ts +29 -0
  46. package/dist/shared/SharedWorkerProtocol.d.ts +47 -0
  47. package/dist/shared/SharedWorkerRuntime.d.ts +35 -0
  48. package/dist/shared-worker.cjs +1 -0
  49. package/dist/shared-worker.d.ts +1 -0
  50. package/dist/shared-worker.js +185 -0
  51. package/dist/state/callStateMachine.d.ts +9 -0
  52. package/dist/styles.css +7 -0
  53. package/dist/types.d.ts +134 -0
  54. package/dist/ui/XCallCCBarElement.d.ts +23 -0
  55. package/dist/ui/controllers/mobileLifecycle.d.ts +18 -0
  56. package/dist/ui/controllers/phoneActions.d.ts +27 -0
  57. package/dist/ui/i18n/en-US.d.ts +2 -0
  58. package/dist/ui/i18n/index.d.ts +6 -0
  59. package/dist/ui/i18n/types.d.ts +53 -0
  60. package/dist/ui/i18n/zh-CN.d.ts +2 -0
  61. package/dist/ui/icons/index.d.ts +5 -0
  62. package/dist/ui/index.cjs +1 -0
  63. package/dist/ui/index.d.ts +3 -0
  64. package/dist/ui/index.js +1044 -0
  65. package/dist/ui/state/toPhoneViewModel.d.ts +54 -0
  66. package/dist/ui/views/dom.d.ts +11 -0
  67. package/dist/ui/views/messages.d.ts +5 -0
  68. package/dist/ui/views/renderActiveCall.d.ts +8 -0
  69. package/dist/ui/views/renderDesktop.d.ts +24 -0
  70. package/dist/ui/views/renderDialpad.d.ts +4 -0
  71. package/dist/ui/views/renderError.d.ts +6 -0
  72. package/dist/ui/views/renderIncoming.d.ts +8 -0
  73. package/dist/ui/views/renderMobile.d.ts +15 -0
  74. package/dist/ui/views/renderSetup.d.ts +6 -0
  75. package/package.json +107 -0
@@ -0,0 +1,54 @@
1
+ import { CallState } from '../../types.js';
2
+ export type PhonePermission = 'granted' | 'denied' | 'prompt' | 'unsupported' | 'unknown';
3
+ export type PhoneConnectionState = 'idle' | 'offline' | 'connecting' | 'connected' | 'reconnecting' | 'failed' | 'disconnected';
4
+ export interface PhoneCallSnapshot {
5
+ readonly id: string;
6
+ readonly state: CallState;
7
+ readonly destination?: string;
8
+ readonly direction?: 'inbound' | 'outbound';
9
+ }
10
+ export interface PhoneViewInput {
11
+ readonly connectionState: PhoneConnectionState;
12
+ readonly permission?: PhonePermission;
13
+ readonly calls: readonly PhoneCallSnapshot[];
14
+ readonly error?: {
15
+ readonly code: string;
16
+ };
17
+ readonly supported?: boolean;
18
+ }
19
+ export type PhoneViewModel = {
20
+ readonly kind: 'unsupported';
21
+ } | {
22
+ readonly kind: 'permission-error';
23
+ readonly code: 'MEDIA_PERMISSION_DENIED';
24
+ readonly action: 'retry-permission';
25
+ } | {
26
+ readonly kind: 'unrecoverable-error';
27
+ readonly code: string;
28
+ } | {
29
+ readonly kind: 'setup';
30
+ } | {
31
+ readonly kind: 'connecting';
32
+ } | {
33
+ readonly kind: 'incoming';
34
+ readonly callId: string;
35
+ readonly from: string;
36
+ } | {
37
+ readonly kind: 'active';
38
+ readonly callId: string;
39
+ readonly destination?: string;
40
+ } | {
41
+ readonly kind: 'held';
42
+ readonly callId: string;
43
+ readonly destination?: string;
44
+ } | {
45
+ readonly kind: 'dialing';
46
+ readonly callId: string;
47
+ readonly destination?: string;
48
+ } | {
49
+ readonly kind: 'ended';
50
+ readonly callId?: string;
51
+ } | {
52
+ readonly kind: 'ready';
53
+ };
54
+ export declare function toPhoneViewModel(input: PhoneViewInput): PhoneViewModel;
@@ -0,0 +1,11 @@
1
+ export declare function createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, options?: {
2
+ readonly className?: string;
3
+ readonly text?: string;
4
+ readonly attrs?: Record<string, string>;
5
+ readonly children?: readonly Node[];
6
+ }): HTMLElementTagNameMap[K];
7
+ export declare function createStatusRail(text: string): HTMLDivElement;
8
+ export declare function createLabelledTelInput(id: string, labelText: string, name?: string): {
9
+ readonly field: HTMLDivElement;
10
+ readonly input: HTMLInputElement;
11
+ };
@@ -0,0 +1,5 @@
1
+ import { UiMessages } from '../i18n/types.js';
2
+ export type PhoneUiMessages = Partial<UiMessages> & {
3
+ readonly status?: string;
4
+ };
5
+ export declare const defaultZhMessages: PhoneUiMessages;
@@ -0,0 +1,8 @@
1
+ import { PhoneViewModel } from '../state/toPhoneViewModel.js';
2
+ import { PhoneUiMessages } from './messages.js';
3
+ export declare function renderActiveCall(options: {
4
+ readonly view: Extract<PhoneViewModel, {
5
+ kind: 'active' | 'held' | 'dialing';
6
+ }>;
7
+ readonly messages: PhoneUiMessages;
8
+ }): HTMLElement;
@@ -0,0 +1,24 @@
1
+ import { PhoneViewModel } from '../state/toPhoneViewModel.js';
2
+ import { PhoneUiMessages } from './messages.js';
3
+ export interface DesktopCallRow {
4
+ readonly id: string;
5
+ readonly destination: string;
6
+ readonly state: string;
7
+ readonly direction: 'inbound' | 'outbound';
8
+ readonly current: boolean;
9
+ }
10
+ export interface DesktopRenderOptions {
11
+ readonly mode: 'compact' | 'panel';
12
+ readonly view: PhoneViewModel;
13
+ readonly messages: PhoneUiMessages;
14
+ readonly destination: string;
15
+ readonly muted: boolean;
16
+ readonly canDial: boolean;
17
+ readonly moreOpen: boolean;
18
+ readonly floating: boolean;
19
+ readonly connected: boolean;
20
+ readonly agentStatus: 'available' | 'offline' | 'break';
21
+ readonly extension: string;
22
+ readonly calls: readonly DesktopCallRow[];
23
+ }
24
+ export declare function renderDesktop(options: DesktopRenderOptions): HTMLElement;
@@ -0,0 +1,4 @@
1
+ import { PhoneUiMessages } from './messages.js';
2
+ export declare function renderDialpad(options: {
3
+ readonly messages: Pick<PhoneUiMessages, 'numberLabel' | 'call'>;
4
+ }): HTMLElement;
@@ -0,0 +1,6 @@
1
+ import { PhoneViewModel } from '../state/toPhoneViewModel.js';
2
+ import { PhoneUiMessages } from './messages.js';
3
+ export declare function renderError(options: {
4
+ readonly view: PhoneViewModel;
5
+ readonly messages: PhoneUiMessages;
6
+ }): HTMLElement;
@@ -0,0 +1,8 @@
1
+ import { PhoneViewModel } from '../state/toPhoneViewModel.js';
2
+ import { PhoneUiMessages } from './messages.js';
3
+ export declare function renderIncoming(options: {
4
+ readonly view: Extract<PhoneViewModel, {
5
+ kind: 'incoming';
6
+ }>;
7
+ readonly messages: PhoneUiMessages;
8
+ }): HTMLElement;
@@ -0,0 +1,15 @@
1
+ import { PhoneViewModel } from '../state/toPhoneViewModel.js';
2
+ import { PhoneUiMessages } from './messages.js';
3
+ export declare function renderMobileEnable(options: {
4
+ readonly enabling: boolean;
5
+ readonly status: string;
6
+ readonly enablePhone?: string;
7
+ }): HTMLElement;
8
+ export declare function renderMobile(options: {
9
+ readonly view: PhoneViewModel;
10
+ readonly messages: PhoneUiMessages;
11
+ readonly destination: string;
12
+ readonly muted: boolean;
13
+ readonly canDial: boolean;
14
+ readonly showOutputDevice: boolean;
15
+ }): HTMLElement;
@@ -0,0 +1,6 @@
1
+ import { PhoneViewModel } from '../state/toPhoneViewModel.js';
2
+ import { PhoneUiMessages } from './messages.js';
3
+ export declare function renderSetup(options: {
4
+ readonly view: PhoneViewModel;
5
+ readonly messages: PhoneUiMessages;
6
+ }): HTMLElement;
package/package.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@16x/webphone-sdk",
3
+ "version": "3.0.1",
4
+ "private": false,
5
+ "license": "UNLICENSED",
6
+ "publishConfig": {
7
+ "access": "public",
8
+ "registry": "https://registry.npmjs.org"
9
+ },
10
+ "type": "module",
11
+ "sideEffects": [
12
+ "./dist/styles.css"
13
+ ],
14
+ "files": [
15
+ "dist/index.js",
16
+ "dist/index.cjs",
17
+ "dist/index.umd.js",
18
+ "dist/*.js",
19
+ "dist/*.cjs",
20
+ "dist/index.d.ts",
21
+ "dist/types.d.ts",
22
+ "dist/errors",
23
+ "dist/events",
24
+ "dist/state",
25
+ "dist/auth",
26
+ "dist/api",
27
+ "dist/core",
28
+ "dist/shared",
29
+ "dist/ui",
30
+ "dist/legacy",
31
+ "dist/diagnostics",
32
+ "dist/shared-worker.js",
33
+ "dist/shared-worker.d.ts",
34
+ "dist/styles.css",
35
+ "README.md",
36
+ "LICENSE",
37
+ "CHANGELOG.md"
38
+ ],
39
+ "exports": {
40
+ ".": {
41
+ "types": "./dist/index.d.ts",
42
+ "import": "./dist/index.js",
43
+ "require": "./dist/index.cjs"
44
+ },
45
+ "./ui": {
46
+ "types": "./dist/ui/index.d.ts",
47
+ "import": "./dist/ui/index.js",
48
+ "require": "./dist/ui/index.cjs"
49
+ },
50
+ "./legacy": {
51
+ "types": "./dist/legacy/index.d.ts",
52
+ "import": "./dist/legacy/index.js",
53
+ "require": "./dist/legacy/index.cjs"
54
+ },
55
+ "./diagnostics": {
56
+ "types": "./dist/diagnostics/index.d.ts",
57
+ "import": "./dist/diagnostics/index.js",
58
+ "require": "./dist/diagnostics/index.cjs"
59
+ },
60
+ "./shared-worker": {
61
+ "types": "./dist/shared-worker.d.ts",
62
+ "import": "./dist/shared-worker.js"
63
+ },
64
+ "./styles.css": "./dist/styles.css"
65
+ },
66
+ "scripts": {
67
+ "build": "vite build && vite build -c vite.umd.config.ts",
68
+ "typecheck": "tsc -p tsconfig.json --noEmit",
69
+ "test": "npm run build && vitest run",
70
+ "lint": "eslint .",
71
+ "pack:check": "node scripts/check-package.mjs",
72
+ "sbom": "node scripts/generate-sbom.mjs",
73
+ "release:artifacts": "node scripts/generate-release-artifacts.mjs",
74
+ "check:node-next": "npm run build && node scripts/check-node-next-consumer.mjs",
75
+ "build:examples": "node scripts/build-examples.mjs",
76
+ "verify:bundle": "node scripts/check-bundle-size.mjs",
77
+ "verify:memory": "node scripts/run-memory-soak.mjs",
78
+ "verify:call-soak": "node scripts/run-call-soak.mjs",
79
+ "verify:hour-soak": "node scripts/run-browser-call-soak.mjs",
80
+ "verify:staged": "npm run verify:memory && npm run verify:call-soak",
81
+ "docs:build": "node scripts/build-docs-site.mjs",
82
+ "docs:check": "node scripts/check-docs-site.mjs",
83
+ "docs:test": "npm run docs:build && npx vitest run tests/docs-site/static-site.test.ts tests/docs-site/navigation.test.ts",
84
+ "customer:packages": "node scripts/create-customer-packages.mjs",
85
+ "verify:release": "npm run lint && npm run typecheck && npm test && npm run build && npm run build:examples && npm run verify:bundle && npm run pack:check && npm run sbom"
86
+ },
87
+ "dependencies": {
88
+ "jssip": "3.10.1"
89
+ },
90
+ "devDependencies": {
91
+ "@eslint/js": "^10.0.1",
92
+ "@types/react": "^19.3.0",
93
+ "@types/react-dom": "^19.3.0",
94
+ "@vitejs/plugin-react": "^6.1.1",
95
+ "@vitejs/plugin-vue": "^6.0.9",
96
+ "eslint": "^10.10.0",
97
+ "happy-dom": "^20.14.5",
98
+ "react": "^19.3.0",
99
+ "react-dom": "^19.3.0",
100
+ "typescript": "^6.0.3",
101
+ "typescript-eslint": "^8.70.0",
102
+ "vite": "^8.3.0",
103
+ "vite-plugin-dts": "^5.1.0",
104
+ "vitest": "^5.0.1",
105
+ "vue": "^3.5.43"
106
+ }
107
+ }