apxor-rtm-ui 0.6.1 → 0.7.1

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.
@@ -6394,7 +6394,8 @@
6394
6394
  BOTTOM_RIGHT: "bottom-right",
6395
6395
  TOP_CENTER: "top-center",
6396
6396
  BOTTOM_CENTER: "bottom-center",
6397
- CENTER: "center"
6397
+ CENTER: "center",
6398
+ FULL_SCREEN: "full-screen"
6398
6399
  };
6399
6400
  var imgWrapperStyles = {
6400
6401
  "margin-left": "marginLeft",
@@ -6404,6 +6405,14 @@
6404
6405
  "align-self": "alignSelf",
6405
6406
  width: "width"
6406
6407
  };
6408
+ var imgWrapperStylesForStories = {
6409
+ "margin-left": "marginLeft",
6410
+ "margin-right": "marginRight",
6411
+ "margin-top": "marginTop",
6412
+ "margin-bottom": "marginBottom",
6413
+ "align-self": "alignSelf",
6414
+ width: "width"
6415
+ };
6407
6416
  var DIRECTION = {
6408
6417
  HORIZONTAL: "horizontal",
6409
6418
  VERTICAL: "vertical"
@@ -6437,7 +6446,7 @@
6437
6446
  var EMBED_CARD_TYPE = {
6438
6447
  cell: "div",
6439
6448
  img: "img",
6440
- text: "div",
6449
+ text: "span",
6441
6450
  button: "button"
6442
6451
  };
6443
6452
 
@@ -6552,7 +6561,7 @@
6552
6561
  * @returns
6553
6562
  */
6554
6563
  var _setFontFaceAtRule = function _setFontFaceAtRule(font) {
6555
- if (!font.source || font.source === "url") {
6564
+ if (!font.source || font.source === "url" || font.source === "name") {
6556
6565
  return [font.family, ""];
6557
6566
  }
6558
6567
  var src;
@@ -6570,6 +6579,15 @@
6570
6579
  return ["".concat(font_family, ", ").concat(fallbackFont), font_face];
6571
6580
  };
6572
6581
 
6582
+ /**
6583
+ * @function getFileExtension
6584
+ * @param {*} filename takes image or video url and returns extension
6585
+ * @returns extension (jpg ,png etc)
6586
+ */
6587
+ function getFileExtension(filename) {
6588
+ return filename.slice((filename.lastIndexOf(".") - 1 >>> 0) + 2);
6589
+ }
6590
+
6573
6591
  /**
6574
6592
  * @function createNewTextElement
6575
6593
  * @description Creates a text element for the given text config. It could either be a title or a description.
@@ -6986,6 +7004,88 @@
6986
7004
  });
6987
7005
  return "\n div .".concat(position, "-buttons-container {\n width:100%;\n display: flex;\n flex-direction:").concat(button_direction === DIRECTION.VERTICAL && position === BUTTON_CONTAINER_POSITION.BOTTOM ? "column" : "row", ";\n justify-content:").concat(justifyContent, ";\n align-items:").concat(button_direction === DIRECTION.HORIZONTAL ? "center" : getButtonPosition(button_alignment), ";\n flex-wrap:wrap;\n }\n ").concat(buttons, "\n ");
6988
7006
  };
7007
+ var setImgAction = function setImgAction(action_config, ActionHandler, uuid, name) {
7008
+ var configType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : EVENT_PREFIX.INAPP;
7009
+ var action = function action() {};
7010
+ var _action = action_config === null || action_config === void 0 ? void 0 : action_config.action;
7011
+ try {
7012
+ switch (_action) {
7013
+ case "done":
7014
+ case "dismiss":
7015
+ action = function action() {
7016
+ ActionHandler.complete(false, "dismiss");
7017
+ window.Apxor.logActionEvent(configType + "img" + "_Clicked", uuid, name);
7018
+ };
7019
+ break;
7020
+ case "redirect":
7021
+ action = function action() {
7022
+ var _window$Apxor;
7023
+ if (((_window$Apxor = window.Apxor) === null || _window$Apxor === void 0 ? void 0 : _window$Apxor.platform) === "ios") {
7024
+ window.Apxor.logActionEvent(configType + "img" + "_Clicked", uuid, name);
7025
+ ActionHandler.complete(false, "redirect");
7026
+ window.Apxor.redirectTo(JSON.stringify(action_config));
7027
+ var type = configType.toLowerCase();
7028
+ window.Apxor.logActionEvent("".concat(type, "dismissed"), uuid, name);
7029
+ } else {
7030
+ ActionHandler.complete(true, "redirect");
7031
+ window.Apxor.redirectTo("IN_APP", uuid, name, "img", JSON.stringify(action_config));
7032
+ }
7033
+ // if (redirectWithin || isExternal) {
7034
+ // window.open(url, redirectWithin ? "_self" : "_blank");
7035
+ // } else {
7036
+ // rtmInstance.logClientEvent("REDIRECT", { url });
7037
+ // }
7038
+ };
7039
+
7040
+ break;
7041
+ case "cancel":
7042
+ action = function action() {
7043
+ ActionHandler.cancel(true, "cancel");
7044
+ ActionHandler._isCancelled = true;
7045
+ window.Apxor.logActionEvent(configType + "img" + "_Clicked", uuid, name);
7046
+ window.Apxor.logActionEvent("walk_through_cancelled", uuid, name);
7047
+ };
7048
+ break;
7049
+ // case "submit":
7050
+ // action = () => {
7051
+ // ActionHandler.complete(false, "submit");
7052
+ // window.Apxor.logActionEvent(
7053
+ // configType + "img" + "_Clicked",
7054
+ // uuid,
7055
+ // name
7056
+ // );
7057
+ // };
7058
+ // break;
7059
+ // case "skip":
7060
+ // action = () => {
7061
+ // ActionHandler.complete(false, "skip");
7062
+ // window.Apxor.logActionEvent(
7063
+ // configType + "img" + "_Clicked",
7064
+ // uuid,
7065
+ // name
7066
+ // );
7067
+ // };
7068
+ // break;
7069
+ case "never":
7070
+ action = function action() {
7071
+ ActionHandler.cancel(true, "cancel");
7072
+ ActionHandler._isCancelled = true;
7073
+ window.Apxor.logActionEvent(configType + "img" + "_Clicked", uuid, name);
7074
+ window.Apxor.neverShow(uuid, name, "IN_APP");
7075
+ window.Apxor.logActionEvent("never_show_clicked", uuid, name);
7076
+ };
7077
+ break;
7078
+ default:
7079
+ action = function action() {
7080
+ ActionHandler.cancel(false, "cancel");
7081
+ window.Apxor.logActionEvent(configType + "img" + "_Clicked", uuid, name);
7082
+ };
7083
+ }
7084
+ } catch (e) {
7085
+ console.error("Error setting actions on the image:" + e);
7086
+ }
7087
+ return action;
7088
+ };
6989
7089
  var generateButtonsFromConfig = function generateButtonsFromConfig() {
6990
7090
  var buttons_config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
6991
7091
  var ActionHandler = arguments.length > 1 ? arguments[1] : undefined;
@@ -7078,8 +7178,8 @@
7078
7178
  break;
7079
7179
  case "redirect":
7080
7180
  action = function action() {
7081
- var _window$Apxor;
7082
- if (((_window$Apxor = window.Apxor) === null || _window$Apxor === void 0 ? void 0 : _window$Apxor.platform) === "ios") {
7181
+ var _window$Apxor2;
7182
+ if (((_window$Apxor2 = window.Apxor) === null || _window$Apxor2 === void 0 ? void 0 : _window$Apxor2.platform) === "ios") {
7083
7183
  window.Apxor.logActionEvent(configType + text + "_Clicked", uuid, name);
7084
7184
  ActionHandler.complete(false, "redirect");
7085
7185
  window.Apxor.redirectTo(JSON.stringify(action_config));
@@ -11660,8 +11760,8 @@
11660
11760
  var _this = this,
11661
11761
  _config$termination;
11662
11762
  _classCallCheck(this, TemplateContent);
11663
- _defineProperty(this, "hJkH", function () {
11664
- var element = _this.jtyP(_this.layout);
11763
+ _defineProperty(this, "KyAi", function () {
11764
+ var element = _this.HjRo(_this.layout);
11665
11765
  //document.body.appendChild(element);
11666
11766
  var tooltipStyles = document.createElement("style");
11667
11767
  tooltipStyles.innerHTML = _this.initialStyles;
@@ -11677,7 +11777,7 @@
11677
11777
  }
11678
11778
  return element;
11679
11779
  });
11680
- _defineProperty(this, "jtyP", function (config) {
11780
+ _defineProperty(this, "HjRo", function (config) {
11681
11781
  var _window$Apxor;
11682
11782
  var element;
11683
11783
  switch (config.type) {
@@ -11808,7 +11908,7 @@
11808
11908
  if (config.absolute_position_children && config.absolute_position_children.length > 0) {
11809
11909
  element.style.position = "relative";
11810
11910
  config.absolute_position_children.forEach(function (childConfig) {
11811
- var childElement = _this.jtyP(childConfig);
11911
+ var childElement = _this.HjRo(childConfig);
11812
11912
  childElement.style.position = "absolute";
11813
11913
  for (var _prop in childConfig.offset) {
11814
11914
  childElement.style[_prop] = childConfig.offset[_prop];
@@ -11826,7 +11926,7 @@
11826
11926
  // }
11827
11927
 
11828
11928
  config.children.forEach(function (childConfig) {
11829
- var childElement = _this.jtyP(childConfig);
11929
+ var childElement = _this.HjRo(childConfig);
11830
11930
  element.appendChild(childElement);
11831
11931
  });
11832
11932
  }
@@ -12729,7 +12829,7 @@
12729
12829
  }, {
12730
12830
  key: "_setInLineContent",
12731
12831
  value: function _setInLineContent() {
12732
- this.inLineContainer = this.templateContent.hJkH();
12832
+ this.inLineContainer = this.templateContent.KyAi();
12733
12833
  }
12734
12834
  }, {
12735
12835
  key: "_setObservors",
@@ -13285,7 +13385,7 @@
13285
13385
  * }
13286
13386
  * }
13287
13387
  */
13288
- var Image = /*#__PURE__*/function () {
13388
+ var Image$1 = /*#__PURE__*/function () {
13289
13389
  function Image() {
13290
13390
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13291
13391
  _classCallCheck(this, Image);
@@ -13296,6 +13396,8 @@
13296
13396
  this.background_image = new BackgroundImage(data.background_image);
13297
13397
  this.enable_border = data.enable_border;
13298
13398
  this.border = new Border(data.border);
13399
+ this.enable_action = data === null || data === void 0 ? void 0 : data.enable_action;
13400
+ if (this.enable_action) this.action = data === null || data === void 0 ? void 0 : data.action;
13299
13401
  }
13300
13402
  _createClass(Image, null, [{
13301
13403
  key: "isEnabled",
@@ -14277,7 +14379,7 @@
14277
14379
  * @description Creates the styles for Marketing message.
14278
14380
  * @returns {string} css styles
14279
14381
  */
14280
- _defineProperty(this, "RiAn", function () {
14382
+ _defineProperty(this, "VrCy", function () {
14281
14383
  if (!_this.enable_marketing) {
14282
14384
  return "";
14283
14385
  }
@@ -14296,7 +14398,7 @@
14296
14398
  * @private
14297
14399
  * @description Sets the marketing content at the end of the Inline
14298
14400
  */
14299
- _defineProperty(this, "YrUN", function () {
14401
+ _defineProperty(this, "wQRV", function () {
14300
14402
  if (_this.enable_marketing) {
14301
14403
  var marketingContainer = document.createElement("div");
14302
14404
  marketingContainer.classList.add("apx-inline-marketing".concat(_this.cssPostFix));
@@ -14358,7 +14460,7 @@
14358
14460
  this.enable_icon = config.enable_icon;
14359
14461
  if (this.enable_icon) this.icon = new Icon(config.icon);
14360
14462
  this.enable_image = config.enable_image;
14361
- if (this.enable_image) this.image = new Image(config.image);
14463
+ if (this.enable_image) this.image = new Image$1(config.image);
14362
14464
  this.enable_video = config.enable_video;
14363
14465
  if (this.enable_video) this.video = new Video(config.video);
14364
14466
  this.enable_title = config.enable_title;
@@ -14776,12 +14878,16 @@
14776
14878
  this._setDimenstionFromResolution(this.video.width, this.video.height, scale, calculateFromHeight);
14777
14879
  }
14778
14880
  } else if (this.enable_icon) {
14779
- if (this.direction.nudge === DIRECTION.VERTICAL) {
14780
- this.inline_width = "".concat(this.getPixelsFromPercentage(this.width, false), "px");
14781
- } else {
14782
- //this.inline_height = `${this.height}%`;
14783
- this.min_width = "".concat(this.getPixelsFromPercentage(this.width, false), "px");
14784
- }
14881
+ this.inline_width = "".concat(this.getPixelsFromPercentage(this.width, false), "px");
14882
+ // if (this.direction.nudge === DIRECTION.VERTICAL) {
14883
+ // this.inline_width = `${this.getPixelsFromPercentage(
14884
+ // this.width,
14885
+ // false
14886
+ // )}px`;
14887
+ // } else {
14888
+ // //this.inline_height = `${this.height}%`;
14889
+ // this.min_width = `${this.getPixelsFromPercentage(this.width, false)}px`;
14890
+ // }
14785
14891
  } else {
14786
14892
  if (this.direction.nudge === DIRECTION.VERTICAL) {
14787
14893
  this.inline_width = "".concat(this.getPixelsFromPercentage(this.width, false), "px");
@@ -14898,7 +15004,7 @@
14898
15004
  if (apxor_tooltip_styles) {
14899
15005
  return;
14900
15006
  }
14901
- var styles = "\n ".concat(this._getCustomFonts(), " \n ").concat(this._getBackgroundContainerStyles(), " \n ").concat(this._getInLineContainerStyles(), " \n ").concat(this._getScrollStyles(), " \n ").concat(this._getControlsStyles(), " \n ").concat(this._getInLineMediaContainerStyles(), "\n ").concat(this._getInLineNonMediaContainerStyles(), "\n ").concat(this._getTextConatinerStyles(), "\n ").concat(this._getTitleStyles(), " \n ").concat(this._getDescriptionStyles(), " \n ").concat(this._getInLineButtonContainerStyles(), " \n ").concat(this._getIconStyles(), " \n ").concat(this._getImageStyles(), " \n ").concat(this._getVideoStyles(), " \n ").concat(this.RiAn(), "\n ").concat(this._getTippyStyles(), "\n ").concat(this._getFooterStyles(), "\n ").concat(this._getProgressBarStyles(), "\n ").concat(this._getBootstrapiconsStyles(), " \n ").replaceAll("\n", "").replace(/[\s]{2,999}/g, "");
15007
+ var styles = "\n ".concat(this._getCustomFonts(), " \n ").concat(this._getBackgroundContainerStyles(), " \n ").concat(this._getInLineContainerStyles(), " \n ").concat(this._getScrollStyles(), " \n ").concat(this._getControlsStyles(), " \n ").concat(this._getInLineMediaContainerStyles(), "\n ").concat(this._getInLineNonMediaContainerStyles(), "\n ").concat(this._getTextConatinerStyles(), "\n ").concat(this._getTitleStyles(), " \n ").concat(this._getDescriptionStyles(), " \n ").concat(this._getInLineButtonContainerStyles(), " \n ").concat(this._getIconStyles(), " \n ").concat(this._getImageStyles(), " \n ").concat(this._getVideoStyles(), " \n ").concat(this.VrCy(), "\n ").concat(this._getTippyStyles(), "\n ").concat(this._getFooterStyles(), "\n ").concat(this._getProgressBarStyles(), "\n ").concat(this._getBootstrapiconsStyles(), " \n ").replaceAll("\n", "").replace(/[\s]{2,999}/g, "");
14902
15008
  var styleNode = document.createElement("style");
14903
15009
  styleNode.setAttribute("apx-tooltip-styles", "");
14904
15010
  styleNode.innerHTML = styles;
@@ -15708,7 +15814,7 @@
15708
15814
  this._setCloseButton();
15709
15815
 
15710
15816
  //Set the Marketing content
15711
- this.YrUN();
15817
+ this.wQRV();
15712
15818
  }
15713
15819
 
15714
15820
  /**
@@ -18553,7 +18659,7 @@
18553
18659
  }, {
18554
18660
  key: "_setInAppModalContent",
18555
18661
  value: function _setInAppModalContent() {
18556
- this.inAppContainer = this.templateContent.hJkH();
18662
+ this.inAppContainer = this.templateContent.KyAi();
18557
18663
  this.inAppContainer.style.zIndex = 99999;
18558
18664
  this.overlayElement.appendChild(this.inAppContainer);
18559
18665
  }
@@ -18701,7 +18807,7 @@
18701
18807
  * @description Creates the styles for Marketing message.
18702
18808
  * @returns {string} css styles
18703
18809
  */
18704
- _defineProperty(this, "RiAn", function () {
18810
+ _defineProperty(this, "VrCy", function () {
18705
18811
  if (!_this.enable_marketing) {
18706
18812
  return "";
18707
18813
  }
@@ -18747,7 +18853,7 @@
18747
18853
  * @private
18748
18854
  * @description Get the response for Form content in the InApp modal.
18749
18855
  */
18750
- _defineProperty(this, "Ghij", function (form_elements) {
18856
+ _defineProperty(this, "UrBX", function (form_elements) {
18751
18857
  var obj = {};
18752
18858
  var callback = "";
18753
18859
  form_elements.forEach(function (element) {
@@ -18787,7 +18893,7 @@
18787
18893
  * @private
18788
18894
  * @description Sets the marketing content at the end of the InApp
18789
18895
  */
18790
- _defineProperty(this, "YrUN", function () {
18896
+ _defineProperty(this, "wQRV", function () {
18791
18897
  if (_this.enable_marketing) {
18792
18898
  var marketingContainer = document.createElement("div");
18793
18899
  marketingContainer.classList.add("apx-inapp-marketing".concat(_this.cssPostFix));
@@ -18827,7 +18933,7 @@
18827
18933
  this.enable_icon = config.enable_icon;
18828
18934
  if (this.enable_icon) this.icon = new Icon(config.icon);
18829
18935
  this.enable_image = config.enable_image;
18830
- if (this.enable_image) this.image = new Image(config.image);
18936
+ if (this.enable_image) this.image = new Image$1(config.image);
18831
18937
  this.enable_video = config.enable_video;
18832
18938
  if (this.enable_video) this.video = new Video(config.video);
18833
18939
  this.enable_title = config.enable_title;
@@ -19040,7 +19146,7 @@
19040
19146
  }, {
19041
19147
  key: "_setStyles",
19042
19148
  value: function _setStyles() {
19043
- var styles = "\n ".concat(this._getCustomFonts(), " \n ").concat(this._getBackgroundContainerStyles(), " \n ").concat(this._getInAppContainerStyles(), " \n ").concat(this._getScrollStyles(), " \n ").concat(this._getControlsStyles(), " \n ").concat(this._getInAppMediaContainerStyles(), "\n ").concat(this._getInAppNonMediaContainerStyles(), "\n ").concat(this._getTextConatinerStyles(), "\n ").concat(this._getTitleStyles(), " \n ").concat(this._getDescriptionStyles(), " \n ").concat(this._getFormStyles(), "\n ").concat(this._getInAppButtonContainerStyles(), "\n ").concat(this._getIconStyles(), " \n ").concat(this._getImageStyles(), " \n ").concat(this._getVideoStyles(), " \n ").concat(this.RiAn(), " \n ").concat(this._getProgressBarStyles(), "\n ").concat(this._getBootstrapiconsStyles(), " \n ").replaceAll("\n", "").replace(/[\s]{2,999}/g, "");
19149
+ var styles = "\n ".concat(this._getCustomFonts(), " \n ").concat(this._getBackgroundContainerStyles(), " \n ").concat(this._getInAppContainerStyles(), " \n ").concat(this._getScrollStyles(), " \n ").concat(this._getControlsStyles(), " \n ").concat(this._getInAppMediaContainerStyles(), "\n ").concat(this._getInAppNonMediaContainerStyles(), "\n ").concat(this._getTextConatinerStyles(), "\n ").concat(this._getTitleStyles(), " \n ").concat(this._getDescriptionStyles(), " \n ").concat(this._getFormStyles(), "\n ").concat(this._getInAppButtonContainerStyles(), "\n ").concat(this._getIconStyles(), " \n ").concat(this._getImageStyles(), " \n ").concat(this._getVideoStyles(), " \n ").concat(this.VrCy(), " \n ").concat(this._getProgressBarStyles(), "\n ").concat(this._getBootstrapiconsStyles(), " \n ").replaceAll("\n", "").replace(/[\s]{2,999}/g, "");
19044
19150
  var styleNode = document.createElement("style");
19045
19151
  styleNode.setAttribute("id", "apxor-style-" + this.configId);
19046
19152
  styleNode.innerHTML = styles;
@@ -19130,6 +19236,9 @@
19130
19236
  case INAPP_POSITION.CENTER:
19131
19237
  positionStylesForContainer = "\n left:50%;\n top:50%;\n -webkit-transform: translate(-50%, -50%);\n -moz-transform: translate(-50%, -50%);\n ";
19132
19238
  break;
19239
+ case INAPP_POSITION.FULL_SCREEN:
19240
+ positionStylesForContainer = "\n top: 0px;\n left: 0px;\n ";
19241
+ break;
19133
19242
  default:
19134
19243
  positionStylesForContainer = "\n left:50%;\n top:50%;\n -webkit-transform: translate(-50%, -50%);\n -moz-transform: translate(-50%, -50%);\n ";
19135
19244
  break;
@@ -19158,7 +19267,7 @@
19158
19267
  flexStylesForContainer = " ".concat(flexStylesForContainer, "\n justify-content:space-evenly;\n align-items:center;\n display:flex;\n ");
19159
19268
  var maxWidth = "",
19160
19269
  maxHeight = "",
19161
- margin = "margin: auto";
19270
+ margin = "margin: auto;";
19162
19271
  if (this.direction.nudge === DIRECTION.HORIZONTAL) {
19163
19272
  if (!(this.enable_image || this.enable_video || this.enable_icon)) {
19164
19273
  maxWidth = "max-width: ".concat(this.max_width);
@@ -19176,7 +19285,7 @@
19176
19285
  }
19177
19286
  //justify-content: space-evenly;
19178
19287
  //align-items:stretch
19179
- var inappContainerStyles = "\n .apx-inapp-container".concat(this.cssPostFix, " {\n height:").concat(this.inapp_height, ";\n width:").concat(this.inapp_width, ";\n background-color:").concat(this.background_color, ";\n z-index:9999;\n opacity:0;\n transition:all .5s cubic-bezier(.96,.23,.07,.8);\n position:fixed;\n visibility:hidden;\n\n ").concat(minWidthStyle, "\n ").concat(flexStylesForContainer, "\n ").concat(paddingStylesForContainer, "\n ").concat(borderStylesForContainer, "\n ").concat(gradientStylesForContainer, "\n ").concat(shadowStylesForContainer, "\n ").concat(positionStylesForContainer, "\n ").concat(maxWidth, "\n ").concat(maxHeight, "\n ").concat(margin, "\n }\n \n .apx-inapp-container").concat(this.cssPostFix, ".open{\n opacity:1;\n visibility:visible;\n }\n ");
19288
+ var inappContainerStyles = "\n .apx-inapp-container".concat(this.cssPostFix, " {\n height:").concat(this.position.position === INAPP_POSITION.FULL_SCREEN ? "100%" : this.inapp_height, ";\n width:").concat(this.position.position === INAPP_POSITION.FULL_SCREEN ? "100%" : this.inapp_width, ";\n background-color:").concat(this.background_color, ";\n z-index:9999;\n opacity:0;\n transition:all .5s cubic-bezier(.96,.23,.07,.8);\n position:fixed;\n visibility:hidden;\n\n ").concat(minWidthStyle, "\n ").concat(flexStylesForContainer, "\n ").concat(paddingStylesForContainer, "\n ").concat(borderStylesForContainer, "\n ").concat(gradientStylesForContainer, "\n ").concat(shadowStylesForContainer, "\n ").concat(positionStylesForContainer, "\n ").concat(maxWidth, "\n ").concat(maxHeight, "\n ").concat(margin, "\n ").concat(this.position.position === INAPP_POSITION.FULL_SCREEN ? "box-sizing: border-box" : "", "\n }\n \n .apx-inapp-container").concat(this.cssPostFix, ".open{\n opacity:1;\n visibility:visible;\n }\n ");
19180
19289
  return inappContainerStyles;
19181
19290
  }
19182
19291
 
@@ -19229,7 +19338,7 @@
19229
19338
  }, {
19230
19339
  key: "_getInAppMediaContainerStyles",
19231
19340
  value: function _getInAppMediaContainerStyles() {
19232
- var inappMediaContainerStyles = "\n .apx-inapp-media-container".concat(this.cssPostFix, "{\n ").concat(this.enable_icon ? "align-self:".concat(this.icon.alignment, ";") : "", "\n ").concat(this.enable_image || this.enable_video ? "display:flex;" : "", "\n }");
19341
+ var inappMediaContainerStyles = "\n .apx-inapp-media-container".concat(this.cssPostFix, "{\n ").concat(this.enable_icon ? "align-self:".concat(this.icon.alignment, ";") : "", "\n ").concat(this.enable_image || this.enable_video ? "display:flex;" : "", "\n ").concat(this.position.position === INAPP_POSITION.FULL_SCREEN && (this.enable_image || this.enable_video) ? "flex-grow:1" : "", "\n }");
19233
19342
  return inappMediaContainerStyles;
19234
19343
  }
19235
19344
 
@@ -19406,7 +19515,7 @@
19406
19515
  if (this.image.enable_border) {
19407
19516
  imageBorderStyles = "\n border-radius:".concat(this.image.border.radius, "%;\n border:").concat(this.image.border.width, "px ").concat(this.image.border.style, " ").concat(this.image.border.color, ";\n ");
19408
19517
  }
19409
- imageStyles = "\n .apx-inapp-image".concat(this.cssPostFix, "{\n height: ").concat(this.media_height, ";\n width: ").concat(this.media_width, ";\n ").concat(imageBorderStyles, "\n }\n ");
19518
+ imageStyles = "\n .apx-inapp-image".concat(this.cssPostFix, "{\n height: ").concat(this.position.position === INAPP_POSITION.FULL_SCREEN ? "100%" : this.media_height, ";\n width: ").concat(this.position.position === INAPP_POSITION.FULL_SCREEN ? "100%" : this.media_width, ";\n ").concat(imageBorderStyles, "\n ").concat(this.position.position === INAPP_POSITION.FULL_SCREEN ? "box-sizing: border-box;" : "", "\n }\n ");
19410
19519
  }
19411
19520
  }
19412
19521
  return imageStyles;
@@ -19517,7 +19626,7 @@
19517
19626
  this._setCloseButton();
19518
19627
 
19519
19628
  //Set the Marketing content
19520
- this.YrUN();
19629
+ this.wQRV();
19521
19630
  }
19522
19631
 
19523
19632
  /**
@@ -19560,15 +19669,42 @@
19560
19669
  }, {
19561
19670
  key: "_setImageOptions",
19562
19671
  value: function _setImageOptions() {
19672
+ var _this4 = this;
19563
19673
  if (this.enable_image) {
19674
+ var action;
19675
+ if (this.image.enable_action) {
19676
+ var overlay = this.overlayElement;
19677
+ var actionCallback = function actionCallback(isCancelled, action) {
19678
+ clearTimeout(_this4.terminationTimeoutId);
19679
+ _this4.closeCallback(overlay, action, "new-inline".concat(_this4.cssPostFix), _this4.closeListener, _this4.redirectionListener);
19680
+ };
19681
+ var next_Callback = function next_Callback(id, action) {
19682
+ actionCallback(false, "next");
19683
+ _this4.stepperCallBack(id, action);
19684
+ };
19685
+ var prev_Callback = function prev_Callback(id, action) {
19686
+ actionCallback(false, "prev");
19687
+ _this4.stepperCallBack(id, action);
19688
+ };
19689
+ var actionHandler = {
19690
+ next: next_Callback,
19691
+ prev: prev_Callback,
19692
+ complete: actionCallback,
19693
+ cancel: actionCallback,
19694
+ _isCancelled: false,
19695
+ action: ""
19696
+ };
19697
+ action = setImgAction(this.image.action, actionHandler, this.configId, this.name);
19698
+ }
19564
19699
  if (this.image.enable_background_image) {
19565
19700
  this.inAppContainer.classList.add("apx-inapp-image".concat(this.cssPostFix));
19566
19701
  } else {
19567
- //const imgDiv = document.createElement("div");
19568
19702
  var imgElement = document.createElement("img");
19569
19703
  imgElement.src = this.image.path;
19570
19704
  imgElement.classList.add("apx-inapp-image".concat(this.cssPostFix));
19571
- //imgDiv.appendChild(imgElement);
19705
+ if (this.image.enable_action) imgElement.onclick = function () {
19706
+ return action();
19707
+ };
19572
19708
  this.mediaContainer.appendChild(imgElement);
19573
19709
  }
19574
19710
  }
@@ -19708,7 +19844,7 @@
19708
19844
  * @description Sets the form content in the InApp modal.
19709
19845
  */
19710
19846
  function _setFormContent() {
19711
- var _this4 = this;
19847
+ var _this5 = this;
19712
19848
  if (this.enable_form) {
19713
19849
  var _this$form$elements;
19714
19850
  var formContainer = document.createElement("form");
@@ -19722,14 +19858,14 @@
19722
19858
  var form = document.querySelector(".apx-inapp-form-container".concat(this.cssPostFix));
19723
19859
  form.addEventListener("submit", function (e) {
19724
19860
  e.preventDefault();
19725
- var _this4$generateRespon = _this4.Ghij(_this4.form.elements),
19726
- obj = _this4$generateRespon.obj,
19727
- callback = _this4$generateRespon.callback;
19861
+ var _this5$generateRespon = _this5.UrBX(_this5.form.elements),
19862
+ obj = _this5$generateRespon.obj,
19863
+ callback = _this5$generateRespon.callback;
19728
19864
  var evalString = "(obj)=>" + callback + "(obj)";
19729
19865
  var evalFunction = eval(evalString);
19730
19866
  evalFunction(obj);
19731
- clearTimeout(_this4.terminationTimeoutId);
19732
- _this4.closeCallback(_this4.overlayElement, "dismiss", ".apx-inapp-container".concat(_this4.cssPostFix), _this4.closeListener, _this4.redirectionListener);
19867
+ clearTimeout(_this5.terminationTimeoutId);
19868
+ _this5.closeCallback(_this5.overlayElement, "dismiss", ".apx-inapp-container".concat(_this5.cssPostFix), _this5.closeListener, _this5.redirectionListener);
19733
19869
  });
19734
19870
  }
19735
19871
  }
@@ -19829,23 +19965,23 @@
19829
19965
  }, {
19830
19966
  key: "_setButtons",
19831
19967
  value: function _setButtons(position) {
19832
- var _this5 = this;
19968
+ var _this6 = this;
19833
19969
  if (!this.enable_buttons) {
19834
19970
  return;
19835
19971
  }
19836
19972
  if (position === BUTTON_CONTAINER_POSITION.TOP && this.buttons.enable_top || position === BUTTON_CONTAINER_POSITION.CENTER && this.buttons.enable_center || position === BUTTON_CONTAINER_POSITION.BOTTOM && this.buttons.enable_bottom) {
19837
19973
  var overlay = this.overlayElement;
19838
19974
  var actionCallback = function actionCallback(isCancelled, action) {
19839
- clearTimeout(_this5.terminationTimeoutId);
19840
- _this5.closeCallback(overlay, action, "new-inline".concat(_this5.cssPostFix), _this5.closeListener, _this5.redirectionListener);
19975
+ clearTimeout(_this6.terminationTimeoutId);
19976
+ _this6.closeCallback(overlay, action, "new-inline".concat(_this6.cssPostFix), _this6.closeListener, _this6.redirectionListener);
19841
19977
  };
19842
19978
  var next_Callback = function next_Callback(id, action) {
19843
19979
  actionCallback(false, "next");
19844
- _this5.stepperCallBack(id, action);
19980
+ _this6.stepperCallBack(id, action);
19845
19981
  };
19846
19982
  var prev_Callback = function prev_Callback(id, action) {
19847
19983
  actionCallback(false, "prev");
19848
- _this5.stepperCallBack(id, action);
19984
+ _this6.stepperCallBack(id, action);
19849
19985
  };
19850
19986
  var actionHandler = {
19851
19987
  next: next_Callback,
@@ -19887,7 +20023,7 @@
19887
20023
  }, {
19888
20024
  key: "_setCloseButton",
19889
20025
  value: function _setCloseButton() {
19890
- var _this6 = this;
20026
+ var _this7 = this;
19891
20027
  if (this.enable_close_button) {
19892
20028
  var closeButton = document.createElement("span");
19893
20029
  // Close button SVG is decided based on the type of the button in the config.
@@ -19904,13 +20040,13 @@
19904
20040
  }
19905
20041
  closeButton.classList.add("apx-inapp-close".concat(this.cssPostFix));
19906
20042
  closeButton.addEventListener("click", function () {
19907
- if (_this6.close_button.action === "dismiss") {
19908
- window.Apxor.logActionEvent(EVENT_PREFIX.INAPP + "InAppXIconClicked" + "_Clicked", _this6.configId, _this6.name);
19909
- } else if (_this6.close_button.action === "cancel") {
19910
- window.Apxor.logActionEvent("walk_through_cancelled", _this6.configId, _this6.name);
20043
+ if (_this7.close_button.action === "dismiss") {
20044
+ window.Apxor.logActionEvent(EVENT_PREFIX.INAPP + "InAppXIconClicked" + "_Clicked", _this7.configId, _this7.name);
20045
+ } else if (_this7.close_button.action === "cancel") {
20046
+ window.Apxor.logActionEvent("walk_through_cancelled", _this7.configId, _this7.name);
19911
20047
  }
19912
- clearTimeout(_this6.terminationTimeoutId);
19913
- _this6.closeCallback(_this6.overlayElement, _this6.close_button.action, ".apx-inapp-container".concat(_this6.cssPostFix), _this6.closeListener, _this6.redirectionListener);
20048
+ clearTimeout(_this7.terminationTimeoutId);
20049
+ _this7.closeCallback(_this7.overlayElement, _this7.close_button.action, ".apx-inapp-container".concat(_this7.cssPostFix), _this7.closeListener, _this7.redirectionListener);
19914
20050
  });
19915
20051
  this.direction.non_media === DIRECTION.VERTICAL || this.direction.nudge === DIRECTION.VERTICAL ? this.inAppContainer.appendChild(closeButton) : this.buttonContainer.appendChild(closeButton);
19916
20052
  }
@@ -19924,10 +20060,10 @@
19924
20060
  * @description If the auto dismiss is enabled, sets the timeout to call the InApp close.
19925
20061
  */
19926
20062
  function _setAutoTerminate() {
19927
- var _this7 = this;
20063
+ var _this8 = this;
19928
20064
  if (this.terminationConfig.auto_dismiss === true) {
19929
20065
  this.terminationTimeoutId = window.setTimeout(function () {
19930
- _this7.closeCallback(_this7.overlayElement, "dismiss", ".apx-inapp-container".concat(_this7.cssPostFix), _this7.closeListener, _this7.redirectionListener);
20066
+ _this8.closeCallback(_this8.overlayElement, "dismiss", ".apx-inapp-container".concat(_this8.cssPostFix), _this8.closeListener, _this8.redirectionListener);
19931
20067
  }, this.terminationConfig.duration);
19932
20068
  }
19933
20069
  }
@@ -20080,7 +20216,7 @@
20080
20216
  };
20081
20217
  } else {
20082
20218
  // As the video player is hidden by default, unhide if the mode is not PIP.
20083
- _this.qlGO();
20219
+ _this.lZpS();
20084
20220
  }
20085
20221
  _this.showCallback();
20086
20222
  } catch (e) {
@@ -20101,7 +20237,7 @@
20101
20237
  * For portrait - width is set to 50% of the screen and height is auto adjusted based on resolution.
20102
20238
  * For landscape - height is set to 50% of the screen and width is auto adjusted based on resolution.
20103
20239
  */
20104
- _defineProperty(this, "Vjvf", function () {
20240
+ _defineProperty(this, "Bntg", function () {
20105
20241
  var _getHeightWidthFromRe = getHeightWidthFromResolution(_this.video, 1),
20106
20242
  width = _getHeightWidthFromRe.width,
20107
20243
  height = _getHeightWidthFromRe.height;
@@ -20113,7 +20249,7 @@
20113
20249
  * @private
20114
20250
  * @description Removes the video player style element.
20115
20251
  */
20116
- _defineProperty(this, "MXZq", function () {
20252
+ _defineProperty(this, "mCTB", function () {
20117
20253
  var playerStyles = document.getElementById("apx-mpl-styles");
20118
20254
  if (playerStyles) {
20119
20255
  playerStyles.remove();
@@ -20124,7 +20260,7 @@
20124
20260
  * @private
20125
20261
  * @description Attach listeners on the video controls
20126
20262
  */
20127
- _defineProperty(this, "SZZs", function () {
20263
+ _defineProperty(this, "vJMI", function () {
20128
20264
  // Listener for the video end. Display the CTA's when the video ends.
20129
20265
  _this.videoElement.addEventListener("ended", function () {
20130
20266
  var ctaButtons = document.getElementById("apx-cta-btn");
@@ -20239,7 +20375,7 @@
20239
20375
  * @private
20240
20376
  * @description Attach listeners for the PIP toggle. i.e. for the PIP enter and PIP exit
20241
20377
  */
20242
- _defineProperty(this, "ULkp", function () {
20378
+ _defineProperty(this, "sHYh", function () {
20243
20379
  var _this$terminationConf;
20244
20380
  if (_this.mode === "PIP" && !((_this$terminationConf = _this.terminationConfig) !== null && _this$terminationConf !== void 0 && _this$terminationConf.auto_dismiss)) {
20245
20381
  // On Exit of the PIP,
@@ -20279,7 +20415,7 @@
20279
20415
  * @private Sets the custom controls on the video player.
20280
20416
  * PIP and close are the custom controls that are created and positions on the video.
20281
20417
  */
20282
- _defineProperty(this, "FYKO", function () {
20418
+ _defineProperty(this, "WaDM", function () {
20283
20419
  _this.enable_close_button;
20284
20420
  if (_this.enable_close_button) {
20285
20421
  var closeButton = document.createElement("span");
@@ -20326,21 +20462,21 @@
20326
20462
  * @function hideVideoPlayer
20327
20463
  * @description Sets the visibility of the video player to hidden.
20328
20464
  */
20329
- _defineProperty(this, "rupR", function () {
20465
+ _defineProperty(this, "TNFE", function () {
20330
20466
  _this.videoPlayer.classList.add("apx-video-hide-elmt".concat(_this.cssPostFix));
20331
20467
  });
20332
20468
  /**
20333
20469
  * @function unhideVideoPlayer
20334
20470
  * @description Unhides video player.
20335
20471
  */
20336
- _defineProperty(this, "qlGO", function () {
20472
+ _defineProperty(this, "lZpS", function () {
20337
20473
  _this.videoPlayer.classList.remove("apx-video-hide-elmt".concat(_this.cssPostFix));
20338
20474
  });
20339
20475
  /**
20340
20476
  * @function getVideoElement
20341
20477
  * @returns {HTMLElement} Video ekement
20342
20478
  */
20343
- _defineProperty(this, "UFZT", function () {
20479
+ _defineProperty(this, "FXhx", function () {
20344
20480
  return _this.videoElement;
20345
20481
  });
20346
20482
  this.videoPlayer = null;
@@ -20392,7 +20528,7 @@
20392
20528
  this.videoPlayer.style.backgroundColor = this.bg_color;
20393
20529
 
20394
20530
  // Video has a resolution, not deviating from the resolution set the height and width.
20395
- this.Vjvf();
20531
+ this.Bntg();
20396
20532
  //Generate the styles and add them to the document head.
20397
20533
  this._setVideoPlayerStyles();
20398
20534
  //Set the position of the video player with in the 5 possible positions.
@@ -20400,16 +20536,16 @@
20400
20536
  //Create a video element,set the source and add to the container.
20401
20537
  this._setPlayerContent();
20402
20538
  //Set the listeners on the video control buttons.
20403
- this.SZZs();
20539
+ this.vJMI();
20404
20540
  //Attach listeners for the PIP toggle. i.e. for the PIP enter and PIP exit
20405
- this.ULkp();
20541
+ this.sHYh();
20406
20542
  //Set the custom close and PIP controls. Not using the defaults from the html video element.
20407
20543
  //Reason - We want to position them at the top right and left positions.
20408
- this.FYKO();
20544
+ this.WaDM();
20409
20545
  //Generate and postion the CTA buttons on the video. By default hidden, visible only when video is completed
20410
20546
  this._setButtons(BUTTON_CONTAINER_POSITION.CENTER);
20411
20547
  //Hide the video player. Display it based on the video mode. Videoplayer for "video" mode and a direct PIP for "PIP" mode.
20412
- this.rupR();
20548
+ this.TNFE();
20413
20549
  //If the auto dismiss is enabled, sets the timeout to call the InApp close.
20414
20550
  this._setAutoTerminate();
20415
20551
  document.body.appendChild(this.videoPlayer);
@@ -20524,7 +20660,7 @@
20524
20660
  }
20525
20661
  }
20526
20662
  this.videoPlayer.remove();
20527
- this.MXZq();
20663
+ this.mCTB();
20528
20664
  if (closeButtonName !== "auto_dismiss") {
20529
20665
  var _window$ApxorRTM9;
20530
20666
  (_window$ApxorRTM9 = window.ApxorRTM) === null || _window$ApxorRTM9 === void 0 || _window$ApxorRTM9.logEvent("apx_video_inapp_close_button_clicked", {
@@ -20594,7 +20730,7 @@
20594
20730
  replayCount: _this3.replayCount
20595
20731
  });
20596
20732
  _this3.videoPlayer.remove();
20597
- _this3.MXZq();
20733
+ _this3.mCTB();
20598
20734
  _this3.hideCallback();
20599
20735
  } catch (e) {
20600
20736
  console.log("Can't close the video player\n".concat(e));
@@ -20681,17 +20817,23 @@
20681
20817
 
20682
20818
  var EmbedCards = /*#__PURE__*/_createClass(function EmbedCards(_config, configId, name, showCallback, closeCallback) {
20683
20819
  var _this = this,
20820
+ _config$wait_interval,
20684
20821
  _config$termination;
20685
20822
  _classCallCheck(this, EmbedCards);
20686
20823
  _defineProperty(this, "showEmbedCards", function () {
20687
20824
  try {
20688
20825
  var _window;
20689
20826
  (_window = window) === null || _window === void 0 || (_window = _window.ApxorLogger) === null || _window === void 0 || _window.debug("called showEmbedCards");
20690
- var element = _this.QrCq(_this.layout);
20691
- _this.GVvf();
20827
+ var element = _this.VvNT(_this.layout);
20828
+ _this.XCRi();
20692
20829
  window.onresize = function () {
20693
- _this.Kitu();
20830
+ _this.NiOI();
20694
20831
  };
20832
+ _this.imageElements.forEach(function (img) {
20833
+ img.addEventListener("error", function () {
20834
+ _this.YaYk("provided image doesn't exists");
20835
+ });
20836
+ });
20695
20837
  var rootContainer = document.createElement("div");
20696
20838
  rootContainer.style.display = "flex";
20697
20839
  rootContainer.style.justifyContent = "center";
@@ -20700,7 +20842,7 @@
20700
20842
  var styleElement = document.createElement("style");
20701
20843
  styleElement.innerHTML = _this.styleContent;
20702
20844
  document.head.appendChild(styleElement);
20703
- _this.QOPs(_this.termination);
20845
+ _this.SafO(_this.termination);
20704
20846
  try {
20705
20847
  eval(_this.script);
20706
20848
  } catch (e) {
@@ -20708,55 +20850,44 @@
20708
20850
  console.log("found error while executing script: ".concat(e));
20709
20851
  (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.ApxorLogger) === null || _window2 === void 0 || _window2.error("found error while executing script: ".concat(e === null || e === void 0 ? void 0 : e.name, " ").concat(e === null || e === void 0 ? void 0 : e.message));
20710
20852
  }
20711
- var videoStatusCheck = function videoStatusCheck() {
20712
- _this.intervalToCheckVideoStatus = setInterval(function () {
20713
- _this.waitInterval = _this.waitInterval - 1;
20714
- if (_this.waitInterval === 0) {
20715
- var _window$ApxorRTM, _window3;
20716
- clearInterval(_this.intervalToCheckVideoStatus);
20717
- (_window$ApxorRTM = window.ApxorRTM) === null || _window$ApxorRTM === void 0 || _window$ApxorRTM.logEvent("apx_nudge_not_shown", {
20718
- campaignName: _this.name,
20719
- id: _this.configId,
20720
- apx_nudge_type: "sticky_card",
20721
- apx_notshown_type: "error",
20722
- apx_reason: "provided video doesn't exists"
20723
- });
20724
- window.onresize = null;
20725
- (_window3 = window) === null || _window3 === void 0 || (_window3 = _window3.ApxorWidget) === null || _window3 === void 0 || _window3.removeEmbedCard(_this.configId);
20726
- _this.waitInterval = 30;
20727
- }
20728
- if (_this.BhLQ()) {
20729
- _this.waitInterval = 30;
20730
- _this.Kitu();
20731
- clearInterval(_this.intervalToCheckVideoStatus);
20853
+ _this.intervalToCheckMediaLoadingStatus = setInterval(function () {
20854
+ _this.wait_interval -= 1;
20855
+ if (_this.wait_interval <= 0) {
20856
+ _this.YaYk("provided media doesn't exists");
20857
+ } else {
20858
+ if (_this.PXQj() && _this.DZYh()) {
20859
+ _this.NiOI();
20860
+ clearInterval(_this.intervalToCheckMediaLoadingStatus);
20732
20861
  }
20733
- }, 100);
20734
- };
20735
- _this.intervalToCheckImgStatus = setInterval(function () {
20736
- _this.waitInterval = _this.waitInterval - 1;
20737
- if (_this.waitInterval === 0) {
20738
- clearInterval(_this.intervalToCheckImgStatus);
20739
- _this.waitInterval = 30;
20740
- }
20741
- if (_this.wMuZ()) {
20742
- _this.waitInterval = 30;
20743
- clearInterval(_this.intervalToCheckImgStatus);
20744
- _this.videoElements.length > 0 ? videoStatusCheck() : _this.Kitu();
20745
20862
  }
20746
20863
  }, 100);
20747
20864
  } catch (e) {
20748
- var _window4;
20865
+ var _window3;
20749
20866
  console.log("failed while creating embed card with error ".concat(e));
20750
- (_window4 = window) === null || _window4 === void 0 || (_window4 = _window4.ApxorLogger) === null || _window4 === void 0 || _window4.error("failed while creating embed card with error: ".concat(e === null || e === void 0 ? void 0 : e.name, " ").concat(e === null || e === void 0 ? void 0 : e.message));
20867
+ (_window3 = window) === null || _window3 === void 0 || (_window3 = _window3.ApxorLogger) === null || _window3 === void 0 || _window3.error("failed while creating embed card with error: ".concat(e === null || e === void 0 ? void 0 : e.name, " ").concat(e === null || e === void 0 ? void 0 : e.message));
20751
20868
  }
20752
20869
  });
20753
- _defineProperty(this, "GVvf", function () {
20870
+ _defineProperty(this, "YaYk", function (reason) {
20871
+ var _window$ApxorRTM, _window4;
20872
+ !_this.loggedNudgeNotShownEvent && ((_window$ApxorRTM = window.ApxorRTM) === null || _window$ApxorRTM === void 0 ? void 0 : _window$ApxorRTM.logEvent("apx_nudge_not_shown", {
20873
+ campaignName: _this.name,
20874
+ id: _this.configId,
20875
+ apx_nudge_type: "sticky_card",
20876
+ apx_notshown_type: "error",
20877
+ apx_reason: reason
20878
+ }));
20879
+ _this.loggedNudgeNotShownEvent = true;
20880
+ window.onresize = null;
20881
+ clearInterval(_this.intervalToCheckMediaLoadingStatus);
20882
+ (_window4 = window) === null || _window4 === void 0 || (_window4 = _window4.ApxorWidget) === null || _window4 === void 0 || _window4.removeEmbedCard(_this.configId);
20883
+ });
20884
+ _defineProperty(this, "XCRi", function () {
20754
20885
  var EmbeddedCardsStyles = document.createElement("style");
20755
20886
  EmbeddedCardsStyles.innerHTML = _this.initialStyles;
20756
20887
  EmbeddedCardsStyles.setAttribute("apx-tooltip-styles", "");
20757
20888
  document.head.appendChild(EmbeddedCardsStyles);
20758
20889
  });
20759
- _defineProperty(this, "QrCq", function (config) {
20890
+ _defineProperty(this, "VvNT", function (config) {
20760
20891
  var _window$Apxor;
20761
20892
  var element;
20762
20893
  switch (config.type) {
@@ -20948,7 +21079,7 @@
20948
21079
  if (config.absolute_position_children && config.absolute_position_children.length > 0) {
20949
21080
  element.style.position = "relative";
20950
21081
  config.absolute_position_children.forEach(function (childConfig) {
20951
- var childElement = _this.jtyP(childConfig);
21082
+ var childElement = _this.HjRo(childConfig);
20952
21083
  childElement.style.position = "absolute";
20953
21084
  for (var _prop in childConfig.offset) {
20954
21085
  childElement.style[_prop] = childConfig.offset[_prop];
@@ -20966,7 +21097,7 @@
20966
21097
  // }
20967
21098
 
20968
21099
  config.children.forEach(function (childConfig) {
20969
- var childElement = _this.QrCq(childConfig);
21100
+ var childElement = _this.VvNT(childConfig);
20970
21101
  element.appendChild(childElement);
20971
21102
  });
20972
21103
  }
@@ -20992,7 +21123,7 @@
20992
21123
  }
20993
21124
  return element;
20994
21125
  });
20995
- _defineProperty(this, "QOPs", function (config) {
21126
+ _defineProperty(this, "SafO", function (config) {
20996
21127
  config.forEach(function (id) {
20997
21128
  var element = document.getElementById(id);
20998
21129
  if (element) {
@@ -21000,17 +21131,21 @@
21000
21131
  }
21001
21132
  });
21002
21133
  });
21003
- _defineProperty(this, "wMuZ", function () {
21134
+ _defineProperty(this, "DZYh", function () {
21135
+ //This logic is to make sure that image has loaded, it doesn't check whether image is broken
21136
+ //refer: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/complete#value
21137
+ if (_this.imageElements.length === 0) return true;
21004
21138
  return _this.imageElements.every(function (img) {
21005
21139
  return img.complete;
21006
21140
  });
21007
21141
  });
21008
- _defineProperty(this, "BhLQ", function () {
21142
+ _defineProperty(this, "PXQj", function () {
21143
+ if (_this.videoElements.length === 0) return true;
21009
21144
  return _this.videoElements.every(function (video) {
21010
21145
  return video.readyState >= 3;
21011
21146
  });
21012
21147
  });
21013
- _defineProperty(this, "Kitu", function () {
21148
+ _defineProperty(this, "NiOI", function () {
21014
21149
  var _window6, _window7;
21015
21150
  var width = window.document.querySelector("html").offsetWidth;
21016
21151
  var height = window.document.querySelector("html").offsetHeight;
@@ -21027,29 +21162,1602 @@
21027
21162
  this.closeCallback = closeCallback;
21028
21163
  this.layout = _config.layout;
21029
21164
  this.styleContent = _config.css;
21165
+ this.wait_interval = (_config$wait_interval = _config === null || _config === void 0 ? void 0 : _config.wait_interval) !== null && _config$wait_interval !== void 0 ? _config$wait_interval : 5000 / 100;
21030
21166
  this.termination = (_config$termination = _config.termination) !== null && _config$termination !== void 0 ? _config$termination : [];
21031
21167
  this.script = _config.script;
21032
21168
  this.initialStyles = "";
21033
21169
  this.imageElements = [];
21034
21170
  this.videoElements = [];
21035
- this.intervalToCheckImgStatus;
21036
- this.waitInterval = 30;
21171
+ this.intervalToCheckMediaLoadingStatus = null;
21037
21172
  this.loggedNudgeShownEvent = false;
21173
+ this.loggedNudgeNotShownEvent = false;
21038
21174
  });
21039
21175
 
21176
+ /**
21177
+ * @constructor ProgressBar
21178
+ * @example
21179
+ * Example of a ProgressBar model is
21180
+ *
21181
+ * progress_bar: {
21182
+ * seen_color : #e0d210,
21183
+ * unseen_color : #ffffff,
21184
+ * }
21185
+ */
21186
+ var ProgressBar$1 = /*#__PURE__*/_createClass(function ProgressBar() {
21187
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21188
+ _classCallCheck(this, ProgressBar);
21189
+ this.seen_color = getColorOrDefault(data === null || data === void 0 ? void 0 : data.seen_color, "#FFFFFF");
21190
+ this.unseen_color = getColorOrDefault(data === null || data === void 0 ? void 0 : data.unseen_color, "#000000");
21191
+ });
21192
+
21193
+ var Stories = /*#__PURE__*/function () {
21194
+ function Stories(_config, configId, name, position, slidesSeenCount, view_id, showCallback, closeCallback) {
21195
+ var _this = this;
21196
+ _classCallCheck(this, Stories);
21197
+ _defineProperty(this, "showStories", function () {
21198
+ _this.storyContainer = document.createElement("div");
21199
+ _this.storyContainer.classList.add("pause");
21200
+ _this.storyContainer.style = "height:100%;display:flex;align-items:center;";
21201
+ _this.progressContainer = document.createElement("div");
21202
+ _this._getStoriesStyles();
21203
+ _this.progressContainer.classList.add("progress-container");
21204
+
21205
+ // Create custom loader element
21206
+ _this.loader = document.createElement("div");
21207
+ _this.loader.classList.add("loader-1", "center");
21208
+ var loaderSpan = document.createElement("span");
21209
+ _this.loader.appendChild(loaderSpan);
21210
+ _this.storyContainer.appendChild(_this.loader);
21211
+ var loaderStyles = "\n *,\n ::after,\n ::before {\n box-sizing: border-box;\n }\n .loader-1 {\n height: 32px;\n width: 32px;\n animation: loader-1-1 4.8s linear infinite;\n }\n @keyframes loader-1-1 {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n .loader-1 span {\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n margin: auto;\n height: 32px;\n width: 32px;\n clip: rect(0, 32px, 32px, 16px);\n animation: loader-1-2 1.2s linear infinite;\n }\n @keyframes loader-1-2 {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(220deg);\n }\n }\n .loader-1 span::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n margin: auto;\n height: 32px;\n width: 32px;\n clip: rect(0, 32px, 32px, 16px);\n border: 3px solid #fff;\n border-radius: 50%;\n animation: loader-1-3 1.2s cubic-bezier(0.77, 0, 0.175, 1) infinite;\n }\n @keyframes loader-1-3 {\n 0% {\n transform: rotate(-140deg);\n }\n 50% {\n transform: rotate(-160deg);\n }\n 100% {\n transform: rotate(140deg);\n }\n }\n .center {\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n margin: auto;\n }\n ";
21212
+ var styleSheet = document.createElement("style");
21213
+ styleSheet.type = "text/css";
21214
+ styleSheet.innerText = loaderStyles;
21215
+ document.head.appendChild(styleSheet);
21216
+ _this.slides.forEach(function (slide, index) {
21217
+ var progressSlide = document.createElement("div");
21218
+ progressSlide.classList.add("slide".concat(index));
21219
+ progressSlide.classList.add("progress");
21220
+ var slide_duration = slide.duration / 1000;
21221
+ progressSlide.style.animationDuration = "".concat(slide_duration, "s");
21222
+ _this.progressContainer.appendChild(progressSlide);
21223
+ });
21224
+ _this.storyContainer.appendChild(_this.progressContainer);
21225
+ var breakElement = document.createElement("br");
21226
+ _this.storyContainer.appendChild(breakElement);
21227
+ var currentElement = document.createElement("div");
21228
+ currentElement.classList.add("slide-header");
21229
+ currentElement.style = "position:relative;top:20px;";
21230
+ var slideDetails = document.createElement("div");
21231
+ slideDetails.classList.add("slide-details");
21232
+ slideDetails.style = "display:flex;align-items:center;height:auto;width:100%";
21233
+ _this.storyContainer.appendChild(currentElement);
21234
+ _this.storyContainer.appendChild(slideDetails);
21235
+ document.body.appendChild(_this.storyContainer);
21236
+ _this.UhcC();
21237
+ _this.yUQd();
21238
+ _this.progress = Array.from(document.querySelectorAll(".progress"));
21239
+ var current_slide = document.querySelector(".slide-details");
21240
+ var playNext = function playNext(e) {
21241
+ var _absolute_header, _window2, _window2$logInternalE, _window$ApxorRTM4;
21242
+ var current = e && e.target;
21243
+ var next;
21244
+ var progress1 = Array.from(document.querySelectorAll(".progress"));
21245
+ var activeIndex1 = progress1.findIndex(function (el) {
21246
+ return el.classList.contains("active");
21247
+ });
21248
+ var current_time = Date.now();
21249
+ var time_taken;
21250
+ time_taken = (current_time - _this.slideStartTime) / 1000;
21251
+ if (activeIndex1 != -1) {
21252
+ var _window$ApxorRTM;
21253
+ (_window$ApxorRTM = window.ApxorRTM) === null || _window$ApxorRTM === void 0 || _window$ApxorRTM.logEvent("apx_slide_completed", {
21254
+ apx_nudge_id: _this.config[_this.position].id,
21255
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21256
+ apx_template_name: "stories",
21257
+ apx_variant_code: _this.config[_this.position].variant_code,
21258
+ apx_slide_number: activeIndex1 + 1,
21259
+ apx_slide_label: _this.current_slide_config.slide_label,
21260
+ apx_time_taken: time_taken
21261
+ });
21262
+ }
21263
+ if (current) {
21264
+ var currentIndex = _this.progress.indexOf(current);
21265
+ if (currentIndex < _this.progress.length - 1) {
21266
+ // If there are more slides in the current story group
21267
+ _this.storyContainer.removeEventListener("touchend", _this.boundSwipeUpHandling);
21268
+ var _existingAbsoluteElements = document.querySelectorAll(".apx-slide-header");
21269
+ _existingAbsoluteElements.forEach(function (element) {
21270
+ element.remove();
21271
+ });
21272
+ var currentSlideDetails = document.querySelector(".slide-details");
21273
+ currentSlideDetails.innerHTML = "";
21274
+ next = _this.progress[currentIndex + 1];
21275
+ } else {
21276
+ _this.storyContainer.removeEventListener("touchend", _this.boundSwipeUpHandling);
21277
+ // If it's the last slide of the current story group
21278
+ // Check if there's a next story group
21279
+ var _existingAbsoluteElements2 = document.querySelectorAll(".apx-slide-header");
21280
+ _existingAbsoluteElements2.forEach(function (element) {
21281
+ element.remove();
21282
+ });
21283
+ // this.Voll();
21284
+ var _currentSlideDetails = document.querySelector(".slide-details");
21285
+ _currentSlideDetails.innerHTML = "";
21286
+ _this.position = _this.position + 1;
21287
+ var nextGroupIndex = _this.position;
21288
+ if (nextGroupIndex < _this.config.length) {
21289
+ var _window$ApxorRTM2;
21290
+ _this.progressContainer.innerHTML = "";
21291
+ // Redirect to the first slide of the next story group
21292
+ var nextGroupSlides = _this.config[nextGroupIndex].slides;
21293
+ _this.progress_bar = new ProgressBar$1(_this.config[nextGroupIndex].progress_bar);
21294
+ _this.slides = nextGroupSlides;
21295
+ _this.slides.forEach(function (slide, index) {
21296
+ var progressSlide = document.createElement("div");
21297
+ progressSlide.classList.add("slide".concat(index));
21298
+ progressSlide.classList.add("progress");
21299
+ var slide_duration = slide.duration / 1000;
21300
+ progressSlide.style.animationDuration = "".concat(slide_duration, "s");
21301
+ _this.progressContainer.appendChild(progressSlide);
21302
+ });
21303
+ _this.progress = Array.from(document.querySelectorAll(".progress"));
21304
+ _this.progress.map(function (el) {
21305
+ return el.addEventListener("animationend", playNext, false);
21306
+ });
21307
+ next = _this.progress[0];
21308
+ _this.current_slide_config = _this.config[_this.position].slides;
21309
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
21310
+ var timeTaken;
21311
+ var _current_time = Date.now();
21312
+ timeTaken = (_current_time - _this.slideStartTime) / 1000;
21313
+ (_window$ApxorRTM2 = window.ApxorRTM) === null || _window$ApxorRTM2 === void 0 || _window$ApxorRTM2.logEvent("apx_story_changed", {
21314
+ apx_nudge_id: _this.config[_this.position].id,
21315
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21316
+ apx_template_name: "stories",
21317
+ apx_variant_code: _this.config[_this.position].variant_code,
21318
+ apx_slide_number: 1,
21319
+ apx_slide_label: _this.current_slide_config.slide_label,
21320
+ apx_slide_type: _this.currentMediaType,
21321
+ apx_change_action: "autoplay",
21322
+ apx_time_taken: timeTaken
21323
+ });
21324
+ } else {
21325
+ if (currentIndex === _this.progress.length - 1) {
21326
+ var _window, _window$logInternalEv, _window$ApxorRTM3;
21327
+ //this is the last slide of last story group hence close the current story group
21328
+
21329
+ var progressContainer = document.querySelector(".progress-container");
21330
+ var progressSegments = progressContainer.querySelectorAll(".progress");
21331
+ progressSegments[progressSegments.length - 1].classList.add("passed");
21332
+ (_window = window) === null || _window === void 0 || (_window = _window.Apxor) === null || _window === void 0 || (_window$logInternalEv = _window.logInternalEvent) === null || _window$logInternalEv === void 0 || _window$logInternalEv.call(_window, "story_slides_closed");
21333
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
21334
+ (_window$ApxorRTM3 = window.ApxorRTM) === null || _window$ApxorRTM3 === void 0 || _window$ApxorRTM3.logEvent("apx_slide_closed", {
21335
+ apx_nudge_id: _this.config[_this.position].id,
21336
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21337
+ apx_template_name: "stories",
21338
+ apx_variant_code: _this.config[_this.position].variant_code,
21339
+ apx_slide_number: currentIndex + 1,
21340
+ apx_slide_label: _this.current_slide_config.slide_label,
21341
+ apx_slide_type: _this.currentMediaType
21342
+ });
21343
+ return;
21344
+ }
21345
+ }
21346
+ }
21347
+ current.classList.remove("active");
21348
+ current.classList.add("passed");
21349
+ }
21350
+ if (!next) {
21351
+ _this.progress.forEach(function (el) {
21352
+ el.classList.remove("active");
21353
+ el.classList.remove("passed");
21354
+ });
21355
+ next = _this.progress[_this.slidesSeenCount];
21356
+ var _progressContainer = document.querySelector(".progress-container");
21357
+ var _progressSegments = _progressContainer.querySelectorAll(".progress");
21358
+ for (var i = 0; i < _this.slidesSeenCount; i++) {
21359
+ var _progressSegments$i;
21360
+ (_progressSegments$i = _progressSegments[i]) === null || _progressSegments$i === void 0 || _progressSegments$i.classList.add("passed");
21361
+ }
21362
+ }
21363
+ next.classList.add("active");
21364
+ var current_slide_from_config = _this.slides[_this.progress.indexOf(next)];
21365
+ _this.current_slide_config = current_slide_from_config;
21366
+ var slide_header = document.querySelectorAll(".slide_header");
21367
+ if (slide_header.length > 0) {
21368
+ slide_header[0].remove();
21369
+ }
21370
+ //remove existing existing header elements
21371
+ var existingAbsoluteElements = document.querySelectorAll(".apx-slide-header");
21372
+ existingAbsoluteElements.forEach(function (element) {
21373
+ element.remove();
21374
+ });
21375
+ var absolute_header;
21376
+ absolute_header = document.createElement("div");
21377
+ current_slide_from_config.layout.absolute_position_children.forEach(function (current_element) {
21378
+ var current_absolute_element;
21379
+ current_absolute_element = _this.HjRo(current_element);
21380
+ absolute_header.appendChild(current_absolute_element);
21381
+ });
21382
+ (_absolute_header = absolute_header) === null || _absolute_header === void 0 || _absolute_header.classList.add("apx-slide-header");
21383
+ document.body.appendChild(absolute_header);
21384
+ var element;
21385
+ if (current_slide_from_config.media_type === "image") {
21386
+ var _window$Apxor;
21387
+ element = document.createElement("div");
21388
+ var image_src;
21389
+ var image_ext;
21390
+ if (((_window$Apxor = window.Apxor) === null || _window$Apxor === void 0 ? void 0 : _window$Apxor.platform) != "ios") {
21391
+ image_ext = getFileExtension(current_slide_from_config.media_url);
21392
+ image_src = window.Apxor.getFilePath(_this.config[_this.position].id, current_slide_from_config.media_url, image_ext);
21393
+ if (image_src && image_src != "") {
21394
+ document.body.style.backgroundImage = "url(".concat(image_src, ")");
21395
+ document.body.style.backgroundSize = "100% auto";
21396
+ document.body.style.backgroundPosition = "center";
21397
+ document.body.style.backgroundRepeat = "no-repeat";
21398
+ } else {
21399
+ document.body.style.backgroundImage = "url(".concat(current_slide_from_config.media_url, ")");
21400
+ document.body.style.backgroundSize = "100% auto";
21401
+ document.body.style.backgroundPosition = "center";
21402
+ document.body.style.backgroundRepeat = "no-repeat";
21403
+ }
21404
+ } else {
21405
+ document.body.style.backgroundImage = "url(".concat(current_slide_from_config.media_url, ")");
21406
+ document.body.style.backgroundSize = "100% auto";
21407
+ document.body.style.backgroundPosition = "center";
21408
+ document.body.style.backgroundRepeat = "no-repeat";
21409
+ }
21410
+ document.body.style.backgroundColor = current_slide_from_config.media_background_color;
21411
+ document.body.style.margin = "0px";
21412
+ } else if (current_slide_from_config.media_type === "video") {
21413
+ var _window$Apxor2;
21414
+ document.body.style.backgroundImage = "";
21415
+ document.body.style.backgroundSize = "";
21416
+ document.body.style.backgroundPosition = "";
21417
+ document.body.style.backgroundRepeat = "";
21418
+ element = document.createElement("video");
21419
+ element.classList.add("apx-story-video");
21420
+ element.disablePictureInPicture = true;
21421
+ element.autoplay = true;
21422
+ var sourceElement = document.createElement("source");
21423
+ //Set the video tag attributes
21424
+ sourceElement.setAttribute("src", current_slide_from_config.media_url);
21425
+ sourceElement.setAttribute("type", "video/mp4");
21426
+ if (((_window$Apxor2 = window.Apxor) === null || _window$Apxor2 === void 0 ? void 0 : _window$Apxor2.platform) === "ios") {
21427
+ element.playsInline = true;
21428
+ }
21429
+ element.appendChild(sourceElement);
21430
+ element.style = "width:100%;height:auto;align-items:center;display:flex;align-items:center;object-fit:cover";
21431
+ document.body.style.backgroundColor = current_slide_from_config.media_background_color;
21432
+ document.body.style.margin = "0px";
21433
+ } else if (current_slide_from_config.media_type === "none") {
21434
+ document.body.style.backgroundImage = "";
21435
+ document.body.style.backgroundSize = "";
21436
+ document.body.style.backgroundPosition = "";
21437
+ document.body.style.backgroundRepeat = "";
21438
+ var updated_layout_without_absolute_elements = JSON.parse(JSON.stringify(current_slide_from_config.layout));
21439
+ delete updated_layout_without_absolute_elements["absolute_position_children"];
21440
+ element = _this.HjRo(updated_layout_without_absolute_elements);
21441
+ document.body.style.backgroundColor = current_slide_from_config.media_background_color;
21442
+ document.body.style.margin = "0px";
21443
+ }
21444
+ if (current_slide.children.length > 0) {
21445
+ current_slide.removeChild(current_slide.children[0]);
21446
+ }
21447
+ current_slide.appendChild(element);
21448
+ _this.Jwju();
21449
+ window.intervalToCheckImgStatus = setInterval(function () {
21450
+ if (_this.rnGL()) {
21451
+ clearInterval(window.intervalToCheckImgStatus);
21452
+ }
21453
+ }, 500);
21454
+ (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.Apxor) === null || _window2 === void 0 || (_window2$logInternalE = _window2.logInternalEvent) === null || _window2$logInternalE === void 0 || _window2$logInternalE.call(_window2, "story_slide_seen", JSON.stringify({
21455
+ config_id: _this.config[_this.position].id,
21456
+ position: _this.position,
21457
+ index: parseInt(_this.progress.indexOf(next)) + 1,
21458
+ view_id: _this.view_id
21459
+ }));
21460
+ var currentTime = Date.now();
21461
+ _this.slideStartTime = currentTime;
21462
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
21463
+ (_window$ApxorRTM4 = window.ApxorRTM) === null || _window$ApxorRTM4 === void 0 || _window$ApxorRTM4.logEvent("apx_slide_viewed", {
21464
+ apx_nudge_id: _this.config[_this.position].id,
21465
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21466
+ apx_template_name: "stories",
21467
+ apx_variant_code: _this.config[_this.position].variant_code,
21468
+ apx_slide_number: parseInt(_this.progress.indexOf(next)) + 1,
21469
+ apx_slide_label: _this.current_slide_config.slide_label,
21470
+ apx_slide_type: _this.currentMediaType
21471
+ });
21472
+ };
21473
+ _this.progress.map(function (el) {
21474
+ return el.addEventListener("animationend", playNext, false);
21475
+ });
21476
+ playNext();
21477
+ });
21478
+ _defineProperty(this, "Voll", function () {
21479
+ document.body.classList.add("slide-right");
21480
+ var animationEndCounter = 0;
21481
+ var onAnimationEnd = function onAnimationEnd() {
21482
+ animationEndCounter++;
21483
+ if (animationEndCounter === 2) {
21484
+ document.body.classList.remove("slide-right");
21485
+ document.body.removeEventListener("animationend", onAnimationEnd);
21486
+ }
21487
+ };
21488
+ document.body.addEventListener("animationend", onAnimationEnd);
21489
+ });
21490
+ _defineProperty(this, "HjRo", function (config) {
21491
+ var _window$Apxor3;
21492
+ var element;
21493
+ var startY;
21494
+ var progress_bar;
21495
+ var slide_header;
21496
+ var slide_details;
21497
+ switch (config.type) {
21498
+ case "cell":
21499
+ case "text":
21500
+ case "button":
21501
+ element = document.createElement(EMBED_CARD_TYPE[config.type]);
21502
+ break;
21503
+ case "img":
21504
+ element = document.createElement(EMBED_CARD_TYPE[config.type]);
21505
+ element.addEventListener("error", function () {
21506
+ element.style.visibility = "hidden";
21507
+ var ele = document.querySelector(".loader-1");
21508
+ _this.continueLoading = true;
21509
+ ele.style.display = "block";
21510
+ ele.style.visibility = "visible";
21511
+ progress_bar = document.querySelector(".progress-container");
21512
+ progress_bar.style.visibility = "hidden";
21513
+ slide_header = document.querySelector(".apx-slide-header");
21514
+ slide_header.style.visibility = "hidden";
21515
+ slide_details = document.querySelector(".slide-details");
21516
+ slide_details.style.visibility = "hidden";
21517
+ });
21518
+ break;
21519
+ case "copy_button":
21520
+ element = document.createElement("div");
21521
+ break;
21522
+ case "floating_button":
21523
+ element = document.createElement("button");
21524
+ break;
21525
+ case "swipe_up_button":
21526
+ element = document.createElement("div");
21527
+ element.style.animation = "moveUpDownButton 1000ms ease-in-out infinite alternate";
21528
+ break;
21529
+ case "swipe_up_icon":
21530
+ element = document.createElement("div");
21531
+ element.innerHTML = "<svg width=\"30\" height=\"26\" viewBox=\"0 0 30 26\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M22.1338 22.1335C21.8994 22.3679 21.5815 22.4995 21.25 22.4995C20.9186 22.4995 20.6007 22.3679 20.3663 22.1335L15 16.7673L9.63377 22.1335C9.51847 22.2529 9.38053 22.3481 9.22803 22.4137C9.07552 22.4792 8.9115 22.5136 8.74552 22.5151C8.57955 22.5165 8.41495 22.4849 8.26133 22.4221C8.10771 22.3592 7.96815 22.2664 7.85078 22.149C7.73341 22.0317 7.6406 21.8921 7.57775 21.7385C7.51489 21.5848 7.48327 21.4202 7.48471 21.2543C7.48615 21.0883 7.52064 20.9243 7.58615 20.7718C7.65166 20.6193 7.74688 20.4813 7.86627 20.366L14.1163 14.116C14.3507 13.8817 14.6686 13.75 15 13.75C15.3315 13.75 15.6494 13.8817 15.8838 14.116L22.1338 20.366C22.3681 20.6004 22.4998 20.9183 22.4998 21.2498C22.4998 21.5812 22.3681 21.8991 22.1338 22.1335ZM22.1338 14.6335C21.8994 14.8679 21.5815 14.9995 21.25 14.9995C20.9186 14.9995 20.6007 14.8679 20.3663 14.6335L15 9.26728L9.63377 14.6335C9.39802 14.8612 9.08227 14.9872 8.75452 14.9844C8.42678 14.9815 8.11326 14.8501 7.8815 14.6183C7.64974 14.3865 7.51828 14.073 7.51543 13.7453C7.51258 13.4175 7.63857 13.1018 7.86627 12.866L14.1163 6.61603C14.3507 6.38169 14.6686 6.25004 15 6.25004C15.3315 6.25004 15.6494 6.38169 15.8838 6.61603L22.1338 12.866C22.3681 13.1004 22.4998 13.4183 22.4998 13.7498C22.4998 14.0812 22.3681 14.3991 22.1338 14.6335Z\"/>\n </svg>";
21532
+ break;
21533
+ case "cross_button":
21534
+ element = document.createElement("div");
21535
+ element.innerHTML = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.46995 5.46983C5.61058 5.32938 5.8012 5.25049 5.99995 5.25049C6.1987 5.25049 6.38933 5.32938 6.52995 5.46983L18.53 17.4698C18.6036 17.5385 18.6627 17.6213 18.7037 17.7133C18.7447 17.8053 18.7668 17.9046 18.7685 18.0053C18.7703 18.106 18.7518 18.206 18.7141 18.2994C18.6764 18.3928 18.6202 18.4776 18.549 18.5489C18.4778 18.6201 18.3929 18.6762 18.2995 18.714C18.2062 18.7517 18.1061 18.7702 18.0054 18.7684C17.9047 18.7666 17.8054 18.7446 17.7134 18.7036C17.6214 18.6626 17.5386 18.6035 17.4699 18.5298L5.46995 6.52983C5.3295 6.3892 5.25061 6.19858 5.25061 5.99983C5.25061 5.80108 5.3295 5.61045 5.46995 5.46983Z\" />\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M18.53 5.46983C18.6704 5.61045 18.7493 5.80108 18.7493 5.99983C18.7493 6.19858 18.6704 6.3892 18.53 6.52983L6.52997 18.5298C6.38779 18.6623 6.19975 18.7344 6.00545 18.731C5.81114 18.7276 5.62576 18.6489 5.48835 18.5114C5.35093 18.374 5.27222 18.1887 5.26879 17.9944C5.26537 17.8 5.33749 17.612 5.46997 17.4698L17.47 5.46983C17.6106 5.32938 17.8012 5.25049 18 5.25049C18.1987 5.25049 18.3893 5.32938 18.53 5.46983Z\" />\n </svg>";
21536
+ break;
21537
+ case "unmute_icon":
21538
+ element = document.createElement("div");
21539
+ element.innerHTML = "<svg width=\"25\" height=\"25\" viewBox=\"0 0 25 25\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12.5 4.16667L10.3229 6.34375L12.5 8.52083M4.44792 3.125L3.125 4.44792L8.05208 9.375H3.125V15.625H7.29167L12.5 20.8333V13.8229L16.9271 18.2604C16.2292 18.7917 15.4479 19.2292 14.5833 19.4792V21.6354C16.0208 21.3021 17.3229 20.6458 18.4167 19.75L20.5521 21.875L21.875 20.5521L12.5 11.1771M19.7917 12.5C19.7917 13.4792 19.5833 14.3958 19.2292 15.25L20.8021 16.8229C21.5051 15.4903 21.8733 14.0067 21.875 12.5C21.875 8.04167 18.75 4.3125 14.5833 3.36458V5.51042C17.5938 6.40625 19.7917 9.19792 19.7917 12.5ZM17.1875 12.5C17.1875 10.6562 16.1458 9.07292 14.5833 8.30208V10.6042L17.1354 13.1562C17.1875 12.9479 17.1875 12.7188 17.1875 12.5Z\" />\n </svg>";
21540
+ break;
21541
+ case "mute_icon":
21542
+ element = document.createElement("div");
21543
+ element.innerHTML = "<svg width=\"30\" height=\"30\" viewBox=\"0 0 25 25\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12.375 4L10.1979 6.17708L7.92708 9.20833H3V15.4583H7.16667L12.375 20.6667V4Z\" fill=\"currentColor\" />\n <path d=\"M14.4905 20.2167C18.9193 20.2167 22.5095 16.6265 22.5095 12.1977C22.5095 7.76894 18.9193 4.17871 14.4905 4.17871\" stroke=\"currentColor\" fill =\"transparent\" stroke-width=\"1.782\"/>\n <path d=\"M14.4905 15.7618C16.4588 15.7618 18.0545 14.1661 18.0545 12.1978C18.0545 10.2294 16.4588 8.63379 14.4905 8.63379\" stroke=\"currentColor\" fill=\"transparent\" stroke-width=\"1.782\"/>\n </svg>";
21544
+ element.id = "apx-mute-icon";
21545
+ element.addEventListener("touchstart", function (event) {
21546
+ _this.CfIa(event);
21547
+ });
21548
+ break;
21549
+ case "copy_icon":
21550
+ element = document.createElement("div");
21551
+ element.innerHTML = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 1.25H10.944C9.106 1.25 7.65 1.25 6.511 1.403C5.339 1.561 4.39 1.893 3.641 2.641C2.893 3.39 2.561 4.339 2.403 5.511C2.25 6.651 2.25 8.106 2.25 9.944V16C2.25002 16.8934 2.56894 17.7575 3.14934 18.4367C3.72974 19.1159 4.53351 19.5657 5.416 19.705C5.553 20.469 5.818 21.121 6.348 21.652C6.95 22.254 7.708 22.512 8.608 22.634C9.475 22.75 10.578 22.75 11.945 22.75H15.055C16.422 22.75 17.525 22.75 18.392 22.634C19.292 22.512 20.05 22.254 20.652 21.652C21.254 21.05 21.512 20.292 21.634 19.392C21.75 18.525 21.75 17.422 21.75 16.055V10.945C21.75 9.578 21.75 8.475 21.634 7.608C21.512 6.708 21.254 5.95 20.652 5.348C20.121 4.818 19.469 4.553 18.705 4.416C18.5657 3.53351 18.1159 2.72974 17.4367 2.14934C16.7575 1.56894 15.8934 1.25002 15 1.25ZM17.13 4.271C16.9779 3.827 16.6909 3.44166 16.3089 3.16893C15.927 2.89619 15.4693 2.74971 15 2.75H11C9.093 2.75 7.739 2.752 6.71 2.89C5.705 3.025 5.125 3.279 4.702 3.702C4.279 4.125 4.025 4.705 3.89 5.711C3.752 6.739 3.75 8.093 3.75 10V16C3.74971 16.4693 3.89619 16.927 4.16892 17.3089C4.44166 17.6908 4.827 17.9779 5.271 18.13C5.25 17.52 5.25 16.83 5.25 16.055V10.945C5.25 9.578 5.25 8.475 5.367 7.608C5.487 6.708 5.747 5.95 6.348 5.348C6.95 4.746 7.708 4.488 8.608 4.367C9.475 4.25 10.578 4.25 11.945 4.25H15.055C15.83 4.25 16.52 4.25 17.13 4.271ZM7.408 6.41C7.685 6.133 8.073 5.953 8.808 5.854C9.562 5.753 10.564 5.751 11.999 5.751H14.999C16.434 5.751 17.435 5.753 18.191 5.854C18.925 5.953 19.313 6.134 19.59 6.41C19.867 6.687 20.047 7.075 20.146 7.81C20.247 8.564 20.249 9.566 20.249 11.001V16.001C20.249 17.436 20.247 18.437 20.146 19.193C20.047 19.927 19.866 20.315 19.59 20.592C19.313 20.869 18.925 21.049 18.19 21.148C17.435 21.249 16.434 21.251 14.999 21.251H11.999C10.564 21.251 9.562 21.249 8.807 21.148C8.073 21.049 7.685 20.868 7.408 20.592C7.131 20.315 6.951 19.927 6.852 19.192C6.751 18.437 6.749 17.436 6.749 16.001V11.001C6.749 9.566 6.751 8.564 6.852 7.809C6.951 7.075 7.132 6.687 7.408 6.41Z\"/>\n </svg>";
21552
+ break;
21553
+ case "video":
21554
+ element = document.createElement("video");
21555
+ element.style.width = "100%";
21556
+ element.style.height = "auto";
21557
+ element.controlsList = "noplaybackrate nodownload nofullscreen";
21558
+ // element.controls = true;
21559
+ element.disablePictureInPicture = true;
21560
+ element.autoplay = true;
21561
+ if (((_window$Apxor3 = window.Apxor) === null || _window$Apxor3 === void 0 ? void 0 : _window$Apxor3.platform) === "ios") {
21562
+ element.playsInline = true;
21563
+ }
21564
+ element.addEventListener("error", function () {
21565
+ element.style.visibility = "hidden";
21566
+ progress_bar = document.querySelector(".progress-container");
21567
+ progress_bar.style.visibility = "hidden";
21568
+ slide_header = document.querySelector(".apx-slide-header");
21569
+ slide_header.style.visibility = "hidden";
21570
+ slide_details = document.querySelector(".slide-details");
21571
+ slide_details.style.visibility = "hidden";
21572
+ });
21573
+ break;
21574
+ default:
21575
+ element = document.createElement(config.type);
21576
+ }
21577
+ if (config.properties) {
21578
+ // eslint-disable-next-line no-unused-vars
21579
+ for (var prop in config.properties) {
21580
+ if (config.type === "img" && prop === "src" || config.type === "img" && prop === "format") continue;
21581
+ if (config.type === "video" && prop === "source") {
21582
+ var sourceElement = document.createElement("source");
21583
+ // eslint-disable-next-line no-unused-vars
21584
+ for (var srcprop in (_config$properties = config.properties) === null || _config$properties === void 0 ? void 0 : _config$properties[prop]) {
21585
+ var _config$properties, _config$properties2;
21586
+ sourceElement[srcprop] = (_config$properties2 = config.properties) === null || _config$properties2 === void 0 || (_config$properties2 = _config$properties2[prop]) === null || _config$properties2 === void 0 ? void 0 : _config$properties2[srcprop];
21587
+ }
21588
+ sourceElement["type"] = "video/mp4";
21589
+ element.appendChild(sourceElement);
21590
+ continue;
21591
+ }
21592
+ element[prop] = config.properties[prop];
21593
+ }
21594
+ }
21595
+ element.classList.add(config._id);
21596
+ if (config.css) {
21597
+ if (config.type == "img") {
21598
+ var styleObject = parseCSS(config.css);
21599
+ var imgStyleObject = removeKeys(styleObject, Object.keys(imgWrapperStylesForStories));
21600
+ var styles;
21601
+ styles = objectToCSS(imgStyleObject);
21602
+ element.style = styles;
21603
+ } else {
21604
+ element.style = config.css;
21605
+ }
21606
+ }
21607
+ if (config.enable_actions && config.actions.length > 0) {
21608
+ var slide_details_to_be_deleted;
21609
+ var updated_action;
21610
+ var updated_swipe_action;
21611
+ config.actions.forEach(function (action) {
21612
+ switch (action.type) {
21613
+ case "activity":
21614
+ case "deeplink":
21615
+ element.ontouchstart = function (e) {
21616
+ var _window$ApxorRTM5;
21617
+ _this.redirectionFlag = true;
21618
+ e.stopPropagation();
21619
+ updated_action = _objectSpread2(_objectSpread2({}, action), {}, {
21620
+ display_type: "stories"
21621
+ });
21622
+ window.Apxor.redirect(JSON.stringify(updated_action));
21623
+ var progress = Array.from(document.querySelectorAll(".progress"));
21624
+ var activeIndex = progress.findIndex(function (el) {
21625
+ return el.classList.contains("active");
21626
+ });
21627
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
21628
+ var current_time = Date.now();
21629
+ var time_taken;
21630
+ time_taken = (current_time - _this.slideStartTime) / 1000;
21631
+ (_window$ApxorRTM5 = window.ApxorRTM) === null || _window$ApxorRTM5 === void 0 || _window$ApxorRTM5.logEvent("apx_slide_interaction", {
21632
+ apx_nudge_id: _this.config[_this.position].id,
21633
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21634
+ apx_template_name: "stories",
21635
+ apx_variant_code: _this.config[_this.position].variant_code,
21636
+ apx_slide_number: activeIndex + 1,
21637
+ apx_slide_label: _this.current_slide_config.slide_label,
21638
+ apx_slide_type: _this.currentMediaType,
21639
+ apx_interaction_type: "cta-clicked",
21640
+ apx_time_taken: time_taken
21641
+ });
21642
+ };
21643
+ break;
21644
+ case "swipe_redirect_deeplink":
21645
+ case "swipe_redirect_activity":
21646
+ updated_swipe_action = _objectSpread2(_objectSpread2({}, action), {}, {
21647
+ display_type: "stories"
21648
+ });
21649
+ _this.storyContainer.addEventListener("touchstart", function (event) {
21650
+ event.stopPropagation();
21651
+ startY = event.touches[0].clientY;
21652
+ _this.startY = startY;
21653
+ _this.swipe_action = updated_swipe_action;
21654
+ });
21655
+ _this.storyContainer.addEventListener("touchend", _this.boundSwipeUpHandling);
21656
+ break;
21657
+ case "dismiss":
21658
+ element.ontouchstart = function (e) {
21659
+ var _window$ApxorRTM6, _window3, _window3$logInternalE;
21660
+ e.stopPropagation();
21661
+ _this.dismissFlag = true;
21662
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
21663
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
21664
+ for (var i = 0; i < childElements.length; i++) {
21665
+ var child = childElements[i];
21666
+ if (child.tagName.toLowerCase() === "video") {
21667
+ child.muted = true;
21668
+ }
21669
+ }
21670
+ var progress = Array.from(document.querySelectorAll(".progress"));
21671
+ var activeIndex = progress.findIndex(function (el) {
21672
+ return el.classList.contains("active");
21673
+ });
21674
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
21675
+ (_window$ApxorRTM6 = window.ApxorRTM) === null || _window$ApxorRTM6 === void 0 || _window$ApxorRTM6.logEvent("apx_slide_closed", {
21676
+ apx_nudge_id: _this.config[_this.position].id,
21677
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21678
+ apx_template_name: "stories",
21679
+ apx_variant_code: _this.config[_this.position].variant_code,
21680
+ apx_slide_number: activeIndex + 1,
21681
+ apx_slide_label: _this.current_slide_config.slide_label,
21682
+ apx_slide_type: _this.currentMediaType
21683
+ });
21684
+ (_window3 = window) === null || _window3 === void 0 || (_window3 = _window3.Apxor) === null || _window3 === void 0 || (_window3$logInternalE = _window3.logInternalEvent) === null || _window3$logInternalE === void 0 || _window3$logInternalE.call(_window3, "story_slides_closed");
21685
+ return;
21686
+ };
21687
+ return;
21688
+ case "never":
21689
+ element.onclick = function () {
21690
+ window.Apxor.neverShow(_this.config[_this.position].id, _this.name, "IN_APP");
21691
+ window.Apxor.logActionEvent("never_show_clicked", _this.config[_this.position].id, _this.name);
21692
+ };
21693
+ break;
21694
+ case "copy-content":
21695
+ element.ontouchstart = function (e) {
21696
+ var _window4, _window4$logInternalE, _window$ApxorRTM7;
21697
+ e.stopPropagation();
21698
+ e.stopImmediatePropagation();
21699
+ e.preventDefault();
21700
+ var textToCopy = action.content;
21701
+ (_window4 = window) === null || _window4 === void 0 || (_window4 = _window4.Apxor) === null || _window4 === void 0 || (_window4$logInternalE = _window4.logInternalEvent) === null || _window4$logInternalE === void 0 || _window4$logInternalE.call(_window4, "TextCopied", JSON.stringify({
21702
+ text_to_copy: textToCopy.toString()
21703
+ }));
21704
+ var progress = Array.from(document.querySelectorAll(".progress"));
21705
+ var activeIndex = progress.findIndex(function (el) {
21706
+ return el.classList.contains("active");
21707
+ });
21708
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
21709
+ var current_time = Date.now();
21710
+ var time_taken;
21711
+ time_taken = (current_time - _this.slideStartTime) / 1000;
21712
+ (_window$ApxorRTM7 = window.ApxorRTM) === null || _window$ApxorRTM7 === void 0 || _window$ApxorRTM7.logEvent("apx_slide_interaction", {
21713
+ apx_nudge_id: _this.config[_this.position].id,
21714
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21715
+ apx_template_name: "stories",
21716
+ apx_variant_code: _this.config[_this.position].variant_code,
21717
+ apx_slide_number: activeIndex + 1,
21718
+ apx_slide_label: _this.current_slide_config.slide_label,
21719
+ apx_slide_type: _this.currentMediaType,
21720
+ apx_interaction_type: "cta-clicked",
21721
+ apx_time_taken: time_taken
21722
+ });
21723
+ return;
21724
+ };
21725
+ break;
21726
+ case "log-app-event":
21727
+ element.onclick = function () {
21728
+ window.Apxor.logAppEvent(action === null || action === void 0 ? void 0 : action.event_name);
21729
+ };
21730
+ break;
21731
+ case "log-client-event":
21732
+ element.onclick = function () {
21733
+ window.Apxor.logClientEvent(action === null || action === void 0 ? void 0 : action.event_name);
21734
+ };
21735
+ }
21736
+ });
21737
+ }
21738
+ if (config.absolute_position_children && config.absolute_position_children.length > 0) {
21739
+ config.absolute_position_children.forEach(function (childConfig) {
21740
+ var childElement = _this.HjRo(childConfig);
21741
+ element.appendChild(childElement);
21742
+ });
21743
+ }
21744
+
21745
+ // Process children
21746
+ if (config.children && config.children.length > 0) {
21747
+ config.children.forEach(function (childConfig) {
21748
+ var childElement = _this.HjRo(childConfig);
21749
+ element.appendChild(childElement);
21750
+ });
21751
+ }
21752
+ if (config.type === "img") {
21753
+ var _config$properties3, _config$properties4, _window5, _window5$getFilePath;
21754
+ var src = config === null || config === void 0 || (_config$properties3 = config.properties) === null || _config$properties3 === void 0 ? void 0 : _config$properties3.src;
21755
+ var format = config === null || config === void 0 || (_config$properties4 = config.properties) === null || _config$properties4 === void 0 ? void 0 : _config$properties4.format;
21756
+ element["src"] = src && format ? ((_window5 = window) === null || _window5 === void 0 || (_window5 = _window5.Apxor) === null || _window5 === void 0 || (_window5$getFilePath = _window5.getFilePath) === null || _window5$getFilePath === void 0 ? void 0 : _window5$getFilePath.call(_window5, _this.config[_this.position].id, src, format)) || src : src;
21757
+ _this.imageElements.push(element);
21758
+ var imgWrapper = document.createElement("div");
21759
+ var _styleObject = parseCSS(config.css);
21760
+ Object.keys(imgWrapperStylesForStories).forEach(function (prop) {
21761
+ if (prop in _styleObject) {
21762
+ imgWrapper.style[imgWrapperStylesForStories[prop]] = _styleObject[prop];
21763
+ if (prop === "width") {
21764
+ element.style.width = _styleObject[prop];
21765
+ }
21766
+ }
21767
+ });
21768
+ imgWrapper.appendChild(element);
21769
+ return imgWrapper;
21770
+ } else if (config.type === "video") {
21771
+ _this.videoElements.push(element);
21772
+ }
21773
+ return element;
21774
+ });
21775
+ _defineProperty(this, "CfIa", function (event) {
21776
+ var slide_details_to_be_deleted;
21777
+ var mute_child_elements;
21778
+ var unmute_child_elements;
21779
+ _this.muteElement = document.getElementById("apx-mute-icon");
21780
+ event.stopPropagation();
21781
+ if (_this.videoAudioState === "unmute") {
21782
+ _this.muteElement.innerHTML = "<svg width=\"30\" height=\"30\" viewBox=\"0 0 25 25\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12.5 4.16667L10.3229 6.34375L12.5 8.52083M4.44792 3.125L3.125 4.44792L8.05208 9.375H3.125V15.625H7.29167L12.5 20.8333V13.8229L16.9271 18.2604C16.2292 18.7917 15.4479 19.2292 14.5833 19.4792V21.6354C16.0208 21.3021 17.3229 20.6458 18.4167 19.75L20.5521 21.875L21.875 20.5521L12.5 11.1771M19.7917 12.5C19.7917 13.4792 19.5833 14.3958 19.2292 15.25L20.8021 16.8229C21.5051 15.4903 21.8733 14.0067 21.875 12.5C21.875 8.04167 18.75 4.3125 14.5833 3.36458V5.51042C17.5938 6.40625 19.7917 9.19792 19.7917 12.5ZM17.1875 12.5C17.1875 10.6562 16.1458 9.07292 14.5833 8.30208V10.6042L17.1354 13.1562C17.1875 12.9479 17.1875 12.7188 17.1875 12.5Z\" />\n </svg>";
21783
+ _this.videoAudioState = "mute";
21784
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
21785
+ mute_child_elements = slide_details_to_be_deleted.querySelectorAll("video");
21786
+ for (var i = 0; i < mute_child_elements.length; i++) {
21787
+ var child = mute_child_elements[i];
21788
+ if (child.tagName.toLowerCase() === "video") {
21789
+ child.muted = true;
21790
+ }
21791
+ }
21792
+ } else if (_this.videoAudioState === "mute") {
21793
+ _this.muteElement.innerHTML = "<svg width=\"30\" height=\"30\" viewBox=\"0 0 25 25\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12.375 4L10.1979 6.17708L7.92708 9.20833H3V15.4583H7.16667L12.375 20.6667V4Z\" fill=\"currentColor\" />\n <path d=\"M14.4905 20.2167C18.9193 20.2167 22.5095 16.6265 22.5095 12.1977C22.5095 7.76894 18.9193 4.17871 14.4905 4.17871\" stroke=\"currentColor\" fill =\"transparent\" stroke-width=\"1.782\"/>\n <path d=\"M14.4905 15.7618C16.4588 15.7618 18.0545 14.1661 18.0545 12.1978C18.0545 10.2294 16.4588 8.63379 14.4905 8.63379\" stroke=\"currentColor\" fill=\"transparent\" stroke-width=\"1.782\"/>\n </svg>";
21794
+ _this.videoAudioState = "unmute";
21795
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
21796
+ unmute_child_elements = slide_details_to_be_deleted.querySelectorAll("video");
21797
+ for (var j = 0; j < unmute_child_elements.length; j++) {
21798
+ var child2 = unmute_child_elements[j];
21799
+ if (child2.tagName.toLowerCase() === "video") {
21800
+ child2.muted = false;
21801
+ }
21802
+ }
21803
+ // this.muteElement.addEventListener("touchstart", (event) => {
21804
+ // event.stopPropagation();
21805
+ // this.CfIa(event);
21806
+ // });
21807
+ }
21808
+ });
21809
+ _defineProperty(this, "yUQd", function () {
21810
+ var tapTimeout;
21811
+ var tapThreshold = 0.5; // Assuming 0.5 is the center of the WebView
21812
+ var longPressDuration = 200;
21813
+ _this.storyContainer.addEventListener("touchstart", function (event) {
21814
+ _this.gestureTouch = true;
21815
+ var touchX = event.touches[0].clientX - _this.storyContainer.getBoundingClientRect().left;
21816
+ var webViewWidth = _this.storyContainer.offsetWidth;
21817
+ var relativeX = touchX / webViewWidth;
21818
+ clearTimeout(tapTimeout);
21819
+ tapTimeout = setTimeout(function () {
21820
+ if (!_this.swipe_up_redirect) {
21821
+ var _window$ApxorRTM8;
21822
+ var progress = Array.from(document.querySelectorAll(".progress"));
21823
+ var activeIndex = progress.findIndex(function (el) {
21824
+ return el.classList.contains("active");
21825
+ });
21826
+ progress[activeIndex].style.animationPlayState = "paused";
21827
+ _this.slidePaused = true;
21828
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
21829
+ var current_time = Date.now();
21830
+ var time_taken;
21831
+ time_taken = (current_time - _this.slideStartTime) / 1000;
21832
+ (_window$ApxorRTM8 = window.ApxorRTM) === null || _window$ApxorRTM8 === void 0 || _window$ApxorRTM8.logEvent("apx_slide_paused", {
21833
+ apx_nudge_id: _this.config[_this.position].id,
21834
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21835
+ apx_template_name: "stories",
21836
+ apx_variant_code: _this.config[_this.position].variant_code,
21837
+ apx_slide_number: activeIndex + 1,
21838
+ apx_slide_label: _this.current_slide_config.slide_label,
21839
+ apx_slide_type: _this.currentMediaType,
21840
+ apx_time_taken: time_taken
21841
+ });
21842
+ var slide_details_to_be_deleted;
21843
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
21844
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
21845
+ for (var i = 0; i < childElements.length; i++) {
21846
+ var child = childElements[i];
21847
+ if (child.tagName.toLowerCase() === "video") {
21848
+ child.pause();
21849
+ }
21850
+ }
21851
+ } else {
21852
+ _this.swipe_up_redirect = false;
21853
+ }
21854
+ }, longPressDuration);
21855
+ event.target.dataset.relativeX = relativeX;
21856
+ });
21857
+ _this.storyContainer.addEventListener("touchend", function (event) {
21858
+ setTimeout(function () {
21859
+ if (_this.gestureTouch && !_this.swipeUpTouch) {
21860
+ _this.gestureTouch = false;
21861
+ clearTimeout(tapTimeout);
21862
+ var progress = Array.from(document.querySelectorAll(".progress"));
21863
+ var activeIndex = progress.findIndex(function (el) {
21864
+ return el.classList.contains("active");
21865
+ });
21866
+ progress[activeIndex].style.animationPlayState = "running";
21867
+ if (_this.slidePaused) {
21868
+ var _window$ApxorRTM9;
21869
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
21870
+ var current_time = Date.now();
21871
+ var time_taken;
21872
+ time_taken = (current_time - _this.slideStartTime) / 1000;
21873
+ (_window$ApxorRTM9 = window.ApxorRTM) === null || _window$ApxorRTM9 === void 0 || _window$ApxorRTM9.logEvent("apx_slide_resumed", {
21874
+ apx_nudge_id: _this.config[_this.position].id,
21875
+ apx_nudge_name: _this.config[_this.position].campaign_name,
21876
+ apx_template_name: "stories",
21877
+ apx_variant_code: _this.config[_this.position].variant_code,
21878
+ apx_slide_number: activeIndex + 1,
21879
+ apx_slide_label: _this.current_slide_config.slide_label,
21880
+ apx_slide_type: _this.currentMediaType,
21881
+ apx_time_taken: time_taken
21882
+ });
21883
+ _this.slidePaused = false;
21884
+ }
21885
+ var slide_details_to_be_deleted;
21886
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
21887
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
21888
+ for (var i = 0; i < childElements.length; i++) {
21889
+ var child = childElements[i];
21890
+ if (child.tagName.toLowerCase() === "video") {
21891
+ child.play();
21892
+ }
21893
+ }
21894
+ if (event.timeStamp - event.target.dataset.touchStartTime < longPressDuration) {
21895
+ var relativeX = event.target.dataset.relativeX;
21896
+ if (!_this.swipeDownFlag) {
21897
+ if (relativeX > tapThreshold) {
21898
+ var _slide_details_to_be_deleted = document.querySelector(".slide-details");
21899
+ var _childElements = _slide_details_to_be_deleted.children;
21900
+ for (var _i = 0; _i < _childElements.length; _i++) {
21901
+ var _child = _childElements[_i];
21902
+ if (_child.tagName.toLowerCase() === "video") {
21903
+ _child.muted = true;
21904
+ }
21905
+ }
21906
+ if (!_this.dismissFlag && !_this.swipeDownFlag) {
21907
+ if (!_this.swipeLeft && !_this.swipeRight) {
21908
+ _this.moveToNextSlide();
21909
+ } else {
21910
+ _this.swipeLeft = false;
21911
+ _this.swipeRight = false;
21912
+ }
21913
+ }
21914
+ } else if (relativeX < tapThreshold) {
21915
+ if (!_this.swipeLeft && !_this.swipeRight) {
21916
+ _this.moveToPreviousSlide();
21917
+ } else {
21918
+ _this.swipeLeft = false;
21919
+ _this.swipeRight = false;
21920
+ }
21921
+ }
21922
+ }
21923
+ }
21924
+ } else {
21925
+ _this.swipeUpTouch = false;
21926
+ }
21927
+ }, 50);
21928
+ });
21929
+ _this.storyContainer.addEventListener("touchstart", function (event) {
21930
+ event.target.dataset.touchStartTime = event.timeStamp;
21931
+ });
21932
+ });
21933
+ _defineProperty(this, "UhcC", function () {
21934
+ var startY, startX;
21935
+ _this.storyContainer.addEventListener("touchstart", function (event) {
21936
+ _this.swipeTouch = true;
21937
+ startX = event.touches[0].clientX;
21938
+ startY = event.touches[0].clientY;
21939
+ });
21940
+ _this.storyContainer.addEventListener("touchend", function (event) {
21941
+ setTimeout(function () {
21942
+ if (_this.swipeTouch && !_this.swipeUpTouch) {
21943
+ var endX = event.changedTouches[0].clientX;
21944
+ var endY = event.changedTouches[0].clientY;
21945
+ var deltaY = startY - endY;
21946
+ var deltaX = startX - endX;
21947
+ event.stopPropagation();
21948
+ event.preventDefault();
21949
+ var progress = Array.from(document.querySelectorAll(".progress"));
21950
+ var activeIndex = progress.findIndex(function (el) {
21951
+ return el.classList.contains("active");
21952
+ });
21953
+ _this.swipeTouch = false;
21954
+ if (deltaY < -50 && Math.abs(deltaY) > Math.abs(deltaX)) {
21955
+ var _window6, _window6$logInternalE;
21956
+ _this.swipeDownFlag = true;
21957
+ var slide_details_to_be_deleted;
21958
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
21959
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
21960
+ for (var i = 0; i < childElements.length; i++) {
21961
+ var child = childElements[i];
21962
+ if (child.tagName.toLowerCase() === "video") {
21963
+ child.muted = true;
21964
+ }
21965
+ }
21966
+ (_window6 = window) === null || _window6 === void 0 || (_window6 = _window6.Apxor) === null || _window6 === void 0 || (_window6$logInternalE = _window6.logInternalEvent) === null || _window6$logInternalE === void 0 || _window6$logInternalE.call(_window6, "story_slides_closed");
21967
+ return;
21968
+ } else if (deltaX > 50 && Math.abs(deltaX) > Math.abs(deltaY)) {
21969
+ var _progress$activeIndex, _progress$activeIndex2, _window8, _window8$logInternalE, _window$ApxorRTM10, _window$ApxorRTM11;
21970
+ _this.swipeRight = true;
21971
+ if (_this.position === _this.config.length - 1) {
21972
+ var _window7, _window7$logInternalE;
21973
+ // If it's the last group, log event and return
21974
+ (_window7 = window) === null || _window7 === void 0 || (_window7 = _window7.Apxor) === null || _window7 === void 0 || (_window7$logInternalE = _window7.logInternalEvent) === null || _window7$logInternalE === void 0 || _window7$logInternalE.call(_window7, "story_slides_closed");
21975
+ var _slide_details_to_be_deleted2 = document.querySelector(".slide-details");
21976
+ var mute_child_elements = _slide_details_to_be_deleted2.querySelectorAll("video");
21977
+ for (var j = 0; j < mute_child_elements.length; j++) {
21978
+ var child1 = mute_child_elements[j];
21979
+ if (child1.tagName.toLowerCase() === "video") {
21980
+ child1.muted = true;
21981
+ }
21982
+ }
21983
+ return;
21984
+ }
21985
+ _this.position++;
21986
+ _this.progress_bar = new ProgressBar$1(_this.config[_this.position].progress_bar);
21987
+ _this.slides = _this.config[_this.position].slides;
21988
+ var slideToStart;
21989
+ if (_this.slides.length === _this.config[_this.position].slides_seen) {
21990
+ slideToStart = 0;
21991
+ } else if (_this.config[_this.position].slides_seen === 0) {
21992
+ slideToStart = 0;
21993
+ } else {
21994
+ slideToStart = _this.config[_this.position].slides_seen;
21995
+ }
21996
+ (_progress$activeIndex = progress[activeIndex]) === null || _progress$activeIndex === void 0 || _progress$activeIndex.classList.remove("active");
21997
+ (_progress$activeIndex2 = progress[activeIndex]) === null || _progress$activeIndex2 === void 0 || _progress$activeIndex2.classList.add("passed");
21998
+ var progressContainer = document.querySelector(".progress-container");
21999
+ progressContainer.innerHTML = "";
22000
+ _this.slides.forEach(function (slide, index) {
22001
+ var progressSlide = document.createElement("div");
22002
+ progressSlide.classList.add("slide".concat(index));
22003
+ progressSlide.classList.add("progress");
22004
+ var slide_duration = slide.duration / 1000;
22005
+ progressSlide.style.animationDuration = "".concat(slide_duration, "s");
22006
+ progressContainer.appendChild(progressSlide);
22007
+ });
22008
+ var progressSegments = progressContainer.querySelectorAll(".progress");
22009
+ for (var _i2 = 0; _i2 < slideToStart; _i2++) {
22010
+ var _progressSegments$_i;
22011
+ (_progressSegments$_i = progressSegments[_i2]) === null || _progressSegments$_i === void 0 || _progressSegments$_i.classList.add("passed");
22012
+ }
22013
+ progressSegments[slideToStart].classList.add("active");
22014
+ Array.from(progressSegments).map(function (el) {
22015
+ return el.addEventListener("animationend", function () {
22016
+ _this.moveToNextSlide();
22017
+ }, false);
22018
+ });
22019
+ _this._getStoriesStyles();
22020
+ _this.storyContainer.removeEventListener("touchend", _this.boundSwipeUpHandling);
22021
+ _this.updateSlideDetails(0);
22022
+ (_window8 = window) === null || _window8 === void 0 || (_window8 = _window8.Apxor) === null || _window8 === void 0 || (_window8$logInternalE = _window8.logInternalEvent) === null || _window8$logInternalE === void 0 || _window8$logInternalE.call(_window8, "story_slide_seen", JSON.stringify({
22023
+ config_id: _this.config[_this.position].id,
22024
+ position: _this.position,
22025
+ index: slideToStart + 1,
22026
+ view_id: _this.view_id
22027
+ }));
22028
+ (_window$ApxorRTM10 = window.ApxorRTM) === null || _window$ApxorRTM10 === void 0 || _window$ApxorRTM10.logEvent("apx_slide_viewed", {
22029
+ apx_slide_number: slideToStart + 1,
22030
+ apx_slide_label: _this.current_slide_config.slide_label,
22031
+ apx_slide_type: _this.currentMediaType,
22032
+ apx_template_name: "stories",
22033
+ apx_nudge_id: _this.config[_this.position].id,
22034
+ apx_nudge_name: _this.config[_this.position].campaign_name,
22035
+ apx_variant_code: _this.config[_this.position].variant_code
22036
+ });
22037
+ var current_time = Date.now();
22038
+ var time_taken;
22039
+ time_taken = (current_time - _this.slideStartTime) / 1000;
22040
+ (_window$ApxorRTM11 = window.ApxorRTM) === null || _window$ApxorRTM11 === void 0 || _window$ApxorRTM11.logEvent("apx_story_changed", {
22041
+ apx_nudge_id: _this.config[_this.position].id,
22042
+ apx_nudge_name: _this.config[_this.position].campaign_name,
22043
+ apx_template_name: "stories",
22044
+ apx_variant_code: _this.config[_this.position].variant_code,
22045
+ apx_slide_number: slideToStart + 1,
22046
+ apx_slide_label: _this.current_slide_config.slide_label,
22047
+ apx_slide_type: _this.currentMediaType,
22048
+ apx_change_action: "swiped-right",
22049
+ apx_time_taken: time_taken
22050
+ });
22051
+ var currentTime = Date.now();
22052
+ _this.slideStartTime = currentTime;
22053
+ return;
22054
+ } else if (deltaX < -50 && Math.abs(deltaX) > Math.abs(deltaY)) {
22055
+ var _progress$activeIndex3, _progress$activeIndex4, _window9, _window9$logInternalE, _window$ApxorRTM12, _window$ApxorRTM13;
22056
+ _this.swipeLeft = true;
22057
+ if (activeIndex === 0 && _this.position === 0) {
22058
+ return;
22059
+ }
22060
+ if (_this.position === 0) {
22061
+ return;
22062
+ }
22063
+ _this.position--;
22064
+ _this.progress_bar = new ProgressBar$1(_this.config[_this.position].progress_bar);
22065
+ _this.slides = _this.config[_this.position].slides;
22066
+ var lastSlideIndex;
22067
+ if (_this.slides.length === _this.config[_this.position].slides_seen) {
22068
+ lastSlideIndex = 0;
22069
+ } else if (_this.config[_this.position].slides_seen === 0) {
22070
+ lastSlideIndex = 0;
22071
+ } else {
22072
+ lastSlideIndex = _this.config[_this.position].slides_seen;
22073
+ }
22074
+ (_progress$activeIndex3 = progress[activeIndex]) === null || _progress$activeIndex3 === void 0 || _progress$activeIndex3.classList.remove("active");
22075
+ (_progress$activeIndex4 = progress[activeIndex]) === null || _progress$activeIndex4 === void 0 || _progress$activeIndex4.classList.add("passed");
22076
+ var _progressContainer2 = document.querySelector(".progress-container");
22077
+ _progressContainer2.innerHTML = "";
22078
+ _this.slides.forEach(function (slide, index) {
22079
+ var progressSlide = document.createElement("div");
22080
+ progressSlide.classList.add("slide".concat(index));
22081
+ progressSlide.classList.add("progress");
22082
+ var slide_duration = slide.duration / 1000;
22083
+ progressSlide.style.animationDuration = "".concat(slide_duration, "s");
22084
+ _progressContainer2.appendChild(progressSlide);
22085
+ });
22086
+ var _progressSegments2 = _progressContainer2.querySelectorAll(".progress");
22087
+ if (_progressSegments2.length > 0) {
22088
+ for (var _i3 = 0; _i3 < lastSlideIndex; _i3++) {
22089
+ var _progressSegments2$_i;
22090
+ (_progressSegments2$_i = _progressSegments2[_i3]) === null || _progressSegments2$_i === void 0 || _progressSegments2$_i.classList.add("passed");
22091
+ }
22092
+ _progressSegments2[lastSlideIndex].classList.add("active");
22093
+ }
22094
+ Array.from(_progressSegments2).map(function (el) {
22095
+ return el.addEventListener("animationend", function () {
22096
+ _this.moveToNextSlide();
22097
+ }, false);
22098
+ });
22099
+ _this._getStoriesStyles();
22100
+ _this.storyContainer.removeEventListener("touchend", _this.boundSwipeUpHandling);
22101
+ _this.updateSlideDetails(lastSlideIndex);
22102
+ (_window9 = window) === null || _window9 === void 0 || (_window9 = _window9.Apxor) === null || _window9 === void 0 || (_window9$logInternalE = _window9.logInternalEvent) === null || _window9$logInternalE === void 0 || _window9$logInternalE.call(_window9, "story_slide_seen", JSON.stringify({
22103
+ config_id: _this.config[_this.position].id,
22104
+ position: _this.position,
22105
+ index: lastSlideIndex + 1,
22106
+ view_id: _this.view_id
22107
+ }));
22108
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
22109
+ (_window$ApxorRTM12 = window.ApxorRTM) === null || _window$ApxorRTM12 === void 0 || _window$ApxorRTM12.logEvent("apx_slide_viewed", {
22110
+ apx_nudge_id: _this.config[_this.position].id,
22111
+ apx_nudge_name: _this.config[_this.position].campaign_name,
22112
+ apx_template_name: "stories",
22113
+ apx_variant_code: _this.config[_this.position].variant_code,
22114
+ apx_slide_number: lastSlideIndex + 1,
22115
+ apx_slide_label: _this.current_slide_config.slide_label,
22116
+ apx_slide_type: _this.currentMediaType
22117
+ });
22118
+ var _current_time2 = Date.now();
22119
+ var _time_taken;
22120
+ _time_taken = (_current_time2 - _this.slideStartTime) / 1000;
22121
+ (_window$ApxorRTM13 = window.ApxorRTM) === null || _window$ApxorRTM13 === void 0 || _window$ApxorRTM13.logEvent("apx_story_changed", {
22122
+ apx_nudge_id: _this.config[_this.position].id,
22123
+ apx_nudge_name: _this.config[_this.position].campaign_name,
22124
+ apx_template_name: "stories",
22125
+ apx_variant_code: _this.config[_this.position].variant_code,
22126
+ apx_slide_number: lastSlideIndex + 1,
22127
+ apx_slide_label: _this.current_slide_config.slide_label,
22128
+ apx_slide_type: _this.currentMediaType,
22129
+ apx_change_action: "swiped-left",
22130
+ apx_time_taken: _time_taken
22131
+ });
22132
+ var _currentTime = Date.now();
22133
+ _this.slideStartTime = _currentTime;
22134
+ return;
22135
+ }
22136
+ }
22137
+ }, 50);
22138
+ });
22139
+ });
22140
+ _defineProperty(this, "Jwju", function () {
22141
+ _this.loader.style.display = "block";
22142
+ var progress = Array.from(document.querySelectorAll(".progress"));
22143
+ var activeIndex = progress.findIndex(function (el) {
22144
+ return el.classList.contains("active");
22145
+ });
22146
+ progress[activeIndex].style.animationPlayState = "paused";
22147
+ var slide_details_to_be_deleted = document.querySelector(".slide-details");
22148
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
22149
+ for (var i = 0; i < childElements.length; i++) {
22150
+ var child = childElements[i];
22151
+ if (child.tagName.toLowerCase() === "video") {
22152
+ child.style.opacity = 0;
22153
+ }
22154
+ }
22155
+ });
22156
+ _defineProperty(this, "vCTl", function () {
22157
+ if (!_this.continueLoading) {
22158
+ var slide_details_to_be_deleted = document.querySelector(".slide-details");
22159
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
22160
+ for (var i = 0; i < childElements.length; i++) {
22161
+ var child = childElements[i];
22162
+ if (child.tagName.toLowerCase() === "video") {
22163
+ child.style.opacity = 1;
22164
+ }
22165
+ }
22166
+ var progress = Array.from(document.querySelectorAll(".progress"));
22167
+ var activeIndex = progress.findIndex(function (el) {
22168
+ return el.classList.contains("active");
22169
+ });
22170
+ progress[activeIndex].style.animationPlayState = "running";
22171
+ var ele = document.querySelector(".loader-1");
22172
+ ele.style.display = "none";
22173
+ _this.loader.style.display = "none";
22174
+ }
22175
+ });
22176
+ _defineProperty(this, "DZYh", function () {
22177
+ if (_this.imageElements.length === 0) return true;
22178
+ return _this.imageElements.every(function (img) {
22179
+ return img.complete;
22180
+ });
22181
+ });
22182
+ _defineProperty(this, "PXQj", function () {
22183
+ if (_this.videoElements.length === 0) return true;
22184
+ return _this.videoElements.every(function (video) {
22185
+ return video.readyState >= 3;
22186
+ });
22187
+ });
22188
+ _defineProperty(this, "rnGL", function () {
22189
+ var bodyStyles = window.getComputedStyle(document.body);
22190
+ var backgroundImage = bodyStyles.backgroundImage;
22191
+ if (backgroundImage && backgroundImage !== "none" && _this.current_slide_config.media_type === "image") {
22192
+ var imageUrl = backgroundImage.slice(5, -2);
22193
+ var loader_ele = document.createElement("div");
22194
+ loader_ele.classList.add = "wrapper";
22195
+ var img = new Image();
22196
+ img.src = imageUrl;
22197
+ if (img.complete) {
22198
+ _this.vCTl();
22199
+ return true;
22200
+ }
22201
+ return false;
22202
+ } else if (_this.current_slide_config.media_type === "video") {
22203
+ var slide_details_to_be_deleted = document.querySelector(".slide-details");
22204
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
22205
+ if (childElements[0].readyState >= 3) {
22206
+ _this.vCTl();
22207
+ return true;
22208
+ }
22209
+ return false;
22210
+ } else {
22211
+ if (_this.videoElements.length == 0 && _this.imageElements.length == 0) {
22212
+ _this.vCTl();
22213
+ return true;
22214
+ } else if (_this.DZYh() && _this.PXQj()) {
22215
+ _this.vCTl();
22216
+ return true;
22217
+ }
22218
+ }
22219
+ });
22220
+ _defineProperty(this, "tBkX", function (event, startY, action) {
22221
+ event.stopPropagation();
22222
+ var endY = event.changedTouches[0].clientY;
22223
+ var deltaY = startY - endY;
22224
+ if (!_this.redirectionFlag) {
22225
+ if (deltaY > 50) {
22226
+ var _window$ApxorRTM14;
22227
+ _this.swipe_up_redirect = true;
22228
+ _this.swipeUpTouch = true;
22229
+ window.Apxor.redirect(JSON.stringify(action));
22230
+ var progress = Array.from(document.querySelectorAll(".progress"));
22231
+ var activeIndex = progress.findIndex(function (el) {
22232
+ return el.classList.contains("active");
22233
+ });
22234
+ _this.current_slide_config.media_type === "none" ? _this.currentMediaType = "builder" : _this.currentMediaType = _this.current_slide_config.media_type;
22235
+ var current_time = Date.now();
22236
+ var time_taken;
22237
+ time_taken = (current_time - _this.slideStartTime) / 1000;
22238
+ (_window$ApxorRTM14 = window.ApxorRTM) === null || _window$ApxorRTM14 === void 0 || _window$ApxorRTM14.logEvent("apx_slide_interaction", {
22239
+ apx_nudge_id: _this.config[_this.position].id,
22240
+ apx_nudge_name: _this.config[_this.position].campaign_name,
22241
+ apx_template_name: "stories",
22242
+ apx_variant_code: _this.config[_this.position].variant_code,
22243
+ apx_slide_number: activeIndex + 1,
22244
+ apx_slide_label: _this.current_slide_config.slide_label,
22245
+ apx_slide_type: _this.currentMediaType,
22246
+ apx_interaction_type: "gesture",
22247
+ apx_time_taken: time_taken
22248
+ });
22249
+ progress[activeIndex].style.animationPlayState = "running";
22250
+ var slide_details_to_be_deleted;
22251
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
22252
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
22253
+ for (var i = 0; i < childElements.length; i++) {
22254
+ var child = childElements[i];
22255
+ if (child.tagName.toLowerCase() === "video") {
22256
+ child.play();
22257
+ }
22258
+ }
22259
+ return;
22260
+ }
22261
+ } else {
22262
+ _this.redirectionFlag = false;
22263
+ }
22264
+ });
22265
+ this.config = _config;
22266
+ this.configId = configId;
22267
+ this.name = name;
22268
+ this.position = position;
22269
+ this.slidesSeenCount = slidesSeenCount;
22270
+ this.view_id = view_id;
22271
+ this.showCallback = showCallback;
22272
+ this.closeCallback = closeCallback;
22273
+ this.progress_bar = new ProgressBar$1(_config[position].progress_bar);
22274
+ this.slides = _config[position].slides;
22275
+ if (this.slides.length === this.slidesSeenCount) {
22276
+ this.slidesSeenCount = 0;
22277
+ }
22278
+ if (this.slidesSeenCount > this.slides.length) {
22279
+ var _window10, _window10$logInternal;
22280
+ (_window10 = window) === null || _window10 === void 0 || (_window10 = _window10.Apxor) === null || _window10 === void 0 || (_window10$logInternal = _window10.logInternalEvent) === null || _window10$logInternal === void 0 || _window10$logInternal.call(_window10, "story_slides_closed");
22281
+ }
22282
+ this.storiesStyles = "";
22283
+ this.progressContainer;
22284
+ this.storyContainer;
22285
+ this.dismissFlag = false;
22286
+ this.videoAudioState = "unmute";
22287
+ this.muteElement;
22288
+ this.progress = [];
22289
+ this.swipeDownFlag = false;
22290
+ this.current_slide_config;
22291
+ this.imageElements = [];
22292
+ this.videoElements = [];
22293
+ this.swipeTouch = false;
22294
+ this.gestureTouch = false;
22295
+ this.swipeLeft = false;
22296
+ this.swipeRight = false;
22297
+ this.slidePaused = false;
22298
+ this.currentMediaType;
22299
+ this.slideStartTime;
22300
+ this.swipeUpTouch = false;
22301
+ this.swipe_up_redirect = false;
22302
+ this.boundSwipeUpHandling;
22303
+ this.redirectionFlag = false;
22304
+ this.startY;
22305
+ this.swipe_action;
22306
+ this.continueLoading = false;
22307
+ this.boundSwipeUpHandling = function (event) {
22308
+ return _this.tBkX(event, _this.startY, _this.swipe_action);
22309
+ };
22310
+ }
22311
+ _createClass(Stories, [{
22312
+ key: "_getStoriesStyles",
22313
+ value: function _getStoriesStyles() {
22314
+ var head = document.head || document.getElementsByTagName("head")[0];
22315
+ var styleNodes = head.querySelectorAll(".apx-progressbar-styles");
22316
+ styleNodes.forEach(function (node) {
22317
+ node.parentNode.removeChild(node);
22318
+ });
22319
+ this.storiesStyles = "\n .progress-container {\n position:absolute;\n top:12px;\n display: flex;\n flex-direction: row;\n width:100%;\n }\n\n *,:before,:after {\n box-sizing: border-box;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n border-width: 0;\n border-style: solid;\n border-color: #e5e7eb\n }\n\n .progress {\n height: 4px;\n flex-grow: 1;\n border-radius: 4px;\n margin: 0 4px;\n display: flex;\n background-image: linear-gradient(\n to right,\n ".concat(this.progress_bar.seen_color, " 0%,\n ").concat(this.progress_bar.seen_color, " 50%,\n ").concat(this.progress_bar.unseen_color, " 50%,\n ").concat(this.progress_bar.unseen_color, " 100%\n );\n background-repeat: no-repeat;\n background-size: 200%;\n background-position: 100% 50%;\n animation-timing-function: linear;\n animation-delay: 0.2s;\n }\n\n .progress.active {\n animation-name: Loader;\n }\n\n .progress.passed { \n background-position: 0 0;\n }\n\n .slide-right {\n animation: 0.5s slide-right forwards;\n background: linear-gradient(to right, rgba(225, 219, 30, 0.99), rgb(36, 202, 238)); \n background-size: 200% 100%;\n }\n \n @keyframes slide-right {\n from {\n background-position: 0% 0;\n }\n to {\n background-position: 100% 0;\n }\n }\n\n @-webkit-keyframes Loader {\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: 0 0;\n }\n }\n\n @keyframes moveUpDownButton {\n 0%,\n 100% {\n bottom: 12px;\n }\n 50% {\n bottom: 32px;\n }\n } \n\n body {\n background: #121216;\n }\n ").replaceAll("\n", "").replace(/[\s]{2,999}/g, "");
22320
+ var styleNode = document.createElement("style");
22321
+ styleNode.setAttribute("apx-stories-styles", "");
22322
+ styleNode.classList.add("apx-progressbar-styles");
22323
+ styleNode.innerHTML = this.storiesStyles;
22324
+ document.head.appendChild(styleNode);
22325
+ return this.storiesStyles;
22326
+ }
22327
+ }, {
22328
+ key: "moveToNextSlide",
22329
+ value: function moveToNextSlide() {
22330
+ var _window$ApxorRTM15, _progress$activeIndex7, _progress$activeIndex8, _progress$nextIndex, _window13, _window13$logInternal, _window$ApxorRTM19, _window$ApxorRTM20;
22331
+ this.storyContainer.removeEventListener("touchend", this.boundSwipeUpHandling);
22332
+ var progress1 = Array.from(document.querySelectorAll(".progress"));
22333
+ var activeIndex1 = progress1.findIndex(function (el) {
22334
+ return el.classList.contains("active");
22335
+ });
22336
+ var current_time_new = Date.now();
22337
+ var time_taken_new;
22338
+ time_taken_new = (current_time_new - this.slideStartTime) / 1000;
22339
+ (_window$ApxorRTM15 = window.ApxorRTM) === null || _window$ApxorRTM15 === void 0 || _window$ApxorRTM15.logEvent("apx_slide_completed", {
22340
+ apx_nudge_id: this.config[this.position].id,
22341
+ apx_nudge_name: this.config[this.position].campaign_name,
22342
+ apx_template_name: "stories",
22343
+ apx_variant_code: this.config[this.position].variant_code,
22344
+ apx_slide_number: activeIndex1 + 1,
22345
+ apx_slide_label: this.current_slide_config.slide_label,
22346
+ apx_time_taken: time_taken_new
22347
+ });
22348
+ var progress = Array.from(document.querySelectorAll(".progress"));
22349
+ var activeIndex = progress.findIndex(function (el) {
22350
+ return el.classList.contains("active");
22351
+ });
22352
+ if (activeIndex === progress.length - 1) {
22353
+ // If at the last slide of the current group
22354
+ if (this.position === this.config.length - 1) {
22355
+ var _window11, _window11$logInternal;
22356
+ // If it's the last group, log event and return
22357
+ (_window11 = window) === null || _window11 === void 0 || (_window11 = _window11.Apxor) === null || _window11 === void 0 || (_window11$logInternal = _window11.logInternalEvent) === null || _window11$logInternal === void 0 || _window11$logInternal.call(_window11, "story_slides_closed");
22358
+ var slide_details_to_be_deleted;
22359
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
22360
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
22361
+ for (var i = 0; i < childElements.length; i++) {
22362
+ var child = childElements[i];
22363
+ if (child.tagName.toLowerCase() === "video") {
22364
+ child.muted = true;
22365
+ }
22366
+ }
22367
+ return;
22368
+ } else {
22369
+ var _progress$activeIndex5, _progress$activeIndex6, _progress$, _window12, _window12$logInternal, _window$ApxorRTM16, _window$ApxorRTM17, _window$ApxorRTM18;
22370
+ // Move to the first slide of the next group
22371
+ // this.Voll();
22372
+ this.position++;
22373
+ this.progress_bar = new ProgressBar$1(this.config[this.position].progress_bar);
22374
+ this.slides = this.config[this.position].slides;
22375
+ this.updateProgressBarSegments();
22376
+ (_progress$activeIndex5 = progress[activeIndex]) === null || _progress$activeIndex5 === void 0 || _progress$activeIndex5.classList.remove("active");
22377
+ (_progress$activeIndex6 = progress[activeIndex]) === null || _progress$activeIndex6 === void 0 || _progress$activeIndex6.classList.add("passed");
22378
+ (_progress$ = progress[0]) === null || _progress$ === void 0 || _progress$.classList.add("active");
22379
+ this.updateSlideDetails(0);
22380
+ (_window12 = window) === null || _window12 === void 0 || (_window12 = _window12.Apxor) === null || _window12 === void 0 || (_window12$logInternal = _window12.logInternalEvent) === null || _window12$logInternal === void 0 || _window12$logInternal.call(_window12, "story_slide_seen", JSON.stringify({
22381
+ config_id: this.config[this.position].id,
22382
+ position: this.position,
22383
+ index: 1,
22384
+ view_id: this.view_id
22385
+ }));
22386
+ var _time_taken2;
22387
+ var _current_time3 = Date.now();
22388
+ _time_taken2 = (_current_time3 - this.slideStartTime) / 1000;
22389
+ this.current_slide_config.media_type === "none" ? this.currentMediaType = "builder" : this.currentMediaType = this.current_slide_config.media_type;
22390
+ (_window$ApxorRTM16 = window.ApxorRTM) === null || _window$ApxorRTM16 === void 0 || _window$ApxorRTM16.logEvent("apx_slide_changed", {
22391
+ apx_nudge_id: this.config[this.position].id,
22392
+ apx_nudge_name: this.config[this.position].campaign_name,
22393
+ apx_template_name: "stories",
22394
+ apx_variant_code: this.config[this.position].variant_code,
22395
+ apx_slide_number: 1,
22396
+ apx_slide_label: this.current_slide_config.slide_label,
22397
+ apx_slide_type: this.currentMediaType,
22398
+ apx_change_action: "next-clicked",
22399
+ apx_time_taken: _time_taken2
22400
+ });
22401
+ (_window$ApxorRTM17 = window.ApxorRTM) === null || _window$ApxorRTM17 === void 0 || _window$ApxorRTM17.logEvent("apx_slide_viewed", {
22402
+ apx_nudge_id: this.config[this.position].id,
22403
+ apx_nudge_name: this.config[this.position].campaign_name,
22404
+ apx_template_name: "stories",
22405
+ apx_variant_code: this.config[this.position].variant_code,
22406
+ apx_slide_number: 1,
22407
+ apx_slide_label: this.current_slide_config.slide_label,
22408
+ apx_slide_type: this.currentMediaType
22409
+ });
22410
+ (_window$ApxorRTM18 = window.ApxorRTM) === null || _window$ApxorRTM18 === void 0 || _window$ApxorRTM18.logEvent("apx_story_changed", {
22411
+ apx_nudge_id: this.config[this.position].id,
22412
+ apx_nudge_name: this.config[this.position].campaign_name,
22413
+ apx_template_name: "stories",
22414
+ apx_variant_code: this.config[this.position].variant_code,
22415
+ apx_slide_number: 1,
22416
+ apx_slide_label: this.current_slide_config.slide_label,
22417
+ apx_slide_type: this.currentMediaType,
22418
+ apx_change_action: "autoplay",
22419
+ apx_time_taken: _time_taken2
22420
+ });
22421
+ var _currentTime2 = Date.now();
22422
+ this.slideStartTime = _currentTime2;
22423
+ return;
22424
+ }
22425
+ }
22426
+
22427
+ // Move to the next slide within the current group
22428
+ var nextIndex = activeIndex + 1;
22429
+ (_progress$activeIndex7 = progress[activeIndex]) === null || _progress$activeIndex7 === void 0 || _progress$activeIndex7.classList.remove("active");
22430
+ (_progress$activeIndex8 = progress[activeIndex]) === null || _progress$activeIndex8 === void 0 || _progress$activeIndex8.classList.add("passed");
22431
+ (_progress$nextIndex = progress[nextIndex]) === null || _progress$nextIndex === void 0 || _progress$nextIndex.classList.add("active");
22432
+ this.updateSlideDetails(nextIndex);
22433
+ (_window13 = window) === null || _window13 === void 0 || (_window13 = _window13.Apxor) === null || _window13 === void 0 || (_window13$logInternal = _window13.logInternalEvent) === null || _window13$logInternal === void 0 || _window13$logInternal.call(_window13, "story_slide_seen", JSON.stringify({
22434
+ config_id: this.config[this.position].id,
22435
+ position: this.position,
22436
+ index: activeIndex + 2,
22437
+ view_id: this.view_id
22438
+ }));
22439
+ this.current_slide_config.media_type === "none" ? this.currentMediaType = "builder" : this.currentMediaType = this.current_slide_config.media_type;
22440
+ var time_taken;
22441
+ var current_time = Date.now();
22442
+ time_taken = (current_time - this.slideStartTime) / 1000;
22443
+ (_window$ApxorRTM19 = window.ApxorRTM) === null || _window$ApxorRTM19 === void 0 || _window$ApxorRTM19.logEvent("apx_slide_changed", {
22444
+ apx_nudge_id: this.config[this.position].id,
22445
+ apx_nudge_name: this.config[this.position].campaign_name,
22446
+ apx_template_name: "stories",
22447
+ apx_variant_code: this.config[this.position].variant_code,
22448
+ apx_slide_number: activeIndex + 2,
22449
+ apx_slide_label: this.current_slide_config.slide_label,
22450
+ apx_slide_type: this.currentMediaType,
22451
+ apx_change_action: "next-clicked",
22452
+ apx_time_taken: time_taken
22453
+ });
22454
+ (_window$ApxorRTM20 = window.ApxorRTM) === null || _window$ApxorRTM20 === void 0 || _window$ApxorRTM20.logEvent("apx_slide_viewed", {
22455
+ apx_nudge_id: this.config[this.position].id,
22456
+ apx_nudge_name: this.config[this.position].campaign_name,
22457
+ apx_template_name: "stories",
22458
+ apx_variant_code: this.config[this.position].variant_code,
22459
+ apx_slide_number: activeIndex + 2,
22460
+ apx_slide_label: this.current_slide_config.slide_label,
22461
+ apx_slide_type: this.currentMediaType
22462
+ });
22463
+ var currentTime = Date.now();
22464
+ this.slideStartTime = currentTime;
22465
+ }
22466
+ }, {
22467
+ key: "moveToPreviousSlide",
22468
+ value: function moveToPreviousSlide() {
22469
+ var _window$ApxorRTM21, _progress$activeIndex11, _progress$activeIndex12, _progress$previousInd, _progress$previousInd2, _window15, _window15$logInternal, _window$ApxorRTM25, _window$ApxorRTM26;
22470
+ this.storyContainer.removeEventListener("touchend", this.boundSwipeUpHandling);
22471
+ var progress1 = Array.from(document.querySelectorAll(".progress"));
22472
+ var activeIndex1 = progress1.findIndex(function (el) {
22473
+ return el.classList.contains("active");
22474
+ });
22475
+ var current_time_new = Date.now();
22476
+ var time_taken_new;
22477
+ time_taken_new = (current_time_new - this.slideStartTime) / 1000;
22478
+ (_window$ApxorRTM21 = window.ApxorRTM) === null || _window$ApxorRTM21 === void 0 || _window$ApxorRTM21.logEvent("apx_slide_completed", {
22479
+ apx_nudge_id: this.config[this.position].id,
22480
+ apx_nudge_name: this.config[this.position].campaign_name,
22481
+ apx_template_name: "stories",
22482
+ apx_variant_code: this.config[this.position].variant_code,
22483
+ apx_slide_number: activeIndex1 + 1,
22484
+ apx_slide_label: this.current_slide_config.slide_label,
22485
+ apx_time_taken: time_taken_new
22486
+ });
22487
+ var progress = Array.from(document.querySelectorAll(".progress"));
22488
+ var activeIndex = progress.findIndex(function (el) {
22489
+ return el.classList.contains("active");
22490
+ });
22491
+ if (activeIndex === 0 && this.position === 0) {
22492
+ return;
22493
+ }
22494
+ if (activeIndex === 0) {
22495
+ var _progress$activeIndex9, _progress$activeIndex10, _progress$lastSlideIn, _window14, _window14$logInternal, _window$ApxorRTM22, _window$ApxorRTM23, _window$ApxorRTM24;
22496
+ // If at the first slide of the current group, move to the last slide of the previous group
22497
+ // this.Voll();
22498
+ this.position--;
22499
+ this.progress_bar = new ProgressBar$1(this.config[this.position].progress_bar);
22500
+ this.slides = this.config[this.position].slides;
22501
+ this.updateProgressBarSegments(true);
22502
+ var lastSlideIndex = this.slides.length - 1;
22503
+ (_progress$activeIndex9 = progress[activeIndex]) === null || _progress$activeIndex9 === void 0 || _progress$activeIndex9.classList.remove("active");
22504
+ (_progress$activeIndex10 = progress[activeIndex]) === null || _progress$activeIndex10 === void 0 || _progress$activeIndex10.classList.add("passed");
22505
+ (_progress$lastSlideIn = progress[lastSlideIndex]) === null || _progress$lastSlideIn === void 0 || _progress$lastSlideIn.classList.add("active");
22506
+ this.updateSlideDetails(lastSlideIndex);
22507
+ (_window14 = window) === null || _window14 === void 0 || (_window14 = _window14.Apxor) === null || _window14 === void 0 || (_window14$logInternal = _window14.logInternalEvent) === null || _window14$logInternal === void 0 || _window14$logInternal.call(_window14, "story_slide_seen", JSON.stringify({
22508
+ config_id: this.config[this.position].id,
22509
+ position: this.position,
22510
+ index: lastSlideIndex + 1,
22511
+ view_id: this.view_id
22512
+ }));
22513
+ this.current_slide_config.media_type === "none" ? this.currentMediaType = "builder" : this.currentMediaType = this.current_slide_config.media_type;
22514
+ var _time_taken3;
22515
+ var _current_time4 = Date.now();
22516
+ _time_taken3 = (_current_time4 - this.slideStartTime) / 1000;
22517
+ (_window$ApxorRTM22 = window.ApxorRTM) === null || _window$ApxorRTM22 === void 0 || _window$ApxorRTM22.logEvent("apx_slide_changed", {
22518
+ apx_nudge_id: this.config[this.position].id,
22519
+ apx_nudge_name: this.config[this.position].campaign_name,
22520
+ apx_template_name: "stories",
22521
+ apx_variant_code: this.config[this.position].variant_code,
22522
+ apx_slide_number: lastSlideIndex + 1,
22523
+ apx_slide_label: this.current_slide_config.slide_label,
22524
+ apx_slide_type: this.currentMediaType,
22525
+ apx_change_action: "previous-clicked",
22526
+ apx_time_taken: _time_taken3
22527
+ });
22528
+ (_window$ApxorRTM23 = window.ApxorRTM) === null || _window$ApxorRTM23 === void 0 || _window$ApxorRTM23.logEvent("apx_slide_viewed", {
22529
+ apx_nudge_id: this.config[this.position].id,
22530
+ apx_nudge_name: this.config[this.position].campaign_name,
22531
+ apx_template_name: "stories",
22532
+ apx_variant_code: this.config[this.position].variant_code,
22533
+ apx_slide_number: lastSlideIndex + 1,
22534
+ apx_slide_label: this.current_slide_config.slide_label,
22535
+ apx_slide_type: this.currentMediaType
22536
+ });
22537
+ (_window$ApxorRTM24 = window.ApxorRTM) === null || _window$ApxorRTM24 === void 0 || _window$ApxorRTM24.logEvent("apx_story_changed", {
22538
+ apx_nudge_id: this.config[this.position].id,
22539
+ apx_nudge_name: this.config[this.position].campaign_name,
22540
+ apx_template_name: "stories",
22541
+ apx_variant_code: this.config[this.position].variant_code,
22542
+ apx_slide_number: lastSlideIndex + 1,
22543
+ apx_slide_label: this.current_slide_config.slide_label,
22544
+ apx_slide_type: this.currentMediaType,
22545
+ apx_change_action: "autoplay",
22546
+ apx_time_taken: _time_taken3
22547
+ });
22548
+ var _currentTime3 = Date.now();
22549
+ this.slideStartTime = _currentTime3;
22550
+ return;
22551
+ }
22552
+ // Move to the previous slide within the current group
22553
+ var previousIndex = activeIndex - 1;
22554
+ (_progress$activeIndex11 = progress[activeIndex]) === null || _progress$activeIndex11 === void 0 || _progress$activeIndex11.classList.remove("active");
22555
+ (_progress$activeIndex12 = progress[activeIndex]) === null || _progress$activeIndex12 === void 0 || _progress$activeIndex12.classList.add("passed");
22556
+ (_progress$previousInd = progress[previousIndex]) === null || _progress$previousInd === void 0 || _progress$previousInd.classList.remove("passed");
22557
+ (_progress$previousInd2 = progress[previousIndex]) === null || _progress$previousInd2 === void 0 || _progress$previousInd2.classList.add("active");
22558
+ var noOfSegments = progress.length;
22559
+ for (var i = activeIndex; i < noOfSegments; i++) {
22560
+ var _progress$i;
22561
+ (_progress$i = progress[i]) === null || _progress$i === void 0 || _progress$i.classList.remove("passed");
22562
+ }
22563
+ this.updateSlideDetails(previousIndex);
22564
+ (_window15 = window) === null || _window15 === void 0 || (_window15 = _window15.Apxor) === null || _window15 === void 0 || (_window15$logInternal = _window15.logInternalEvent) === null || _window15$logInternal === void 0 || _window15$logInternal.call(_window15, "story_slide_seen", JSON.stringify({
22565
+ config_id: this.config[this.position].id,
22566
+ position: this.position,
22567
+ index: activeIndex,
22568
+ view_id: this.view_id
22569
+ }));
22570
+ var currentTime = Date.now();
22571
+ this.current_slide_config.media_type === "none" ? this.currentMediaType = "builder" : this.currentMediaType = this.current_slide_config.media_type;
22572
+ var time_taken;
22573
+ var current_time = Date.now();
22574
+ time_taken = (current_time - this.slideStartTime) / 1000;
22575
+ (_window$ApxorRTM25 = window.ApxorRTM) === null || _window$ApxorRTM25 === void 0 || _window$ApxorRTM25.logEvent("apx_slide_changed", {
22576
+ apx_nudge_id: this.config[this.position].id,
22577
+ apx_nudge_name: this.config[this.position].campaign_name,
22578
+ apx_template_name: "stories",
22579
+ apx_variant_code: this.config[this.position].variant_code,
22580
+ apx_slide_number: activeIndex,
22581
+ apx_slide_label: this.current_slide_config.slide_label,
22582
+ apx_slide_type: this.currentMediaType,
22583
+ apx_change_action: "previous-clicked",
22584
+ apx_time_taken: time_taken
22585
+ });
22586
+ (_window$ApxorRTM26 = window.ApxorRTM) === null || _window$ApxorRTM26 === void 0 || _window$ApxorRTM26.logEvent("apx_slide_viewed", {
22587
+ apx_nudge_id: this.config[this.position].id,
22588
+ apx_nudge_name: this.config[this.position].campaign_name,
22589
+ apx_template_name: "stories",
22590
+ apx_variant_code: this.config[this.position].variant_code,
22591
+ apx_slide_number: activeIndex,
22592
+ apx_slide_label: this.current_slide_config.slide_label,
22593
+ apx_slide_type: this.currentMediaType
22594
+ });
22595
+ this.slideStartTime = currentTime;
22596
+ }
22597
+ }, {
22598
+ key: "updateSlideDetails",
22599
+ value: function updateSlideDetails(activeIndex) {
22600
+ var _this2 = this;
22601
+ // Update slide details for the new active slide
22602
+ var existingAbsoluteElements = document.querySelectorAll(".apx-slide-header");
22603
+ existingAbsoluteElements.forEach(function (element) {
22604
+ element.remove();
22605
+ });
22606
+ var currentSlideDetails = document.querySelector(".slide-details");
22607
+ currentSlideDetails.style.display = "none";
22608
+ currentSlideDetails.innerHTML = "";
22609
+ currentSlideDetails.style.display = "flex";
22610
+
22611
+ // Get details of the new active slide
22612
+ var current_slide_from_config = this.slides[activeIndex];
22613
+ this.current_slide_config = current_slide_from_config;
22614
+
22615
+ // Update slide details
22616
+ var slideHeader = document.createElement("div");
22617
+ slideHeader.classList.add("slide-header");
22618
+ slideHeader.style.position = "relative";
22619
+ slideHeader.style.top = "20px";
22620
+ // Append slide header to slide details container
22621
+ currentSlideDetails.appendChild(slideHeader);
22622
+
22623
+ // Update slide content
22624
+ var element;
22625
+ if ((current_slide_from_config === null || current_slide_from_config === void 0 ? void 0 : current_slide_from_config.media_type) === "image") {
22626
+ var _window$Apxor4;
22627
+ element = document.createElement("div");
22628
+ var image_src;
22629
+ var image_ext;
22630
+ if (((_window$Apxor4 = window.Apxor) === null || _window$Apxor4 === void 0 ? void 0 : _window$Apxor4.platform) != "ios") {
22631
+ image_ext = getFileExtension(current_slide_from_config.media_url);
22632
+ image_src = window.Apxor.getFilePath(this.config[this.position].id, current_slide_from_config.media_url, image_ext);
22633
+ if (image_src && image_src != "") {
22634
+ document.body.style.backgroundImage = "url(".concat(image_src, ")");
22635
+ document.body.style.backgroundSize = "100% auto";
22636
+ document.body.style.backgroundPosition = "center";
22637
+ document.body.style.backgroundRepeat = "no-repeat";
22638
+ } else {
22639
+ document.body.style.backgroundImage = "url(".concat(current_slide_from_config.media_url, ")");
22640
+ document.body.style.backgroundSize = "100% auto";
22641
+ document.body.style.backgroundPosition = "center";
22642
+ document.body.style.backgroundRepeat = "no-repeat";
22643
+ }
22644
+ } else {
22645
+ document.body.style.backgroundImage = "url(".concat(current_slide_from_config.media_url, ")");
22646
+ document.body.style.backgroundSize = "100% auto";
22647
+ document.body.style.backgroundPosition = "center";
22648
+ document.body.style.backgroundRepeat = "no-repeat";
22649
+ }
22650
+ document.body.style.backgroundColor = current_slide_from_config.media_background_color;
22651
+ document.body.style.margin = "0px";
22652
+ } else if ((current_slide_from_config === null || current_slide_from_config === void 0 ? void 0 : current_slide_from_config.media_type) === "video") {
22653
+ var _window$Apxor5;
22654
+ document.body.style.backgroundImage = "";
22655
+ document.body.style.backgroundSize = "";
22656
+ document.body.style.backgroundPosition = "";
22657
+ document.body.style.backgroundRepeat = "";
22658
+ element = document.createElement("video");
22659
+ element.classList.add("apx-story-video");
22660
+ element.disablePictureInPicture = true;
22661
+ element.autoplay = true;
22662
+ var sourceElement = document.createElement("source");
22663
+ sourceElement.setAttribute("src", current_slide_from_config.media_url);
22664
+ sourceElement.setAttribute("type", "video/mp4");
22665
+ element.appendChild(sourceElement);
22666
+ element.style.width = "100%";
22667
+ element.style.height = "auto";
22668
+ document.body.style.backgroundColor = current_slide_from_config.media_background_color;
22669
+ document.body.style.margin = "0px";
22670
+ if (((_window$Apxor5 = window.Apxor) === null || _window$Apxor5 === void 0 ? void 0 : _window$Apxor5.platform) === "ios") {
22671
+ element.playsInline = true;
22672
+ }
22673
+ element.style.alignItems = "center";
22674
+ element.style.objectFit = "cover";
22675
+ element.style.display = "flex";
22676
+ element.style.alignItems = "center";
22677
+ } else if ((current_slide_from_config === null || current_slide_from_config === void 0 ? void 0 : current_slide_from_config.media_type) === "none") {
22678
+ document.body.style.backgroundImage = "";
22679
+ document.body.style.backgroundSize = "";
22680
+ document.body.style.backgroundPosition = "";
22681
+ document.body.style.backgroundRepeat = "";
22682
+ // If media type is none ,build each element in story using builder approach
22683
+ // Create custom content
22684
+ var updated_layout_without_absolute_elements = JSON.parse(JSON.stringify(current_slide_from_config.layout));
22685
+ delete updated_layout_without_absolute_elements["absolute_position_children"];
22686
+ element = this.HjRo(updated_layout_without_absolute_elements);
22687
+ }
22688
+ // Append slide content to slide details container
22689
+
22690
+ document.body.style.backgroundColor = current_slide_from_config.media_background_color;
22691
+ document.body.style.margin = "0px";
22692
+ currentSlideDetails.appendChild(element);
22693
+ this.Jwju();
22694
+
22695
+ // Handle absolute position children
22696
+ if (current_slide_from_config.layout.absolute_position_children && current_slide_from_config.layout.absolute_position_children.length > 0) {
22697
+ current_slide_from_config.layout.absolute_position_children.forEach(function (childConfig) {
22698
+ var childElement = _this2.HjRo(childConfig);
22699
+ // Append absolute position children to slide details container
22700
+ currentSlideDetails.appendChild(childElement);
22701
+ });
22702
+ }
22703
+ window.intervalToCheckImgStatus2 = setInterval(function () {
22704
+ if (_this2.rnGL()) {
22705
+ clearInterval(window.intervalToCheckImgStatus2);
22706
+ }
22707
+ }, 500);
22708
+ }
22709
+ }, {
22710
+ key: "updateProgressBarSegments",
22711
+ value: function updateProgressBarSegments() {
22712
+ var _this3 = this;
22713
+ var previousChecker = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
22714
+ // Update progress bar segments based on the number of slides in the current group
22715
+ var progressContainer = document.querySelector(".progress-container");
22716
+ progressContainer.innerHTML = "";
22717
+ this.slides.forEach(function (slide, index) {
22718
+ var progressSlide = document.createElement("div");
22719
+ progressSlide.classList.add("slide".concat(index));
22720
+ progressSlide.classList.add("progress");
22721
+ var slide_duration = slide.duration / 1000;
22722
+ progressSlide.style.animationDuration = "".concat(slide_duration, "s");
22723
+ progressContainer.appendChild(progressSlide);
22724
+ });
22725
+ var progressSegments = progressContainer.querySelectorAll(".progress");
22726
+ if (progressSegments.length > 0) {
22727
+ if (previousChecker) {
22728
+ for (var i = 0; i < progressSegments.length - 1; i++) {
22729
+ var _progressSegments$i2;
22730
+ (_progressSegments$i2 = progressSegments[i]) === null || _progressSegments$i2 === void 0 || _progressSegments$i2.classList.add("passed");
22731
+ }
22732
+ progressSegments[progressSegments.length - 1].classList.add("active");
22733
+ } else {
22734
+ progressSegments[0].classList.add("active");
22735
+ }
22736
+ }
22737
+ Array.from(progressSegments).map(function (el) {
22738
+ return el.addEventListener("animationend", function () {
22739
+ _this3.moveToNextSlide();
22740
+ }, false);
22741
+ });
22742
+ this._getStoriesStyles();
22743
+ }
22744
+ }]);
22745
+ return Stories;
22746
+ }();
22747
+
21040
22748
  var RTM = /*#__PURE__*/_createClass(function RTM() {
21041
22749
  var _this = this;
21042
22750
  _classCallCheck(this, RTM);
21043
- _defineProperty(this, "ZeeY", {});
22751
+ _defineProperty(this, "RxKq", {});
21044
22752
  _defineProperty(this, "isShowingAction", false);
21045
22753
  _defineProperty(this, "currentAction", null);
21046
- _defineProperty(this, "XhLY", null);
21047
- _defineProperty(this, "version", 61);
22754
+ _defineProperty(this, "sOOz", null);
22755
+ _defineProperty(this, "version", 71);
21048
22756
  _defineProperty(this, "isInitialised", false);
21049
- _defineProperty(this, "bBhw", {});
21050
- _defineProperty(this, "QDeD", false);
22757
+ _defineProperty(this, "jkaK", {});
22758
+ _defineProperty(this, "pNeK", false);
21051
22759
  _defineProperty(this, "_isShownECCalled", false);
21052
- _defineProperty(this, "DuFv", function () {
22760
+ _defineProperty(this, "BYKy", function () {
21053
22761
  _this.isInitialised = true;
21054
22762
  var oldPushState = history.pushState;
21055
22763
  history.pushState = function pushState() {
@@ -21074,7 +22782,7 @@
21074
22782
  });
21075
22783
  _defineProperty(this, "show", function (uiJson, duration, uuid, name) {
21076
22784
  if (!_this.isInitialised) {
21077
- _this.DuFv();
22785
+ _this.BYKy();
21078
22786
  }
21079
22787
  window.addEventListener("pagehide", function () {
21080
22788
  var _window$Apxor, _window$Apxor$pageUnl;
@@ -21101,7 +22809,7 @@
21101
22809
  } else if (ui_config.display_type === "new-inline" || ui_config.action_class === "tooltip_builder") {
21102
22810
  _this.createInLineToolTip(ui_config, duration, uuid, name, ui_config.action_class === "tooltip_builder" ? "tooltip_builder" : "new-inline");
21103
22811
  } else if (ui_config.display_type === "coach_mark_v2") {
21104
- _this.QCTE(ui_config, duration, uuid, name);
22812
+ _this.iGMR(ui_config, duration, uuid, name);
21105
22813
  } else {
21106
22814
  showCoachmarkWithDelay(_this, ui_config, {
21107
22815
  configId: uuid,
@@ -21198,17 +22906,45 @@
21198
22906
  });
21199
22907
  cardsContainer.showEmbedCards();
21200
22908
  });
22909
+ _defineProperty(this, "showStories", function (config, duration, configId, name, position, slidesSeenCount, view_id) {
22910
+ try {
22911
+ config = config.split("\n").join("\\n");
22912
+ var ui_config = JSON.parse(config);
22913
+ _this.jQXU(ui_config, configId, name, position, slidesSeenCount, view_id);
22914
+ } catch (e) {
22915
+ var _window$Apxor3;
22916
+ if (((_window$Apxor3 = window.Apxor) === null || _window$Apxor3 === void 0 ? void 0 : _window$Apxor3.platform) === "ios") {
22917
+ var _window14, _window14$logInternal, _window15, _window15$updateFlag;
22918
+ (_window14 = window) === null || _window14 === void 0 || (_window14 = _window14.Apxor) === null || _window14 === void 0 || (_window14$logInternal = _window14.logInternalEvent) === null || _window14$logInternal === void 0 || _window14$logInternal.call(_window14, "story_slides_closed");
22919
+ (_window15 = window) === null || _window15 === void 0 || (_window15 = _window15.Apxor) === null || _window15 === void 0 || (_window15$updateFlag = _window15.updateFlag) === null || _window15$updateFlag === void 0 || _window15$updateFlag.call(_window15, false, "IN_APP");
22920
+ } else {
22921
+ var _window16, _window16$updateFlag;
22922
+ (_window16 = window) === null || _window16 === void 0 || (_window16 = _window16.Apxor) === null || _window16 === void 0 || (_window16$updateFlag = _window16.updateFlag) === null || _window16$updateFlag === void 0 || _window16$updateFlag.call(_window16, "IN_APP", false);
22923
+ }
22924
+ console.error(e);
22925
+ }
22926
+ });
22927
+ _defineProperty(this, "jQXU", function (config, configId, name, position, slidesSeenCount, view_id) {
22928
+ var cardsContainer = new Stories(config, configId, name, position, slidesSeenCount, view_id, function () {
22929
+ window.Apxor.logAppEvent("apx_nudge_shown", {
22930
+ campaignName: name,
22931
+ id: configId,
22932
+ apx_nudge_type: "stories"
22933
+ });
22934
+ }, function () {});
22935
+ cardsContainer.showStories();
22936
+ });
21201
22937
  _defineProperty(this, "removeAll", function () {
21202
- var _window14, _window14$updateFlag;
21203
- (_window14 = window) === null || _window14 === void 0 || (_window14 = _window14.Apxor) === null || _window14 === void 0 || (_window14$updateFlag = _window14.updateFlag) === null || _window14$updateFlag === void 0 || _window14$updateFlag.call(_window14, false);
22938
+ var _window17, _window17$updateFlag;
22939
+ (_window17 = window) === null || _window17 === void 0 || (_window17 = _window17.Apxor) === null || _window17 === void 0 || (_window17$updateFlag = _window17.updateFlag) === null || _window17$updateFlag === void 0 || _window17$updateFlag.call(_window17, false);
21204
22940
  if (_this.currentAction !== null && _this.currentAction !== undefined) {
21205
22941
  _this.isShowingAction = false;
21206
22942
  try {
21207
- var _window15;
22943
+ var _window18;
21208
22944
  _this.currentAction();
21209
22945
  _this.currentAction = null;
21210
22946
  console.log("Callback is called");
21211
- (_window15 = window) === null || _window15 === void 0 || (_window15 = _window15.ApxorLogger) === null || _window15 === void 0 || _window15.debug("Callback is called");
22947
+ (_window18 = window) === null || _window18 === void 0 || (_window18 = _window18.ApxorLogger) === null || _window18 === void 0 || _window18.debug("Callback is called");
21212
22948
  } catch (e) {}
21213
22949
  }
21214
22950
  });
@@ -21220,48 +22956,48 @@
21220
22956
  var onShow = function onShow() {
21221
22957
  _this.isShowingAction = true;
21222
22958
  if (window.Apxor && window.Apxor.logActionEvent) {
21223
- var _window16, _window16$updateFlag, _window17, _window17$updateCount;
21224
- (_window16 = window) === null || _window16 === void 0 || (_window16 = _window16.Apxor) === null || _window16 === void 0 || (_window16$updateFlag = _window16.updateFlag) === null || _window16$updateFlag === void 0 || _window16$updateFlag.call(_window16, true);
22959
+ var _window19, _window19$updateFlag, _window20, _window20$updateCount;
22960
+ (_window19 = window) === null || _window19 === void 0 || (_window19 = _window19.Apxor) === null || _window19 === void 0 || (_window19$updateFlag = _window19.updateFlag) === null || _window19$updateFlag === void 0 || _window19$updateFlag.call(_window19, true);
21225
22961
  window.Apxor.logActionEvent("inline_shown", uuid, name);
21226
- (_window17 = window) === null || _window17 === void 0 || (_window17 = _window17.Apxor) === null || _window17 === void 0 || (_window17$updateCount = _window17.updateCount) === null || _window17$updateCount === void 0 || _window17$updateCount.call(_window17, uuid);
22962
+ (_window20 = window) === null || _window20 === void 0 || (_window20 = _window20.Apxor) === null || _window20 === void 0 || (_window20$updateCount = _window20.updateCount) === null || _window20$updateCount === void 0 || _window20$updateCount.call(_window20, uuid);
21227
22963
  if (ui_config !== null && ui_config !== void 0 && ui_config.is_preview) {
21228
22964
  setTimeout(function () {
21229
- var _window18, _window18$logInternal;
21230
- (_window18 = window) === null || _window18 === void 0 || (_window18 = _window18.Apxor) === null || _window18 === void 0 || (_window18$logInternal = _window18.logInternalEvent) === null || _window18$logInternal === void 0 || _window18$logInternal.call(_window18, "capt");
22965
+ var _window21, _window21$logInternal;
22966
+ (_window21 = window) === null || _window21 === void 0 || (_window21 = _window21.Apxor) === null || _window21 === void 0 || (_window21$logInternal = _window21.logInternalEvent) === null || _window21$logInternal === void 0 || _window21$logInternal.call(_window21, "capt");
21231
22967
  }, 500);
21232
22968
  }
21233
22969
  }
21234
22970
  };
21235
22971
  var onHide = function onHide(isCancelled) {
21236
- var _window19, _window19$updateFlag, _window20;
22972
+ var _window22, _window22$updateFlag, _window23;
21237
22973
  _this.isShowingAction = false;
21238
22974
  _this.currentAction = null;
21239
- _this.XhLY = null;
21240
- (_window19 = window) === null || _window19 === void 0 || (_window19 = _window19.Apxor) === null || _window19 === void 0 || (_window19$updateFlag = _window19.updateFlag) === null || _window19$updateFlag === void 0 || _window19$updateFlag.call(_window19, false);
22975
+ _this.sOOz = null;
22976
+ (_window22 = window) === null || _window22 === void 0 || (_window22 = _window22.Apxor) === null || _window22 === void 0 || (_window22$updateFlag = _window22.updateFlag) === null || _window22$updateFlag === void 0 || _window22$updateFlag.call(_window22, false);
21241
22977
  if (window.Apxor && window.Apxor.logActionEvent && !isCancelled) {
21242
22978
  window.Apxor.logActionEvent("inline_dismissed", uuid, name);
21243
22979
  }
21244
- if (((_window20 = window) === null || _window20 === void 0 || (_window20 = _window20.ApxorWebView) === null || _window20 === void 0 ? void 0 : _window20.getLayoutType()) === "web-inline") {
21245
- var _window21;
21246
- (_window21 = window) === null || _window21 === void 0 || (_window21 = _window21.ApxorWebView) === null || _window21 === void 0 || _window21.removeWebView();
22980
+ if (((_window23 = window) === null || _window23 === void 0 || (_window23 = _window23.ApxorWebView) === null || _window23 === void 0 ? void 0 : _window23.getLayoutType()) === "web-inline") {
22981
+ var _window24;
22982
+ (_window24 = window) === null || _window24 === void 0 || (_window24 = _window24.ApxorWebView) === null || _window24 === void 0 || _window24.removeWebView();
21247
22983
  }
21248
22984
  };
21249
22985
  if (action_class === "new-inline") {
21250
- _this.XhLY = new InLineTooltip(ui_config, [], [], terminationConfig, {
22986
+ _this.sOOz = new InLineTooltip(ui_config, [], [], terminationConfig, {
21251
22987
  configId: uuid,
21252
22988
  configName: name
21253
22989
  }, _this, onShow, onHide, function () {}, false, 0);
21254
22990
  } else if (action_class === "tooltip_builder") {
21255
- _this.XhLY = new NewInLineTooltip(ui_config, terminationConfig, {
22991
+ _this.sOOz = new NewInLineTooltip(ui_config, terminationConfig, {
21256
22992
  configId: uuid,
21257
22993
  configName: name
21258
22994
  }, _this, onShow, onHide);
21259
22995
  }
21260
22996
  setTimeout(function () {
21261
- _this.XhLY.createNewTooltip();
22997
+ _this.sOOz.createNewTooltip();
21262
22998
  }, ui_config.delay);
21263
22999
  });
21264
- _defineProperty(this, "QCTE", function (ui_config, duration, uuid, name) {
23000
+ _defineProperty(this, "iGMR", function (ui_config, duration, uuid, name) {
21265
23001
  var terminationConfig = {};
21266
23002
  terminationConfig["auto_dismiss"] = duration > 0;
21267
23003
  terminationConfig["duration"] = duration;
@@ -21271,35 +23007,35 @@
21271
23007
  }, _this, function () {
21272
23008
  _this.isShowingAction = true;
21273
23009
  if (window.Apxor && window.Apxor.logActionEvent) {
21274
- var _window22, _window22$updateFlag;
21275
- (_window22 = window) === null || _window22 === void 0 || (_window22 = _window22.Apxor) === null || _window22 === void 0 || (_window22$updateFlag = _window22.updateFlag) === null || _window22$updateFlag === void 0 || _window22$updateFlag.call(_window22, true);
23010
+ var _window25, _window25$updateFlag;
23011
+ (_window25 = window) === null || _window25 === void 0 || (_window25 = _window25.Apxor) === null || _window25 === void 0 || (_window25$updateFlag = _window25.updateFlag) === null || _window25$updateFlag === void 0 || _window25$updateFlag.call(_window25, true);
21276
23012
  window.Apxor.logActionEvent("inline_shown", uuid, name);
21277
23013
  if (ui_config !== null && ui_config !== void 0 && ui_config.is_preview) {
21278
23014
  setTimeout(function () {
21279
- var _window23, _window23$logInternal;
21280
- (_window23 = window) === null || _window23 === void 0 || (_window23 = _window23.Apxor) === null || _window23 === void 0 || (_window23$logInternal = _window23.logInternalEvent) === null || _window23$logInternal === void 0 || _window23$logInternal.call(_window23, "capt");
23015
+ var _window26, _window26$logInternal;
23016
+ (_window26 = window) === null || _window26 === void 0 || (_window26 = _window26.Apxor) === null || _window26 === void 0 || (_window26$logInternal = _window26.logInternalEvent) === null || _window26$logInternal === void 0 || _window26$logInternal.call(_window26, "capt");
21281
23017
  }, 500);
21282
23018
  }
21283
23019
  }
21284
23020
  }, function (isCancelled) {
21285
- var _window24, _window24$updateFlag, _window25;
23021
+ var _window27, _window27$updateFlag, _window28;
21286
23022
  _this.isShowingAction = false;
21287
23023
  _this.currentAction = null;
21288
- _this.XhLY = null;
21289
- (_window24 = window) === null || _window24 === void 0 || (_window24 = _window24.Apxor) === null || _window24 === void 0 || (_window24$updateFlag = _window24.updateFlag) === null || _window24$updateFlag === void 0 || _window24$updateFlag.call(_window24, false);
23024
+ _this.sOOz = null;
23025
+ (_window27 = window) === null || _window27 === void 0 || (_window27 = _window27.Apxor) === null || _window27 === void 0 || (_window27$updateFlag = _window27.updateFlag) === null || _window27$updateFlag === void 0 || _window27$updateFlag.call(_window27, false);
21290
23026
  if (window.Apxor && window.Apxor.logActionEvent && !isCancelled) {
21291
23027
  window.Apxor.logActionEvent("inline_dismissed", uuid, name);
21292
23028
  }
21293
- if (((_window25 = window) === null || _window25 === void 0 || (_window25 = _window25.ApxorWebView) === null || _window25 === void 0 ? void 0 : _window25.getLayoutType()) === "web-inline") {
21294
- var _window26;
21295
- (_window26 = window) === null || _window26 === void 0 || (_window26 = _window26.ApxorWebView) === null || _window26 === void 0 || _window26.removeWebView();
23029
+ if (((_window28 = window) === null || _window28 === void 0 || (_window28 = _window28.ApxorWebView) === null || _window28 === void 0 ? void 0 : _window28.getLayoutType()) === "web-inline") {
23030
+ var _window29;
23031
+ (_window29 = window) === null || _window29 === void 0 || (_window29 = _window29.ApxorWebView) === null || _window29 === void 0 || _window29.removeWebView();
21296
23032
  }
21297
23033
  }, _this.stepperCallback, false, 0);
21298
23034
  _this._currentCoachmark.createNewCoachMark();
21299
23035
  });
21300
23036
  _defineProperty(this, "updateElementPositionOnScroll", function (top, left, height, width) {
21301
- if (_this.XhLY) {
21302
- _this.XhLY.updateElementPositionOnScroll(top, left, height, width);
23037
+ if (_this.sOOz) {
23038
+ _this.sOOz.updateElementPositionOnScroll(top, left, height, width);
21303
23039
  }
21304
23040
  });
21305
23041
  _defineProperty(this, "createInAppVideo", function (config, duration, configId, name) {
@@ -21316,15 +23052,15 @@
21316
23052
  var VideoInAppInstance = new VideoInApp(videoConfig, terminationConfig, configId, name, function () {
21317
23053
  _this.isShowingAction = true;
21318
23054
  if (window.Apxor && window.Apxor.logActionEvent) {
21319
- var _window27, _window27$updateFlag;
21320
- (_window27 = window) === null || _window27 === void 0 || (_window27 = _window27.Apxor) === null || _window27 === void 0 || (_window27$updateFlag = _window27.updateFlag) === null || _window27$updateFlag === void 0 || _window27$updateFlag.call(_window27, true);
23055
+ var _window30, _window30$updateFlag;
23056
+ (_window30 = window) === null || _window30 === void 0 || (_window30 = _window30.Apxor) === null || _window30 === void 0 || (_window30$updateFlag = _window30.updateFlag) === null || _window30$updateFlag === void 0 || _window30$updateFlag.call(_window30, true);
21321
23057
  window.Apxor.logActionEvent("inapp_shown", configId, name);
21322
23058
  }
21323
23059
  }, function () {
21324
- var _window28, _window28$updateFlag;
23060
+ var _window31, _window31$updateFlag;
21325
23061
  _this.isShowingAction = false;
21326
23062
  _this.currentAction = null;
21327
- (_window28 = window) === null || _window28 === void 0 || (_window28 = _window28.Apxor) === null || _window28 === void 0 || (_window28$updateFlag = _window28.updateFlag) === null || _window28$updateFlag === void 0 || _window28$updateFlag.call(_window28, false);
23063
+ (_window31 = window) === null || _window31 === void 0 || (_window31 = _window31.Apxor) === null || _window31 === void 0 || (_window31$updateFlag = _window31.updateFlag) === null || _window31$updateFlag === void 0 || _window31$updateFlag.call(_window31, false);
21328
23064
  if (window.Apxor && window.Apxor.logActionEvent) {
21329
23065
  window.Apxor.logActionEvent("inapp_dismissed", configId, name);
21330
23066
  }
@@ -21350,19 +23086,19 @@
21350
23086
  var onShow = function onShow() {
21351
23087
  _this.isShowingAction = true;
21352
23088
  if (window.Apxor && window.Apxor.logActionEvent) {
21353
- var _window$Apxor3;
21354
- if (((_window$Apxor3 = window.Apxor) === null || _window$Apxor3 === void 0 ? void 0 : _window$Apxor3.platform) === "ios") {
21355
- var _window29, _window29$updateFlag;
21356
- (_window29 = window) === null || _window29 === void 0 || (_window29 = _window29.Apxor) === null || _window29 === void 0 || (_window29$updateFlag = _window29.updateFlag) === null || _window29$updateFlag === void 0 || _window29$updateFlag.call(_window29, true, "IN_APP");
23089
+ var _window$Apxor4;
23090
+ if (((_window$Apxor4 = window.Apxor) === null || _window$Apxor4 === void 0 ? void 0 : _window$Apxor4.platform) === "ios") {
23091
+ var _window32, _window32$updateFlag;
23092
+ (_window32 = window) === null || _window32 === void 0 || (_window32 = _window32.Apxor) === null || _window32 === void 0 || (_window32$updateFlag = _window32.updateFlag) === null || _window32$updateFlag === void 0 || _window32$updateFlag.call(_window32, true, "IN_APP");
21357
23093
  } else {
21358
- var _window30, _window30$updateFlag;
21359
- (_window30 = window) === null || _window30 === void 0 || (_window30 = _window30.Apxor) === null || _window30 === void 0 || (_window30$updateFlag = _window30.updateFlag) === null || _window30$updateFlag === void 0 || _window30$updateFlag.call(_window30, "IN_APP", true);
23094
+ var _window33, _window33$updateFlag;
23095
+ (_window33 = window) === null || _window33 === void 0 || (_window33 = _window33.Apxor) === null || _window33 === void 0 || (_window33$updateFlag = _window33.updateFlag) === null || _window33$updateFlag === void 0 || _window33$updateFlag.call(_window33, "IN_APP", true);
21360
23096
  }
21361
23097
  window.Apxor.logActionEvent("inapp_shown", configId, name);
21362
23098
  }
21363
23099
  };
21364
23100
  var onHide = function onHide(backgroundDiv, action) {
21365
- var _dialogContent$classL, _window$Apxor4;
23101
+ var _dialogContent$classL, _window$Apxor5;
21366
23102
  var cssClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ".apx-dlg-c";
21367
23103
  var closeListener = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
21368
23104
  var redirectionListener = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
@@ -21373,12 +23109,12 @@
21373
23109
  // setTimeout(() => {
21374
23110
  backgroundDiv.remove();
21375
23111
  _this.isShowingAction = false;
21376
- if (((_window$Apxor4 = window.Apxor) === null || _window$Apxor4 === void 0 ? void 0 : _window$Apxor4.platform) === "ios") {
21377
- var _window31, _window31$updateFlag;
21378
- (_window31 = window) === null || _window31 === void 0 || (_window31 = _window31.Apxor) === null || _window31 === void 0 || (_window31$updateFlag = _window31.updateFlag) === null || _window31$updateFlag === void 0 || _window31$updateFlag.call(_window31, false, "IN_APP");
23112
+ if (((_window$Apxor5 = window.Apxor) === null || _window$Apxor5 === void 0 ? void 0 : _window$Apxor5.platform) === "ios") {
23113
+ var _window34, _window34$updateFlag;
23114
+ (_window34 = window) === null || _window34 === void 0 || (_window34 = _window34.Apxor) === null || _window34 === void 0 || (_window34$updateFlag = _window34.updateFlag) === null || _window34$updateFlag === void 0 || _window34$updateFlag.call(_window34, false, "IN_APP");
21379
23115
  } else {
21380
- var _window32, _window32$updateFlag;
21381
- (_window32 = window) === null || _window32 === void 0 || (_window32 = _window32.Apxor) === null || _window32 === void 0 || (_window32$updateFlag = _window32.updateFlag) === null || _window32$updateFlag === void 0 || _window32$updateFlag.call(_window32, "IN_APP", false);
23116
+ var _window35, _window35$updateFlag;
23117
+ (_window35 = window) === null || _window35 === void 0 || (_window35 = _window35.Apxor) === null || _window35 === void 0 || (_window35$updateFlag = _window35.updateFlag) === null || _window35$updateFlag === void 0 || _window35$updateFlag.call(_window35, "IN_APP", false);
21382
23118
  }
21383
23119
  _this.currentAction = null;
21384
23120
  if (window.Apxor && window.Apxor.logActionEvent && !(action == "cancel" || action == "redirect")) {
@@ -21393,11 +23129,11 @@
21393
23129
  inappModal.createInAppModal();
21394
23130
  });
21395
23131
  _defineProperty(this, "showPlaceHolder", function () {
21396
- var _window33;
21397
- if (_this.QDeD) {
23132
+ var _window36;
23133
+ if (_this.pNeK) {
21398
23134
  return;
21399
23135
  }
21400
- _this.QDeD = true;
23136
+ _this.pNeK = true;
21401
23137
  var ele = document.createElement("div");
21402
23138
  ele.innerHTML = "place your immersive card here";
21403
23139
  ele.style.backgroundColor = "#f5f5f5";
@@ -21407,20 +23143,62 @@
21407
23143
  ele.style.padding = "12px";
21408
23144
  ele.style.fontSize = "14px";
21409
23145
  document.body.appendChild(ele);
21410
- (_window33 = window) === null || _window33 === void 0 || (_window33 = _window33.ApxorWidget) === null || _window33 === void 0 || _window33.setDimensions(window.document.querySelector("html").offsetWidth, window.document.querySelector("html").offsetHeight);
23146
+ (_window36 = window) === null || _window36 === void 0 || (_window36 = _window36.ApxorWidget) === null || _window36 === void 0 || _window36.setDimensions(window.document.querySelector("html").offsetWidth, window.document.querySelector("html").offsetHeight);
23147
+ });
23148
+ _defineProperty(this, "pauseStories", function () {
23149
+ var progress = Array.from(document.querySelectorAll(".progress"));
23150
+ var activeIndex = progress.findIndex(function (el) {
23151
+ return el.classList.contains("active");
23152
+ });
23153
+ progress[activeIndex].style.animationPlayState = "paused";
23154
+ var slide_details_to_be_deleted;
23155
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
23156
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
23157
+ for (var i = 0; i < childElements.length; i++) {
23158
+ var child = childElements[i];
23159
+ if (child.tagName.toLowerCase() === "video") {
23160
+ child.pause();
23161
+ }
23162
+ }
23163
+ });
23164
+ _defineProperty(this, "resumeStories", function () {
23165
+ var progress = Array.from(document.querySelectorAll(".progress"));
23166
+ var activeIndex = progress.findIndex(function (el) {
23167
+ return el.classList.contains("active");
23168
+ });
23169
+ progress[activeIndex].style.animationPlayState = "running";
23170
+ var slide_details_to_be_deleted;
23171
+ slide_details_to_be_deleted = document.querySelector(".slide-details");
23172
+ var childElements = slide_details_to_be_deleted.querySelectorAll("video");
23173
+ for (var i = 0; i < childElements.length; i++) {
23174
+ var child = childElements[i];
23175
+ if (child.tagName.toLowerCase() === "video") {
23176
+ child.play();
23177
+ }
23178
+ }
21411
23179
  });
21412
23180
  // createSurvey = (config, configId, name) => {
21413
23181
  // const survey_obj = new NewSurveys(configId, name, config, []);
21414
23182
  // survey_obj.createSurvey();
21415
23183
  // };
21416
23184
  _defineProperty(this, "logEvent", function (name, additional_info) {
21417
- var _window$Apxor5;
21418
- if (((_window$Apxor5 = window.Apxor) === null || _window$Apxor5 === void 0 ? void 0 : _window$Apxor5.platform) === "ios") {
23185
+ var _window$Apxor6;
23186
+ if (((_window$Apxor6 = window.Apxor) === null || _window$Apxor6 === void 0 ? void 0 : _window$Apxor6.platform) === "ios") {
21419
23187
  window.Apxor.logAppEvent(name, additional_info);
21420
23188
  } else {
21421
23189
  window.Apxor.logAppEvent(name, JSON.stringify(additional_info));
21422
23190
  }
21423
23191
  });
23192
+ _defineProperty(this, "pauseVideos", function () {
23193
+ var videos_to_be_paused = document.querySelector(".slide-details");
23194
+ var childElements = videos_to_be_paused.querySelectorAll("video");
23195
+ for (var i = 0; i < childElements.length; i++) {
23196
+ var child = childElements[i];
23197
+ if (child.tagName.toLowerCase() === "video") {
23198
+ child.muted = true;
23199
+ }
23200
+ }
23201
+ });
21424
23202
  });
21425
23203
 
21426
23204
  /* eslint-disable no-empty */