@trustchex/react-native-sdk 1.248.0 → 1.250.0
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/module/Trustchex.js
CHANGED
|
@@ -35,6 +35,7 @@ const Trustchex = ({
|
|
|
35
35
|
const [baseUrl, setBaseUrl] = useState(null);
|
|
36
36
|
const [sessionId, setSessionId] = useState(null);
|
|
37
37
|
const [locale, setLocale] = useState(propLocale || i18n.language);
|
|
38
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
38
39
|
const branding = useMemo(() => ({
|
|
39
40
|
...DEFAULT_BRANDING,
|
|
40
41
|
...propBranding
|
|
@@ -68,23 +69,25 @@ const Trustchex = ({
|
|
|
68
69
|
useEffect(() => {
|
|
69
70
|
initializeTTS();
|
|
70
71
|
}, []);
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
if (propBaseUrl) {
|
|
73
|
-
setBaseUrl(propBaseUrl);
|
|
74
|
-
}
|
|
75
|
-
}, [propBaseUrl]);
|
|
76
72
|
useEffect(() => {
|
|
77
73
|
if (propSessionId) {
|
|
78
74
|
setSessionId(propSessionId);
|
|
79
75
|
}
|
|
80
|
-
|
|
76
|
+
if (propBaseUrl) {
|
|
77
|
+
setBaseUrl(propBaseUrl);
|
|
78
|
+
const timer = setTimeout(() => {
|
|
79
|
+
setIsInitialized(true);
|
|
80
|
+
}, 1000);
|
|
81
|
+
return () => clearTimeout(timer);
|
|
82
|
+
}
|
|
83
|
+
}, [propBaseUrl, propSessionId]);
|
|
81
84
|
useEffect(() => {
|
|
82
85
|
if (propLocale) {
|
|
83
86
|
setLocale(propLocale);
|
|
84
87
|
i18n.changeLanguage(propLocale);
|
|
85
88
|
}
|
|
86
89
|
}, [propLocale]);
|
|
87
|
-
if (!baseUrl) {
|
|
90
|
+
if (!baseUrl || !isInitialized) {
|
|
88
91
|
return /*#__PURE__*/_jsx(View, {
|
|
89
92
|
style: styles.loadingContainer,
|
|
90
93
|
children: /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trustchex.d.ts","sourceRoot":"","sources":["../../../src/Trustchex.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,gCAAgC,CAAC;AAexC,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AASD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"Trustchex.d.ts","sourceRoot":"","sources":["../../../src/Trustchex.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,gCAAgC,CAAC;AAexC,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AASD,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAmIvC,CAAC;AAWF,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
package/src/Trustchex.tsx
CHANGED
|
@@ -52,6 +52,7 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
52
52
|
const [baseUrl, setBaseUrl] = useState<string | null>(null);
|
|
53
53
|
const [sessionId, setSessionId] = useState<string | null>(null);
|
|
54
54
|
const [locale, setLocale] = useState(propLocale || i18n.language);
|
|
55
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
55
56
|
|
|
56
57
|
const branding = useMemo(
|
|
57
58
|
() => ({
|
|
@@ -100,16 +101,19 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
100
101
|
}, []);
|
|
101
102
|
|
|
102
103
|
useEffect(() => {
|
|
104
|
+
if (propSessionId) {
|
|
105
|
+
setSessionId(propSessionId);
|
|
106
|
+
}
|
|
107
|
+
|
|
103
108
|
if (propBaseUrl) {
|
|
104
109
|
setBaseUrl(propBaseUrl);
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
const timer = setTimeout(() => {
|
|
111
|
+
setIsInitialized(true);
|
|
112
|
+
}, 1000);
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
if (propSessionId) {
|
|
110
|
-
setSessionId(propSessionId);
|
|
114
|
+
return () => clearTimeout(timer);
|
|
111
115
|
}
|
|
112
|
-
}, [propSessionId]);
|
|
116
|
+
}, [propBaseUrl, propSessionId]);
|
|
113
117
|
|
|
114
118
|
useEffect(() => {
|
|
115
119
|
if (propLocale) {
|
|
@@ -118,7 +122,7 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
118
122
|
}
|
|
119
123
|
}, [propLocale]);
|
|
120
124
|
|
|
121
|
-
if (!baseUrl) {
|
|
125
|
+
if (!baseUrl || !isInitialized) {
|
|
122
126
|
return (
|
|
123
127
|
<View style={styles.loadingContainer}>
|
|
124
128
|
<ActivityIndicator size="large" color={branding.primaryColor} />
|