react-native-visit-rn-sdk 6.0.2 → 6.0.4

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 (45) hide show
  1. package/README.md +157 -51
  2. package/lib/commonjs/components/VideoCallComponent.js +11 -16
  3. package/lib/commonjs/components/VideoCallComponent.js.map +1 -1
  4. package/lib/commonjs/index.android.js +44 -14
  5. package/lib/commonjs/index.android.js.map +1 -1
  6. package/lib/commonjs/index.ios.js +74 -38
  7. package/lib/commonjs/index.ios.js.map +1 -1
  8. package/lib/commonjs/index.js +6 -0
  9. package/lib/commonjs/index.js.map +1 -0
  10. package/lib/commonjs/shims.d.js +2 -0
  11. package/lib/commonjs/shims.d.js.map +1 -0
  12. package/lib/commonjs/types.js +2 -0
  13. package/lib/commonjs/types.js.map +1 -0
  14. package/lib/module/components/VideoCallComponent.js +11 -16
  15. package/lib/module/components/VideoCallComponent.js.map +1 -1
  16. package/lib/module/index.android.js +45 -15
  17. package/lib/module/index.android.js.map +1 -1
  18. package/lib/module/index.ios.js +75 -39
  19. package/lib/module/index.ios.js.map +1 -1
  20. package/lib/module/index.js +2 -0
  21. package/lib/module/index.js.map +1 -0
  22. package/lib/module/shims.d.js +2 -0
  23. package/lib/module/shims.d.js.map +1 -0
  24. package/lib/module/types.js +2 -0
  25. package/lib/module/types.js.map +1 -0
  26. package/lib/typescript/components/VideoCallComponent.d.ts +77 -2
  27. package/lib/typescript/components/VideoCallComponent.d.ts.map +1 -1
  28. package/lib/typescript/index.android.d.ts +3 -11
  29. package/lib/typescript/index.android.d.ts.map +1 -1
  30. package/lib/typescript/index.d.ts +17 -0
  31. package/lib/typescript/index.d.ts.map +1 -0
  32. package/lib/typescript/index.ios.d.ts +3 -11
  33. package/lib/typescript/index.ios.d.ts.map +1 -1
  34. package/lib/typescript/types.d.ts +24 -0
  35. package/lib/typescript/types.d.ts.map +1 -0
  36. package/package.json +14 -11
  37. package/src/components/VideoCallComponent.tsx +1484 -0
  38. package/src/index.android.tsx +459 -0
  39. package/src/index.ios.tsx +238 -0
  40. package/src/index.tsx +25 -0
  41. package/src/shims.d.ts +49 -0
  42. package/src/types.ts +25 -0
  43. package/src/components/VideoCallComponent.js +0 -1305
  44. package/src/index.android.js +0 -362
  45. package/src/index.ios.js +0 -157
@@ -1,4 +1,79 @@
1
- export default VideoCallComponent;
2
- declare const VideoCallComponent: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
1
  import React from 'react';
