@letscooee/web-sdk 0.0.9 → 0.0.14

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 CHANGED
@@ -1,36 +1,71 @@
1
1
  # Change Log
2
2
 
3
- # 0.0.9
3
+ ## 0.0.14
4
+
5
+ ### Fixes
6
+
7
+ 1. Scaling down of in-app when rendered in full page.
8
+ 2. Enforce `display: block` on elements to overwrite site specific rules.
9
+
10
+ ## 0.0.13
11
+
12
+ ### Features
13
+
14
+ 1. Support dynamic canvas size.
15
+ 2. Ability to set colors on in-app and container separately.
16
+
17
+ ### Improvements
18
+
19
+ 1. Add hand pointer for CTAs.
20
+ 2. Add push prompt CTA.
21
+
22
+ ## 0.0.11, 0.0.12
23
+
24
+ ### Fixes
25
+
26
+ 1. Rendering condition for x(left) and y(top) position.
27
+ 2. Rotation of the text.
28
+
29
+ ## 0.0.10 (unreleased)
30
+
31
+ ### Improvement:
32
+ 1. Get trigger direction(gravity) for InAppTrigger.
33
+
34
+ ### Fixes
35
+ 1. Rename `prompt` to `pmpt`.
36
+ 2. Use device api instead of user api to send device data.
37
+
38
+ ## 0.0.9
4
39
 
5
40
  1. Fix: glassmorphism on iOS.
6
41
  2. Fix: Fix rendering scaled images.
7
42
  3. Fix: Update in KPI for CTA.
8
43
  4. Fix: Do not remove in-app if being used inside an element.
9
44
 
10
- # 0.0.8
45
+ ## 0.0.8
11
46
 
12
47
  1. Feature: Ability of InApp to be rendered inside an element.
13
48
  2. Fix: Overflowed content should not be rendered.
14
49
  3. Fix: Placing in-app on east direction.
15
50
 
16
- # 0.0.7
51
+ ## 0.0.7
17
52
 
18
53
  More feature support in the sdk.
19
54
 
20
- # 0.0.6
55
+ ## 0.0.6
21
56
 
22
57
  1. Build: Upgrade TypeScript to 4.4.
23
58
  2. Fix: Convert \n to `<br>` in texts.
24
59
 
25
- # 0.0.5
60
+ ## 0.0.5
26
61
 
27
62
  Supporting changes based on the in-app composer.
28
63
 
29
- # 0.0.3, 0.0.4
64
+ ## 0.0.3, 0.0.4
30
65
 
31
66
  1. Fix generating token because of missing app version.
32
67
  2. Handle scenario when `CooeeSDK` is not initialised.
33
68
 
34
- # 0.0.2
69
+ ## 0.0.2
35
70
 
36
71
  First functional release.
@@ -35,11 +35,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import { Constants } from '../../../constants';
38
- import { IFrameRenderer, RootContainerRenderer } from '../../../renderer';
38
+ import { IFrameRenderer } from '../../../renderer';
39
+ import { Renderer } from '../../../renderer/renderer';
39
40
  import { SafeHttpService } from '../../../services/safe-http-service';
41
+ import { LocalStorageHelper } from '../../../utils/local-storage-helper';
40
42
  import { Log } from '../../../utils/log';
41
43
  import { Event } from '../../event/event';
42
- import { LocalStorageHelper } from '../../../utils/local-storage-helper';
43
44
  import { Permission } from '../blocks/click-action';
