@subiz/widget-v4 4.1.60 → 4.1.61

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.
Files changed (58) hide show
  1. package/app.js +10 -0
  2. package/compiled_src/call/call.js +2 -2
  3. package/compiled_src/chatbox/DropdownSelect.js +2 -2
  4. package/compiled_src/chatbox/ImageAttachments.js +2 -2
  5. package/compiled_src/chatbox/MessageInput.js +2 -2
  6. package/compiled_src/chatbox/Order.js +2 -2
  7. package/compiled_src/chatbox/Rating.js +2 -2
  8. package/compiled_src/chatbox/Widget.js +2 -2
  9. package/compiled_src/contact/contact.js +2 -2
  10. package/compiled_src/lib.js +2 -2
  11. package/compiled_src/notif/notif.js +2 -2
  12. package/compiled_src/order/address_picker.js +2 -2
  13. package/compiled_src/order/order.js +2 -2
  14. package/compiled_src/popup/countdown.js +2 -2
  15. package/compiled_src/popup/popup.js +2 -2
  16. package/compiled_src/store/api.js +2 -2
  17. package/compiled_src/store/api_fake.js +2 -2
  18. package/compiled_src/store/store.js +2 -2
  19. package/dist/178.js +1 -1
  20. package/dist/18d5e97bf55.178.js +1 -0
  21. package/dist/18d5e97bf55.213.js +1 -0
  22. package/dist/18d5e97bf55.335.js +1 -0
  23. package/dist/{18a02a9c54e.362.js → 18d5e97bf55.362.js} +1 -1
  24. package/dist/18d5e97bf55.605.js +1 -0
  25. package/dist/{18a02a9c54e.782.js → 18d5e97bf55.782.js} +1 -1
  26. package/dist/18d5e97bf55.841.js +1 -0
  27. package/dist/18d5e97bf55.app.js +1 -0
  28. package/dist/{18a02a9c54e.index.html → 18d5e97bf55.index.html} +4 -4
  29. package/dist/{18a02a9c54e.library.html → 18d5e97bf55.library.html} +4 -4
  30. package/dist/18d5e97bf55.library.js +1 -0
  31. package/dist/{18a02a9c54e.preview.html → 18d5e97bf55.preview.html} +1 -1
  32. package/dist/18d5e97bf55.preview.js +1 -0
  33. package/dist/18d5e97bf55.screenshoot.js +1 -0
  34. package/dist/18d5e97bf55.webview.js +1 -0
  35. package/dist/213.js +122 -106
  36. package/dist/335.js +27 -27
  37. package/dist/362.js +1 -1
  38. package/dist/605.js +52 -53
  39. package/dist/782.js +1 -1
  40. package/dist/{132.js → 841.js} +657 -644
  41. package/dist/HASH +1 -1
  42. package/dist/malicious-app.js +9 -3
  43. package/dist/screenshoot.html +1 -1
  44. package/dist/screenshoot.js +547 -623
  45. package/package.json +8 -8
  46. package/dist/18a02a9c54e.132.js +0 -1
  47. package/dist/18a02a9c54e.178.js +0 -1
  48. package/dist/18a02a9c54e.213.js +0 -1
  49. package/dist/18a02a9c54e.335.js +0 -1
  50. package/dist/18a02a9c54e.441.js +0 -1
  51. package/dist/18a02a9c54e.605.js +0 -1
  52. package/dist/18a02a9c54e.app.js +0 -1
  53. package/dist/18a02a9c54e.library.js +0 -1
  54. package/dist/18a02a9c54e.preview.js +0 -1
  55. package/dist/18a02a9c54e.screenshoot.js +0 -1
  56. package/dist/18a02a9c54e.webview.js +0 -1
  57. package/dist/441.js +0 -2855
  58. /package/dist/{18a02a9c54e.678.js → 18d5e97bf55.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.parseJSON */.Z.parseJSON(util/* default.stringify */.Z.stringify(obj));
1057
+ return util/* default */.Z.parseJSON(util/* default */.Z.stringify(obj));
1058
1058
  }
1059
1059
  return obj;
1060
1060
  };
