@knime/hub-features 1.17.1 → 1.18.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/CHANGELOG.md +6 -0
- package/package.json +3 -3
- package/src/embeddingSDK/guest.ts +12 -4
- package/src/embeddingSDK/types.ts +14 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knime/hub-features",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Vue components & composables for shared hub features",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"ofetch": "^1.4.1",
|
|
38
38
|
"typescript": "^5.8.3",
|
|
39
39
|
"@knime/components": "1.45.4",
|
|
40
|
-
"@knime/
|
|
41
|
-
"@knime/
|
|
40
|
+
"@knime/utils": "1.9.2",
|
|
41
|
+
"@knime/styles": "1.15.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"consola": "3.x",
|
|
@@ -53,6 +53,8 @@ const defaultvalidator: EmbeddingContextValidator = () => ({
|
|
|
53
53
|
error: null,
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
const PARENT_ORIGIN = "*";
|
|
57
|
+
|
|
56
58
|
/**
|
|
57
59
|
* Wait for host application to send a message containing the embedding context
|
|
58
60
|
*/
|
|
@@ -98,19 +100,25 @@ export const waitForContext = (
|
|
|
98
100
|
|
|
99
101
|
// send message to parent after postmessage listener has been set-up
|
|
100
102
|
logger().info("Awaiting to receive embedding context");
|
|
101
|
-
window.parent.postMessage(
|
|
103
|
+
window.parent.postMessage(
|
|
104
|
+
{ type: MESSAGES.AWAITING_EMBEDDING_CONTEXT },
|
|
105
|
+
PARENT_ORIGIN,
|
|
106
|
+
);
|
|
102
107
|
|
|
103
108
|
return promise;
|
|
104
109
|
};
|
|
105
110
|
|
|
106
111
|
export const sendEmbeddingFailureMessage = (error: unknown) => {
|
|
107
|
-
window.parent.postMessage(
|
|
112
|
+
window.parent.postMessage(
|
|
113
|
+
{ type: MESSAGES.EMBEDDING_FAILED, error },
|
|
114
|
+
PARENT_ORIGIN,
|
|
115
|
+
);
|
|
108
116
|
};
|
|
109
117
|
|
|
110
118
|
export const dispatchGenericEventToHost = (event: GenericEvent) => {
|
|
111
119
|
window.parent.postMessage(
|
|
112
120
|
{ type: MESSAGES.GENERIC_EVENT, payload: event },
|
|
113
|
-
|
|
121
|
+
PARENT_ORIGIN,
|
|
114
122
|
);
|
|
115
123
|
};
|
|
116
124
|
|
|
@@ -119,6 +127,6 @@ export const notifyActivityChange = (userActivityInfo: UserActivityInfo) => {
|
|
|
119
127
|
|
|
120
128
|
window.parent.postMessage(
|
|
121
129
|
{ type: MESSAGES.USER_ACTIVITY, payload: userActivityInfo },
|
|
122
|
-
|
|
130
|
+
PARENT_ORIGIN,
|
|
123
131
|
);
|
|
124
132
|
};
|
|
@@ -8,7 +8,9 @@ export type EmbeddingContext = {
|
|
|
8
8
|
wsConnectionUri: string;
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated URI of the WS used by the embedded application.
|
|
11
|
-
* Last used in AP 5.8.0
|
|
11
|
+
* Last used in AP 5.8.0. From 5.9.0 and onwards `wsConnectionUri` is preferred.
|
|
12
|
+
* Although, the AP still references the url for compatibility with older embedders
|
|
13
|
+
* that don't use the new property `wsConnectionUri`
|
|
12
14
|
*/
|
|
13
15
|
url?: string;
|
|
14
16
|
/**
|
|
@@ -56,10 +58,20 @@ type HostNavigationRequestEvent = {
|
|
|
56
58
|
| { intent: "navigate"; href: string; openIn: "_blank" | "_parent" };
|
|
57
59
|
};
|
|
58
60
|
|
|
61
|
+
type AnalyticsEvent = {
|
|
62
|
+
kind: "analytics";
|
|
63
|
+
payload: {
|
|
64
|
+
category: string;
|
|
65
|
+
name: string;
|
|
66
|
+
data: unknown;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
59
70
|
export type GenericEvent =
|
|
60
71
|
| ShowNotificationEvent
|
|
61
72
|
| ClearNotificationEvent
|
|
62
|
-
| HostNavigationRequestEvent
|
|
73
|
+
| HostNavigationRequestEvent
|
|
74
|
+
| AnalyticsEvent;
|
|
63
75
|
|
|
64
76
|
export type GenericEventByKind<K extends GenericEvent["kind"]> = Extract<
|
|
65
77
|
GenericEvent,
|