@one-commerce/sdk-backoffice-vue3 1.11.0 → 1.12.0-alpha.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/bundles/bundle.esm.js +17 -0
- package/lib/bundles/bundle.esm.js.map +1 -1
- package/lib/bundles/bundle.esm.min.js +1 -1
- package/lib/bundles/bundle.esm.min.js.map +1 -1
- package/lib/bundles/bundle.umd.js +17 -0
- package/lib/bundles/bundle.umd.js.map +1 -1
- package/lib/bundles/bundle.umd.min.js +1 -1
- package/lib/bundles/bundle.umd.min.js.map +1 -1
- package/lib/types/vue.d.ts +14 -0
- package/package.json +3 -3
|
@@ -61,6 +61,8 @@ exports.Errors = exports.Message = void 0;
|
|
|
61
61
|
Message["METHOD_CALL_ERROR"] = "one:method:error";
|
|
62
62
|
Message["METHOD_RESULT"] = "one:method:result";
|
|
63
63
|
Message["NAVIGATION_PUSH"] = "one:navigation:push";
|
|
64
|
+
Message["FRAME_HEIGHT_REQUEST"] = "one:frameheight:request";
|
|
65
|
+
Message["FRAME_HEIGHT_CHANGE"] = "one:frameheight:change";
|
|
64
66
|
})(exports.Message || (exports.Message = {}));
|
|
65
67
|
(function (Errors) {
|
|
66
68
|
Errors["METHOD_DOES_NOT_EXISTS"] = "Method does not exists";
|
|
@@ -276,6 +278,8 @@ class Sdk extends Events {
|
|
|
276
278
|
|
|
277
279
|
_defineProperty(this, "channel", void 0);
|
|
278
280
|
|
|
281
|
+
_defineProperty(this, "autoheight", true);
|
|
282
|
+
|
|
279
283
|
_defineProperty(this, "origin", void 0);
|
|
280
284
|
|
|
281
285
|
_defineProperty(this, "isInitialized", false);
|
|
@@ -311,6 +315,15 @@ class Sdk extends Events {
|
|
|
311
315
|
Sdk.log('Emitting UPDATE with payload ', payload);
|
|
312
316
|
this.emit(SdkInternalEvents.UPDATE, payload);
|
|
313
317
|
});
|
|
318
|
+
this.channel.subscribe(main.Message.FRAME_HEIGHT_REQUEST, payload => {
|
|
319
|
+
if (this.autoheight) {
|
|
320
|
+
Sdk.log('Request for iframe height');
|
|
321
|
+
const body = document.body,
|
|
322
|
+
html = document.documentElement;
|
|
323
|
+
const height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
|
|
324
|
+
this.channel.postMessage(main.Message.FRAME_HEIGHT_CHANGE, height);
|
|
325
|
+
}
|
|
326
|
+
});
|
|
314
327
|
this.channel.connect().then(() => {
|
|
315
328
|
Sdk.log('Connected with ONe SDK');
|
|
316
329
|
});
|
|
@@ -323,6 +336,10 @@ class Sdk extends Events {
|
|
|
323
336
|
if (typeof options.debug !== 'undefined') {
|
|
324
337
|
Sdk.debug = options.debug;
|
|
325
338
|
}
|
|
339
|
+
|
|
340
|
+
if (typeof options.autoheight !== 'undefined') {
|
|
341
|
+
this.autoheight = options.autoheight;
|
|
342
|
+
}
|
|
326
343
|
}
|
|
327
344
|
}
|
|
328
345
|
|