@subiz/widget-v4 4.0.58 → 4.0.63
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/caret.svg +1 -0
- package/assets/img/done_green.svg +4 -0
- package/assets/img/empty_1.svg +11 -0
- package/assets/img/ghn.svg +17 -0
- package/assets/img/ghtk.svg +18 -0
- package/assets/img/home.svg +1 -0
- package/assets/img/info.svg +1 -0
- package/assets/img/loader.svg +1 -0
- package/assets/img/map-pin.svg +1 -0
- package/assets/img/not_found_search.png +0 -0
- package/assets/img/package.svg +5 -0
- package/assets/img/package_fade.svg +1 -0
- package/assets/img/phone.svg +1 -0
- package/assets/img/search.svg +1 -0
- package/assets/img/shop.svg +1 -0
- package/assets/img/shop_faded.svg +1 -0
- package/assets/img/user.svg +1 -0
- package/assets/img/x.svg +5 -0
- package/assets/less/chatbox.less +35 -0
- package/assets/less/dropdown_select.less +130 -0
- package/assets/less/form.less +7 -20
- package/assets/less/order.less +489 -0
- package/assets/less/rating.less +3 -8
- package/compiled_src/call/call.js +12 -15
- package/compiled_src/chatbox/DropdownSelect.js +239 -0
- package/compiled_src/chatbox/Event.js +4 -2
- package/compiled_src/chatbox/Events.js +1 -0
- package/compiled_src/chatbox/MessageInput.js +4 -7
- package/compiled_src/chatbox/Order.js +281 -0
- package/compiled_src/chatbox/OrderAttachments.js +2 -1
- package/compiled_src/chatbox/Rating.js +7 -10
- package/compiled_src/chatbox/TextMessage.js +9 -2
- package/compiled_src/chatbox/Widget.js +40 -3
- package/compiled_src/chatbox/main.js +2 -1
- package/compiled_src/chatbox/spinner.js +1 -1
- package/compiled_src/chatbox/time.js +3 -1
- package/compiled_src/common.js +40 -1
- package/compiled_src/contact/contact.js +7 -12
- package/compiled_src/lib.js +9 -14
- package/compiled_src/notif/notif.js +12 -15
- package/compiled_src/order/address_picker.js +241 -0
- package/compiled_src/order/icon.js +62 -0
- package/compiled_src/order/index.js +113 -0
- package/compiled_src/order/order.js +1220 -0
- package/compiled_src/plugin.js +9 -42
- package/compiled_src/popup/countdown.js +4 -7
- package/compiled_src/popup/popup.js +40 -13
- package/compiled_src/store/api.js +80 -90
- package/compiled_src/store/api_fake.js +55 -82
- package/compiled_src/store/store.js +163 -158
- package/compiled_src/util/common.js +40 -4
- package/dist/0b82fa7e5c3b07b40a44.png +1 -0
- package/dist/0f4af006e38ee8b93633.png +1 -0
- package/dist/{74.js → 132.js} +2234 -236
- package/dist/178.js +341 -174
- package/dist/17e757ccadd.132.js +1 -0
- package/dist/17e757ccadd.178.js +1 -0
- package/dist/17e757ccadd.213.js +1 -0
- package/dist/17e757ccadd.335.js +1 -0
- package/dist/17e757ccadd.362.js +1 -0
- package/dist/17e757ccadd.441.js +1 -0
- package/dist/17e757ccadd.605.js +1 -0
- package/dist/17e757ccadd.678.js +1 -0
- package/dist/17e757ccadd.782.js +1 -0
- package/dist/17e757ccadd.app.js +1 -0
- package/dist/{17d938a5acb.index.html → 17e757ccadd.index.html} +3 -18
- package/dist/{17d938a5acb.library.html → 17e757ccadd.library.html} +3 -18
- package/dist/17e757ccadd.library.js +1 -0
- package/dist/{17d938a5acb.preview.html → 17e757ccadd.preview.html} +1 -1
- package/dist/17e757ccadd.preview.js +1 -0
- package/dist/17e757ccadd.screenshoot.js +1 -0
- package/dist/1ea1c6cd21d25176810c.png +1 -0
- package/dist/213.js +46 -87
- package/dist/292d42404e1b03398f61.png +1 -0
- package/dist/312d376370831b7bea83.png +1 -0
- package/dist/313d1bfc1cf776d1aefe.png +1 -0
- package/dist/335.js +408 -0
- package/dist/362.js +71 -21
- package/dist/441.js +69 -43
- package/dist/4aa58bb7a66bb44975aa.png +1 -0
- package/dist/56ce063bc6c81adb7322.png +1 -0
- package/dist/605.js +13 -79
- package/dist/678.js +70 -20
- package/dist/6a411166ef5cc79e0714.png +1 -0
- package/dist/6faf403782fefacc1649.png +1 -0
- package/dist/782.js +118 -21
- package/dist/79dca33c68fab79c067f.png +1 -0
- package/dist/82da1578fa84f9debaeb.png +1 -0
- package/dist/8b8e0f0824743974b282.png +1 -0
- package/dist/8d551390d81e39130a3c.png +1 -0
- package/dist/9fc61b9479877ebdb6c7.png +1 -0
- package/dist/HASH +1 -1
- package/dist/a165d31dcb3dc90f1057.png +1 -0
- package/dist/a98d4a5698812c4426b3.png +1 -0
- package/dist/assets/img/caret.998eb8f.svg +1 -0
- package/dist/assets/img/done_green.b817fd4.svg +4 -0
- package/dist/assets/img/empty_1.0b98af0.svg +11 -0
- package/dist/assets/img/ghn.070f8e3.svg +17 -0
- package/dist/assets/img/ghtk.326eac1.svg +18 -0
- package/dist/assets/img/info.ebce7ea.svg +1 -0
- package/dist/assets/img/loader.37000a7.svg +1 -0
- package/dist/assets/img/not_found_search.2ddb8d1.png +0 -0
- package/dist/assets/img/package.8d37d0f.svg +5 -0
- package/dist/assets/img/package_fade.763c001.svg +1 -0
- package/dist/assets/img/search.f9705ff.svg +1 -0
- package/dist/assets/img/shop.f7dc7d8.svg +1 -0
- package/dist/assets/img/shop_faded.df7845a.svg +1 -0
- package/dist/assets/img/x.26fdfa3.svg +5 -0
- package/dist/c41606bf9d1b604e46d5.png +1 -0
- package/dist/ce1f7450ce6c1aacd330.png +1 -0
- package/dist/cf8c01e88f4770a6e3e5.png +1 -0
- package/dist/dfbcfeab1d5622a737e2.png +1 -0
- package/dist/e4893ed8c2f7b8329919.png +1 -0
- package/dist/ec2ab4eb4ef73d186186.png +1 -0
- package/dist/screenshoot.html +1 -1
- package/dist/screenshoot.js +452 -389
- package/index.html +3 -18
- package/order.html +32 -0
- package/package.json +13 -14
- package/src/chatbox/DropdownSelect.js +229 -0
- package/src/chatbox/Event.js +2 -2
- package/src/chatbox/Events.js +43 -42
- package/src/chatbox/Order.js +232 -0
- package/src/chatbox/OrderAttachments.js +2 -1
- package/src/chatbox/TextMessage.js +21 -12
- package/src/chatbox/Widget.js +34 -4
- package/src/chatbox/main.js +2 -2
- package/src/chatbox/spinner.js +1 -1
- package/src/chatbox/time.js +1 -1
- package/src/common.js +52 -8
- package/src/contact/contact.js +1 -1
- package/src/order/address_picker.js +235 -0
- package/src/order/icon.js +32 -0
- package/src/order/index.js +86 -0
- package/src/order/order.js +1157 -0
- package/src/order/scratch +211 -0
- package/src/plugin.js +7 -52
- package/src/popup/popup.js +27 -2
- package/src/store/api.js +26 -1
- package/src/store/store.js +46 -9
- package/src/util/common.js +52 -4
- package/webpack.dev.js +2 -0
- package/dist/17d938a5acb.178.js +0 -1
- package/dist/17d938a5acb.213.js +0 -1
- package/dist/17d938a5acb.362.js +0 -1
- package/dist/17d938a5acb.441.js +0 -1
- package/dist/17d938a5acb.605.js +0 -1
- package/dist/17d938a5acb.619.js +0 -1
- package/dist/17d938a5acb.678.js +0 -1
- package/dist/17d938a5acb.74.js +0 -1
- package/dist/17d938a5acb.782.js +0 -1
- package/dist/17d938a5acb.app.js +0 -1
- package/dist/17d938a5acb.library.js +0 -1
- package/dist/17d938a5acb.preview.js +0 -1
- package/dist/17d938a5acb.screenshoot.js +0 -1
- package/dist/619.js +0 -777
package/dist/213.js
CHANGED
|
@@ -1,69 +1,5 @@
|
|
|
1
1
|
(self["webpackChunk_subiz_widget_v4"] = self["webpackChunk_subiz_widget_v4"] || []).push([[213],{
|
|
2
2
|
|
|
3
|
-
/***/ 2493:
|
|
4
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5
|
-
|
|
6
|
-
"use strict";
|
|
7
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8
|
-
/* harmony export */ "M": () => (/* binding */ Com),
|
|
9
|
-
/* harmony export */ "u": () => (/* binding */ Clickaway)
|
|
10
|
-
/* harmony export */ });
|
|
11
|
-
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6400);
|
|
12
|
-
/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(819);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class Com extends preact__WEBPACK_IMPORTED_MODULE_0__/* .Component */ .wA {
|
|
16
|
-
constructor(props) {
|
|
17
|
-
super(props);
|
|
18
|
-
this._isMounted = true;
|
|
19
|
-
setTimeout(() => {
|
|
20
|
-
if (this.componentWillUnmount) {
|
|
21
|
-
let old = this.componentWillUnmount.bind(this);
|
|
22
|
-
|
|
23
|
-
this.componentWillUnmount = () => {
|
|
24
|
-
old();
|
|
25
|
-
this._isMounted = false;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}, 10);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
class Clickaway extends Com {
|
|
33
|
-
constructor(props) {
|
|
34
|
-
super(props);
|
|
35
|
-
this.setWrapperRef = this.setWrapperRef.bind(this);
|
|
36
|
-
this.onClick = this.onClick.bind(this);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
componentDidMount() {
|
|
40
|
-
document.addEventListener('mousedown', this.onClick);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
componentWillUnmount() {
|
|
44
|
-
document.removeEventListener('mousedown', this.onClick);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
setWrapperRef(node) {
|
|
48
|
-
this.wrapperRef = node;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
onClick(event) {
|
|
52
|
-
if (this.wrapperRef && !this.wrapperRef.contains(event.target)) {
|
|
53
|
-
this.props.onClickaway && this.props.onClickaway();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
render() {
|
|
58
|
-
return (0,preact__WEBPACK_IMPORTED_MODULE_0__.h)("div", {
|
|
59
|
-
ref: this.setWrapperRef
|
|
60
|
-
}, this.props.children);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/***/ }),
|
|
66
|
-
|
|
67
3
|
/***/ 8213:
|
|
68
4
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
69
5
|
|
|
@@ -1706,22 +1642,19 @@ var tick_view_flip_commonjs_default = /*#__PURE__*/__webpack_require__.n(tick_vi
|
|
|
1706
1642
|
// EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js
|
|
1707
1643
|
var preact_module = __webpack_require__(6400);
|
|
1708
1644
|
;// CONCATENATED MODULE: ./src/popup/countdown.js
|
|
1709
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1710
|
-
|
|
1711
1645
|
|
|
1712
1646
|
|
|
1713
1647
|
|
|
1714
1648
|
|
|
1715
1649
|
tick_core_commonjs.plugin.add((tick_view_flip_commonjs_default()));
|
|
1716
1650
|
|
|
1717
|
-
class Countdown extends common/* Com */.
|
|
1651
|
+
class Countdown extends common/* Com */.up {
|
|
1652
|
+
state = {
|
|
1653
|
+
flipKey: '43'
|
|
1654
|
+
};
|
|
1655
|
+
|
|
1718
1656
|
constructor(props) {
|
|
1719
1657
|
super(props);
|
|
1720
|
-
|
|
1721
|
-
_defineProperty(this, "state", {
|
|
1722
|
-
flipKey: '43'
|
|
1723
|
-
});
|
|
1724
|
-
|
|
1725
1658
|
this.timer = setInterval(() => {
|
|
1726
1659
|
if (this.props._destroy) return this.componentWillUnmount();
|
|
1727
1660
|
let cd = this.props.com.countdown || {};
|
|
@@ -1927,7 +1860,7 @@ const WEEKDAY_INDEX = {
|
|
|
1927
1860
|
saturday: 6
|
|
1928
1861
|
};
|
|
1929
1862
|
|
|
1930
|
-
class Flip extends common/* Com */.
|
|
1863
|
+
class Flip extends common/* Com */.up {
|
|
1931
1864
|
constructor(props) {
|
|
1932
1865
|
super(props);
|
|
1933
1866
|
this._tickRef = (0,preact_module/* createRef */.Vf)();
|
|
@@ -1970,8 +1903,6 @@ class Flip extends common/* Com */.M {
|
|
|
1970
1903
|
|
|
1971
1904
|
}
|
|
1972
1905
|
;// CONCATENATED MODULE: ./src/popup/popup.js
|
|
1973
|
-
function popup_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1974
|
-
|
|
1975
1906
|
|
|
1976
1907
|
|
|
1977
1908
|
|
|
@@ -1979,18 +1910,18 @@ function popup_defineProperty(obj, key, value) { if (key in obj) { Object.define
|
|
|
1979
1910
|
|
|
1980
1911
|
let popupCSS = (() => __webpack_require__.e(/* import() */ 782).then(__webpack_require__.bind(__webpack_require__, 9782)))();
|
|
1981
1912
|
|
|
1982
|
-
class Popup extends common/* Com */.
|
|
1913
|
+
class Popup extends common/* Com */.up {
|
|
1914
|
+
state = {
|
|
1915
|
+
close: false,
|
|
1916
|
+
cssready: false,
|
|
1917
|
+
closeAnimation: true,
|
|
1918
|
+
pressedSubmit: false,
|
|
1919
|
+
imageReady: false,
|
|
1920
|
+
fontReady: false
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1983
1923
|
constructor(props) {
|
|
1984
1924
|
super(props);
|
|
1985
|
-
|
|
1986
|
-
popup_defineProperty(this, "state", {
|
|
1987
|
-
close: false,
|
|
1988
|
-
cssready: false,
|
|
1989
|
-
closeAnimation: true,
|
|
1990
|
-
pressedSubmit: false,
|
|
1991
|
-
imageReady: false
|
|
1992
|
-
});
|
|
1993
|
-
|
|
1994
1925
|
this._formRef = (0,preact_module/* createRef */.Vf)();
|
|
1995
1926
|
setTimeout(() => this.fillForm(), 1000);
|
|
1996
1927
|
setTimeout(async () => {
|
|
@@ -2014,6 +1945,9 @@ class Popup extends common/* Com */.M {
|
|
|
2014
1945
|
}
|
|
2015
1946
|
});
|
|
2016
1947
|
});
|
|
1948
|
+
delete fonts.undefined;
|
|
1949
|
+
delete fonts.null;
|
|
1950
|
+
delete fonts[''];
|
|
2017
1951
|
if (util/* default.size */.Z.size(images) == 0) this.setState({
|
|
2018
1952
|
imageReady: true
|
|
2019
1953
|
});
|
|
@@ -2021,9 +1955,33 @@ class Popup extends common/* Com */.M {
|
|
|
2021
1955
|
imageReady: true
|
|
2022
1956
|
})));
|
|
2023
1957
|
util/* default.preloadWebfonts */.Z.preloadWebfonts(Object.keys(fonts));
|
|
1958
|
+
setTimeout(async () => {
|
|
1959
|
+
await this.waitForFont(Object.keys(fonts));
|
|
1960
|
+
this.setState({
|
|
1961
|
+
fontReady: true
|
|
1962
|
+
});
|
|
1963
|
+
});
|
|
2024
1964
|
});
|
|
2025
1965
|
}
|
|
2026
1966
|
|
|
1967
|
+
async waitForFont(fonts) {
|
|
1968
|
+
if (util/* default.size */.Z.size(fonts) == 0) return;
|
|
1969
|
+
let ready = {};
|
|
1970
|
+
|
|
1971
|
+
for (var t = 0; t < 10; t++) {
|
|
1972
|
+
for (var i = 0; i < fonts.length; i++) {
|
|
1973
|
+
try {
|
|
1974
|
+
if (document.fonts.check('normal 16px ' + fonts[i])) ready[fonts[i]] = true;
|
|
1975
|
+
if (Object.keys(readycount) == fonts.length) return;
|
|
1976
|
+
} catch (e) {}
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
await util/* default.sleep */.Z.sleep(200);
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
2027
1985
|
openPopup() {
|
|
2028
1986
|
this.setState({
|
|
2029
1987
|
close: false
|
|
@@ -2038,7 +1996,7 @@ class Popup extends common/* Com */.M {
|
|
|
2038
1996
|
isFormFilled() {
|
|
2039
1997
|
let page = util/* default.get */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
|
|
2040
1998
|
let form = util/* default.find */.Z.find(page.components, com => com.type === 'form');
|
|
2041
|
-
if (!form || !form.form) return;
|
|
1999
|
+
if (!form || !form.form) return true;
|
|
2042
2000
|
let fields = util/* default.get */.Z.get(form, 'form.fields', []);
|
|
2043
2001
|
let wrong = util/* default.find */.Z.find(fields, field => {
|
|
2044
2002
|
if (!field.is_required) return false;
|
|
@@ -2181,7 +2139,7 @@ class Popup extends common/* Com */.M {
|
|
|
2181
2139
|
}
|
|
2182
2140
|
|
|
2183
2141
|
if (hasConversion) {
|
|
2184
|
-
var formData = new FormData(this._formRef.current);
|
|
2142
|
+
var formData = this._formRef.current ? new FormData(this._formRef.current) : new FormData();
|
|
2185
2143
|
var summitFields = [];
|
|
2186
2144
|
let user = util/* default.cloneDeep */.Z.cloneDeep(this.props.store.matchUser());
|
|
2187
2145
|
|
|
@@ -2820,6 +2778,7 @@ class Popup extends common/* Com */.M {
|
|
|
2820
2778
|
if (!this.props.t) return null;
|
|
2821
2779
|
if (!this.state.cssready) return null;
|
|
2822
2780
|
if (!this.state.imageReady) return null;
|
|
2781
|
+
if (!this.state.fontReady) return null;
|
|
2823
2782
|
if (this.state.close) return null;
|
|
2824
2783
|
let popup = util/* default.get */.Z.get(this.props.plugin, 'popup', {});
|
|
2825
2784
|
let page = util/* default.get */.Z.get(popup, `pages.${this.getPageIndex()}`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = __webpack_public_path__ + "assets/img/emoji/messenger/sub_27.451_84.314.231e2b7.png";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = __webpack_public_path__ + "assets/img/emoji/messenger/sub_25.490_5.882.4b49e94.png";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = __webpack_public_path__ + "assets/img/emoji/messenger/sub_23.529_60.784.1420241.png";
|
package/dist/335.js
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(self["webpackChunk_subiz_widget_v4"] = self["webpackChunk_subiz_widget_v4"] || []).push([[335],{
|
|
3
|
+
|
|
4
|
+
/***/ 2335:
|
|
5
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
6
|
+
|
|
7
|
+
__webpack_require__.r(__webpack_exports__);
|
|
8
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
+
/* harmony export */ "default": () => (/* binding */ Contact),
|
|
10
|
+
/* harmony export */ "replaceCssVariable": () => (/* binding */ replaceCssVariable),
|
|
11
|
+
/* harmony export */ "DEFVAL": () => (/* binding */ DEFVAL)
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(819);
|
|
14
|
+
/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6400);
|
|
15
|
+
/* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2493);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
let CSS = (() => __webpack_require__.e(/* import() */ 678).then(__webpack_require__.bind(__webpack_require__, 2678)))();
|
|
21
|
+
|
|
22
|
+
class Contact extends _common_js__WEBPACK_IMPORTED_MODULE_2__/* .Com */ .up {
|
|
23
|
+
state = {
|
|
24
|
+
map: false,
|
|
25
|
+
map_loading: false,
|
|
26
|
+
map_initialized: false
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
constructor(props) {
|
|
30
|
+
super(props);
|
|
31
|
+
this.showMap = this.showMap.bind(this);
|
|
32
|
+
this.hideMap = this.hideMap.bind(this);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async initMap() {
|
|
36
|
+
if (this.map_initialized) return;
|
|
37
|
+
this.setState({
|
|
38
|
+
map_initialized: true,
|
|
39
|
+
map_loading: true
|
|
40
|
+
});
|
|
41
|
+
await new Loader({
|
|
42
|
+
apiKey: 'YOUR_API_KEY',
|
|
43
|
+
version: 'weekly'
|
|
44
|
+
}).load();
|
|
45
|
+
this.gmap = new google.maps.Map(document.getElementById('map'));
|
|
46
|
+
this.setState({
|
|
47
|
+
map_loading: false
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
js2css(js, onlyProps) {
|
|
52
|
+
return _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css(js, onlyProps, {
|
|
53
|
+
'@font_size': this.props.plugin.popup.font_size,
|
|
54
|
+
'@font_family': this.props.plugin.popup.font_family,
|
|
55
|
+
'@text_color': this.props.plugin.popup.text_color,
|
|
56
|
+
'@primary_color': this.props.plugin.popup.primary_color,
|
|
57
|
+
'@background': this.props.plugin.popup.background,
|
|
58
|
+
'@spacer0': spacer / 2 + 'px',
|
|
59
|
+
'@spacer': spacer + 'px',
|
|
60
|
+
'@spacer2': spacer * 2 + 'px',
|
|
61
|
+
'@spacer3': spacer * 3 + 'px'
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
renderMapButton(button) {
|
|
66
|
+
let icon = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("svg", {
|
|
67
|
+
width: "20px",
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
focusable: "false",
|
|
70
|
+
"data-prefix": "fas",
|
|
71
|
+
"data-icon": "map-marker-alt",
|
|
72
|
+
role: "img",
|
|
73
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
74
|
+
viewBox: "0 0 384 512",
|
|
75
|
+
class: "svg-inline--fa fa-map-marker-alt fa-w-12 fa-3x"
|
|
76
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("path", {
|
|
77
|
+
fill: "red",
|
|
78
|
+
d: "M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z",
|
|
79
|
+
class: ""
|
|
80
|
+
}));
|
|
81
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
82
|
+
class: "contact_button",
|
|
83
|
+
onClick: this.showMap
|
|
84
|
+
}, this.renderMapModal(button), icon);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async setMap(lat, lng) {
|
|
88
|
+
console.log('HEE');
|
|
89
|
+
await this.initMap();
|
|
90
|
+
console.log('HEE22');
|
|
91
|
+
window.gmap = this.gmap;
|
|
92
|
+
this.gmap.map.setCenter(new google.maps.LatLng(lat, lng));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
renderMapModal(button) {
|
|
96
|
+
let cls = 'map_modal';
|
|
97
|
+
if (this.state.map) cls += ' map_modal__show';else cls += ' map_modal__hide';
|
|
98
|
+
let overlaycls = 'overlay';
|
|
99
|
+
if (!this.state.map) overlaycls += ' overlay__hidden';
|
|
100
|
+
let $locations = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].map */ .Z.map(button.map.locations, loc => {
|
|
101
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
102
|
+
class: "map_location",
|
|
103
|
+
onClick: e => this.setMap(loc.latitude, loc.longitude)
|
|
104
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, loc.name), (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, loc.latitude), (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, loc.longitude));
|
|
105
|
+
});
|
|
106
|
+
$locations.unshift((0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
107
|
+
class: "map_title"
|
|
108
|
+
}, button.map.title));
|
|
109
|
+
let $map = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
110
|
+
id: "map",
|
|
111
|
+
style: "height: 100%; width: 100%"
|
|
112
|
+
}, ' ');
|
|
113
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
114
|
+
class: overlaycls,
|
|
115
|
+
onClick: this.hideMap
|
|
116
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
117
|
+
class: cls,
|
|
118
|
+
onClick: e => e.stopPropagation()
|
|
119
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
120
|
+
class: "map_body"
|
|
121
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
122
|
+
class: "map_locations"
|
|
123
|
+
}, $locations), $map, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
124
|
+
class: "mapouter"
|
|
125
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
126
|
+
class: "gmap_canvas"
|
|
127
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("iframe", {
|
|
128
|
+
width: "300",
|
|
129
|
+
height: "400",
|
|
130
|
+
id: "gmap_canvas",
|
|
131
|
+
src: "https://maps.google.com/maps?q=2880%20Broadway,%20New%20York&t=&z=13&ie=UTF8&iwloc=&output=embed",
|
|
132
|
+
frameborder: "0",
|
|
133
|
+
scrolling: "no",
|
|
134
|
+
marginheight: "0",
|
|
135
|
+
marginwidth: "0"
|
|
136
|
+
}))))));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
hideMap(e) {
|
|
140
|
+
e.stopPropagation();
|
|
141
|
+
this.setState({
|
|
142
|
+
map: false
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
showMap() {
|
|
147
|
+
this.setState({
|
|
148
|
+
map: true
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
renderZaloButton(button) {
|
|
153
|
+
let icon = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("svg", {
|
|
154
|
+
width: "20px ",
|
|
155
|
+
"aria-hidden": "true",
|
|
156
|
+
focusable: "false",
|
|
157
|
+
"data-prefix": "fab",
|
|
158
|
+
"data-icon": "facebook-f",
|
|
159
|
+
role: "img",
|
|
160
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
161
|
+
viewBox: "0 0 320 512",
|
|
162
|
+
class: "svg-inline--fa fa-facebook-f fa-w-10 fa-5x"
|
|
163
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("path", {
|
|
164
|
+
fill: "currentColor",
|
|
165
|
+
d: "M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z",
|
|
166
|
+
class: ""
|
|
167
|
+
}));
|
|
168
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
169
|
+
class: "contact_button"
|
|
170
|
+
}, icon);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
renderFacebookButton(button) {
|
|
174
|
+
let icon = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("svg", {
|
|
175
|
+
width: "20px ",
|
|
176
|
+
"aria-hidden": "true",
|
|
177
|
+
focusable: "false",
|
|
178
|
+
"data-prefix": "fab",
|
|
179
|
+
"data-icon": "facebook-f",
|
|
180
|
+
role: "img",
|
|
181
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
182
|
+
viewBox: "0 0 320 512",
|
|
183
|
+
class: "svg-inline--fa fa-facebook-f fa-w-10 fa-5x"
|
|
184
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("path", {
|
|
185
|
+
fill: "currentColor",
|
|
186
|
+
d: "M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z",
|
|
187
|
+
class: ""
|
|
188
|
+
}));
|
|
189
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
190
|
+
class: "contact_button"
|
|
191
|
+
}, icon);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
renderChatButton() {
|
|
195
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, "Chat");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
renderCallButton() {
|
|
199
|
+
let icon = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("svg", {
|
|
200
|
+
width: "20px",
|
|
201
|
+
"aria-hidden": "true",
|
|
202
|
+
focusable: "false",
|
|
203
|
+
"data-prefix": "fas",
|
|
204
|
+
"data-icon": "phone",
|
|
205
|
+
role: "img",
|
|
206
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
207
|
+
viewBox: "0 0 512 512",
|
|
208
|
+
class: "svg-inline--fa fa-phone fa-w-16 fa-7x"
|
|
209
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("path", {
|
|
210
|
+
fill: "currentColor",
|
|
211
|
+
d: "M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z",
|
|
212
|
+
class: ""
|
|
213
|
+
}));
|
|
214
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, icon);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
renderButtons(buttons) {
|
|
218
|
+
if (_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].size */ .Z.size(buttons) === 0) return null;
|
|
219
|
+
return _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].map */ .Z.map(buttons, button => {
|
|
220
|
+
if (button.type === 'map') return this.renderMapButton(button);
|
|
221
|
+
if (button.type === 'zalo') return this.renderZaloButton(button);
|
|
222
|
+
if (button.type === 'facebook') return this.renderFacebookButton(button);
|
|
223
|
+
if (button.type === 'call') return this.renderCallButton(button);
|
|
224
|
+
if (button.type === 'chat') return this.renderChatButton(button);
|
|
225
|
+
return null;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
renderByLayoutSideByStandard() {
|
|
230
|
+
let $buttons = this.renderButtons(this.props.plugin.contact.buttons);
|
|
231
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, $buttons);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
renderLineComponent(com) {
|
|
235
|
+
let style = Object.assign({}, com.style, this.props.mobile ? com.mobile_style : {});
|
|
236
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
237
|
+
style: this.js2css(style)
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
renderTextComponent(com) {
|
|
242
|
+
let style = Object.assign({}, com.style, this.props.mobile ? com.mobile_style : {});
|
|
243
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
244
|
+
class: "text",
|
|
245
|
+
style: this.js2css(style),
|
|
246
|
+
dangerouslySetInnerHTML: {
|
|
247
|
+
__html: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(com, 'text.html')
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
async refreshCSS() {
|
|
253
|
+
let css = (await CSS).default.default.toString();
|
|
254
|
+
var outcss = replaceCssVariable(css, this.props.plugin.popup);
|
|
255
|
+
_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].setCss */ .Z.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
|
|
256
|
+
this.setState({
|
|
257
|
+
cssready: true
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
componentDidMount() {
|
|
262
|
+
this.$cssStyleDiv = document.createElement('style');
|
|
263
|
+
document.head.appendChild(this.$cssStyleDiv);
|
|
264
|
+
this.$cssStyleDiv.type = 'text/css';
|
|
265
|
+
this.$cssStyleDiv.id = 'subiz-style-for-' + this.props.plugin.id;
|
|
266
|
+
this.refreshCSS();
|
|
267
|
+
let pluginstringify = JSON.stringify(this.props.plugin);
|
|
268
|
+
this.setState({
|
|
269
|
+
pluginjson: pluginstringify
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
render() {
|
|
274
|
+
if (!this.state.cssready) return null;
|
|
275
|
+
let pluginstringify = JSON.stringify(this.props.plugin);
|
|
276
|
+
|
|
277
|
+
if (this.state.pluginjson !== pluginstringify) {
|
|
278
|
+
this.refreshCSS();
|
|
279
|
+
setTimeout(() => this.setState({
|
|
280
|
+
pluginjson: pluginstringify
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (this.state.close) return null;
|
|
285
|
+
let containercss = '';
|
|
286
|
+
let bodycss = '';
|
|
287
|
+
let layout = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, 'contact.layout', 'standard');
|
|
288
|
+
let $body = null;
|
|
289
|
+
|
|
290
|
+
if (layout === 'standard' || !layout) {
|
|
291
|
+
$body = this.renderByLayoutSideByStandard();
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (layout === 'footer') {
|
|
295
|
+
$body = this.renderByLayoutFooter(_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, `popup.pages.${this.state.pageIndex}`));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (layout === 'mini') {
|
|
299
|
+
$body = this.renderByLayoutMini(_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, `popup.pages.${this.state.pageIndex}`));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (layout === 'docked') {
|
|
303
|
+
$body = this.renderByLayoutDocked(_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, `popup.pages.${this.state.pageIndex}`));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
let left, right, bottom, top, transform;
|
|
307
|
+
let position = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, 'contact.position', 'bottom-left');
|
|
308
|
+
|
|
309
|
+
if (position === 'center-left') {
|
|
310
|
+
left = '0';
|
|
311
|
+
top = '50%';
|
|
312
|
+
transform = 'translateY(-50%)';
|
|
313
|
+
} else if (position === 'top-left') {
|
|
314
|
+
left = '0';
|
|
315
|
+
top = '20px';
|
|
316
|
+
} else if (position === 'bottom-right') {
|
|
317
|
+
right = '0';
|
|
318
|
+
bottom = '20px';
|
|
319
|
+
} else if (position === 'center-right') {
|
|
320
|
+
right = '0';
|
|
321
|
+
top = '50%';
|
|
322
|
+
transform = 'translateY(-50%)';
|
|
323
|
+
} else if (position === 'top-right') {
|
|
324
|
+
right = '0';
|
|
325
|
+
top = '20px';
|
|
326
|
+
} else {
|
|
327
|
+
left = '0';
|
|
328
|
+
bottom = '20px';
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
332
|
+
style: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css({
|
|
333
|
+
position: 'absolute',
|
|
334
|
+
left,
|
|
335
|
+
right,
|
|
336
|
+
bottom,
|
|
337
|
+
top,
|
|
338
|
+
transform,
|
|
339
|
+
display: 'flex',
|
|
340
|
+
align_items: 'center',
|
|
341
|
+
justify_content: 'center',
|
|
342
|
+
overflow: 'hidden'
|
|
343
|
+
}),
|
|
344
|
+
onClick: e => e.stopPropagation()
|
|
345
|
+
}, $body);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function isEmpty(value) {
|
|
351
|
+
return value === undefined || value === null || value === '';
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
async function runCampaign(byTrigger) {
|
|
355
|
+
if (ran && byTrigger !== 'area_clicked') return;
|
|
356
|
+
ran = true;
|
|
357
|
+
pageIndex = 0;
|
|
358
|
+
let page = sb.get(camp, `pages.${pageIndex}`) || {};
|
|
359
|
+
showPage(page);
|
|
360
|
+
triggerType = byTrigger;
|
|
361
|
+
let {
|
|
362
|
+
body: impression
|
|
363
|
+
} = await store.sendImpression(camp.id, byTrigger);
|
|
364
|
+
impressionToken = sb.get(impression, 'impression_token') || '';
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function eq(a, b) {
|
|
368
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function replaceCssVariable(css, setting) {
|
|
372
|
+
var tokens = [css];
|
|
373
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@font_family'");
|
|
374
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@font_size'");
|
|
375
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@text_color'");
|
|
376
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@primary_color'");
|
|
377
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@background'");
|
|
378
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@spacer'");
|
|
379
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@spacer0'");
|
|
380
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@spacer2'");
|
|
381
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@spacer3'");
|
|
382
|
+
var ret = [];
|
|
383
|
+
|
|
384
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
385
|
+
var item = tokens[i];
|
|
386
|
+
|
|
387
|
+
if (typeof item === 'string') {
|
|
388
|
+
ret.push(item);
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
var path = item.type.substr(2, item.type.length - 3);
|
|
393
|
+
var val = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(setting, path) || _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(DEFVAL, path) || '';
|
|
394
|
+
ret.push(val);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return ret.join('');
|
|
398
|
+
}
|
|
399
|
+
const DEFVAL = {
|
|
400
|
+
font_size: '16px',
|
|
401
|
+
font_family: 'roboto',
|
|
402
|
+
text_color: '#333',
|
|
403
|
+
primary_color: '#333'
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
/***/ })
|
|
407
|
+
|
|
408
|
+
}]);
|