@intra-mart/smartlime 2.1.1 → 2.2.0-dev.20250408
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/lib/packages/Me/type.d.ts +1 -0
- package/lib/packages/Session/index.js +24 -23
- package/lib/packages/Tenant/Context.d.ts +13 -5
- package/lib/packages/Tenant/constants.d.ts +2 -0
- package/lib/packages/Tenant/constants.js +4 -0
- package/lib/packages/Tenant/hooks/index.d.ts +2 -2
- package/lib/packages/Tenant/hooks/index.js +2 -2
- package/lib/packages/Tenant/hooks/useIMModules.d.ts +6 -0
- package/lib/packages/Tenant/hooks/useIMModules.js +73 -0
- package/lib/packages/Tenant/hooks/useIMModulesState.d.ts +2 -0
- package/lib/packages/Tenant/hooks/{useIMFetchModuleState.js → useIMModulesState.js} +3 -4
- package/lib/packages/Tenant/index.d.ts +3 -15
- package/lib/packages/Tenant/index.js +13 -80
- package/lib/packages/Tenant/modulesType.d.ts +1522 -2
- package/lib/packages/Tenant/modulesType.js +1522 -2
- package/lib/packages/WebView/InternalIMWebView.js +6 -6
- package/lib/packages/WebView/index.js +8 -8
- package/package.json +1 -2
- package/lib/packages/Tenant/hooks/useIMFetchModuleState.d.ts +0 -2
- package/lib/packages/Tenant/hooks/useIMModuleInfo.d.ts +0 -6
- package/lib/packages/Tenant/hooks/useIMModuleInfo.js +0 -13
|
@@ -4,8 +4,8 @@ import { WebView } from 'react-native-webview';
|
|
|
4
4
|
import { useIMBaseUrl, useIMToken } from '../..';
|
|
5
5
|
import { mergeRef } from '../../utils/mergeRef';
|
|
6
6
|
import { join } from '../../utils/path';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useIMModules } from '../Tenant/hooks/useIMModules';
|
|
8
|
+
import { IM_HYBRID_SSO_KEY } from '../Tenant/modulesType';
|
|
9
9
|
import { IMWebViewError } from './IMWebViewError';
|
|
10
10
|
const IMAUTOLOGIN_SUCCESS = 'IMAUTOLOGIN_SUCCESS';
|
|
11
11
|
const IMAUTOLOGIN_ERROR = 'IMAUTOLOGIN_ERROR';
|
|
@@ -16,10 +16,10 @@ const useSessionEstablishmentUrl = (baseUrl) => {
|
|
|
16
16
|
return join(baseUrl, '/api/bearer/smacolow/session');
|
|
17
17
|
};
|
|
18
18
|
const useLogoutUrl = (baseUrl) => {
|
|
19
|
-
const {
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
const hybridSSO =
|
|
19
|
+
const { getModules } = useIMModules();
|
|
20
|
+
const modules = getModules();
|
|
21
|
+
if (modules && modules[IM_HYBRID_SSO_KEY]) {
|
|
22
|
+
const hybridSSO = modules[IM_HYBRID_SSO_KEY];
|
|
23
23
|
if (hybridSSO.enabled)
|
|
24
24
|
return join(baseUrl, '/login');
|
|
25
25
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { ActivityIndicator, View } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
import { useIMModuleInfo } from '../Tenant/hooks/useIMModuleInfo';
|
|
3
|
+
import { useIMModules } from '../Tenant/hooks/useIMModules';
|
|
5
4
|
import { IMWebViewError } from './IMWebViewError';
|
|
6
5
|
import { InternalIMWebView, internalIMWebViewStyles, } from './InternalIMWebView';
|
|
6
|
+
import { useIMModulesState } from '../Tenant/hooks/useIMModulesState';
|
|
7
7
|
const useInitModuleState = (onSessionCreationError) => {
|
|
8
8
|
const initRef = useRef(true);
|
|
9
|
-
const
|
|
10
|
-
const {
|
|
11
|
-
if (
|
|
9
|
+
const state = useIMModulesState();
|
|
10
|
+
const { request } = useIMModules();
|
|
11
|
+
if (!state && initRef.current) {
|
|
12
12
|
initRef.current = false;
|
|
13
13
|
(async () => {
|
|
14
14
|
try {
|
|
15
|
-
await
|
|
15
|
+
await request();
|
|
16
16
|
}
|
|
17
17
|
catch (error) {
|
|
18
18
|
onSessionCreationError?.(new IMWebViewError('failed to fetch module status.', {
|
|
@@ -21,11 +21,11 @@ const useInitModuleState = (onSessionCreationError) => {
|
|
|
21
21
|
}
|
|
22
22
|
})();
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return state;
|
|
25
25
|
};
|
|
26
26
|
export const IMWebView = React.forwardRef((props, ref) => {
|
|
27
27
|
const moduleState = useInitModuleState(props.onSessionCreationError);
|
|
28
|
-
return moduleState
|
|
28
|
+
return moduleState ? (<InternalIMWebView ref={ref} {...props}/>) : (<>
|
|
29
29
|
<View style={props.style}/>
|
|
30
30
|
<ActivityIndicator style={internalIMWebViewStyles.indicator}/>
|
|
31
31
|
</>);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intra-mart/smartlime",
|
|
3
3
|
"description": "expoで使用できるintra mart accelplatform SDK",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0-dev.20250408",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intra-mart",
|
|
7
7
|
"AccelPlatform",
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"@react-native-async-storage/async-storage": "1.23.1",
|
|
50
50
|
"expo-auth-session": "~6.0.1",
|
|
51
51
|
"expo-crypto": "~14.0.1",
|
|
52
|
-
"expo-random": "~14.0.1",
|
|
53
52
|
"expo-secure-store": "~14.0.0",
|
|
54
53
|
"react-native-webview": "13.12.5",
|
|
55
54
|
"set-cookie-parser": "^2.7.1"
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Context as DefaultContext } from '../Context';
|
|
2
|
-
export declare const useIMModuleInfo: (Context?: typeof DefaultContext) => {
|
|
3
|
-
fetchModuleInfo: () => Promise<void>;
|
|
4
|
-
getModuleInfo: () => import("..").Moudles | undefined;
|
|
5
|
-
destroyModuleInfo: () => Promise<void>;
|
|
6
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo } from 'react';
|
|
2
|
-
import { Context as DefaultContext } from '../Context';
|
|
3
|
-
import { IMTenantError } from '../IMTenantError';
|
|
4
|
-
export const useIMModuleInfo = (Context) => {
|
|
5
|
-
const tenantContext = useContext(Context || DefaultContext);
|
|
6
|
-
if (tenantContext == null) {
|
|
7
|
-
throw new IMTenantError('useIMModuleInfo requires either a Context provide or an ancestor element with a IMTenantProvider.');
|
|
8
|
-
}
|
|
9
|
-
return useMemo(() => {
|
|
10
|
-
const { fetchModuleInfo, getModuleInfo, destroyModuleInfo } = tenantContext;
|
|
11
|
-
return { fetchModuleInfo, getModuleInfo, destroyModuleInfo };
|
|
12
|
-
}, [tenantContext]);
|
|
13
|
-
};
|