@subiz/widget-v4 4.1.40 → 4.1.41
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/compiled_src/lib.js +4 -0
- package/compiled_src/plugin.js +1 -2
- package/compiled_src/store/store.js +26 -6
- package/compiled_src/util/campaign.js +2 -6
- package/compiled_src/util/common.js +2 -6
- package/compiled_src/util/order.js +2 -4
- package/compiled_src/util/pubsub.js +3 -6
- package/dist/132.js +531 -525
- package/dist/18a3a577516.132.js +1 -0
- package/dist/18a3a577516.213.js +1 -0
- package/dist/18a3a577516.335.js +1 -0
- package/dist/{18a02a9c54e.362.js → 18a3a577516.362.js} +1 -1
- package/dist/18a3a577516.441.js +1 -0
- package/dist/18a3a577516.605.js +1 -0
- package/dist/{18a02a9c54e.782.js → 18a3a577516.782.js} +1 -1
- package/dist/18a3a577516.app.js +1 -0
- package/dist/{18a02a9c54e.index.html → 18a3a577516.index.html} +4 -4
- package/dist/{18a02a9c54e.library.html → 18a3a577516.library.html} +4 -4
- package/dist/18a3a577516.library.js +1 -0
- package/dist/{18a02a9c54e.preview.html → 18a3a577516.preview.html} +1 -1
- package/dist/18a3a577516.preview.js +1 -0
- package/dist/18a3a577516.screenshoot.js +1 -0
- package/dist/18a3a577516.webview.js +1 -0
- package/dist/213.js +118 -100
- package/dist/335.js +25 -25
- package/dist/362.js +1 -1
- package/dist/441.js +2441 -2597
- package/dist/605.js +50 -50
- package/dist/782.js +1 -1
- package/dist/HASH +1 -1
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +396 -412
- package/package.json +10 -10
- package/src/lib.js +6 -0
- package/src/plugin.js +2 -3
- package/src/store/store.js +26 -5
- package/dist/18a02a9c54e.132.js +0 -1
- package/dist/18a02a9c54e.213.js +0 -1
- package/dist/18a02a9c54e.335.js +0 -1
- package/dist/18a02a9c54e.441.js +0 -1
- package/dist/18a02a9c54e.605.js +0 -1
- package/dist/18a02a9c54e.app.js +0 -1
- package/dist/18a02a9c54e.library.js +0 -1
- package/dist/18a02a9c54e.preview.js +0 -1
- package/dist/18a02a9c54e.screenshoot.js +0 -1
- package/dist/18a02a9c54e.webview.js +0 -1
- /package/dist/{18a02a9c54e.178.js → 18a3a577516.178.js} +0 -0
- /package/dist/{18a02a9c54e.678.js → 18a3a577516.678.js} +0 -0
package/dist/213.js
CHANGED
|
@@ -1054,7 +1054,7 @@ let obj = function () {
|
|
|
1054
1054
|
};
|
|
1055
1055
|
var clone = function clone(obj) {
|
|
1056
1056
|
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
|
|
1057
|
-
return util/* default
|
|
1057
|
+
return util/* default */.Z.parseJSON(util/* default */.Z.stringify(obj));
|
|
1058
1058
|
}
|
|
1059
1059
|
return obj;
|
|
1060
1060
|
};
|
|
@@ -1367,7 +1367,7 @@ class Countdown extends common/* Com */.up {
|
|
|
1367
1367
|
_defineProperty(this, "state", {
|
|
1368
1368
|
flipKey: '43'
|
|
1369
1369
|
});
|
|
1370
|
-
this.timer = util/* default
|
|
1370
|
+
this.timer = util/* default */.Z.setInterval(() => {
|
|
1371
1371
|
if (this.props._destroy) return this.componentWillUnmount();
|
|
1372
1372
|
let cd = this.props.com.countdown || {};
|
|
1373
1373
|
let newFlipKey = 'cd' + ':' + cd.skin + ':' + cd.size + ':' + this.props.plugin.popup.font_family + ':';
|
|
@@ -1378,25 +1378,25 @@ class Countdown extends common/* Com */.up {
|
|
|
1378
1378
|
}, 500);
|
|
1379
1379
|
}
|
|
1380
1380
|
componentWillUnmount() {
|
|
1381
|
-
util/* default
|
|
1381
|
+
util/* default */.Z.clearInterval(this.timer);
|
|
1382
1382
|
}
|
|
1383
1383
|
getCountDownDeltaSec(countdown) {
|
|
1384
1384
|
let dest;
|
|
1385
1385
|
if (countdown.expire_time_type === 'fixed_time') dest = countdown.fixed_time;
|
|
1386
1386
|
if (countdown.expire_time_type === 'visit_time') dest = this.props.store.pageLoaded() + countdown.visit_time * 60000;
|
|
1387
1387
|
if (countdown.expire_time_type === 'repeat_daily') {
|
|
1388
|
-
var start = new util/* default
|
|
1388
|
+
var start = new util/* default */.Z.Date();
|
|
1389
1389
|
start.setHours(0, 0, 0, 0);
|
|
1390
1390
|
dest = start.getTime() + countdown.repeat_daily * 60000;
|
|
1391
1391
|
}
|
|
1392
1392
|
if (countdown.expire_time_type === 'repeat_weekly') {
|
|
1393
1393
|
let daytill = 0;
|
|
1394
|
-
let todayweekday = new util/* default
|
|
1394
|
+
let todayweekday = new util/* default */.Z.Date().getDay();
|
|
1395
1395
|
if (todayweekday === 0) {
|
|
1396
1396
|
if (countdown.repeat_weekly_weekday === 'sunday') {
|
|
1397
1397
|
daytill = 0;
|
|
1398
1398
|
} else {
|
|
1399
|
-
daytill = 7 - new util/* default
|
|
1399
|
+
daytill = 7 - new util/* default */.Z.Date().getDay();
|
|
1400
1400
|
}
|
|
1401
1401
|
} else {
|
|
1402
1402
|
if (countdown.repeat_weekly_weekday === 'sunday') {
|
|
@@ -1406,16 +1406,16 @@ class Countdown extends common/* Com */.up {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
if (daytill < 0) delta = 0;else if (daytill == 0) {
|
|
1409
|
-
var start = new util/* default
|
|
1409
|
+
var start = new util/* default */.Z.Date();
|
|
1410
1410
|
start.setHours(0, 0, 0, 0);
|
|
1411
1411
|
dest = start.getTime() + countdown.repeat_weekly_min * 60000;
|
|
1412
1412
|
} else {
|
|
1413
|
-
var start = new util/* default
|
|
1413
|
+
var start = new util/* default */.Z.Date();
|
|
1414
1414
|
start.setHours(0, 0, 0, 0);
|
|
1415
1415
|
dest = start.getTime() + countdown.repeat_weekly_min * 60000 + daytill * 86400000;
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
let delta = dest - util/* default
|
|
1418
|
+
let delta = dest - util/* default */.Z.Date.now();
|
|
1419
1419
|
if (delta < 0) delta = 0;
|
|
1420
1420
|
return Math.floor(delta / 1000) || 0;
|
|
1421
1421
|
}
|
|
@@ -1433,13 +1433,13 @@ class Countdown extends common/* Com */.up {
|
|
|
1433
1433
|
class: "countdown_electric_numbers"
|
|
1434
1434
|
}, (0,preact_module.h)("div", {
|
|
1435
1435
|
class: "countdown_electric_number",
|
|
1436
|
-
style: util/* default
|
|
1436
|
+
style: util/* default */.Z.js2css({
|
|
1437
1437
|
font_size: fs,
|
|
1438
1438
|
font_family: this.props.plugin.popup.font_family
|
|
1439
1439
|
})
|
|
1440
1440
|
}, hour0), (0,preact_module.h)("div", {
|
|
1441
1441
|
class: "countdown_electric_number",
|
|
1442
|
-
style: util/* default
|
|
1442
|
+
style: util/* default */.Z.js2css({
|
|
1443
1443
|
font_size: fs,
|
|
1444
1444
|
font_family: this.props.plugin.popup.font_family
|
|
1445
1445
|
})
|
|
@@ -1451,13 +1451,13 @@ class Countdown extends common/* Com */.up {
|
|
|
1451
1451
|
class: "countdown_electric_numbers"
|
|
1452
1452
|
}, (0,preact_module.h)("div", {
|
|
1453
1453
|
class: "countdown_electric_number",
|
|
1454
|
-
style: util/* default
|
|
1454
|
+
style: util/* default */.Z.js2css({
|
|
1455
1455
|
font_size: fs,
|
|
1456
1456
|
font_family: this.props.plugin.popup.font_family
|
|
1457
1457
|
})
|
|
1458
1458
|
}, min0), (0,preact_module.h)("div", {
|
|
1459
1459
|
class: "countdown_electric_number",
|
|
1460
|
-
style: util/* default
|
|
1460
|
+
style: util/* default */.Z.js2css({
|
|
1461
1461
|
font_size: fs,
|
|
1462
1462
|
font_family: this.props.plugin.popup.font_family
|
|
1463
1463
|
})
|
|
@@ -1469,13 +1469,13 @@ class Countdown extends common/* Com */.up {
|
|
|
1469
1469
|
class: "countdown_electric_numbers"
|
|
1470
1470
|
}, (0,preact_module.h)("div", {
|
|
1471
1471
|
class: "countdown_electric_number",
|
|
1472
|
-
style: util/* default
|
|
1472
|
+
style: util/* default */.Z.js2css({
|
|
1473
1473
|
font_size: fs,
|
|
1474
1474
|
font_family: this.props.plugin.popup.font_family
|
|
1475
1475
|
})
|
|
1476
1476
|
}, sec0), (0,preact_module.h)("div", {
|
|
1477
1477
|
class: "countdown_electric_number",
|
|
1478
|
-
style: util/* default
|
|
1478
|
+
style: util/* default */.Z.js2css({
|
|
1479
1479
|
font_size: fs,
|
|
1480
1480
|
font_family: this.props.plugin.popup.font_family
|
|
1481
1481
|
})
|
|
@@ -1586,7 +1586,7 @@ class Flip extends common/* Com */.up {
|
|
|
1586
1586
|
"aria-hidden": "true"
|
|
1587
1587
|
}, (0,preact_module.h)("span", {
|
|
1588
1588
|
"data-view": "flip",
|
|
1589
|
-
style: util/* default
|
|
1589
|
+
style: util/* default */.Z.js2css({
|
|
1590
1590
|
font_size: fs,
|
|
1591
1591
|
font_family: this.props.plugin.popup.font_family
|
|
1592
1592
|
})
|
|
@@ -1614,22 +1614,22 @@ class Popup extends common/* Com */.up {
|
|
|
1614
1614
|
fontReady: false
|
|
1615
1615
|
});
|
|
1616
1616
|
this._formRef = (0,preact_module/* createRef */.Vf)();
|
|
1617
|
-
util/* default
|
|
1618
|
-
util/* default
|
|
1617
|
+
util/* default */.Z.setTimeout(() => this.fillForm(), 1000);
|
|
1618
|
+
util/* default */.Z.setTimeout(async () => {
|
|
1619
1619
|
let {
|
|
1620
1620
|
body: impression
|
|
1621
1621
|
} = await this.props.store.sendImpression(this.props.plugin.id);
|
|
1622
|
-
this.impressionToken = util/* default
|
|
1622
|
+
this.impressionToken = util/* default */.Z.get(impression, 'impression_token') || '';
|
|
1623
1623
|
}, 10);
|
|
1624
|
-
util/* default
|
|
1624
|
+
util/* default */.Z.setTimeout(() => {
|
|
1625
1625
|
let fonts = {};
|
|
1626
1626
|
fonts[this.props.plugin.popup.font_family] = true;
|
|
1627
1627
|
let images = {};
|
|
1628
|
-
util/* default
|
|
1628
|
+
util/* default */.Z.map(this.props.plugin.popup.pages, page => {
|
|
1629
1629
|
if (!page) return;
|
|
1630
|
-
util/* default
|
|
1631
|
-
fonts[util/* default
|
|
1632
|
-
fonts[util/* default
|
|
1630
|
+
util/* default */.Z.map(page.components, com => {
|
|
1631
|
+
fonts[util/* default */.Z.get(com, 'style.font_family')] = true;
|
|
1632
|
+
fonts[util/* default */.Z.get(com, 'mobile_style.font_family')] = true;
|
|
1633
1633
|
if (com.type === 'image' && com.image && com.image.url && com.image.url.startsWith('http')) {
|
|
1634
1634
|
images[com.image.url] = true;
|
|
1635
1635
|
}
|
|
@@ -1638,14 +1638,14 @@ class Popup extends common/* Com */.up {
|
|
|
1638
1638
|
delete fonts.undefined;
|
|
1639
1639
|
delete fonts.null;
|
|
1640
1640
|
delete fonts[''];
|
|
1641
|
-
if (util/* default
|
|
1641
|
+
if (util/* default */.Z.size(images) == 0) this.setState({
|
|
1642
1642
|
imageReady: true
|
|
1643
1643
|
});
|
|
1644
|
-
util/* default
|
|
1644
|
+
util/* default */.Z.map(images, (_, image) => util/* default */.Z.preloadImg(image, () => this.setState({
|
|
1645
1645
|
imageReady: true
|
|
1646
1646
|
})));
|
|
1647
|
-
util/* default
|
|
1648
|
-
util/* default
|
|
1647
|
+
util/* default */.Z.preloadWebfonts(Object.keys(fonts));
|
|
1648
|
+
util/* default */.Z.setTimeout(async () => {
|
|
1649
1649
|
await this.waitForFont(Object.keys(fonts));
|
|
1650
1650
|
this.setState({
|
|
1651
1651
|
fontReady: true
|
|
@@ -1654,7 +1654,7 @@ class Popup extends common/* Com */.up {
|
|
|
1654
1654
|
});
|
|
1655
1655
|
}
|
|
1656
1656
|
async waitForFont(fonts) {
|
|
1657
|
-
if (util/* default
|
|
1657
|
+
if (util/* default */.Z.size(fonts) == 0) return;
|
|
1658
1658
|
let ready = {};
|
|
1659
1659
|
for (var t = 0; t < 10; t++) {
|
|
1660
1660
|
for (var i = 0; i < fonts.length; i++) {
|
|
@@ -1663,7 +1663,7 @@ class Popup extends common/* Com */.up {
|
|
|
1663
1663
|
if (Object.keys(readycount) == fonts.length) return;
|
|
1664
1664
|
} catch (e) {}
|
|
1665
1665
|
}
|
|
1666
|
-
await util/* default
|
|
1666
|
+
await util/* default */.Z.sleep(200);
|
|
1667
1667
|
}
|
|
1668
1668
|
return;
|
|
1669
1669
|
}
|
|
@@ -1677,11 +1677,11 @@ class Popup extends common/* Com */.up {
|
|
|
1677
1677
|
return this.props.pageIndex;
|
|
1678
1678
|
}
|
|
1679
1679
|
isFormFilled() {
|
|
1680
|
-
let page = util/* default
|
|
1681
|
-
let form = util/* default
|
|
1680
|
+
let page = util/* default */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
|
|
1681
|
+
let form = util/* default */.Z.find(page.components, com => com.type === 'form');
|
|
1682
1682
|
if (!form || !form.form) return true;
|
|
1683
|
-
let fields = util/* default
|
|
1684
|
-
let wrong = util/* default
|
|
1683
|
+
let fields = util/* default */.Z.get(form, 'form.fields', []);
|
|
1684
|
+
let wrong = util/* default */.Z.find(fields, field => {
|
|
1685
1685
|
if (!field.is_required) return false;
|
|
1686
1686
|
if (!this.isFieldValid(field.key, field.validate)) return true;
|
|
1687
1687
|
return this.isFieldEmpty(field.key);
|
|
@@ -1689,19 +1689,33 @@ class Popup extends common/* Com */.up {
|
|
|
1689
1689
|
return !wrong;
|
|
1690
1690
|
}
|
|
1691
1691
|
fillForm() {
|
|
1692
|
-
let page = util/* default
|
|
1693
|
-
let form = util/* default
|
|
1692
|
+
let page = util/* default */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
|
|
1693
|
+
let form = util/* default */.Z.find(page.components, com => com.type === 'form');
|
|
1694
1694
|
if (!form) return;
|
|
1695
1695
|
let user = this.props.store.matchUser();
|
|
1696
|
-
let userAttributes = util/* default
|
|
1697
|
-
let fields = util/* default
|
|
1698
|
-
util/* default
|
|
1696
|
+
let userAttributes = util/* default */.Z.get(user, 'attributes');
|
|
1697
|
+
let fields = util/* default */.Z.get(form, 'form.fields', []);
|
|
1698
|
+
util/* default */.Z.each(fields, field => {
|
|
1699
1699
|
let fieldkey = field.key;
|
|
1700
1700
|
if (fieldkey === 'email') fieldkey = 'emails';
|
|
1701
1701
|
if (fieldkey === 'phone') fieldkey = 'phones';
|
|
1702
1702
|
if (fieldkey !== 'emails' || fieldkey != 'phones' || fieldkey !== 'fullname') return;
|
|
1703
|
-
|
|
1704
|
-
|
|
1703
|
+
if (fieldkey == 'emails') {
|
|
1704
|
+
let text = util/* default */.Z.getUserAttr(user, 'related_email', 'text');
|
|
1705
|
+
if (!text) return;
|
|
1706
|
+
var input = this._formRef.current.elements[field.key];
|
|
1707
|
+
if (!input) return;
|
|
1708
|
+
input.value = text;
|
|
1709
|
+
}
|
|
1710
|
+
if (fieldkey == 'phones') {
|
|
1711
|
+
let text = util/* default */.Z.getUserAttr(user, 'related_phone', 'text');
|
|
1712
|
+
if (!text) return;
|
|
1713
|
+
var input = this._formRef.current.elements[field.key];
|
|
1714
|
+
if (!input) return;
|
|
1715
|
+
input.value = text;
|
|
1716
|
+
}
|
|
1717
|
+
util/* default */.Z.map(userAttributes, attr => {
|
|
1718
|
+
if (fieldkey !== attr.key || !attr.text) return;
|
|
1705
1719
|
var input = this._formRef.current.elements[field.key];
|
|
1706
1720
|
if (!input) return;
|
|
1707
1721
|
input.value = attr.text;
|
|
@@ -1714,10 +1728,10 @@ class Popup extends common/* Com */.up {
|
|
|
1714
1728
|
var formData = new FormData(this._formRef.current);
|
|
1715
1729
|
for (var pair of formData.entries()) {
|
|
1716
1730
|
if (pair[0] !== key) continue;
|
|
1717
|
-
if (validate === 'email') return util/* default
|
|
1718
|
-
if (validate === 'phone') return util/* default
|
|
1719
|
-
if (validate === 'url') return util/* default
|
|
1720
|
-
if (validate === 'number') return util/* default
|
|
1731
|
+
if (validate === 'email') return util/* default */.Z.isEmail(pair[1]);
|
|
1732
|
+
if (validate === 'phone') return util/* default */.Z.isPhone(pair[1]);
|
|
1733
|
+
if (validate === 'url') return util/* default */.Z.isURL(pair[1]);
|
|
1734
|
+
if (validate === 'number') return util/* default */.Z.isNumber(pair[1]);
|
|
1721
1735
|
return true;
|
|
1722
1736
|
}
|
|
1723
1737
|
return true;
|
|
@@ -1764,11 +1778,11 @@ class Popup extends common/* Com */.up {
|
|
|
1764
1778
|
this.setState({
|
|
1765
1779
|
closeAnimation: true
|
|
1766
1780
|
});
|
|
1767
|
-
util/* default
|
|
1781
|
+
util/* default */.Z.setTimeout(() => this.setState({
|
|
1768
1782
|
close: true,
|
|
1769
1783
|
closeAnimation: false
|
|
1770
1784
|
}), 150);
|
|
1771
|
-
if (this.props.plugin._dont_close) util/* default
|
|
1785
|
+
if (this.props.plugin._dont_close) util/* default */.Z.setTimeout(() => {
|
|
1772
1786
|
this.lastoverflow = window.getComputedStyle(document.body).getPropertyValue('overflow');
|
|
1773
1787
|
document.body.style.setProperty('overflow', 'hidden', 'important');
|
|
1774
1788
|
this.setState({
|
|
@@ -1786,11 +1800,11 @@ class Popup extends common/* Com */.up {
|
|
|
1786
1800
|
}
|
|
1787
1801
|
onButtonClick(e, buttontype) {
|
|
1788
1802
|
e.stopPropagation();
|
|
1789
|
-
let popup = util/* default
|
|
1790
|
-
let page = util/* default
|
|
1803
|
+
let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
|
|
1804
|
+
let page = util/* default */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
|
|
1791
1805
|
let actions = [];
|
|
1792
|
-
let buttons = util/* default
|
|
1793
|
-
if (buttontype === 'background') actions = util/* default
|
|
1806
|
+
let buttons = util/* default */.Z.find(page.components, com => com.type === 'buttons');
|
|
1807
|
+
if (buttontype === 'background') actions = util/* default */.Z.get(page, 'background_click.actions') || [];
|
|
1794
1808
|
if (buttontype === 'primary' && buttons.buttons.primary_enabled) actions = buttons.buttons.primary_actions || [];
|
|
1795
1809
|
if (buttontype === 'secondary' && buttons.buttons.secondary_enabled) actions = buttons.buttons.secondary_actions || [];
|
|
1796
1810
|
let mustfillform = false;
|
|
@@ -1810,50 +1824,54 @@ class Popup extends common/* Com */.up {
|
|
|
1810
1824
|
if (hasConversion) {
|
|
1811
1825
|
var formData = this._formRef.current ? new FormData(this._formRef.current) : new FormData();
|
|
1812
1826
|
var summitFields = [];
|
|
1813
|
-
let user = util/* default
|
|
1827
|
+
let user = util/* default */.Z.cloneDeep(this.props.store.matchUser());
|
|
1814
1828
|
let is_lead = false;
|
|
1815
1829
|
let modifiedPairs = {};
|
|
1830
|
+
console.log('333333333333');
|
|
1816
1831
|
for (var pair of formData.entries()) {
|
|
1832
|
+
console.log('44444444444444444');
|
|
1817
1833
|
if (modifiedPairs[pair[0]]) {
|
|
1818
|
-
let currentValue = util/* default
|
|
1834
|
+
let currentValue = util/* default */.Z.get(modifiedPairs, `${pair[0]}.1`, '');
|
|
1819
1835
|
currentValue += `,${pair[1]}`;
|
|
1820
|
-
util/* default
|
|
1836
|
+
util/* default */.Z.set(modifiedPairs, `${pair[0]}.1`, currentValue);
|
|
1821
1837
|
} else {
|
|
1822
1838
|
modifiedPairs[pair[0]] = [pair[0], pair[1]];
|
|
1823
1839
|
}
|
|
1824
1840
|
}
|
|
1841
|
+
console.log('1111111111111', Object.entries(modifiedPairs));
|
|
1825
1842
|
for (const [_, pair] of Object.entries(modifiedPairs)) {
|
|
1826
|
-
|
|
1827
|
-
let
|
|
1828
|
-
let
|
|
1829
|
-
let
|
|
1843
|
+
console.log('2222222222222', pair);
|
|
1844
|
+
let page = util/* default */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
|
|
1845
|
+
let form = util/* default */.Z.find(page.components, com => com.type === 'form');
|
|
1846
|
+
let fields = util/* default */.Z.get(form, 'form.fields', []);
|
|
1847
|
+
let field = util/* default */.Z.find(fields, field => field.key === pair[0]) || {};
|
|
1830
1848
|
if (!field.type) return;
|
|
1831
1849
|
summitFields.push({
|
|
1832
1850
|
key: pair[0],
|
|
1833
1851
|
type: field.type,
|
|
1834
|
-
value: util/* default
|
|
1852
|
+
value: util/* default */.Z.stringify(pair[1])
|
|
1835
1853
|
});
|
|
1836
1854
|
let key = pair[0];
|
|
1837
1855
|
if (key === 'email') key = 'emails';
|
|
1838
1856
|
if (key === 'phone') key = 'phones';
|
|
1839
1857
|
is_lead = is_lead || key == 'emails' || key == 'phones';
|
|
1840
|
-
util/* default
|
|
1858
|
+
util/* default */.Z.setUserAttr(user, {
|
|
1841
1859
|
key: key,
|
|
1842
1860
|
text: pair[1]
|
|
1843
1861
|
});
|
|
1844
1862
|
}
|
|
1845
|
-
if (is_lead) util/* default
|
|
1863
|
+
if (is_lead) util/* default */.Z.setUserAttr(user, {
|
|
1846
1864
|
key: 'lead_source',
|
|
1847
1865
|
text: 'plugin.' + this.props.plugin.id
|
|
1848
1866
|
});
|
|
1849
|
-
this.props.store.sendConversion(this.props.plugin.id, summitFields, this.impressionToken);
|
|
1850
1867
|
this.props.store.setUser(user);
|
|
1868
|
+
this.props.store.sendConversion(this.props.plugin.id, summitFields, this.impressionToken);
|
|
1851
1869
|
}
|
|
1852
1870
|
for (let a of actions) {
|
|
1853
1871
|
if (a.action === 'open_widget') this.props.showWidget('list');
|
|
1854
1872
|
}
|
|
1855
1873
|
for (let a of actions) {
|
|
1856
|
-
if (a.action === 'close') util/* default
|
|
1874
|
+
if (a.action === 'close') util/* default */.Z.setTimeout(() => this.setClose(true), 100);
|
|
1857
1875
|
if (a.action === 'next_page') this.props.nextPage();
|
|
1858
1876
|
}
|
|
1859
1877
|
for (let a of actions) {
|
|
@@ -1868,7 +1886,7 @@ class Popup extends common/* Com */.up {
|
|
|
1868
1886
|
}
|
|
1869
1887
|
}
|
|
1870
1888
|
renderButtons(com, page) {
|
|
1871
|
-
let popup = util/* default
|
|
1889
|
+
let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
|
|
1872
1890
|
let buttonsstyle = com.style || {};
|
|
1873
1891
|
let primarystyle = Object.assign({}, buttonsstyle);
|
|
1874
1892
|
delete primarystyle.justify_content;
|
|
@@ -1887,8 +1905,8 @@ class Popup extends common/* Com */.up {
|
|
|
1887
1905
|
let style = Object.assign({
|
|
1888
1906
|
font_size: popup.font_size || '14px'
|
|
1889
1907
|
}, page.primary_button);
|
|
1890
|
-
if (util/* default
|
|
1891
|
-
if (util/* default
|
|
1908
|
+
if (util/* default */.Z.get(com, 'style.background')) style.background = com.style.background;
|
|
1909
|
+
if (util/* default */.Z.get(com, 'style.color')) style.color = com.style.color;
|
|
1892
1910
|
$primary = (0,preact_module.h)("div", {
|
|
1893
1911
|
class: 'btn btn__primary ',
|
|
1894
1912
|
style: this.js2css(primarystyle),
|
|
@@ -1925,7 +1943,7 @@ class Popup extends common/* Com */.up {
|
|
|
1925
1943
|
}
|
|
1926
1944
|
js2css(js, onlyProps) {
|
|
1927
1945
|
let spacer = this.props.plugin.popup.spacer || 10;
|
|
1928
|
-
return util/* default
|
|
1946
|
+
return util/* default */.Z.js2css(js, onlyProps, {
|
|
1929
1947
|
'@font_size': this.props.plugin.popup.font_size,
|
|
1930
1948
|
'@font_family': this.props.plugin.popup.font_family,
|
|
1931
1949
|
'@text_color': this.props.plugin.popup.text_color,
|
|
@@ -1939,7 +1957,7 @@ class Popup extends common/* Com */.up {
|
|
|
1939
1957
|
}
|
|
1940
1958
|
renderSingleChoiceField(field) {
|
|
1941
1959
|
var cls = 'form-control form-control__select ' + this.props.plugin.popup.theme;
|
|
1942
|
-
let $options = util/* default
|
|
1960
|
+
let $options = util/* default */.Z.map(field.options, option => {
|
|
1943
1961
|
return (0,preact_module.h)("label", {
|
|
1944
1962
|
class: cls
|
|
1945
1963
|
}, (0,preact_module.h)("input", {
|
|
@@ -1951,12 +1969,12 @@ class Popup extends common/* Com */.up {
|
|
|
1951
1969
|
return (0,preact_module.h)(preact_module/* Fragment */.HY, null, $options);
|
|
1952
1970
|
}
|
|
1953
1971
|
renderDropdownField(field) {
|
|
1954
|
-
let $options = util/* default
|
|
1972
|
+
let $options = util/* default */.Z.map(field.options, option => {
|
|
1955
1973
|
return (0,preact_module.h)("option", {
|
|
1956
1974
|
value: option.value
|
|
1957
1975
|
}, option.value);
|
|
1958
1976
|
});
|
|
1959
|
-
let theme = util/* default
|
|
1977
|
+
let theme = util/* default */.Z.get(this.props.plugin, 'popup.theme');
|
|
1960
1978
|
var cls = 'form-control form-control__select ' + theme;
|
|
1961
1979
|
if (theme === 'vintage') {
|
|
1962
1980
|
return (0,preact_module.h)("div", {
|
|
@@ -1975,7 +1993,7 @@ class Popup extends common/* Com */.up {
|
|
|
1975
1993
|
}
|
|
1976
1994
|
renderMutiChoiceField(field) {
|
|
1977
1995
|
var cls = 'form-control form-control__check ' + this.props.plugin.popup.theme;
|
|
1978
|
-
let $options = util/* default
|
|
1996
|
+
let $options = util/* default */.Z.map(field.options, option => {
|
|
1979
1997
|
return (0,preact_module.h)("label", {
|
|
1980
1998
|
class: cls
|
|
1981
1999
|
}, (0,preact_module.h)("input", {
|
|
@@ -1988,7 +2006,7 @@ class Popup extends common/* Com */.up {
|
|
|
1988
2006
|
return (0,preact_module.h)(preact_module/* Fragment */.HY, null, $options);
|
|
1989
2007
|
}
|
|
1990
2008
|
renderTextField(field) {
|
|
1991
|
-
let theme = util/* default
|
|
2009
|
+
let theme = util/* default */.Z.get(this.props.plugin, 'popup.theme');
|
|
1992
2010
|
var cls = 'form-control form-control__text ' + theme;
|
|
1993
2011
|
if (theme === 'simple') {
|
|
1994
2012
|
return (0,preact_module.h)("input", {
|
|
@@ -2021,7 +2039,7 @@ class Popup extends common/* Com */.up {
|
|
|
2021
2039
|
});
|
|
2022
2040
|
}
|
|
2023
2041
|
renderMultilineTextField(field) {
|
|
2024
|
-
let theme = util/* default
|
|
2042
|
+
let theme = util/* default */.Z.get(this.props.plugin, 'popup.theme');
|
|
2025
2043
|
var cls = 'form-control form-control__text ' + theme;
|
|
2026
2044
|
if (theme === 'simple') {
|
|
2027
2045
|
return (0,preact_module.h)("textarea", {
|
|
@@ -2069,8 +2087,8 @@ class Popup extends common/* Com */.up {
|
|
|
2069
2087
|
});
|
|
2070
2088
|
}
|
|
2071
2089
|
renderFormComponent(com) {
|
|
2072
|
-
let popup = util/* default
|
|
2073
|
-
let $fields = util/* default
|
|
2090
|
+
let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
|
|
2091
|
+
let $fields = util/* default */.Z.map(com.form.fields, field => {
|
|
2074
2092
|
if (field.type === 'email') return this.renderTextField(field);
|
|
2075
2093
|
if (field.type === 'single-choice') return this.renderSingleChoiceField(field);
|
|
2076
2094
|
if (field.type === 'multiple-choice') return this.renderMutiChoiceField(field);
|
|
@@ -2079,8 +2097,8 @@ class Popup extends common/* Com */.up {
|
|
|
2079
2097
|
if (field.type === 'dropdown') return this.renderDropdownField(field);
|
|
2080
2098
|
return;
|
|
2081
2099
|
});
|
|
2082
|
-
let theme = util/* default
|
|
2083
|
-
$fields = util/* default
|
|
2100
|
+
let theme = util/* default */.Z.get(popup, 'theme');
|
|
2101
|
+
$fields = util/* default */.Z.map($fields, ($field, i) => {
|
|
2084
2102
|
let $label = null;
|
|
2085
2103
|
let field = com.form.fields[i];
|
|
2086
2104
|
$label = (0,preact_module.h)("div", {
|
|
@@ -2128,11 +2146,11 @@ class Popup extends common/* Com */.up {
|
|
|
2128
2146
|
}, $fields);
|
|
2129
2147
|
}
|
|
2130
2148
|
renderComponents(page) {
|
|
2131
|
-
let buttons = util/* default
|
|
2149
|
+
let buttons = util/* default */.Z.find(page.components, com => com.type === 'buttons');
|
|
2132
2150
|
let $buttons = null;
|
|
2133
2151
|
if (buttons) $buttons = this.renderButtons(buttons, page);
|
|
2134
2152
|
let comIndexWithoutImg = 0;
|
|
2135
|
-
return util/* default
|
|
2153
|
+
return util/* default */.Z.map(page.components, (com, i) => {
|
|
2136
2154
|
if (com.type === 'image') return null;
|
|
2137
2155
|
comIndexWithoutImg++;
|
|
2138
2156
|
if (com.type === 'buttons') return $buttons;
|
|
@@ -2154,7 +2172,7 @@ class Popup extends common/* Com */.up {
|
|
|
2154
2172
|
});
|
|
2155
2173
|
}
|
|
2156
2174
|
renderFollowFacebook(com) {
|
|
2157
|
-
let fburl = util/* default
|
|
2175
|
+
let fburl = util/* default */.Z.get(com, 'follow_facebook.url');
|
|
2158
2176
|
if (!fburl) return null;
|
|
2159
2177
|
let style = this.props.mobile && com.mobile_style || com.style;
|
|
2160
2178
|
let containerstyle = {
|
|
@@ -2183,7 +2201,7 @@ class Popup extends common/* Com */.up {
|
|
|
2183
2201
|
}, this.props.t('follow_us_on_facebook'))));
|
|
2184
2202
|
}
|
|
2185
2203
|
renderSocialButtons(com) {
|
|
2186
|
-
let fburl = util/* default
|
|
2204
|
+
let fburl = util/* default */.Z.get(com, 'social_buttons.facebook');
|
|
2187
2205
|
let $fb = null;
|
|
2188
2206
|
if (fburl) {
|
|
2189
2207
|
$fb = (0,preact_module.h)("a", {
|
|
@@ -2196,7 +2214,7 @@ class Popup extends common/* Com */.up {
|
|
|
2196
2214
|
src: __webpack_require__(7435)
|
|
2197
2215
|
}));
|
|
2198
2216
|
}
|
|
2199
|
-
let zlurl = util/* default
|
|
2217
|
+
let zlurl = util/* default */.Z.get(com, 'social_buttons.zalo');
|
|
2200
2218
|
let $zl = null;
|
|
2201
2219
|
if (zlurl) {
|
|
2202
2220
|
$zl = (0,preact_module.h)("a", {
|
|
@@ -2230,7 +2248,7 @@ class Popup extends common/* Com */.up {
|
|
|
2230
2248
|
style: this.js2css({
|
|
2231
2249
|
width: '100%',
|
|
2232
2250
|
height: '100%',
|
|
2233
|
-
background_image: `url("${encodeURI(util/* default
|
|
2251
|
+
background_image: `url("${encodeURI(util/* default */.Z.get(com, 'image.url'))}")`,
|
|
2234
2252
|
background_size: style.background_size || 'cover',
|
|
2235
2253
|
background_position: style.background_position || 'auto'
|
|
2236
2254
|
})
|
|
@@ -2244,7 +2262,7 @@ class Popup extends common/* Com */.up {
|
|
|
2244
2262
|
});
|
|
2245
2263
|
}
|
|
2246
2264
|
renderTextComponent(com, isFirst) {
|
|
2247
|
-
let popup = util/* default
|
|
2265
|
+
let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
|
|
2248
2266
|
let style = Object.assign({
|
|
2249
2267
|
color: popup.text_color,
|
|
2250
2268
|
font_family: popup.font_family,
|
|
@@ -2256,21 +2274,21 @@ class Popup extends common/* Com */.up {
|
|
|
2256
2274
|
class: "text popup_component",
|
|
2257
2275
|
style: this.js2css(style),
|
|
2258
2276
|
onClick: e => e.stopPropagation()
|
|
2259
|
-
}, this.props.t.i18n(util/* default
|
|
2277
|
+
}, this.props.t.i18n(util/* default */.Z.get(com, 'text.i18n_html')) || util/* default */.Z.get(com, 'text.html'));
|
|
2260
2278
|
}
|
|
2261
2279
|
async refreshCSS() {
|
|
2262
2280
|
let plugins = this.props.store.matchPlugin();
|
|
2263
|
-
let found = util/* default
|
|
2281
|
+
let found = util/* default */.Z.find(plugins, plugin => plugin.id === this.props.plugin.id);
|
|
2264
2282
|
if (!found) return;
|
|
2265
2283
|
let css = (await popupCSS).default.default.toString();
|
|
2266
|
-
var outcss = util/* default
|
|
2267
|
-
let extra_css = util/* default
|
|
2268
|
-
let extra_css_string = util/* default
|
|
2284
|
+
var outcss = util/* default */.Z.replaceCssVariablePlugin(css, this.props.plugin.popup);
|
|
2285
|
+
let extra_css = util/* default */.Z.get(this.props.plugin, `popup.pages.0.extra_css`, []);
|
|
2286
|
+
let extra_css_string = util/* default */.Z.map(extra_css, css => `#sbz92 ${css.selector} { ${this.js2css(css.style)}}`).join('\n');
|
|
2269
2287
|
outcss += extra_css_string;
|
|
2270
|
-
util/* default
|
|
2288
|
+
util/* default */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
|
|
2271
2289
|
}
|
|
2272
2290
|
componentWillUnmount() {
|
|
2273
|
-
util/* default
|
|
2291
|
+
util/* default */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, '');
|
|
2274
2292
|
}
|
|
2275
2293
|
async componentDidMount() {
|
|
2276
2294
|
this.$cssStyleDiv = document.getElementById('subiz-style-for-' + this.props.plugin.id);
|
|
@@ -2282,7 +2300,7 @@ class Popup extends common/* Com */.up {
|
|
|
2282
2300
|
}
|
|
2283
2301
|
this.props.store.onResetCSS(this, () => this.refreshCSS());
|
|
2284
2302
|
await this.refreshCSS();
|
|
2285
|
-
util/* default
|
|
2303
|
+
util/* default */.Z.setTimeout(() => {
|
|
2286
2304
|
this.setState({
|
|
2287
2305
|
cssready: true
|
|
2288
2306
|
});
|
|
@@ -2298,7 +2316,7 @@ class Popup extends common/* Com */.up {
|
|
|
2298
2316
|
max_height: '85%'
|
|
2299
2317
|
});
|
|
2300
2318
|
let containercss = {};
|
|
2301
|
-
util/* default
|
|
2319
|
+
util/* default */.Z.map(['left', 'top', 'right', 'bottom', 'box_shadow', 'transform'], prop => {
|
|
2302
2320
|
containercss[prop] = pagestyle[prop];
|
|
2303
2321
|
});
|
|
2304
2322
|
containercss.position = 'absolute';
|
|
@@ -2407,13 +2425,13 @@ class Popup extends common/* Com */.up {
|
|
|
2407
2425
|
if (!this.state.imageReady) return null;
|
|
2408
2426
|
if (!this.state.fontReady) return null;
|
|
2409
2427
|
if (this.state.close) return null;
|
|
2410
|
-
let popup = util/* default
|
|
2411
|
-
let page = util/* default
|
|
2428
|
+
let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
|
|
2429
|
+
let page = util/* default */.Z.get(popup, `pages.${this.getPageIndex()}`);
|
|
2412
2430
|
if (!page) return null;
|
|
2413
2431
|
let pagestyle = Object.assign({}, this.props.mobile && page.mobile_style || page.style);
|
|
2414
2432
|
let containercss = this.calculateContainerCss(popup, page);
|
|
2415
2433
|
let animation = '';
|
|
2416
|
-
let pos = util/* default
|
|
2434
|
+
let pos = util/* default */.Z.get(this.props.plugin, 'popup.position', 'center');
|
|
2417
2435
|
if (pos === 'center' || !pos) {
|
|
2418
2436
|
animation = 'zoomInCenter';
|
|
2419
2437
|
if (this.state.closeAnimation) animation = 'zoomOutCenter';
|
|
@@ -2424,8 +2442,8 @@ class Popup extends common/* Com */.up {
|
|
|
2424
2442
|
if (pos === 'middle-left') animation = 'fadeInLeftBig';
|
|
2425
2443
|
if (pos === 'middle-right') animation = 'fadeInRightBig';
|
|
2426
2444
|
if (pos === 'bottom-center') animation = 'fadeInUpCenter';
|
|
2427
|
-
let layout = util/* default
|
|
2428
|
-
if (this.props.mobile) layout = util/* default
|
|
2445
|
+
let layout = util/* default */.Z.get(page, 'layout');
|
|
2446
|
+
if (this.props.mobile) layout = util/* default */.Z.get(page, 'mobile_layout');
|
|
2429
2447
|
let formcss = {
|
|
2430
2448
|
display: pagestyle.display,
|
|
2431
2449
|
align_items: pagestyle.align_items,
|
|
@@ -2457,10 +2475,10 @@ class Popup extends common/* Com */.up {
|
|
|
2457
2475
|
let overlaystyle = 'position: fixed !important;';
|
|
2458
2476
|
if (this.props.plugin._preview) overlaystyle = 'position: absolute !important;';
|
|
2459
2477
|
if (popup.overlay) overlaystyle += ' background: #000c !important;';
|
|
2460
|
-
let $imgs = util/* default
|
|
2478
|
+
let $imgs = util/* default */.Z.map(page.components, (com, i) => {
|
|
2461
2479
|
if (com.type === 'image') return this.renderImageComponent(com, i);
|
|
2462
2480
|
});
|
|
2463
|
-
let formComponents = util/* default
|
|
2481
|
+
let formComponents = util/* default */.Z.filter(page.components, com => com.type !== 'image');
|
|
2464
2482
|
if (!formComponents.length) {
|
|
2465
2483
|
formcss.background = 'transparent';
|
|
2466
2484
|
formcss.padding_top = '0';
|