@icanbwell/native-components 3.0.0 → 3.1.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/index.js +16 -9
- package/package.json +5 -5
- package/src/ComponentView/htmlTemplate.d.ts +4 -1
package/index.js
CHANGED
|
@@ -1911,13 +1911,15 @@ const htmlTemplate = props => {
|
|
|
1911
1911
|
const scriptTemplate = ({
|
|
1912
1912
|
clientKey,
|
|
1913
1913
|
userToken: initialUserToken,
|
|
1914
|
-
initialPath
|
|
1914
|
+
initialPath,
|
|
1915
|
+
telemetry
|
|
1915
1916
|
}) => `
|
|
1916
1917
|
(async function init() {
|
|
1917
1918
|
${initialPath ? `window.location.hash = "${initialPath}";` : ''}
|
|
1918
1919
|
window.bwell.init(${JSON.stringify({
|
|
1919
1920
|
clientKey,
|
|
1920
|
-
initialUserToken
|
|
1921
|
+
initialUserToken,
|
|
1922
|
+
telemetry
|
|
1921
1923
|
})})
|
|
1922
1924
|
})();
|
|
1923
1925
|
`;
|
|
@@ -1945,7 +1947,8 @@ function createSource({
|
|
|
1945
1947
|
name,
|
|
1946
1948
|
clientKey,
|
|
1947
1949
|
userToken,
|
|
1948
|
-
initialPath
|
|
1950
|
+
initialPath,
|
|
1951
|
+
telemetry
|
|
1949
1952
|
}) {
|
|
1950
1953
|
if (!uri) {
|
|
1951
1954
|
const html = htmlTemplate({
|
|
@@ -1953,7 +1956,8 @@ function createSource({
|
|
|
1953
1956
|
webcomponent: `<bwell-${name} id=${WEB_COMPONENT_ID} loading />`,
|
|
1954
1957
|
clientKey,
|
|
1955
1958
|
userToken,
|
|
1956
|
-
initialPath
|
|
1959
|
+
initialPath,
|
|
1960
|
+
telemetry
|
|
1957
1961
|
});
|
|
1958
1962
|
return {
|
|
1959
1963
|
html
|
|
@@ -1974,7 +1978,8 @@ const ComponentView = ({
|
|
|
1974
1978
|
clientKey,
|
|
1975
1979
|
userToken,
|
|
1976
1980
|
path,
|
|
1977
|
-
initialPath
|
|
1981
|
+
initialPath,
|
|
1982
|
+
telemetry
|
|
1978
1983
|
}) => {
|
|
1979
1984
|
if (_authStrategy === 'jwe' && !userToken) {
|
|
1980
1985
|
throw new Error('"userToken" required with JWE based authentication strategy.');
|
|
@@ -1993,10 +1998,11 @@ const ComponentView = ({
|
|
|
1993
1998
|
name,
|
|
1994
1999
|
clientKey,
|
|
1995
2000
|
userToken,
|
|
1996
|
-
initialPath
|
|
2001
|
+
initialPath,
|
|
2002
|
+
telemetry
|
|
1997
2003
|
})), {
|
|
1998
2004
|
baseUrl: `https://mobile.${ORIGIN}/`
|
|
1999
|
-
}), [uri, version, name, clientKey, userToken, initialPath]);
|
|
2005
|
+
}), [uri, version, name, clientKey, userToken, initialPath, telemetry]);
|
|
2000
2006
|
const invoke = useMemo(() => createInvoke(() => webviewRef.current), []);
|
|
2001
2007
|
const {
|
|
2002
2008
|
eventEmitter
|
|
@@ -2125,10 +2131,11 @@ const ComponentView = ({
|
|
|
2125
2131
|
}, []);
|
|
2126
2132
|
useEffect(() => {
|
|
2127
2133
|
var _a;
|
|
2128
|
-
if (path && webviewLoaded) {
|
|
2129
|
-
const script = `window.location.hash = '#${path}';
|
|
2134
|
+
if ((path === null || path === void 0 ? void 0 : path.value) && webviewLoaded) {
|
|
2135
|
+
const script = `window.location.hash = '#${path.value}';
|
|
2130
2136
|
window.history.pushState({}, '', window.location.hash);`;
|
|
2131
2137
|
(_a = webviewRef.current) === null || _a === void 0 ? void 0 : _a.injectJavaScript(script);
|
|
2138
|
+
path.onResetValue();
|
|
2132
2139
|
}
|
|
2133
2140
|
}, [path, webviewLoaded]);
|
|
2134
2141
|
return /*#__PURE__*/jsxs(Fragment, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icanbwell/native-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"typedoc": {
|
|
5
5
|
"entryPoint": "./src/index.ts",
|
|
6
6
|
"tsconfig": "./tsconfig.lib.json"
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
12
12
|
"react-native-webview": "11.x"
|
|
13
13
|
},
|
|
14
|
-
"repoVersion": "8.
|
|
15
|
-
"description": "@icanbwell/native-components. repo version: 8.
|
|
14
|
+
"repoVersion": "8.11.0",
|
|
15
|
+
"description": "@icanbwell/native-components. repo version: 8.11.0",
|
|
16
16
|
"module": "./index.js",
|
|
17
17
|
"main": "./index.js",
|
|
18
18
|
"type": "module",
|
|
19
19
|
"types": "./src/index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@icanbwell/native-plugins": "4.
|
|
21
|
+
"@icanbwell/native-plugins": "4.1.0",
|
|
22
22
|
"@icanbwell/react-native-webview-invoke": "0.6.2",
|
|
23
|
-
"@icanbwell/types": "4.
|
|
23
|
+
"@icanbwell/types": "4.1.0",
|
|
24
24
|
"lodash.noop": "3.0.1"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { Telemetry } from '@icanbwell/types';
|
|
1
2
|
export type HtmlTemplateProps = {
|
|
2
3
|
script: string;
|
|
3
4
|
webcomponent: string;
|
|
4
5
|
clientKey: string;
|
|
5
6
|
userToken?: string;
|
|
6
7
|
initialPath?: string;
|
|
8
|
+
telemetry?: Telemetry;
|
|
7
9
|
};
|
|
8
10
|
export declare const htmlTemplate: (props: HtmlTemplateProps) => string;
|
|
9
11
|
export type ScriptTemplateProps = {
|
|
10
12
|
clientKey: string;
|
|
11
13
|
userToken?: string;
|
|
12
14
|
initialPath?: string;
|
|
15
|
+
telemetry?: Telemetry;
|
|
13
16
|
};
|
|
14
|
-
export declare const scriptTemplate: ({ clientKey, userToken: initialUserToken, initialPath }: ScriptTemplateProps) => string;
|
|
17
|
+
export declare const scriptTemplate: ({ clientKey, userToken: initialUserToken, initialPath, telemetry, }: ScriptTemplateProps) => string;
|