@nihinmedia/medgen-react-native 1.0.12
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/LICENSE +62 -0
- package/README.md +221 -0
- package/SECURITY.md +101 -0
- package/lib/commonjs/MedGenWebView.js +201 -0
- package/lib/commonjs/bridge.js +208 -0
- package/lib/commonjs/client.js +445 -0
- package/lib/commonjs/index.js +204 -0
- package/lib/commonjs/native.js +201 -0
- package/lib/commonjs/pdfLinks.js +57 -0
- package/lib/commonjs/types.js +27 -0
- package/lib/module/MedGenWebView.js +166 -0
- package/lib/module/bridge.js +182 -0
- package/lib/module/client.js +391 -0
- package/lib/module/index.js +152 -0
- package/lib/module/native.js +171 -0
- package/lib/module/pdfLinks.js +45 -0
- package/lib/module/types.js +17 -0
- package/lib/typescript/MedGenWebView.d.ts +18 -0
- package/lib/typescript/bridge.d.ts +12 -0
- package/lib/typescript/client.d.ts +30 -0
- package/lib/typescript/index.d.ts +23 -0
- package/lib/typescript/native.d.ts +38 -0
- package/lib/typescript/pdfLinks.d.ts +14 -0
- package/lib/typescript/types.d.ts +182 -0
- package/package.json +116 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { OptionalNativeModules } from './native';
|
|
2
|
+
import type { PdfLink } from './pdfLinks';
|
|
3
|
+
export type { PdfLink };
|
|
4
|
+
export declare enum MedGenEnvironment {
|
|
5
|
+
|
|
6
|
+
Development = "development",
|
|
7
|
+
|
|
8
|
+
Staging = "staging",
|
|
9
|
+
Production = "production"
|
|
10
|
+
}
|
|
11
|
+
export interface MedGenPalette {
|
|
12
|
+
primary?: string;
|
|
13
|
+
secondary?: string;
|
|
14
|
+
accent?: string;
|
|
15
|
+
surface?: string;
|
|
16
|
+
onSurface?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface MedGenTheme extends MedGenPalette {
|
|
19
|
+
darkVariant?: MedGenPalette;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type AssertionProvider = () => Promise<string>;
|
|
23
|
+
|
|
24
|
+
export type AttestationProvider = (challenge: string) => Promise<string>;
|
|
25
|
+
|
|
26
|
+
export interface MedGenCapabilities {
|
|
27
|
+
theming: boolean;
|
|
28
|
+
customLogo: boolean;
|
|
29
|
+
hideAttribution: boolean;
|
|
30
|
+
|
|
31
|
+
customMonogram: boolean;
|
|
32
|
+
topbar: boolean;
|
|
33
|
+
newChat: boolean;
|
|
34
|
+
sidebar: boolean;
|
|
35
|
+
networkBanner: boolean;
|
|
36
|
+
notifications: boolean;
|
|
37
|
+
referral: boolean;
|
|
38
|
+
announcements: boolean;
|
|
39
|
+
appDownloadPrompt: boolean;
|
|
40
|
+
notes: boolean;
|
|
41
|
+
questionForum: boolean;
|
|
42
|
+
workshopVideos: boolean;
|
|
43
|
+
collections: boolean;
|
|
44
|
+
|
|
45
|
+
ads: boolean;
|
|
46
|
+
|
|
47
|
+
navBar: boolean;
|
|
48
|
+
|
|
49
|
+
settings: boolean;
|
|
50
|
+
|
|
51
|
+
settingsLegal: boolean;
|
|
52
|
+
|
|
53
|
+
settingsTheme: boolean;
|
|
54
|
+
settingsSupport: boolean;
|
|
55
|
+
settingsSystemInfo: boolean;
|
|
56
|
+
settingsLogout: boolean;
|
|
57
|
+
profileAccount: boolean;
|
|
58
|
+
profileDeleteAccount: boolean;
|
|
59
|
+
quickAnswer: boolean;
|
|
60
|
+
detailedAnswer: boolean;
|
|
61
|
+
japaneseAnswer: boolean;
|
|
62
|
+
dictation: boolean;
|
|
63
|
+
fileUpload: boolean;
|
|
64
|
+
|
|
65
|
+
clipboard: boolean;
|
|
66
|
+
richClipboard: boolean;
|
|
67
|
+
share: boolean;
|
|
68
|
+
|
|
69
|
+
downloadToDevice: boolean;
|
|
70
|
+
|
|
71
|
+
closeButton: boolean;
|
|
72
|
+
|
|
73
|
+
downloadPdf: boolean;
|
|
74
|
+
chatHistory: boolean;
|
|
75
|
+
bookmarks: boolean;
|
|
76
|
+
citationsPanel: boolean;
|
|
77
|
+
|
|
78
|
+
referencesShowMore: boolean;
|
|
79
|
+
directLink: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface MedGenNativeHandlers {
|
|
83
|
+
|
|
84
|
+
onShare?: (text: string) => Promise<boolean>;
|
|
85
|
+
|
|
86
|
+
onCopy?: (content: {
|
|
87
|
+
text: string;
|
|
88
|
+
html?: string;
|
|
89
|
+
}) => Promise<boolean>;
|
|
90
|
+
|
|
91
|
+
onSpeechStart?: () => Promise<void>;
|
|
92
|
+
|
|
93
|
+
onSpeechStop?: () => Promise<string>;
|
|
94
|
+
|
|
95
|
+
onFilePick?: () => Promise<MedGenFile[]>;
|
|
96
|
+
|
|
97
|
+
onSavePdf?: (document: {
|
|
98
|
+
html: string;
|
|
99
|
+
fileName: string;
|
|
100
|
+
|
|
101
|
+
links?: PdfLink[];
|
|
102
|
+
}) => Promise<boolean>;
|
|
103
|
+
}
|
|
104
|
+
export interface MedGenFile {
|
|
105
|
+
uri: string;
|
|
106
|
+
name: string;
|
|
107
|
+
mimeType: string;
|
|
108
|
+
size: number;
|
|
109
|
+
}
|
|
110
|
+
export interface MedGenConfig {
|
|
111
|
+
partnerId: string;
|
|
112
|
+
environment: MedGenEnvironment;
|
|
113
|
+
|
|
114
|
+
assertionProvider?: AssertionProvider;
|
|
115
|
+
|
|
116
|
+
assertion?: string;
|
|
117
|
+
attestationProvider?: AttestationProvider;
|
|
118
|
+
nativeHandlers?: MedGenNativeHandlers;
|
|
119
|
+
|
|
120
|
+
nativeModules?: OptionalNativeModules;
|
|
121
|
+
locale?: 'ja' | 'en';
|
|
122
|
+
theme?: MedGenTheme;
|
|
123
|
+
apiBaseUrl?: string;
|
|
124
|
+
embedBaseUrl?: string;
|
|
125
|
+
|
|
126
|
+
onEvent?: (event: MedGenEvent) => void;
|
|
127
|
+
}
|
|
128
|
+
export interface MedGenPresentOptions {
|
|
129
|
+
entryQuestion?: string;
|
|
130
|
+
}
|
|
131
|
+
export type MedGenEventName = 'exchange.started' | 'exchange.succeeded' | 'exchange.failed' | 'surface.opened' | 'surface.closed' | 'session.expired' | 'session.refreshed'
|
|
132
|
+
|
|
133
|
+
| 'surface.externalLinkOpened'
|
|
134
|
+
|
|
135
|
+
| 'surface.externalLinkFailed'
|
|
136
|
+
|
|
137
|
+
| 'surface.loadFailed';
|
|
138
|
+
export interface MedGenEvent {
|
|
139
|
+
name: MedGenEventName;
|
|
140
|
+
at: number;
|
|
141
|
+
detail?: Record<string, unknown>;
|
|
142
|
+
}
|
|
143
|
+
export type MedGenErrorCode = 'NOT_INITIALIZED' | 'ASSERTION_PROVIDER_FAILED' | 'ASSERTION_PROVIDER_TIMEOUT' | 'ASSERTION_EXPIRED' | 'ASSERTION_REPLAYED' | 'SIGNATURE_INVALID' | 'AUDIENCE_INVALID' | 'PARTNER_NOT_ENABLED' | 'PARTNER_SUSPENDED' | 'ATTESTATION_REQUIRED' | 'ATTESTATION_FAILED' | 'SUBJECT_REUSE_SUSPECTED' | 'RATE_LIMIT_EXCEEDED' | 'NETWORK_UNAVAILABLE' | 'SESSION_EXPIRED' | 'UNKNOWN';
|
|
144
|
+
export declare class MedGenError extends Error {
|
|
145
|
+
readonly code: MedGenErrorCode;
|
|
146
|
+
readonly retryable: boolean;
|
|
147
|
+
readonly supportReference?: string;
|
|
148
|
+
constructor(code: MedGenErrorCode, message: string, retryable?: boolean, supportReference?: string);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface MedGenBrandAsset {
|
|
152
|
+
url?: string;
|
|
153
|
+
|
|
154
|
+
alt?: string;
|
|
155
|
+
width?: number;
|
|
156
|
+
height?: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface MedGenBranding {
|
|
160
|
+
|
|
161
|
+
logo?: MedGenBrandAsset;
|
|
162
|
+
|
|
163
|
+
monogram?: MedGenBrandAsset;
|
|
164
|
+
|
|
165
|
+
colors?: Record<string, string>;
|
|
166
|
+
|
|
167
|
+
colorsDark?: Record<string, string>;
|
|
168
|
+
|
|
169
|
+
attribution?: {
|
|
170
|
+
hidden?: boolean;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export interface ExchangeResult {
|
|
174
|
+
handoffCode: string;
|
|
175
|
+
isNewUser: boolean;
|
|
176
|
+
|
|
177
|
+
emailCollisionPending: boolean;
|
|
178
|
+
brandingVersion: string;
|
|
179
|
+
|
|
180
|
+
branding: MedGenBranding;
|
|
181
|
+
capabilities: MedGenCapabilities;
|
|
182
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nihinmedia/medgen-react-native",
|
|
3
|
+
"version": "1.0.12",
|
|
4
|
+
"description": "MedGen Japan SDK for React Native",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"private": false,
|
|
7
|
+
"main": "lib/commonjs/index.js",
|
|
8
|
+
"module": "lib/module/index.js",
|
|
9
|
+
"types": "lib/typescript/index.d.ts",
|
|
10
|
+
"react-native": "lib/module/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"*.podspec",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"SECURITY.md",
|
|
19
|
+
"!**/__tests__",
|
|
20
|
+
"!**/.*"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "bob build && npm run strip-maps && npm run strip-comments",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
26
|
+
"test": "jest",
|
|
27
|
+
"prepack": "npm run build && node scripts/swap-readme.mjs to-npm",
|
|
28
|
+
"strip-maps": "find lib -name '*.map' -delete && find lib -type f \\( -name '*.js' -o -name '*.d.ts' \\) -exec perl -0777 -pi -e 's{\\n?^//# sourceMappingURL=.*$}{}mg' {} +",
|
|
29
|
+
"strip-comments": "node scripts/strip-comments.mjs",
|
|
30
|
+
"postpack": "node scripts/swap-readme.mjs restore"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"react-native",
|
|
34
|
+
"medgen",
|
|
35
|
+
"healthcare",
|
|
36
|
+
"sdk"
|
|
37
|
+
],
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@react-native-clipboard/clipboard": ">=1.11.0",
|
|
40
|
+
"react": ">=18.0.0",
|
|
41
|
+
"react-native": ">=0.71.0",
|
|
42
|
+
"react-native-blob-util": ">=0.19.0",
|
|
43
|
+
"react-native-html-to-pdf": ">=0.12.0 <1.0.0",
|
|
44
|
+
"react-native-share": ">=10.0.0",
|
|
45
|
+
"react-native-webview": ">=13.0.0"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"pdf-lib": "^1.17.1",
|
|
49
|
+
"react-native-keychain": "^8.2.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@react-native/babel-preset": "^0.73.21",
|
|
53
|
+
"@types/jest": "^29.5.12",
|
|
54
|
+
"@types/react": "^18.2.6",
|
|
55
|
+
"babel-jest": "^29.7.0",
|
|
56
|
+
"eslint": "^8.19.0",
|
|
57
|
+
"jest": "^29.7.0",
|
|
58
|
+
"react": "18.2.0",
|
|
59
|
+
"react-native": "0.73.6",
|
|
60
|
+
"react-native-builder-bob": "^0.23.2",
|
|
61
|
+
"react-native-webview": "^13.8.6",
|
|
62
|
+
"terser": "^5.31.0",
|
|
63
|
+
"typescript": "5.3.3"
|
|
64
|
+
},
|
|
65
|
+
"react-native-builder-bob": {
|
|
66
|
+
"source": "src",
|
|
67
|
+
"output": "lib",
|
|
68
|
+
"targets": [
|
|
69
|
+
[
|
|
70
|
+
"commonjs",
|
|
71
|
+
{
|
|
72
|
+
"sourceMaps": false
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
"module",
|
|
77
|
+
{
|
|
78
|
+
"sourceMaps": false
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
"typescript",
|
|
83
|
+
{
|
|
84
|
+
"project": "tsconfig.build.json"
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"publishConfig": {
|
|
90
|
+
"registry": "https://registry.npmjs.org/",
|
|
91
|
+
"access": "public"
|
|
92
|
+
},
|
|
93
|
+
"engines": {
|
|
94
|
+
"node": ">=18"
|
|
95
|
+
},
|
|
96
|
+
"bugs": {
|
|
97
|
+
"email": "contact@nihinmedia.jp"
|
|
98
|
+
},
|
|
99
|
+
"homepage": "https://nihinmedia.jp",
|
|
100
|
+
"author": "Nihin Media K. K. <contact@nihinmedia.jp>",
|
|
101
|
+
"sideEffects": false,
|
|
102
|
+
"peerDependenciesMeta": {
|
|
103
|
+
"react-native-share": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"react-native-blob-util": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"react-native-html-to-pdf": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"@react-native-clipboard/clipboard": {
|
|
113
|
+
"optional": true
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|