2
+ import { type StyleProp, type ViewStyle } from 'react-native';
3
+ declare const VIDEO_CALL_ERROR_STATUS: Readonly<{
4
+ MISSING_ROOM_NAME_OR_ACCESS_TOKEN: "MISSING_ROOM_NAME_OR_ACCESS_TOKEN";
5
+ PERMISSIONS_REQUIRED: "PERMISSIONS_REQUIRED";
6
+ PERMISSION_CHECK_FAILED: "PERMISSION_CHECK_FAILED";
7
+ INVALID_OR_EXPIRED_TOKEN: "INVALID_OR_EXPIRED_TOKEN";
8
+ CONNECT_FAILED: "CONNECT_FAILED";
9
+ }>;
10
+ export type VideoCallErrorStatus = (typeof VIDEO_CALL_ERROR_STATUS)[keyof typeof VIDEO_CALL_ERROR_STATUS];
11
+ export type VideoCallStartParams = {
12
+ roomName: string;
13
+ accessToken: string;
14
+ doctorName?: string;
15
+ visibleDoctorName?: string;
16
+ userName?: string;
17
+ };
18
+ export type VideoCallConnectedInfo = {
19
+ roomName?: string;
20
+ };
21
+ export type VideoCallEndedInfo = {
22
+ reason?: string;
23
+ error?: unknown;
24
+ };
25
+ export type VideoCallErrorInfo = {
26
+ status: VideoCallErrorStatus;
27
+ error?: unknown;
28
+ metadata?: Record<string, unknown>;
29
+ };
30
+ export type VideoCallLowNetworkQualityInfo = {
31
+ quality: number;
32
+ participant: 'local' | 'remote';
33
+ };
34
+ type RemoteTrackIdentifier = {
35
+ participantSid: string;
36
+ videoTrackSid: string;
37
+ };
38
+ type CallStatus = 'idle' | 'connecting' | 'connected' | 'participantDisconnected';
39
+ type VideoCallState = {
40
+ isVisible: boolean;
41
+ loading: boolean;
42
+ status: CallStatus;
43
+ roomName: string;
44
+ accessToken: string;
45
+ remoteTrackSid: string;
46
+ remoteTrackIdentifier: RemoteTrackIdentifier | null;
47
+ participantVideoEnabled: boolean;
48
+ participantAudioEnabled: boolean;
49
+ isMuted: boolean;
50
+ isVideoEnabled: boolean;
51
+ isFrontCameraEnabled: boolean;
52
+ signalStrength: number | null;
53
+ participantSignalStrength: number | null;
54
+ showLowSignalStrengthMessage: boolean;
55
+ showParticipantReconnectingScreen: boolean;
56
+ showUserReconnectingScreen: boolean;
57
+ showBottomBar: boolean;
58
+ durationMins: string;
59
+ durationSecs: string;
60
+ doctorName: string;
61
+ visibleDoctorName: string;
62
+ userName: string;
63
+ };
64
+ export type VideoCallComponentProps = {
65
+ onCallConnected?: (info: VideoCallConnectedInfo) => void;
66
+ onCallEnded?: (info: VideoCallEndedInfo) => void;
67
+ onError?: (info: VideoCallErrorInfo) => void;
68
+ onLowNetworkQuality?: (info: VideoCallLowNetworkQualityInfo) => void;
69
+ onStateChange?: (state: VideoCallState) => void;
70
+ style?: StyleProp<ViewStyle>;
71
+ };
72
+ export type VideoCallComponentHandle = {
73
+ startVideoCall: (params: VideoCallStartParams) => void;
74
+ endCall: () => void;
75
+ isConnected: () => boolean;
76
+ };
77
+ declare const VideoCallComponent: React.ForwardRefExoticComponent<VideoCallComponentProps & React.RefAttributes<VideoCallComponentHandle>>;
78
+ export default VideoCallComponent;
4
79
  //# sourceMappingURL=VideoCallComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VideoCallComponent.d.ts","sourceRoot":"","sources":["../../../src/components/VideoCallComponent.js"],"names":[],"mappings":";AAkFA,4FA6yBE;kBAx3BK,OAAO"}
