@subiz/widget-v4 4.1.141 → 4.1.142
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/assets/img/stars_v2.png +0 -0
- package/assets/less/form-page.less +1 -1
- package/assets/less/form.less +79 -0
- package/compiled_src/form/Form.js +19 -5
- package/compiled_src/form/rating-stars.js +129 -0
- package/package.json +1 -1
- package/src/chatbox/FormAttachment2.js +83 -0
- package/src/form/Form.js +54 -36
- package/src/form/FormPage.js +81 -1
- package/src/form/rating-stars.js +89 -0
- package/compiled_src/store/store.js +0 -1257
- package/compiled_src/util/campaign.js +0 -88
- package/compiled_src/util/common.js +0 -1294
- package/compiled_src/util/common.test.js +0 -496
- package/compiled_src/util/extractor.test.js +0 -299
- package/compiled_src/util/gate.js +0 -38
- package/compiled_src/util/gate.test.js +0 -18
- package/compiled_src/util/index.js +0 -20
- package/compiled_src/util/mutex.js +0 -31
- package/compiled_src/util/op.js +0 -55
- package/compiled_src/util/pubsub.js +0 -29
- package/compiled_src/util/pubsub.test.js +0 -35
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.trackAreaClicked = trackAreaClicked;
|
|
7
|
-
exports.trackExitIntent = trackExitIntent;
|
|
8
|
-
exports.trackInactivity = trackInactivity;
|
|
9
|
-
exports.trackScrollingPercentage = trackScrollingPercentage;
|
|
10
|
-
exports.trackTimeOnPage = trackTimeOnPage;
|
|
11
|
-
var common = require('./common.js');
|
|
12
|
-
function trackExitIntent(cb) {
|
|
13
|
-
let handler = e => {
|
|
14
|
-
if (e.clientY > 10) return;
|
|
15
|
-
if (cb) cb();
|
|
16
|
-
document.removeEventListener('mouseout', handler);
|
|
17
|
-
};
|
|
18
|
-
document.addEventListener('mouseout', handler);
|
|
19
|
-
}
|
|
20
|
-
function trackScrollingPercentage(percent, cb) {
|
|
21
|
-
let handleScroll = e => {
|
|
22
|
-
let scrollTop = e.srcElement.scrollingElement ? e.srcElement.scrollingElement.scrollTop : e.srcElement.scrollTop;
|
|
23
|
-
let scrollHeight = e.srcElement.scrollingElement ? e.srcElement.scrollingElement.scrollHeight : e.srcElement.scrollHeight;
|
|
24
|
-
if (scrollTop > 0 && scrollHeight > 0 && (scrollTop + window.innerHeight) / scrollHeight >= percent) {
|
|
25
|
-
if (cb) cb();
|
|
26
|
-
window.removeEventListener('scroll', handleScroll, false);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
window.addEventListener('scroll', handleScroll, false);
|
|
30
|
-
}
|
|
31
|
-
function trackAreaClicked(selector, cb) {
|
|
32
|
-
if (!selector) return;
|
|
33
|
-
selector = selector || '';
|
|
34
|
-
common.map(selector.split('\n'), selector => {
|
|
35
|
-
selector = common.trim(selector);
|
|
36
|
-
if (!selector) return;
|
|
37
|
-
on('click', selector, cb);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function trackInactivity(seconds = 0, cb) {
|
|
41
|
-
let events = ['scroll', 'keyup', 'keydown', 'mousemove', 'mousewheel', 'mouseenter', 'mouseover', 'mousedown', 'touchstart', 'touchmove', 'touchenter'];
|
|
42
|
-
let inactiveSeconds = 0;
|
|
43
|
-
let resetTime = () => {
|
|
44
|
-
inactiveSeconds = 0;
|
|
45
|
-
};
|
|
46
|
-
let timer = common.setInterval(() => {
|
|
47
|
-
inactiveSeconds++;
|
|
48
|
-
if (inactiveSeconds < seconds) return;
|
|
49
|
-
if (cb) cb();
|
|
50
|
-
for (let ev of events) {
|
|
51
|
-
document.removeEventListener(ev, resetTime, false);
|
|
52
|
-
}
|
|
53
|
-
common.clearInterval(timer);
|
|
54
|
-
}, 1000);
|
|
55
|
-
for (let ev of events) {
|
|
56
|
-
document.addEventListener(ev, resetTime, false);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
let _pageLoaded = common.Date.now();
|
|
60
|
-
function trackTimeOnPage(seconds = 0, cb) {
|
|
61
|
-
if (seconds < 1) {
|
|
62
|
-
return common.setTimeout(function () {
|
|
63
|
-
cb(seconds);
|
|
64
|
-
}, 100);
|
|
65
|
-
}
|
|
66
|
-
let timer = common.setInterval(() => {
|
|
67
|
-
let timeOnPage = (common.Date.now() - _pageLoaded) / 1000;
|
|
68
|
-
if (timeOnPage < seconds) return;
|
|
69
|
-
if (cb) cb(timeOnPage);
|
|
70
|
-
common.clearInterval(timer);
|
|
71
|
-
}, 200);
|
|
72
|
-
}
|
|
73
|
-
function on(eventName, selector, fn) {
|
|
74
|
-
document.addEventListener(eventName, function (event) {
|
|
75
|
-
let possibleTargets = document.querySelectorAll(selector);
|
|
76
|
-
let target = event.target;
|
|
77
|
-
for (let i = 0, l = possibleTargets.length; i < l; i++) {
|
|
78
|
-
let el = target;
|
|
79
|
-
let p = possibleTargets[i];
|
|
80
|
-
while (el && el !== document) {
|
|
81
|
-
if (el === p) {
|
|
82
|
-
return fn.call(p, event);
|
|
83
|
-
}
|
|
84
|
-
el = el.parentNode;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|