@movable/studio-framework 2.36.2 → 2.37.0-studio-types-6

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/index.es.js CHANGED
@@ -8221,19 +8221,50 @@ var StudioFramework = /*#__PURE__*/function () {
8221
8221
  CD.throwError(e);
8222
8222
  throw e;
8223
8223
  }
8224
+ }, {
8225
+ key: "handleAndPreventFutureAnalyticsCalls",
8226
+ value: function handleAndPreventFutureAnalyticsCalls(data) {
8227
+ var _window$MICapture;
8228
+
8229
+ if (_typeof(data) !== 'object') {
8230
+ throw new Error('The result of `analyticsData` must be an object');
8231
+ }
8232
+
8233
+ var format = (_window$MICapture = window.MICapture) === null || _window$MICapture === void 0 ? void 0 : _window$MICapture.format;
8234
+ var analytics = document.querySelector('#mi-data');
8235
+
8236
+ if (format === 'html') {
8237
+ var analyticsLength = analytics ? (analytics.getAttribute('data-mi-data') || '').length : 0;
8238
+
8239
+ if (analyticsLength > 250) {
8240
+ analytics.setAttribute('data-mi-data', '{}');
8241
+ console.log('extraData trying to be set exceeds 250 characters, setting extraData to be empty to avoid breaking crops');
8242
+ }
8243
+ } // Force a full overwrite
8244
+
8245
+
8246
+ if (analytics) document.querySelector('#mi-data').remove();
8247
+ CD.setExtraData(data);
8248
+
8249
+ CD.setExtraData = function () {
8250
+ console.log('setExtraData call was prevented via handleAndPreventFutureAnalyticsCalls');
8251
+ };
8252
+
8253
+ CD.resume();
8254
+ }
8224
8255
  }, {
8225
8256
  key: "render",
8226
8257
  value: function () {
8227
8258
  var _render = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee7(targetElement) {
8228
- var _window$MICapture;
8259
+ var _window$MICapture2;
8229
8260
 
8230
- var currentCanvas, _currentCanvas, clickthroughURL, canvasTags, tags, height, width, renderPromise, analyticsDataPromise, wrappedError;
8261
+ var currentCanvas, _currentCanvas, _window$MICapture3, clickthroughURL, canvasTags, tags, height, width, format, renderPromise, analyticsDataPromise, wrappedError;
8231
8262
 
8232
8263
  return regenerator.wrap(function _callee7$(_context7) {
8233
8264
  while (1) {
8234
8265
  switch (_context7.prev = _context7.next) {
8235
8266
  case 0:
8236
- if ((_window$MICapture = window.MICapture) !== null && _window$MICapture !== void 0 && _window$MICapture.isPreview) console.log('Preview Render');
8267
+ if ((_window$MICapture2 = window.MICapture) !== null && _window$MICapture2 !== void 0 && _window$MICapture2.isPreview) console.log('Preview Render');
8237
8268
  _context7.prev = 1;
8238
8269
  CD.pause();
8239
8270
  _context7.next = 5;
@@ -8254,21 +8285,25 @@ var StudioFramework = /*#__PURE__*/function () {
8254
8285
  tags = _context7.sent;
8255
8286
  height = currentCanvas.height || this.options.height;
8256
8287
  width = currentCanvas.width || this.options.width;
8288
+ format = (_window$MICapture3 = window.MICapture) === null || _window$MICapture3 === void 0 ? void 0 : _window$MICapture3.format;
8257
8289
  renderPromise = this.renderApp(targetElement, clickthroughURL, tags, {
8258
8290
  height: height,
8259
8291
  width: width
8260
8292
  }, currentCanvas);
8261
8293
  analyticsDataPromise = this.handleAnalyticsData();
8262
- _context7.next = 19;
8294
+ _context7.next = 20;
8263
8295
  return promise.all([renderPromise, analyticsDataPromise]);
8264
8296
 
8265
- case 19:
8297
+ case 20:
8266
8298
  if (this.getProperty('animation.isAnimated')) {
8267
8299
  this.setupAnimation();
8268
8300
  }
8269
8301
 
8270
- cleanHTML(targetElement);
8271
- addBrowserContent(targetElement);
8302
+ if (format === 'html') {
8303
+ cleanHTML(targetElement);
8304
+ addBrowserContent(targetElement);
8305
+ }
8306
+
8272
8307
  _context7.next = 28;
8273
8308
  break;
8274
8309
 
package/dist/index.js CHANGED
@@ -8231,19 +8231,50 @@ var StudioFramework = /*#__PURE__*/function () {
8231
8231
  CD__default['default'].throwError(e);
8232
8232
  throw e;
8233
8233
  }
8234
+ }, {
8235
+ key: "handleAndPreventFutureAnalyticsCalls",
8236
+ value: function handleAndPreventFutureAnalyticsCalls(data) {
8237
+ var _window$MICapture;
8238
+
8239
+ if (_typeof(data) !== 'object') {
8240
+ throw new Error('The result of `analyticsData` must be an object');
8241
+ }
8242
+
8243
+ var format = (_window$MICapture = window.MICapture) === null || _window$MICapture === void 0 ? void 0 : _window$MICapture.format;
8244
+ var analytics = document.querySelector('#mi-data');
8245
+
8246
+ if (format === 'html') {
8247
+ var analyticsLength = analytics ? (analytics.getAttribute('data-mi-data') || '').length : 0;
8248
+
8249
+ if (analyticsLength > 250) {
8250
+ analytics.setAttribute('data-mi-data', '{}');
8251
+ console.log('extraData trying to be set exceeds 250 characters, setting extraData to be empty to avoid breaking crops');
8252
+ }
8253
+ } // Force a full overwrite
8254
+
8255
+
8256
+ if (analytics) document.querySelector('#mi-data').remove();
8257
+ CD__default['default'].setExtraData(data);
8258
+
8259
+ CD__default['default'].setExtraData = function () {
8260
+ console.log('setExtraData call was prevented via handleAndPreventFutureAnalyticsCalls');
8261
+ };
8262
+
8263
+ CD__default['default'].resume();
8264
+ }
8234
8265
  }, {
8235
8266
  key: "render",
8236
8267
  value: function () {
8237
8268
  var _render = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee7(targetElement) {
8238
- var _window$MICapture;
8269
+ var _window$MICapture2;
8239
8270
 
8240
- var currentCanvas, _currentCanvas, clickthroughURL, canvasTags, tags, height, width, renderPromise, analyticsDataPromise, wrappedError;
8271
+ var currentCanvas, _currentCanvas, _window$MICapture3, clickthroughURL, canvasTags, tags, height, width, format, renderPromise, analyticsDataPromise, wrappedError;
8241
8272
 
8242
8273
  return regenerator.wrap(function _callee7$(_context7) {
8243
8274
  while (1) {
8244
8275
  switch (_context7.prev = _context7.next) {
8245
8276
  case 0:
8246
- if ((_window$MICapture = window.MICapture) !== null && _window$MICapture !== void 0 && _window$MICapture.isPreview) console.log('Preview Render');
8277
+ if ((_window$MICapture2 = window.MICapture) !== null && _window$MICapture2 !== void 0 && _window$MICapture2.isPreview) console.log('Preview Render');
8247
8278
  _context7.prev = 1;
8248
8279
  CD__default['default'].pause();
8249
8280
  _context7.next = 5;
@@ -8264,21 +8295,25 @@ var StudioFramework = /*#__PURE__*/function () {
8264
8295
  tags = _context7.sent;
8265
8296
  height = currentCanvas.height || this.options.height;
8266
8297
  width = currentCanvas.width || this.options.width;
8298
+ format = (_window$MICapture3 = window.MICapture) === null || _window$MICapture3 === void 0 ? void 0 : _window$MICapture3.format;
8267
8299
  renderPromise = this.renderApp(targetElement, clickthroughURL, tags, {
8268
8300
  height: height,
8269
8301
  width: width
8270
8302
  }, currentCanvas);
8271
8303
  analyticsDataPromise = this.handleAnalyticsData();
8272
- _context7.next = 19;
8304
+ _context7.next = 20;
8273
8305
  return promise.all([renderPromise, analyticsDataPromise]);
8274
8306
 
8275
- case 19:
8307
+ case 20:
8276
8308
  if (this.getProperty('animation.isAnimated')) {
8277
8309
  this.setupAnimation();
8278
8310
  }
8279
8311
 
8280
- cleanHTML(targetElement);
8281
- addBrowserContent(targetElement);
8312
+ if (format === 'html') {
8313
+ cleanHTML(targetElement);
8314
+ addBrowserContent(targetElement);
8315
+ }
8316
+
8282
8317
  _context7.next = 28;
8283
8318
  break;
8284
8319
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movable/studio-framework",
3
- "version": "2.36.2",
3
+ "version": "2.37.0-studio-types-6",
4
4
  "description": "A Component library for reactive Studio apps.",
5
5
  "author": "Movable Ink",
6
6
  "repository": "movableink/studio-framework",
@@ -35,7 +35,7 @@
35
35
  "@babel/preset-react": "^7.14.5",
36
36
  "@babel/preset-typescript": "^7.13.0",
37
37
  "@movable/eslint-config-react": "^1.0.1",
38
- "@movable/studio-framework-test-helpers": "^2.36.2",
38
+ "@movable/studio-framework-test-helpers": "^2.37.0-studio-types-6",
39
39
  "@types/qunit": "^2.11.1",
40
40
  "@types/qunit-dom": "^0.7.0",
41
41
  "@types/react": "^17.0.6",
@@ -67,5 +67,5 @@
67
67
  "volta": {
68
68
  "extends": "../../package.json"
69
69
  },
70
- "gitHead": "6d8ff22685d2df60aca50b0e8c2b478509b3463f"
70
+ "gitHead": "c2efbced7ce727b04255c64ba5c9bc5d9ecd1514"
71
71
  }