@miso.ai/client-sdk-core 1.8.1-beta.2 → 1.8.1-beta.4
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/cjs/api/helpers.js +1 -1
- package/dist/cjs/plugin/plugin-root.js +7 -1
- package/dist/cjs/root.js +1 -0
- package/dist/cjs/version.js +1 -1
- package/package.json +2 -2
- package/src/api/helpers.js +1 -1
- package/src/plugin/plugin-root.js +8 -1
- package/src/root.js +1 -0
- package/src/version.js +1 -1
package/dist/cjs/api/helpers.js
CHANGED
|
@@ -114,7 +114,7 @@ class ApiHelpers {
|
|
|
114
114
|
if (method && method !== 'POST') {
|
|
115
115
|
throw new Error(`Non-POST API is not supported in useBeacon mode: ${url}`);
|
|
116
116
|
}
|
|
117
|
-
if (!window.navigator.sendBeacon(url, JSON.stringify(payload))) {
|
|
117
|
+
if (!(this._root._customSendBeacon || window.navigator.sendBeacon)(url, JSON.stringify(payload))) {
|
|
118
118
|
throw new Error(`Send beacon unsuccessful: ${url}`);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -104,6 +104,12 @@ class PluginRoot extends _commons.Registry {
|
|
|
104
104
|
}
|
|
105
105
|
this._root._customFetch = fetch;
|
|
106
106
|
}
|
|
107
|
+
setCustomSendBeacon(sendBeacon) {
|
|
108
|
+
if (typeof sendBeacon !== 'function') {
|
|
109
|
+
throw new Error(`Expect parameter to be a function: ${sendBeacon}`);
|
|
110
|
+
}
|
|
111
|
+
this._root._customSendBeacon = sendBeacon;
|
|
112
|
+
}
|
|
107
113
|
_tryConfig(instance, options) {
|
|
108
114
|
if (options === undefined) {
|
|
109
115
|
return;
|
|
@@ -215,7 +221,7 @@ class PluginRoot extends _commons.Registry {
|
|
|
215
221
|
exports.default = PluginRoot;
|
|
216
222
|
class PluginContext {
|
|
217
223
|
constructor(root, classes) {
|
|
218
|
-
(0, _commons.delegateGetters)(this, root, ['getPluginClass', 'addSubtree', 'addPayloadPass', 'addUrlPass', 'setCustomFetch', 'whenInstalled', 'whenRegistered']);
|
|
224
|
+
(0, _commons.delegateGetters)(this, root, ['getPluginClass', 'addSubtree', 'addPayloadPass', 'addUrlPass', 'setCustomFetch', 'setCustomSendBeacon', 'whenInstalled', 'whenRegistered']);
|
|
219
225
|
(0, _commons.defineValues)(this, {
|
|
220
226
|
classes
|
|
221
227
|
});
|
package/dist/cjs/root.js
CHANGED
package/dist/cjs/version.js
CHANGED
package/package.json
CHANGED
package/src/api/helpers.js
CHANGED
|
@@ -83,7 +83,7 @@ export default class ApiHelpers {
|
|
|
83
83
|
if (method && method !== 'POST') {
|
|
84
84
|
throw new Error(`Non-POST API is not supported in useBeacon mode: ${url}`);
|
|
85
85
|
}
|
|
86
|
-
if (!window.navigator.sendBeacon(url, JSON.stringify(payload))) {
|
|
86
|
+
if (!(this._root._customSendBeacon || window.navigator.sendBeacon)(url, JSON.stringify(payload))) {
|
|
87
87
|
throw new Error(`Send beacon unsuccessful: ${url}`);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -108,6 +108,13 @@ export default class PluginRoot extends Registry {
|
|
|
108
108
|
this._root._customFetch = fetch;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
setCustomSendBeacon(sendBeacon) {
|
|
112
|
+
if (typeof sendBeacon !== 'function') {
|
|
113
|
+
throw new Error(`Expect parameter to be a function: ${sendBeacon}`);
|
|
114
|
+
}
|
|
115
|
+
this._root._customSendBeacon = sendBeacon;
|
|
116
|
+
}
|
|
117
|
+
|
|
111
118
|
_tryConfig(instance, options) {
|
|
112
119
|
if (options === undefined) {
|
|
113
120
|
return;
|
|
@@ -222,7 +229,7 @@ export default class PluginRoot extends Registry {
|
|
|
222
229
|
class PluginContext {
|
|
223
230
|
|
|
224
231
|
constructor(root, classes) {
|
|
225
|
-
delegateGetters(this, root, ['getPluginClass', 'addSubtree', 'addPayloadPass', 'addUrlPass', 'setCustomFetch', 'whenInstalled', 'whenRegistered']);
|
|
232
|
+
delegateGetters(this, root, ['getPluginClass', 'addSubtree', 'addPayloadPass', 'addUrlPass', 'setCustomFetch', 'setCustomSendBeacon', 'whenInstalled', 'whenRegistered']);
|
|
226
233
|
defineValues(this, { classes });
|
|
227
234
|
}
|
|
228
235
|
|
package/src/root.js
CHANGED
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.8.1-beta.
|
|
1
|
+
export default '1.8.1-beta.4';
|