44
45
  /**
45
46
  * Performs click to action on in-app elements
@@ -105,18 +106,18 @@ var ClickActionExecutor = /** @class */ (function () {
105
106
  * Performs prompt action i.e. ask for permission for location and notification.
106
107
  */
107
108
  ClickActionExecutor.prototype.prompt = function () {
108
- var permission = this.action.prompt;
109
+ var permission = this.action.pmpt;
109
110
  if (!permission) {
110
111
  return;
111
112
  }
112
113
  // TODO test in mobile browsers
113
- if (permission === Permission.Location) {
114
+ if (permission === Permission.LOCATION) {
114
115
  this.promptLocationPermission();
115
116
  }
116
- if (permission === Permission.Push) {
117
+ if (permission === Permission.PUSH) {
117
118
  this.promptPushNotificationPermission();
118
119
  }
119
- if (permission === Permission.Camera) {
120
+ if (permission === Permission.CAMERA) {
120
121
  this.promptCameraPermission();
121
122
  }
122
123
  };
@@ -128,13 +129,13 @@ var ClickActionExecutor = /** @class */ (function () {
128
129
  if (!this.action.close) {
129
130
  return;
130
131
  }
131
- new RootContainerRenderer().removeInApp();
132
+ Renderer.get().removeInApp();
132
133
  var startTime = LocalStorageHelper.getNumber(Constants.STORAGE_TRIGGER_START_TIME, new Date().getTime());
133
134
  var triggerID = (_a = LocalStorageHelper.getObject(Constants.STORAGE_ACTIVE_TRIGGER)) === null || _a === void 0 ? void 0 : _a.triggerID;
134
135
  var diffInSeconds = (new Date().getTime() - startTime) / 1000;
135
136
  var closeBehaviour;
136
137
  if (this.action.ext || this.action.up || this.action.kv ||
137
- this.action.iab || this.action.prompt || this.action.share) {
138
+ this.action.iab || this.action.pmpt || this.action.share) {
138
139
  closeBehaviour = 'CTA';
139
140
  }
140
141
  else {
@@ -179,7 +180,7 @@ var ClickActionExecutor = /** @class */ (function () {
179
180
  }
180
181
  // TODO Need device endpoints to update this property
181
182
  navigator.geolocation.getCurrentPosition(function (position) {
182
- _this.apiService.updateProfile({ 'coords': [position.coords.latitude, position.coords.longitude] });
183
+ _this.apiService.updateDeviceProps({ 'coords': [position.coords.latitude, position.coords.longitude] });
183
184
  _this.sendPermissionData();
184
185
  });
185
186
  };
@@ -195,7 +196,7 @@ var ClickActionExecutor = /** @class */ (function () {
195
196
  }
196
197
  // TODO Need device endpoints to update this property
197
198
  if (Notification.permission !== 'default') {
198
- this.apiService.updateProfile({ 'pnPerm': Notification.permission });
199
+ this.apiService.updateDeviceProps({ 'pnPerm': Notification.permission });
199
200
  return;
200
201
  }
201
202
  Notification.requestPermission()
@@ -260,7 +261,7 @@ var ClickActionExecutor = /** @class */ (function () {
260
261
  ClickActionExecutor.prototype.sendPermissionData = function () {
261
262
  var _this = this;
262
263
  this.checkAllPermission().then(function (permissions) {
263
- _this.apiService.updateProfile({ 'perm': permissions });
264
+ _this.apiService.updateDeviceProps({ 'perm': permissions });
264
265
  });
265
266
  };
266
267
  return ClickActionExecutor;
@@ -1,9 +1,9 @@
1
1
  export var Permission;
2
2
  (function (Permission) {
3
3
  // eslint-disable-next-line no-unused-vars
4
- Permission["Location"] = "LOCATION";
4
+ Permission[Permission["CAMERA"] = 1] = "CAMERA";
5
5
  // eslint-disable-next-line no-unused-vars
6
- Permission["Push"] = "PUSH";
6
+ Permission[Permission["LOCATION"] = 2] = "LOCATION";
7
7
  // eslint-disable-next-line no-unused-vars
8
- Permission["Camera"] = "CAMERA";
8
+ Permission[Permission["PUSH"] = 3] = "PUSH";
9
9
  })(Permission || (Permission = {}));
@@ -1,5 +1,7 @@
1
1
  var Transform = /** @class */ (function () {
2
- function Transform() {
2
+ function Transform(data) {
3
+ if (data === null || data === void 0 ? void 0 : data.rot)
4
+ this.rot = data.rot;
3
5
  }
4
6
  Object.defineProperty(Transform.prototype, "rotate", {
5
7
  get: function () {
@@ -1,4 +1,4 @@
1
- import { Background, Border } from '../blocks';
1
+ import { Background, Border, Transform } from '../blocks';
2
2
  var BaseElement = /** @class */ (function () {
3
3
  function BaseElement(data) {
4
4
  this.t = data.t;
@@ -6,10 +6,10 @@ var BaseElement = /** @class */ (function () {
6
6
  this.bg = new Background(data.bg);
7
7
  if (data.br)
8
8
  this.br = new Border(data.br);
9
+ this.trf = new Transform(data.trf);
9
10
  this.clc = data.clc;
10
11
  this.shd = data.shd;
11
12
  this.spc = data.spc;
12
- this.trf = data.trf;
13
13
  this.w = data.w;
14
14
  this.h = data.h;
15
15
  this.x = data.x;
@@ -17,75 +17,16 @@ import { BaseElement } from '../elements';
17
17
  var Container = /** @class */ (function (_super) {
18
18
  __extends(Container, _super);
19
19
  function Container(data) {
20
- var _a;
20
+ var _a, _b, _c;
21
21
  var _this = _super.call(this, data) || this;
22
22
  _this.o = (_a = data.o) !== null && _a !== void 0 ? _a : ContainerOrigin.C;
23
+ // For backward compatibility
24
+ _this.w = (_b = _this.w) !== null && _b !== void 0 ? _b : 1080;
25
+ _this.h = (_c = _this.h) !== null && _c !== void 0 ? _c : 1920;
23
26
  return _this;
24
27
  }
25
- Container.prototype.getStyles = function () {
26
- var styles;
27
- if (this.o === ContainerOrigin.NW) {
28
- styles = {
29
- top: 0,
30
- left: 0,
31
- };
32
- }
33
- else if (this.o === ContainerOrigin.N) {
34
- styles = {
35
- top: 0,
36
- left: '50%',
37
- transform: 'translateX(-50%)',
38
- };
39
- }
40
- else if (this.o === ContainerOrigin.NE) {
41
- styles = {
42
- top: 0,
43
- right: 0,
44
- };
45
- }
46
- else if (this.o === ContainerOrigin.E) {
47
- styles = {
48
- top: '50%',
49
- right: 0,
50
- transform: 'translateY(-50%)',
51
- };
52
- }
53
- else if (this.o === ContainerOrigin.SE) {
54
- styles = {
55
- bottom: 0,
56
- right: 0,
57
- };
58
- }
59
- else if (this.o === ContainerOrigin.S) {
60
- styles = {
61
- bottom: 0,
62
- left: '50%',
63
- transform: 'translateX(-50%)',
64
- };
65
- }
66
- else if (this.o === ContainerOrigin.SW) {
67
- styles = {
68
- bottom: 0,
69
- left: 0,
70
- };
71
- }
72
- else if (this.o === ContainerOrigin.W) {
73
- styles = {
74
- top: '50%',
75
- left: 0,
76
- transform: 'translateY(-50%)',
77
- };
78
- }
79
- else {
80
- styles = {
81
- top: '50%',
82
- left: '50%',
83
- transform: 'translateX(-50%) translateY(-50%)',
84
- };
85
- }
86
- styles.position = 'absolute';
87
- styles.overflow = 'hidden';
88
- return styles;
28
+ Container.prototype.getOrigin = function () {
29
+ return this.o;
89
30
  };
90
31
  return Container;
91
32
  }(BaseElement));
@@ -1,17 +1,41 @@
1
- import { Container } from './container';
2
- import { ImageElement, ShapeElement, TextElement } from '../elements';
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import { BaseElement, ImageElement, ShapeElement, TextElement } from '../elements';
3
17
  import { ElementType } from '../elements/base-element';
18
+ import { Container } from './container';
4
19
  /**
5
20
  * Stores data present in ian (In App) block in {@link TriggerData}
6
21
  *
7
22
  * @author Abhishek Taparia
8
23
  * @version 0.0.5
9
24
  */
10
- var InAppTrigger = /** @class */ (function () {
25
+ var InAppTrigger = /** @class */ (function (_super) {
26
+ __extends(InAppTrigger, _super);
11
27
  function InAppTrigger(data) {
12
- var _this = this;
13
- this.elems = [];
14
- this.cont = new Container(data.cont);
28
+ var _this =
29
+ // Only background is supported for in-apps
30
+ _super.call(this, { bg: data.bg }) || this;
31
+ _this.elems = [];
32
+ _this.cont = new Container(data.cont);
33
+ _this.gvt = data.gvt;
34
+ // Backward compatibility
35
+ if (!_this.bg) {
36
+ _this.bg = _this.cont.bg;
37
+ delete _this.cont.bg;
38
+ }
15
39
  data.elems.forEach(function (rawElement) {
16
40
  if (rawElement.t === ElementType.IMAGE) {
17
41
  _this.elems.push(new ImageElement(rawElement));
@@ -26,7 +50,85 @@ var InAppTrigger = /** @class */ (function () {
26
50
  _this.elems.push(new ShapeElement(rawElement));
27
51
  }
28
52
  });
53
+ return _this;
29
54
  }
55
+ InAppTrigger.prototype.getStyles = function () {
56
+ var styles;
57
+ if (this.gvt === ContainerOrigin.NW) {
58
+ styles = {
59
+ top: 0,
60
+ left: 0,
61
+ };
62
+ }
63
+ else if (this.gvt === ContainerOrigin.N) {
64
+ styles = {
65
+ top: 0,
66
+ left: '50%',
67
+ transform: 'translateX(-50%)',
68
+ };
69
+ }
70
+ else if (this.gvt === ContainerOrigin.NE) {
71
+ styles = {
72
+ top: 0,
73
+ right: 0,
74
+ };
75
+ }
76
+ else if (this.gvt === ContainerOrigin.E) {
77
+ styles = {
78
+ top: '50%',
79
+ right: 0,
80
+ transform: 'translateY(-50%)',
81
+ };
82
+ }
83
+ else if (this.gvt === ContainerOrigin.SE) {
84
+ styles = {
85
+ bottom: 0,
86
+ right: 0,
87
+ };
88
+ }
89
+ else if (this.gvt === ContainerOrigin.S) {
90
+ styles = {
91
+ bottom: 0,
92
+ left: '50%',
93
+ transform: 'translateX(-50%)',
94
+ };
95
+ }
96
+ else if (this.gvt === ContainerOrigin.SW) {
97
+ styles = {
98
+ bottom: 0,
99
+ left: 0,
100
+ };
101
+ }
102
+ else if (this.gvt === ContainerOrigin.W) {
103
+ styles = {
104
+ top: '50%',
105
+ left: 0,
106
+ transform: 'translateY(-50%)',
107
+ };
108
+ }
109
+ else {
110
+ styles = {
111
+ top: '50%',
112
+ left: '50%',
113
+ transform: 'translateX(-50%) translateY(-50%)',
114
+ };
115
+ }
116
+ styles.position = 'absolute';
117
+ styles.overflow = 'hidden';
118
+ return styles;
119
+ };
30
120
  return InAppTrigger;
31
- }());
121
+ }(BaseElement));
32
122
  export { InAppTrigger };
123
+ export var ContainerOrigin;
124
+ (function (ContainerOrigin) {
125
+ ContainerOrigin[ContainerOrigin["NW"] = 1] = "NW";
126
+ ContainerOrigin[ContainerOrigin["N"] = 2] = "N";
127
+ ContainerOrigin[ContainerOrigin["NE"] = 3] = "NE";
128
+ ContainerOrigin[ContainerOrigin["W"] = 4] = "W";
129
+ ContainerOrigin[ContainerOrigin["C"] = 5] = "C";
130
+ ContainerOrigin[ContainerOrigin["E"] = 6] = "E";
131
+ ContainerOrigin[ContainerOrigin["SW"] = 7] = "SW";
132
+ ContainerOrigin[ContainerOrigin["S"] = 8] = "S";
133
+ ContainerOrigin[ContainerOrigin["SE"] = 9] = "SE";
134
+ })(ContainerOrigin || (ContainerOrigin = {}));
@@ -1,7 +1,7 @@
1
- import { Renderer } from './renderer';
2
1
  import { ClickActionExecutor } from '../models/trigger/action/click-action-executor';
3
- import { getScalingFactor } from './index';
2
+ import { Transform } from '../models/trigger/blocks';
4
3
  import { Container } from '../models/trigger/inapp/container';
4
+ import { Renderer } from './renderer';
5
5
  /**
6
6
  * Process all the block of in-app
7
7
  *
@@ -13,9 +13,9 @@ var BlockProcessor = /** @class */ (function () {
13
13
  this.renderer = Renderer.get();
14
14
  this.screenWidth = 0;
15
15
  this.screenHeight = 0;
16
- this.scalingFactor = getScalingFactor();
17
16
  this.parentHTMLEl = parentHTMLEl;
18
17
  this.inappElement = inappElement;
18
+ this.scalingFactor = this.renderer.getScalingFactor();
19
19
  this.screenWidth = this.renderer.getWidth();
20
20
  this.screenHeight = this.renderer.getHeight();
21
21
  }
@@ -36,6 +36,7 @@ var BlockProcessor = /** @class */ (function () {
36
36
  this.processSpaceBlock();
37
37
  this.processTransformBlock();
38
38
  this.registerAction();
39
+ this.renderer.setStyle(this.inappHTMLEl, 'display', 'block');
39
40
  this.renderer.setStyle(this.inappHTMLEl, 'outline', 'none');
40
41
  };
41
42
  /**
@@ -62,14 +63,11 @@ var BlockProcessor = /** @class */ (function () {
62
63
  * Process position block of the element
63
64
  */
64
65
  BlockProcessor.prototype.processPositionBlock = function () {
65
- if (!this.inappElement.x) {
66
- return;
67
- }
68
66
  this.renderer.setStyle(this.inappHTMLEl, 'position', 'absolute');
69
67
  if (this.inappElement.x)
70
- this.renderer.setStyle(this.inappHTMLEl, 'top', this.getSizePx(this.inappElement.y));
71
- if (this.inappElement.y)
72
68
  this.renderer.setStyle(this.inappHTMLEl, 'left', this.getSizePx(this.inappElement.x));
69
+ if (this.inappElement.y)
70
+ this.renderer.setStyle(this.inappHTMLEl, 'top', this.getSizePx(this.inappElement.y));
73
71
  };
74
72
  /**
75
73
  * Process border block of the element
@@ -120,7 +118,7 @@ var BlockProcessor = /** @class */ (function () {
120
118
  * Process transform block of the element
121
119
  */
122
120
  BlockProcessor.prototype.processTransformBlock = function () {
123
- var transform = this.inappElement.trf;
121
+ var transform = new Transform(this.inappElement.trf);
124
122
  if (!transform) {
125
123
  return;
126
124
  }
@@ -133,13 +131,19 @@ var BlockProcessor = /** @class */ (function () {
133
131
  */
134
132
  BlockProcessor.prototype.registerAction = function () {
135
133
  var action = this.inappElement.clc;
136
- if (!action) {
134
+ if (!action || Object.keys(action).length === 0) {
137
135
  return;
138
136
  }
139
137
  this.inappHTMLEl.addEventListener('click', function (event) {
140
138
  event.stopPropagation();
141
139
  new ClickActionExecutor(action).execute();
142
140
  });
141
+ if (!(this.inappElement instanceof Container)) {
142
+ this.renderer.setStyle(this.inappHTMLEl, 'cursor', "pointer");
143
+ }
144
+ else if (!(Object.keys(action).length === 1 && action.close !== undefined && action.close !== null)) {
145
+ this.renderer.setStyle(this.inappHTMLEl, 'cursor', "pointer");
146
+ }
143
147
  };
144
148
  /**
145
149
  * Process background block of the element
@@ -150,10 +154,6 @@ var BlockProcessor = /** @class */ (function () {
150
154
  return;
151
155
  }
152
156
  var htmlElement = this.inappHTMLEl;
153
- // For container, the background must be applied to its parent i.e. root container
154
- if (this.inappElement instanceof Container) {
155
- htmlElement = htmlElement.parentElement;
156
- }
157
157
  if (bg.glossy) {
158
158
  // Style for Apple devices
159
159
  this.renderer.setStyle(htmlElement, '-webkit-backdrop-filter', "blur(" + bg.glossy.radius + "px)");
@@ -26,9 +26,6 @@ var ContainerRenderer = /** @class */ (function (_super) {
26
26
  var _this = _super.call(this, parentElement, inappElement) || this;
27
27
  _this.inappHTMLEl = _this.renderer.createElement('div');
28
28
  _this.insertElement();
29
- // Need to figure out the best way of doing this
30
- _this.inappElement.w = 1080;
31
- _this.inappElement.h = 1920;
32
29
  return _this;
33
30
  }
34
31
  /**
@@ -38,7 +35,6 @@ var ContainerRenderer = /** @class */ (function (_super) {
38
35
  ContainerRenderer.prototype.render = function () {
39
36
  this.processCommonBlocks();
40
37
  this.renderer.setStyle(this.inappHTMLEl, 'position', 'relative');
41
- Object.assign(this.inappHTMLEl.style, this.inappElement.getStyles());
42
38
  return this;
43
39
  };
44
40
  return ContainerRenderer;
@@ -35,7 +35,6 @@ var ImageRenderer = /** @class */ (function (_super) {
35
35
  this.renderer.setAttribute(this.inappHTMLEl, 'src', this.inappElement.src);
36
36
  this.renderer.setStyle(this.inappHTMLEl, 'max-width', 'none');
37
37
  this.renderer.setStyle(this.inappHTMLEl, 'max-height', 'none');
38
- this.renderer.setStyle(this.inappHTMLEl, 'display', 'block');
39
38
  this.renderer.setStyle(this.inappHTMLEl, 'margin', '0 auto');
40
39
  this.processCommonBlocks();
41
40
  };
@@ -1,13 +1,14 @@
1
- import { Log } from '../utils/log';
1
+ import { Constants } from '../constants';
2
+ import { Event } from '../models/event/event';
2
3
  import { ImageElement, ShapeElement, TextElement } from '../models/trigger/elements/';
3
4
  import { TriggerData } from '../models/trigger/trigger-data';
5
+ import { TriggerHelper } from '../models/trigger/trigger-helper';
6
+ import { SafeHttpService } from '../services/safe-http-service';
4
7
  import { LocalStorageHelper } from '../utils/local-storage-helper';
5
- import { Constants } from '../constants';
8
+ import { Log } from '../utils/log';
6
9
  import { ImageRenderer, RootContainerRenderer, ShapeRenderer, TextRenderer } from './';
7
10
  import { ContainerRenderer } from './container-renderer';
8
- import { TriggerHelper } from '../models/trigger/trigger-helper';
9
- import { SafeHttpService } from '../services/safe-http-service';
10
- import { Event } from '../models/event/event';
11
+ import { Renderer } from './renderer';
11
12
  /**
12
13
  * Renders In App trigger
13
14
  *
@@ -21,8 +22,9 @@ var InAppRenderer = /** @class */ (function () {
21
22
  * @param parent Place the in-app in the given parent instead of the document.body.
22
23
  */
23
24
  function InAppRenderer(parent) {
24
- this.parent = parent;
25
- this.rootContainer = new RootContainerRenderer(parent).render();
25
+ this.renderer = Renderer.get();
26
+ this.parent = parent !== null && parent !== void 0 ? parent : document.body;
27
+ this.renderer.setParentContainer(this.parent);
26
28
  }
27
29
  /**
28
30
  * Renders in-app trigger from payload received
@@ -31,6 +33,8 @@ var InAppRenderer = /** @class */ (function () {
31
33
  InAppRenderer.prototype.render = function (triggerData) {
32
34
  triggerData = new TriggerData(triggerData);
33
35
  this.ian = triggerData.ian;
36
+ this.rootContainer = new RootContainerRenderer(this.parent, this.ian)
37
+ .render();
34
38
  try {
35
39
  this.renderContainer();
36
40
  var event_1 = new Event('CE Trigger Displayed', { 'triggerID': triggerData.id });
@@ -72,9 +76,15 @@ var InAppRenderer = /** @class */ (function () {
72
76
  if (!container) {
73
77
  return;
74
78
  }
79
+ this.renderer.calculateScalingFactor(container.w, container.h);
75
80
  var containerHTMLElement = new ContainerRenderer(this.rootContainer, container)
76
81
  .render()
77
82
  .getHTMLElement();
83
+ // Backward compatibility
84
+ if (!this.ian.gvt) {
85
+ this.ian.gvt = this.ian.cont.getOrigin();
86
+ }
87
+ Object.assign(containerHTMLElement.style, this.ian.getStyles());
78
88
  (_b = this.ian.elems) === null || _b === void 0 ? void 0 : _b.forEach(function (element) {
79
89
  _this.renderElement(containerHTMLElement, element);
80
90
  });
@@ -1,26 +1,5 @@
1
- import { Constants } from '../constants';
2
- import { Renderer } from './renderer';
3
1
  export { TextRenderer } from './text-renderer';
4
2
  export { ShapeRenderer } from './shape-renderer';
5
3
  export { ImageRenderer } from './image-renderer';
6
4
  export { RootContainerRenderer } from './root-container-renderer';
7
5
  export { IFrameRenderer } from './iFrame-renderer';
8
- /**
9
- * Calculate scaling factor according to parent most container where the in-app's root container will be rendered.
10
- * @return number scaling factor
11
- */
12
- export function getScalingFactor() {
13
- var screenWidth = Renderer.get().getWidth();
14
- var screenHeight = Renderer.get().getHeight();
15
- var scalingFactor;
16
- if (screenWidth < screenHeight) {
17
- var shortEdge = Math.min(Constants.CANVAS_WIDTH, Constants.CANVAS_HEIGHT);
18
- scalingFactor = screenWidth / shortEdge;
19
- }
20
- else {
21
- var longEdge = Math.max(Constants.CANVAS_WIDTH, Constants.CANVAS_HEIGHT);
22
- scalingFactor = screenHeight / longEdge;
23
- }
24
- // The in-app should not scale beyond 100%
25
- return Math.min(scalingFactor, 1);
26
- }