dialogshift-webchat-sdk 2.10.1 → 2.10.3

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.
@@ -406,7 +406,7 @@ var App = /** @class */ (function () {
406
406
  });
407
407
  };
408
408
  App.prototype.applyConfig = function () {
409
- var _a = this.chatConfig, setUnreadCounter = _a.setUnreadCounter, showTeaserAfter = _a.showTeaserAfter, hideTeaserAfter = _a.hideTeaserAfter, theme = _a.theme, noCookieModeSdk = _a.noCookieModeSdk, forgetCustomerAfterHours = _a.forgetCustomerAfterHours, isChatboxVisible = _a.isChatboxVisible, renderWaButton = _a.renderWaButton, extendedWidth = _a.extendedWidth, bwWaButton = _a.bwWaButton, custidStoreMode = _a.custidStoreMode, loadGaContext = _a.loadGaContext, leftCloseButton = _a.leftCloseButton;
409
+ var _a = this.chatConfig, setUnreadCounter = _a.setUnreadCounter, showTeaserAfter = _a.showTeaserAfter, hideTeaserAfter = _a.hideTeaserAfter, theme = _a.theme, noCookieModeSdk = _a.noCookieModeSdk, forgetCustomerAfterHours = _a.forgetCustomerAfterHours, isChatboxVisible = _a.isChatboxVisible, renderWaButton = _a.renderWaButton, extendedWidth = _a.extendedWidth, bwWaButton = _a.bwWaButton, custidStoreMode = _a.custidStoreMode, loadGaContext = _a.loadGaContext, leftCloseButton = _a.leftCloseButton, iconUrl = _a.iconUrl;
410
410
  if (setUnreadCounter) {
411
411
  this.options.unreadCounter = setUnreadCounter;
412
412
  }
@@ -448,6 +448,9 @@ var App = /** @class */ (function () {
448
448
  if (leftCloseButton) {
449
449
  this.options.leftCloseButton = leftCloseButton;
450
450
  }
451
+ if (iconUrl) {
452
+ this.options.iconUrl = iconUrl;
453
+ }
451
454
  };
452
455
  App.prototype.getWebchatService = function () {
453
456
  return this.webchatService;
@@ -1550,6 +1553,7 @@ var WidgetManager = /** @class */ (function () {
1550
1553
  };
1551
1554
  WidgetManager.prototype.renderChatButton = function (options, chatConfig) {
1552
1555
  var _this = this;
1556
+ var _a;
1553
1557
  var locale = options.locale;
1554
1558
  var buttonText = chatConfig.buttonText, defaultLocale = chatConfig.defaultLocale, effects = chatConfig.effects;
1555
1559
  var content = '';
@@ -1566,6 +1570,7 @@ var WidgetManager = /** @class */ (function () {
1566
1570
  renderTo: this.footerWidget.getBoxElem(),
1567
1571
  visible: options.isButtonVisible,
1568
1572
  effects: effects === null || effects === void 0 ? void 0 : effects.chatButton,
1573
+ iconUrl: (_a = options.iconUrl) !== null && _a !== void 0 ? _a : undefined,
1569
1574
  events: [
1570
1575
  {
1571
1576
  type: 'toggle',
@@ -2861,6 +2866,7 @@ var ChatButtonWidget = /** @class */ (function (_super) {
2861
2866
  function ChatButtonWidget(options) {
2862
2867
  var _this = _super.call(this, options) || this;
2863
2868
  _this.isPressed = false;
2869
+ _this.iconUrl = undefined;
2864
2870
  return _this;
2865
2871
  }
2866
2872
  ChatButtonWidget.prototype.bindEvents = function () {
@@ -2879,12 +2885,18 @@ var ChatButtonWidget = /** @class */ (function (_super) {
2879
2885
  };
2880
2886
  ChatButtonWidget.prototype.render = function () {
2881
2887
  var boxElem = this.getBoxElem();
2882
- var iconContainer = document.createElement('div');
2883
- iconContainer.classList.add(_config_config__WEBPACK_IMPORTED_MODULE_1__.config.buttonIconContainerCls);
2884
- iconContainer.tabIndex = 0;
2885
- iconContainer.innerHTML = _consts__WEBPACK_IMPORTED_MODULE_2__.iconSvg;
2886
- boxElem.appendChild(iconContainer);
2887
- boxElem.classList.add(_config_config__WEBPACK_IMPORTED_MODULE_1__.config.buttonLogoCls);
2888
+ if (this.iconUrl === undefined) {
2889
+ var iconContainer = document.createElement('div');
2890
+ iconContainer.classList.add(_config_config__WEBPACK_IMPORTED_MODULE_1__.config.buttonIconContainerCls);
2891
+ iconContainer.tabIndex = 0;
2892
+ iconContainer.innerHTML = _consts__WEBPACK_IMPORTED_MODULE_2__.iconSvg;
2893
+ boxElem.appendChild(iconContainer);
2894
+ boxElem.classList.add(_config_config__WEBPACK_IMPORTED_MODULE_1__.config.buttonLogoCls);
2895
+ }
2896
+ else {
2897
+ boxElem.style.backgroundColor = '';
2898
+ boxElem.style.background = "url(".concat(this.iconUrl, ")");
2899
+ }
2888
2900
  this.bindEvents();
2889
2901
  _super.prototype.render.call(this);
2890
2902
  };
@@ -2892,7 +2904,7 @@ var ChatButtonWidget = /** @class */ (function (_super) {
2892
2904
  var _this = this;
2893
2905
  if (suppressEvent === void 0) { suppressEvent = false; }
2894
2906
  if (timeout === void 0) { timeout = 100; }
2895
- var isPressed = state === undefined ? !this.isPressed : !!state;
2907
+ var isPressed = state === undefined ? !this.isPressed : state;
2896
2908
  if (isPressed === this.isPressed) {
2897
2909
  return;
2898
2910
  }
@@ -3394,7 +3406,21 @@ var IframeWidget = /** @class */ (function (_super) {
3394
3406
  return this.loaded;
3395
3407
  };
3396
3408
  IframeWidget.prototype.createNode = function () {
3397
- return document.createElement('iframe');
3409
+ var node = document.createElement('iframe');
3410
+ node.sandbox.add('allow-downloads');
3411
+ node.sandbox.add('allow-forms');
3412
+ node.sandbox.add('allow-modals');
3413
+ node.sandbox.add('allow-pointer-lock');
3414
+ node.sandbox.add('allow-popups');
3415
+ node.sandbox.add('allow-popups-to-escape-sandbox');
3416
+ node.sandbox.add('allow-presentation');
3417
+ node.sandbox.add('allow-same-origin');
3418
+ node.sandbox.add('allow-scripts');
3419
+ node.sandbox.add('allow-storage-access-by-user-activation');
3420
+ node.sandbox.add('allow-top-navigation');
3421
+ node.sandbox.add('allow-top-navigation-by-user-activation');
3422
+ node.sandbox.add('allow-top-navigation-to-custom-protocols');
3423
+ return node;
3398
3424
  };
3399
3425
  IframeWidget.prototype.getViewportWidth = function () {
3400
3426
  return Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);