@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.
@@ -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 { useIMModuleInfo } from '../Tenant/hooks/useIMModuleInfo';
8
- import { HYBRID_SSO_KEY } from '../Tenant/modulesType';
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 { getModuleInfo } = useIMModuleInfo();
20
- const info = getModuleInfo();
21
- if (info && info[HYBRID_SSO_KEY]) {
22
- const hybridSSO = info[HYBRID_SSO_KEY];
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 { useIMFetchModuleState } from '../Tenant/hooks/useIMFetchModuleState';
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 fetchModuleState = useIMFetchModuleState();
10
- const { fetchModuleInfo } = useIMModuleInfo();
11
- if (fetchModuleState === 'notFetched' && initRef.current) {
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 fetchModuleInfo();
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 fetchModuleState;
24
+ return state;
25
25
  };
26
26
  export const IMWebView = React.forwardRef((props, ref) => {
27
27
  const moduleState = useInitModuleState(props.onSessionCreationError);
28
- return moduleState !== 'notFetched' ? (<InternalIMWebView ref={ref} {...props}/>) : (<>
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.1.1",
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,2 +0,0 @@
1
- import { Context as DefaultContext } from '../Context';
2
- export declare const useIMFetchModuleState: (Context?: typeof DefaultContext) => import("..").FetchModuleState;
@@ -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
- };