@novasamatech/product-sdk 0.7.2-0 → 0.7.2-1
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/dist/sandboxTransport.js +12 -2
- package/package.json +2 -2
package/dist/sandboxTransport.js
CHANGED
|
@@ -43,6 +43,14 @@ function isValidIframeMessage(event, sourceEnv, currentEnv) {
|
|
|
43
43
|
function isValidWebviewMessage(event) {
|
|
44
44
|
return event.data && event.data.constructor.name === 'Uint8Array';
|
|
45
45
|
}
|
|
46
|
+
// Copy into a tight-fitting ArrayBuffer. Required before handing the array across
|
|
47
|
+
// an Electron IPC / structured-clone boundary: structured clone serializes the full
|
|
48
|
+
// underlying ArrayBuffer.
|
|
49
|
+
function detach(view) {
|
|
50
|
+
const copy = new Uint8Array(view.byteLength);
|
|
51
|
+
copy.set(view);
|
|
52
|
+
return copy;
|
|
53
|
+
}
|
|
46
54
|
function createDefaultSdkProvider() {
|
|
47
55
|
const subscribers = new Set();
|
|
48
56
|
const handleIframeMessage = (event) => {
|
|
@@ -55,8 +63,9 @@ function createDefaultSdkProvider() {
|
|
|
55
63
|
const handleWebviewMessage = (event) => {
|
|
56
64
|
if (!isValidWebviewMessage(event))
|
|
57
65
|
return;
|
|
66
|
+
const detached = detach(event.data);
|
|
58
67
|
for (const subscriber of subscribers) {
|
|
59
|
-
subscriber(
|
|
68
|
+
subscriber(detached);
|
|
60
69
|
}
|
|
61
70
|
};
|
|
62
71
|
if (isIframe()) {
|
|
@@ -75,7 +84,8 @@ function createDefaultSdkProvider() {
|
|
|
75
84
|
getParentWindow().postMessage(message, '*', [message.buffer]);
|
|
76
85
|
}
|
|
77
86
|
else if (isWebview()) {
|
|
78
|
-
|
|
87
|
+
const detached = detach(message);
|
|
88
|
+
getWebviewPort().then(port => port.postMessage(detached, [detached.buffer]));
|
|
79
89
|
}
|
|
80
90
|
},
|
|
81
91
|
subscribe(callback) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/product-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.2-
|
|
4
|
+
"version": "0.7.2-1",
|
|
5
5
|
"description": "Polkadot product SDK: integrate and run your product inside Polkadot browser.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@polkadot/extension-inject": "^0.63.1",
|
|
29
29
|
"@polkadot-api/json-rpc-provider-proxy": "^0.4.0",
|
|
30
|
-
"@novasamatech/host-api": "0.7.2-
|
|
30
|
+
"@novasamatech/host-api": "0.7.2-1",
|
|
31
31
|
"polkadot-api": ">=2",
|
|
32
32
|
"neverthrow": "^8.2.0"
|
|
33
33
|
},
|