@intra-mart/smartlime 0.0.1-beta
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/.gitattributes +1 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/lib/_shared/renderTarget.d.ts +14 -0
- package/lib/_shared/renderTarget.js +31 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +18 -0
- package/lib/packages/Fetch/IMFecthError.d.ts +4 -0
- package/lib/packages/Fetch/IMFecthError.js +10 -0
- package/lib/packages/Fetch/index.d.ts +14 -0
- package/lib/packages/Fetch/index.js +112 -0
- package/lib/packages/Me/Context.d.ts +10 -0
- package/lib/packages/Me/Context.js +2 -0
- package/lib/packages/Me/IMMeError.d.ts +4 -0
- package/lib/packages/Me/IMMeError.js +10 -0
- package/lib/packages/Me/hooks/index.d.ts +2 -0
- package/lib/packages/Me/hooks/index.js +2 -0
- package/lib/packages/Me/hooks/useMe.d.ts +6 -0
- package/lib/packages/Me/hooks/useMe.js +11 -0
- package/lib/packages/Me/hooks/useMeState.d.ts +2 -0
- package/lib/packages/Me/hooks/useMeState.js +21 -0
- package/lib/packages/Me/index.d.ts +22 -0
- package/lib/packages/Me/index.js +55 -0
- package/lib/packages/Me/type.d.ts +85 -0
- package/lib/packages/Me/type.js +1 -0
- package/lib/packages/OAuth/Context.d.ts +14 -0
- package/lib/packages/OAuth/Context.js +2 -0
- package/lib/packages/OAuth/IMOAuthError.d.ts +4 -0
- package/lib/packages/OAuth/IMOAuthError.js +10 -0
- package/lib/packages/OAuth/hooks/index.d.ts +5 -0
- package/lib/packages/OAuth/hooks/index.js +5 -0
- package/lib/packages/OAuth/hooks/useAuthState.d.ts +2 -0
- package/lib/packages/OAuth/hooks/useAuthState.js +25 -0
- package/lib/packages/OAuth/hooks/useAuthStateEffect.d.ts +6 -0
- package/lib/packages/OAuth/hooks/useAuthStateEffect.js +14 -0
- package/lib/packages/OAuth/hooks/useIMOAuth.d.ts +7 -0
- package/lib/packages/OAuth/hooks/useIMOAuth.js +13 -0
- package/lib/packages/OAuth/hooks/useIMToken.d.ts +2 -0
- package/lib/packages/OAuth/hooks/useIMToken.js +21 -0
- package/lib/packages/OAuth/hooks/useStartAuth.d.ts +2 -0
- package/lib/packages/OAuth/hooks/useStartAuth.js +12 -0
- package/lib/packages/OAuth/index.d.ts +39 -0
- package/lib/packages/OAuth/index.js +299 -0
- package/lib/packages/Search/Context.d.ts +6 -0
- package/lib/packages/Search/Context.js +2 -0
- package/lib/packages/Search/IMSearchError.d.ts +4 -0
- package/lib/packages/Search/IMSearchError.js +10 -0
- package/lib/packages/Search/hooks/index.d.ts +11 -0
- package/lib/packages/Search/hooks/index.js +11 -0
- package/lib/packages/Search/hooks/useDepartmentPostSearch.d.ts +2 -0
- package/lib/packages/Search/hooks/useDepartmentPostSearch.js +48 -0
- package/lib/packages/Search/hooks/useDepartmentSerch.d.ts +2 -0
- package/lib/packages/Search/hooks/useDepartmentSerch.js +56 -0
- package/lib/packages/Search/hooks/useDepartmentTopSerch.d.ts +2 -0
- package/lib/packages/Search/hooks/useDepartmentTopSerch.js +47 -0
- package/lib/packages/Search/hooks/useIMSearch.d.ts +4 -0
- package/lib/packages/Search/hooks/useIMSearch.js +11 -0
- package/lib/packages/Search/hooks/usePostSerch.d.ts +2 -0
- package/lib/packages/Search/hooks/usePostSerch.js +48 -0
- package/lib/packages/Search/hooks/usePublicGroupRoleSerch.d.ts +2 -0
- package/lib/packages/Search/hooks/usePublicGroupRoleSerch.js +50 -0
- package/lib/packages/Search/hooks/usePublicGroupSerch.d.ts +2 -0
- package/lib/packages/Search/hooks/usePublicGroupSerch.js +56 -0
- package/lib/packages/Search/hooks/usePublicGroupTopSerch.d.ts +2 -0
- package/lib/packages/Search/hooks/usePublicGroupTopSerch.js +47 -0
- package/lib/packages/Search/hooks/useRoleSerch.d.ts +2 -0
- package/lib/packages/Search/hooks/useRoleSerch.js +50 -0
- package/lib/packages/Search/hooks/useUserAdditionalInformationSearch.d.ts +2 -0
- package/lib/packages/Search/hooks/useUserAdditionalInformationSearch.js +50 -0
- package/lib/packages/Search/hooks/useUserSerch.d.ts +2 -0
- package/lib/packages/Search/hooks/useUserSerch.js +68 -0
- package/lib/packages/Search/hooks/utils.d.ts +4 -0
- package/lib/packages/Search/hooks/utils.js +25 -0
- package/lib/packages/Search/index.d.ts +49 -0
- package/lib/packages/Search/index.js +72 -0
- package/lib/packages/Search/types.d.ts +208 -0
- package/lib/packages/Search/types.js +1 -0
- package/lib/packages/Session/Context.d.ts +16 -0
- package/lib/packages/Session/Context.js +2 -0
- package/lib/packages/Session/IMSessionError.d.ts +4 -0
- package/lib/packages/Session/IMSessionError.js +10 -0
- package/lib/packages/Session/hooks/index.d.ts +2 -0
- package/lib/packages/Session/hooks/index.js +2 -0
- package/lib/packages/Session/hooks/useSession.d.ts +12 -0
- package/lib/packages/Session/hooks/useSession.js +11 -0
- package/lib/packages/Session/hooks/useSessionState.d.ts +4 -0
- package/lib/packages/Session/hooks/useSessionState.js +24 -0
- package/lib/packages/Session/index.d.ts +16 -0
- package/lib/packages/Session/index.js +164 -0
- package/lib/packages/Session/type.d.ts +5 -0
- package/lib/packages/Session/type.js +1 -0
- package/lib/packages/Session/utils.d.ts +2 -0
- package/lib/packages/Session/utils.js +6 -0
- package/lib/packages/Smartlime/NotSearchPropError.d.ts +2 -0
- package/lib/packages/Smartlime/NotSearchPropError.js +13 -0
- package/lib/packages/Smartlime/index.d.ts +19 -0
- package/lib/packages/Smartlime/index.js +23 -0
- package/lib/packages/Tenant/Context.d.ts +6 -0
- package/lib/packages/Tenant/Context.js +2 -0
- package/lib/packages/Tenant/IMTenantError.d.ts +4 -0
- package/lib/packages/Tenant/IMTenantError.js +10 -0
- package/lib/packages/Tenant/hooks/index.d.ts +1 -0
- package/lib/packages/Tenant/hooks/index.js +1 -0
- package/lib/packages/Tenant/hooks/useIMBaseUrl.d.ts +2 -0
- package/lib/packages/Tenant/hooks/useIMBaseUrl.js +10 -0
- package/lib/packages/Tenant/index.d.ts +10 -0
- package/lib/packages/Tenant/index.js +19 -0
- package/lib/packages/WebView/IMWebViewError.d.ts +4 -0
- package/lib/packages/WebView/IMWebViewError.js +10 -0
- package/lib/packages/WebView/hooks/index.d.ts +1 -0
- package/lib/packages/WebView/hooks/index.js +1 -0
- package/lib/packages/WebView/hooks/useHackSearchUI.d.ts +8 -0
- package/lib/packages/WebView/hooks/useHackSearchUI.js +49 -0
- package/lib/packages/WebView/index.d.ts +11 -0
- package/lib/packages/WebView/index.js +166 -0
- package/lib/utils/mergeRef.d.ts +1 -0
- package/lib/utils/mergeRef.js +14 -0
- package/lib/utils/path.d.ts +1 -0
- package/lib/utils/path.js +16 -0
- package/package.json +87 -0
- package/tsconfig.json +36 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const errorType = 'IMWebViewError';
|
|
2
|
+
export class IMWebViewError extends Error {
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
if (Error.captureStackTrace) {
|
|
6
|
+
Error.captureStackTrace(this, IMWebViewError);
|
|
7
|
+
}
|
|
8
|
+
this.name = errorType;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useHackSearchUI';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useHackSearchUI';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import WebView, { WebViewMessageEvent } from 'react-native-webview';
|
|
2
|
+
type ErrorCallBack = (error: unknown) => void;
|
|
3
|
+
export declare const useHackSearchUI: (errorCallBack?: ErrorCallBack) => {
|
|
4
|
+
ref: import("react").RefObject<WebView<{}>>;
|
|
5
|
+
injectedJavaScriptBeforeContentLoaded: string;
|
|
6
|
+
onMessage: (event: WebViewMessageEvent) => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { useIMSearch } from '../../Search/hooks';
|
|
3
|
+
const checkIapSearchMessage = (data) => {
|
|
4
|
+
return data.__SMARTLIME_ACM_SEARCH === true;
|
|
5
|
+
};
|
|
6
|
+
const messageParse = (data) => {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(data);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// parse is performed to determine if the message is a SearchMessage only so an empty object is returned if parse fails.
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const injectedJavaScriptBeforeContentLoaded = `
|
|
16
|
+
window.__SMARTLIME = true;
|
|
17
|
+
true;
|
|
18
|
+
`;
|
|
19
|
+
export const useHackSearchUI = (errorCallBack) => {
|
|
20
|
+
const ref = useRef(null);
|
|
21
|
+
const { startSearch } = useIMSearch();
|
|
22
|
+
const onMessage = useCallback(async (event) => {
|
|
23
|
+
const data = messageParse(event.nativeEvent.data);
|
|
24
|
+
if (checkIapSearchMessage(data)) {
|
|
25
|
+
const dialogId = data.dialogId;
|
|
26
|
+
const target = data.param.target;
|
|
27
|
+
const type = data.param.type;
|
|
28
|
+
const paramString = data.paramString;
|
|
29
|
+
try {
|
|
30
|
+
const result = await startSearch({ target, type, paramString });
|
|
31
|
+
if (result.type === 'success') {
|
|
32
|
+
ref.current?.postMessage(JSON.stringify({ dialogId, ...result }));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
if (errorCallBack) {
|
|
36
|
+
errorCallBack(result);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
if (errorCallBack)
|
|
42
|
+
errorCallBack(e);
|
|
43
|
+
else
|
|
44
|
+
console.error('failed to execute search process.');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, [errorCallBack]);
|
|
48
|
+
return { ref, injectedJavaScriptBeforeContentLoaded, onMessage };
|
|
49
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WebView, WebViewProps } from 'react-native-webview';
|
|
3
|
+
import { WebViewSourceUri } from 'react-native-webview/lib/WebViewTypes';
|
|
4
|
+
import { IMWebViewError } from './IMWebViewError';
|
|
5
|
+
export type OnSessionCreationError = (error: IMWebViewError) => void;
|
|
6
|
+
export interface IMWebViewProps extends Omit<WebViewProps, 'onShouldStartLoadWithRequest'> {
|
|
7
|
+
source: WebViewSourceUri;
|
|
8
|
+
onSessionCreationError?: OnSessionCreationError;
|
|
9
|
+
indicator?: JSX.Element | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const IMWebView: React.ForwardRefExoticComponent<IMWebViewProps & React.RefAttributes<WebView<{}>>>;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { ActivityIndicator, StyleSheet } from 'react-native';
|
|
3
|
+
import { WebView } from 'react-native-webview';
|
|
4
|
+
import { useIMBaseUrl, useIMToken } from '../..';
|
|
5
|
+
import { mergeRef } from '../../utils/mergeRef';
|
|
6
|
+
import { join } from '../../utils/path';
|
|
7
|
+
import { IMWebViewError } from './IMWebViewError';
|
|
8
|
+
const IMAUTOLOGIN_SUCCESS = 'IMAUTOLOGIN_SUCCESS';
|
|
9
|
+
const IMAUTOLOGIN_ERROR = 'IMAUTOLOGIN_ERROR';
|
|
10
|
+
const useCheckSessionUrl = (baseUrl) => {
|
|
11
|
+
return join(baseUrl, '/api/smacolow/session');
|
|
12
|
+
};
|
|
13
|
+
const useGetSessionUrl = (baseUrl) => {
|
|
14
|
+
return join(baseUrl, '/api/bearer/smacolow/session');
|
|
15
|
+
};
|
|
16
|
+
const usLogoutUrl = (baseUrl) => {
|
|
17
|
+
return join(baseUrl, '/logout');
|
|
18
|
+
};
|
|
19
|
+
const useLogin = (props, webviewRef) => {
|
|
20
|
+
const baseUrl = useIMBaseUrl();
|
|
21
|
+
const token = useIMToken();
|
|
22
|
+
const targetUrl = props.source.uri;
|
|
23
|
+
const checkSessionUrl = useCheckSessionUrl(baseUrl);
|
|
24
|
+
const getSessionUrl = useGetSessionUrl(baseUrl);
|
|
25
|
+
const logoutUrl = usLogoutUrl(baseUrl);
|
|
26
|
+
const currentUrlRef = useRef(checkSessionUrl);
|
|
27
|
+
const isCheckSessionErrorRef = useRef(false);
|
|
28
|
+
const [isFailedLogin, setIsFailedLogin] = useState(false);
|
|
29
|
+
const [isLogin, setIsLogin] = useState(false);
|
|
30
|
+
const [isTargetUrl, setIsTargetUrl] = useState(false);
|
|
31
|
+
const onHttpError = (event) => {
|
|
32
|
+
if (currentUrlRef.current === checkSessionUrl &&
|
|
33
|
+
event.nativeEvent.statusCode === 401) {
|
|
34
|
+
isCheckSessionErrorRef.current = true;
|
|
35
|
+
}
|
|
36
|
+
else if (currentUrlRef.current === targetUrl) {
|
|
37
|
+
if (props.onHttpError)
|
|
38
|
+
props.onHttpError(event);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
setIsFailedLogin(true);
|
|
42
|
+
if (props.onSessionCreationError) {
|
|
43
|
+
props.onSessionCreationError(new IMWebViewError('http error occurred during auto login.'));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const onShouldStartLoadWithRequest = (request) => {
|
|
48
|
+
if (isLogin || isTargetUrl)
|
|
49
|
+
return true;
|
|
50
|
+
if (currentUrlRef.current === checkSessionUrl) {
|
|
51
|
+
if (request.url === logoutUrl || request.url === checkSessionUrl)
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (currentUrlRef.current === logoutUrl) {
|
|
55
|
+
if (request.url === targetUrl || request.url === logoutUrl)
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (currentUrlRef.current === targetUrl) {
|
|
59
|
+
if (request.url === targetUrl)
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
};
|
|
64
|
+
const onLoad = (event) => {
|
|
65
|
+
if (isLogin || isFailedLogin)
|
|
66
|
+
return;
|
|
67
|
+
if ((isCheckSessionErrorRef.current === false &&
|
|
68
|
+
currentUrlRef.current === checkSessionUrl) ||
|
|
69
|
+
currentUrlRef.current === getSessionUrl) {
|
|
70
|
+
setIsTargetUrl(true);
|
|
71
|
+
currentUrlRef.current = targetUrl;
|
|
72
|
+
webviewRef.current?.injectJavaScript(`
|
|
73
|
+
location.replace('${targetUrl}');
|
|
74
|
+
true;
|
|
75
|
+
`);
|
|
76
|
+
}
|
|
77
|
+
else if (isCheckSessionErrorRef.current === true &&
|
|
78
|
+
checkSessionUrl === currentUrlRef.current) {
|
|
79
|
+
currentUrlRef.current = logoutUrl;
|
|
80
|
+
webviewRef.current?.injectJavaScript(`
|
|
81
|
+
location.replace('${logoutUrl}');
|
|
82
|
+
true;
|
|
83
|
+
`);
|
|
84
|
+
}
|
|
85
|
+
else if (currentUrlRef.current === logoutUrl) {
|
|
86
|
+
webviewRef.current?.injectJavaScript(`
|
|
87
|
+
fetch('${getSessionUrl}', {
|
|
88
|
+
headers: {
|
|
89
|
+
'X-Intramart-Session': 'keep',
|
|
90
|
+
Authorization: 'Bearer ${token}',
|
|
91
|
+
},
|
|
92
|
+
}).then((state) => {
|
|
93
|
+
if(state.status === 200) window.ReactNativeWebView.postMessage('${IMAUTOLOGIN_SUCCESS}');
|
|
94
|
+
else window.ReactNativeWebView.postMessage('${IMAUTOLOGIN_ERROR}');
|
|
95
|
+
}).catch(() => {
|
|
96
|
+
window.ReactNativeWebView.postMessage('${IMAUTOLOGIN_ERROR}');
|
|
97
|
+
});
|
|
98
|
+
true;
|
|
99
|
+
`);
|
|
100
|
+
}
|
|
101
|
+
else if (currentUrlRef.current === targetUrl && !isLogin) {
|
|
102
|
+
setIsLogin(true);
|
|
103
|
+
if (props.onLoad)
|
|
104
|
+
props.onLoad(event);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const onMessage = (event) => {
|
|
108
|
+
if (currentUrlRef.current === targetUrl && props.onMessage)
|
|
109
|
+
props.onMessage(event);
|
|
110
|
+
if (event.nativeEvent.data === IMAUTOLOGIN_SUCCESS) {
|
|
111
|
+
setIsTargetUrl(true);
|
|
112
|
+
currentUrlRef.current = targetUrl;
|
|
113
|
+
webviewRef.current?.injectJavaScript(`
|
|
114
|
+
location.replace('${targetUrl}');
|
|
115
|
+
`);
|
|
116
|
+
}
|
|
117
|
+
if (event.nativeEvent.data === IMAUTOLOGIN_ERROR) {
|
|
118
|
+
setIsFailedLogin(true);
|
|
119
|
+
if (props.onSessionCreationError) {
|
|
120
|
+
props.onSessionCreationError(new IMWebViewError('http error occurred during auto login.'));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const autoLoginProps = {
|
|
125
|
+
source: {
|
|
126
|
+
uri: checkSessionUrl,
|
|
127
|
+
},
|
|
128
|
+
sharedCookiesEnabled: false,
|
|
129
|
+
onLoad,
|
|
130
|
+
onHttpError,
|
|
131
|
+
onMessage,
|
|
132
|
+
onShouldStartLoadWithRequest,
|
|
133
|
+
};
|
|
134
|
+
const webviewProps = isLogin
|
|
135
|
+
? props
|
|
136
|
+
: isTargetUrl
|
|
137
|
+
? { ...props, ...autoLoginProps }
|
|
138
|
+
: autoLoginProps;
|
|
139
|
+
return {
|
|
140
|
+
isLogin,
|
|
141
|
+
isFailedLogin,
|
|
142
|
+
webviewProps,
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
export const IMWebView = React.forwardRef((props, ref) => {
|
|
146
|
+
const webviewRef = useRef(null);
|
|
147
|
+
const margedRef = mergeRef(ref, webviewRef);
|
|
148
|
+
const { isLogin, isFailedLogin, webviewProps } = useLogin(props, webviewRef);
|
|
149
|
+
const indicator = isLogin && !isFailedLogin ? null : props.indicator !== void 0 ? (props.indicator) : (<ActivityIndicator style={styles.indicator}/>);
|
|
150
|
+
return (<>
|
|
151
|
+
<WebView ref={margedRef} {...webviewProps}/>
|
|
152
|
+
{indicator}
|
|
153
|
+
</>);
|
|
154
|
+
});
|
|
155
|
+
const styles = StyleSheet.create({
|
|
156
|
+
indicator: {
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
left: 0,
|
|
159
|
+
right: 0,
|
|
160
|
+
top: 0,
|
|
161
|
+
bottom: 0,
|
|
162
|
+
alignItems: 'center',
|
|
163
|
+
justifyContent: 'center',
|
|
164
|
+
backgroundColor: 'gray',
|
|
165
|
+
},
|
|
166
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mergeRef: <T>(...refs: (string | import("react").MutableRefObject<T> | ((instance: T | null) => void) | import("react").MutableRefObject<T | null> | ((instance: T | null) => void) | import("react").RefObject<T> | null)[]) => (instance: T | null) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const mergeRef = (...refs) => {
|
|
2
|
+
const refCallback = (instance) => {
|
|
3
|
+
for (let i = 0; i < refs.length; i++) {
|
|
4
|
+
const ref = refs[i];
|
|
5
|
+
if (typeof ref === 'function') {
|
|
6
|
+
ref(instance);
|
|
7
|
+
}
|
|
8
|
+
else if (ref != null) {
|
|
9
|
+
ref.current = instance;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return refCallback;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const join: (...args: string[]) => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// NOTE:
|
|
2
|
+
// 下記のようなpackageの採用が正しいが現状必要なのがシンプルな結合だけなので暫定の実装で様子見
|
|
3
|
+
// https://www.npmjs.com/package/path
|
|
4
|
+
// https://www.npmjs.com/package/react-native-url-polyfill
|
|
5
|
+
// 必要が出てきたら再検討
|
|
6
|
+
export const join = (...args) => {
|
|
7
|
+
return args.reduce((prev, current) => {
|
|
8
|
+
if (prev === '')
|
|
9
|
+
return current;
|
|
10
|
+
if (prev.endsWith('/') && current.startsWith('/'))
|
|
11
|
+
return `${prev}${current.slice(1)}`;
|
|
12
|
+
if (!prev.endsWith('/') && !current.startsWith('/'))
|
|
13
|
+
return `${prev}/${current}`;
|
|
14
|
+
return `${prev}${current}`;
|
|
15
|
+
}, '');
|
|
16
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intra-mart/smartlime",
|
|
3
|
+
"description": "expoで使用できるintra mart accelplatform SDK",
|
|
4
|
+
"version": "0.0.1-beta",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"intra-mart",
|
|
7
|
+
"AccelPlatform",
|
|
8
|
+
"iAP",
|
|
9
|
+
"react",
|
|
10
|
+
"react-native",
|
|
11
|
+
"expo"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/accelplatform/smartlime.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/accelplatform/smartlime/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "http://oss.intra-mart.org",
|
|
25
|
+
"author": "NTT DATA INTRAMART",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"default": "./lib/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"main": "lib/index.js",
|
|
33
|
+
"types": "lib/index.d.ts",
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc",
|
|
36
|
+
"build-watch": "tsc --watch",
|
|
37
|
+
"lint": "eslint ./src/**/*.{ts,tsx}",
|
|
38
|
+
"lint-fix": "eslint --fix ./src/**/*.{ts,tsx} && prettier --write ./src/**/*.{ts,tsx}",
|
|
39
|
+
"test": "jest",
|
|
40
|
+
"test-watch": "jest --watch --coverage=false --changedSince=origin/main",
|
|
41
|
+
"emit-declaration": "tsc --emitDeclarationOnly",
|
|
42
|
+
"type": "tsc --noEmit"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"expo": "^47.0.13",
|
|
46
|
+
"react": "18.1.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@react-native-async-storage/async-storage": "~1.17.11",
|
|
50
|
+
"expo-auth-session": "~3.8.0",
|
|
51
|
+
"expo-crypto": "~12.0.0",
|
|
52
|
+
"expo-random": "~13.0.0",
|
|
53
|
+
"react-native-webview": "11.23.1",
|
|
54
|
+
"set-cookie-parser": "^2.5.1"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@babel/core": "^7.20.12",
|
|
58
|
+
"@babel/preset-env": "^7.20.2",
|
|
59
|
+
"@types/jest": "^27.5.2",
|
|
60
|
+
"@types/react": "~18.0.27",
|
|
61
|
+
"@types/react-native": "~0.70.6",
|
|
62
|
+
"@types/react-test-renderer": "18.0.0",
|
|
63
|
+
"@types/set-cookie-parser": "^2.4.2",
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
|
65
|
+
"@typescript-eslint/parser": "^5.51.0",
|
|
66
|
+
"eslint": "^8.33.0",
|
|
67
|
+
"eslint-config-prettier": "^8.6.0",
|
|
68
|
+
"eslint-plugin-react": "^7.32.2",
|
|
69
|
+
"expo": "^47.0.13",
|
|
70
|
+
"jest": "^27.5.1",
|
|
71
|
+
"jest-expo": "^47.0.1",
|
|
72
|
+
"prettier": "^2.8.3",
|
|
73
|
+
"react": "18.1.0",
|
|
74
|
+
"react-dom": "18.1.0",
|
|
75
|
+
"react-native": "0.70.5",
|
|
76
|
+
"react-test-renderer": "18.1.0",
|
|
77
|
+
"ts-jest": "^27.1.5",
|
|
78
|
+
"typescript": "^4.9.5"
|
|
79
|
+
},
|
|
80
|
+
"resolutions": {
|
|
81
|
+
"@types/react": "^18.0.24"
|
|
82
|
+
},
|
|
83
|
+
"packageManager": "yarn@1.22.10",
|
|
84
|
+
"engines": {
|
|
85
|
+
"node": ">= 16.9.0"
|
|
86
|
+
}
|
|
87
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-native",
|
|
4
|
+
"lib": ["dom", "esnext"],
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"module": "esnext",
|
|
7
|
+
"target": "esnext",
|
|
8
|
+
"outDir": "./lib",
|
|
9
|
+
"declarationDir": "./lib",
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"noEmitOnError": true,
|
|
12
|
+
"removeComments": false,
|
|
13
|
+
|
|
14
|
+
"allowJs": false,
|
|
15
|
+
"checkJs": false,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"allowSyntheticDefaultImports": true,
|
|
18
|
+
"forceConsistentCasingInFileNames": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"resolveJsonModule": true,
|
|
22
|
+
"strict": true,
|
|
23
|
+
"noImplicitAny": true,
|
|
24
|
+
"strictNullChecks": true,
|
|
25
|
+
"noImplicitThis": true,
|
|
26
|
+
"alwaysStrict": true,
|
|
27
|
+
"noUnusedLocals": true,
|
|
28
|
+
"noUnusedParameters": true,
|
|
29
|
+
"noImplicitReturns": true,
|
|
30
|
+
"noFallthroughCasesInSwitch": true,
|
|
31
|
+
"noUncheckedIndexedAccess": true
|
|
32
|
+
},
|
|
33
|
+
"include": ["src", "test", "**/*.test.ts", "**/*.test.tsx"],
|
|
34
|
+
"exclude": ["node_modules"],
|
|
35
|
+
"newLine": "CRLF"
|
|
36
|
+
}
|