@@ -1353,8 +1353,8 @@ var tick_view_flip_commonjs_default = /*#__PURE__*/__webpack_require__.n(tick_vi
1353
1353
  var preact_module = __webpack_require__(6400);
1354
1354
  ;// CONCATENATED MODULE: ./src/popup/countdown.js
1355
1355
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1356
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
1357
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1356
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
1357
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1358
1358
 
1359
1359
 
1360
1360
 
@@ -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.setInterval */.Z.setInterval(() => {
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.clearInterval */.Z.clearInterval(this.timer);
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.Date */.Z.Date();
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.Date */.Z.Date().getDay();
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.Date */.Z.Date().getDay();
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.Date */.Z.Date();
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.Date */.Z.Date();
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.Date.now */.Z.Date.now();
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.js2css */.Z.js2css({
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.js2css */.Z.js2css({
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.js2css */.Z.js2css({
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.js2css */.Z.js2css({
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.js2css */.Z.js2css({
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.js2css */.Z.js2css({
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.js2css */.Z.js2css({
1589
+ style: util/* default */.Z.js2css({
1590
1590
  font_size: fs,
1591
1591
  font_family: this.props.plugin.popup.font_family
1592
1592
  })
@@ -1595,8 +1595,8 @@ class Flip extends common/* Com */.up {
1595
1595
  }
1596
1596
  ;// CONCATENATED MODULE: ./src/popup/popup.js
1597
1597
  function popup_defineProperty(obj, key, value) { key = popup_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1598
- function popup_toPropertyKey(arg) { var key = popup_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
1599
- function popup_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1598
+ function popup_toPropertyKey(t) { var i = popup_toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
1599
+ function popup_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1600
1600
 
1601
1601
 
1602
1602
 
@@ -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.setTimeout */.Z.setTimeout(() => this.fillForm(), 1000);
1618
- util/* default.setTimeout */.Z.setTimeout(async () => {
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.get */.Z.get(impression, 'impression_token') || '';
1622
+ this.impressionToken = util/* default */.Z.get(impression, 'impression_token') || '';
1623
1623
  }, 10);
1624
- util/* default.setTimeout */.Z.setTimeout(() => {
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.map */.Z.map(this.props.plugin.popup.pages, page => {
1628
+ util/* default */.Z.map(this.props.plugin.popup.pages, page => {
1629
1629
  if (!page) return;
1630
- util/* default.map */.Z.map(page.components, com => {
1631
- fonts[util/* default.get */.Z.get(com, 'style.font_family')] = true;
1632
- fonts[util/* default.get */.Z.get(com, 'mobile_style.font_family')] = true;
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.size */.Z.size(images) == 0) this.setState({
1641
+ if (util/* default */.Z.size(images) == 0) this.setState({
1642
1642
  imageReady: true
1643
1643
  });
1644
- util/* default.map */.Z.map(images, (_, image) => util/* default.preloadImg */.Z.preloadImg(image, () => this.setState({
1644
+ util/* default */.Z.map(images, (_, image) => util/* default */.Z.preloadImg(image, () => this.setState({
1645
1645
  imageReady: true
1646
1646
  })));
1647
- util/* default.preloadWebfonts */.Z.preloadWebfonts(Object.keys(fonts));
1648
- util/* default.setTimeout */.Z.setTimeout(async () => {
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.size */.Z.size(fonts) == 0) return;
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.sleep */.Z.sleep(200);
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.get */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
1681
- let form = util/* default.find */.Z.find(page.components, com => com.type === 'form');
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.get */.Z.get(form, 'form.fields', []);
1684
- let wrong = util/* default.find */.Z.find(fields, field => {
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.get */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
1693
- let form = util/* default.find */.Z.find(page.components, com => com.type === 'form');
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.get */.Z.get(user, 'attributes');
1697
- let fields = util/* default.get */.Z.get(form, 'form.fields', []);
1698
- util/* default.each */.Z.each(fields, field => {
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
- util/* default.map */.Z.map(userAttributes, attr => {
1704
- if (fieldkey !== attr.key) return;
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.isEmail */.Z.isEmail(pair[1]);
1718
- if (validate === 'phone') return util/* default.isPhone */.Z.isPhone(pair[1]);
1719
- if (validate === 'url') return util/* default.isURL */.Z.isURL(pair[1]);
1720
- if (validate === 'number') return util/* default.isNumber */.Z.isNumber(pair[1]);
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.setTimeout */.Z.setTimeout(() => this.setState({
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.setTimeout */.Z.setTimeout(() => {
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({
@@ -1784,13 +1798,13 @@ class Popup extends common/* Com */.up {
1784
1798
  });
1785
1799
  }
1786
1800
  }
1787
- onButtonClick(e, buttontype) {
1801
+ async onButtonClick(e, buttontype) {
1788
1802
  e.stopPropagation();
1789
- let popup = util/* default.get */.Z.get(this.props.plugin, 'popup', {});
1790
- let page = util/* default.get */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
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.find */.Z.find(page.components, com => com.type === 'buttons');
1793
- if (buttontype === 'background') actions = util/* default.get */.Z.get(page, 'background_click.actions') || [];
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;
@@ -1808,52 +1822,54 @@ class Popup extends common/* Com */.up {
1808
1822
  if (a.action === 'submit' || a.action === 'conversion') hasConversion = true;
1809
1823
  }
1810
1824
  if (hasConversion) {
1825
+ if (this.isSubmitting) return;
1811
1826
  var formData = this._formRef.current ? new FormData(this._formRef.current) : new FormData();
1812
1827
  var summitFields = [];
1813
- let user = util/* default.cloneDeep */.Z.cloneDeep(this.props.store.matchUser());
1828
+ let user = util/* default */.Z.cloneDeep(this.props.store.matchUser());
1814
1829
  let is_lead = false;
1815
1830
  let modifiedPairs = {};
1816
1831
  for (var pair of formData.entries()) {
1817
1832
  if (modifiedPairs[pair[0]]) {
1818
- let currentValue = util/* default.get */.Z.get(modifiedPairs, `${pair[0]}.1`, '');
1833
+ let currentValue = util/* default */.Z.get(modifiedPairs, `${pair[0]}.1`, '');
1819
1834
  currentValue += `,${pair[1]}`;
1820
- util/* default.set */.Z.set(modifiedPairs, `${pair[0]}.1`, currentValue);
1835
+ util/* default */.Z.set(modifiedPairs, `${pair[0]}.1`, currentValue);
1821
1836
  } else {
1822
1837
  modifiedPairs[pair[0]] = [pair[0], pair[1]];
1823
1838
  }
1824
1839
  }
1825
1840
  for (const [_, pair] of Object.entries(modifiedPairs)) {
1826
- let page = util/* default.get */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
1827
- let form = util/* default.find */.Z.find(page.components, com => com.type === 'form');
1828
- let fields = util/* default.get */.Z.get(form, 'form.fields', []);
1829
- let field = util/* default.find */.Z.find(fields, field => field.key === pair[0]) || {};
1841
+ let page = util/* default */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
1842
+ let form = util/* default */.Z.find(page.components, com => com.type === 'form');
1843
+ let fields = util/* default */.Z.get(form, 'form.fields', []);
1844
+ let field = util/* default */.Z.find(fields, field => field.key === pair[0]) || {};
1830
1845
  if (!field.type) return;
1831
1846
  summitFields.push({
1832
1847
  key: pair[0],
1833
1848
  type: field.type,
1834
- value: util/* default.stringify */.Z.stringify(pair[1])
1849
+ value: util/* default */.Z.stringify(pair[1])
1835
1850
  });
1836
1851
  let key = pair[0];
1837
1852
  if (key === 'email') key = 'emails';
1838
1853
  if (key === 'phone') key = 'phones';
1839
1854
  is_lead = is_lead || key == 'emails' || key == 'phones';
1840
- util/* default.setUserAttr */.Z.setUserAttr(user, {
1855
+ util/* default */.Z.setUserAttr(user, {
1841
1856
  key: key,
1842
1857
  text: pair[1]
1843
1858
  });
1844
1859
  }
1845
- if (is_lead) util/* default.setUserAttr */.Z.setUserAttr(user, {
1860
+ if (is_lead) util/* default */.Z.setUserAttr(user, {
1846
1861
  key: 'lead_source',
1847
1862
  text: 'plugin.' + this.props.plugin.id
1848
1863
  });
1849
- this.props.store.sendConversion(this.props.plugin.id, summitFields, this.impressionToken);
1850
- this.props.store.setUser(user);
1864
+ this.isSubmitting = true;
1865
+ await Promise.all([this.props.store.setUser(user), this.props.store.sendConversion(this.props.plugin.id, summitFields, this.impressionToken)]);
1866
+ this.isSubmitting = false;
1851
1867
  }
1852
1868
  for (let a of actions) {
1853
1869
  if (a.action === 'open_widget') this.props.showWidget('list');
1854
1870
  }
1855
1871
  for (let a of actions) {
1856
- if (a.action === 'close') util/* default.setTimeout */.Z.setTimeout(() => this.setClose(true), 100);
1872
+ if (a.action === 'close') util/* default */.Z.setTimeout(() => this.setClose(true), 100);
1857
1873
  if (a.action === 'next_page') this.props.nextPage();
1858
1874
  }
1859
1875
  for (let a of actions) {
@@ -1868,7 +1884,7 @@ class Popup extends common/* Com */.up {
1868
1884
  }
1869
1885
  }
1870
1886
  renderButtons(com, page) {
1871
- let popup = util/* default.get */.Z.get(this.props.plugin, 'popup', {});
1887
+ let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
1872
1888
  let buttonsstyle = com.style || {};
1873
1889
  let primarystyle = Object.assign({}, buttonsstyle);
1874
1890
  delete primarystyle.justify_content;
@@ -1887,8 +1903,8 @@ class Popup extends common/* Com */.up {
1887
1903
  let style = Object.assign({
1888
1904
  font_size: popup.font_size || '14px'
1889
1905
  }, page.primary_button);
1890
- if (util/* default.get */.Z.get(com, 'style.background')) style.background = com.style.background;
1891
- if (util/* default.get */.Z.get(com, 'style.color')) style.color = com.style.color;
1906
+ if (util/* default */.Z.get(com, 'style.background')) style.background = com.style.background;
1907
+ if (util/* default */.Z.get(com, 'style.color')) style.color = com.style.color;
1892
1908
  $primary = (0,preact_module.h)("div", {
1893
1909
  class: 'btn btn__primary ',
1894
1910
  style: this.js2css(primarystyle),
@@ -1925,7 +1941,7 @@ class Popup extends common/* Com */.up {
1925
1941
  }
1926
1942
  js2css(js, onlyProps) {
1927
1943
  let spacer = this.props.plugin.popup.spacer || 10;
1928
- return util/* default.js2css */.Z.js2css(js, onlyProps, {
1944
+ return util/* default */.Z.js2css(js, onlyProps, {
1929
1945
  '@font_size': this.props.plugin.popup.font_size,
1930
1946
  '@font_family': this.props.plugin.popup.font_family,
1931
1947
  '@text_color': this.props.plugin.popup.text_color,
@@ -1939,7 +1955,7 @@ class Popup extends common/* Com */.up {
1939
1955
  }
1940
1956
  renderSingleChoiceField(field) {
1941
1957
  var cls = 'form-control form-control__select ' + this.props.plugin.popup.theme;
1942
- let $options = util/* default.map */.Z.map(field.options, option => {
1958
+ let $options = util/* default */.Z.map(field.options, option => {
1943
1959
  return (0,preact_module.h)("label", {
1944
1960
  class: cls
1945
1961
  }, (0,preact_module.h)("input", {
@@ -1951,12 +1967,12 @@ class Popup extends common/* Com */.up {
1951
1967
  return (0,preact_module.h)(preact_module/* Fragment */.HY, null, $options);
1952
1968
  }
1953
1969
  renderDropdownField(field) {
1954
- let $options = util/* default.map */.Z.map(field.options, option => {
1970
+ let $options = util/* default */.Z.map(field.options, option => {
1955
1971
  return (0,preact_module.h)("option", {
1956
1972
  value: option.value
1957
1973
  }, option.value);
1958
1974
  });
1959
- let theme = util/* default.get */.Z.get(this.props.plugin, 'popup.theme');
1975
+ let theme = util/* default */.Z.get(this.props.plugin, 'popup.theme');
1960
1976
  var cls = 'form-control form-control__select ' + theme;
1961
1977
  if (theme === 'vintage') {
1962
1978
  return (0,preact_module.h)("div", {
@@ -1975,7 +1991,7 @@ class Popup extends common/* Com */.up {
1975
1991
  }
1976
1992
  renderMutiChoiceField(field) {
1977
1993
  var cls = 'form-control form-control__check ' + this.props.plugin.popup.theme;
1978
- let $options = util/* default.map */.Z.map(field.options, option => {
1994
+ let $options = util/* default */.Z.map(field.options, option => {
1979
1995
  return (0,preact_module.h)("label", {
1980
1996
  class: cls
1981
1997
  }, (0,preact_module.h)("input", {
@@ -1988,7 +2004,7 @@ class Popup extends common/* Com */.up {
1988
2004
  return (0,preact_module.h)(preact_module/* Fragment */.HY, null, $options);
1989
2005
  }
1990
2006
  renderTextField(field) {
1991
- let theme = util/* default.get */.Z.get(this.props.plugin, 'popup.theme');
2007
+ let theme = util/* default */.Z.get(this.props.plugin, 'popup.theme');
1992
2008
  var cls = 'form-control form-control__text ' + theme;
1993
2009
  if (theme === 'simple') {
1994
2010
  return (0,preact_module.h)("input", {
@@ -2021,7 +2037,7 @@ class Popup extends common/* Com */.up {
2021
2037
  });
2022
2038
  }
2023
2039
  renderMultilineTextField(field) {
2024
- let theme = util/* default.get */.Z.get(this.props.plugin, 'popup.theme');
2040
+ let theme = util/* default */.Z.get(this.props.plugin, 'popup.theme');
2025
2041
  var cls = 'form-control form-control__text ' + theme;
2026
2042
  if (theme === 'simple') {
2027
2043
  return (0,preact_module.h)("textarea", {
@@ -2069,8 +2085,8 @@ class Popup extends common/* Com */.up {
2069
2085
  });
2070
2086
  }
2071
2087
  renderFormComponent(com) {
2072
- let popup = util/* default.get */.Z.get(this.props.plugin, 'popup', {});
2073
- let $fields = util/* default.map */.Z.map(com.form.fields, field => {
2088
+ let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
2089
+ let $fields = util/* default */.Z.map(com.form.fields, field => {
2074
2090
  if (field.type === 'email') return this.renderTextField(field);
2075
2091
  if (field.type === 'single-choice') return this.renderSingleChoiceField(field);
2076
2092
  if (field.type === 'multiple-choice') return this.renderMutiChoiceField(field);
@@ -2079,8 +2095,8 @@ class Popup extends common/* Com */.up {
2079
2095
  if (field.type === 'dropdown') return this.renderDropdownField(field);
2080
2096
  return;
2081
2097
  });
2082
- let theme = util/* default.get */.Z.get(popup, 'theme');
2083
- $fields = util/* default.map */.Z.map($fields, ($field, i) => {
2098
+ let theme = util/* default */.Z.get(popup, 'theme');
2099
+ $fields = util/* default */.Z.map($fields, ($field, i) => {
2084
2100
  let $label = null;
2085
2101
  let field = com.form.fields[i];
2086
2102
  $label = (0,preact_module.h)("div", {
@@ -2128,11 +2144,11 @@ class Popup extends common/* Com */.up {
2128
2144
  }, $fields);
2129
2145
  }
2130
2146
  renderComponents(page) {
2131
- let buttons = util/* default.find */.Z.find(page.components, com => com.type === 'buttons');
2147
+ let buttons = util/* default */.Z.find(page.components, com => com.type === 'buttons');
2132
2148
  let $buttons = null;
2133
2149
  if (buttons) $buttons = this.renderButtons(buttons, page);
2134
2150
  let comIndexWithoutImg = 0;
2135
- return util/* default.map */.Z.map(page.components, (com, i) => {
2151
+ return util/* default */.Z.map(page.components, (com, i) => {
2136
2152
  if (com.type === 'image') return null;
2137
2153
  comIndexWithoutImg++;
2138
2154
  if (com.type === 'buttons') return $buttons;
@@ -2154,7 +2170,7 @@ class Popup extends common/* Com */.up {
2154
2170
  });
2155
2171
  }
2156
2172
  renderFollowFacebook(com) {
2157
- let fburl = util/* default.get */.Z.get(com, 'follow_facebook.url');
2173
+ let fburl = util/* default */.Z.get(com, 'follow_facebook.url');
2158
2174
  if (!fburl) return null;
2159
2175
  let style = this.props.mobile && com.mobile_style || com.style;
2160
2176
  let containerstyle = {
@@ -2183,7 +2199,7 @@ class Popup extends common/* Com */.up {
2183
2199
  }, this.props.t('follow_us_on_facebook'))));
2184
2200
  }
2185
2201
  renderSocialButtons(com) {
2186
- let fburl = util/* default.get */.Z.get(com, 'social_buttons.facebook');
2202
+ let fburl = util/* default */.Z.get(com, 'social_buttons.facebook');
2187
2203
  let $fb = null;
2188
2204
  if (fburl) {
2189
2205
  $fb = (0,preact_module.h)("a", {
@@ -2196,7 +2212,7 @@ class Popup extends common/* Com */.up {
2196
2212
  src: __webpack_require__(7435)
2197
2213
  }));
2198
2214
  }
2199
- let zlurl = util/* default.get */.Z.get(com, 'social_buttons.zalo');
2215
+ let zlurl = util/* default */.Z.get(com, 'social_buttons.zalo');
2200
2216
  let $zl = null;
2201
2217
  if (zlurl) {
2202
2218
  $zl = (0,preact_module.h)("a", {
@@ -2230,7 +2246,7 @@ class Popup extends common/* Com */.up {
2230
2246
  style: this.js2css({
2231
2247
  width: '100%',
2232
2248
  height: '100%',
2233
- background_image: `url("${encodeURI(util/* default.get */.Z.get(com, 'image.url'))}")`,
2249
+ background_image: `url("${encodeURI(util/* default */.Z.get(com, 'image.url'))}")`,
2234
2250
  background_size: style.background_size || 'cover',
2235
2251
  background_position: style.background_position || 'auto'
2236
2252
  })
@@ -2244,7 +2260,7 @@ class Popup extends common/* Com */.up {
2244
2260
  });
2245
2261
  }
2246
2262
  renderTextComponent(com, isFirst) {
2247
- let popup = util/* default.get */.Z.get(this.props.plugin, 'popup', {});
2263
+ let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
2248
2264
  let style = Object.assign({
2249
2265
  color: popup.text_color,
2250
2266
  font_family: popup.font_family,
@@ -2256,21 +2272,21 @@ class Popup extends common/* Com */.up {
2256
2272
  class: "text popup_component",
2257
2273
  style: this.js2css(style),
2258
2274
  onClick: e => e.stopPropagation()
2259
- }, this.props.t.i18n(util/* default.get */.Z.get(com, 'text.i18n_html')) || util/* default.get */.Z.get(com, 'text.html'));
2275
+ }, this.props.t.i18n(util/* default */.Z.get(com, 'text.i18n_html')) || util/* default */.Z.get(com, 'text.html'));
2260
2276
  }
2261
2277
  async refreshCSS() {
2262
2278
  let plugins = this.props.store.matchPlugin();
2263
- let found = util/* default.find */.Z.find(plugins, plugin => plugin.id === this.props.plugin.id);
2279
+ let found = util/* default */.Z.find(plugins, plugin => plugin.id === this.props.plugin.id);
2264
2280
  if (!found) return;
2265
2281
  let css = (await popupCSS).default.default.toString();
2266
- var outcss = util/* default.replaceCssVariablePlugin */.Z.replaceCssVariablePlugin(css, this.props.plugin.popup);
2267
- let extra_css = util/* default.get */.Z.get(this.props.plugin, `popup.pages.0.extra_css`, []);
2268
- let extra_css_string = util/* default.map */.Z.map(extra_css, css => `#sbz92 ${css.selector} { ${this.js2css(css.style)}}`).join('\n');
2282
+ var outcss = util/* default */.Z.replaceCssVariablePlugin(css, this.props.plugin.popup);
2283
+ let extra_css = util/* default */.Z.get(this.props.plugin, `popup.pages.0.extra_css`, []);
2284
+ let extra_css_string = util/* default */.Z.map(extra_css, css => `#sbz92 ${css.selector} { ${this.js2css(css.style)}}`).join('\n');
2269
2285
  outcss += extra_css_string;
2270
- util/* default.setCss */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
2286
+ util/* default */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
2271
2287
  }
2272
2288
  componentWillUnmount() {
2273
- util/* default.setCss */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, '');
2289
+ util/* default */.Z.setCss(this.props.plugin.id, this.$cssStyleDiv, '');
2274
2290
  }
2275
2291
  async componentDidMount() {
2276
2292
  this.$cssStyleDiv = document.getElementById('subiz-style-for-' + this.props.plugin.id);
@@ -2282,7 +2298,7 @@ class Popup extends common/* Com */.up {
2282
2298
  }
2283
2299
  this.props.store.onResetCSS(this, () => this.refreshCSS());
2284
2300
  await this.refreshCSS();
2285
- util/* default.setTimeout */.Z.setTimeout(() => {
2301
+ util/* default */.Z.setTimeout(() => {
2286
2302
  this.setState({
2287
2303
  cssready: true
2288
2304
  });
@@ -2298,7 +2314,7 @@ class Popup extends common/* Com */.up {
2298
2314
  max_height: '85%'
2299
2315
  });
2300
2316
  let containercss = {};
2301
- util/* default.map */.Z.map(['left', 'top', 'right', 'bottom', 'box_shadow', 'transform'], prop => {
2317
+ util/* default */.Z.map(['left', 'top', 'right', 'bottom', 'box_shadow', 'transform'], prop => {
2302
2318
  containercss[prop] = pagestyle[prop];
2303
2319
  });
2304
2320
  containercss.position = 'absolute';
@@ -2407,13 +2423,13 @@ class Popup extends common/* Com */.up {
2407
2423
  if (!this.state.imageReady) return null;
2408
2424
  if (!this.state.fontReady) return null;
2409
2425
  if (this.state.close) return null;
2410
- let popup = util/* default.get */.Z.get(this.props.plugin, 'popup', {});
2411
- let page = util/* default.get */.Z.get(popup, `pages.${this.getPageIndex()}`);
2426
+ let popup = util/* default */.Z.get(this.props.plugin, 'popup', {});
2427
+ let page = util/* default */.Z.get(popup, `pages.${this.getPageIndex()}`);
2412
2428
  if (!page) return null;
2413
2429
  let pagestyle = Object.assign({}, this.props.mobile && page.mobile_style || page.style);
2414
2430
  let containercss = this.calculateContainerCss(popup, page);
2415
2431
  let animation = '';
2416
- let pos = util/* default.get */.Z.get(this.props.plugin, 'popup.position', 'center');
2432
+ let pos = util/* default */.Z.get(this.props.plugin, 'popup.position', 'center');
2417
2433
  if (pos === 'center' || !pos) {
2418
2434
  animation = 'zoomInCenter';
2419
2435
  if (this.state.closeAnimation) animation = 'zoomOutCenter';
@@ -2424,8 +2440,8 @@ class Popup extends common/* Com */.up {
2424
2440
  if (pos === 'middle-left') animation = 'fadeInLeftBig';
2425
2441
  if (pos === 'middle-right') animation = 'fadeInRightBig';
2426
2442
  if (pos === 'bottom-center') animation = 'fadeInUpCenter';
2427
- let layout = util/* default.get */.Z.get(page, 'layout');
2428
- if (this.props.mobile) layout = util/* default.get */.Z.get(page, 'mobile_layout');
2443
+ let layout = util/* default */.Z.get(page, 'layout');
2444
+ if (this.props.mobile) layout = util/* default */.Z.get(page, 'mobile_layout');
2429
2445
  let formcss = {
2430
2446
  display: pagestyle.display,
2431
2447
  align_items: pagestyle.align_items,
@@ -2457,10 +2473,10 @@ class Popup extends common/* Com */.up {
2457
2473
  let overlaystyle = 'position: fixed !important;';
2458
2474
  if (this.props.plugin._preview) overlaystyle = 'position: absolute !important;';
2459
2475
  if (popup.overlay) overlaystyle += ' background: #000c !important;';
2460
- let $imgs = util/* default.map */.Z.map(page.components, (com, i) => {
2476
+ let $imgs = util/* default */.Z.map(page.components, (com, i) => {
2461
2477
  if (com.type === 'image') return this.renderImageComponent(com, i);
2462
2478
  });
2463
- let formComponents = util/* default.filter */.Z.filter(page.components, com => com.type !== 'image');
2479
+ let formComponents = util/* default */.Z.filter(page.components, com => com.type !== 'image');
2464
2480
  if (!formComponents.length) {
2465
2481
  formcss.background = 'transparent';
2466
2482
  formcss.padding_top = '0';