apxor-rtm-ui 0.1.0-qa.1 → 0.1.0-qa.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apxor.rtm.js.bak +1326 -965
- package/dist/apxor.rtm.min.js +1 -1
- package/package.json +3 -2
package/dist/apxor.rtm.js.bak
CHANGED
|
@@ -157,13 +157,12 @@
|
|
|
157
157
|
return typeof key === "symbol" ? key : String(key);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
/*! shepherd.js 4.0.0-beta.1 */
|
|
161
|
-
|
|
162
160
|
/* eslint-disable no-unused-vars */
|
|
163
161
|
/* eslint-disable no-useless-escape */
|
|
164
162
|
/* eslint-disable no-empty */
|
|
165
163
|
/* eslint-disable no-unsafe-finally */
|
|
166
164
|
/* eslint-disable no-func-assign */
|
|
165
|
+
/*! shepherd.js 4.0.0-beta.1 */
|
|
167
166
|
|
|
168
167
|
function _typeof$1(obj) {
|
|
169
168
|
if (typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol") {
|
|
@@ -228,7 +227,7 @@
|
|
|
228
227
|
if (i % 2) {
|
|
229
228
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
230
229
|
var ownKeys = Object.keys(source);
|
|
231
|
-
if (typeof Object.getOwnPropertySymbols ===
|
|
230
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
232
231
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
233
232
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
234
233
|
}));
|
|
@@ -325,7 +324,7 @@
|
|
|
325
324
|
*/
|
|
326
325
|
|
|
327
326
|
function isFunction(value) {
|
|
328
|
-
return typeof value ===
|
|
327
|
+
return typeof value === "function";
|
|
329
328
|
}
|
|
330
329
|
/**
|
|
331
330
|
* Checks if `value` is classified as a `Number` object.
|
|
@@ -333,7 +332,7 @@
|
|
|
333
332
|
*/
|
|
334
333
|
|
|
335
334
|
function isNumber(value) {
|
|
336
|
-
return typeof value ===
|
|
335
|
+
return typeof value === "number";
|
|
337
336
|
}
|
|
338
337
|
/**
|
|
339
338
|
* Checks if `value` is classified as a `String` object.
|
|
@@ -341,7 +340,7 @@
|
|
|
341
340
|
*/
|
|
342
341
|
|
|
343
342
|
function isString(value) {
|
|
344
|
-
return typeof value ===
|
|
343
|
+
return typeof value === "string";
|
|
345
344
|
}
|
|
346
345
|
/**
|
|
347
346
|
* Checks if `value` is undefined.
|
|
@@ -371,27 +370,27 @@
|
|
|
371
370
|
};
|
|
372
371
|
return _extends$1.apply(this, arguments);
|
|
373
372
|
}
|
|
374
|
-
var isBrowser = typeof window !==
|
|
375
|
-
var ua = isBrowser ? navigator.userAgent :
|
|
373
|
+
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
374
|
+
var ua = isBrowser ? navigator.userAgent : "";
|
|
376
375
|
var isIE = /MSIE |Trident\//.test(ua);
|
|
377
376
|
var isUCBrowser = /UCBrowser\//.test(ua);
|
|
378
377
|
var isIOS = isBrowser && /iPhone|iPad|iPod/.test(navigator.platform);
|
|
379
378
|
var defaultProps = {
|
|
380
379
|
allowHTML: true,
|
|
381
380
|
animateFill: false,
|
|
382
|
-
animation:
|
|
381
|
+
animation: "fade",
|
|
383
382
|
appendTo: function appendTo() {
|
|
384
383
|
return document.body;
|
|
385
384
|
},
|
|
386
|
-
aria:
|
|
385
|
+
aria: "describedby",
|
|
387
386
|
arrow: true,
|
|
388
|
-
boundary:
|
|
389
|
-
content:
|
|
387
|
+
boundary: "scrollParent",
|
|
388
|
+
content: "",
|
|
390
389
|
delay: 0,
|
|
391
390
|
distance: 10,
|
|
392
391
|
duration: [325, 275],
|
|
393
392
|
flip: true,
|
|
394
|
-
flipBehavior:
|
|
393
|
+
flipBehavior: "flip",
|
|
395
394
|
flipOnUpdate: false,
|
|
396
395
|
hideOnClick: true,
|
|
397
396
|
ignoreAttributes: false,
|
|
@@ -411,20 +410,20 @@
|
|
|
411
410
|
onShown: function onShown() {},
|
|
412
411
|
onTrigger: function onTrigger() {},
|
|
413
412
|
onUntrigger: function onUntrigger() {},
|
|
414
|
-
placement:
|
|
413
|
+
placement: "top",
|
|
415
414
|
popperOptions: {},
|
|
416
|
-
role:
|
|
415
|
+
role: "tooltip",
|
|
417
416
|
showOnCreate: false,
|
|
418
417
|
sticky: false,
|
|
419
|
-
theme:
|
|
418
|
+
theme: "",
|
|
420
419
|
touch: true,
|
|
421
|
-
trigger:
|
|
420
|
+
trigger: "mouseenter focus",
|
|
422
421
|
triggerTarget: null,
|
|
423
422
|
updateDuration: 0,
|
|
424
423
|
wait: null,
|
|
425
424
|
zIndex: 9999
|
|
426
425
|
};
|
|
427
|
-
var POPPER_INSTANCE_DEPENDENCIES = [
|
|
426
|
+
var POPPER_INSTANCE_DEPENDENCIES = ["arrow", "boundary", "distance", "flip", "flipBehavior", "flipOnUpdate", "offset", "placement", "popperOptions"];
|
|
428
427
|
var PASSIVE = {
|
|
429
428
|
passive: true
|
|
430
429
|
};
|
|
@@ -463,7 +462,7 @@
|
|
|
463
462
|
document.body.classList.add(IOS_CLASS);
|
|
464
463
|
}
|
|
465
464
|
if (window.performance) {
|
|
466
|
-
document.addEventListener(
|
|
465
|
+
document.addEventListener("mousemove", onDocumentMouseMove);
|
|
467
466
|
}
|
|
468
467
|
}
|
|
469
468
|
/**
|
|
@@ -476,7 +475,7 @@
|
|
|
476
475
|
var now = performance.now();
|
|
477
476
|
if (now - lastMouseMoveTime < 20) {
|
|
478
477
|
currentInput.isTouch = false;
|
|
479
|
-
document.removeEventListener(
|
|
478
|
+
document.removeEventListener("mousemove", onDocumentMouseMove);
|
|
480
479
|
if (!isIOS) {
|
|
481
480
|
document.body.classList.remove(IOS_CLASS);
|
|
482
481
|
}
|
|
@@ -503,10 +502,10 @@
|
|
|
503
502
|
*/
|
|
504
503
|
|
|
505
504
|
function bindGlobalEventListeners() {
|
|
506
|
-
document.addEventListener(
|
|
505
|
+
document.addEventListener("touchstart", onDocumentTouchStart, _extends$1({}, PASSIVE, {
|
|
507
506
|
capture: true
|
|
508
507
|
}));
|
|
509
|
-
window.addEventListener(
|
|
508
|
+
window.addEventListener("blur", onWindowBlur);
|
|
510
509
|
}
|
|
511
510
|
var keys = Object.keys(defaultProps);
|
|
512
511
|
/**
|
|
@@ -515,11 +514,11 @@
|
|
|
515
514
|
|
|
516
515
|
function getDataAttributeProps(reference) {
|
|
517
516
|
var props = keys.reduce(function (acc, key) {
|
|
518
|
-
var valueAsString = (reference.getAttribute("data-tippy-" + key) ||
|
|
517
|
+
var valueAsString = (reference.getAttribute("data-tippy-" + key) || "").trim();
|
|
519
518
|
if (!valueAsString) {
|
|
520
519
|
return acc;
|
|
521
520
|
}
|
|
522
|
-
if (key ===
|
|
521
|
+
if (key === "content") {
|
|
523
522
|
acc[key] = valueAsString;
|
|
524
523
|
} else {
|
|
525
524
|
try {
|
|
@@ -599,14 +598,14 @@
|
|
|
599
598
|
*/
|
|
600
599
|
|
|
601
600
|
function innerHTML() {
|
|
602
|
-
return
|
|
601
|
+
return "innerHTML";
|
|
603
602
|
}
|
|
604
603
|
/**
|
|
605
604
|
* Evaluates a function if one, or returns the value
|
|
606
605
|
*/
|
|
607
606
|
|
|
608
607
|
function invokeWithArgsOrReturn(value, args) {
|
|
609
|
-
return typeof value ===
|
|
608
|
+
return typeof value === "function" ? value.apply(null, args) : value;
|
|
610
609
|
}
|
|
611
610
|
/**
|
|
612
611
|
* Sets a popperInstance `flip` modifier's enabled state
|
|
@@ -614,15 +613,21 @@
|
|
|
614
613
|
|
|
615
614
|
function setFlipModifierEnabled(modifiers, value) {
|
|
616
615
|
modifiers.filter(function (m) {
|
|
617
|
-
return m.name ===
|
|
616
|
+
return m.name === "flip";
|
|
618
617
|
})[0].enabled = value;
|
|
619
618
|
}
|
|
619
|
+
function setEscapeWithReference(modifiers, value) {
|
|
620
|
+
modifiers.filter(function (m) {
|
|
621
|
+
return m.name === "preventOverflow";
|
|
622
|
+
})[0].escapeWithReference = value;
|
|
623
|
+
}
|
|
624
|
+
|
|
620
625
|
/**
|
|
621
626
|
* Returns a new `div` element
|
|
622
627
|
*/
|
|
623
628
|
|
|
624
629
|
function div() {
|
|
625
|
-
return document.createElement(
|
|
630
|
+
return document.createElement("div");
|
|
626
631
|
}
|
|
627
632
|
/**
|
|
628
633
|
* Applies a transition duration to a list of elements
|
|
@@ -642,7 +647,7 @@
|
|
|
642
647
|
function setVisibilityState(els, state) {
|
|
643
648
|
els.forEach(function (el) {
|
|
644
649
|
if (el) {
|
|
645
|
-
el.setAttribute(
|
|
650
|
+
el.setAttribute("data-state", state);
|
|
646
651
|
}
|
|
647
652
|
});
|
|
648
653
|
}
|
|
@@ -732,10 +737,10 @@
|
|
|
732
737
|
|
|
733
738
|
function setContent(contentEl, props) {
|
|
734
739
|
if (isRealElement(props.content)) {
|
|
735
|
-
setInnerHTML(contentEl,
|
|
740
|
+
setInnerHTML(contentEl, "");
|
|
736
741
|
contentEl.appendChild(props.content);
|
|
737
|
-
} else if (typeof props.content !==
|
|
738
|
-
var key = props.allowHTML ?
|
|
742
|
+
} else if (typeof props.content !== "function") {
|
|
743
|
+
var key = props.allowHTML ? "innerHTML" : "textContent";
|
|
739
744
|
contentEl[key] = props.content;
|
|
740
745
|
}
|
|
741
746
|
}
|
|
@@ -756,14 +761,14 @@
|
|
|
756
761
|
*/
|
|
757
762
|
|
|
758
763
|
function addInertia(tooltip) {
|
|
759
|
-
tooltip.setAttribute(
|
|
764
|
+
tooltip.setAttribute("data-inertia", "");
|
|
760
765
|
}
|
|
761
766
|
/**
|
|
762
767
|
* Removes `data-inertia` attribute
|
|
763
768
|
*/
|
|
764
769
|
|
|
765
770
|
function removeInertia(tooltip) {
|
|
766
|
-
tooltip.removeAttribute(
|
|
771
|
+
tooltip.removeAttribute("data-inertia");
|
|
767
772
|
}
|
|
768
773
|
/**
|
|
769
774
|
* Creates an arrow element and returns it
|
|
@@ -778,7 +783,7 @@
|
|
|
778
783
|
if (isRealElement(arrow)) {
|
|
779
784
|
arrowElement.appendChild(arrow);
|
|
780
785
|
} else {
|
|
781
|
-
setInnerHTML(arrowElement, arrow ===
|
|
786
|
+
setInnerHTML(arrowElement, arrow === "round" ? ROUND_ARROW_INNER_HTML : arrow);
|
|
782
787
|
}
|
|
783
788
|
}
|
|
784
789
|
return arrowElement;
|
|
@@ -790,7 +795,7 @@
|
|
|
790
795
|
function createBackdropElement(isVisible) {
|
|
791
796
|
var backdrop = div();
|
|
792
797
|
backdrop.className = BACKDROP_CLASS;
|
|
793
|
-
backdrop.setAttribute(
|
|
798
|
+
backdrop.setAttribute("data-state", isVisible ? "visible" : "hidden");
|
|
794
799
|
return backdrop;
|
|
795
800
|
}
|
|
796
801
|
/**
|
|
@@ -798,29 +803,29 @@
|
|
|
798
803
|
*/
|
|
799
804
|
|
|
800
805
|
function addInteractive(tooltip) {
|
|
801
|
-
tooltip.setAttribute(
|
|
806
|
+
tooltip.setAttribute("data-interactive", "");
|
|
802
807
|
}
|
|
803
808
|
/**
|
|
804
809
|
* Removes interactive-related attributes
|
|
805
810
|
*/
|
|
806
811
|
|
|
807
812
|
function removeInteractive(tooltip) {
|
|
808
|
-
tooltip.removeAttribute(
|
|
813
|
+
tooltip.removeAttribute("data-interactive");
|
|
809
814
|
}
|
|
810
815
|
/**
|
|
811
816
|
* Add/remove transitionend listener from tooltip
|
|
812
817
|
*/
|
|
813
818
|
|
|
814
819
|
function updateTransitionEndListener(tooltip, action, listener) {
|
|
815
|
-
var eventName = isUCBrowser && document.body.style.webkitTransition !== undefined ?
|
|
816
|
-
tooltip[action +
|
|
820
|
+
var eventName = isUCBrowser && document.body.style.webkitTransition !== undefined ? "webkitTransitionEnd" : "transitionend";
|
|
821
|
+
tooltip[action + "EventListener"](eventName, listener);
|
|
817
822
|
}
|
|
818
823
|
/**
|
|
819
824
|
* Returns the popper's placement, ignoring shifting (top-start, etc)
|
|
820
825
|
*/
|
|
821
826
|
|
|
822
827
|
function getBasePlacement(placement) {
|
|
823
|
-
return placement.split(
|
|
828
|
+
return placement.split("-")[0];
|
|
824
829
|
}
|
|
825
830
|
/**
|
|
826
831
|
* Triggers reflow
|
|
@@ -834,7 +839,7 @@
|
|
|
834
839
|
*/
|
|
835
840
|
|
|
836
841
|
function updateTheme(tooltip, action, theme) {
|
|
837
|
-
theme.split(
|
|
842
|
+
theme.split(" ").forEach(function (name) {
|
|
838
843
|
if (name) {
|
|
839
844
|
tooltip.classList[action](name + "-theme");
|
|
840
845
|
}
|
|
@@ -847,28 +852,28 @@
|
|
|
847
852
|
function createPopperElement(id, props) {
|
|
848
853
|
var popper = div();
|
|
849
854
|
popper.className = POPPER_CLASS;
|
|
850
|
-
popper.style.position =
|
|
851
|
-
popper.style.top =
|
|
852
|
-
popper.style.left =
|
|
855
|
+
popper.style.position = "absolute";
|
|
856
|
+
popper.style.top = "0";
|
|
857
|
+
popper.style.left = "0";
|
|
853
858
|
var tooltip = div();
|
|
854
859
|
tooltip.className = TOOLTIP_CLASS;
|
|
855
860
|
tooltip.id = "tippy-" + id;
|
|
856
|
-
tooltip.setAttribute(
|
|
857
|
-
tooltip.setAttribute(
|
|
858
|
-
updateTheme(tooltip,
|
|
861
|
+
tooltip.setAttribute("data-state", "hidden");
|
|
862
|
+
tooltip.setAttribute("tabindex", "-1");
|
|
863
|
+
updateTheme(tooltip, "add", props.theme);
|
|
859
864
|
var content = div();
|
|
860
865
|
content.className = CONTENT_CLASS;
|
|
861
|
-
content.setAttribute(
|
|
866
|
+
content.setAttribute("data-state", "hidden");
|
|
862
867
|
if (props.interactive) {
|
|
863
868
|
addInteractive(tooltip);
|
|
864
869
|
}
|
|
865
870
|
if (props.arrow) {
|
|
866
|
-
tooltip.setAttribute(
|
|
871
|
+
tooltip.setAttribute("data-arrow", "");
|
|
867
872
|
tooltip.appendChild(createArrowElement(props.arrow));
|
|
868
873
|
}
|
|
869
874
|
if (props.animateFill) {
|
|
870
875
|
tooltip.appendChild(createBackdropElement(false));
|
|
871
|
-
tooltip.setAttribute(
|
|
876
|
+
tooltip.setAttribute("data-animatefill", "");
|
|
872
877
|
}
|
|
873
878
|
if (props.inertia) {
|
|
874
879
|
addInertia(tooltip);
|
|
@@ -889,13 +894,13 @@
|
|
|
889
894
|
content = _getChildren.content,
|
|
890
895
|
backdrop = _getChildren.backdrop,
|
|
891
896
|
arrow = _getChildren.arrow;
|
|
892
|
-
popper.style.zIndex =
|
|
893
|
-
tooltip.setAttribute(
|
|
894
|
-
tooltip.style.maxWidth = nextProps.maxWidth + (typeof nextProps.maxWidth ===
|
|
897
|
+
popper.style.zIndex = "" + nextProps.zIndex;
|
|
898
|
+
tooltip.setAttribute("data-animation", nextProps.animation);
|
|
899
|
+
tooltip.style.maxWidth = nextProps.maxWidth + (typeof nextProps.maxWidth === "number" ? "px" : "");
|
|
895
900
|
if (nextProps.role) {
|
|
896
|
-
tooltip.setAttribute(
|
|
901
|
+
tooltip.setAttribute("role", nextProps.role);
|
|
897
902
|
} else {
|
|
898
|
-
tooltip.removeAttribute(
|
|
903
|
+
tooltip.removeAttribute("role");
|
|
899
904
|
}
|
|
900
905
|
if (prevProps.content !== nextProps.content) {
|
|
901
906
|
setContent(content, nextProps);
|
|
@@ -903,20 +908,20 @@
|
|
|
903
908
|
|
|
904
909
|
if (!prevProps.animateFill && nextProps.animateFill) {
|
|
905
910
|
tooltip.appendChild(createBackdropElement(isVisible));
|
|
906
|
-
tooltip.setAttribute(
|
|
911
|
+
tooltip.setAttribute("data-animatefill", "");
|
|
907
912
|
} else if (prevProps.animateFill && !nextProps.animateFill) {
|
|
908
913
|
tooltip.removeChild(backdrop);
|
|
909
|
-
tooltip.removeAttribute(
|
|
914
|
+
tooltip.removeAttribute("data-animatefill");
|
|
910
915
|
} // arrow
|
|
911
916
|
|
|
912
917
|
if (!prevProps.arrow && nextProps.arrow) {
|
|
913
918
|
// false to true
|
|
914
919
|
tooltip.appendChild(createArrowElement(nextProps.arrow));
|
|
915
|
-
tooltip.setAttribute(
|
|
920
|
+
tooltip.setAttribute("data-arrow", "");
|
|
916
921
|
} else if (prevProps.arrow && !nextProps.arrow) {
|
|
917
922
|
// true to false
|
|
918
923
|
tooltip.removeChild(arrow);
|
|
919
|
-
tooltip.removeAttribute(
|
|
924
|
+
tooltip.removeAttribute("data-arrow");
|
|
920
925
|
} else if (prevProps.arrow !== nextProps.arrow) {
|
|
921
926
|
// true to 'round' or vice-versa
|
|
922
927
|
tooltip.removeChild(arrow);
|
|
@@ -936,8 +941,8 @@
|
|
|
936
941
|
} // theme
|
|
937
942
|
|
|
938
943
|
if (prevProps.theme !== nextProps.theme) {
|
|
939
|
-
updateTheme(tooltip,
|
|
940
|
-
updateTheme(tooltip,
|
|
944
|
+
updateTheme(tooltip, "remove", prevProps.theme);
|
|
945
|
+
updateTheme(tooltip, "add", nextProps.theme);
|
|
941
946
|
}
|
|
942
947
|
}
|
|
943
948
|
/**
|
|
@@ -953,10 +958,10 @@
|
|
|
953
958
|
y = event.clientY;
|
|
954
959
|
var interactiveBorder = props.interactiveBorder,
|
|
955
960
|
distance = props.distance;
|
|
956
|
-
var exceedsTop = popperRect.top - y > (popperPlacement ===
|
|
957
|
-
var exceedsBottom = y - popperRect.bottom > (popperPlacement ===
|
|
958
|
-
var exceedsLeft = popperRect.left - x > (popperPlacement ===
|
|
959
|
-
var exceedsRight = x - popperRect.right > (popperPlacement ===
|
|
961
|
+
var exceedsTop = popperRect.top - y > (popperPlacement === "top" ? interactiveBorder + distance : interactiveBorder);
|
|
962
|
+
var exceedsBottom = y - popperRect.bottom > (popperPlacement === "bottom" ? interactiveBorder + distance : interactiveBorder);
|
|
963
|
+
var exceedsLeft = popperRect.left - x > (popperPlacement === "left" ? interactiveBorder + distance : interactiveBorder);
|
|
964
|
+
var exceedsRight = x - popperRect.right > (popperPlacement === "right" ? interactiveBorder + distance : interactiveBorder);
|
|
960
965
|
return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
|
|
961
966
|
}
|
|
962
967
|
|
|
@@ -984,8 +989,8 @@
|
|
|
984
989
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
985
990
|
* SOFTWARE.
|
|
986
991
|
*/
|
|
987
|
-
var isBrowser$1 = typeof window !==
|
|
988
|
-
var longerTimeoutBrowsers = [
|
|
992
|
+
var isBrowser$1 = typeof window !== "undefined" && typeof document !== "undefined";
|
|
993
|
+
var longerTimeoutBrowsers = ["Edge", "Trident", "Firefox"];
|
|
989
994
|
var timeoutDuration = 0;
|
|
990
995
|
for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
|
|
991
996
|
if (isBrowser$1 && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
|
|
@@ -1040,7 +1045,7 @@
|
|
|
1040
1045
|
*/
|
|
1041
1046
|
function isFunction$1(functionToCheck) {
|
|
1042
1047
|
var getType = {};
|
|
1043
|
-
return functionToCheck && getType.toString.call(functionToCheck) ===
|
|
1048
|
+
return functionToCheck && getType.toString.call(functionToCheck) === "[object Function]";
|
|
1044
1049
|
}
|
|
1045
1050
|
|
|
1046
1051
|
/**
|
|
@@ -1068,7 +1073,7 @@
|
|
|
1068
1073
|
* @returns {Element} parent
|
|
1069
1074
|
*/
|
|
1070
1075
|
function getParentNode(element) {
|
|
1071
|
-
if (element.nodeName ===
|
|
1076
|
+
if (element.nodeName === "HTML") {
|
|
1072
1077
|
return element;
|
|
1073
1078
|
}
|
|
1074
1079
|
return element.parentNode || element.host;
|
|
@@ -1087,10 +1092,10 @@
|
|
|
1087
1092
|
return document.body;
|
|
1088
1093
|
}
|
|
1089
1094
|
switch (element.nodeName) {
|
|
1090
|
-
case
|
|
1091
|
-
case
|
|
1095
|
+
case "HTML":
|
|
1096
|
+
case "BODY":
|
|
1092
1097
|
return element.ownerDocument.body;
|
|
1093
|
-
case
|
|
1098
|
+
case "#document":
|
|
1094
1099
|
return element.body;
|
|
1095
1100
|
}
|
|
1096
1101
|
|
|
@@ -1145,23 +1150,23 @@
|
|
|
1145
1150
|
offsetParent = (element = element.nextElementSibling).offsetParent;
|
|
1146
1151
|
}
|
|
1147
1152
|
var nodeName = offsetParent && offsetParent.nodeName;
|
|
1148
|
-
if (!nodeName || nodeName ===
|
|
1153
|
+
if (!nodeName || nodeName === "BODY" || nodeName === "HTML") {
|
|
1149
1154
|
return element ? element.ownerDocument.documentElement : document.documentElement;
|
|
1150
1155
|
}
|
|
1151
1156
|
|
|
1152
1157
|
// .offsetParent will return the closest TH, TD or TABLE in case
|
|
1153
1158
|
// no offsetParent is present, I hate this job...
|
|
1154
|
-
if ([
|
|
1159
|
+
if (["TH", "TD", "TABLE"].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, "position") === "static") {
|
|
1155
1160
|
return getOffsetParent(offsetParent);
|
|
1156
1161
|
}
|
|
1157
1162
|
return offsetParent;
|
|
1158
1163
|
}
|
|
1159
1164
|
function isOffsetContainer(element) {
|
|
1160
1165
|
var nodeName = element.nodeName;
|
|
1161
|
-
if (nodeName ===
|
|
1166
|
+
if (nodeName === "BODY") {
|
|
1162
1167
|
return false;
|
|
1163
1168
|
}
|
|
1164
|
-
return nodeName ===
|
|
1169
|
+
return nodeName === "HTML" || getOffsetParent(element.firstElementChild) === element;
|
|
1165
1170
|
}
|
|
1166
1171
|
|
|
1167
1172
|
/**
|
|
@@ -1230,10 +1235,10 @@
|
|
|
1230
1235
|
* @returns {number} amount of scrolled pixels
|
|
1231
1236
|
*/
|
|
1232
1237
|
function getScroll(element) {
|
|
1233
|
-
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
1234
|
-
var upperSide = side ===
|
|
1238
|
+
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "top";
|
|
1239
|
+
var upperSide = side === "top" ? "scrollTop" : "scrollLeft";
|
|
1235
1240
|
var nodeName = element.nodeName;
|
|
1236
|
-
if (nodeName ===
|
|
1241
|
+
if (nodeName === "BODY" || nodeName === "HTML") {
|
|
1237
1242
|
var html = element.ownerDocument.documentElement;
|
|
1238
1243
|
var scrollingElement = element.ownerDocument.scrollingElement || html;
|
|
1239
1244
|
return scrollingElement[upperSide];
|
|
@@ -1252,8 +1257,8 @@
|
|
|
1252
1257
|
*/
|
|
1253
1258
|
function includeScroll(rect, element) {
|
|
1254
1259
|
var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1255
|
-
var scrollTop = getScroll(element,
|
|
1256
|
-
var scrollLeft = getScroll(element,
|
|
1260
|
+
var scrollTop = getScroll(element, "top");
|
|
1261
|
+
var scrollLeft = getScroll(element, "left");
|
|
1257
1262
|
var modifier = subtract ? -1 : 1;
|
|
1258
1263
|
rect.top += scrollTop * modifier;
|
|
1259
1264
|
rect.bottom += scrollTop * modifier;
|
|
@@ -1273,20 +1278,20 @@
|
|
|
1273
1278
|
*/
|
|
1274
1279
|
|
|
1275
1280
|
function getBordersSize(styles, axis) {
|
|
1276
|
-
var sideA = axis ===
|
|
1277
|
-
var sideB = sideA ===
|
|
1278
|
-
return parseFloat(styles[
|
|
1281
|
+
var sideA = axis === "x" ? "Left" : "Top";
|
|
1282
|
+
var sideB = sideA === "Left" ? "Right" : "Bottom";
|
|
1283
|
+
return parseFloat(styles["border" + sideA + "Width"], 10) + parseFloat(styles["border" + sideB + "Width"], 10);
|
|
1279
1284
|
}
|
|
1280
1285
|
function getSize(axis, body, html, computedStyle) {
|
|
1281
|
-
return Math.max(body[
|
|
1286
|
+
return Math.max(body["offset" + axis], body["scroll" + axis], html["client" + axis], html["offset" + axis], html["scroll" + axis], isIE$1(10) ? parseInt(html["offset" + axis]) + parseInt(computedStyle["margin" + (axis === "Height" ? "Top" : "Left")]) + parseInt(computedStyle["margin" + (axis === "Height" ? "Bottom" : "Right")]) : 0);
|
|
1282
1287
|
}
|
|
1283
1288
|
function getWindowSizes(document) {
|
|
1284
1289
|
var body = document.body;
|
|
1285
1290
|
var html = document.documentElement;
|
|
1286
1291
|
var computedStyle = isIE$1(10) && getComputedStyle(html);
|
|
1287
1292
|
return {
|
|
1288
|
-
height: getSize(
|
|
1289
|
-
width: getSize(
|
|
1293
|
+
height: getSize("Height", body, html, computedStyle),
|
|
1294
|
+
width: getSize("Width", body, html, computedStyle)
|
|
1290
1295
|
};
|
|
1291
1296
|
}
|
|
1292
1297
|
var classCallCheck = function classCallCheck(instance, Constructor) {
|
|
@@ -1365,8 +1370,8 @@
|
|
|
1365
1370
|
try {
|
|
1366
1371
|
if (isIE$1(10)) {
|
|
1367
1372
|
rect = element.getBoundingClientRect();
|
|
1368
|
-
var scrollTop = getScroll(element,
|
|
1369
|
-
var scrollLeft = getScroll(element,
|
|
1373
|
+
var scrollTop = getScroll(element, "top");
|
|
1374
|
+
var scrollLeft = getScroll(element, "left");
|
|
1370
1375
|
rect.top += scrollTop;
|
|
1371
1376
|
rect.left += scrollLeft;
|
|
1372
1377
|
rect.bottom += scrollTop;
|
|
@@ -1383,7 +1388,7 @@
|
|
|
1383
1388
|
};
|
|
1384
1389
|
|
|
1385
1390
|
// subtract scrollbar size from sizes
|
|
1386
|
-
var sizes = element.nodeName ===
|
|
1391
|
+
var sizes = element.nodeName === "HTML" ? getWindowSizes(element.ownerDocument) : {};
|
|
1387
1392
|
var width = sizes.width || element.clientWidth || result.right - result.left;
|
|
1388
1393
|
var height = sizes.height || element.clientHeight || result.bottom - result.top;
|
|
1389
1394
|
var horizScrollbar = element.offsetWidth - width;
|
|
@@ -1393,8 +1398,8 @@
|
|
|
1393
1398
|
// we make this check conditional for performance reasons
|
|
1394
1399
|
if (horizScrollbar || vertScrollbar) {
|
|
1395
1400
|
var styles = getStyleComputedProperty(element);
|
|
1396
|
-
horizScrollbar -= getBordersSize(styles,
|
|
1397
|
-
vertScrollbar -= getBordersSize(styles,
|
|
1401
|
+
horizScrollbar -= getBordersSize(styles, "x");
|
|
1402
|
+
vertScrollbar -= getBordersSize(styles, "y");
|
|
1398
1403
|
result.width -= horizScrollbar;
|
|
1399
1404
|
result.height -= vertScrollbar;
|
|
1400
1405
|
}
|
|
@@ -1403,7 +1408,7 @@
|
|
|
1403
1408
|
function getOffsetRectRelativeToArbitraryNode(children, parent) {
|
|
1404
1409
|
var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1405
1410
|
var isIE10 = isIE$1(10);
|
|
1406
|
-
var isHTML = parent.nodeName ===
|
|
1411
|
+
var isHTML = parent.nodeName === "HTML";
|
|
1407
1412
|
var childrenRect = getBoundingClientRect(children);
|
|
1408
1413
|
var parentRect = getBoundingClientRect(parent);
|
|
1409
1414
|
var scrollParent = getScrollParent(children);
|
|
@@ -1441,7 +1446,7 @@
|
|
|
1441
1446
|
offsets.marginTop = marginTop;
|
|
1442
1447
|
offsets.marginLeft = marginLeft;
|
|
1443
1448
|
}
|
|
1444
|
-
if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !==
|
|
1449
|
+
if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== "BODY") {
|
|
1445
1450
|
offsets = includeScroll(offsets, parent);
|
|
1446
1451
|
}
|
|
1447
1452
|
return offsets;
|
|
@@ -1453,7 +1458,7 @@
|
|
|
1453
1458
|
var width = Math.max(html.clientWidth, window.innerWidth || 0);
|
|
1454
1459
|
var height = Math.max(html.clientHeight, window.innerHeight || 0);
|
|
1455
1460
|
var scrollTop = !excludeScroll ? getScroll(html) : 0;
|
|
1456
|
-
var scrollLeft = !excludeScroll ? getScroll(html,
|
|
1461
|
+
var scrollLeft = !excludeScroll ? getScroll(html, "left") : 0;
|
|
1457
1462
|
var offset = {
|
|
1458
1463
|
top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
|
|
1459
1464
|
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
|
|
@@ -1473,10 +1478,10 @@
|
|
|
1473
1478
|
*/
|
|
1474
1479
|
function isFixed(element) {
|
|
1475
1480
|
var nodeName = element.nodeName;
|
|
1476
|
-
if (nodeName ===
|
|
1481
|
+
if (nodeName === "BODY" || nodeName === "HTML") {
|
|
1477
1482
|
return false;
|
|
1478
1483
|
}
|
|
1479
|
-
if (getStyleComputedProperty(element,
|
|
1484
|
+
if (getStyleComputedProperty(element, "position") === "fixed") {
|
|
1480
1485
|
return true;
|
|
1481
1486
|
}
|
|
1482
1487
|
var parentNode = getParentNode(element);
|
|
@@ -1500,7 +1505,7 @@
|
|
|
1500
1505
|
return document.documentElement;
|
|
1501
1506
|
}
|
|
1502
1507
|
var el = element.parentElement;
|
|
1503
|
-
while (el && getStyleComputedProperty(el,
|
|
1508
|
+
while (el && getStyleComputedProperty(el, "transform") === "none") {
|
|
1504
1509
|
el = el.parentElement;
|
|
1505
1510
|
}
|
|
1506
1511
|
return el || document.documentElement;
|
|
@@ -1529,17 +1534,17 @@
|
|
|
1529
1534
|
var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
|
|
1530
1535
|
|
|
1531
1536
|
// Handle viewport case
|
|
1532
|
-
if (boundariesElement ===
|
|
1537
|
+
if (boundariesElement === "viewport") {
|
|
1533
1538
|
boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
|
|
1534
1539
|
} else {
|
|
1535
1540
|
// Handle other cases based on DOM element used as boundaries
|
|
1536
1541
|
var boundariesNode = void 0;
|
|
1537
|
-
if (boundariesElement ===
|
|
1542
|
+
if (boundariesElement === "scrollParent") {
|
|
1538
1543
|
boundariesNode = getScrollParent(getParentNode(reference));
|
|
1539
|
-
if (boundariesNode.nodeName ===
|
|
1544
|
+
if (boundariesNode.nodeName === "BODY") {
|
|
1540
1545
|
boundariesNode = popper.ownerDocument.documentElement;
|
|
1541
1546
|
}
|
|
1542
|
-
} else if (boundariesElement ===
|
|
1547
|
+
} else if (boundariesElement === "window") {
|
|
1543
1548
|
boundariesNode = popper.ownerDocument.documentElement;
|
|
1544
1549
|
} else {
|
|
1545
1550
|
boundariesNode = boundariesElement;
|
|
@@ -1547,7 +1552,7 @@
|
|
|
1547
1552
|
var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
|
|
1548
1553
|
|
|
1549
1554
|
// In case of HTML, we need a different computation
|
|
1550
|
-
if (boundariesNode.nodeName ===
|
|
1555
|
+
if (boundariesNode.nodeName === "HTML" && !isFixed(offsetParent)) {
|
|
1551
1556
|
var _getWindowSizes = getWindowSizes(popper.ownerDocument),
|
|
1552
1557
|
height = _getWindowSizes.height,
|
|
1553
1558
|
width = _getWindowSizes.width;
|
|
@@ -1563,7 +1568,7 @@
|
|
|
1563
1568
|
|
|
1564
1569
|
// Add paddings
|
|
1565
1570
|
padding = padding || 0;
|
|
1566
|
-
var isPaddingNumber = typeof padding ===
|
|
1571
|
+
var isPaddingNumber = typeof padding === "number";
|
|
1567
1572
|
boundaries.left += isPaddingNumber ? padding : padding.left || 0;
|
|
1568
1573
|
boundaries.top += isPaddingNumber ? padding : padding.top || 0;
|
|
1569
1574
|
boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
|
|
@@ -1587,7 +1592,7 @@
|
|
|
1587
1592
|
*/
|
|
1588
1593
|
function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
|
|
1589
1594
|
var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
1590
|
-
if (placement.indexOf(
|
|
1595
|
+
if (placement.indexOf("auto") === -1) {
|
|
1591
1596
|
return placement;
|
|
1592
1597
|
}
|
|
1593
1598
|
var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
|
|
@@ -1624,8 +1629,8 @@
|
|
|
1624
1629
|
return width >= popper.clientWidth && height >= popper.clientHeight;
|
|
1625
1630
|
});
|
|
1626
1631
|
var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
|
|
1627
|
-
var variation = placement.split(
|
|
1628
|
-
return computedPlacement + (variation ?
|
|
1632
|
+
var variation = placement.split("-")[1];
|
|
1633
|
+
return computedPlacement + (variation ? "-" + variation : "");
|
|
1629
1634
|
}
|
|
1630
1635
|
|
|
1631
1636
|
/**
|
|
@@ -1672,10 +1677,10 @@
|
|
|
1672
1677
|
*/
|
|
1673
1678
|
function getOppositePlacement(placement) {
|
|
1674
1679
|
var hash = {
|
|
1675
|
-
left:
|
|
1676
|
-
right:
|
|
1677
|
-
bottom:
|
|
1678
|
-
top:
|
|
1680
|
+
left: "right",
|
|
1681
|
+
right: "left",
|
|
1682
|
+
bottom: "top",
|
|
1683
|
+
top: "bottom"
|
|
1679
1684
|
};
|
|
1680
1685
|
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
1681
1686
|
return hash[matched];
|
|
@@ -1693,7 +1698,7 @@
|
|
|
1693
1698
|
* @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
|
|
1694
1699
|
*/
|
|
1695
1700
|
function getPopperOffsets(popper, referenceOffsets, placement) {
|
|
1696
|
-
placement = placement.split(
|
|
1701
|
+
placement = placement.split("-")[0];
|
|
1697
1702
|
|
|
1698
1703
|
// Get popper node sizes
|
|
1699
1704
|
var popperRect = getOuterSizes(popper);
|
|
@@ -1705,11 +1710,11 @@
|
|
|
1705
1710
|
};
|
|
1706
1711
|
|
|
1707
1712
|
// depending by the popper placement we have to compute its offsets slightly differently
|
|
1708
|
-
var isHoriz = [
|
|
1709
|
-
var mainSide = isHoriz ?
|
|
1710
|
-
var secondarySide = isHoriz ?
|
|
1711
|
-
var measurement = isHoriz ?
|
|
1712
|
-
var secondaryMeasurement = !isHoriz ?
|
|
1713
|
+
var isHoriz = ["right", "left"].indexOf(placement) !== -1;
|
|
1714
|
+
var mainSide = isHoriz ? "top" : "left";
|
|
1715
|
+
var secondarySide = isHoriz ? "left" : "top";
|
|
1716
|
+
var measurement = isHoriz ? "height" : "width";
|
|
1717
|
+
var secondaryMeasurement = !isHoriz ? "height" : "width";
|
|
1713
1718
|
popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
|
|
1714
1719
|
if (placement === secondarySide) {
|
|
1715
1720
|
popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
|
|
@@ -1773,13 +1778,13 @@
|
|
|
1773
1778
|
* @returns {dataObject}
|
|
1774
1779
|
*/
|
|
1775
1780
|
function runModifiers(modifiers, data, ends) {
|
|
1776
|
-
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers,
|
|
1781
|
+
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, "name", ends));
|
|
1777
1782
|
modifiersToRun.forEach(function (modifier) {
|
|
1778
|
-
if (modifier[
|
|
1783
|
+
if (modifier["function"]) {
|
|
1779
1784
|
// eslint-disable-line dot-notation
|
|
1780
|
-
console.warn(
|
|
1785
|
+
console.warn("`modifier.function` is deprecated, use `modifier.fn`!");
|
|
1781
1786
|
}
|
|
1782
|
-
var fn = modifier[
|
|
1787
|
+
var fn = modifier["function"] || modifier.fn; // eslint-disable-line dot-notation
|
|
1783
1788
|
if (modifier.enabled && isFunction$1(fn)) {
|
|
1784
1789
|
// Add properties to offsets to make them a complete clientRect object
|
|
1785
1790
|
// we do this before each modifier to make sure the previous one doesn't
|
|
@@ -1827,7 +1832,7 @@
|
|
|
1827
1832
|
|
|
1828
1833
|
// compute the popper offsets
|
|
1829
1834
|
data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
|
|
1830
|
-
data.offsets.popper.position = this.options.positionFixed ?
|
|
1835
|
+
data.offsets.popper.position = this.options.positionFixed ? "fixed" : "absolute";
|
|
1831
1836
|
|
|
1832
1837
|
// run the modifiers
|
|
1833
1838
|
data = runModifiers(this.modifiers, data);
|
|
@@ -1864,12 +1869,12 @@
|
|
|
1864
1869
|
* @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
|
|
1865
1870
|
*/
|
|
1866
1871
|
function getSupportedPropertyName(property) {
|
|
1867
|
-
var prefixes = [false,
|
|
1872
|
+
var prefixes = [false, "ms", "Webkit", "Moz", "O"];
|
|
1868
1873
|
var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
|
|
1869
1874
|
for (var i = 0; i < prefixes.length; i++) {
|
|
1870
1875
|
var prefix = prefixes[i];
|
|
1871
|
-
var toCheck = prefix ?
|
|
1872
|
-
if (typeof document.body.style[toCheck] !==
|
|
1876
|
+
var toCheck = prefix ? "" + prefix + upperProp : property;
|
|
1877
|
+
if (typeof document.body.style[toCheck] !== "undefined") {
|
|
1873
1878
|
return toCheck;
|
|
1874
1879
|
}
|
|
1875
1880
|
}
|
|
@@ -1885,15 +1890,15 @@
|
|
|
1885
1890
|
this.state.isDestroyed = true;
|
|
1886
1891
|
|
|
1887
1892
|
// touch DOM only if `applyStyle` modifier is enabled
|
|
1888
|
-
if (isModifierEnabled(this.modifiers,
|
|
1889
|
-
this.popper.removeAttribute(
|
|
1890
|
-
this.popper.style.position =
|
|
1891
|
-
this.popper.style.top =
|
|
1892
|
-
this.popper.style.left =
|
|
1893
|
-
this.popper.style.right =
|
|
1894
|
-
this.popper.style.bottom =
|
|
1895
|
-
this.popper.style.willChange =
|
|
1896
|
-
this.popper.style[getSupportedPropertyName(
|
|
1893
|
+
if (isModifierEnabled(this.modifiers, "applyStyle")) {
|
|
1894
|
+
this.popper.removeAttribute("x-placement");
|
|
1895
|
+
this.popper.style.position = "";
|
|
1896
|
+
this.popper.style.top = "";
|
|
1897
|
+
this.popper.style.left = "";
|
|
1898
|
+
this.popper.style.right = "";
|
|
1899
|
+
this.popper.style.bottom = "";
|
|
1900
|
+
this.popper.style.willChange = "";
|
|
1901
|
+
this.popper.style[getSupportedPropertyName("transform")] = "";
|
|
1897
1902
|
}
|
|
1898
1903
|
this.disableEventListeners();
|
|
1899
1904
|
|
|
@@ -1915,7 +1920,7 @@
|
|
|
1915
1920
|
return ownerDocument ? ownerDocument.defaultView : window;
|
|
1916
1921
|
}
|
|
1917
1922
|
function attachToScrollParents(scrollParent, event, callback, scrollParents) {
|
|
1918
|
-
var isBody = scrollParent.nodeName ===
|
|
1923
|
+
var isBody = scrollParent.nodeName === "BODY";
|
|
1919
1924
|
var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
|
|
1920
1925
|
target.addEventListener(event, callback, {
|
|
1921
1926
|
passive: true
|
|
@@ -1935,13 +1940,13 @@
|
|
|
1935
1940
|
function setupEventListeners(reference, options, state, updateBound) {
|
|
1936
1941
|
// Resize event listener on window
|
|
1937
1942
|
state.updateBound = updateBound;
|
|
1938
|
-
getWindow(reference).addEventListener(
|
|
1943
|
+
getWindow(reference).addEventListener("resize", state.updateBound, {
|
|
1939
1944
|
passive: true
|
|
1940
1945
|
});
|
|
1941
1946
|
|
|
1942
1947
|
// Scroll event listener on scroll parents
|
|
1943
1948
|
var scrollElement = getScrollParent(reference);
|
|
1944
|
-
attachToScrollParents(scrollElement,
|
|
1949
|
+
attachToScrollParents(scrollElement, "scroll", state.updateBound, state.scrollParents);
|
|
1945
1950
|
state.scrollElement = scrollElement;
|
|
1946
1951
|
state.eventsEnabled = true;
|
|
1947
1952
|
return state;
|
|
@@ -1967,11 +1972,11 @@
|
|
|
1967
1972
|
*/
|
|
1968
1973
|
function removeEventListeners(reference, state) {
|
|
1969
1974
|
// Remove resize event listener on window
|
|
1970
|
-
getWindow(reference).removeEventListener(
|
|
1975
|
+
getWindow(reference).removeEventListener("resize", state.updateBound);
|
|
1971
1976
|
|
|
1972
1977
|
// Remove scroll event listener on scroll parents
|
|
1973
1978
|
state.scrollParents.forEach(function (target) {
|
|
1974
|
-
target.removeEventListener(
|
|
1979
|
+
target.removeEventListener("scroll", state.updateBound);
|
|
1975
1980
|
});
|
|
1976
1981
|
|
|
1977
1982
|
// Reset state
|
|
@@ -2004,7 +2009,7 @@
|
|
|
2004
2009
|
* @return {Boolean}
|
|
2005
2010
|
*/
|
|
2006
2011
|
function isNumeric(n) {
|
|
2007
|
-
return n !==
|
|
2012
|
+
return n !== "" && !isNaN(parseFloat(n)) && isFinite(n);
|
|
2008
2013
|
}
|
|
2009
2014
|
|
|
2010
2015
|
/**
|
|
@@ -2017,10 +2022,10 @@
|
|
|
2017
2022
|
*/
|
|
2018
2023
|
function setStyles(element, styles) {
|
|
2019
2024
|
Object.keys(styles).forEach(function (prop) {
|
|
2020
|
-
var unit =
|
|
2025
|
+
var unit = "";
|
|
2021
2026
|
// add unit if the value is numeric and is one of the following
|
|
2022
|
-
if ([
|
|
2023
|
-
unit =
|
|
2027
|
+
if (["width", "height", "top", "right", "bottom", "left"].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
|
|
2028
|
+
unit = "px";
|
|
2024
2029
|
}
|
|
2025
2030
|
element.style[prop] = styles[prop] + unit;
|
|
2026
2031
|
});
|
|
@@ -2090,12 +2095,12 @@
|
|
|
2090
2095
|
// modifiers will be able to edit `placement` if needed
|
|
2091
2096
|
// and refer to originalPlacement to know the original value
|
|
2092
2097
|
var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
|
|
2093
|
-
popper.setAttribute(
|
|
2098
|
+
popper.setAttribute("x-placement", placement);
|
|
2094
2099
|
|
|
2095
2100
|
// Apply `position` to popper before anything else because
|
|
2096
2101
|
// without the position applied we can't guarantee correct computations
|
|
2097
2102
|
setStyles(popper, {
|
|
2098
|
-
position: options.positionFixed ?
|
|
2103
|
+
position: options.positionFixed ? "fixed" : "absolute"
|
|
2099
2104
|
});
|
|
2100
2105
|
return options;
|
|
2101
2106
|
}
|
|
@@ -2130,8 +2135,8 @@
|
|
|
2130
2135
|
};
|
|
2131
2136
|
var referenceWidth = round(reference.width);
|
|
2132
2137
|
var popperWidth = round(popper.width);
|
|
2133
|
-
var isVertical = [
|
|
2134
|
-
var isVariation = data.placement.indexOf(
|
|
2138
|
+
var isVertical = ["left", "right"].indexOf(data.placement) !== -1;
|
|
2139
|
+
var isVariation = data.placement.indexOf("-") !== -1;
|
|
2135
2140
|
var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
|
|
2136
2141
|
var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
|
|
2137
2142
|
var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
|
|
@@ -2160,10 +2165,10 @@
|
|
|
2160
2165
|
// Remove this legacy support in Popper.js v2
|
|
2161
2166
|
|
|
2162
2167
|
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
|
|
2163
|
-
return modifier.name ===
|
|
2168
|
+
return modifier.name === "applyStyle";
|
|
2164
2169
|
}).gpuAcceleration;
|
|
2165
2170
|
if (legacyGpuAccelerationOption !== undefined) {
|
|
2166
|
-
console.warn(
|
|
2171
|
+
console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");
|
|
2167
2172
|
}
|
|
2168
2173
|
var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
|
|
2169
2174
|
var offsetParent = getOffsetParent(data.instance.popper);
|
|
@@ -2174,13 +2179,13 @@
|
|
|
2174
2179
|
position: popper.position
|
|
2175
2180
|
};
|
|
2176
2181
|
var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
|
|
2177
|
-
var sideA = x ===
|
|
2178
|
-
var sideB = y ===
|
|
2182
|
+
var sideA = x === "bottom" ? "top" : "bottom";
|
|
2183
|
+
var sideB = y === "right" ? "left" : "right";
|
|
2179
2184
|
|
|
2180
2185
|
// if gpuAcceleration is set to `true` and transform is supported,
|
|
2181
2186
|
// we use `translate3d` to apply the position to the popper we
|
|
2182
2187
|
// automatically use the supported prefixed version if needed
|
|
2183
|
-
var prefixedProperty = getSupportedPropertyName(
|
|
2188
|
+
var prefixedProperty = getSupportedPropertyName("transform");
|
|
2184
2189
|
|
|
2185
2190
|
// now, let's make a step back and look at this code closely (wtf?)
|
|
2186
2191
|
// If the content of the popper grows once it's been positioned, it
|
|
@@ -2193,10 +2198,10 @@
|
|
|
2193
2198
|
// its bottom.
|
|
2194
2199
|
var left = void 0,
|
|
2195
2200
|
top = void 0;
|
|
2196
|
-
if (sideA ===
|
|
2201
|
+
if (sideA === "bottom") {
|
|
2197
2202
|
// when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
|
|
2198
2203
|
// and not the bottom of the html element
|
|
2199
|
-
if (offsetParent.nodeName ===
|
|
2204
|
+
if (offsetParent.nodeName === "HTML") {
|
|
2200
2205
|
top = -offsetParent.clientHeight + offsets.bottom;
|
|
2201
2206
|
} else {
|
|
2202
2207
|
top = -offsetParentRect.height + offsets.bottom;
|
|
@@ -2204,8 +2209,8 @@
|
|
|
2204
2209
|
} else {
|
|
2205
2210
|
top = offsets.top;
|
|
2206
2211
|
}
|
|
2207
|
-
if (sideB ===
|
|
2208
|
-
if (offsetParent.nodeName ===
|
|
2212
|
+
if (sideB === "right") {
|
|
2213
|
+
if (offsetParent.nodeName === "HTML") {
|
|
2209
2214
|
left = -offsetParent.clientWidth + offsets.right;
|
|
2210
2215
|
} else {
|
|
2211
2216
|
left = -offsetParentRect.width + offsets.right;
|
|
@@ -2214,22 +2219,22 @@
|
|
|
2214
2219
|
left = offsets.left;
|
|
2215
2220
|
}
|
|
2216
2221
|
if (gpuAcceleration && prefixedProperty) {
|
|
2217
|
-
styles[prefixedProperty] =
|
|
2222
|
+
styles[prefixedProperty] = "translate3d(" + left + "px, " + top + "px, 0)";
|
|
2218
2223
|
styles[sideA] = 0;
|
|
2219
2224
|
styles[sideB] = 0;
|
|
2220
|
-
styles.willChange =
|
|
2225
|
+
styles.willChange = "transform";
|
|
2221
2226
|
} else {
|
|
2222
2227
|
// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
|
|
2223
|
-
var invertTop = sideA ===
|
|
2224
|
-
var invertLeft = sideB ===
|
|
2228
|
+
var invertTop = sideA === "bottom" ? -1 : 1;
|
|
2229
|
+
var invertLeft = sideB === "right" ? -1 : 1;
|
|
2225
2230
|
styles[sideA] = top * invertTop;
|
|
2226
2231
|
styles[sideB] = left * invertLeft;
|
|
2227
|
-
styles.willChange = sideA +
|
|
2232
|
+
styles.willChange = sideA + ", " + sideB;
|
|
2228
2233
|
}
|
|
2229
2234
|
|
|
2230
2235
|
// Attributes
|
|
2231
2236
|
var attributes = {
|
|
2232
|
-
|
|
2237
|
+
"x-placement": data.placement
|
|
2233
2238
|
};
|
|
2234
2239
|
|
|
2235
2240
|
// Update `data` attributes, styles and arrowStyles
|
|
@@ -2258,9 +2263,9 @@
|
|
|
2258
2263
|
return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
|
|
2259
2264
|
});
|
|
2260
2265
|
if (!isRequired) {
|
|
2261
|
-
var _requesting =
|
|
2262
|
-
var requested =
|
|
2263
|
-
console.warn(requested +
|
|
2266
|
+
var _requesting = "`" + requestingName + "`";
|
|
2267
|
+
var requested = "`" + requestedName + "`";
|
|
2268
|
+
console.warn(requested + " modifier is required by " + _requesting + " modifier in order to work, be sure to include it before " + _requesting + "!");
|
|
2264
2269
|
}
|
|
2265
2270
|
return isRequired;
|
|
2266
2271
|
}
|
|
@@ -2276,13 +2281,13 @@
|
|
|
2276
2281
|
var _data$offsets$arrow;
|
|
2277
2282
|
|
|
2278
2283
|
// arrow depends on keepTogether in order to work
|
|
2279
|
-
if (!isModifierRequired(data.instance.modifiers,
|
|
2284
|
+
if (!isModifierRequired(data.instance.modifiers, "arrow", "keepTogether")) {
|
|
2280
2285
|
return data;
|
|
2281
2286
|
}
|
|
2282
2287
|
var arrowElement = options.element;
|
|
2283
2288
|
|
|
2284
2289
|
// if arrowElement is a string, suppose it's a CSS selector
|
|
2285
|
-
if (typeof arrowElement ===
|
|
2290
|
+
if (typeof arrowElement === "string") {
|
|
2286
2291
|
arrowElement = data.instance.popper.querySelector(arrowElement);
|
|
2287
2292
|
|
|
2288
2293
|
// if arrowElement is not found, don't run the modifier
|
|
@@ -2293,20 +2298,20 @@
|
|
|
2293
2298
|
// if the arrowElement isn't a query selector we must check that the
|
|
2294
2299
|
// provided DOM node is child of its popper node
|
|
2295
2300
|
if (!data.instance.popper.contains(arrowElement)) {
|
|
2296
|
-
console.warn(
|
|
2301
|
+
console.warn("WARNING: `arrow.element` must be child of its popper element!");
|
|
2297
2302
|
return data;
|
|
2298
2303
|
}
|
|
2299
2304
|
}
|
|
2300
|
-
var placement = data.placement.split(
|
|
2305
|
+
var placement = data.placement.split("-")[0];
|
|
2301
2306
|
var _data$offsets = data.offsets,
|
|
2302
2307
|
popper = _data$offsets.popper,
|
|
2303
2308
|
reference = _data$offsets.reference;
|
|
2304
|
-
var isVertical = [
|
|
2305
|
-
var len = isVertical ?
|
|
2306
|
-
var sideCapitalized = isVertical ?
|
|
2309
|
+
var isVertical = ["left", "right"].indexOf(placement) !== -1;
|
|
2310
|
+
var len = isVertical ? "height" : "width";
|
|
2311
|
+
var sideCapitalized = isVertical ? "Top" : "Left";
|
|
2307
2312
|
var side = sideCapitalized.toLowerCase();
|
|
2308
|
-
var altSide = isVertical ?
|
|
2309
|
-
var opSide = isVertical ?
|
|
2313
|
+
var altSide = isVertical ? "left" : "top";
|
|
2314
|
+
var opSide = isVertical ? "bottom" : "right";
|
|
2310
2315
|
var arrowElementSize = getOuterSizes(arrowElement)[len];
|
|
2311
2316
|
|
|
2312
2317
|
//
|
|
@@ -2330,14 +2335,14 @@
|
|
|
2330
2335
|
// Compute the sideValue using the updated popper offsets
|
|
2331
2336
|
// take popper margin in account because we don't have this info available
|
|
2332
2337
|
var css = getStyleComputedProperty(data.instance.popper);
|
|
2333
|
-
var popperMarginSide = parseFloat(css[
|
|
2334
|
-
var popperBorderSide = parseFloat(css[
|
|
2338
|
+
var popperMarginSide = parseFloat(css["margin" + sideCapitalized], 10);
|
|
2339
|
+
var popperBorderSide = parseFloat(css["border" + sideCapitalized + "Width"], 10);
|
|
2335
2340
|
var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
|
|
2336
2341
|
|
|
2337
2342
|
// prevent arrowElement from being placed not contiguously to its popper
|
|
2338
2343
|
sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
|
|
2339
2344
|
data.arrowElement = arrowElement;
|
|
2340
|
-
data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide,
|
|
2345
|
+
data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ""), _data$offsets$arrow);
|
|
2341
2346
|
return data;
|
|
2342
2347
|
}
|
|
2343
2348
|
|
|
@@ -2349,10 +2354,10 @@
|
|
|
2349
2354
|
* @returns {String} flipped placement variation
|
|
2350
2355
|
*/
|
|
2351
2356
|
function getOppositeVariation(variation) {
|
|
2352
|
-
if (variation ===
|
|
2353
|
-
return
|
|
2354
|
-
} else if (variation ===
|
|
2355
|
-
return
|
|
2357
|
+
if (variation === "end") {
|
|
2358
|
+
return "start";
|
|
2359
|
+
} else if (variation === "start") {
|
|
2360
|
+
return "end";
|
|
2356
2361
|
}
|
|
2357
2362
|
return variation;
|
|
2358
2363
|
}
|
|
@@ -2388,7 +2393,7 @@
|
|
|
2388
2393
|
* @method placements
|
|
2389
2394
|
* @memberof Popper
|
|
2390
2395
|
*/
|
|
2391
|
-
var placements = [
|
|
2396
|
+
var placements = ["auto-start", "auto", "auto-end", "top-start", "top", "top-end", "right-start", "right", "right-end", "bottom-end", "bottom", "bottom-start", "left-end", "left", "left-start"];
|
|
2392
2397
|
|
|
2393
2398
|
// Get rid of `auto` `auto-start` and `auto-end`
|
|
2394
2399
|
var validPlacements = placements.slice(3);
|
|
@@ -2410,9 +2415,9 @@
|
|
|
2410
2415
|
return counter ? arr.reverse() : arr;
|
|
2411
2416
|
}
|
|
2412
2417
|
var BEHAVIORS = {
|
|
2413
|
-
FLIP:
|
|
2414
|
-
CLOCKWISE:
|
|
2415
|
-
COUNTERCLOCKWISE:
|
|
2418
|
+
FLIP: "flip",
|
|
2419
|
+
CLOCKWISE: "clockwise",
|
|
2420
|
+
COUNTERCLOCKWISE: "counterclockwise"
|
|
2416
2421
|
};
|
|
2417
2422
|
|
|
2418
2423
|
/**
|
|
@@ -2424,7 +2429,7 @@
|
|
|
2424
2429
|
*/
|
|
2425
2430
|
function flip(data, options) {
|
|
2426
2431
|
// if `inner` modifier is enabled, we can't use the `flip` modifier
|
|
2427
|
-
if (isModifierEnabled(data.instance.modifiers,
|
|
2432
|
+
if (isModifierEnabled(data.instance.modifiers, "inner")) {
|
|
2428
2433
|
return data;
|
|
2429
2434
|
}
|
|
2430
2435
|
if (data.flipped && data.placement === data.originalPlacement) {
|
|
@@ -2432,9 +2437,9 @@
|
|
|
2432
2437
|
return data;
|
|
2433
2438
|
}
|
|
2434
2439
|
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
|
|
2435
|
-
var placement = data.placement.split(
|
|
2440
|
+
var placement = data.placement.split("-")[0];
|
|
2436
2441
|
var placementOpposite = getOppositePlacement(placement);
|
|
2437
|
-
var variation = data.placement.split(
|
|
2442
|
+
var variation = data.placement.split("-")[1] || "";
|
|
2438
2443
|
var flipOrder = [];
|
|
2439
2444
|
switch (options.behavior) {
|
|
2440
2445
|
case BEHAVIORS.FLIP:
|
|
@@ -2453,28 +2458,28 @@
|
|
|
2453
2458
|
if (placement !== step || flipOrder.length === index + 1) {
|
|
2454
2459
|
return data;
|
|
2455
2460
|
}
|
|
2456
|
-
placement = data.placement.split(
|
|
2461
|
+
placement = data.placement.split("-")[0];
|
|
2457
2462
|
placementOpposite = getOppositePlacement(placement);
|
|
2458
2463
|
var popperOffsets = data.offsets.popper;
|
|
2459
2464
|
var refOffsets = data.offsets.reference;
|
|
2460
2465
|
|
|
2461
2466
|
// using floor because the reference offsets may contain decimals we are not going to consider here
|
|
2462
2467
|
var floor = Math.floor;
|
|
2463
|
-
var overlapsRef = placement ===
|
|
2468
|
+
var overlapsRef = placement === "left" && floor(popperOffsets.right) > floor(refOffsets.left) || placement === "right" && floor(popperOffsets.left) < floor(refOffsets.right) || placement === "top" && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === "bottom" && floor(popperOffsets.top) < floor(refOffsets.bottom);
|
|
2464
2469
|
var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
|
|
2465
2470
|
var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
|
|
2466
2471
|
var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
|
|
2467
2472
|
var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
|
|
2468
|
-
var overflowsBoundaries = placement ===
|
|
2473
|
+
var overflowsBoundaries = placement === "left" && overflowsLeft || placement === "right" && overflowsRight || placement === "top" && overflowsTop || placement === "bottom" && overflowsBottom;
|
|
2469
2474
|
|
|
2470
2475
|
// flip the variation if required
|
|
2471
|
-
var isVertical = [
|
|
2476
|
+
var isVertical = ["top", "bottom"].indexOf(placement) !== -1;
|
|
2472
2477
|
|
|
2473
2478
|
// flips variation if reference element overflows boundaries
|
|
2474
|
-
var flippedVariationByRef = !!options.flipVariations && (isVertical && variation ===
|
|
2479
|
+
var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === "start" && overflowsLeft || isVertical && variation === "end" && overflowsRight || !isVertical && variation === "start" && overflowsTop || !isVertical && variation === "end" && overflowsBottom);
|
|
2475
2480
|
|
|
2476
2481
|
// flips variation if popper content overflows boundaries
|
|
2477
|
-
var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation ===
|
|
2482
|
+
var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === "start" && overflowsRight || isVertical && variation === "end" && overflowsLeft || !isVertical && variation === "start" && overflowsBottom || !isVertical && variation === "end" && overflowsTop);
|
|
2478
2483
|
var flippedVariation = flippedVariationByRef || flippedVariationByContent;
|
|
2479
2484
|
if (overlapsRef || overflowsBoundaries || flippedVariation) {
|
|
2480
2485
|
// this boolean to detect any flip loop
|
|
@@ -2485,12 +2490,12 @@
|
|
|
2485
2490
|
if (flippedVariation) {
|
|
2486
2491
|
variation = getOppositeVariation(variation);
|
|
2487
2492
|
}
|
|
2488
|
-
data.placement = placement + (variation ?
|
|
2493
|
+
data.placement = placement + (variation ? "-" + variation : "");
|
|
2489
2494
|
|
|
2490
2495
|
// this object contains `position`, we want to preserve it along with
|
|
2491
2496
|
// any additional property we may add in the future
|
|
2492
2497
|
data.offsets.popper = _extends$2({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
|
|
2493
|
-
data = runModifiers(data.instance.modifiers, data,
|
|
2498
|
+
data = runModifiers(data.instance.modifiers, data, "flip");
|
|
2494
2499
|
}
|
|
2495
2500
|
});
|
|
2496
2501
|
return data;
|
|
@@ -2507,12 +2512,12 @@
|
|
|
2507
2512
|
var _data$offsets = data.offsets,
|
|
2508
2513
|
popper = _data$offsets.popper,
|
|
2509
2514
|
reference = _data$offsets.reference;
|
|
2510
|
-
var placement = data.placement.split(
|
|
2515
|
+
var placement = data.placement.split("-")[0];
|
|
2511
2516
|
var floor = Math.floor;
|
|
2512
|
-
var isVertical = [
|
|
2513
|
-
var side = isVertical ?
|
|
2514
|
-
var opSide = isVertical ?
|
|
2515
|
-
var measurement = isVertical ?
|
|
2517
|
+
var isVertical = ["top", "bottom"].indexOf(placement) !== -1;
|
|
2518
|
+
var side = isVertical ? "right" : "bottom";
|
|
2519
|
+
var opSide = isVertical ? "left" : "top";
|
|
2520
|
+
var measurement = isVertical ? "width" : "height";
|
|
2516
2521
|
if (popper[side] < floor(reference[opSide])) {
|
|
2517
2522
|
data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
|
|
2518
2523
|
}
|
|
@@ -2544,23 +2549,23 @@
|
|
|
2544
2549
|
if (!value) {
|
|
2545
2550
|
return str;
|
|
2546
2551
|
}
|
|
2547
|
-
if (unit.indexOf(
|
|
2552
|
+
if (unit.indexOf("%") === 0) {
|
|
2548
2553
|
var element = void 0;
|
|
2549
2554
|
switch (unit) {
|
|
2550
|
-
case
|
|
2555
|
+
case "%p":
|
|
2551
2556
|
element = popperOffsets;
|
|
2552
2557
|
break;
|
|
2553
|
-
case
|
|
2554
|
-
case
|
|
2558
|
+
case "%":
|
|
2559
|
+
case "%r":
|
|
2555
2560
|
default:
|
|
2556
2561
|
element = referenceOffsets;
|
|
2557
2562
|
}
|
|
2558
2563
|
var rect = getClientRect(element);
|
|
2559
2564
|
return rect[measurement] / 100 * value;
|
|
2560
|
-
} else if (unit ===
|
|
2565
|
+
} else if (unit === "vh" || unit === "vw") {
|
|
2561
2566
|
// if is a vh or vw, we calculate the size based on the viewport
|
|
2562
2567
|
var size = void 0;
|
|
2563
|
-
if (unit ===
|
|
2568
|
+
if (unit === "vh") {
|
|
2564
2569
|
size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
2565
2570
|
} else {
|
|
2566
2571
|
size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
|
@@ -2590,7 +2595,7 @@
|
|
|
2590
2595
|
// Use height if placement is left or right and index is 0 otherwise use width
|
|
2591
2596
|
// in this way the first offset will use an axis and the second one
|
|
2592
2597
|
// will use the other one
|
|
2593
|
-
var useHeight = [
|
|
2598
|
+
var useHeight = ["right", "left"].indexOf(basePlacement) !== -1;
|
|
2594
2599
|
|
|
2595
2600
|
// Split the offset string to obtain a list of values and operands
|
|
2596
2601
|
// The regex addresses values with the plus or minus sign in front (+10, -20, etc)
|
|
@@ -2603,8 +2608,8 @@
|
|
|
2603
2608
|
var divider = fragments.indexOf(find(fragments, function (frag) {
|
|
2604
2609
|
return frag.search(/,|\s/) !== -1;
|
|
2605
2610
|
}));
|
|
2606
|
-
if (fragments[divider] && fragments[divider].indexOf(
|
|
2607
|
-
console.warn(
|
|
2611
|
+
if (fragments[divider] && fragments[divider].indexOf(",") === -1) {
|
|
2612
|
+
console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");
|
|
2608
2613
|
}
|
|
2609
2614
|
|
|
2610
2615
|
// If divider is found, we divide the list of values and operands to divide
|
|
@@ -2615,13 +2620,13 @@
|
|
|
2615
2620
|
// Convert the values with units to absolute pixels to allow our computations
|
|
2616
2621
|
ops = ops.map(function (op, index) {
|
|
2617
2622
|
// Most of the units rely on the orientation of the popper
|
|
2618
|
-
var measurement = (index === 1 ? !useHeight : useHeight) ?
|
|
2623
|
+
var measurement = (index === 1 ? !useHeight : useHeight) ? "height" : "width";
|
|
2619
2624
|
var mergeWithPrevious = false;
|
|
2620
2625
|
return op
|
|
2621
2626
|
// This aggregates any `+` or `-` sign that aren't considered operators
|
|
2622
2627
|
// e.g.: 10 + +5 => [10, +, +5]
|
|
2623
2628
|
.reduce(function (a, b) {
|
|
2624
|
-
if (a[a.length - 1] ===
|
|
2629
|
+
if (a[a.length - 1] === "" && ["+", "-"].indexOf(b) !== -1) {
|
|
2625
2630
|
a[a.length - 1] = b;
|
|
2626
2631
|
mergeWithPrevious = true;
|
|
2627
2632
|
return a;
|
|
@@ -2643,7 +2648,7 @@
|
|
|
2643
2648
|
ops.forEach(function (op, index) {
|
|
2644
2649
|
op.forEach(function (frag, index2) {
|
|
2645
2650
|
if (isNumeric(frag)) {
|
|
2646
|
-
offsets[index] += frag * (op[index2 - 1] ===
|
|
2651
|
+
offsets[index] += frag * (op[index2 - 1] === "-" ? -1 : 1);
|
|
2647
2652
|
}
|
|
2648
2653
|
});
|
|
2649
2654
|
});
|
|
@@ -2665,23 +2670,23 @@
|
|
|
2665
2670
|
_data$offsets = data.offsets,
|
|
2666
2671
|
popper = _data$offsets.popper,
|
|
2667
2672
|
reference = _data$offsets.reference;
|
|
2668
|
-
var basePlacement = placement.split(
|
|
2673
|
+
var basePlacement = placement.split("-")[0];
|
|
2669
2674
|
var offsets = void 0;
|
|
2670
2675
|
if (isNumeric(+offset)) {
|
|
2671
2676
|
offsets = [+offset, 0];
|
|
2672
2677
|
} else {
|
|
2673
2678
|
offsets = parseOffset(offset, popper, reference, basePlacement);
|
|
2674
2679
|
}
|
|
2675
|
-
if (basePlacement ===
|
|
2680
|
+
if (basePlacement === "left") {
|
|
2676
2681
|
popper.top += offsets[0];
|
|
2677
2682
|
popper.left -= offsets[1];
|
|
2678
|
-
} else if (basePlacement ===
|
|
2683
|
+
} else if (basePlacement === "right") {
|
|
2679
2684
|
popper.top += offsets[0];
|
|
2680
2685
|
popper.left += offsets[1];
|
|
2681
|
-
} else if (basePlacement ===
|
|
2686
|
+
} else if (basePlacement === "top") {
|
|
2682
2687
|
popper.left += offsets[0];
|
|
2683
2688
|
popper.top -= offsets[1];
|
|
2684
|
-
} else if (basePlacement ===
|
|
2689
|
+
} else if (basePlacement === "bottom") {
|
|
2685
2690
|
popper.left += offsets[0];
|
|
2686
2691
|
popper.top += offsets[1];
|
|
2687
2692
|
}
|
|
@@ -2709,14 +2714,14 @@
|
|
|
2709
2714
|
// NOTE: DOM access here
|
|
2710
2715
|
// resets the popper's position so that the document size can be calculated excluding
|
|
2711
2716
|
// the size of the popper element itself
|
|
2712
|
-
var transformProp = getSupportedPropertyName(
|
|
2717
|
+
var transformProp = getSupportedPropertyName("transform");
|
|
2713
2718
|
var popperStyles = data.instance.popper.style; // assignment to help minification
|
|
2714
2719
|
var top = popperStyles.top,
|
|
2715
2720
|
left = popperStyles.left,
|
|
2716
2721
|
transform = popperStyles[transformProp];
|
|
2717
|
-
popperStyles.top =
|
|
2718
|
-
popperStyles.left =
|
|
2719
|
-
popperStyles[transformProp] =
|
|
2722
|
+
popperStyles.top = "";
|
|
2723
|
+
popperStyles.left = "";
|
|
2724
|
+
popperStyles[transformProp] = "";
|
|
2720
2725
|
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
|
|
2721
2726
|
|
|
2722
2727
|
// NOTE: DOM access here
|
|
@@ -2736,16 +2741,16 @@
|
|
|
2736
2741
|
return defineProperty({}, placement, value);
|
|
2737
2742
|
},
|
|
2738
2743
|
secondary: function secondary(placement) {
|
|
2739
|
-
var mainSide = placement ===
|
|
2744
|
+
var mainSide = placement === "right" ? "left" : "top";
|
|
2740
2745
|
var value = popper[mainSide];
|
|
2741
2746
|
if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
|
|
2742
|
-
value = Math.min(popper[mainSide], boundaries[placement] - (placement ===
|
|
2747
|
+
value = Math.min(popper[mainSide], boundaries[placement] - (placement === "right" ? popper.width : popper.height));
|
|
2743
2748
|
}
|
|
2744
2749
|
return defineProperty({}, mainSide, value);
|
|
2745
2750
|
}
|
|
2746
2751
|
};
|
|
2747
2752
|
order.forEach(function (placement) {
|
|
2748
|
-
var side = [
|
|
2753
|
+
var side = ["left", "top"].indexOf(placement) !== -1 ? "primary" : "secondary";
|
|
2749
2754
|
popper = _extends$2({}, popper, check[side](placement));
|
|
2750
2755
|
});
|
|
2751
2756
|
data.offsets.popper = popper;
|
|
@@ -2761,17 +2766,17 @@
|
|
|
2761
2766
|
*/
|
|
2762
2767
|
function shift(data) {
|
|
2763
2768
|
var placement = data.placement;
|
|
2764
|
-
var basePlacement = placement.split(
|
|
2765
|
-
var shiftvariation = placement.split(
|
|
2769
|
+
var basePlacement = placement.split("-")[0];
|
|
2770
|
+
var shiftvariation = placement.split("-")[1];
|
|
2766
2771
|
|
|
2767
2772
|
// if shift shiftvariation is specified, run the modifier
|
|
2768
2773
|
if (shiftvariation) {
|
|
2769
2774
|
var _data$offsets = data.offsets,
|
|
2770
2775
|
reference = _data$offsets.reference,
|
|
2771
2776
|
popper = _data$offsets.popper;
|
|
2772
|
-
var isVertical = [
|
|
2773
|
-
var side = isVertical ?
|
|
2774
|
-
var measurement = isVertical ?
|
|
2777
|
+
var isVertical = ["bottom", "top"].indexOf(basePlacement) !== -1;
|
|
2778
|
+
var side = isVertical ? "left" : "top";
|
|
2779
|
+
var measurement = isVertical ? "width" : "height";
|
|
2775
2780
|
var shiftOffsets = {
|
|
2776
2781
|
start: defineProperty({}, side, reference[side]),
|
|
2777
2782
|
end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
|
|
@@ -2789,12 +2794,12 @@
|
|
|
2789
2794
|
* @returns {Object} The data object, properly modified
|
|
2790
2795
|
*/
|
|
2791
2796
|
function hide(data) {
|
|
2792
|
-
if (!isModifierRequired(data.instance.modifiers,
|
|
2797
|
+
if (!isModifierRequired(data.instance.modifiers, "hide", "preventOverflow")) {
|
|
2793
2798
|
return data;
|
|
2794
2799
|
}
|
|
2795
2800
|
var refRect = data.offsets.reference;
|
|
2796
2801
|
var bound = find(data.instance.modifiers, function (modifier) {
|
|
2797
|
-
return modifier.name ===
|
|
2802
|
+
return modifier.name === "preventOverflow";
|
|
2798
2803
|
}).boundaries;
|
|
2799
2804
|
if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
|
|
2800
2805
|
// Avoid unnecessary DOM access if visibility hasn't changed
|
|
@@ -2802,14 +2807,14 @@
|
|
|
2802
2807
|
return data;
|
|
2803
2808
|
}
|
|
2804
2809
|
data.hide = true;
|
|
2805
|
-
data.attributes[
|
|
2810
|
+
data.attributes["x-out-of-boundaries"] = "";
|
|
2806
2811
|
} else {
|
|
2807
2812
|
// Avoid unnecessary DOM access if visibility hasn't changed
|
|
2808
2813
|
if (data.hide === false) {
|
|
2809
2814
|
return data;
|
|
2810
2815
|
}
|
|
2811
2816
|
data.hide = false;
|
|
2812
|
-
data.attributes[
|
|
2817
|
+
data.attributes["x-out-of-boundaries"] = false;
|
|
2813
2818
|
}
|
|
2814
2819
|
return data;
|
|
2815
2820
|
}
|
|
@@ -2823,13 +2828,13 @@
|
|
|
2823
2828
|
*/
|
|
2824
2829
|
function inner(data) {
|
|
2825
2830
|
var placement = data.placement;
|
|
2826
|
-
var basePlacement = placement.split(
|
|
2831
|
+
var basePlacement = placement.split("-")[0];
|
|
2827
2832
|
var _data$offsets = data.offsets,
|
|
2828
2833
|
popper = _data$offsets.popper,
|
|
2829
2834
|
reference = _data$offsets.reference;
|
|
2830
|
-
var isHoriz = [
|
|
2831
|
-
var subtractLength = [
|
|
2832
|
-
popper[isHoriz ?
|
|
2835
|
+
var isHoriz = ["left", "right"].indexOf(basePlacement) !== -1;
|
|
2836
|
+
var subtractLength = ["top", "left"].indexOf(basePlacement) === -1;
|
|
2837
|
+
popper[isHoriz ? "left" : "top"] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? "width" : "height"] : 0);
|
|
2833
2838
|
data.placement = getOppositePlacement(placement);
|
|
2834
2839
|
data.offsets.popper = getClientRect(popper);
|
|
2835
2840
|
return data;
|
|
@@ -2952,7 +2957,7 @@
|
|
|
2952
2957
|
* Popper will try to prevent overflow following these priorities by default,
|
|
2953
2958
|
* then, it could overflow on the left and on top of the `boundariesElement`
|
|
2954
2959
|
*/
|
|
2955
|
-
priority: [
|
|
2960
|
+
priority: ["left", "right", "top", "bottom"],
|
|
2956
2961
|
/**
|
|
2957
2962
|
* @prop {number} padding=5
|
|
2958
2963
|
* Amount of pixel used to define a minimum distance between the boundaries
|
|
@@ -2965,7 +2970,7 @@
|
|
|
2965
2970
|
* Boundaries used by the modifier. Can be `scrollParent`, `window`,
|
|
2966
2971
|
* `viewport` or any DOM element.
|
|
2967
2972
|
*/
|
|
2968
|
-
boundariesElement:
|
|
2973
|
+
boundariesElement: "scrollParent"
|
|
2969
2974
|
},
|
|
2970
2975
|
/**
|
|
2971
2976
|
* Modifier used to make sure the reference and its popper stay near each other
|
|
@@ -3002,7 +3007,7 @@
|
|
|
3002
3007
|
/** @prop {ModifierFn} */
|
|
3003
3008
|
fn: arrow,
|
|
3004
3009
|
/** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
|
|
3005
|
-
element:
|
|
3010
|
+
element: "[x-arrow]"
|
|
3006
3011
|
},
|
|
3007
3012
|
/**
|
|
3008
3013
|
* Modifier used to flip the popper's placement when it starts to overlap its
|
|
@@ -3028,7 +3033,7 @@
|
|
|
3028
3033
|
* `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
|
|
3029
3034
|
* placements (with optional variations)
|
|
3030
3035
|
*/
|
|
3031
|
-
behavior:
|
|
3036
|
+
behavior: "flip",
|
|
3032
3037
|
/**
|
|
3033
3038
|
* @prop {number} padding=5
|
|
3034
3039
|
* The popper will flip if it hits the edges of the `boundariesElement`
|
|
@@ -3040,7 +3045,7 @@
|
|
|
3040
3045
|
* The popper will never be placed outside of the defined boundaries
|
|
3041
3046
|
* (except if `keepTogether` is enabled)
|
|
3042
3047
|
*/
|
|
3043
|
-
boundariesElement:
|
|
3048
|
+
boundariesElement: "viewport",
|
|
3044
3049
|
/**
|
|
3045
3050
|
* @prop {Boolean} flipVariations=false
|
|
3046
3051
|
* The popper will switch placement variation between `-start` and `-end` when
|
|
@@ -3124,13 +3129,13 @@
|
|
|
3124
3129
|
* Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
|
|
3125
3130
|
* Change this if your popper should grow in a direction different from `bottom`
|
|
3126
3131
|
*/
|
|
3127
|
-
x:
|
|
3132
|
+
x: "bottom",
|
|
3128
3133
|
/**
|
|
3129
3134
|
* @prop {string} [x='left']
|
|
3130
3135
|
* Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
|
|
3131
3136
|
* Change this if your popper should grow in a direction different from `right`
|
|
3132
3137
|
*/
|
|
3133
|
-
y:
|
|
3138
|
+
y: "right"
|
|
3134
3139
|
},
|
|
3135
3140
|
/**
|
|
3136
3141
|
* Applies the computed styles to the popper element.
|
|
@@ -3206,7 +3211,7 @@
|
|
|
3206
3211
|
* Popper's placement.
|
|
3207
3212
|
* @prop {Popper.placements} placement='bottom'
|
|
3208
3213
|
*/
|
|
3209
|
-
placement:
|
|
3214
|
+
placement: "bottom",
|
|
3210
3215
|
/**
|
|
3211
3216
|
* Set this to true if you want popper to position it self in 'fixed' mode
|
|
3212
3217
|
* @prop {Boolean} positionFixed=false
|
|
@@ -3334,22 +3339,22 @@
|
|
|
3334
3339
|
// class prototype and break stuff like Sinon stubs
|
|
3335
3340
|
|
|
3336
3341
|
createClass(Popper, [{
|
|
3337
|
-
key:
|
|
3342
|
+
key: "update",
|
|
3338
3343
|
value: function update$$1() {
|
|
3339
3344
|
return update.call(this);
|
|
3340
3345
|
}
|
|
3341
3346
|
}, {
|
|
3342
|
-
key:
|
|
3347
|
+
key: "destroy",
|
|
3343
3348
|
value: function destroy$$1() {
|
|
3344
3349
|
return destroy.call(this);
|
|
3345
3350
|
}
|
|
3346
3351
|
}, {
|
|
3347
|
-
key:
|
|
3352
|
+
key: "enableEventListeners",
|
|
3348
3353
|
value: function enableEventListeners$$1() {
|
|
3349
3354
|
return enableEventListeners.call(this);
|
|
3350
3355
|
}
|
|
3351
3356
|
}, {
|
|
3352
|
-
key:
|
|
3357
|
+
key: "disableEventListeners",
|
|
3353
3358
|
value: function disableEventListeners$$1() {
|
|
3354
3359
|
return disableEventListeners.call(this);
|
|
3355
3360
|
}
|
|
@@ -3401,7 +3406,7 @@
|
|
|
3401
3406
|
* An ES6 getter that will return the height of the virtual reference element.
|
|
3402
3407
|
*/
|
|
3403
3408
|
|
|
3404
|
-
Popper.Utils = (typeof window !==
|
|
3409
|
+
Popper.Utils = (typeof window !== "undefined" ? window : global).PopperUtils;
|
|
3405
3410
|
Popper.placements = placements;
|
|
3406
3411
|
Popper.Defaults = Defaults;
|
|
3407
3412
|
|
|
@@ -3498,14 +3503,14 @@
|
|
|
3498
3503
|
} // Prevent a tippy with a delay from hiding if the cursor left then returned
|
|
3499
3504
|
// before it started hiding
|
|
3500
3505
|
|
|
3501
|
-
popper.addEventListener(
|
|
3502
|
-
if (instance.props.interactive && instance.state.isVisible && lastTriggerEventType ===
|
|
3506
|
+
popper.addEventListener("mouseenter", function () {
|
|
3507
|
+
if (instance.props.interactive && instance.state.isVisible && lastTriggerEventType === "mouseenter") {
|
|
3503
3508
|
instance.clearDelayTimeouts();
|
|
3504
3509
|
}
|
|
3505
3510
|
});
|
|
3506
|
-
popper.addEventListener(
|
|
3507
|
-
if (instance.props.interactive && lastTriggerEventType ===
|
|
3508
|
-
document.addEventListener(
|
|
3511
|
+
popper.addEventListener("mouseleave", function () {
|
|
3512
|
+
if (instance.props.interactive && lastTriggerEventType === "mouseenter") {
|
|
3513
|
+
document.addEventListener("mousemove", debouncedOnMouseMove);
|
|
3509
3514
|
}
|
|
3510
3515
|
});
|
|
3511
3516
|
props.onCreate(instance);
|
|
@@ -3513,17 +3518,17 @@
|
|
|
3513
3518
|
/* ======================= 🔒 Private methods 🔒 ======================= */
|
|
3514
3519
|
|
|
3515
3520
|
function getIsVerticalPlacement() {
|
|
3516
|
-
return includes([
|
|
3521
|
+
return includes(["top", "bottom"], getBasePlacement(instance.state.currentPlacement));
|
|
3517
3522
|
}
|
|
3518
3523
|
function getIsOppositePlacement() {
|
|
3519
|
-
return includes([
|
|
3524
|
+
return includes(["bottom", "right"], getBasePlacement(instance.state.currentPlacement));
|
|
3520
3525
|
}
|
|
3521
3526
|
function getNormalizedTouchSettings() {
|
|
3522
3527
|
var touch = instance.props.touch;
|
|
3523
3528
|
return Array.isArray(touch) ? touch : [touch, 0];
|
|
3524
3529
|
}
|
|
3525
3530
|
function getIsCustomTouchBehavior() {
|
|
3526
|
-
return getNormalizedTouchSettings()[0] ===
|
|
3531
|
+
return getNormalizedTouchSettings()[0] === "hold";
|
|
3527
3532
|
}
|
|
3528
3533
|
function getTransitionableElements() {
|
|
3529
3534
|
return [tooltip, content, instance.popperChildren.backdrop];
|
|
@@ -3532,8 +3537,8 @@
|
|
|
3532
3537
|
return instance.props.triggerTarget || reference;
|
|
3533
3538
|
}
|
|
3534
3539
|
function cleanupInteractiveMouseListeners() {
|
|
3535
|
-
document.body.removeEventListener(
|
|
3536
|
-
document.removeEventListener(
|
|
3540
|
+
document.body.removeEventListener("mouseleave", scheduleHide);
|
|
3541
|
+
document.removeEventListener("mousemove", debouncedOnMouseMove);
|
|
3537
3542
|
mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
|
|
3538
3543
|
return listener !== debouncedOnMouseMove;
|
|
3539
3544
|
});
|
|
@@ -3548,7 +3553,7 @@
|
|
|
3548
3553
|
if (currentInput.isTouch) {
|
|
3549
3554
|
return;
|
|
3550
3555
|
}
|
|
3551
|
-
if (instance.state.isVisible && includes(instance.props.trigger,
|
|
3556
|
+
if (instance.state.isVisible && includes(instance.props.trigger, "click")) {
|
|
3552
3557
|
return;
|
|
3553
3558
|
}
|
|
3554
3559
|
}
|
|
@@ -3570,10 +3575,10 @@
|
|
|
3570
3575
|
}
|
|
3571
3576
|
}
|
|
3572
3577
|
function addDocumentMouseDownListener() {
|
|
3573
|
-
document.addEventListener(
|
|
3578
|
+
document.addEventListener("mousedown", onDocumentMouseDown, true);
|
|
3574
3579
|
}
|
|
3575
3580
|
function removeDocumentMouseDownListener() {
|
|
3576
|
-
document.removeEventListener(
|
|
3581
|
+
document.removeEventListener("mousedown", onDocumentMouseDown, true);
|
|
3577
3582
|
}
|
|
3578
3583
|
function makeSticky() {
|
|
3579
3584
|
setTransitionDuration([popper], isIE ? 0 : instance.props.updateDuration);
|
|
@@ -3603,7 +3608,7 @@
|
|
|
3603
3608
|
*/
|
|
3604
3609
|
function listener(event) {
|
|
3605
3610
|
if (event.target === tooltip) {
|
|
3606
|
-
updateTransitionEndListener(tooltip,
|
|
3611
|
+
updateTransitionEndListener(tooltip, "remove", listener);
|
|
3607
3612
|
callback();
|
|
3608
3613
|
}
|
|
3609
3614
|
} // Make callback synchronous if duration is 0
|
|
@@ -3612,8 +3617,8 @@
|
|
|
3612
3617
|
if (duration === 0) {
|
|
3613
3618
|
return callback();
|
|
3614
3619
|
}
|
|
3615
|
-
updateTransitionEndListener(tooltip,
|
|
3616
|
-
updateTransitionEndListener(tooltip,
|
|
3620
|
+
updateTransitionEndListener(tooltip, "remove", currentTransitionEndListener);
|
|
3621
|
+
updateTransitionEndListener(tooltip, "add", listener);
|
|
3617
3622
|
currentTransitionEndListener = listener;
|
|
3618
3623
|
}
|
|
3619
3624
|
function on(eventType, handler, options) {
|
|
@@ -3629,28 +3634,28 @@
|
|
|
3629
3634
|
}
|
|
3630
3635
|
function addTriggersToEventListenersTarget() {
|
|
3631
3636
|
if (getIsCustomTouchBehavior()) {
|
|
3632
|
-
on(
|
|
3633
|
-
on(
|
|
3637
|
+
on("touchstart", onTrigger, PASSIVE);
|
|
3638
|
+
on("touchend", onMouseLeave, PASSIVE);
|
|
3634
3639
|
} // `click` for keyboard. Mouse uses `mousedown` (onDocumentMouseDown)
|
|
3635
3640
|
|
|
3636
|
-
if (!includes(instance.props.trigger,
|
|
3637
|
-
on(
|
|
3641
|
+
if (!includes(instance.props.trigger, "click")) {
|
|
3642
|
+
on("click", function () {
|
|
3638
3643
|
if (!currentInput.isTouch && instance.props.hideOnClick === true) {
|
|
3639
3644
|
instance.hide();
|
|
3640
3645
|
}
|
|
3641
3646
|
});
|
|
3642
3647
|
}
|
|
3643
|
-
instance.props.trigger.trim().split(
|
|
3644
|
-
if (eventType ===
|
|
3648
|
+
instance.props.trigger.trim().split(" ").forEach(function (eventType) {
|
|
3649
|
+
if (eventType === "manual") {
|
|
3645
3650
|
return;
|
|
3646
3651
|
}
|
|
3647
3652
|
on(eventType, onTrigger);
|
|
3648
3653
|
switch (eventType) {
|
|
3649
|
-
case
|
|
3650
|
-
on(
|
|
3654
|
+
case "mouseenter":
|
|
3655
|
+
on("mouseleave", onMouseLeave);
|
|
3651
3656
|
break;
|
|
3652
|
-
case
|
|
3653
|
-
on(isIE ?
|
|
3657
|
+
case "focus":
|
|
3658
|
+
on(isIE ? "focusout" : "blur", onBlur);
|
|
3654
3659
|
break;
|
|
3655
3660
|
}
|
|
3656
3661
|
});
|
|
@@ -3681,13 +3686,13 @@
|
|
|
3681
3686
|
}
|
|
3682
3687
|
} // Toggle show/hide when clicking click-triggered tooltips
|
|
3683
3688
|
|
|
3684
|
-
if (event.type ===
|
|
3689
|
+
if (event.type === "click" && instance.props.hideOnClick !== false && instance.state.isVisible) {
|
|
3685
3690
|
scheduleHide(event);
|
|
3686
3691
|
} else {
|
|
3687
3692
|
var _getNormalizedTouchSe = getNormalizedTouchSettings(),
|
|
3688
3693
|
value = _getNormalizedTouchSe[0],
|
|
3689
3694
|
duration = _getNormalizedTouchSe[1];
|
|
3690
|
-
if (currentInput.isTouch && value ===
|
|
3695
|
+
if (currentInput.isTouch && value === "hold" && duration) {
|
|
3691
3696
|
// We can hijack the show timeout here, it will be cleared by
|
|
3692
3697
|
// `scheduleHide()` when necessary
|
|
3693
3698
|
showTimeout = setTimeout(function () {
|
|
@@ -3715,8 +3720,8 @@
|
|
|
3715
3720
|
return;
|
|
3716
3721
|
}
|
|
3717
3722
|
if (instance.props.interactive) {
|
|
3718
|
-
document.body.addEventListener(
|
|
3719
|
-
document.addEventListener(
|
|
3723
|
+
document.body.addEventListener("mouseleave", scheduleHide);
|
|
3724
|
+
document.addEventListener("mousemove", debouncedOnMouseMove);
|
|
3720
3725
|
mouseMoveListeners.push(debouncedOnMouseMove);
|
|
3721
3726
|
return;
|
|
3722
3727
|
}
|
|
@@ -3733,8 +3738,8 @@
|
|
|
3733
3738
|
scheduleHide(event);
|
|
3734
3739
|
}
|
|
3735
3740
|
function isEventListenerStopped(event) {
|
|
3736
|
-
var supportsTouch = (
|
|
3737
|
-
var isTouchEvent = includes(event.type,
|
|
3741
|
+
var supportsTouch = ("ontouchstart" in window);
|
|
3742
|
+
var isTouchEvent = includes(event.type, "touch");
|
|
3738
3743
|
var isCustomTouch = getIsCustomTouchBehavior();
|
|
3739
3744
|
return supportsTouch && currentInput.isTouch && isCustomTouch && !isTouchEvent || currentInput.isTouch && !isCustomTouch && isTouchEvent;
|
|
3740
3745
|
}
|
|
@@ -3743,11 +3748,11 @@
|
|
|
3743
3748
|
popperOptions = _instance$props.popperOptions,
|
|
3744
3749
|
placement = _instance$props.placement;
|
|
3745
3750
|
var arrow = instance.popperChildren.arrow;
|
|
3746
|
-
var preventOverflowModifier = getModifier(popperOptions,
|
|
3751
|
+
var preventOverflowModifier = getModifier(popperOptions, "preventOverflow"); // Due to the virtual offsets normalization when using `followCursor`, we
|
|
3747
3752
|
// need to use the opposite placement
|
|
3748
3753
|
|
|
3749
|
-
var shift = instance.state.currentPlacement.split(
|
|
3750
|
-
normalizedPlacement = instance.props.followCursor && shift ? placement.replace(shift, shift ===
|
|
3754
|
+
var shift = instance.state.currentPlacement.split("-")[1];
|
|
3755
|
+
normalizedPlacement = instance.props.followCursor && shift ? placement.replace(shift, shift === "start" ? "end" : "start") : placement;
|
|
3751
3756
|
function applyMutations(data) {
|
|
3752
3757
|
instance.state.currentPlacement = data.placement;
|
|
3753
3758
|
if (instance.props.flip && !instance.props.flipOnUpdate) {
|
|
@@ -3756,20 +3761,23 @@
|
|
|
3756
3761
|
}
|
|
3757
3762
|
setFlipModifierEnabled(instance.popperInstance.modifiers, false);
|
|
3758
3763
|
}
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3764
|
+
if (instance.props.escapeWithReference) {
|
|
3765
|
+
setEscapeWithReference(instance.popperInstance.modifiers, true);
|
|
3766
|
+
}
|
|
3767
|
+
tooltip.setAttribute("data-placement", instance.state.currentPlacement);
|
|
3768
|
+
if (data.attributes["x-out-of-boundaries"] !== false) {
|
|
3769
|
+
tooltip.setAttribute("data-out-of-boundaries", "");
|
|
3762
3770
|
} else {
|
|
3763
|
-
tooltip.removeAttribute(
|
|
3771
|
+
tooltip.removeAttribute("data-out-of-boundaries");
|
|
3764
3772
|
} // Apply the `distance` prop
|
|
3765
3773
|
|
|
3766
3774
|
var basePlacement = getBasePlacement(instance.state.currentPlacement);
|
|
3767
3775
|
var tooltipStyles = tooltip.style;
|
|
3768
|
-
tooltipStyles.top =
|
|
3769
|
-
tooltipStyles.left =
|
|
3770
|
-
tooltipStyles[getIsVerticalPlacement() ?
|
|
3776
|
+
tooltipStyles.top = "0";
|
|
3777
|
+
tooltipStyles.left = "0";
|
|
3778
|
+
tooltipStyles[getIsVerticalPlacement() ? "top" : "left"] = (getIsOppositePlacement() ? 1 : -1) * instance.props.distance + "px";
|
|
3771
3779
|
var padding = preventOverflowModifier && preventOverflowModifier.padding !== undefined ? preventOverflowModifier.padding : PREVENT_OVERFLOW_PADDING;
|
|
3772
|
-
var isPaddingNumber = typeof padding ===
|
|
3780
|
+
var isPaddingNumber = typeof padding === "number";
|
|
3773
3781
|
var computedPadding = _extends$1({
|
|
3774
3782
|
top: isPaddingNumber ? padding : padding.top,
|
|
3775
3783
|
bottom: isPaddingNumber ? padding : padding.bottom,
|
|
@@ -3778,7 +3786,7 @@
|
|
|
3778
3786
|
}, !isPaddingNumber && padding);
|
|
3779
3787
|
computedPadding[basePlacement] = isPaddingNumber ? padding + instance.props.distance : (padding[basePlacement] || 0) + instance.props.distance;
|
|
3780
3788
|
instance.popperInstance.modifiers.filter(function (m) {
|
|
3781
|
-
return m.name ===
|
|
3789
|
+
return m.name === "preventOverflow";
|
|
3782
3790
|
})[0].padding = computedPadding;
|
|
3783
3791
|
}
|
|
3784
3792
|
var config = _extends$1({
|
|
@@ -3793,17 +3801,17 @@
|
|
|
3793
3801
|
arrow: _extends$1({
|
|
3794
3802
|
element: arrow,
|
|
3795
3803
|
enabled: !!arrow
|
|
3796
|
-
}, getModifier(popperOptions,
|
|
3804
|
+
}, getModifier(popperOptions, "arrow")),
|
|
3797
3805
|
flip: _extends$1({
|
|
3798
3806
|
enabled: instance.props.flip,
|
|
3799
3807
|
// The tooltip is offset by 10px from the popper in CSS,
|
|
3800
3808
|
// we need to account for its distance
|
|
3801
3809
|
padding: instance.props.distance + PREVENT_OVERFLOW_PADDING,
|
|
3802
3810
|
behavior: instance.props.flipBehavior
|
|
3803
|
-
}, getModifier(popperOptions,
|
|
3811
|
+
}, getModifier(popperOptions, "flip")),
|
|
3804
3812
|
offset: _extends$1({
|
|
3805
3813
|
offset: instance.props.offset
|
|
3806
|
-
}, getModifier(popperOptions,
|
|
3814
|
+
}, getModifier(popperOptions, "offset"))
|
|
3807
3815
|
}),
|
|
3808
3816
|
onCreate: function onCreate(data) {
|
|
3809
3817
|
applyMutations(data);
|
|
@@ -3830,7 +3838,7 @@
|
|
|
3830
3838
|
// popperInstance update/create
|
|
3831
3839
|
hasMountCallbackRun = false;
|
|
3832
3840
|
var appendTo = instance.props.appendTo;
|
|
3833
|
-
var parentNode = appendTo ===
|
|
3841
|
+
var parentNode = appendTo === "parent" ? reference.parentNode : invokeWithArgsOrReturn(appendTo, [reference]); // The popper element needs to exist on the DOM before its position can be
|
|
3834
3842
|
// updated as Popper.js needs to read its dimensions
|
|
3835
3843
|
|
|
3836
3844
|
if (!parentNode.contains(popper)) {
|
|
@@ -3914,7 +3922,7 @@
|
|
|
3914
3922
|
var nextProps = evaluateProps(reference, _extends$1({}, instance.props, partialProps, {
|
|
3915
3923
|
ignoreAttributes: true
|
|
3916
3924
|
}));
|
|
3917
|
-
nextProps.ignoreAttributes = hasOwnProperty(partialProps,
|
|
3925
|
+
nextProps.ignoreAttributes = hasOwnProperty(partialProps, "ignoreAttributes") ? partialProps.ignoreAttributes || false : prevProps.ignoreAttributes;
|
|
3918
3926
|
instance.props = nextProps;
|
|
3919
3927
|
addTriggersToEventListenersTarget();
|
|
3920
3928
|
cleanupInteractiveMouseListeners();
|
|
@@ -3957,14 +3965,14 @@
|
|
|
3957
3965
|
// Firefox allows events on disabled elements, but Chrome doesn't.
|
|
3958
3966
|
// Using a wrapper element (i.e. <span>) is recommended.
|
|
3959
3967
|
|
|
3960
|
-
if (getEventListenersTarget().hasAttribute(
|
|
3968
|
+
if (getEventListenersTarget().hasAttribute("disabled")) {
|
|
3961
3969
|
return;
|
|
3962
3970
|
}
|
|
3963
3971
|
if (instance.props.onShow(instance) === false) {
|
|
3964
3972
|
return;
|
|
3965
3973
|
}
|
|
3966
3974
|
addDocumentMouseDownListener();
|
|
3967
|
-
popper.style.visibility =
|
|
3975
|
+
popper.style.visibility = "visible";
|
|
3968
3976
|
instance.state.isVisible = true; // Prevent a transition of the popper from its previous position and of the
|
|
3969
3977
|
// elements at a different placement.
|
|
3970
3978
|
|
|
@@ -3981,13 +3989,13 @@
|
|
|
3981
3989
|
// tooltip element. `clip-path` is the other alternative but is not well-
|
|
3982
3990
|
// supported and is buggy on some devices.
|
|
3983
3991
|
|
|
3984
|
-
content.style.transitionDelay = instance.popperChildren.backdrop ? Math.round(duration / 12) + "ms" :
|
|
3992
|
+
content.style.transitionDelay = instance.popperChildren.backdrop ? Math.round(duration / 12) + "ms" : "";
|
|
3985
3993
|
if (instance.props.sticky) {
|
|
3986
3994
|
makeSticky();
|
|
3987
3995
|
}
|
|
3988
3996
|
setTransitionDuration([popper], instance.props.updateDuration);
|
|
3989
3997
|
setTransitionDuration(transitionableElements, duration);
|
|
3990
|
-
setVisibilityState(transitionableElements,
|
|
3998
|
+
setVisibilityState(transitionableElements, "visible");
|
|
3991
3999
|
onTransitionedIn(duration, function () {
|
|
3992
4000
|
if (instance.props.aria) {
|
|
3993
4001
|
getEventListenersTarget().setAttribute("aria-" + instance.props.aria, tooltip.id);
|
|
@@ -4012,12 +4020,12 @@
|
|
|
4012
4020
|
return;
|
|
4013
4021
|
}
|
|
4014
4022
|
removeDocumentMouseDownListener();
|
|
4015
|
-
popper.style.visibility =
|
|
4023
|
+
popper.style.visibility = "hidden";
|
|
4016
4024
|
instance.state.isVisible = false;
|
|
4017
4025
|
instance.state.isShown = false;
|
|
4018
4026
|
var transitionableElements = getTransitionableElements();
|
|
4019
4027
|
setTransitionDuration(transitionableElements, duration);
|
|
4020
|
-
setVisibilityState(transitionableElements,
|
|
4028
|
+
setVisibilityState(transitionableElements, "hidden");
|
|
4021
4029
|
onTransitionedOut(duration, function () {
|
|
4022
4030
|
if (instance.props.aria) {
|
|
4023
4031
|
getEventListenersTarget().removeAttribute("aria-" + instance.props.aria);
|
|
@@ -4100,8 +4108,8 @@
|
|
|
4100
4108
|
*/
|
|
4101
4109
|
|
|
4102
4110
|
function autoInit() {
|
|
4103
|
-
arrayFrom(document.querySelectorAll(
|
|
4104
|
-
var content = el.getAttribute(
|
|
4111
|
+
arrayFrom(document.querySelectorAll("[data-tippy]")).forEach(function (el) {
|
|
4112
|
+
var content = el.getAttribute("data-tippy");
|
|
4105
4113
|
if (content) {
|
|
4106
4114
|
tippy(el, {
|
|
4107
4115
|
content: content
|
|
@@ -4119,7 +4127,7 @@
|
|
|
4119
4127
|
* MIT License
|
|
4120
4128
|
*/
|
|
4121
4129
|
|
|
4122
|
-
var css = ".tippy-tooltip[data-animation=fade][data-state=hidden]{opacity:0}.tippy-iOS{cursor:pointer!important;-webkit-tap-highlight-color:transparent}.tippy-popper{pointer-events:none;max-width:calc(100% - 8px);transition-timing-function:cubic-bezier(.165,.84,.44,1)}.tippy-tooltip{position:relative;color:#fff;border-radius:.25rem;font-size:.875rem;line-height:1.4;background-color:#333;overflow:hidden;transition-property:visibility,opacity,transform;outline:0}.tippy-tooltip[data-placement^=top] .tippy-arrow{border-width:8px 8px 0;border-top-color:#333;margin:0 3px;transform-origin:50% 0;bottom:-
|
|
4130
|
+
var css = ".tippy-tooltip[data-animation=fade][data-state=hidden]{opacity:0}.tippy-iOS{cursor:pointer!important;-webkit-tap-highlight-color:transparent}.tippy-popper{pointer-events:none;max-width:calc(100% - 8px);transition-timing-function:cubic-bezier(.165,.84,.44,1)}.tippy-tooltip{position:relative;color:#fff;border-radius:.25rem;font-size:.875rem;line-height:1.4;background-color:#333;overflow:hidden;transition-property:visibility,opacity,transform;outline:0}.tippy-tooltip[data-placement^=top] .tippy-arrow{border-width:8px 8px 0;border-top-color:#333;margin:0 3px;transform-origin:50% 0;bottom:-8px}.tippy-tooltip[data-placement^=bottom] .tippy-arrow{border-width:0 8px 8px;border-bottom-color:#333;margin:0 3px;transform-origin:50% 7px;top:-8px}.tippy-tooltip[data-placement^=left] .tippy-arrow{border-width:8px 0 8px 8px;border-left-color:#333;margin:3px 0;transform-origin:0 50%;right:-8px}.tippy-tooltip[data-placement^=right] .tippy-arrow{border-width:8px 8px 8px 0;border-right-color:#333;margin:3px 0;transform-origin:7px 50%;left:-8px}.tippy-tooltip[data-arrow]{overflow:visible}.tippy-tooltip[data-animatefill]{background-color:transparent!important}.tippy-tooltip[data-interactive]{pointer-events:auto}.tippy-tooltip[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-tooltip[data-inertia][data-state=hidden]{transition-timing-function:ease}.tippy-arrow{border-color:transparent;border-style:solid;position:absolute}.tippy-arrow[data-state=hidden]{opacity:0}.tippy-content{padding:.3125rem .5625rem}";
|
|
4123
4131
|
|
|
4124
4132
|
/**
|
|
4125
4133
|
* Injects a string of CSS styles to a style node in <head>
|
|
@@ -4127,11 +4135,11 @@
|
|
|
4127
4135
|
|
|
4128
4136
|
function injectCSS(css) {
|
|
4129
4137
|
if (isBrowser) {
|
|
4130
|
-
var style = document.createElement(
|
|
4138
|
+
var style = document.createElement("style");
|
|
4131
4139
|
style.textContent = css;
|
|
4132
|
-
style.setAttribute(
|
|
4140
|
+
style.setAttribute("data-tippy-stylesheet", "");
|
|
4133
4141
|
var head = document.head;
|
|
4134
|
-
var firstStyleOrLinkTag = head.querySelector(
|
|
4142
|
+
var firstStyleOrLinkTag = head.querySelector("style,link");
|
|
4135
4143
|
if (firstStyleOrLinkTag) {
|
|
4136
4144
|
head.insertBefore(style, firstStyleOrLinkTag);
|
|
4137
4145
|
} else {
|
|
@@ -4140,17 +4148,17 @@
|
|
|
4140
4148
|
}
|
|
4141
4149
|
}
|
|
4142
4150
|
injectCSS(css);
|
|
4143
|
-
var missingTippy =
|
|
4144
|
-
var addShepherdClass = _createClassModifier(
|
|
4145
|
-
var addHasTitleClass = _createClassModifier(
|
|
4151
|
+
var missingTippy = "Using the attachment feature of Shepherd requires the Tippy.js library";
|
|
4152
|
+
var addShepherdClass = _createClassModifier("shepherd");
|
|
4153
|
+
var addHasTitleClass = _createClassModifier("shepherd-has-title");
|
|
4146
4154
|
var centeredStylePopperModifier = {
|
|
4147
4155
|
computeStyle: {
|
|
4148
4156
|
enabled: true,
|
|
4149
4157
|
fn: function fn(data) {
|
|
4150
4158
|
data.styles = _extends({}, data.styles, {
|
|
4151
|
-
left:
|
|
4152
|
-
top:
|
|
4153
|
-
transform:
|
|
4159
|
+
left: "50%",
|
|
4160
|
+
top: "50%",
|
|
4161
|
+
transform: "translate(-50%, -50%)"
|
|
4154
4162
|
});
|
|
4155
4163
|
return data;
|
|
4156
4164
|
}
|
|
@@ -4171,7 +4179,7 @@
|
|
|
4171
4179
|
*/
|
|
4172
4180
|
|
|
4173
4181
|
function createFromHTML(html) {
|
|
4174
|
-
var el = document.createElement(
|
|
4182
|
+
var el = document.createElement("div");
|
|
4175
4183
|
el.innerHTML = html;
|
|
4176
4184
|
return el.children[0];
|
|
4177
4185
|
}
|
|
@@ -4234,7 +4242,7 @@
|
|
|
4234
4242
|
var attachToOpts = this.parseAttachTo();
|
|
4235
4243
|
this.tooltip = _makeTippyInstance.call(this, attachToOpts);
|
|
4236
4244
|
this.target = attachToOpts.element || document.body;
|
|
4237
|
-
this.el.classList.add(
|
|
4245
|
+
this.el.classList.add("shepherd-element");
|
|
4238
4246
|
}
|
|
4239
4247
|
/**
|
|
4240
4248
|
* Checks if options.attachTo.element is a string, and if so, tries to find the element
|
|
@@ -4251,7 +4259,8 @@
|
|
|
4251
4259
|
// guarantee that the element will exist in the future.
|
|
4252
4260
|
try {
|
|
4253
4261
|
returnOpts.element = document.querySelector(options.element);
|
|
4254
|
-
} catch (e) {
|
|
4262
|
+
} catch (e) {
|
|
4263
|
+
// TODO
|
|
4255
4264
|
}
|
|
4256
4265
|
if (!returnOpts.element) {
|
|
4257
4266
|
console.error("The element for this Shepherd step was not found ".concat(options.element));
|
|
@@ -4302,7 +4311,7 @@
|
|
|
4302
4311
|
var resultingTippyOptions = {
|
|
4303
4312
|
content: this.el,
|
|
4304
4313
|
flipOnUpdate: true,
|
|
4305
|
-
placement: attachToOptions.on ||
|
|
4314
|
+
placement: attachToOptions.on || "right"
|
|
4306
4315
|
};
|
|
4307
4316
|
_extends(resultingTippyOptions, this.options.tippyOptions);
|
|
4308
4317
|
if (this.options.title) {
|
|
@@ -4328,7 +4337,7 @@
|
|
|
4328
4337
|
function _makeCenteredTippy() {
|
|
4329
4338
|
var tippyOptions = _objectSpread2({
|
|
4330
4339
|
content: this.el,
|
|
4331
|
-
placement:
|
|
4340
|
+
placement: "top"
|
|
4332
4341
|
}, this.options.tippyOptions);
|
|
4333
4342
|
tippyOptions.arrow = false;
|
|
4334
4343
|
tippyOptions.popperOptions = tippyOptions.popperOptions || {};
|
|
@@ -4442,23 +4451,24 @@
|
|
|
4442
4451
|
var el;
|
|
4443
4452
|
try {
|
|
4444
4453
|
el = document.querySelector(selector);
|
|
4445
|
-
} catch (e) {
|
|
4454
|
+
} catch (e) {
|
|
4455
|
+
// TODO
|
|
4446
4456
|
}
|
|
4447
4457
|
if (!isUndefined(selector) && !el) {
|
|
4448
4458
|
return console.error("No element was found for the selector supplied to advanceOn: ".concat(selector));
|
|
4449
4459
|
} else if (el) {
|
|
4450
4460
|
el.addEventListener(event, handler);
|
|
4451
|
-
this.on(
|
|
4461
|
+
this.on("destroy", function () {
|
|
4452
4462
|
return el.removeEventListener(event, handler);
|
|
4453
4463
|
});
|
|
4454
4464
|
} else {
|
|
4455
4465
|
document.body.addEventListener(event, handler, true);
|
|
4456
|
-
this.on(
|
|
4466
|
+
this.on("destroy", function () {
|
|
4457
4467
|
return document.body.removeEventListener(event, handler, true);
|
|
4458
4468
|
});
|
|
4459
4469
|
}
|
|
4460
4470
|
} else {
|
|
4461
|
-
return console.error(
|
|
4471
|
+
return console.error("advanceOn was defined, but no event name was passed.");
|
|
4462
4472
|
}
|
|
4463
4473
|
}
|
|
4464
4474
|
/**
|
|
@@ -4488,8 +4498,8 @@
|
|
|
4488
4498
|
el.dataset.buttonEvent = true;
|
|
4489
4499
|
el.addEventListener(event, handler); // Cleanup event listeners on destroy
|
|
4490
4500
|
|
|
4491
|
-
_this2.on(
|
|
4492
|
-
el.removeAttribute(
|
|
4501
|
+
_this2.on("destroy", function () {
|
|
4502
|
+
el.removeAttribute("data-button-event");
|
|
4493
4503
|
el.removeEventListener(event, handler);
|
|
4494
4504
|
});
|
|
4495
4505
|
});
|
|
@@ -4502,7 +4512,7 @@
|
|
|
4502
4512
|
|
|
4503
4513
|
function bindCancelLink(link) {
|
|
4504
4514
|
var _this3 = this;
|
|
4505
|
-
link.addEventListener(
|
|
4515
|
+
link.addEventListener("click", function (e) {
|
|
4506
4516
|
e.preventDefault();
|
|
4507
4517
|
_this3.cancel();
|
|
4508
4518
|
});
|
|
@@ -4536,7 +4546,7 @@
|
|
|
4536
4546
|
var d = document;
|
|
4537
4547
|
|
|
4538
4548
|
// return if scroll behavior is supported and polyfill is not forced
|
|
4539
|
-
if (
|
|
4549
|
+
if ("scrollBehavior" in d.documentElement.style && w.__forceSmoothScrollPolyfill__ !== true) {
|
|
4540
4550
|
return;
|
|
4541
4551
|
}
|
|
4542
4552
|
|
|
@@ -4562,15 +4572,15 @@
|
|
|
4562
4572
|
* @returns {Boolean}
|
|
4563
4573
|
*/
|
|
4564
4574
|
function isMicrosoftBrowser(userAgent) {
|
|
4565
|
-
var userAgentPatterns = [
|
|
4566
|
-
return new RegExp(userAgentPatterns.join(
|
|
4575
|
+
var userAgentPatterns = ["MSIE ", "Trident/", "Edge/"];
|
|
4576
|
+
return new RegExp(userAgentPatterns.join("|")).test(userAgent);
|
|
4567
4577
|
}
|
|
4568
4578
|
|
|
4569
4579
|
/*
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4580
|
+
* IE has rounding bug rounding down clientHeight and clientWidth and
|
|
4581
|
+
* rounding up scrollHeight and scrollWidth causing false positives
|
|
4582
|
+
* on hasScrollableSpace
|
|
4583
|
+
*/
|
|
4574
4584
|
var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;
|
|
4575
4585
|
|
|
4576
4586
|
/**
|
|
@@ -4602,18 +4612,18 @@
|
|
|
4602
4612
|
* @returns {Boolean}
|
|
4603
4613
|
*/
|
|
4604
4614
|
function shouldBailOut(firstArg) {
|
|
4605
|
-
if (firstArg === null || _typeof(firstArg) !==
|
|
4615
|
+
if (firstArg === null || _typeof(firstArg) !== "object" || firstArg.behavior === undefined || firstArg.behavior === "auto" || firstArg.behavior === "instant") {
|
|
4606
4616
|
// first argument is not an object/null
|
|
4607
4617
|
// or behavior is auto, instant or undefined
|
|
4608
4618
|
return true;
|
|
4609
4619
|
}
|
|
4610
|
-
if (_typeof(firstArg) ===
|
|
4620
|
+
if (_typeof(firstArg) === "object" && firstArg.behavior === "smooth") {
|
|
4611
4621
|
// first argument is an object and behavior is smooth
|
|
4612
4622
|
return false;
|
|
4613
4623
|
}
|
|
4614
4624
|
|
|
4615
4625
|
// throw error when behavior is not supported
|
|
4616
|
-
throw new TypeError(
|
|
4626
|
+
throw new TypeError("behavior member of ScrollOptions " + firstArg.behavior + " is not a valid value for enumeration ScrollBehavior.");
|
|
4617
4627
|
}
|
|
4618
4628
|
|
|
4619
4629
|
/**
|
|
@@ -4624,10 +4634,10 @@
|
|
|
4624
4634
|
* @returns {Boolean}
|
|
4625
4635
|
*/
|
|
4626
4636
|
function hasScrollableSpace(el, axis) {
|
|
4627
|
-
if (axis ===
|
|
4637
|
+
if (axis === "Y") {
|
|
4628
4638
|
return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
|
|
4629
4639
|
}
|
|
4630
|
-
if (axis ===
|
|
4640
|
+
if (axis === "X") {
|
|
4631
4641
|
return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
|
|
4632
4642
|
}
|
|
4633
4643
|
}
|
|
@@ -4640,8 +4650,8 @@
|
|
|
4640
4650
|
* @returns {Boolean}
|
|
4641
4651
|
*/
|
|
4642
4652
|
function canOverflow(el, axis) {
|
|
4643
|
-
var overflowValue = w.getComputedStyle(el, null)[
|
|
4644
|
-
return overflowValue ===
|
|
4653
|
+
var overflowValue = w.getComputedStyle(el, null)["overflow" + axis];
|
|
4654
|
+
return overflowValue === "auto" || overflowValue === "scroll";
|
|
4645
4655
|
}
|
|
4646
4656
|
|
|
4647
4657
|
/**
|
|
@@ -4652,8 +4662,8 @@
|
|
|
4652
4662
|
* @returns {Boolean}
|
|
4653
4663
|
*/
|
|
4654
4664
|
function isScrollable(el) {
|
|
4655
|
-
var isScrollableY = hasScrollableSpace(el,
|
|
4656
|
-
var isScrollableX = hasScrollableSpace(el,
|
|
4665
|
+
var isScrollableY = hasScrollableSpace(el, "Y") && canOverflow(el, "Y");
|
|
4666
|
+
var isScrollableX = hasScrollableSpace(el, "X") && canOverflow(el, "X");
|
|
4657
4667
|
return isScrollableY || isScrollableX;
|
|
4658
4668
|
}
|
|
4659
4669
|
|
|
@@ -4748,7 +4758,7 @@
|
|
|
4748
4758
|
|
|
4749
4759
|
// avoid smooth behavior if not required
|
|
4750
4760
|
if (shouldBailOut(arguments[0]) === true) {
|
|
4751
|
-
original.scroll.call(w, arguments[0].left !== undefined ? arguments[0].left : _typeof(arguments[0]) !==
|
|
4761
|
+
original.scroll.call(w, arguments[0].left !== undefined ? arguments[0].left : _typeof(arguments[0]) !== "object" ? arguments[0] : w.scrollX || w.pageXOffset,
|
|
4752
4762
|
// use top prop, second argument if present or fallback to scrollY
|
|
4753
4763
|
arguments[0].top !== undefined ? arguments[0].top : arguments[1] !== undefined ? arguments[1] : w.scrollY || w.pageYOffset);
|
|
4754
4764
|
return;
|
|
@@ -4767,7 +4777,7 @@
|
|
|
4767
4777
|
|
|
4768
4778
|
// avoid smooth behavior if not required
|
|
4769
4779
|
if (shouldBailOut(arguments[0])) {
|
|
4770
|
-
original.scrollBy.call(w, arguments[0].left !== undefined ? arguments[0].left : _typeof(arguments[0]) !==
|
|
4780
|
+
original.scrollBy.call(w, arguments[0].left !== undefined ? arguments[0].left : _typeof(arguments[0]) !== "object" ? arguments[0] : 0, arguments[0].top !== undefined ? arguments[0].top : arguments[1] !== undefined ? arguments[1] : 0);
|
|
4771
4781
|
return;
|
|
4772
4782
|
}
|
|
4773
4783
|
|
|
@@ -4785,12 +4795,12 @@
|
|
|
4785
4795
|
// avoid smooth behavior if not required
|
|
4786
4796
|
if (shouldBailOut(arguments[0]) === true) {
|
|
4787
4797
|
// if one number is passed, throw error to match Firefox implementation
|
|
4788
|
-
if (typeof arguments[0] ===
|
|
4789
|
-
throw new SyntaxError(
|
|
4798
|
+
if (typeof arguments[0] === "number" && arguments[1] === undefined) {
|
|
4799
|
+
throw new SyntaxError("Value could not be converted");
|
|
4790
4800
|
}
|
|
4791
4801
|
original.elementScroll.call(this,
|
|
4792
4802
|
// use left prop, first number argument or fallback to scrollLeft
|
|
4793
|
-
arguments[0].left !== undefined ? ~~arguments[0].left : _typeof(arguments[0]) !==
|
|
4803
|
+
arguments[0].left !== undefined ? ~~arguments[0].left : _typeof(arguments[0]) !== "object" ? ~~arguments[0] : this.scrollLeft,
|
|
4794
4804
|
// use top prop, second argument or fallback to scrollTop
|
|
4795
4805
|
arguments[0].top !== undefined ? ~~arguments[0].top : arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop);
|
|
4796
4806
|
return;
|
|
@@ -4799,7 +4809,7 @@
|
|
|
4799
4809
|
var top = arguments[0].top;
|
|
4800
4810
|
|
|
4801
4811
|
// LET THE SMOOTHNESS BEGIN!
|
|
4802
|
-
smoothScroll.call(this, this, typeof left ===
|
|
4812
|
+
smoothScroll.call(this, this, typeof left === "undefined" ? this.scrollLeft : ~~left, typeof top === "undefined" ? this.scrollTop : ~~top);
|
|
4803
4813
|
};
|
|
4804
4814
|
|
|
4805
4815
|
// Element.prototype.scrollBy
|
|
@@ -4838,11 +4848,11 @@
|
|
|
4838
4848
|
smoothScroll.call(this, scrollableParent, scrollableParent.scrollLeft + clientRects.left - parentRects.left, scrollableParent.scrollTop + clientRects.top - parentRects.top);
|
|
4839
4849
|
|
|
4840
4850
|
// reveal parent in viewport unless is fixed
|
|
4841
|
-
if (w.getComputedStyle(scrollableParent).position !==
|
|
4851
|
+
if (w.getComputedStyle(scrollableParent).position !== "fixed") {
|
|
4842
4852
|
w.scrollBy({
|
|
4843
4853
|
left: parentRects.left,
|
|
4844
4854
|
top: parentRects.top,
|
|
4845
|
-
behavior:
|
|
4855
|
+
behavior: "smooth"
|
|
4846
4856
|
});
|
|
4847
4857
|
}
|
|
4848
4858
|
} else {
|
|
@@ -4850,7 +4860,7 @@
|
|
|
4850
4860
|
w.scrollBy({
|
|
4851
4861
|
left: clientRects.left,
|
|
4852
4862
|
top: clientRects.top,
|
|
4853
|
-
behavior:
|
|
4863
|
+
behavior: "smooth"
|
|
4854
4864
|
});
|
|
4855
4865
|
}
|
|
4856
4866
|
};
|
|
@@ -4969,7 +4979,7 @@
|
|
|
4969
4979
|
_classCallCheck$1(this, Step);
|
|
4970
4980
|
_this = _possibleConstructorReturn$1(this, _getPrototypeOf$1(Step).call(this, tour, options));
|
|
4971
4981
|
_this.tour = tour;
|
|
4972
|
-
bindMethods.call(_assertThisInitialized$1(_this), [
|
|
4982
|
+
bindMethods.call(_assertThisInitialized$1(_this), ["_show", "cancel", "complete", "destroy", "hide", "isOpen", "scrollTo", "setupElements", "show"]);
|
|
4973
4983
|
_this.setOptions(options);
|
|
4974
4984
|
_this.bindAdvance = bindAdvance.bind(_assertThisInitialized$1(_this));
|
|
4975
4985
|
_this.bindButtonEvents = bindButtonEvents.bind(_assertThisInitialized$1(_this));
|
|
@@ -4990,10 +5000,10 @@
|
|
|
4990
5000
|
value: function _addButtons(content) {
|
|
4991
5001
|
var _this2 = this;
|
|
4992
5002
|
if (Array.isArray(this.options.buttons) && this.options.buttons.length) {
|
|
4993
|
-
var footer = document.createElement(
|
|
4994
|
-
footer.classList.add(
|
|
5003
|
+
var footer = document.createElement("footer");
|
|
5004
|
+
footer.classList.add("shepherd-footer");
|
|
4995
5005
|
this.options.buttons.map(function (cfg) {
|
|
4996
|
-
var button = createFromHTML(
|
|
5006
|
+
var button = createFromHTML('<button class="shepherd-button '.concat(cfg.classes || "", '" tabindex="0">').concat(cfg.text, "</button>"));
|
|
4997
5007
|
footer.appendChild(button);
|
|
4998
5008
|
_this2.bindButtonEvents(cfg, button);
|
|
4999
5009
|
});
|
|
@@ -5012,7 +5022,7 @@
|
|
|
5012
5022
|
if (this.options.showCancelLink) {
|
|
5013
5023
|
var link = createFromHTML('<a href class="shepherd-cancel-link"></a>');
|
|
5014
5024
|
header.appendChild(link);
|
|
5015
|
-
element.classList.add(
|
|
5025
|
+
element.classList.add("shepherd-has-cancel-link");
|
|
5016
5026
|
this.bindCancelLink(link);
|
|
5017
5027
|
}
|
|
5018
5028
|
}
|
|
@@ -5027,7 +5037,7 @@
|
|
|
5027
5037
|
}, {
|
|
5028
5038
|
key: "_addContent",
|
|
5029
5039
|
value: function _addContent(content, descriptionId) {
|
|
5030
|
-
var text = createFromHTML(
|
|
5040
|
+
var text = createFromHTML('<div class="shepherd-text"\n id="'.concat(descriptionId, '"\n ></div>'));
|
|
5031
5041
|
var paragraphs = this.options.text;
|
|
5032
5042
|
if (isFunction(paragraphs)) {
|
|
5033
5043
|
paragraphs = paragraphs.call(this, text);
|
|
@@ -5065,7 +5075,7 @@
|
|
|
5065
5075
|
var _focusableElements = _slicedToArray(focusableElements, 1),
|
|
5066
5076
|
firstFocusableElement = _focusableElements[0];
|
|
5067
5077
|
var lastFocusableElement = focusableElements[focusableElements.length - 1];
|
|
5068
|
-
element.addEventListener(
|
|
5078
|
+
element.addEventListener("keydown", function (e) {
|
|
5069
5079
|
switch (e.keyCode) {
|
|
5070
5080
|
case KEY_TAB:
|
|
5071
5081
|
if (focusableElements.length === 1) {
|
|
@@ -5108,27 +5118,27 @@
|
|
|
5108
5118
|
}, {
|
|
5109
5119
|
key: "_createTooltipContent",
|
|
5110
5120
|
value: function _createTooltipContent() {
|
|
5111
|
-
var content = document.createElement(
|
|
5112
|
-
var classes = this.options.classes ||
|
|
5121
|
+
var content = document.createElement("div");
|
|
5122
|
+
var classes = this.options.classes || "";
|
|
5113
5123
|
var descriptionId = "".concat(this.id, "-description");
|
|
5114
5124
|
var labelId = "".concat(this.id, "-label");
|
|
5115
|
-
var element = createFromHTML(
|
|
5116
|
-
var header = document.createElement(
|
|
5125
|
+
var element = createFromHTML('<div class="'.concat(classes, '"\n data-shepherd-step-id="').concat(this.id, '"\n role="dialog"\n tabindex="0">'));
|
|
5126
|
+
var header = document.createElement("header");
|
|
5117
5127
|
if (this.options.title) {
|
|
5118
|
-
var title = document.createElement(
|
|
5119
|
-
title.classList.add(
|
|
5128
|
+
var title = document.createElement("h3");
|
|
5129
|
+
title.classList.add("shepherd-title");
|
|
5120
5130
|
title.innerHTML = "".concat(this.options.title);
|
|
5121
5131
|
title.id = labelId;
|
|
5122
|
-
element.setAttribute(
|
|
5132
|
+
element.setAttribute("aria-labeledby", labelId);
|
|
5123
5133
|
header.appendChild(title);
|
|
5124
5134
|
}
|
|
5125
|
-
content.classList.add(
|
|
5126
|
-
header.classList.add(
|
|
5135
|
+
content.classList.add("shepherd-content");
|
|
5136
|
+
header.classList.add("shepherd-header");
|
|
5127
5137
|
element.appendChild(content);
|
|
5128
5138
|
content.appendChild(header);
|
|
5129
5139
|
if (!isUndefined(this.options.text)) {
|
|
5130
5140
|
this._addContent(content, descriptionId);
|
|
5131
|
-
element.setAttribute(
|
|
5141
|
+
element.setAttribute("aria-describedby", descriptionId);
|
|
5132
5142
|
}
|
|
5133
5143
|
this._addButtons(content);
|
|
5134
5144
|
this._addCancelLink(element, header);
|
|
@@ -5151,7 +5161,7 @@
|
|
|
5151
5161
|
key: "cancel",
|
|
5152
5162
|
value: function cancel() {
|
|
5153
5163
|
this.tour.cancel();
|
|
5154
|
-
this.trigger(
|
|
5164
|
+
this.trigger("cancel");
|
|
5155
5165
|
}
|
|
5156
5166
|
/**
|
|
5157
5167
|
* Complete the tour
|
|
@@ -5161,7 +5171,7 @@
|
|
|
5161
5171
|
key: "complete",
|
|
5162
5172
|
value: function complete() {
|
|
5163
5173
|
this.tour.complete();
|
|
5164
|
-
this.trigger(
|
|
5174
|
+
this.trigger("complete");
|
|
5165
5175
|
}
|
|
5166
5176
|
/**
|
|
5167
5177
|
* Remove the step, delete the step's element, and destroy the tippy instance for the step
|
|
@@ -5170,18 +5180,20 @@
|
|
|
5170
5180
|
}, {
|
|
5171
5181
|
key: "destroy",
|
|
5172
5182
|
value: function destroy() {
|
|
5173
|
-
|
|
5174
|
-
this.tooltip
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
this.el
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
this.
|
|
5183
|
-
|
|
5184
|
-
|
|
5183
|
+
try {
|
|
5184
|
+
if (this.tooltip) {
|
|
5185
|
+
this.tooltip.destroy();
|
|
5186
|
+
this.tooltip = null;
|
|
5187
|
+
}
|
|
5188
|
+
if (isElement(this.el) && this.el.parentNode) {
|
|
5189
|
+
this.el.parentNode.removeChild(this.el);
|
|
5190
|
+
this.el = null;
|
|
5191
|
+
}
|
|
5192
|
+
if (this.target) {
|
|
5193
|
+
this._updateStepTargetOnHide();
|
|
5194
|
+
}
|
|
5195
|
+
this.trigger("destroy");
|
|
5196
|
+
} catch (e) {}
|
|
5185
5197
|
}
|
|
5186
5198
|
/**
|
|
5187
5199
|
* Hide the step and destroy the tippy instance
|
|
@@ -5190,15 +5202,15 @@
|
|
|
5190
5202
|
key: "hide",
|
|
5191
5203
|
value: function hide() {
|
|
5192
5204
|
this.tour.modal.hide();
|
|
5193
|
-
this.trigger(
|
|
5194
|
-
document.body.removeAttribute(
|
|
5205
|
+
this.trigger("before-hide");
|
|
5206
|
+
document.body.removeAttribute("data-shepherd-step");
|
|
5195
5207
|
if (this.target) {
|
|
5196
5208
|
this._updateStepTargetOnHide();
|
|
5197
5209
|
}
|
|
5198
5210
|
if (this.tooltip) {
|
|
5199
5211
|
this.tooltip.hide();
|
|
5200
5212
|
}
|
|
5201
|
-
this.trigger(
|
|
5213
|
+
this.trigger("hide");
|
|
5202
5214
|
}
|
|
5203
5215
|
/**
|
|
5204
5216
|
* Check if the step is open and visible
|
|
@@ -5293,19 +5305,19 @@
|
|
|
5293
5305
|
value: function _show() {
|
|
5294
5306
|
var _this6 = this;
|
|
5295
5307
|
this.tour.beforeShowStep(this);
|
|
5296
|
-
this.trigger(
|
|
5308
|
+
this.trigger("before-show");
|
|
5297
5309
|
if (!this.el) {
|
|
5298
5310
|
this.setupElements();
|
|
5299
5311
|
}
|
|
5300
|
-
this.target.classList.add(
|
|
5301
|
-
document.body.setAttribute(
|
|
5312
|
+
this.target.classList.add("shepherd-enabled", "shepherd-target");
|
|
5313
|
+
document.body.setAttribute("data-shepherd-step", this.id);
|
|
5302
5314
|
if (this.options.scrollTo) {
|
|
5303
5315
|
setTimeout(function () {
|
|
5304
5316
|
_this6.scrollTo(_this6.options.scrollTo);
|
|
5305
5317
|
});
|
|
5306
5318
|
}
|
|
5307
5319
|
this.tooltip.show();
|
|
5308
|
-
this.trigger(
|
|
5320
|
+
this.trigger("show");
|
|
5309
5321
|
this.el.focus();
|
|
5310
5322
|
}
|
|
5311
5323
|
/**
|
|
@@ -5319,29 +5331,29 @@
|
|
|
5319
5331
|
if (this.options.highlightClass) {
|
|
5320
5332
|
this.target.classList.remove(this.options.highlightClass);
|
|
5321
5333
|
}
|
|
5322
|
-
this.target.classList.remove(
|
|
5334
|
+
this.target.classList.remove("shepherd-enabled", "shepherd-target");
|
|
5323
5335
|
}
|
|
5324
5336
|
}]);
|
|
5325
5337
|
return Step;
|
|
5326
5338
|
}(Evented);
|
|
5327
|
-
var svgNS =
|
|
5339
|
+
var svgNS = "http://www.w3.org/2000/svg";
|
|
5328
5340
|
var elementIds = {
|
|
5329
|
-
modalOverlay:
|
|
5330
|
-
modalOverlayMask:
|
|
5331
|
-
modalOverlayMaskRect:
|
|
5332
|
-
modalOverlayMaskOpening:
|
|
5341
|
+
modalOverlay: "shepherdModalOverlayContainer",
|
|
5342
|
+
modalOverlayMask: "shepherdModalMask",
|
|
5343
|
+
modalOverlayMaskRect: "shepherdModalMaskRect",
|
|
5344
|
+
modalOverlayMaskOpening: "shepherdModalMaskOpening"
|
|
5333
5345
|
};
|
|
5334
5346
|
var classNames = {
|
|
5335
|
-
isVisible:
|
|
5336
|
-
modalTarget:
|
|
5347
|
+
isVisible: "shepherd-modal-is-visible",
|
|
5348
|
+
modalTarget: "shepherd-modal-target"
|
|
5337
5349
|
};
|
|
5338
5350
|
/**
|
|
5339
5351
|
* <svg id="shepherdModalOverlayContainer" xmlns="http://www.w3.org/2000/svg">
|
|
5340
5352
|
*/
|
|
5341
5353
|
|
|
5342
5354
|
function _createModalContainer() {
|
|
5343
|
-
var element = document.createElementNS(svgNS,
|
|
5344
|
-
element.setAttributeNS(null,
|
|
5355
|
+
var element = document.createElementNS(svgNS, "svg");
|
|
5356
|
+
element.setAttributeNS(null, "id", elementIds.modalOverlay);
|
|
5345
5357
|
return element;
|
|
5346
5358
|
}
|
|
5347
5359
|
/**
|
|
@@ -5349,13 +5361,13 @@
|
|
|
5349
5361
|
*/
|
|
5350
5362
|
|
|
5351
5363
|
function _createMaskContainer() {
|
|
5352
|
-
var element = document.createElementNS(svgNS,
|
|
5364
|
+
var element = document.createElementNS(svgNS, "mask");
|
|
5353
5365
|
_setAttributes(element, {
|
|
5354
|
-
height:
|
|
5366
|
+
height: "100%",
|
|
5355
5367
|
id: elementIds.modalOverlayMask,
|
|
5356
|
-
width:
|
|
5357
|
-
x:
|
|
5358
|
-
y:
|
|
5368
|
+
width: "100%",
|
|
5369
|
+
x: "0",
|
|
5370
|
+
y: "0"
|
|
5359
5371
|
});
|
|
5360
5372
|
return element;
|
|
5361
5373
|
}
|
|
@@ -5364,14 +5376,14 @@
|
|
|
5364
5376
|
*/
|
|
5365
5377
|
|
|
5366
5378
|
function _createMaskRect() {
|
|
5367
|
-
var element = document.createElementNS(svgNS,
|
|
5379
|
+
var element = document.createElementNS(svgNS, "rect");
|
|
5368
5380
|
_setAttributes(element, {
|
|
5369
|
-
fill:
|
|
5370
|
-
height:
|
|
5381
|
+
fill: "#FFFFFF",
|
|
5382
|
+
height: "100%",
|
|
5371
5383
|
id: elementIds.modalOverlayMaskRect,
|
|
5372
|
-
width:
|
|
5373
|
-
x:
|
|
5374
|
-
y:
|
|
5384
|
+
width: "100%",
|
|
5385
|
+
x: "0",
|
|
5386
|
+
y: "0"
|
|
5375
5387
|
});
|
|
5376
5388
|
return element;
|
|
5377
5389
|
}
|
|
@@ -5380,9 +5392,9 @@
|
|
|
5380
5392
|
*/
|
|
5381
5393
|
|
|
5382
5394
|
function _createMaskOpening() {
|
|
5383
|
-
var element = document.createElementNS(svgNS,
|
|
5395
|
+
var element = document.createElementNS(svgNS, "rect");
|
|
5384
5396
|
_setAttributes(element, {
|
|
5385
|
-
fill:
|
|
5397
|
+
fill: "#000000",
|
|
5386
5398
|
id: elementIds.modalOverlayMaskOpening
|
|
5387
5399
|
});
|
|
5388
5400
|
return element;
|
|
@@ -5392,35 +5404,35 @@
|
|
|
5392
5404
|
*/
|
|
5393
5405
|
|
|
5394
5406
|
function _createMaskConsumer() {
|
|
5395
|
-
var element = document.createElementNS(svgNS,
|
|
5407
|
+
var element = document.createElementNS(svgNS, "rect");
|
|
5396
5408
|
_setAttributes(element, {
|
|
5397
|
-
height:
|
|
5398
|
-
width:
|
|
5399
|
-
x:
|
|
5400
|
-
y:
|
|
5409
|
+
height: "100%",
|
|
5410
|
+
width: "100%",
|
|
5411
|
+
x: "0",
|
|
5412
|
+
y: "0"
|
|
5401
5413
|
});
|
|
5402
|
-
element.setAttribute(
|
|
5414
|
+
element.setAttribute("mask", "url(#".concat(elementIds.modalOverlayMask, ")"));
|
|
5403
5415
|
return element;
|
|
5404
5416
|
}
|
|
5405
5417
|
/**
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5418
|
+
* Generates an SVG with the following structure:
|
|
5419
|
+
* ```html
|
|
5420
|
+
* <svg id="shepherdModalOverlayContainer" xmlns="http://www.w3.org/2000/svg">
|
|
5421
|
+
<defs>
|
|
5422
|
+
<mask id="shepherdModalMask" x="0" y="0" width="100%" height="100%" >
|
|
5423
|
+
<rect x="0" y="0" width="100%" height="100%" fill="#FFFFFF"/>
|
|
5424
|
+
<!-- This element will "punch a hole" through the mask by preventing it from rendering within the perimeter -->
|
|
5425
|
+
<rect id="shepherdModalMaskOpening"/>
|
|
5426
|
+
</mask>
|
|
5427
|
+
</defs>
|
|
5428
|
+
<rect x="0" y="0" width="100%" height="100%" mask="url(#shepherdModalMask)"/>
|
|
5429
|
+
</svg>
|
|
5430
|
+
* ```
|
|
5431
|
+
*/
|
|
5420
5432
|
|
|
5421
5433
|
function createModalOverlay() {
|
|
5422
5434
|
var containerElement = _createModalContainer();
|
|
5423
|
-
var defsElement = document.createElementNS(svgNS,
|
|
5435
|
+
var defsElement = document.createElementNS(svgNS, "defs");
|
|
5424
5436
|
var maskContainer = _createMaskContainer();
|
|
5425
5437
|
var maskRect = _createMaskRect();
|
|
5426
5438
|
var maskOpening = _createMaskOpening();
|
|
@@ -5461,10 +5473,10 @@
|
|
|
5461
5473
|
function closeModalOpening(openingElement) {
|
|
5462
5474
|
if (openingElement && openingElement instanceof SVGElement) {
|
|
5463
5475
|
_setAttributes(openingElement, {
|
|
5464
|
-
height:
|
|
5465
|
-
x:
|
|
5466
|
-
y:
|
|
5467
|
-
width:
|
|
5476
|
+
height: "0",
|
|
5477
|
+
x: "0",
|
|
5478
|
+
y: "0",
|
|
5479
|
+
width: "0"
|
|
5468
5480
|
});
|
|
5469
5481
|
}
|
|
5470
5482
|
}
|
|
@@ -5516,7 +5528,13 @@
|
|
|
5516
5528
|
if (op instanceof HTMLElement) {
|
|
5517
5529
|
return op;
|
|
5518
5530
|
}
|
|
5519
|
-
|
|
5531
|
+
if (op instanceof SVGElement) {
|
|
5532
|
+
return op;
|
|
5533
|
+
}
|
|
5534
|
+
try {
|
|
5535
|
+
return document.querySelector(op);
|
|
5536
|
+
} catch (e) {}
|
|
5537
|
+
return null;
|
|
5520
5538
|
}
|
|
5521
5539
|
/**
|
|
5522
5540
|
* Return the element for a step
|
|
@@ -5534,9 +5552,9 @@
|
|
|
5534
5552
|
}
|
|
5535
5553
|
var type = _typeof$1(attachTo);
|
|
5536
5554
|
var element;
|
|
5537
|
-
if (type ===
|
|
5555
|
+
if (type === "string") {
|
|
5538
5556
|
element = getElementFromString(attachTo);
|
|
5539
|
-
} else if (type ===
|
|
5557
|
+
} else if (type === "object") {
|
|
5540
5558
|
element = getElementFromObject(attachTo);
|
|
5541
5559
|
} else {
|
|
5542
5560
|
/* istanbul ignore next: cannot test undefined attachTo, but it does work! */
|
|
@@ -5554,26 +5572,26 @@
|
|
|
5554
5572
|
*/
|
|
5555
5573
|
|
|
5556
5574
|
function getElementFromString(element) {
|
|
5557
|
-
var _element$split = element.split(
|
|
5575
|
+
var _element$split = element.split(" "),
|
|
5558
5576
|
_element$split2 = _slicedToArray(_element$split, 1),
|
|
5559
5577
|
selector = _element$split2[0];
|
|
5560
5578
|
return document.querySelector(selector);
|
|
5561
5579
|
}
|
|
5562
5580
|
function addStepEventListeners() {
|
|
5563
|
-
if (typeof this._onScreenChange ===
|
|
5564
|
-
window.removeEventListener(
|
|
5565
|
-
window.removeEventListener(
|
|
5581
|
+
if (typeof this._onScreenChange === "function") {
|
|
5582
|
+
window.removeEventListener("resize", this._onScreenChange, false);
|
|
5583
|
+
window.removeEventListener("scroll", this._onScreenChange, true);
|
|
5566
5584
|
}
|
|
5567
|
-
window.addEventListener(
|
|
5568
|
-
window.addEventListener(
|
|
5585
|
+
window.addEventListener("resize", this._onScreenChange, false);
|
|
5586
|
+
window.addEventListener("scroll", this._onScreenChange, true);
|
|
5569
5587
|
var overlay = document.querySelector("#".concat(elementIds.modalOverlay)); // Prevents window from moving on touch.
|
|
5570
5588
|
|
|
5571
|
-
window.addEventListener(
|
|
5589
|
+
window.addEventListener("touchmove", preventModalBodyTouch, {
|
|
5572
5590
|
passive: false
|
|
5573
5591
|
}); // Allows content to move on touch.
|
|
5574
5592
|
|
|
5575
5593
|
if (overlay) {
|
|
5576
|
-
overlay.addEventListener(
|
|
5594
|
+
overlay.addEventListener("touchmove", preventModalOverlayTouch, false);
|
|
5577
5595
|
}
|
|
5578
5596
|
}
|
|
5579
5597
|
var Modal = /*#__PURE__*/
|
|
@@ -5591,12 +5609,14 @@
|
|
|
5591
5609
|
_createClass$1(Modal, [{
|
|
5592
5610
|
key: "cleanup",
|
|
5593
5611
|
value: function cleanup() {
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5612
|
+
try {
|
|
5613
|
+
var element = this._modalOverlayElem;
|
|
5614
|
+
if (element && element instanceof SVGElement) {
|
|
5615
|
+
element.parentNode.removeChild(element);
|
|
5616
|
+
}
|
|
5617
|
+
this._modalOverlayElem = null;
|
|
5618
|
+
document.body.classList.remove(classNames.isVisible);
|
|
5619
|
+
} catch (e) {}
|
|
5600
5620
|
}
|
|
5601
5621
|
/**
|
|
5602
5622
|
* Create the modal overlay, if it does not already exist
|
|
@@ -5605,7 +5625,7 @@
|
|
|
5605
5625
|
key: "createModalOverlay",
|
|
5606
5626
|
value: function createModalOverlay$1() {
|
|
5607
5627
|
if (!this._modalOverlayElem) {
|
|
5608
|
-
var existingModal = document.getElementById(
|
|
5628
|
+
var existingModal = document.getElementById("shepherdModalOverlayContainer");
|
|
5609
5629
|
this._modalOverlayElem = existingModal || createModalOverlay();
|
|
5610
5630
|
this._modalOverlayOpening = getModalMaskOpening(this._modalOverlayElem); // don't show yet -- each step will control that
|
|
5611
5631
|
|
|
@@ -5624,7 +5644,7 @@
|
|
|
5624
5644
|
value: function hide() {
|
|
5625
5645
|
document.body.classList.remove(classNames.isVisible);
|
|
5626
5646
|
if (this._modalOverlayElem) {
|
|
5627
|
-
this._modalOverlayElem.style.display =
|
|
5647
|
+
this._modalOverlayElem.style.display = "none";
|
|
5628
5648
|
}
|
|
5629
5649
|
}
|
|
5630
5650
|
/**
|
|
@@ -5649,7 +5669,7 @@
|
|
|
5649
5669
|
value: function show() {
|
|
5650
5670
|
document.body.classList.add(classNames.isVisible);
|
|
5651
5671
|
if (this._modalOverlayElem) {
|
|
5652
|
-
this._modalOverlayElem.style.display =
|
|
5672
|
+
this._modalOverlayElem.style.display = "block";
|
|
5653
5673
|
}
|
|
5654
5674
|
}
|
|
5655
5675
|
/**
|
|
@@ -5681,17 +5701,17 @@
|
|
|
5681
5701
|
// https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
|
|
5682
5702
|
|
|
5683
5703
|
var hasPassiveEvents = false;
|
|
5684
|
-
if (typeof window !==
|
|
5704
|
+
if (typeof window !== "undefined") {
|
|
5685
5705
|
var passiveTestOptions = {
|
|
5686
5706
|
get passive() {
|
|
5687
5707
|
hasPassiveEvents = true;
|
|
5688
5708
|
return undefined;
|
|
5689
5709
|
}
|
|
5690
5710
|
};
|
|
5691
|
-
window.addEventListener(
|
|
5692
|
-
window.removeEventListener(
|
|
5711
|
+
window.addEventListener("testPassive", null, passiveTestOptions);
|
|
5712
|
+
window.removeEventListener("testPassive", null, passiveTestOptions);
|
|
5693
5713
|
}
|
|
5694
|
-
var isIosDevice = typeof window !==
|
|
5714
|
+
var isIosDevice = typeof window !== "undefined" && window.navigator && window.navigator.platform && /iP(ad|hone|od)/.test(window.navigator.platform);
|
|
5695
5715
|
var locks = [];
|
|
5696
5716
|
var documentListenerAdded = false;
|
|
5697
5717
|
var initialClientY = -1;
|
|
@@ -5740,7 +5760,7 @@
|
|
|
5740
5760
|
// If previousBodyOverflowSetting is already set, don't set it again.
|
|
5741
5761
|
if (previousBodyOverflowSetting === undefined) {
|
|
5742
5762
|
previousBodyOverflowSetting = document.body.style.overflow;
|
|
5743
|
-
document.body.style.overflow =
|
|
5763
|
+
document.body.style.overflow = "hidden";
|
|
5744
5764
|
}
|
|
5745
5765
|
});
|
|
5746
5766
|
};
|
|
@@ -5791,7 +5811,7 @@
|
|
|
5791
5811
|
// called on this targetElement before.
|
|
5792
5812
|
if (!targetElement) {
|
|
5793
5813
|
// eslint-disable-next-line no-console
|
|
5794
|
-
console.error(
|
|
5814
|
+
console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");
|
|
5795
5815
|
return;
|
|
5796
5816
|
}
|
|
5797
5817
|
if (targetElement && !locks.some(function (lock) {
|
|
@@ -5815,7 +5835,7 @@
|
|
|
5815
5835
|
}
|
|
5816
5836
|
};
|
|
5817
5837
|
if (!documentListenerAdded) {
|
|
5818
|
-
document.addEventListener(
|
|
5838
|
+
document.addEventListener("touchmove", preventDefault, hasPassiveEvents ? {
|
|
5819
5839
|
passive: false
|
|
5820
5840
|
} : undefined);
|
|
5821
5841
|
documentListenerAdded = true;
|
|
@@ -5838,7 +5858,7 @@
|
|
|
5838
5858
|
lock.targetElement.ontouchmove = null;
|
|
5839
5859
|
});
|
|
5840
5860
|
if (documentListenerAdded) {
|
|
5841
|
-
document.removeEventListener(
|
|
5861
|
+
document.removeEventListener("touchmove", preventDefault, hasPassiveEvents ? {
|
|
5842
5862
|
passive: false
|
|
5843
5863
|
} : undefined);
|
|
5844
5864
|
documentListenerAdded = false;
|
|
@@ -5853,16 +5873,16 @@
|
|
|
5853
5873
|
}
|
|
5854
5874
|
};
|
|
5855
5875
|
var defaults = {
|
|
5856
|
-
trigger:
|
|
5876
|
+
trigger: "manual",
|
|
5857
5877
|
arrow: true,
|
|
5858
|
-
animation:
|
|
5878
|
+
animation: "fade",
|
|
5859
5879
|
duration: 420,
|
|
5860
5880
|
flip: true,
|
|
5861
5881
|
animateFill: false,
|
|
5862
5882
|
// https://atomiks.github.io/tippyjs/#animate-fill-option
|
|
5863
5883
|
interactive: true,
|
|
5864
5884
|
// https://atomiks.github.io/tippyjs/#interactive-option
|
|
5865
|
-
hideOnClick:
|
|
5885
|
+
hideOnClick: "toggle",
|
|
5866
5886
|
// https://atomiks.github.io/tippyjs/#hide-on-click-option
|
|
5867
5887
|
multiple: true // https://atomiks.github.io/tippyjs/#multiple-option
|
|
5868
5888
|
};
|
|
@@ -5879,7 +5899,7 @@
|
|
|
5879
5899
|
if (step.options && step.options.canClickTarget === false && step.options.attachTo) {
|
|
5880
5900
|
var stepElement = getElementForStep(step);
|
|
5881
5901
|
if (stepElement instanceof HTMLElement) {
|
|
5882
|
-
stepElement.style.pointerEvents =
|
|
5902
|
+
stepElement.style.pointerEvents = "auto";
|
|
5883
5903
|
}
|
|
5884
5904
|
}
|
|
5885
5905
|
});
|
|
@@ -5890,12 +5910,12 @@
|
|
|
5890
5910
|
*/
|
|
5891
5911
|
|
|
5892
5912
|
function cleanupStepEventListeners() {
|
|
5893
|
-
if (typeof this._onScreenChange ===
|
|
5894
|
-
window.removeEventListener(
|
|
5895
|
-
window.removeEventListener(
|
|
5913
|
+
if (typeof this._onScreenChange === "function") {
|
|
5914
|
+
window.removeEventListener("resize", this._onScreenChange, false);
|
|
5915
|
+
window.removeEventListener("scroll", this._onScreenChange, false);
|
|
5896
5916
|
this._onScreenChange = null;
|
|
5897
5917
|
}
|
|
5898
|
-
window.removeEventListener(
|
|
5918
|
+
window.removeEventListener("touchmove", preventModalBodyTouch, {
|
|
5899
5919
|
passive: false
|
|
5900
5920
|
});
|
|
5901
5921
|
}
|
|
@@ -5942,11 +5962,11 @@
|
|
|
5942
5962
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5943
5963
|
_classCallCheck$1(this, Tour);
|
|
5944
5964
|
_this = _possibleConstructorReturn$1(this, _getPrototypeOf$1(Tour).call(this, options));
|
|
5945
|
-
bindMethods.call(_assertThisInitialized$1(_this), [
|
|
5965
|
+
bindMethods.call(_assertThisInitialized$1(_this), ["back", "cancel", "complete", "hide", "next"]);
|
|
5946
5966
|
_this.options = options;
|
|
5947
5967
|
_this.steps = _this.options.steps || []; // Pass these events onto the global Shepherd object
|
|
5948
5968
|
|
|
5949
|
-
var events = [
|
|
5969
|
+
var events = ["active", "cancel", "complete", "inactive", "show", "start"];
|
|
5950
5970
|
events.map(function (event) {
|
|
5951
5971
|
(function (e) {
|
|
5952
5972
|
_this.on(e, function (opts) {
|
|
@@ -6006,13 +6026,13 @@
|
|
|
6006
6026
|
key: "cancel",
|
|
6007
6027
|
value: function cancel() {
|
|
6008
6028
|
if (this.options.confirmCancel) {
|
|
6009
|
-
var cancelMessage = this.options.confirmCancelMessage ||
|
|
6029
|
+
var cancelMessage = this.options.confirmCancelMessage || "Are you sure you want to stop the tour?";
|
|
6010
6030
|
var stopTour = window.confirm(cancelMessage);
|
|
6011
6031
|
if (stopTour) {
|
|
6012
|
-
this.done(
|
|
6032
|
+
this.done("cancel");
|
|
6013
6033
|
}
|
|
6014
6034
|
} else {
|
|
6015
|
-
this.done(
|
|
6035
|
+
this.done("cancel");
|
|
6016
6036
|
}
|
|
6017
6037
|
}
|
|
6018
6038
|
/**
|
|
@@ -6021,7 +6041,7 @@
|
|
|
6021
6041
|
}, {
|
|
6022
6042
|
key: "complete",
|
|
6023
6043
|
value: function complete() {
|
|
6024
|
-
this.done(
|
|
6044
|
+
this.done("complete");
|
|
6025
6045
|
}
|
|
6026
6046
|
/**
|
|
6027
6047
|
* Called whenever the tour is cancelled or completed, basically anytime we exit the tour
|
|
@@ -6040,7 +6060,7 @@
|
|
|
6040
6060
|
this.trigger(event);
|
|
6041
6061
|
Shepherd.activeTour = null;
|
|
6042
6062
|
this._removeBodyAttrs();
|
|
6043
|
-
this.trigger(
|
|
6063
|
+
this.trigger("inactive", {
|
|
6044
6064
|
tour: this
|
|
6045
6065
|
});
|
|
6046
6066
|
if (this.options.disableScroll) {
|
|
@@ -6168,7 +6188,7 @@
|
|
|
6168
6188
|
if (shouldSkipStep) {
|
|
6169
6189
|
this._skipStep(step, forward);
|
|
6170
6190
|
} else {
|
|
6171
|
-
this.trigger(
|
|
6191
|
+
this.trigger("show", {
|
|
6172
6192
|
step: step,
|
|
6173
6193
|
previous: this.currentStep
|
|
6174
6194
|
});
|
|
@@ -6183,7 +6203,7 @@
|
|
|
6183
6203
|
}, {
|
|
6184
6204
|
key: "start",
|
|
6185
6205
|
value: function start() {
|
|
6186
|
-
this.trigger(
|
|
6206
|
+
this.trigger("start");
|
|
6187
6207
|
if (this.options.disableScroll) {
|
|
6188
6208
|
disableBodyScroll();
|
|
6189
6209
|
}
|
|
@@ -6200,7 +6220,7 @@
|
|
|
6200
6220
|
value: function _setupActiveTour() {
|
|
6201
6221
|
this.modal.createModalOverlay();
|
|
6202
6222
|
this._addBodyAttrs();
|
|
6203
|
-
this.trigger(
|
|
6223
|
+
this.trigger("active", {
|
|
6204
6224
|
tour: this
|
|
6205
6225
|
});
|
|
6206
6226
|
Shepherd.activeTour = this;
|
|
@@ -6224,7 +6244,7 @@
|
|
|
6224
6244
|
targetElement.classList.add(step.options.highlightClass);
|
|
6225
6245
|
}
|
|
6226
6246
|
if (step.options.canClickTarget === false) {
|
|
6227
|
-
targetElement.style.pointerEvents =
|
|
6247
|
+
targetElement.style.pointerEvents = "none";
|
|
6228
6248
|
}
|
|
6229
6249
|
}
|
|
6230
6250
|
/**
|
|
@@ -6271,7 +6291,7 @@
|
|
|
6271
6291
|
}, {
|
|
6272
6292
|
key: "_setTourID",
|
|
6273
6293
|
value: function _setTourID() {
|
|
6274
|
-
var tourName = this.options.tourName ||
|
|
6294
|
+
var tourName = this.options.tourName || "tour";
|
|
6275
6295
|
var uuid = uniqueId$1();
|
|
6276
6296
|
this.id = "".concat(tourName, "--").concat(uuid);
|
|
6277
6297
|
}
|
|
@@ -6283,8 +6303,8 @@
|
|
|
6283
6303
|
}, {
|
|
6284
6304
|
key: "_addBodyAttrs",
|
|
6285
6305
|
value: function _addBodyAttrs() {
|
|
6286
|
-
document.body.setAttribute(
|
|
6287
|
-
document.body.classList.add(
|
|
6306
|
+
document.body.setAttribute("data-shepherd-active-tour", this.id);
|
|
6307
|
+
document.body.classList.add("shepherd-active");
|
|
6288
6308
|
}
|
|
6289
6309
|
/**
|
|
6290
6310
|
* Removes the data-shepherd-active-tour attribute and the 'shepherd-active'
|
|
@@ -6294,8 +6314,8 @@
|
|
|
6294
6314
|
}, {
|
|
6295
6315
|
key: "_removeBodyAttrs",
|
|
6296
6316
|
value: function _removeBodyAttrs() {
|
|
6297
|
-
document.body.removeAttribute(
|
|
6298
|
-
document.body.classList.remove(
|
|
6317
|
+
document.body.removeAttribute("data-shepherd-active-tour");
|
|
6318
|
+
document.body.classList.remove("shepherd-active");
|
|
6299
6319
|
}
|
|
6300
6320
|
}]);
|
|
6301
6321
|
return Tour;
|
|
@@ -6362,6 +6382,15 @@
|
|
|
6362
6382
|
var isNull = function isNull(term) {
|
|
6363
6383
|
return term === null;
|
|
6364
6384
|
};
|
|
6385
|
+
|
|
6386
|
+
/**
|
|
6387
|
+
*
|
|
6388
|
+
* @param term
|
|
6389
|
+
* @returns {boolean}
|
|
6390
|
+
*/
|
|
6391
|
+
var isDefined = function isDefined(term) {
|
|
6392
|
+
return typeof term !== "undefined" && !isNull(term);
|
|
6393
|
+
};
|
|
6365
6394
|
var isElementInViewport = function isElementInViewport(el) {
|
|
6366
6395
|
var elementOffsetHight = el.offsetHeight;
|
|
6367
6396
|
var elementOffsetWidth = el.offsetWidth;
|
|
@@ -7053,7 +7082,7 @@
|
|
|
7053
7082
|
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 24;
|
|
7054
7083
|
var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 24;
|
|
7055
7084
|
var color = arguments.length > 2 ? arguments[2] : undefined;
|
|
7056
|
-
var closeSVG = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(width, "\" height=\"").concat(height, "\" fill=").concat(color, " class=\"bi bi-x\" viewBox=\"0 0
|
|
7085
|
+
var closeSVG = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"".concat(width, "\" height=\"").concat(height, "\" fill=").concat(color, " class=\"bi bi-x\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path>\n </svg>");
|
|
7057
7086
|
return closeSVG;
|
|
7058
7087
|
};
|
|
7059
7088
|
|
|
@@ -7152,6 +7181,242 @@
|
|
|
7152
7181
|
if (position === "left") return 1;else if (position === "center") return 3;else return 5;
|
|
7153
7182
|
};
|
|
7154
7183
|
|
|
7184
|
+
/**
|
|
7185
|
+
* @function getElementFromSelector
|
|
7186
|
+
* @description Finds the element in DOM for a given selector. Selector can be an ID, or any css selector. It can also be an XPath.
|
|
7187
|
+
* @param {string} selector
|
|
7188
|
+
* @returns {HTMLElement} Returns the HTML element that matches the given selector
|
|
7189
|
+
*/
|
|
7190
|
+
var getElementFromSelector = function getElementFromSelector(selector) {
|
|
7191
|
+
var iframe_id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
7192
|
+
// Given selector can be an ID.
|
|
7193
|
+
var element = document.getElementById(selector);
|
|
7194
|
+
if (!element) {
|
|
7195
|
+
try {
|
|
7196
|
+
element = document.querySelector(selector);
|
|
7197
|
+
} catch (e) {
|
|
7198
|
+
//If there is an exception, it means it is not a valid selector.
|
|
7199
|
+
window.ApxorLogger.error("Error finding element in DOM:" + e);
|
|
7200
|
+
}
|
|
7201
|
+
}
|
|
7202
|
+
// If no element is found till now, it means it is neither an ID nor a valid css selector. It could be an XPath.
|
|
7203
|
+
if (!element) {
|
|
7204
|
+
element = getElementByXPath(selector);
|
|
7205
|
+
}
|
|
7206
|
+
|
|
7207
|
+
// If no element is found, it means the selector is not an ID. It could be a css selector
|
|
7208
|
+
if (!element && iframe_id.length > 0) {
|
|
7209
|
+
var _document$getElementB, _document$getElementB2, _document$getElementB3;
|
|
7210
|
+
element = (_document$getElementB = document.getElementById(iframe_id)) === null || _document$getElementB === void 0 ? void 0 : (_document$getElementB2 = _document$getElementB.contentWindow) === null || _document$getElementB2 === void 0 ? void 0 : (_document$getElementB3 = _document$getElementB2.document) === null || _document$getElementB3 === void 0 ? void 0 : _document$getElementB3.querySelector(selector);
|
|
7211
|
+
}
|
|
7212
|
+
return element;
|
|
7213
|
+
};
|
|
7214
|
+
var getElementByXPath = function getElementByXPath(path) {
|
|
7215
|
+
var index = path.indexOf("svg");
|
|
7216
|
+
if (index !== -1) {
|
|
7217
|
+
path = path.substring(0, index) + "svg:svg";
|
|
7218
|
+
}
|
|
7219
|
+
try {
|
|
7220
|
+
return document.evaluate(path, document, function (prefix) {
|
|
7221
|
+
if (prefix === "svg") {
|
|
7222
|
+
return "http://www.w3.org/2000/svg";
|
|
7223
|
+
} else {
|
|
7224
|
+
return null;
|
|
7225
|
+
}
|
|
7226
|
+
}, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
7227
|
+
} catch (e) {
|
|
7228
|
+
window.ApxorLogger.error("Error finding element in DOM:" + e);
|
|
7229
|
+
}
|
|
7230
|
+
return null;
|
|
7231
|
+
};
|
|
7232
|
+
var generateButtons = function generateButtons() {
|
|
7233
|
+
var buttons_config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
7234
|
+
var ActionHandler = arguments.length > 1 ? arguments[1] : undefined;
|
|
7235
|
+
var uuid = arguments.length > 2 ? arguments[2] : undefined;
|
|
7236
|
+
var name = arguments.length > 3 ? arguments[3] : undefined;
|
|
7237
|
+
var configType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "Inline_";
|
|
7238
|
+
var rtmInstance = window.ApxorRTM;
|
|
7239
|
+
var buttons_array = [];
|
|
7240
|
+
var buttons_css = [];
|
|
7241
|
+
buttons_config.forEach(function (button_config, index) {
|
|
7242
|
+
var _button_config$action, _button_config$action2, _button_config$action3, _button_config$action4, _button_config$action5, _button_config$action6, _button_config$action7, _button_config$action8, _button_config$action9, _button_config$action10, _button_config$action11, _button_config$action12;
|
|
7243
|
+
var _action = (_button_config$action = button_config === null || button_config === void 0 ? void 0 : (_button_config$action2 = button_config.action_config) === null || _button_config$action2 === void 0 ? void 0 : _button_config$action2.action) !== null && _button_config$action !== void 0 ? _button_config$action : "end";
|
|
7244
|
+
var vMap = (_button_config$action3 = button_config === null || button_config === void 0 ? void 0 : (_button_config$action4 = button_config.action_config) === null || _button_config$action4 === void 0 ? void 0 : _button_config$action4.vmap) !== null && _button_config$action3 !== void 0 ? _button_config$action3 : {};
|
|
7245
|
+
var url = (_button_config$action5 = button_config === null || button_config === void 0 ? void 0 : (_button_config$action6 = button_config.action_config) === null || _button_config$action6 === void 0 ? void 0 : _button_config$action6.url) !== null && _button_config$action5 !== void 0 ? _button_config$action5 : "";
|
|
7246
|
+
var isExternal = (_button_config$action7 = button_config === null || button_config === void 0 ? void 0 : (_button_config$action8 = button_config.action_config) === null || _button_config$action8 === void 0 ? void 0 : _button_config$action8.is_external) !== null && _button_config$action7 !== void 0 ? _button_config$action7 : true;
|
|
7247
|
+
var redirectWithin = (_button_config$action9 = button_config === null || button_config === void 0 ? void 0 : (_button_config$action10 = button_config.action_config) === null || _button_config$action10 === void 0 ? void 0 : _button_config$action10.is_within) !== null && _button_config$action9 !== void 0 ? _button_config$action9 : false;
|
|
7248
|
+
var callbackFunction = (_button_config$action11 = button_config === null || button_config === void 0 ? void 0 : (_button_config$action12 = button_config.action_config) === null || _button_config$action12 === void 0 ? void 0 : _button_config$action12.callback_func) !== null && _button_config$action11 !== void 0 ? _button_config$action11 : "";
|
|
7249
|
+
var action_config_str = JSON.stringify(button_config === null || button_config === void 0 ? void 0 : button_config.action_config);
|
|
7250
|
+
_action = _action.toLowerCase();
|
|
7251
|
+
var borders = button_config.borders,
|
|
7252
|
+
color = button_config.color,
|
|
7253
|
+
_button_config$text_c = button_config.text_config,
|
|
7254
|
+
text = _button_config$text_c.text,
|
|
7255
|
+
text_color = _button_config$text_c.color,
|
|
7256
|
+
size = _button_config$text_c.size,
|
|
7257
|
+
style = _button_config$text_c.style,
|
|
7258
|
+
font_family = _button_config$text_c.font_family,
|
|
7259
|
+
_button_config$gradie2 = button_config.gradient_config,
|
|
7260
|
+
gradient_config = _button_config$gradie2 === void 0 ? {} : _button_config$gradie2;
|
|
7261
|
+
var action;
|
|
7262
|
+
try {
|
|
7263
|
+
switch (_action) {
|
|
7264
|
+
case "done":
|
|
7265
|
+
case "dismiss":
|
|
7266
|
+
action = function action() {
|
|
7267
|
+
ActionHandler.complete();
|
|
7268
|
+
};
|
|
7269
|
+
break;
|
|
7270
|
+
case "next":
|
|
7271
|
+
action = function action() {
|
|
7272
|
+
ActionHandler.next();
|
|
7273
|
+
window.Apxor.logActionEvent(configType + text + "_Clicked", uuid, name);
|
|
7274
|
+
};
|
|
7275
|
+
break;
|
|
7276
|
+
case "prev":
|
|
7277
|
+
action = function action() {
|
|
7278
|
+
ActionHandler.prev();
|
|
7279
|
+
window.Apxor.logActionEvent(configType + text + "_Clicked", uuid, name);
|
|
7280
|
+
};
|
|
7281
|
+
break;
|
|
7282
|
+
case "redirect":
|
|
7283
|
+
action = function action() {
|
|
7284
|
+
ActionHandler.complete();
|
|
7285
|
+
window.Apxor.redirectTo(uuid, name, text, action_config_str);
|
|
7286
|
+
};
|
|
7287
|
+
break;
|
|
7288
|
+
case "cancel":
|
|
7289
|
+
action = function action() {
|
|
7290
|
+
ActionHandler.cancel();
|
|
7291
|
+
};
|
|
7292
|
+
break;
|
|
7293
|
+
default:
|
|
7294
|
+
action = function action() {
|
|
7295
|
+
ActionHandler.cancel();
|
|
7296
|
+
window.Apxor.logActionEvent(configType + text + "_Clicked", uuid, name);
|
|
7297
|
+
};
|
|
7298
|
+
}
|
|
7299
|
+
} catch (e) {
|
|
7300
|
+
window.ApxorLogger.error("Error setting actions on the buttons:" + e);
|
|
7301
|
+
}
|
|
7302
|
+
buttons_css.push({
|
|
7303
|
+
borders: borders,
|
|
7304
|
+
bg_color: color,
|
|
7305
|
+
text_color: text_color,
|
|
7306
|
+
size: size,
|
|
7307
|
+
style: style,
|
|
7308
|
+
font_family: font_family,
|
|
7309
|
+
gradient_config: gradient_config
|
|
7310
|
+
});
|
|
7311
|
+
buttons_array.push({
|
|
7312
|
+
classes: index === 0 ? "button-o" : "button-t",
|
|
7313
|
+
text: text,
|
|
7314
|
+
action: action
|
|
7315
|
+
});
|
|
7316
|
+
});
|
|
7317
|
+
return {
|
|
7318
|
+
buttons_array: buttons_array,
|
|
7319
|
+
buttons_css: buttons_css
|
|
7320
|
+
};
|
|
7321
|
+
};
|
|
7322
|
+
var getButtonPosition = function getButtonPosition(position) {
|
|
7323
|
+
switch (position) {
|
|
7324
|
+
case "center":
|
|
7325
|
+
return "center";
|
|
7326
|
+
case "left":
|
|
7327
|
+
return "flex-start";
|
|
7328
|
+
case "right":
|
|
7329
|
+
return "flex-end";
|
|
7330
|
+
case "ends":
|
|
7331
|
+
return "space-between";
|
|
7332
|
+
default:
|
|
7333
|
+
return "flex-end";
|
|
7334
|
+
}
|
|
7335
|
+
};
|
|
7336
|
+
var getButtonsCSS = function getButtonsCSS(buttons_css) {
|
|
7337
|
+
var button_position = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "right";
|
|
7338
|
+
var button_direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DIRECTION.HORIZONTAL;
|
|
7339
|
+
var prefix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
|
|
7340
|
+
var buttons = "";
|
|
7341
|
+
if (buttons_css.length > 0) {
|
|
7342
|
+
var _buttons_css$ = buttons_css[0],
|
|
7343
|
+
bg_color = _buttons_css$.bg_color,
|
|
7344
|
+
text_color = _buttons_css$.text_color,
|
|
7345
|
+
size = _buttons_css$.size,
|
|
7346
|
+
font_family = _buttons_css$.font_family,
|
|
7347
|
+
_buttons_css$$borders = _buttons_css$.borders,
|
|
7348
|
+
stroke_color = _buttons_css$$borders.stroke_color,
|
|
7349
|
+
radius = _buttons_css$$borders.radius,
|
|
7350
|
+
enable_gradient = _buttons_css$.enable_gradient,
|
|
7351
|
+
_buttons_css$$gradien = _buttons_css$.gradient,
|
|
7352
|
+
gradient = _buttons_css$$gradien === void 0 ? {} : _buttons_css$$gradien;
|
|
7353
|
+
var gradient_direction, gradient_c1, gradient_c2;
|
|
7354
|
+
if (enable_gradient) {
|
|
7355
|
+
gradient_direction = gradient.gradient_direction || "to right";
|
|
7356
|
+
gradient_c1 = gradient.gradient_c1 || COLORS.BLACK;
|
|
7357
|
+
gradient_c2 = gradient.gradient_c2 || COLORS.WHITE;
|
|
7358
|
+
}
|
|
7359
|
+
buttons = "\n ".concat(prefix, " footer .shepherd-button.button-o {\n cursor: pointer;\n background-color: ").concat(bg_color === "#" ? "transparent" : bg_color, ";\n color: ").concat(text_color, ";font-size: ").concat(size, "px;font-family: ").concat(font_family, ";\n font-weight: ").concat(font_family !== "bold" ? "normal" : font_family, ";\n font-style: ").concat(font_family === "italic" ? "italic" : "unset", ";\n border: 0px solid ").concat(stroke_color, ";border-radius: ").concat(radius, "px;\n ").concat(enable_gradient ? "background-image:linear-gradient(".concat(gradient_direction, ", ").concat(gradient_c1, ", ").concat(gradient_c2, ");") : "", "\n margin-right:").concat(bg_color === "#" ? 0 : "12px", "\n }\n ");
|
|
7360
|
+
}
|
|
7361
|
+
if (buttons_css.length > 1) {
|
|
7362
|
+
var _buttons_css$2 = buttons_css[1],
|
|
7363
|
+
_bg_color = _buttons_css$2.bg_color,
|
|
7364
|
+
_text_color = _buttons_css$2.text_color,
|
|
7365
|
+
_size = _buttons_css$2.size,
|
|
7366
|
+
_font_family = _buttons_css$2.font_family,
|
|
7367
|
+
_buttons_css$2$border = _buttons_css$2.borders,
|
|
7368
|
+
_stroke_color = _buttons_css$2$border.stroke_color,
|
|
7369
|
+
_radius = _buttons_css$2$border.radius,
|
|
7370
|
+
_buttons_css$2$gradie = _buttons_css$2.gradient_config,
|
|
7371
|
+
gradient_config = _buttons_css$2$gradie === void 0 ? {} : _buttons_css$2$gradie;
|
|
7372
|
+
var _gradient_direction, _gradient_c, _gradient_c2;
|
|
7373
|
+
var _enable_gradient = gradient_config.enable_gradient || false;
|
|
7374
|
+
if (_enable_gradient) {
|
|
7375
|
+
_gradient_direction = gradient_config.gradient_direction || "to right";
|
|
7376
|
+
_gradient_c = (gradient_config === null || gradient_config === void 0 ? void 0 : gradient_config.colors[0]) || COLORS.BLACK;
|
|
7377
|
+
_gradient_c2 = (gradient_config === null || gradient_config === void 0 ? void 0 : gradient_config.colors[1]) || COLORS.WHITE;
|
|
7378
|
+
}
|
|
7379
|
+
buttons += "\n ".concat(prefix, " footer .shepherd-button.button-t {\n cursor: pointer;\n background-color: ").concat(_bg_color === "#" ? "transparent" : _bg_color, ";\n color: ").concat(_text_color, ";font-size: ").concat(_size, "px;font-family: ").concat(_font_family, ";\n font-weight: ").concat(_font_family !== "bold" ? "normal" : _font_family, ";\n font-style: ").concat(_font_family === "italic" ? "italic" : "unset", ";\n ").concat(_enable_gradient ? "background-image:linear-gradient(".concat(_gradient_direction, ", ").concat(_gradient_c, ", ").concat(_gradient_c2, ");") : "", "\n border: 0px solid ").concat(_stroke_color, ";border-radius: ").concat(_radius, "px;\n }\n ");
|
|
7380
|
+
}
|
|
7381
|
+
return "\n ".concat(prefix, " footer .shepherd-button {\n display: inline-block;\n *display: inline;\n vertical-align: middle;\n *vertical-align: auto;\n *zoom: 1;\n border: 0;border-radius: 3px;cursor: pointer;display: inline;font-family: inherit;\n font-size: .8em;letter-spacing: .01em;line-height: 18px;margin-right: 12px;\n padding: 8px 16px;text-transform: none;transition: all .5s ease\n }\n ").concat(buttons, "\n ").concat(prefix, " footer .shepherd-button:last-child {\n }\n\n ").concat(prefix, " footer {\n border-bottom-left-radius: 5px;\n border-bottom-right-radius: 5px;\n display: flex;\n flex-direction:").concat(button_direction === DIRECTION.HORIZONTAL ? "row" : "column", ";\n\n align-items:center;\n justify-content: ").concat(button_direction === DIRECTION.HORIZONTAL ? getButtonPosition(button_position) : "space-evenly", ";\n padding: 0 .8em .8em;\n }\n ");
|
|
7382
|
+
};
|
|
7383
|
+
|
|
7384
|
+
/**
|
|
7385
|
+
* @function createTextElement
|
|
7386
|
+
* @description Creates a text element for the given text config. It could either be a title or a description.
|
|
7387
|
+
* @param {object} config
|
|
7388
|
+
* @param {string} currentId
|
|
7389
|
+
* @param {string} type - Title or Description type
|
|
7390
|
+
* @returns
|
|
7391
|
+
*/
|
|
7392
|
+
var createTextElement = function createTextElement(_ref2, currentId) {
|
|
7393
|
+
var _ref2$color = _ref2.color,
|
|
7394
|
+
color = _ref2$color === void 0 ? "#000" : _ref2$color,
|
|
7395
|
+
_ref2$font_family = _ref2.font_family,
|
|
7396
|
+
font_family = _ref2$font_family === void 0 ? "cursive" : _ref2$font_family,
|
|
7397
|
+
_ref2$size = _ref2.size,
|
|
7398
|
+
size = _ref2$size === void 0 ? 14 : _ref2$size,
|
|
7399
|
+
_ref2$style = _ref2.style,
|
|
7400
|
+
style = _ref2$style === void 0 ? "bold" : _ref2$style,
|
|
7401
|
+
text = _ref2.text,
|
|
7402
|
+
segments = _ref2.segments,
|
|
7403
|
+
quote = _ref2.quote,
|
|
7404
|
+
_ref2$link_config = _ref2.link_config,
|
|
7405
|
+
link_config = _ref2$link_config === void 0 ? [] : _ref2$link_config;
|
|
7406
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "desc";
|
|
7407
|
+
var fontMultiplier = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
7408
|
+
size = size * fontMultiplier;
|
|
7409
|
+
var element = document.createElement("span");
|
|
7410
|
+
element.setAttribute("id", currentId + "-" + type);
|
|
7411
|
+
element.className = "apx-class-".concat(currentId, "-").concat(type);
|
|
7412
|
+
var styleTag = document.createElement("style");
|
|
7413
|
+
styleTag.innerHTML = "\n .apx-class-".concat(currentId, "-").concat(type, " {\n z-index:99999;\n color:").concat(color, " !important;\n font-family:").concat(font_family, " !important;\n font-size:").concat(size, "px !important;\n font-weight:").concat(style, " !important;\n font-style:").concat(style === "normal" || style === "italic" ? style + " !important" : "unset", ";\n max-width:400px;\n }\n ");
|
|
7414
|
+
element.appendChild(styleTag);
|
|
7415
|
+
// If there are any styles to the text through inline edits, apply them.
|
|
7416
|
+
element.appendChild(getStylisedText(text, segments, quote, link_config));
|
|
7417
|
+
return element;
|
|
7418
|
+
};
|
|
7419
|
+
|
|
7155
7420
|
/* eslint-disable no-unused-vars */
|
|
7156
7421
|
var ApxorWalkthroughTour;
|
|
7157
7422
|
var onClickCallback = function onClickCallback(configId, configName) {
|
|
@@ -7232,13 +7497,21 @@
|
|
|
7232
7497
|
action = ApxorWalkthroughTour.complete;
|
|
7233
7498
|
break;
|
|
7234
7499
|
case "next":
|
|
7235
|
-
action =
|
|
7500
|
+
action = function action() {
|
|
7501
|
+
ApxorWalkthroughTour.complete();
|
|
7502
|
+
window.Apxor.logActionEvent("inline_".concat(button_text, "_Clicked"), configId, configName);
|
|
7503
|
+
};
|
|
7504
|
+
break;
|
|
7505
|
+
case "prev":
|
|
7506
|
+
action = function action() {
|
|
7507
|
+
ApxorWalkthroughTour.complete();
|
|
7508
|
+
window.Apxor.logActionEvent("inline_".concat(button_text, "_Clicked"), configId, configName);
|
|
7509
|
+
};
|
|
7236
7510
|
break;
|
|
7237
7511
|
case "redirect":
|
|
7238
7512
|
action = function action() {
|
|
7513
|
+
ApxorWalkthroughTour.complete();
|
|
7239
7514
|
window.Apxor.redirectTo(configId, configName, button_text, action_config_str);
|
|
7240
|
-
//window.Apxor.logActionEvent("redirection", configId, configName, url);
|
|
7241
|
-
ApxorWalkthroughTour.cancel();
|
|
7242
7515
|
};
|
|
7243
7516
|
break;
|
|
7244
7517
|
default:
|
|
@@ -7344,7 +7617,7 @@
|
|
|
7344
7617
|
return dummySpan;
|
|
7345
7618
|
}
|
|
7346
7619
|
var styleSpan = applyCSS();
|
|
7347
|
-
var targetElement = document.getElementById(view_id);
|
|
7620
|
+
var targetElement = getElementFromSelector(view_id); //document.getElementById(view_id);
|
|
7348
7621
|
var styleDiv = document.getElementById("apxor-".concat(configId, "-step-").concat(index));
|
|
7349
7622
|
var clickListener = function clickListener(e) {
|
|
7350
7623
|
onClickCallback(configId, configName, false, dismiss_target_touch);
|
|
@@ -7363,10 +7636,10 @@
|
|
|
7363
7636
|
(_document$getElementB = document.getElementById("shepherdModalOverlayContainer")) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
|
|
7364
7637
|
styleSpan === null || styleSpan === void 0 ? void 0 : (_styleSpan$parentNode = styleSpan.parentNode) === null || _styleSpan$parentNode === void 0 ? void 0 : _styleSpan$parentNode.removeChild(styleSpan);
|
|
7365
7638
|
styleDiv === null || styleDiv === void 0 ? void 0 : (_styleDiv$parentNode = styleDiv.parentNode) === null || _styleDiv$parentNode === void 0 ? void 0 : _styleDiv$parentNode.removeChild(styleDiv);
|
|
7639
|
+
(_window = window) === null || _window === void 0 ? void 0 : (_window$Apxor = _window.Apxor) === null || _window$Apxor === void 0 ? void 0 : _window$Apxor.updateFlag(false);
|
|
7366
7640
|
window.Apxor.logActionEvent("inline_dismissed", configId, configName);
|
|
7367
7641
|
rtmInstance.isShowingAction = false;
|
|
7368
7642
|
targetElement.removeEventListener("click", clickListener);
|
|
7369
|
-
(_window = window) === null || _window === void 0 ? void 0 : (_window$Apxor = _window.Apxor) === null || _window$Apxor === void 0 ? void 0 : _window$Apxor.updateFlag(false);
|
|
7370
7643
|
};
|
|
7371
7644
|
var scrolledToView = false;
|
|
7372
7645
|
|
|
@@ -7416,7 +7689,8 @@
|
|
|
7416
7689
|
hideOnClick: dismiss_outside_touch,
|
|
7417
7690
|
theme: "apxor-".concat(configId, "-step-").concat(index),
|
|
7418
7691
|
onShow: function onShow() {
|
|
7419
|
-
|
|
7692
|
+
var _window2, _window2$Apxor;
|
|
7693
|
+
(_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Apxor = _window2.Apxor) === null || _window2$Apxor === void 0 ? void 0 : _window2$Apxor.updateFlag(true);
|
|
7420
7694
|
window.Apxor.logActionEvent("inline_shown", configId, configName);
|
|
7421
7695
|
window.Apxor.updateCount(configId);
|
|
7422
7696
|
rtmInstance.isShowingAction = true;
|
|
@@ -7538,138 +7812,107 @@
|
|
|
7538
7812
|
|
|
7539
7813
|
var DEFAULT_PADDING = 5;
|
|
7540
7814
|
var fontMultiplier = 1;
|
|
7541
|
-
|
|
7542
|
-
var result = "";
|
|
7543
|
-
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
7544
|
-
var charactersLength = characters.length;
|
|
7545
|
-
for (var i = 0; i < length; i++) {
|
|
7546
|
-
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
7547
|
-
}
|
|
7548
|
-
return result;
|
|
7549
|
-
}
|
|
7550
|
-
var currentId = makeid$1(10);
|
|
7815
|
+
var currentId = makeid(10);
|
|
7551
7816
|
function getDocumentOffsetPosition(el) {
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
//
|
|
7555
|
-
//
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
var element = document.createElement("span");
|
|
7579
|
-
element.setAttribute("id", currentId + "-" + key);
|
|
7580
|
-
element.className = "apx-class-".concat(currentId, "-").concat(key);
|
|
7581
|
-
// if (style === "normal" || style === "italic") {
|
|
7582
|
-
// element.style.fontStyle = style;
|
|
7583
|
-
// }
|
|
7584
|
-
// element.style.zIndex = 99999;
|
|
7585
|
-
// element.style.textAlign = "initial";
|
|
7586
|
-
// element.style.color = color;
|
|
7587
|
-
// element.style.fontFamily = font_family;
|
|
7588
|
-
// element.style.fontSize = size + "px";
|
|
7589
|
-
// element.style.fontWeight = style;
|
|
7590
|
-
|
|
7591
|
-
var styleTag = document.createElement("style");
|
|
7592
|
-
styleTag.innerHTML = "\n .apx-class-".concat(currentId, "-").concat(key, " {\n z-index: 99999; \n text-align: initial; \n color: ").concat(color, " !important; \n font-family: ").concat(font_family, " !important; \n font-size: ").concat(size, "px !important; \n font-weight: ").concat(style, " !important;\n font-style: ").concat(style === "normal" || style === "italic" ? style + " !important" : "unset", ";\n }\n ");
|
|
7593
|
-
console.log(element, element.style, color, font_family, size, style);
|
|
7594
|
-
if (Object.keys(margin).length > 0) {
|
|
7595
|
-
element.style.margin = "".concat(margin.top, "px ").concat(margin.right, "px ").concat(margin.bottom, "px ").concat(margin.left, "px");
|
|
7596
|
-
}
|
|
7597
|
-
element.appendChild(styleTag);
|
|
7598
|
-
element.innerHTML = element.innerHTML + text;
|
|
7599
|
-
return element;
|
|
7600
|
-
}
|
|
7601
|
-
|
|
7602
|
-
/**
|
|
7603
|
-
* @function createButtons
|
|
7604
|
-
* @private
|
|
7605
|
-
* @description Creates a button and apply actions,styles to button and styles to text inside the button
|
|
7606
|
-
* @returns {object} a button element
|
|
7607
|
-
*/
|
|
7608
|
-
|
|
7609
|
-
function createButtons(button, index) {
|
|
7610
|
-
var button_classes = button.button_classes,
|
|
7611
|
-
text = button.text,
|
|
7612
|
-
action = button.action,
|
|
7613
|
-
button_css = button.button_css;
|
|
7614
|
-
var element = document.createElement("button");
|
|
7615
|
-
element.setAttribute("id", currentId + "-" + index);
|
|
7616
|
-
element.className = "apx-".concat(button_classes, "-").concat(currentId, "-").concat(index);
|
|
7617
|
-
element.onclick = function () {
|
|
7618
|
-
return action();
|
|
7817
|
+
var rect = el.getBoundingClientRect();
|
|
7818
|
+
|
|
7819
|
+
// Add window scroll position to get the offset position
|
|
7820
|
+
// relative to the document but not viewport.
|
|
7821
|
+
var left = rect.left + window.scrollX;
|
|
7822
|
+
var top = rect.top + window.scrollY;
|
|
7823
|
+
var right = rect.right + window.scrollX;
|
|
7824
|
+
var bottom = rect.bottom + window.scrollY;
|
|
7825
|
+
|
|
7826
|
+
// polyfill missing 'x' and 'y' rect properties not returned
|
|
7827
|
+
// from getBoundingClientRect() by older browsers
|
|
7828
|
+
var x = isDefined(rect.x) ? rect.x + window.scrollX : left;
|
|
7829
|
+
var y = isDefined(rect.y) ? rect.y + window.scrollY : top;
|
|
7830
|
+
|
|
7831
|
+
// width and height are the same
|
|
7832
|
+
var width = rect.width;
|
|
7833
|
+
var height = rect.height;
|
|
7834
|
+
return {
|
|
7835
|
+
left: left,
|
|
7836
|
+
top: top,
|
|
7837
|
+
right: right,
|
|
7838
|
+
bottom: bottom,
|
|
7839
|
+
x: x,
|
|
7840
|
+
y: y,
|
|
7841
|
+
width: width,
|
|
7842
|
+
height: height
|
|
7619
7843
|
};
|
|
7620
|
-
var elementStyleTag = document.createElement("style");
|
|
7621
|
-
elementStyleTag.innerHTML = "\n .apx-".concat(button_classes, "-").concat(currentId, "-").concat(index, " {\n background-color: ").concat(button_css.color, ";\n border-radius: ").concat(button_css.borders.radius, "px;\n margin: ").concat(button_css.margin.top, "px ").concat(button_css.margin.right, "px ").concat(button_css.margin.bottom, "px ").concat(button_css.margin.left, "px;\n padding: ").concat(button_css.padding.top, "px ").concat(button_css.padding.right, "px ").concat(button_css.padding.bottom, "px ").concat(button_css.padding.left, "px;\n visibility: ").concat(button_css.visibility, ";\n }\n ");
|
|
7622
|
-
element.appendChild(elementStyleTag);
|
|
7623
|
-
var textElement = document.createElement("div");
|
|
7624
|
-
textElement.setAttribute("id", currentId + "- text -" + index);
|
|
7625
|
-
textElement.className = "apx-text-".concat(button_classes, "-").concat(currentId, "-").concat(index);
|
|
7626
|
-
var textElementStyleTag = document.createElement("style");
|
|
7627
|
-
textElementStyleTag.innerHTML = "\n .apx-text-".concat(button_classes, "-").concat(currentId, "-").concat(index, " {\n color:").concat(button_css.text_config.color, ";\n padding:").concat(button_css.text_config.padding_config.top, "px ").concat(button_css.text_config.padding_config.right, "px ").concat(button_css.text_config.padding_config.bottom, "px ").concat(button_css.text_config.padding_config.left, "px;\n margin:").concat(button_css.text_config.margin_config.top, "px ").concat(button_css.text_config.margin_config.right, "px ").concat(button_css.text_config.margin_config.bottom, "px ").concat(button_css.text_config.margin_config.left, "px;\n font-family:").concat(button_css.text_config.font_family, ";\n size:").concat(button_css.text_config.size, ";\n style=").concat(button_css.text_config.style, "; \n }\n ");
|
|
7628
|
-
textElement.appendChild(textElementStyleTag);
|
|
7629
|
-
textElement.innerHTML = textElement.innerHTML + text;
|
|
7630
|
-
element.appendChild(textElement);
|
|
7631
|
-
return element;
|
|
7632
7844
|
}
|
|
7633
|
-
function
|
|
7845
|
+
function createTitleDescriptionButtons(text_config) {
|
|
7634
7846
|
var title_config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
7635
|
-
var
|
|
7847
|
+
var buttons_config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
7848
|
+
var button_position = arguments.length > 3 ? arguments[3] : undefined;
|
|
7849
|
+
var button_direction = arguments.length > 4 ? arguments[4] : undefined;
|
|
7850
|
+
var uuid = arguments.length > 5 ? arguments[5] : undefined;
|
|
7851
|
+
var name = arguments.length > 6 ? arguments[6] : undefined;
|
|
7852
|
+
var on_dismiss = arguments.length > 7 ? arguments[7] : undefined;
|
|
7636
7853
|
var element = null;
|
|
7637
|
-
var parent_element = document.createElement("div");
|
|
7638
7854
|
if (!title_config && text_config) {
|
|
7639
|
-
element = createTextElement(text_config);
|
|
7855
|
+
element = createTextElement(text_config, currentId, "title", fontMultiplier);
|
|
7856
|
+
/*element = document.createElement("div");
|
|
7857
|
+
element.style.textAlign = text_config?.alignment || "center";
|
|
7858
|
+
element.appendChild(createTextElement(text_config, currentId));*/
|
|
7640
7859
|
} else if (title_config && text_config) {
|
|
7641
7860
|
element = document.createElement("div");
|
|
7642
7861
|
element.style.display = "inline-flex";
|
|
7643
7862
|
element.style.flexDirection = "column";
|
|
7644
|
-
element.style.visibility = "
|
|
7645
|
-
element.style.textAlign = "center";
|
|
7646
|
-
element.style.
|
|
7647
|
-
element.
|
|
7648
|
-
element.appendChild(createTextElement(
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7863
|
+
element.style.visibility = "hidden";
|
|
7864
|
+
element.style.textAlign = (text_config === null || text_config === void 0 ? void 0 : text_config.alignment) || "center";
|
|
7865
|
+
element.style.lineHeight = "26px";
|
|
7866
|
+
element.style.letterSpacing = "0.01em";
|
|
7867
|
+
element.appendChild(createTextElement(title_config, currentId, "title", fontMultiplier));
|
|
7868
|
+
element.appendChild(createTextElement(text_config, currentId, "desc", fontMultiplier));
|
|
7869
|
+
}
|
|
7870
|
+
if (buttons_config && buttons_config.length > 0) {
|
|
7871
|
+
var buttons = document.createElement("footer");
|
|
7872
|
+
buttons.className = "shepherd-footer";
|
|
7873
|
+
buttons.style.zIndex = 99999;
|
|
7874
|
+
buttons.style.margin = "8px";
|
|
7875
|
+
buttons.style.padding = "0";
|
|
7876
|
+
var hideCallback = function hideCallback() {
|
|
7877
|
+
if (on_dismiss) on_dismiss();
|
|
7878
|
+
};
|
|
7879
|
+
var _generateButtons = generateButtons(buttons_config, {
|
|
7880
|
+
prev: hideCallback,
|
|
7881
|
+
next: hideCallback,
|
|
7882
|
+
complete: hideCallback,
|
|
7883
|
+
cancel: hideCallback
|
|
7884
|
+
}, uuid, name),
|
|
7885
|
+
buttons_array = _generateButtons.buttons_array,
|
|
7886
|
+
buttons_css = _generateButtons.buttons_css;
|
|
7887
|
+
var buttonsStyle = document.createElement("style");
|
|
7888
|
+
buttonsStyle.innerHTML = getButtonsCSS(buttons_css, button_position, button_direction);
|
|
7889
|
+
buttons.appendChild(buttonsStyle);
|
|
7890
|
+
buttons_array.forEach(function (button_data) {
|
|
7891
|
+
var classes = button_data.classes,
|
|
7892
|
+
text = button_data.text,
|
|
7893
|
+
action = button_data.action;
|
|
7894
|
+
var newButton = document.createElement("button");
|
|
7895
|
+
newButton.className = "shepherd-button " + classes;
|
|
7896
|
+
newButton.innerHTML = text;
|
|
7897
|
+
newButton.onclick = function () {
|
|
7898
|
+
return action();
|
|
7899
|
+
};
|
|
7900
|
+
buttons.appendChild(newButton);
|
|
7660
7901
|
});
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7902
|
+
var template = document.createElement("div");
|
|
7903
|
+
template.style.display = "inline-flex";
|
|
7904
|
+
template.style.flexDirection = "column";
|
|
7905
|
+
template.style.visibility = "hidden";
|
|
7906
|
+
template.appendChild(element);
|
|
7907
|
+
template.appendChild(buttons);
|
|
7908
|
+
element = template;
|
|
7664
7909
|
}
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
document.body.appendChild(parent_element);
|
|
7669
|
-
return parent_element;
|
|
7910
|
+
element.style.position = "absolute";
|
|
7911
|
+
document.body.appendChild(element);
|
|
7912
|
+
return element;
|
|
7670
7913
|
}
|
|
7671
7914
|
function addRippleStyles(type, width, height) {
|
|
7672
|
-
return "\n
|
|
7915
|
+
return "\n<style>\n.ripple-animator {\n position: relative;\n display: -webkit-box;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n flex-direction: row;\n -webkit-box-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n align-items: center;\n height: ".concat(height, "px !important;\n width: ").concat(width, "px !important;\n border-radius: ").concat(type === "circle" ? "100%" : "0", ";\n}\n.ripple-animator span {\n position: relative;\n font-size: 72px;\n top: 5px;left: -5px;\n}\n\n.ripple-animator:before,\n.ripple-animator:after {\n content: '';\n display: block;\n position: absolute;\n top: 0; \n right: 0; \n bottom: 0; \n left: 0;\n opacity:1;\n z-index:10;\n border: 0px solid white;\n border-radius: ").concat(type === "circle" ? "100%" : "0%", ";\n z-index: 99999;\n}\n\n.ripple-animator:before {\n animation: ripple 1s infinite ease-out;\n}\n\n@keyframes ripple{\n 0% { \n border: 0px solid white;\n transform: scale(0.8); \n }\n 100% { \n border: 20px solid white;\n transform: scale(1.5); \n opacity:0; \n }\n}\n</style>");
|
|
7673
7916
|
}
|
|
7674
7917
|
function createInnerCircle(width, height, left, top, type, has_ripple) {
|
|
7675
7918
|
var newWidth = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
|
|
@@ -7737,7 +7980,7 @@
|
|
|
7737
7980
|
svgElement.style.top = 0;
|
|
7738
7981
|
svgElement.style.zIndex = 99998;
|
|
7739
7982
|
svgElement.style.width = "100%";
|
|
7740
|
-
svgElement.style.height = "
|
|
7983
|
+
svgElement.style.height = "99%";
|
|
7741
7984
|
var svg = "";
|
|
7742
7985
|
if (type === "circle") {
|
|
7743
7986
|
svg = getCircleSVG(data);
|
|
@@ -7748,16 +7991,19 @@
|
|
|
7748
7991
|
document.body.appendChild(svgElement);
|
|
7749
7992
|
return svgElement;
|
|
7750
7993
|
}
|
|
7751
|
-
function showCoachmark(ui_config,
|
|
7994
|
+
function showCoachmark(ui_config, campaignConfig, termination_config, on_shown, on_dismissed) {
|
|
7752
7995
|
var bg_color = ui_config.bg_color,
|
|
7996
|
+
_ui_config$buttons_co = ui_config.buttons_config,
|
|
7997
|
+
buttons_config = _ui_config$buttons_co === void 0 ? [] : _ui_config$buttons_co,
|
|
7998
|
+
button_position = ui_config.button_position,
|
|
7999
|
+
_ui_config$button_dir = ui_config.button_direction,
|
|
8000
|
+
button_direction = _ui_config$button_dir === void 0 ? DIRECTION.HORIZONTAL : _ui_config$button_dir,
|
|
7753
8001
|
_ui_config$coach_mark = ui_config.coach_mark_details,
|
|
7754
8002
|
_ui_config$coach_mark2 = _ui_config$coach_mark.has_ripple,
|
|
7755
8003
|
has_ripple = _ui_config$coach_mark2 === void 0 ? false : _ui_config$coach_mark2,
|
|
7756
8004
|
_ui_config$coach_mark3 = _ui_config$coach_mark.type,
|
|
7757
8005
|
type = _ui_config$coach_mark3 === void 0 ? "circle" : _ui_config$coach_mark3,
|
|
7758
8006
|
delay = ui_config.delay,
|
|
7759
|
-
_ui_config$buttons_co = ui_config.buttons_config,
|
|
7760
|
-
buttons_config = _ui_config$buttons_co === void 0 ? [] : _ui_config$buttons_co,
|
|
7761
8007
|
_ui_config$dismiss_ou = ui_config.dismiss_outside_touch,
|
|
7762
8008
|
dismiss_outside_touch = _ui_config$dismiss_ou === void 0 ? false : _ui_config$dismiss_ou,
|
|
7763
8009
|
_ui_config$opacity = ui_config.opacity,
|
|
@@ -7768,141 +8014,29 @@
|
|
|
7768
8014
|
_ui_config$title_conf = ui_config.title_config,
|
|
7769
8015
|
title_config = _ui_config$title_conf === void 0 ? null : _ui_config$title_conf,
|
|
7770
8016
|
view_id = ui_config.view_id,
|
|
8017
|
+
_ui_config$iframe_id = ui_config.iframe_id,
|
|
8018
|
+
iframe_id = _ui_config$iframe_id === void 0 ? "" : _ui_config$iframe_id,
|
|
7771
8019
|
_ui_config$scroll_to_ = ui_config.scroll_to_view,
|
|
7772
|
-
scroll_to_view = _ui_config$scroll_to_ === void 0 ? false : _ui_config$scroll_to_
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
set_font_to_scale = _ui_config$set_font_t === void 0 ? false : _ui_config$set_font_t;
|
|
7776
|
-
var configId = messageconfig.configId,
|
|
7777
|
-
configName = messageconfig.configName;
|
|
7778
|
-
fontMultiplier = set_font_to_scale ? getFontMultiplier() : 1;
|
|
7779
|
-
fontMultiplier = fontMultiplier > 1 ? fontMultiplier : 1;
|
|
7780
|
-
// Note: There are different possible ways to identify the element.
|
|
8020
|
+
scroll_to_view = _ui_config$scroll_to_ === void 0 ? false : _ui_config$scroll_to_;
|
|
8021
|
+
var configId = campaignConfig.configId,
|
|
8022
|
+
configName = campaignConfig.configName;
|
|
7781
8023
|
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
next: hideCallback,
|
|
7799
|
-
complete: hideCallback,
|
|
7800
|
-
cancel: hideCallback
|
|
7801
|
-
};
|
|
7802
|
-
switch (_action) {
|
|
7803
|
-
case "done":
|
|
7804
|
-
case "dismiss":
|
|
7805
|
-
action = function action() {
|
|
7806
|
-
ActionHandler.complete(false, "dismiss");
|
|
7807
|
-
};
|
|
7808
|
-
break;
|
|
7809
|
-
case "next":
|
|
7810
|
-
action = function action() {
|
|
7811
|
-
ActionHandler.complete(false, "dismiss");
|
|
7812
|
-
};
|
|
7813
|
-
break;
|
|
7814
|
-
case "prev":
|
|
7815
|
-
action = function action() {
|
|
7816
|
-
ActionHandler.complete(false, "prev");
|
|
7817
|
-
};
|
|
7818
|
-
break;
|
|
7819
|
-
case "redirect":
|
|
7820
|
-
action = function action() {
|
|
7821
|
-
window.Apxor.redirectTo(configId, configName, button_text, action_config_str);
|
|
7822
|
-
//window.Apxor.logActionEvent("redirection", configId, configName, url);
|
|
7823
|
-
ActionHandler.next(false, "redirect");
|
|
7824
|
-
};
|
|
7825
|
-
break;
|
|
7826
|
-
case "cancel":
|
|
7827
|
-
action = function action() {
|
|
7828
|
-
ActionHandler._isCancelled = true;
|
|
7829
|
-
ActionHandler.cancel(true, "cancel");
|
|
7830
|
-
};
|
|
7831
|
-
break;
|
|
7832
|
-
default:
|
|
7833
|
-
action = function action() {
|
|
7834
|
-
ActionHandler.cancel(false, "cancel");
|
|
7835
|
-
};
|
|
7836
|
-
}
|
|
7837
|
-
button_classes = "shepherd-button";
|
|
7838
|
-
button_classes += button_config.id === "okButton" ? "-secondary" : "";
|
|
7839
|
-
button_css = {
|
|
7840
|
-
borders: button_config.borders,
|
|
7841
|
-
color: button_config.color,
|
|
7842
|
-
margin: button_config.margin_config,
|
|
7843
|
-
padding: button_config.padding_config,
|
|
7844
|
-
text_config: button_config.text_config,
|
|
7845
|
-
visibility: button_config.visibility
|
|
7846
|
-
};
|
|
7847
|
-
buttons_array.push({
|
|
7848
|
-
classes: button_classes,
|
|
7849
|
-
text: button_text,
|
|
7850
|
-
action: action,
|
|
7851
|
-
button_css: button_css
|
|
7852
|
-
});
|
|
7853
|
-
});
|
|
7854
|
-
var textContentCSS = {
|
|
7855
|
-
color: text_config.color,
|
|
7856
|
-
fontSize: text_config.size * fontMultiplier,
|
|
7857
|
-
fontFamily: text_config.font_family,
|
|
7858
|
-
fontStyle: text_config.style
|
|
7859
|
-
};
|
|
7860
|
-
if (text_config.margin_config && Object.keys(text_config.margin_config).length > 0) {
|
|
7861
|
-
var margin = text_config.margin_config;
|
|
7862
|
-
textContentCSS.margin = "".concat(margin.top, "px ").concat(margin.right, "px ").concat(margin.bottom, "px ").concat(margin.left, "px");
|
|
7863
|
-
}
|
|
7864
|
-
var style = text_config.style;
|
|
7865
|
-
if (style === "bold") {
|
|
7866
|
-
textContentCSS.fontWeight = style;
|
|
7867
|
-
}
|
|
7868
|
-
var titleContentCSS = {
|
|
7869
|
-
color: title_config.color,
|
|
7870
|
-
fontSize: title_config.size * fontMultiplier,
|
|
7871
|
-
fontFamily: title_config.font_family,
|
|
7872
|
-
fontStyle: title_config.style
|
|
7873
|
-
};
|
|
7874
|
-
if (title_config.margin_config && Object.keys(title_config.margin_config).length > 0) {
|
|
7875
|
-
var _margin = title_config.margin_config;
|
|
7876
|
-
titleContentCSS.margin = "".concat(_margin.top, "px ").concat(_margin.right, "px ").concat(_margin.bottom, "px ").concat(_margin.left, "px");
|
|
7877
|
-
}
|
|
7878
|
-
style = title_config.style;
|
|
7879
|
-
if (style === "bold") {
|
|
7880
|
-
textContentCSS.fontWeight = style;
|
|
7881
|
-
}
|
|
7882
|
-
var element = document.getElementById(view_id);
|
|
7883
|
-
if (!element) {
|
|
7884
|
-
console.warn("Element not found with id: ", view_id);
|
|
7885
|
-
return;
|
|
7886
|
-
}
|
|
7887
|
-
currentId = makeid$1(10);
|
|
7888
|
-
var rect = getDocumentOffsetPosition(element);
|
|
7889
|
-
var _rect$left = rect.left,
|
|
7890
|
-
targetElementLeft = _rect$left === void 0 ? 0 : _rect$left,
|
|
7891
|
-
_rect$top = rect.top,
|
|
7892
|
-
targetElementTop = _rect$top === void 0 ? 0 : _rect$top,
|
|
7893
|
-
_rect$width = rect.width,
|
|
7894
|
-
targetElementWidth = _rect$width === void 0 ? 0 : _rect$width,
|
|
7895
|
-
_rect$height = rect.height,
|
|
7896
|
-
targetElementHeight = _rect$height === void 0 ? 0 : _rect$height;
|
|
7897
|
-
if (!scroll_to_view && rect.top >= window.innerHeight) {
|
|
7898
|
-
console.warn("Element ", view_id, " not in viewport. Can't show");
|
|
7899
|
-
return;
|
|
7900
|
-
}
|
|
7901
|
-
var scrolledToView = false;
|
|
7902
|
-
// Add MutationObserver to the target element
|
|
7903
|
-
var targetDeletionObserver = new MutationObserver(function () {
|
|
7904
|
-
if (!document.body.contains(element)) {
|
|
7905
|
-
will_dismiss();
|
|
8024
|
+
// TODO: There are different possible ways to identify the element.
|
|
8025
|
+
var element = getElementFromSelector(view_id, iframe_id);
|
|
8026
|
+
if (!element) {
|
|
8027
|
+
console.warn("Element not found with id or path: ", view_id);
|
|
8028
|
+
return;
|
|
8029
|
+
}
|
|
8030
|
+
currentId = makeid(10);
|
|
8031
|
+
if (!scroll_to_view && !isElementInViewport(element)) {
|
|
8032
|
+
console.warn("Element ", view_id, " not in viewport. Can't show");
|
|
8033
|
+
return;
|
|
8034
|
+
}
|
|
8035
|
+
var scrolledToView = false;
|
|
8036
|
+
// Add MutationObserver to the target element
|
|
8037
|
+
var targetDeletionObserver = new MutationObserver(function () {
|
|
8038
|
+
if (!document.body.contains(element)) {
|
|
8039
|
+
will_dismiss();
|
|
7906
8040
|
}
|
|
7907
8041
|
});
|
|
7908
8042
|
var viewPortObservor = new IntersectionObserver(function () {
|
|
@@ -7914,13 +8048,31 @@
|
|
|
7914
8048
|
scrolledToView = true;
|
|
7915
8049
|
}
|
|
7916
8050
|
});
|
|
7917
|
-
|
|
8051
|
+
var rect = getDocumentOffsetPosition(element);
|
|
8052
|
+
var _rect$left = rect.left,
|
|
8053
|
+
targetElementLeft = _rect$left === void 0 ? 0 : _rect$left,
|
|
8054
|
+
_rect$top = rect.top,
|
|
8055
|
+
targetElementTop = _rect$top === void 0 ? 0 : _rect$top,
|
|
8056
|
+
_rect$width = rect.width,
|
|
8057
|
+
targetElementWidth = _rect$width === void 0 ? 0 : _rect$width,
|
|
8058
|
+
_rect$height = rect.height,
|
|
8059
|
+
targetElementHeight = _rect$height === void 0 ? 0 : _rect$height;
|
|
7918
8060
|
var isFirstHalf = rect.left < window.innerWidth / 2;
|
|
7919
8061
|
if (targetElementHeight === 0 || targetElementWidth === 0) {
|
|
7920
8062
|
console.warn("Can't show on an invisible element: ", view_id);
|
|
7921
8063
|
return;
|
|
7922
8064
|
}
|
|
7923
|
-
var
|
|
8065
|
+
var will_dismiss = function will_dismiss() {
|
|
8066
|
+
// Detach the observer
|
|
8067
|
+
targetDeletionObserver.disconnect();
|
|
8068
|
+
viewPortObservor.disconnect();
|
|
8069
|
+
svgElement.parentNode.removeChild(svgElement);
|
|
8070
|
+
textElement.parentNode.removeChild(textElement);
|
|
8071
|
+
transparentCircle.parentNode.removeChild(transparentCircle);
|
|
8072
|
+
if (on_dismissed) on_dismissed();
|
|
8073
|
+
if (autoDismissCallback) clearTimeout(autoDismissCallback);
|
|
8074
|
+
};
|
|
8075
|
+
var textElement = createTitleDescriptionButtons(text_config, title_config, buttons_config, button_position, button_direction, configId, configName, will_dismiss);
|
|
7924
8076
|
var textElemOffsetWidth = textElement.offsetWidth;
|
|
7925
8077
|
var textElemOffsetHeight = textElement.offsetHeight;
|
|
7926
8078
|
var marginLeft = 0;
|
|
@@ -7954,6 +8106,8 @@
|
|
|
7954
8106
|
outerCircleCenterY = innerCircleBottom - Math.abs(innerCircleBottom - textElementOffsetTop) / 2;
|
|
7955
8107
|
break;
|
|
7956
8108
|
case "BOTTOM":
|
|
8109
|
+
case "RIGHT":
|
|
8110
|
+
case "LEFT":
|
|
7957
8111
|
left = innerCenterX - textElemOffsetWidth / 2;
|
|
7958
8112
|
textElementOffsetLeft = left < 0 ? DEFAULT_PADDING : left;
|
|
7959
8113
|
if (type === "circle") {
|
|
@@ -7963,9 +8117,8 @@
|
|
|
7963
8117
|
}
|
|
7964
8118
|
outerCircleCenterY = innerCircleTop + (textElementOffsetTop + textElemOffsetHeight - innerCircleTop) / 2;
|
|
7965
8119
|
break;
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
case "RIGHT":
|
|
8120
|
+
default:
|
|
8121
|
+
// We won't support LEFT and RIGHT positions
|
|
7969
8122
|
break;
|
|
7970
8123
|
}
|
|
7971
8124
|
if (textElementOffsetLeft === -1 || textElementOffsetTop === -1 || outerCircleCenterY === -1) {
|
|
@@ -8012,29 +8165,24 @@
|
|
|
8012
8165
|
textElement.style.visibility = "hidden";
|
|
8013
8166
|
var autoDismissCallback = null;
|
|
8014
8167
|
var dismissCallback = function dismissCallback(e) {
|
|
8015
|
-
var isUserHitTarget =
|
|
8168
|
+
var isUserHitTarget = false;
|
|
8169
|
+
var autoDismiss = false;
|
|
8170
|
+
if (e === undefined) {
|
|
8171
|
+
autoDismiss = true;
|
|
8172
|
+
}
|
|
8016
8173
|
var rect = element.getBoundingClientRect();
|
|
8017
|
-
if (e && e.clientX >= rect.left && e.clientX <= rect.left + rect.width && e.clientY >= rect.top && e.clientY <= rect.top + rect.height) {
|
|
8174
|
+
if (e !== undefined && e.clientX >= rect.left && e.clientX <= rect.left + rect.width && e.clientY >= rect.top && e.clientY <= rect.top + rect.height) {
|
|
8018
8175
|
isUserHitTarget = true;
|
|
8019
8176
|
}
|
|
8020
|
-
|
|
8021
|
-
// if (!dismiss_outside_touch && e && e.preventDefault) {
|
|
8022
|
-
// e.preventDefault();
|
|
8023
|
-
// }
|
|
8024
|
-
if (dismiss_outside_touch || isUserHitTarget) {
|
|
8177
|
+
if (dismiss_outside_touch || isUserHitTarget || autoDismiss) {
|
|
8025
8178
|
will_dismiss();
|
|
8179
|
+
// FIXME: Uncomment it, whenever you are confident!!
|
|
8180
|
+
// if (isUserHitTarget && element.click) {
|
|
8181
|
+
// element.click();
|
|
8182
|
+
// }
|
|
8026
8183
|
}
|
|
8027
8184
|
};
|
|
8028
|
-
|
|
8029
|
-
// Detach the observer
|
|
8030
|
-
targetDeletionObserver.disconnect();
|
|
8031
|
-
viewPortObservor.disconnect();
|
|
8032
|
-
svgElement.parentNode.removeChild(svgElement);
|
|
8033
|
-
textElement.parentNode.removeChild(textElement);
|
|
8034
|
-
transparentCircle.parentNode.removeChild(transparentCircle);
|
|
8035
|
-
if (on_dismissed) on_dismissed();
|
|
8036
|
-
if (autoDismissCallback) clearTimeout(autoDismissCallback);
|
|
8037
|
-
};
|
|
8185
|
+
|
|
8038
8186
|
if (termination_config && termination_config.auto_dismiss === true) {
|
|
8039
8187
|
autoDismissCallback = setTimeout(function () {
|
|
8040
8188
|
return dismissCallback();
|
|
@@ -8043,6 +8191,9 @@
|
|
|
8043
8191
|
svgElement.style.visibility = "visible";
|
|
8044
8192
|
transparentCircle.style.visibility = "visible";
|
|
8045
8193
|
textElement.style.visibility = "visible";
|
|
8194
|
+
if (textElement.childElementCount > 0) {
|
|
8195
|
+
textElement.children[0].style.visibility = "visible";
|
|
8196
|
+
}
|
|
8046
8197
|
if (dismiss_outside_touch) {
|
|
8047
8198
|
svgElement.addEventListener("click", dismissCallback);
|
|
8048
8199
|
}
|
|
@@ -8091,39 +8242,27 @@
|
|
|
8091
8242
|
}
|
|
8092
8243
|
|
|
8093
8244
|
/**
|
|
8094
|
-
* @constructor
|
|
8245
|
+
* @constructor Border
|
|
8095
8246
|
* @example
|
|
8096
|
-
* Example of a
|
|
8247
|
+
* Example of a border model is
|
|
8097
8248
|
*
|
|
8098
|
-
*
|
|
8099
|
-
*
|
|
8100
|
-
*
|
|
8101
|
-
*
|
|
8102
|
-
*
|
|
8103
|
-
* offset_top: 8,
|
|
8104
|
-
* offset_right: 8,
|
|
8105
|
-
* height: 20,
|
|
8106
|
-
* width: 20,
|
|
8107
|
-
* action: "cancel/dismiss",
|
|
8108
|
-
* shape: "rectangle/circle"
|
|
8249
|
+
* border: {
|
|
8250
|
+
* radius : 50,
|
|
8251
|
+
* color : "#FFFFFF",
|
|
8252
|
+
* width : 2,
|
|
8253
|
+
* style : "dotted"
|
|
8109
8254
|
* }
|
|
8110
8255
|
*/
|
|
8111
|
-
var
|
|
8112
|
-
function
|
|
8256
|
+
var Border = /*#__PURE__*/function () {
|
|
8257
|
+
function Border() {
|
|
8113
8258
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8114
|
-
_classCallCheck(this,
|
|
8259
|
+
_classCallCheck(this, Border);
|
|
8260
|
+
this.radius = getNumberOrDefault(data.radius, 0);
|
|
8115
8261
|
this.color = getColorOrDefault(data.color, "#FFFFFF");
|
|
8116
|
-
this.
|
|
8117
|
-
this.
|
|
8118
|
-
this.path = data.path;
|
|
8119
|
-
this.offset_top = getNumberOrDefault(data.offset_top, 8);
|
|
8120
|
-
this.offset_right = getNumberOrDefault(data.offset_right, 8);
|
|
8121
|
-
this.height = getNumberOrDefault(data.height, 24);
|
|
8122
|
-
this.width = getNumberOrDefault(data.width, 24);
|
|
8123
|
-
this.action = getStringOrDefault(data.action, "dismiss");
|
|
8124
|
-
this.shape = getStringOrDefault(data.shape, "circle");
|
|
8262
|
+
this.width = getNumberOrDefault(data.width, 0);
|
|
8263
|
+
this.style = getStringOrDefault(data.style, "solid");
|
|
8125
8264
|
}
|
|
8126
|
-
_createClass(
|
|
8265
|
+
_createClass(Border, null, [{
|
|
8127
8266
|
key: "isEnabled",
|
|
8128
8267
|
value: function isEnabled(data) {
|
|
8129
8268
|
if (isUndefined$1(data) || isNull(data) || isEmptyObject(data)) {
|
|
@@ -8133,31 +8272,31 @@
|
|
|
8133
8272
|
}
|
|
8134
8273
|
}
|
|
8135
8274
|
}]);
|
|
8136
|
-
return
|
|
8275
|
+
return Border;
|
|
8137
8276
|
}();
|
|
8138
8277
|
|
|
8139
8278
|
/**
|
|
8140
|
-
* @constructor
|
|
8279
|
+
* @constructor Margin
|
|
8141
8280
|
* @example
|
|
8142
|
-
* Example of a
|
|
8281
|
+
* Example of a margin model is
|
|
8143
8282
|
*
|
|
8144
|
-
*
|
|
8283
|
+
* margin: {
|
|
8145
8284
|
* top : 10,
|
|
8146
8285
|
* bottom : 10,
|
|
8147
8286
|
* left : 12,
|
|
8148
8287
|
* right : 12
|
|
8149
8288
|
* }
|
|
8150
8289
|
*/
|
|
8151
|
-
var
|
|
8152
|
-
function
|
|
8290
|
+
var Margin = /*#__PURE__*/function () {
|
|
8291
|
+
function Margin() {
|
|
8153
8292
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8154
|
-
_classCallCheck(this,
|
|
8293
|
+
_classCallCheck(this, Margin);
|
|
8155
8294
|
this.top = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.top, 8);
|
|
8156
8295
|
this.bottom = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.bottom, 8);
|
|
8157
8296
|
this.left = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.left, 8);
|
|
8158
8297
|
this.right = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.right, 8);
|
|
8159
8298
|
}
|
|
8160
|
-
_createClass(
|
|
8299
|
+
_createClass(Margin, null, [{
|
|
8161
8300
|
key: "isEnabled",
|
|
8162
8301
|
value: function isEnabled(data) {
|
|
8163
8302
|
if (isUndefined$1(data) || isNull(data) || isEmptyObject(data)) {
|
|
@@ -8167,31 +8306,31 @@
|
|
|
8167
8306
|
}
|
|
8168
8307
|
}
|
|
8169
8308
|
}]);
|
|
8170
|
-
return
|
|
8309
|
+
return Margin;
|
|
8171
8310
|
}();
|
|
8172
8311
|
|
|
8173
8312
|
/**
|
|
8174
|
-
* @constructor
|
|
8313
|
+
* @constructor Padding
|
|
8175
8314
|
* @example
|
|
8176
|
-
* Example of a
|
|
8315
|
+
* Example of a Padding model is
|
|
8177
8316
|
*
|
|
8178
|
-
*
|
|
8317
|
+
* padding: {
|
|
8179
8318
|
* top : 10,
|
|
8180
8319
|
* bottom : 10,
|
|
8181
8320
|
* left : 12,
|
|
8182
8321
|
* right : 12
|
|
8183
8322
|
* }
|
|
8184
8323
|
*/
|
|
8185
|
-
var
|
|
8186
|
-
function
|
|
8324
|
+
var Padding = /*#__PURE__*/function () {
|
|
8325
|
+
function Padding() {
|
|
8187
8326
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8188
|
-
_classCallCheck(this,
|
|
8327
|
+
_classCallCheck(this, Padding);
|
|
8189
8328
|
this.top = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.top, 8);
|
|
8190
8329
|
this.bottom = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.bottom, 8);
|
|
8191
8330
|
this.left = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.left, 8);
|
|
8192
8331
|
this.right = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.right, 8);
|
|
8193
8332
|
}
|
|
8194
|
-
_createClass(
|
|
8333
|
+
_createClass(Padding, null, [{
|
|
8195
8334
|
key: "isEnabled",
|
|
8196
8335
|
value: function isEnabled(data) {
|
|
8197
8336
|
if (isUndefined$1(data) || isNull(data) || isEmptyObject(data)) {
|
|
@@ -8201,31 +8340,96 @@
|
|
|
8201
8340
|
}
|
|
8202
8341
|
}
|
|
8203
8342
|
}]);
|
|
8204
|
-
return
|
|
8343
|
+
return Padding;
|
|
8205
8344
|
}();
|
|
8206
8345
|
|
|
8207
8346
|
/**
|
|
8208
|
-
* @constructor
|
|
8347
|
+
* @constructor Offset
|
|
8209
8348
|
* @example
|
|
8210
|
-
* Example of a
|
|
8349
|
+
* Example of a Offset model is
|
|
8211
8350
|
*
|
|
8212
|
-
*
|
|
8213
|
-
*
|
|
8214
|
-
*
|
|
8215
|
-
* width : 2,
|
|
8216
|
-
* style : "dotted"
|
|
8351
|
+
* offset: {
|
|
8352
|
+
* skid : 10,
|
|
8353
|
+
* distance : 10,
|
|
8217
8354
|
* }
|
|
8218
8355
|
*/
|
|
8219
|
-
var
|
|
8220
|
-
|
|
8356
|
+
var Offset = /*#__PURE__*/_createClass(function Offset() {
|
|
8357
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8358
|
+
_classCallCheck(this, Offset);
|
|
8359
|
+
this.skid = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.skid, 0);
|
|
8360
|
+
this.distance = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.distance, 0);
|
|
8361
|
+
});
|
|
8362
|
+
|
|
8363
|
+
/**
|
|
8364
|
+
* @constructor Position
|
|
8365
|
+
* @example
|
|
8366
|
+
* Example of a Position model is
|
|
8367
|
+
*
|
|
8368
|
+
* position: {
|
|
8369
|
+
* position : "top-left",
|
|
8370
|
+
* offset: {
|
|
8371
|
+
* skid : 10,
|
|
8372
|
+
* distance : 10,
|
|
8373
|
+
* top: 0,
|
|
8374
|
+
* bottom : 0,
|
|
8375
|
+
* left: 0,
|
|
8376
|
+
* right : 0
|
|
8377
|
+
* }
|
|
8378
|
+
* }
|
|
8379
|
+
*/
|
|
8380
|
+
var Position = /*#__PURE__*/_createClass(function Position() {
|
|
8381
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8382
|
+
_classCallCheck(this, Position);
|
|
8383
|
+
this.position = getStringOrDefault(data === null || data === void 0 ? void 0 : data.position, "top-left").toLowerCase();
|
|
8384
|
+
this.enable_offset = data.enable_offset;
|
|
8385
|
+
this.offset = new Offset(data.offset);
|
|
8386
|
+
});
|
|
8387
|
+
|
|
8388
|
+
/**
|
|
8389
|
+
* @constructor CloseButton
|
|
8390
|
+
* @example
|
|
8391
|
+
* Example of a close button model is
|
|
8392
|
+
*
|
|
8393
|
+
* close_button: {
|
|
8394
|
+
* color: "#172B4D",
|
|
8395
|
+
* fill_color: "#FFFFFF",
|
|
8396
|
+
* type: "normal/filled/custom",
|
|
8397
|
+
* path: "<assets-path>",
|
|
8398
|
+
* offset_top: 8,
|
|
8399
|
+
* offset_right: 8,
|
|
8400
|
+
* height: 20,
|
|
8401
|
+
* width: 20,
|
|
8402
|
+
* action: "cancel/dismiss",
|
|
8403
|
+
* shape: "rectangle/circle"
|
|
8404
|
+
* }
|
|
8405
|
+
*/
|
|
8406
|
+
var CloseButton = /*#__PURE__*/function () {
|
|
8407
|
+
function CloseButton() {
|
|
8221
8408
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8222
|
-
_classCallCheck(this,
|
|
8223
|
-
this.radius = getNumberOrDefault(data.radius, 0);
|
|
8409
|
+
_classCallCheck(this, CloseButton);
|
|
8224
8410
|
this.color = getColorOrDefault(data.color, "#FFFFFF");
|
|
8225
|
-
this.
|
|
8226
|
-
this.
|
|
8411
|
+
this.fill_color = getColorOrDefault(data.fill_color, "#FFFFFF");
|
|
8412
|
+
this.type = getStringOrDefault(data.type, "normal");
|
|
8413
|
+
this.path = data.path;
|
|
8414
|
+
this.height = getNumberOrDefault(data.height, 24);
|
|
8415
|
+
this.width = getNumberOrDefault(data.width, 24);
|
|
8416
|
+
this.offset_top = getNumberOrDefault(data.offset_top, 8);
|
|
8417
|
+
this.offset_right = getNumberOrDefault(data.offset_right, 8);
|
|
8418
|
+
this.action = getStringOrDefault(data.action, "dismiss");
|
|
8419
|
+
this.shape = getStringOrDefault(data.shape, "circle");
|
|
8420
|
+
|
|
8421
|
+
//surveys
|
|
8422
|
+
if (data !== null && data !== void 0 && data.position) {
|
|
8423
|
+
this.position = new Position(data.position);
|
|
8424
|
+
}
|
|
8425
|
+
this.enable_margin = data.enable_margin;
|
|
8426
|
+
if (this.enable_margin) this.margin = new Margin(data.margin);
|
|
8427
|
+
this.enable_padding = data.enable_padding;
|
|
8428
|
+
if (this.enable_padding) this.padding = new Padding(data.padding);
|
|
8429
|
+
this.enable_border = data.enable_border;
|
|
8430
|
+
if (this.enable_border) this.border = new Border(data.border);
|
|
8227
8431
|
}
|
|
8228
|
-
_createClass(
|
|
8432
|
+
_createClass(CloseButton, null, [{
|
|
8229
8433
|
key: "isEnabled",
|
|
8230
8434
|
value: function isEnabled(data) {
|
|
8231
8435
|
if (isUndefined$1(data) || isNull(data) || isEmptyObject(data)) {
|
|
@@ -8235,7 +8439,7 @@
|
|
|
8235
8439
|
}
|
|
8236
8440
|
}
|
|
8237
8441
|
}]);
|
|
8238
|
-
return
|
|
8442
|
+
return CloseButton;
|
|
8239
8443
|
}();
|
|
8240
8444
|
|
|
8241
8445
|
/**
|
|
@@ -8471,48 +8675,6 @@
|
|
|
8471
8675
|
return Video;
|
|
8472
8676
|
}();
|
|
8473
8677
|
|
|
8474
|
-
/**
|
|
8475
|
-
* @constructor Offset
|
|
8476
|
-
* @example
|
|
8477
|
-
* Example of a Offset model is
|
|
8478
|
-
*
|
|
8479
|
-
* offset: {
|
|
8480
|
-
* skid : 10,
|
|
8481
|
-
* distance : 10,
|
|
8482
|
-
* }
|
|
8483
|
-
*/
|
|
8484
|
-
var Offset = /*#__PURE__*/_createClass(function Offset() {
|
|
8485
|
-
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8486
|
-
_classCallCheck(this, Offset);
|
|
8487
|
-
this.skid = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.skid, 0);
|
|
8488
|
-
this.distance = getNumberOrDefault(data === null || data === void 0 ? void 0 : data.distance, 0);
|
|
8489
|
-
});
|
|
8490
|
-
|
|
8491
|
-
/**
|
|
8492
|
-
* @constructor Position
|
|
8493
|
-
* @example
|
|
8494
|
-
* Example of a Position model is
|
|
8495
|
-
*
|
|
8496
|
-
* position: {
|
|
8497
|
-
* position : "top-left",
|
|
8498
|
-
* offset: {
|
|
8499
|
-
* skid : 10,
|
|
8500
|
-
* distance : 10,
|
|
8501
|
-
* top: 0,
|
|
8502
|
-
* bottom : 0,
|
|
8503
|
-
* left: 0,
|
|
8504
|
-
* right : 0
|
|
8505
|
-
* }
|
|
8506
|
-
* }
|
|
8507
|
-
*/
|
|
8508
|
-
var Position = /*#__PURE__*/_createClass(function Position() {
|
|
8509
|
-
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8510
|
-
_classCallCheck(this, Position);
|
|
8511
|
-
this.position = getStringOrDefault(data === null || data === void 0 ? void 0 : data.position, "top-left").toLowerCase();
|
|
8512
|
-
this.enable_offset = data.enable_offset;
|
|
8513
|
-
this.offset = new Offset(data.offset);
|
|
8514
|
-
});
|
|
8515
|
-
|
|
8516
8678
|
/**
|
|
8517
8679
|
* @constructor DimBackground
|
|
8518
8680
|
* @example
|
|
@@ -9504,7 +9666,7 @@
|
|
|
9504
9666
|
* @description Creates the styles for Marketing message.
|
|
9505
9667
|
* @returns {string} css styles
|
|
9506
9668
|
*/
|
|
9507
|
-
_defineProperty(this, "
|
|
9669
|
+
_defineProperty(this, "hNbt", function () {
|
|
9508
9670
|
if (!_this.enable_marketing) {
|
|
9509
9671
|
return "";
|
|
9510
9672
|
}
|
|
@@ -9523,7 +9685,7 @@
|
|
|
9523
9685
|
* @private
|
|
9524
9686
|
* @description Get the response for Form content in the InApp modal.
|
|
9525
9687
|
*/
|
|
9526
|
-
_defineProperty(this, "
|
|
9688
|
+
_defineProperty(this, "PXZN", function (form_elements) {
|
|
9527
9689
|
var obj = {};
|
|
9528
9690
|
var callback = "";
|
|
9529
9691
|
form_elements.forEach(function (element) {
|
|
@@ -9565,7 +9727,7 @@
|
|
|
9565
9727
|
* @private
|
|
9566
9728
|
* @description Sets the marketing content at the end of the InApp
|
|
9567
9729
|
*/
|
|
9568
|
-
_defineProperty(this, "
|
|
9730
|
+
_defineProperty(this, "EcYl", function () {
|
|
9569
9731
|
if (_this.enable_marketing) {
|
|
9570
9732
|
var marketingContainer = document.createElement("div");
|
|
9571
9733
|
marketingContainer.classList.add("apx-inapp-marketing".concat(_this.cssPostFix));
|
|
@@ -9783,7 +9945,7 @@
|
|
|
9783
9945
|
}, {
|
|
9784
9946
|
key: "_setStyles",
|
|
9785
9947
|
value: function _setStyles() {
|
|
9786
|
-
var styles = " \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.
|
|
9948
|
+
var styles = " \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.hNbt(), " \n ").concat(this._getProgressBarStyles(), "\n ").concat(this._getBootstrapiconsStyles(), " \n ").replaceAll("\n", "").replace(/[\s]{2,999}/g, "");
|
|
9787
9949
|
var styleNode = document.createElement("style");
|
|
9788
9950
|
styleNode.innerHTML = styles;
|
|
9789
9951
|
this.overlayElement.appendChild(styleNode);
|
|
@@ -9900,8 +10062,9 @@
|
|
|
9900
10062
|
key: "_getScrollStyles",
|
|
9901
10063
|
value: function _getScrollStyles() {
|
|
9902
10064
|
var scrollStyles = "";
|
|
10065
|
+
var borderStyles = this.enable_scroll && this.scroll.enable_border ? "\n border-top: ".concat(this.scroll.border.width, "px ").concat(this.scroll.border.style, " ").concat(this.scroll.border.color, ";\n border-bottom : ").concat(this.scroll.border.width, "px ").concat(this.scroll.border.style, " ").concat(this.scroll.border.color, ";\n ") : "";
|
|
9903
10066
|
if (this.enable_scroll) {
|
|
9904
|
-
scrollStyles = "\n .apx-inapp-scroll".concat(this.cssPostFix, " {\n overflow:scroll; \n overflow-x: hidden;\n height:").concat(this.scroll.height, "px;\n
|
|
10067
|
+
scrollStyles = "\n .apx-inapp-scroll".concat(this.cssPostFix, " {\n overflow:scroll; \n overflow-x: hidden;\n height:").concat(this.scroll.height, "px;\n ").concat(borderStyles, "\n }\n ");
|
|
9905
10068
|
} else {
|
|
9906
10069
|
scrollStyles = "\n .apx-inapp-scroll".concat(this.cssPostFix, " {\n overflow : hidden;\n }\n ");
|
|
9907
10070
|
}
|
|
@@ -10151,7 +10314,7 @@
|
|
|
10151
10314
|
function _getProgressBarStyles() {
|
|
10152
10315
|
var progressBarStyles = "";
|
|
10153
10316
|
if (this.has_progress_bar) {
|
|
10154
|
-
progressBarStyles = "\n .apx-inapp-progress-bar".concat(this.cssPostFix, "{\n position: absolute;\n width:100%;\n height:").concat(this.progressbar.width, "
|
|
10317
|
+
progressBarStyles = "\n .apx-inapp-progress-bar".concat(this.cssPostFix, "{\n position: absolute;\n width:100%;\n height:").concat(this.progressbar.width, ";\n ").concat(this.progressbar.position === "top" ? "top:0px;" : "bottom:0px;", "\n left:0px;\n z-index:999999;\n overflow:hidden;\n cursor: pointer;\n background:").concat(this.progressbar.reamining_color, ";\n }\n .apx-inapp-bar").concat(this.cssPostFix, "{\n width:100%;\n height:100%;\n background:").concat(this.progressbar.progress_color, ";\n }");
|
|
10155
10318
|
}
|
|
10156
10319
|
return progressBarStyles;
|
|
10157
10320
|
}
|
|
@@ -10225,7 +10388,7 @@
|
|
|
10225
10388
|
this._setCloseButton();
|
|
10226
10389
|
|
|
10227
10390
|
//Set the Marketing content
|
|
10228
|
-
this.
|
|
10391
|
+
this.EcYl();
|
|
10229
10392
|
}
|
|
10230
10393
|
|
|
10231
10394
|
/**
|
|
@@ -10418,7 +10581,7 @@
|
|
|
10418
10581
|
var form = document.querySelector(".apx-inapp-form-container".concat(this.cssPostFix));
|
|
10419
10582
|
form.addEventListener("submit", function (e) {
|
|
10420
10583
|
e.preventDefault();
|
|
10421
|
-
var _this3$generateRespon = _this3.
|
|
10584
|
+
var _this3$generateRespon = _this3.PXZN(_this3.form.elements),
|
|
10422
10585
|
obj = _this3$generateRespon.obj,
|
|
10423
10586
|
callback = _this3$generateRespon.callback;
|
|
10424
10587
|
var evalString = "(obj)=>" + callback + "(obj)";
|
|
@@ -10645,7 +10808,6 @@
|
|
|
10645
10808
|
* height: 20,
|
|
10646
10809
|
* width: 20,
|
|
10647
10810
|
* action: "cancel/dismiss",
|
|
10648
|
-
* shape: "rectangle/circle"
|
|
10649
10811
|
* }
|
|
10650
10812
|
*/
|
|
10651
10813
|
var PIPButton = /*#__PURE__*/function () {
|
|
@@ -10661,7 +10823,6 @@
|
|
|
10661
10823
|
this.height = getNumberOrDefault(data.height, 24);
|
|
10662
10824
|
this.width = getNumberOrDefault(data.width, 24);
|
|
10663
10825
|
this.action = getStringOrDefault(data.action, "dismiss");
|
|
10664
|
-
this.shape = getStringOrDefault(data.shape, "circle");
|
|
10665
10826
|
}
|
|
10666
10827
|
_createClass(PIPButton, null, [{
|
|
10667
10828
|
key: "isEnabled",
|
|
@@ -10713,14 +10874,14 @@
|
|
|
10713
10874
|
* @param {function} showCallback
|
|
10714
10875
|
* @param {function} hideCallback
|
|
10715
10876
|
*/
|
|
10716
|
-
function VideoInApp(config, configId, name, showCallback, _hideCallback) {
|
|
10877
|
+
function VideoInApp(config, terminationConfig, configId, name, showCallback, _hideCallback) {
|
|
10717
10878
|
var _this = this;
|
|
10718
10879
|
_classCallCheck(this, VideoInApp);
|
|
10719
10880
|
/**
|
|
10720
10881
|
* @function showVideoInApp
|
|
10721
10882
|
* @description Shows the video InApp with the configured mode.
|
|
10722
10883
|
*/
|
|
10723
|
-
_defineProperty(this, "
|
|
10884
|
+
_defineProperty(this, "gnAu", function () {
|
|
10724
10885
|
_this.createPlayer();
|
|
10725
10886
|
try {
|
|
10726
10887
|
// In PIP mode, only after the video metadata is loaded, show the PIP.
|
|
@@ -10729,18 +10890,25 @@
|
|
|
10729
10890
|
var hideCallback = _this.hideCallback;
|
|
10730
10891
|
video.onloadedmetadata = function () {
|
|
10731
10892
|
video.disablePictureInPicture = false;
|
|
10732
|
-
video.requestPictureInPicture()
|
|
10893
|
+
video.requestPictureInPicture().then(function () {
|
|
10894
|
+
video.play();
|
|
10895
|
+
})["catch"](function (error) {
|
|
10733
10896
|
Logger.error("Can't show PIP:".concat(error));
|
|
10734
10897
|
hideCallback();
|
|
10735
10898
|
});
|
|
10736
10899
|
};
|
|
10737
10900
|
} else {
|
|
10738
10901
|
// As the video player is hidden by default, unhide if the mode is not PIP.
|
|
10739
|
-
_this.
|
|
10902
|
+
_this.qaRp();
|
|
10740
10903
|
}
|
|
10741
10904
|
_this.showCallback();
|
|
10742
10905
|
} catch (e) {
|
|
10743
10906
|
Logger.error("Can't show video:".concat(e));
|
|
10907
|
+
window.Apxor.logAppEvent("apx_video_inapp_failed", {
|
|
10908
|
+
campaignName: _this.name,
|
|
10909
|
+
id: _this.configId,
|
|
10910
|
+
failureReason: e
|
|
10911
|
+
});
|
|
10744
10912
|
_this.hideCallback();
|
|
10745
10913
|
}
|
|
10746
10914
|
});
|
|
@@ -10751,7 +10919,7 @@
|
|
|
10751
10919
|
* For portrait - width is set to 50% of the screen and height is auto adjusted based on resolution.
|
|
10752
10920
|
* For landscape - height is set to 50% of the screen and width is auto adjusted based on resolution.
|
|
10753
10921
|
*/
|
|
10754
|
-
_defineProperty(this, "
|
|
10922
|
+
_defineProperty(this, "Spyd", function () {
|
|
10755
10923
|
var _getHeightWidthFromRe = getHeightWidthFromResolution(_this.video),
|
|
10756
10924
|
width = _getHeightWidthFromRe.width,
|
|
10757
10925
|
height = _getHeightWidthFromRe.height;
|
|
@@ -10763,7 +10931,7 @@
|
|
|
10763
10931
|
* @private
|
|
10764
10932
|
* @description Removes the video player style element.
|
|
10765
10933
|
*/
|
|
10766
|
-
_defineProperty(this, "
|
|
10934
|
+
_defineProperty(this, "uxBO", function () {
|
|
10767
10935
|
var playerStyles = document.getElementById("apx-mpl-styles");
|
|
10768
10936
|
if (playerStyles) {
|
|
10769
10937
|
playerStyles.remove();
|
|
@@ -10774,52 +10942,146 @@
|
|
|
10774
10942
|
* @private
|
|
10775
10943
|
* @description Attach listeners on the video controls
|
|
10776
10944
|
*/
|
|
10777
|
-
_defineProperty(this, "
|
|
10945
|
+
_defineProperty(this, "LjmO", function () {
|
|
10778
10946
|
// Listener for the video end. Display the CTA's when the video ends.
|
|
10779
10947
|
_this.videoElement.addEventListener("ended", function () {
|
|
10780
10948
|
var ctaButtons = document.getElementById("apx-cta-btn");
|
|
10781
10949
|
if (ctaButtons) {
|
|
10782
10950
|
ctaButtons.classList.remove("apx-video-hide-elmt".concat(_this.cssPostFix));
|
|
10783
10951
|
}
|
|
10952
|
+
if (!document.fullscreenElement) {
|
|
10953
|
+
_this.totalDurationMinimised += Math.round(_this.videoElement.duration) - Math.round(_this.slotStartTime);
|
|
10954
|
+
_this.durationMinimisedSlots.push("".concat(Math.round(_this.videoElement.duration), "-").concat(Math.round(_this.slotStartTime)));
|
|
10955
|
+
} else {
|
|
10956
|
+
_this.totalDurationMaximised += Math.round(_this.videoElement.duration) - Math.round(_this.slotStartTime);
|
|
10957
|
+
_this.durationMaximisedSlots.push("".concat(Math.round(_this.videoElement.duration), "-").concat(Math.round(_this.slotStartTime)));
|
|
10958
|
+
}
|
|
10784
10959
|
});
|
|
10785
10960
|
|
|
10786
10961
|
// Listener for the play button. After the video ended, CTA buttons are shown.
|
|
10787
10962
|
// If the play button is clicked again, the CTA buttons should be removed.
|
|
10788
10963
|
_this.videoElement.addEventListener("play", function () {
|
|
10964
|
+
if (!_this.inAppShown) {
|
|
10965
|
+
// Initialize the fields to keep the track of aditional info required for logging events.
|
|
10966
|
+
_this.minimisedCount = 0;
|
|
10967
|
+
_this.maximisedCount = 0;
|
|
10968
|
+
_this.totalDurationMinimised = 0;
|
|
10969
|
+
_this.totalDurationMaximised = 0;
|
|
10970
|
+
_this.durationMinimisedSlots = [];
|
|
10971
|
+
_this.durationMaximisedSlots = [];
|
|
10972
|
+
_this.volumeClickedCount = 0;
|
|
10973
|
+
_this.slotStartTime = 0; // to tract the start time of the minimize and maximize time slot.
|
|
10974
|
+
_this.slotStartTimeVolumeChange = 0; // to track the start time of the volume change time slot.
|
|
10975
|
+
|
|
10976
|
+
window.Apxor.logAppEvent("inapp_shown", {
|
|
10977
|
+
message_name: _this.name,
|
|
10978
|
+
visibleScreen: location.pathname,
|
|
10979
|
+
inappType: "PIP Inapp",
|
|
10980
|
+
autoReplay: _this.videoElement.loop ? "On" : "Off",
|
|
10981
|
+
defaultSound: _this.videoElement.muted ? "Mute" : "Unmute",
|
|
10982
|
+
id: _this.configId,
|
|
10983
|
+
videoDuration: Math.round(_this.videoElement.duration),
|
|
10984
|
+
videoResolution: "".concat(_this.videoElement.videoWidth, "x").concat(_this.videoElement.videoHeight),
|
|
10985
|
+
videoConfiguration: "Streaming"
|
|
10986
|
+
});
|
|
10987
|
+
_this.inAppShown = true;
|
|
10988
|
+
}
|
|
10989
|
+
if (_this.videoElement.currentTime === 0 || _this.videoElement.currentTime === _this.videoElement.duration) {
|
|
10990
|
+
_this.replayCount++;
|
|
10991
|
+
_this.slotStartTime = 0; // to tract the start time of the minimize and maximize time slot.
|
|
10992
|
+
_this.slotStartTimeVolumeChange = 0; // to track the start time of the volume change time slot.
|
|
10993
|
+
}
|
|
10994
|
+
|
|
10789
10995
|
var ctaButtons = document.getElementById("apx-cta-btn");
|
|
10790
10996
|
if (ctaButtons) {
|
|
10791
10997
|
ctaButtons.classList.add("apx-video-hide-elmt".concat(_this.cssPostFix));
|
|
10792
10998
|
}
|
|
10793
10999
|
});
|
|
11000
|
+
_this.videoElement.addEventListener("fullscreenchange", function () {
|
|
11001
|
+
_this.slotEndTime = _this.videoElement.currentTime;
|
|
11002
|
+
if (document.fullscreenElement) {
|
|
11003
|
+
_this.maximisedCount++;
|
|
11004
|
+
_this.durationMinimised = Math.round(_this.slotEndTime) - Math.round(_this.slotStartTime);
|
|
11005
|
+
_this.totalDurationMinimised += _this.durationMinimised;
|
|
11006
|
+
_this.durationMinimisedSlots.push("".concat(Math.round(_this.slotStartTime), "-").concat(Math.round(_this.slotEndTime)));
|
|
11007
|
+
window.Apxor.logAppEvent("apx_video_inapp_maximised", {
|
|
11008
|
+
message_name: _this.name,
|
|
11009
|
+
durationMinimised: _this.durationMinimised,
|
|
11010
|
+
durationSlotMinimised: "".concat(Math.round(_this.slotStartTime), "-").concat(Math.round(_this.slotEndTime)),
|
|
11011
|
+
id: _this.configId,
|
|
11012
|
+
totalDurationWatched: Math.round(_this.totalDurationMinimised),
|
|
11013
|
+
totalDurationWatchedSlot: _this.durationMinimisedSlots,
|
|
11014
|
+
maximisedCount: _this.maximisedCount
|
|
11015
|
+
});
|
|
11016
|
+
} else {
|
|
11017
|
+
_this.minimisedCount++;
|
|
11018
|
+
_this.durationMaximised = Math.round(_this.slotEndTime) - Math.round(_this.slotStartTime);
|
|
11019
|
+
_this.totalDurationMaximised += _this.durationMaximised;
|
|
11020
|
+
_this.durationMaximisedSlots.push("".concat(Math.round(_this.slotStartTime), "-").concat(Math.round(_this.slotEndTime)));
|
|
11021
|
+
window.Apxor.logAppEvent("apx_video_inapp_minimised", {
|
|
11022
|
+
message_name: _this.name,
|
|
11023
|
+
durationMaximised: _this.durationMaximised,
|
|
11024
|
+
durationSlotMaximised: "".concat(Math.round(_this.slotStartTime), "-").concat(Math.round(_this.slotEndTime)),
|
|
11025
|
+
id: _this.configId,
|
|
11026
|
+
totalDurationWatched: Math.round(_this.totalDurationMaximised),
|
|
11027
|
+
totalDurationWatchedSlot: _this.durationMaximisedSlots,
|
|
11028
|
+
minimisedCount: _this.minimisedCount
|
|
11029
|
+
});
|
|
11030
|
+
}
|
|
11031
|
+
_this.slotStartTime = _this.videoElement.currentTime;
|
|
11032
|
+
});
|
|
11033
|
+
if (!isNaN(_this.slotStartTimeVolumeChange)) {
|
|
11034
|
+
_this.videoElement.addEventListener("volumechange", function () {
|
|
11035
|
+
_this.volumeClickedCount++;
|
|
11036
|
+
window.Apxor.logAppEvent("apx_video_inapp_volume_button_clicked", {
|
|
11037
|
+
message_name: _this.name,
|
|
11038
|
+
id: _this.configId,
|
|
11039
|
+
actionPerformed: _this.videoElement.muted ? "mute" : "unmute",
|
|
11040
|
+
totalDurationWatchedSlot: "".concat(Math.round(_this.slotStartTimeVolumeChange), "-").concat(Math.round(_this.videoElement.currentTime)),
|
|
11041
|
+
totalDurationWatched: Math.round(_this.videoElement.currentTime) - Math.round(_this.slotStartTimeVolumeChange)
|
|
11042
|
+
});
|
|
11043
|
+
_this.slotStartTimeVolumeChange = _this.videoElement.currentTime;
|
|
11044
|
+
});
|
|
11045
|
+
}
|
|
10794
11046
|
});
|
|
10795
11047
|
/**
|
|
10796
11048
|
* @function _setPIPtoggleListeners
|
|
10797
11049
|
* @private
|
|
10798
11050
|
* @description Attach listeners for the PIP toggle. i.e. for the PIP enter and PIP exit
|
|
10799
11051
|
*/
|
|
10800
|
-
_defineProperty(this, "
|
|
10801
|
-
|
|
10802
|
-
if (_this.
|
|
11052
|
+
_defineProperty(this, "mMkN", function () {
|
|
11053
|
+
var _this$terminationConf;
|
|
11054
|
+
if (_this.mode === "PIP" && !((_this$terminationConf = _this.terminationConfig) !== null && _this$terminationConf !== void 0 && _this$terminationConf.auto_dismiss)) {
|
|
10803
11055
|
// On Exit of the PIP,
|
|
10804
|
-
// In PIP mode - Remove the PIP and
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
11056
|
+
// In PIP mode - Remove the PIP and also remove the video player from DOM
|
|
11057
|
+
_this.videoElement.addEventListener("leavepictureinpicture", function () {
|
|
11058
|
+
_this._onClose("web_pip_x_icon_clicked");
|
|
11059
|
+
}, false);
|
|
11060
|
+
} else if (_this.mode === "mini") {
|
|
11061
|
+
if (_this.enable_pip_button) {
|
|
11062
|
+
// On Enter of the PIP,
|
|
11063
|
+
// Hide the video player. It is not a good idea to show both video player and PIP at the same time.
|
|
11064
|
+
var onEnterPip = function onEnterPip() {
|
|
11065
|
+
_this.videoPlayer.classList.add("apx-video-hide-elmt".concat(_this.cssPostFix));
|
|
11066
|
+
};
|
|
11067
|
+
_this.videoElement.addEventListener("enterpictureinpicture", onEnterPip, false);
|
|
11068
|
+
// Enable the PIP toggle listeners only if the config says so.
|
|
11069
|
+
if (_this.pip.enable_toggles) {
|
|
11070
|
+
// On Exit of the PIP,
|
|
11071
|
+
// In Video Player mode(Note that PIP can be opened from video player) - Show the video player. It means that PIP merges to the video player.
|
|
11072
|
+
var onExitPip = function onExitPip() {
|
|
11073
|
+
_this.videoElement.disablePictureInPicture = true;
|
|
11074
|
+
_this.videoPlayer.classList.remove("apx-video-hide-elmt".concat(_this.cssPostFix));
|
|
11075
|
+
};
|
|
11076
|
+
_this.videoElement.addEventListener("leavepictureinpicture", onExitPip, false);
|
|
10811
11077
|
} else {
|
|
10812
|
-
|
|
11078
|
+
// on Exit of the PIP,
|
|
11079
|
+
// when enable_toggles are off then, perform cleanup activities(remove the video player, remove styles and set the correct rtm status.) and log events.
|
|
11080
|
+
_this.videoElement.addEventListener("leavepictureinpicture", function () {
|
|
11081
|
+
_this._onClose("web_pip_x_icon_clicked");
|
|
11082
|
+
}, false);
|
|
10813
11083
|
}
|
|
10814
|
-
}
|
|
10815
|
-
_this.videoElement.addEventListener("leavepictureinpicture", onExitPip, false);
|
|
10816
|
-
|
|
10817
|
-
// On Exit of the PIP,
|
|
10818
|
-
// Hide the video player. It is not a good idea to show both video player and PIP at the same time.
|
|
10819
|
-
var onEnterPip = function onEnterPip() {
|
|
10820
|
-
_this.videoPlayer.classList.add("apx-video-hide-elmt".concat(_this.cssPostFix));
|
|
10821
|
-
};
|
|
10822
|
-
_this.videoElement.addEventListener("enterpictureinpicture", onEnterPip, false);
|
|
11084
|
+
}
|
|
10823
11085
|
}
|
|
10824
11086
|
});
|
|
10825
11087
|
/**
|
|
@@ -10827,7 +11089,7 @@
|
|
|
10827
11089
|
* @private Sets the custom controls on the video player.
|
|
10828
11090
|
* PIP and close are the custom controls that are created and positions on the video.
|
|
10829
11091
|
*/
|
|
10830
|
-
_defineProperty(this, "
|
|
11092
|
+
_defineProperty(this, "WxQw", function () {
|
|
10831
11093
|
_this.enable_close_button;
|
|
10832
11094
|
if (_this.enable_close_button) {
|
|
10833
11095
|
var closeButton = document.createElement("span");
|
|
@@ -10845,19 +11107,16 @@
|
|
|
10845
11107
|
closeButton.classList.add("apx-video-close-btn".concat(_this.cssPostFix));
|
|
10846
11108
|
// On click of the close button, remove the video player, remove styles and set the correct rtm status.
|
|
10847
11109
|
closeButton.addEventListener("click", function () {
|
|
10848
|
-
|
|
10849
|
-
_this.videoPlayer.remove();
|
|
10850
|
-
_this.hideCallback("cancel");
|
|
10851
|
-
_this.erWH();
|
|
10852
|
-
} catch (e) {
|
|
10853
|
-
console.log("Error \n ".concat(e, " \n occured while closing the video"));
|
|
10854
|
-
}
|
|
11110
|
+
_this._onClose();
|
|
10855
11111
|
});
|
|
10856
11112
|
_this.videoPlayer.appendChild(closeButton);
|
|
10857
11113
|
}
|
|
10858
11114
|
if (_this.enable_pip_button) {
|
|
10859
11115
|
var pipButton = document.createElement("span");
|
|
10860
11116
|
pipButton.innerHTML = getPIPSVG(_this.pip_button.width, _this.pip_button.height, _this.pip_button.color);
|
|
11117
|
+
if (_this.pip_button.path) {
|
|
11118
|
+
pipButton.innerHTML = "<img src=\"".concat(_this.pip_button.path, "\" width=\"").concat(_this.pip_button.width, "px\" height=\"").concat(_this.pip_button.height, "px\"></img>");
|
|
11119
|
+
}
|
|
10861
11120
|
pipButton.classList.add("apx-video-pip-btn".concat(_this.cssPostFix));
|
|
10862
11121
|
// PIP button click listener.
|
|
10863
11122
|
// To remove the default PIP option of the video element, PIP is disabled.
|
|
@@ -10877,32 +11136,35 @@
|
|
|
10877
11136
|
* @function hideVideoPlayer
|
|
10878
11137
|
* @description Sets the visibility of the video player to hidden.
|
|
10879
11138
|
*/
|
|
10880
|
-
_defineProperty(this, "
|
|
11139
|
+
_defineProperty(this, "GVEZ", function () {
|
|
10881
11140
|
_this.videoPlayer.classList.add("apx-video-hide-elmt".concat(_this.cssPostFix));
|
|
10882
11141
|
});
|
|
10883
11142
|
/**
|
|
10884
11143
|
* @function unhideVideoPlayer
|
|
10885
11144
|
* @description Unhides video player.
|
|
10886
11145
|
*/
|
|
10887
|
-
_defineProperty(this, "
|
|
11146
|
+
_defineProperty(this, "qaRp", function () {
|
|
10888
11147
|
_this.videoPlayer.classList.remove("apx-video-hide-elmt".concat(_this.cssPostFix));
|
|
10889
11148
|
});
|
|
10890
11149
|
/**
|
|
10891
11150
|
* @function getVideoElement
|
|
10892
11151
|
* @returns {HTMLElement} Video ekement
|
|
10893
11152
|
*/
|
|
10894
|
-
_defineProperty(this, "
|
|
11153
|
+
_defineProperty(this, "qKZl", function () {
|
|
10895
11154
|
return _this.videoElement;
|
|
10896
11155
|
});
|
|
10897
11156
|
this.videoPlayer = null;
|
|
10898
11157
|
this.videoElement = null;
|
|
10899
11158
|
this.showCallback = showCallback;
|
|
11159
|
+
this.terminationConfig = terminationConfig;
|
|
10900
11160
|
this.hideCallback = _hideCallback;
|
|
10901
11161
|
this.height = 320;
|
|
10902
11162
|
this.width = 320;
|
|
10903
11163
|
this.configId = configId;
|
|
10904
11164
|
this.name = name || "VideoPlayer";
|
|
10905
11165
|
this.cssPostFix = "-".concat(this.configId, "-").concat(this.name).replaceAll(" ", "").replace(/[^\w\s]/gi, "");
|
|
11166
|
+
this.replayCount = 0;
|
|
11167
|
+
this.inAppShown = false; // This boolean restricts the "inapp_shown" event from logging multiple times.
|
|
10906
11168
|
|
|
10907
11169
|
/********************************Configs*********************************************************/
|
|
10908
11170
|
this.videoConfig = config;
|
|
@@ -10937,10 +11199,10 @@
|
|
|
10937
11199
|
//Create a container for the video player and add the styles
|
|
10938
11200
|
this.videoPlayer = document.createElement("div");
|
|
10939
11201
|
this.videoPlayer.setAttribute("id", "apx-video-player");
|
|
10940
|
-
this.videoPlayer.style =
|
|
11202
|
+
this.videoPlayer.style.backgroundColor = this.bg_color;
|
|
10941
11203
|
|
|
10942
11204
|
// Video has a resolution, not deviating from the resolution set the height and width.
|
|
10943
|
-
this.
|
|
11205
|
+
this.Spyd();
|
|
10944
11206
|
//Generate the styles and add them to the document head.
|
|
10945
11207
|
this._setVideoPlayerStyles();
|
|
10946
11208
|
//Set the position of the video player with in the 5 possible positions.
|
|
@@ -10948,16 +11210,18 @@
|
|
|
10948
11210
|
//Create a video element,set the source and add to the container.
|
|
10949
11211
|
this._setPlayerContent();
|
|
10950
11212
|
//Set the listeners on the video control buttons.
|
|
10951
|
-
this.
|
|
11213
|
+
this.LjmO();
|
|
10952
11214
|
//Attach listeners for the PIP toggle. i.e. for the PIP enter and PIP exit
|
|
10953
|
-
this.
|
|
11215
|
+
this.mMkN();
|
|
10954
11216
|
//Set the custom close and PIP controls. Not using the defaults from the html video element.
|
|
10955
11217
|
//Reason - We want to position them at the top right and left positions.
|
|
10956
|
-
this.
|
|
11218
|
+
this.WxQw();
|
|
10957
11219
|
//Generate and postion the CTA buttons on the video. By default hidden, visible only when video is completed
|
|
10958
11220
|
this._setButtons(BUTTON_CONTAINER_POSITION.CENTER);
|
|
10959
11221
|
//Hide the video player. Display it based on the video mode. Videoplayer for "video" mode and a direct PIP for "PIP" mode.
|
|
10960
|
-
this.
|
|
11222
|
+
this.GVEZ();
|
|
11223
|
+
//If the auto dismiss is enabled, sets the timeout to call the InApp close.
|
|
11224
|
+
this._setAutoTerminate();
|
|
10961
11225
|
document.body.appendChild(this.videoPlayer);
|
|
10962
11226
|
}
|
|
10963
11227
|
}, {
|
|
@@ -10972,10 +11236,11 @@
|
|
|
10972
11236
|
var playerStyles = document.getElementById("apx-mpl-styles");
|
|
10973
11237
|
// If the styles are already added to the customers website, do not re-add.
|
|
10974
11238
|
if (!playerStyles) {
|
|
10975
|
-
var _this$close_button, _this$close_button2;
|
|
10976
11239
|
var styleElement = document.createElement("style");
|
|
10977
11240
|
styleElement.setAttribute("id", "apx-mpl-styles");
|
|
10978
|
-
|
|
11241
|
+
var pipButtonStyles = this.enable_pip_button ? "\n width: ".concat(this.pip_button.width, "px;\n height: ").concat(this.pip_button.height, "px;\n ") : "";
|
|
11242
|
+
var closeButtonStyles = this.enable_close_button ? "\n top: ".concat(this.close_button.offset_top, "px;\n right: ").concat(this.close_button.offset_right, "px;\n ") : "";
|
|
11243
|
+
styleElement.innerHTML = "\n #apx-video-player {\n width: ".concat(this.width, "px;\n height: ").concat(this.height, "px;\n }\n\n div.apx-video-player").concat(this.cssPostFix, "--topLeft {\n position: fixed;\n top: 0;\n left: 0;\n background-color: ").concat(COLORS.BLACK, ";\n z-index:99999999;\n }\n \n div.apx-video-player").concat(this.cssPostFix, "--topRight {\n position: fixed;\n top: 0;\n right: 0;\n background-color: ").concat(COLORS.BLACK, ";\n z-index:99999999;\n }\n \n div.apx-video-player").concat(this.cssPostFix, "--bottomLeft {\n position: fixed;\n bottom: 0;\n left: 0;\n background-color: ").concat(COLORS.BLACK, ";\n z-index:99999999;\n }\n \n div.apx-video-player").concat(this.cssPostFix, "--bottomRight {\n position: fixed;\n bottom: 0;\n right: 0;\n background-color: ").concat(COLORS.BLACK, ";\n z-index:99999999;\n }\n\n div.apx-video-player").concat(this.cssPostFix, "--center {\n position: fixed;\n left: 50%;\n top: 50%;\n background-color: ").concat(COLORS.BLACK, ";\n transform: translate(-50%, -50%);\n z-index:99999999;\n }\n .apx-video-hide-elmt").concat(this.cssPostFix, " {\n display : none;\n }\n\n #apx-cta-btn.apx-video-hide-elmt").concat(this.cssPostFix, " {\n display : none;\n }\n\n .apx-video-pip-btn").concat(this.cssPostFix, " {\n position: absolute;\n top: 10px;\n left: 10px;\n opacity: 0.3;\n transition: opacity .3s ease;\n cursor: pointer;\n ").concat(pipButtonStyles, "\n }\n\n video:hover~.apx-video-pip-btn").concat(this.cssPostFix, " {\n opacity: 1;\n }\n \n .apx-video-close-btn").concat(this.cssPostFix, " {\n position: absolute;\n opacity: 0.3;\n transition: opacity .3s ease;\n cursor: pointer;\n ").concat(closeButtonStyles, "\n }\n\n video:hover~.apx-video-close-btn").concat(this.cssPostFix, " {\n opacity: 1;\n }\n\n .apx-video-cta").concat(this.cssPostFix, " {\n position: absolute;\n top: 50%;\n left: 50%;\n -webkit-transform: translate(-50%, -50%);\n -moz-transform: translate(-50%, -50%);\n width: auto;\n height: auto;\n transition: opacity .3s ease;\n cursor: pointer;\n }\n \n .bi::before,\n [class^=\"bi-\"]::before,\n [class*=\" bi-\"]::before {\n display: inline-block;\n font-style: normal;\n font-weight: normal !important;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n vertical-align: -.125em;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n \n .bi-pip::before { \n content: \"\f4ef\"; \n }\n\n .bi-x-circle::before { \n content: \"\f623\"; \n }\n\n ");
|
|
10979
11244
|
document.head.appendChild(styleElement);
|
|
10980
11245
|
}
|
|
10981
11246
|
}
|
|
@@ -11003,6 +11268,9 @@
|
|
|
11003
11268
|
case INAPP_POSITION.BOTTOM_RIGHT:
|
|
11004
11269
|
this.videoPlayer.classList.add("apx-video-player".concat(this.cssPostFix, "--bottomRight"));
|
|
11005
11270
|
break;
|
|
11271
|
+
case INAPP_POSITION.CENTER:
|
|
11272
|
+
this.videoPlayer.classList.add("apx-video-player".concat(this.cssPostFix, "--center"));
|
|
11273
|
+
break;
|
|
11006
11274
|
default:
|
|
11007
11275
|
this.videoPlayer.classList.add("apx-video-player".concat(this.cssPostFix, "--bottomRight"));
|
|
11008
11276
|
break;
|
|
@@ -11021,13 +11289,14 @@
|
|
|
11021
11289
|
this.videoElement = document.createElement("video");
|
|
11022
11290
|
this.videoElement.width = this.width;
|
|
11023
11291
|
this.videoElement.height = this.height;
|
|
11024
|
-
this.videoElement.
|
|
11292
|
+
this.videoElement.style.objectFit = "fill";
|
|
11293
|
+
this.videoElement.controlsList = "nodownload";
|
|
11025
11294
|
this.videoElement.controls = true;
|
|
11026
11295
|
// By default disable the PIP. This is a hack to remove the default PIP option.
|
|
11027
11296
|
// We want to have our own PIP button. On click of that button PIP will be enabled.
|
|
11028
11297
|
this.videoElement.disablePictureInPicture = true;
|
|
11029
11298
|
this.videoElement.autoplay = true;
|
|
11030
|
-
if (this.video.enable_audio) {
|
|
11299
|
+
if (!this.video.enable_audio) {
|
|
11031
11300
|
this.videoElement.muted = true;
|
|
11032
11301
|
}
|
|
11033
11302
|
// Create a video source.
|
|
@@ -11039,25 +11308,84 @@
|
|
|
11039
11308
|
this.videoPlayer.appendChild(this.videoElement);
|
|
11040
11309
|
}
|
|
11041
11310
|
}, {
|
|
11042
|
-
key: "
|
|
11311
|
+
key: "_onClose",
|
|
11043
11312
|
value:
|
|
11313
|
+
/**
|
|
11314
|
+
* @function _onClose
|
|
11315
|
+
* @private
|
|
11316
|
+
* @description Performs cleanup activities and log events on close of the mini player
|
|
11317
|
+
* @param {string} closeButtonName
|
|
11318
|
+
*/
|
|
11319
|
+
function _onClose() {
|
|
11320
|
+
var closeButtonName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "web_minimise_x_clicked";
|
|
11321
|
+
try {
|
|
11322
|
+
if (!document.fullscreenElement) {
|
|
11323
|
+
this.totalDurationMinimised += Math.round(this.videoElement.currentTime) - Math.round(this.slotStartTime);
|
|
11324
|
+
this.durationMinimisedSlots.push("".concat(Math.round(this.videoElement.currentTime), "-").concat(Math.round(this.slotStartTime)));
|
|
11325
|
+
} else {
|
|
11326
|
+
this.totalDurationMaximised += Math.round(this.videoElement.currentTime) - Math.round(this.slotStartTime);
|
|
11327
|
+
this.durationMaximisedSlots.push("".concat(Math.round(this.videoElement.currentTime), "-").concat(Math.round(this.slotStartTime)));
|
|
11328
|
+
}
|
|
11329
|
+
this.videoPlayer.remove();
|
|
11330
|
+
this.uxBO();
|
|
11331
|
+
if (closeButtonName !== "auto_dismiss") {
|
|
11332
|
+
window.Apxor.logAppEvent("apx_video_inapp_close_button_clicked", {
|
|
11333
|
+
message_name: this.name,
|
|
11334
|
+
id: this.configId,
|
|
11335
|
+
totalDurationWatchedSlot: "0-".concat(Math.round(this.videoElement.currentTime)),
|
|
11336
|
+
totalDurationWatched: Math.round(this.videoElement.currentTime),
|
|
11337
|
+
closeButtonName: closeButtonName
|
|
11338
|
+
});
|
|
11339
|
+
}
|
|
11340
|
+
window.Apxor.logAppEvent("apx_inapp_dismissed", {
|
|
11341
|
+
campaignName: this.name,
|
|
11342
|
+
id: this.configId,
|
|
11343
|
+
totalDurationWatched: Math.round(this.videoElement.currentTime),
|
|
11344
|
+
totalDurationWatchedSlot: "0-".concat(Math.round(this.videoElement.currentTime)),
|
|
11345
|
+
totalReplayCount: this.replayCount,
|
|
11346
|
+
totalMinimiseCount: this.minimisedCount,
|
|
11347
|
+
totalMaximiseCount: this.maximisedCount,
|
|
11348
|
+
totalDurationMinimised: Math.round(this.totalDurationMinimised),
|
|
11349
|
+
totalDurationMaximised: Math.round(this.totalDurationMaximised),
|
|
11350
|
+
dismissType: closeButtonName,
|
|
11351
|
+
volumeClickedCount: this.volumeClickedCount,
|
|
11352
|
+
inappType: "PIP Inapp",
|
|
11353
|
+
apx_completed: this.videoElement.currentTime === this.videoElement.duration ? true : false,
|
|
11354
|
+
apx_completion_percentage: this.videoElement.currentTime / this.videoElement.duration
|
|
11355
|
+
});
|
|
11356
|
+
this.hideCallback("cancel");
|
|
11357
|
+
} catch (e) {
|
|
11358
|
+
console.log("Error \n ".concat(e, " \n occured while closing the video"));
|
|
11359
|
+
}
|
|
11360
|
+
}
|
|
11361
|
+
|
|
11044
11362
|
/**
|
|
11045
11363
|
* @function _setButtons
|
|
11046
11364
|
* @private
|
|
11047
11365
|
* @description Generate the Button's and append them to the specified button container.
|
|
11048
11366
|
*
|
|
11049
11367
|
*/
|
|
11050
|
-
|
|
11368
|
+
}, {
|
|
11369
|
+
key: "_setButtons",
|
|
11370
|
+
value: function _setButtons(position) {
|
|
11051
11371
|
var _this2 = this;
|
|
11052
11372
|
if (!this.enable_buttons) {
|
|
11053
11373
|
return;
|
|
11054
11374
|
}
|
|
11055
|
-
if (
|
|
11056
|
-
var removeCallback = function removeCallback() {
|
|
11375
|
+
if (this.buttons.enable_top || this.buttons.enable_center || this.buttons.enable_bottom) {
|
|
11376
|
+
var removeCallback = function removeCallback(isCancel, action, index) {
|
|
11057
11377
|
try {
|
|
11378
|
+
window.Apxor.logAppEvent("apx_video_inapp_button_clicked", {
|
|
11379
|
+
buttonName: _this2.buttons.center.at(index).text.text,
|
|
11380
|
+
redirection: _this2.buttons.center.at(index).action.type,
|
|
11381
|
+
totalDurationWatched: Math.round(_this2.videoElement.currentTime),
|
|
11382
|
+
message_name: _this2.name,
|
|
11383
|
+
id: _this2.configId,
|
|
11384
|
+
totalDurationWatchedSlot: "0-".concat(Math.round(_this2.videoElement.currentTime))
|
|
11385
|
+
});
|
|
11058
11386
|
_this2.videoPlayer.remove();
|
|
11387
|
+
_this2.uxBO();
|
|
11059
11388
|
_this2.hideCallback();
|
|
11060
|
-
_this2.erWH();
|
|
11061
11389
|
} catch (e) {
|
|
11062
11390
|
console.log("Can't close the video player\n".concat(e));
|
|
11063
11391
|
}
|
|
@@ -11071,9 +11399,9 @@
|
|
|
11071
11399
|
action: ""
|
|
11072
11400
|
};
|
|
11073
11401
|
var buttons_config = {};
|
|
11074
|
-
if (
|
|
11402
|
+
if (this.buttons.top.length > 0) {
|
|
11075
11403
|
buttons_config = this.buttons.top;
|
|
11076
|
-
} else if (
|
|
11404
|
+
} else if (this.buttons.center.length > 0) {
|
|
11077
11405
|
buttons_config = this.buttons.center;
|
|
11078
11406
|
} else {
|
|
11079
11407
|
buttons_config = this.buttons.bottom;
|
|
@@ -11085,6 +11413,27 @@
|
|
|
11085
11413
|
this.videoPlayer.appendChild(buttons);
|
|
11086
11414
|
}
|
|
11087
11415
|
}
|
|
11416
|
+
}, {
|
|
11417
|
+
key: "_setAutoTerminate",
|
|
11418
|
+
value:
|
|
11419
|
+
/**
|
|
11420
|
+
* @function _setAutoTerminate
|
|
11421
|
+
* @private
|
|
11422
|
+
* @description If the auto dismiss is enabled, sets the timeout to call the InApp close.
|
|
11423
|
+
*/
|
|
11424
|
+
function _setAutoTerminate() {
|
|
11425
|
+
var _this$terminationConf2,
|
|
11426
|
+
_this3 = this;
|
|
11427
|
+
if (((_this$terminationConf2 = this.terminationConfig) === null || _this$terminationConf2 === void 0 ? void 0 : _this$terminationConf2.auto_dismiss) === true) {
|
|
11428
|
+
window.setTimeout(function () {
|
|
11429
|
+
if (document.pictureInPictureEnabled && document.pictureInPictureElement) {
|
|
11430
|
+
_this3.videoElement.pause();
|
|
11431
|
+
document.exitPictureInPicture();
|
|
11432
|
+
}
|
|
11433
|
+
_this3._onClose("auto_dismiss");
|
|
11434
|
+
}, this.terminationConfig.duration);
|
|
11435
|
+
}
|
|
11436
|
+
}
|
|
11088
11437
|
}], [{
|
|
11089
11438
|
key: "isAVideoBeingPlayed",
|
|
11090
11439
|
value: function isAVideoBeingPlayed() {
|
|
@@ -11123,13 +11472,13 @@
|
|
|
11123
11472
|
var RTM = /*#__PURE__*/_createClass(function RTM() {
|
|
11124
11473
|
var _this = this;
|
|
11125
11474
|
_classCallCheck(this, RTM);
|
|
11126
|
-
_defineProperty(this, "
|
|
11475
|
+
_defineProperty(this, "xtAP", {});
|
|
11127
11476
|
_defineProperty(this, "isShowingAction", false);
|
|
11128
11477
|
_defineProperty(this, "currentAction", null);
|
|
11129
|
-
_defineProperty(this, "version",
|
|
11478
|
+
_defineProperty(this, "version", 10);
|
|
11130
11479
|
_defineProperty(this, "isInitialised", false);
|
|
11131
11480
|
_defineProperty(this, "_eventsInDynamicText", {});
|
|
11132
|
-
_defineProperty(this, "
|
|
11481
|
+
_defineProperty(this, "ILce", function () {
|
|
11133
11482
|
_this.isInitialised = true;
|
|
11134
11483
|
var oldPushState = history.pushState;
|
|
11135
11484
|
history.pushState = function pushState() {
|
|
@@ -11154,7 +11503,7 @@
|
|
|
11154
11503
|
});
|
|
11155
11504
|
_defineProperty(this, "show", function (uiJson, duration, uuid, name) {
|
|
11156
11505
|
if (!_this.isInitialised) {
|
|
11157
|
-
_this.
|
|
11506
|
+
_this.ILce();
|
|
11158
11507
|
}
|
|
11159
11508
|
try {
|
|
11160
11509
|
// console.log("Showing action for uuid:", uuid, uiJson, this.currentAction);
|
|
@@ -11178,29 +11527,32 @@
|
|
|
11178
11527
|
}, terminationConfig, function () {
|
|
11179
11528
|
_this.isShowingAction = true;
|
|
11180
11529
|
if (window.Apxor && window.Apxor.logActionEvent) {
|
|
11530
|
+
var _window, _window$Apxor;
|
|
11531
|
+
(_window = window) === null || _window === void 0 ? void 0 : (_window$Apxor = _window.Apxor) === null || _window$Apxor === void 0 ? void 0 : _window$Apxor.updateFlag(true);
|
|
11181
11532
|
window.Apxor.logActionEvent("inline_shown", uuid, name);
|
|
11182
|
-
window.Apxor && window.Apxor.updateFlag && window.Apxor.updateFlag(true);
|
|
11183
11533
|
}
|
|
11184
11534
|
}, function () {
|
|
11535
|
+
var _window2, _window2$Apxor;
|
|
11185
11536
|
_this.isShowingAction = false;
|
|
11537
|
+
(_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Apxor = _window2.Apxor) === null || _window2$Apxor === void 0 ? void 0 : _window2$Apxor.updateFlag(false);
|
|
11538
|
+
_this.currentAction = null;
|
|
11186
11539
|
if (window.Apxor && window.Apxor.logActionEvent) {
|
|
11187
11540
|
window.Apxor.logActionEvent("inline_dismissed", uuid, name);
|
|
11188
11541
|
}
|
|
11189
|
-
_this.currentAction = null;
|
|
11190
|
-
window.Apxor && window.Apxor.updateFlag && window.Apxor.updateFlag(false);
|
|
11191
11542
|
}, function (callback) {
|
|
11192
11543
|
_this.currentAction = callback;
|
|
11193
11544
|
});
|
|
11194
11545
|
}
|
|
11195
11546
|
} catch (e) {
|
|
11196
|
-
var
|
|
11547
|
+
var _window3, _window3$Apxor;
|
|
11197
11548
|
_this.isShowingAction = false;
|
|
11198
|
-
(
|
|
11549
|
+
(_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$Apxor = _window3.Apxor) === null || _window3$Apxor === void 0 ? void 0 : _window3$Apxor.updateFlag(false);
|
|
11199
11550
|
console.error(e);
|
|
11200
11551
|
}
|
|
11201
11552
|
});
|
|
11202
11553
|
_defineProperty(this, "removeAll", function () {
|
|
11203
|
-
|
|
11554
|
+
var _window4, _window4$Apxor;
|
|
11555
|
+
(_window4 = window) === null || _window4 === void 0 ? void 0 : (_window4$Apxor = _window4.Apxor) === null || _window4$Apxor === void 0 ? void 0 : _window4$Apxor.updateFlag(false);
|
|
11204
11556
|
if (_this.currentAction !== null && _this.currentAction !== undefined) {
|
|
11205
11557
|
_this.isShowingAction = false;
|
|
11206
11558
|
try {
|
|
@@ -11210,7 +11562,7 @@
|
|
|
11210
11562
|
} catch (e) {}
|
|
11211
11563
|
}
|
|
11212
11564
|
});
|
|
11213
|
-
_defineProperty(this, "createInAppVideo", function (config, configId, name) {
|
|
11565
|
+
_defineProperty(this, "createInAppVideo", function (config, duration, configId, name) {
|
|
11214
11566
|
var videoConfig = JSON.parse(config);
|
|
11215
11567
|
if (VideoInApp.isAVideoBeingPlayed()) {
|
|
11216
11568
|
return;
|
|
@@ -11218,21 +11570,26 @@
|
|
|
11218
11570
|
if (!VideoInApp.canShowVideoInApp(videoConfig)) {
|
|
11219
11571
|
return;
|
|
11220
11572
|
}
|
|
11221
|
-
var
|
|
11573
|
+
var terminationConfig = {};
|
|
11574
|
+
terminationConfig["auto_dismiss"] = duration > 0;
|
|
11575
|
+
terminationConfig["duration"] = duration;
|
|
11576
|
+
var VideoInAppInstance = new VideoInApp(videoConfig, terminationConfig, configId, name, function () {
|
|
11222
11577
|
_this.isShowingAction = true;
|
|
11223
11578
|
if (window.Apxor && window.Apxor.logActionEvent) {
|
|
11579
|
+
var _window5, _window5$Apxor;
|
|
11580
|
+
(_window5 = window) === null || _window5 === void 0 ? void 0 : (_window5$Apxor = _window5.Apxor) === null || _window5$Apxor === void 0 ? void 0 : _window5$Apxor.updateFlag(true);
|
|
11224
11581
|
window.Apxor.logActionEvent("inapp_shown", configId, name);
|
|
11225
|
-
window.Apxor && window.Apxor.updateFlag && window.Apxor.updateFlag(true);
|
|
11226
11582
|
}
|
|
11227
11583
|
}, function () {
|
|
11584
|
+
var _window6, _window6$Apxor;
|
|
11228
11585
|
_this.isShowingAction = false;
|
|
11586
|
+
_this.currentAction = null;
|
|
11587
|
+
(_window6 = window) === null || _window6 === void 0 ? void 0 : (_window6$Apxor = _window6.Apxor) === null || _window6$Apxor === void 0 ? void 0 : _window6$Apxor.updateFlag(false);
|
|
11229
11588
|
if (window.Apxor && window.Apxor.logActionEvent) {
|
|
11230
11589
|
window.Apxor.logActionEvent("inapp_dismissed", configId, name);
|
|
11231
11590
|
}
|
|
11232
|
-
_this.currentAction = null;
|
|
11233
|
-
window.Apxor && window.Apxor.updateFlag && window.Apxor.updateFlag(false);
|
|
11234
11591
|
});
|
|
11235
|
-
VideoInAppInstance.
|
|
11592
|
+
VideoInAppInstance.gnAu();
|
|
11236
11593
|
});
|
|
11237
11594
|
/**
|
|
11238
11595
|
* Creates a modal for the given config and displays it.
|
|
@@ -11243,27 +11600,31 @@
|
|
|
11243
11600
|
* @param {function} showCallback
|
|
11244
11601
|
* @param {function} closeCallback
|
|
11245
11602
|
*/
|
|
11246
|
-
_defineProperty(this, "createInAppModal", function (inappconfig, configId, name) {
|
|
11603
|
+
_defineProperty(this, "createInAppModal", function (inappconfig, duration, configId, name) {
|
|
11247
11604
|
var config = JSON.parse(inappconfig);
|
|
11248
|
-
var
|
|
11605
|
+
var terminationConfig = {};
|
|
11606
|
+
terminationConfig["auto_dismiss"] = duration > 0;
|
|
11607
|
+
terminationConfig["duration"] = duration;
|
|
11608
|
+
var inappModal = new ModalInApp(config, terminationConfig, configId, name, function () {
|
|
11249
11609
|
_this.isShowingAction = true;
|
|
11250
11610
|
if (window.Apxor && window.Apxor.logActionEvent) {
|
|
11611
|
+
var _window7, _window7$Apxor;
|
|
11612
|
+
(_window7 = window) === null || _window7 === void 0 ? void 0 : (_window7$Apxor = _window7.Apxor) === null || _window7$Apxor === void 0 ? void 0 : _window7$Apxor.updateFlag(true);
|
|
11251
11613
|
window.Apxor.logActionEvent("inapp_shown", configId, name);
|
|
11252
|
-
window.Apxor && window.Apxor.updateFlag && window.Apxor.updateFlag(true);
|
|
11253
11614
|
}
|
|
11254
11615
|
}, function (backgroundDiv, action) {
|
|
11255
|
-
var _dialogContent$classL;
|
|
11616
|
+
var _dialogContent$classL, _window8, _window8$Apxor;
|
|
11256
11617
|
var cssClass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ".apx-dlg-c";
|
|
11257
11618
|
var dialogContent = document.querySelector(cssClass);
|
|
11258
11619
|
dialogContent === null || dialogContent === void 0 ? void 0 : (_dialogContent$classL = dialogContent.classList) === null || _dialogContent$classL === void 0 ? void 0 : _dialogContent$classL.toggle("open");
|
|
11259
11620
|
// setTimeout(() => {
|
|
11260
11621
|
backgroundDiv.remove();
|
|
11261
11622
|
_this.isShowingAction = false;
|
|
11623
|
+
(_window8 = window) === null || _window8 === void 0 ? void 0 : (_window8$Apxor = _window8.Apxor) === null || _window8$Apxor === void 0 ? void 0 : _window8$Apxor.updateFlag(false);
|
|
11624
|
+
_this.currentAction = null;
|
|
11262
11625
|
if (window.Apxor && window.Apxor.logActionEvent) {
|
|
11263
11626
|
window.Apxor.logActionEvent("inapp_dismissed", configId, name);
|
|
11264
11627
|
}
|
|
11265
|
-
_this.currentAction = null;
|
|
11266
|
-
window.Apxor && window.Apxor.updateFlag && window.Apxor.updateFlag(false);
|
|
11267
11628
|
}, function () {}, false, [], 0);
|
|
11268
11629
|
inappModal.createInAppModal();
|
|
11269
11630
|
});
|