1
+ {"version":3,"file":"VideoCallComponent.d.ts","sourceRoot":"","sources":["../../../src/components/VideoCallComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,EAkBL,KAAK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AW,EAAE,MAAM,OAAO,CAAC;CAC5B,CAAC;AA0FF,QAAA,MAAM,kBAAkB,0GA+0BtB,CAAC;AA+ZH,eAAe,kBAAkB,CAAC"}
@@ -1,13 +1,5 @@
1
- export default VisitRnSdkView;
2
- declare function VisitRnSdkView({ ssoLink, isLoggingEnabled }: {
3
- ssoLink: any;
4
- isLoggingEnabled: any;
5
- }): React.JSX.Element;
6
- declare namespace VisitRnSdkView {
7
- namespace defaultProps {
8
- let ssoLink: string;
9
- let isLoggingEnabled: boolean;
10
- }
11
- }
12
1
  import React from 'react';
2
+ import type { VisitRnSdkViewHandle, VisitRnSdkViewProps } from './types';
3
+ declare const VisitRnSdkView: React.ForwardRefExoticComponent<VisitRnSdkViewProps & React.RefAttributes<VisitRnSdkViewHandle>>;
4
+ export default VisitRnSdkView;
13
5
  //# sourceMappingURL=index.android.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.android.d.ts","sourceRoot":"","sources":["../../src/index.android.js"],"names":[],"mappings":";AAwBA;;;sBA0UC;;;;;;;kBAlW+D,OAAO"}
1
+ {"version":3,"file":"index.android.d.ts","sourceRoot":"","sources":["../../src/index.android.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAwBf,OAAO,KAAK,EAEV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AA8BjB,QAAA,MAAM,cAAc,kGAsYnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Ref } from 'react';
2
+ import type { VisitRnSdkViewHandle, VisitRnSdkViewProps } from './types';
3
+ export type { VisitEventProperties, VisitRnSdkViewHandle, VisitRnSdkViewProps, } from './types';
4
+ /**
5
+ * Platform-neutral entry used by TypeScript and react-native-builder-bob.
6
+ * Metro resolves `src/index` to `index.android.tsx` / `index.ios.tsx` at runtime,
7
+ * so this file only exists to publish shared typings.
8
+ *
9
+ * Return type is intentionally loose so host apps on different React /
10
+ * `@types/react` versions can use this as a JSX component without
11
+ * conflicting ReactElement definitions.
12
+ */
13
+ declare const VisitRnSdkView: (props: VisitRnSdkViewProps & {
14
+ ref?: Ref<VisitRnSdkViewHandle>;
15
+ }) => any;
16
+ export default VisitRnSdkView;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEzE,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;GAQG;AACH,OAAO,CAAC,MAAM,cAAc,EAAE,CAC5B,KAAK,EAAE,mBAAmB,GAAG;IAC3B,GAAG,CAAC,EAAE,GAAG,CAAC,oBAAoB,CAAC,CAAC;CACjC,KACE,GAAG,CAAC;AAET,eAAe,cAAc,CAAC"}
@@ -1,13 +1,5 @@
1
- export default VisitRnSdkView;
2
- declare function VisitRnSdkView({ ssoLink, isLoggingEnabled }: {
3
- ssoLink: any;
4
- isLoggingEnabled: any;
5
- }): React.JSX.Element;
6
- declare namespace VisitRnSdkView {
7
- namespace defaultProps {
8
- let ssoLink: string;
9
- let isLoggingEnabled: boolean;
10
- }
11
- }
12
1
  import React from 'react';
2
+ import type { VisitRnSdkViewHandle, VisitRnSdkViewProps } from './types';
3
+ declare const VisitRnSdkView: React.ForwardRefExoticComponent<VisitRnSdkViewProps & React.RefAttributes<VisitRnSdkViewHandle>>;
4
+ export default VisitRnSdkView;
13
5
  //# sourceMappingURL=index.ios.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.ios.d.ts","sourceRoot":"","sources":["../../src/index.ios.js"],"names":[],"mappings":";AA8BA;;;sBAiHC;;;;;;;kBA/I0C,OAAO"}
1
+ {"version":3,"file":"index.ios.d.ts","sourceRoot":"","sources":["../../src/index.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,EAEV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAwCjB,QAAA,MAAM,cAAc,kGA4KnB,CAAC;AAQF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,24 @@
1
+ export type VisitEventProperties = Record<string, unknown>;
2
+ export type VisitRnSdkViewHandle = {
3
+ /**
4
+ * Sends a generic event into the Visit PWA. The PWA must implement
5
+ * `window.sendEventToVisit(eventName, properties)`.
6
+ */
7
+ sendEvent: (eventName: string, properties?: VisitEventProperties) => void;
8
+ };
9
+ export type VisitRnSdkViewProps = {
10
+ /**
11
+ * Pre-generated Visit SSO URL used as the WebView source.
12
+ */
13
+ ssoLink?: string;
14
+ /**
15
+ * When true, the SDK logs diagnostic messages. Defaults to false.
16
+ */
17
+ isLoggingEnabled?: boolean;
18
+ /**
19
+ * Called for host-facing PWA messages (`sendEventToHost`).
20
+ * Built-in methods stay internal.
21
+ */
22
+ onEvent?: (eventName: string, properties?: VisitEventProperties) => void;
23
+ };
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC3E,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC1E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-visit-rn-sdk",
3
- "version": "6.0.2",
3
+ "version": "6.0.4",
4
4
  "description": "a package to inject data into visit health pwa",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -33,10 +33,15 @@
33
33
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
34
34
  "prepack": "bob build",
35
35
  "release": "release-it",
36
- "example": "yarn --cwd example",
36
+ "example:start": "npm --prefix example run start --",
37
+ "example:android": "npm --prefix example run android --",
38
+ "example:ios": "npm --prefix example run ios --",
39
+ "example:test": "npm --prefix example run test --",
40
+ "example:typecheck": "npm --prefix example run typecheck",
41
+ "example:pods": "npm --prefix example run pods",
37
42
  "build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
38
43
  "build:ios": "cd example/ios && xcodebuild -workspace example.xcworkspace -scheme example -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
39
- "bootstrap": "yarn example && yarn install && yarn example pods",
44
+ "bootstrap": "npm install && npm --prefix example install && npm run example:pods",
40
45
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
41
46
  },
42
47
  "keywords": [
@@ -65,6 +70,8 @@
65
70
  "@types/jest": "^28.1.2",
66
71
  "@types/react": "~17.0.21",
67
72
  "@types/react-native": "0.70.0",
73
+ "@typescript-eslint/eslint-plugin": "^8.70.0",
74
+ "@typescript-eslint/parser": "^8.70.0",
68
75
  "commitlint": "^17.0.2",
69
76
  "del-cli": "^5.0.0",
70
77
  "eslint": "^8.4.1",
@@ -78,24 +85,23 @@
78
85
  "react-native": "0.72.4",
79
86
  "react-native-builder-bob": "^0.20.0",
80
87
  "react-native-permissions": "4.1.5",
88
+ "react-native-webview": "^13.12.1",
81
89
  "react-test-renderer": "18.2.0",
82
90
  "release-it": "^15.0.0",
83
91
  "turbo": "^1.10.7",
84
92
  "typescript": "^5.0.2"
85
93
  },
86
- "resolutions": {
87
- "@types/react": "17.0.21"
88
- },
89
94
  "peerDependencies": {
90
95
  "@twilio/video-react-native-sdk": "3.5.0",
91
96
  "react": "*",
92
97
  "react-native": "*",
93
- "react-native-permissions": "^4.1.5"
98
+ "react-native-permissions": "^4.1.5",
99
+ "react-native-webview": "*"
94
100
  },
95
101
  "engines": {
96
102
  "node": ">= 16.0.0"
97
103
  },
98
- "packageManager": "yarn@1.22.22",
104
+ "packageManager": "npm@11.16.0",
99
105
  "jest": {
100
106
  "preset": "react-native",
101
107
  "modulePathIgnorePatterns": [
@@ -172,9 +178,6 @@
172
178
  ]
173
179
  ]
174
180
  },
175
- "dependencies": {
176
- "react-native-webview": "^13.12.1"
177
- },
178
181
  "directories": {
179
182
  "example": "example"
180
183
  }