@intra-mart/smartlime 2.3.0 → 2.4.0-dev.20251020
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.
|
@@ -9,6 +9,13 @@ 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';
|
|
12
|
+
// props that are applied during initialization and cannot be changed dynamically
|
|
13
|
+
const IMIMMUTABLE_PROPS = [
|
|
14
|
+
'allowsInlineMediaPlayback',
|
|
15
|
+
'allowsPictureInPictureMediaPlayback',
|
|
16
|
+
'mediaPlaybackRequiresUserAction',
|
|
17
|
+
'dataDetectorTypes',
|
|
18
|
+
];
|
|
12
19
|
const useCheckSessionUrl = (baseUrl) => {
|
|
13
20
|
return join(baseUrl, '/api/smacolow/session');
|
|
14
21
|
};
|
|
@@ -41,6 +48,16 @@ fetch('${sessionEstablishmentUrl}', {
|
|
|
41
48
|
true;
|
|
42
49
|
`;
|
|
43
50
|
};
|
|
51
|
+
const useImmutableProps = (props) => {
|
|
52
|
+
const [immutableProps] = useState(IMIMMUTABLE_PROPS.reduce((acc, key) => {
|
|
53
|
+
const value = props[key];
|
|
54
|
+
if (value !== void 0) {
|
|
55
|
+
return { ...acc, [key]: value };
|
|
56
|
+
}
|
|
57
|
+
return acc;
|
|
58
|
+
}, {}));
|
|
59
|
+
return immutableProps;
|
|
60
|
+
};
|
|
44
61
|
const useLogin = (props, webviewRef) => {
|
|
45
62
|
const baseUrl = useIMBaseUrl();
|
|
46
63
|
const token = useIMToken();
|
|
@@ -55,6 +72,7 @@ const useLogin = (props, webviewRef) => {
|
|
|
55
72
|
const [isLogin, setIsLogin] = useState(false);
|
|
56
73
|
const [isTargetUrl, setIsTargetUrl] = useState(false);
|
|
57
74
|
const sessionEstablishmentScript = useSessionEstablishmentScript(sessionEstablishmentUrl, token);
|
|
75
|
+
const propsImmutablePart = useImmutableProps(props);
|
|
58
76
|
const onHttpError = (event) => {
|
|
59
77
|
if (currentUrlRef.current === checkSessionUrl &&
|
|
60
78
|
event.nativeEvent.statusCode === 401) {
|
|
@@ -169,11 +187,14 @@ const useLogin = (props, webviewRef) => {
|
|
|
169
187
|
onHttpError,
|
|
170
188
|
onMessage,
|
|
171
189
|
onShouldStartLoadWithRequest,
|
|
190
|
+
...propsImmutablePart,
|
|
172
191
|
};
|
|
192
|
+
const targetUrlProps = { ...props, ...autoLoginProps };
|
|
193
|
+
const loginedWebviewProps = { ...props, ...propsImmutablePart };
|
|
173
194
|
const webviewProps = isLogin
|
|
174
|
-
?
|
|
195
|
+
? loginedWebviewProps
|
|
175
196
|
: isTargetUrl
|
|
176
|
-
?
|
|
197
|
+
? targetUrlProps
|
|
177
198
|
: autoLoginProps;
|
|
178
199
|
return {
|
|
179
200
|
isLogin,
|
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.4.0-dev.20251020",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intra-mart",
|
|
7
7
|
"AccelPlatform",
|
|
@@ -80,4 +80,3 @@
|
|
|
80
80
|
"node": ">= 22.0.0"
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
|