@subiz/widget-v4 4.0.59 → 4.0.64
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/babel.config.js +2 -4
- package/compiled_src/bot.js +7 -1
- package/compiled_src/chatbox/DropdownSelect.js +248 -0
- package/compiled_src/chatbox/Event.js +4 -2
- package/compiled_src/chatbox/Events.js +1 -0
- package/compiled_src/chatbox/Order.js +285 -0
- package/compiled_src/chatbox/OrderAttachments.js +2 -1
- package/compiled_src/chatbox/TextMessage.js +9 -2
- package/compiled_src/chatbox/Widget.js +44 -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 +1 -3
- package/compiled_src/order/address_picker.js +249 -0
- package/compiled_src/order/icon.js +62 -0
- package/compiled_src/order/index.js +113 -0
- package/compiled_src/order/order.js +1234 -0
- package/compiled_src/plugin.js +9 -42
- package/compiled_src/popup/popup.js +2 -2
- package/compiled_src/store/api.js +20 -0
- package/compiled_src/store/store.js +42 -0
- package/compiled_src/util/common.js +36 -2
- package/dist/0b82fa7e5c3b07b40a44.png +1 -0
- package/dist/0f4af006e38ee8b93633.png +1 -0
- package/dist/{74.js → 132.js} +2322 -279
- package/dist/178.js +341 -174
- package/dist/17ee31b89ac.132.js +1 -0
- package/dist/17ee31b89ac.178.js +1 -0
- package/dist/17ee31b89ac.213.js +1 -0
- package/dist/17ee31b89ac.335.js +1 -0
- package/dist/17ee31b89ac.362.js +1 -0
- package/dist/17ee31b89ac.441.js +1 -0
- package/dist/17ee31b89ac.605.js +1 -0
- package/dist/17ee31b89ac.678.js +1 -0
- package/dist/17ee31b89ac.782.js +1 -0
- package/dist/17ee31b89ac.app.js +1 -0
- package/dist/{17d939953e0.index.html → 17ee31b89ac.index.html} +3 -18
- package/dist/{17d939953e0.library.html → 17ee31b89ac.library.html} +3 -18
- package/dist/17ee31b89ac.library.js +1 -0
- package/dist/{17d939953e0.preview.html → 17ee31b89ac.preview.html} +1 -1
- package/dist/17ee31b89ac.preview.js +1 -0
- package/dist/17ee31b89ac.screenshoot.js +1 -0
- package/dist/1ea1c6cd21d25176810c.png +1 -0
- package/dist/213.js +35 -70
- package/dist/292d42404e1b03398f61.png +1 -0
- package/dist/312d376370831b7bea83.png +1 -0
- package/dist/313d1bfc1cf776d1aefe.png +1 -0
- package/dist/335.js +411 -0
- package/dist/362.js +71 -21
- package/dist/441.js +70 -44
- package/dist/4aa58bb7a66bb44975aa.png +1 -0
- package/dist/56ce063bc6c81adb7322.png +1 -0
- package/dist/605.js +1 -64
- 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 +211 -48
- package/index.html +3 -18
- package/order.html +32 -0
- package/package.json +14 -15
- package/src/bot.js +2 -1
- 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 +2 -2
- package/src/store/api.js +26 -1
- package/src/store/store.js +46 -9
- package/src/util/common.js +48 -2
- package/webpack.dev.js +2 -0
- package/dist/17d939953e0.178.js +0 -1
- package/dist/17d939953e0.213.js +0 -1
- package/dist/17d939953e0.362.js +0 -1
- package/dist/17d939953e0.441.js +0 -1
- package/dist/17d939953e0.605.js +0 -1
- package/dist/17d939953e0.619.js +0 -1
- package/dist/17d939953e0.678.js +0 -1
- package/dist/17d939953e0.74.js +0 -1
- package/dist/17d939953e0.782.js +0 -1
- package/dist/17d939953e0.app.js +0 -1
- package/dist/17d939953e0.library.js +0 -1
- package/dist/17d939953e0.preview.js +0 -1
- package/dist/17d939953e0.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
|
|
|
@@ -1714,7 +1650,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
1714
1650
|
|
|
1715
1651
|
tick_core_commonjs.plugin.add((tick_view_flip_commonjs_default()));
|
|
1716
1652
|
|
|
1717
|
-
class Countdown extends common/* Com */.
|
|
1653
|
+
class Countdown extends common/* Com */.up {
|
|
1718
1654
|
constructor(props) {
|
|
1719
1655
|
super(props);
|
|
1720
1656
|
|
|
@@ -1927,7 +1863,7 @@ const WEEKDAY_INDEX = {
|
|
|
1927
1863
|
saturday: 6
|
|
1928
1864
|
};
|
|
1929
1865
|
|
|
1930
|
-
class Flip extends common/* Com */.
|
|
1866
|
+
class Flip extends common/* Com */.up {
|
|
1931
1867
|
constructor(props) {
|
|
1932
1868
|
super(props);
|
|
1933
1869
|
this._tickRef = (0,preact_module/* createRef */.Vf)();
|
|
@@ -1979,7 +1915,7 @@ function popup_defineProperty(obj, key, value) { if (key in obj) { Object.define
|
|
|
1979
1915
|
|
|
1980
1916
|
let popupCSS = (() => __webpack_require__.e(/* import() */ 782).then(__webpack_require__.bind(__webpack_require__, 9782)))();
|
|
1981
1917
|
|
|
1982
|
-
class Popup extends common/* Com */.
|
|
1918
|
+
class Popup extends common/* Com */.up {
|
|
1983
1919
|
constructor(props) {
|
|
1984
1920
|
super(props);
|
|
1985
1921
|
|
|
@@ -1988,7 +1924,8 @@ class Popup extends common/* Com */.M {
|
|
|
1988
1924
|
cssready: false,
|
|
1989
1925
|
closeAnimation: true,
|
|
1990
1926
|
pressedSubmit: false,
|
|
1991
|
-
imageReady: false
|
|
1927
|
+
imageReady: false,
|
|
1928
|
+
fontReady: false
|
|
1992
1929
|
});
|
|
1993
1930
|
|
|
1994
1931
|
this._formRef = (0,preact_module/* createRef */.Vf)();
|
|
@@ -2014,6 +1951,9 @@ class Popup extends common/* Com */.M {
|
|
|
2014
1951
|
}
|
|
2015
1952
|
});
|
|
2016
1953
|
});
|
|
1954
|
+
delete fonts.undefined;
|
|
1955
|
+
delete fonts.null;
|
|
1956
|
+
delete fonts[''];
|
|
2017
1957
|
if (util/* default.size */.Z.size(images) == 0) this.setState({
|
|
2018
1958
|
imageReady: true
|
|
2019
1959
|
});
|
|
@@ -2021,9 +1961,33 @@ class Popup extends common/* Com */.M {
|
|
|
2021
1961
|
imageReady: true
|
|
2022
1962
|
})));
|
|
2023
1963
|
util/* default.preloadWebfonts */.Z.preloadWebfonts(Object.keys(fonts));
|
|
1964
|
+
setTimeout(async () => {
|
|
1965
|
+
await this.waitForFont(Object.keys(fonts));
|
|
1966
|
+
this.setState({
|
|
1967
|
+
fontReady: true
|
|
1968
|
+
});
|
|
1969
|
+
});
|
|
2024
1970
|
});
|
|
2025
1971
|
}
|
|
2026
1972
|
|
|
1973
|
+
async waitForFont(fonts) {
|
|
1974
|
+
if (util/* default.size */.Z.size(fonts) == 0) return;
|
|
1975
|
+
let ready = {};
|
|
1976
|
+
|
|
1977
|
+
for (var t = 0; t < 10; t++) {
|
|
1978
|
+
for (var i = 0; i < fonts.length; i++) {
|
|
1979
|
+
try {
|
|
1980
|
+
if (document.fonts.check('normal 16px ' + fonts[i])) ready[fonts[i]] = true;
|
|
1981
|
+
if (Object.keys(readycount) == fonts.length) return;
|
|
1982
|
+
} catch (e) {}
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
await util/* default.sleep */.Z.sleep(200);
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
return;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
2027
1991
|
openPopup() {
|
|
2028
1992
|
this.setState({
|
|
2029
1993
|
close: false
|
|
@@ -2038,7 +2002,7 @@ class Popup extends common/* Com */.M {
|
|
|
2038
2002
|
isFormFilled() {
|
|
2039
2003
|
let page = util/* default.get */.Z.get(this.props.plugin.popup, `pages.${this.getPageIndex()}`);
|
|
2040
2004
|
let form = util/* default.find */.Z.find(page.components, com => com.type === 'form');
|
|
2041
|
-
if (!form || !form.form) return;
|
|
2005
|
+
if (!form || !form.form) return true;
|
|
2042
2006
|
let fields = util/* default.get */.Z.get(form, 'form.fields', []);
|
|
2043
2007
|
let wrong = util/* default.find */.Z.find(fields, field => {
|
|
2044
2008
|
if (!field.is_required) return false;
|
|
@@ -2181,7 +2145,7 @@ class Popup extends common/* Com */.M {
|
|
|
2181
2145
|
}
|
|
2182
2146
|
|
|
2183
2147
|
if (hasConversion) {
|
|
2184
|
-
var formData = new FormData(this._formRef.current);
|
|
2148
|
+
var formData = this._formRef.current ? new FormData(this._formRef.current) : new FormData();
|
|
2185
2149
|
var summitFields = [];
|
|
2186
2150
|
let user = util/* default.cloneDeep */.Z.cloneDeep(this.props.store.matchUser());
|
|
2187
2151
|
|
|
@@ -2820,6 +2784,7 @@ class Popup extends common/* Com */.M {
|
|
|
2820
2784
|
if (!this.props.t) return null;
|
|
2821
2785
|
if (!this.state.cssready) return null;
|
|
2822
2786
|
if (!this.state.imageReady) return null;
|
|
2787
|
+
if (!this.state.fontReady) return null;
|
|
2823
2788
|
if (this.state.close) return null;
|
|
2824
2789
|
let popup = util/* default.get */.Z.get(this.props.plugin, 'popup', {});
|
|
2825
2790
|
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,411 @@
|
|
|
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
|
+
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; }
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
let CSS = (() => __webpack_require__.e(/* import() */ 678).then(__webpack_require__.bind(__webpack_require__, 2678)))();
|
|
23
|
+
|
|
24
|
+
class Contact extends _common_js__WEBPACK_IMPORTED_MODULE_2__/* .Com */ .up {
|
|
25
|
+
constructor(props) {
|
|
26
|
+
super(props);
|
|
27
|
+
|
|
28
|
+
_defineProperty(this, "state", {
|
|
29
|
+
map: false,
|
|
30
|
+
map_loading: false,
|
|
31
|
+
map_initialized: false
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
this.showMap = this.showMap.bind(this);
|
|
35
|
+
this.hideMap = this.hideMap.bind(this);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async initMap() {
|
|
39
|
+
if (this.map_initialized) return;
|
|
40
|
+
this.setState({
|
|
41
|
+
map_initialized: true,
|
|
42
|
+
map_loading: true
|
|
43
|
+
});
|
|
44
|
+
await new Loader({
|
|
45
|
+
apiKey: 'YOUR_API_KEY',
|
|
46
|
+
version: 'weekly'
|
|
47
|
+
}).load();
|
|
48
|
+
this.gmap = new google.maps.Map(document.getElementById('map'));
|
|
49
|
+
this.setState({
|
|
50
|
+
map_loading: false
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
js2css(js, onlyProps) {
|
|
55
|
+
return _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css(js, onlyProps, {
|
|
56
|
+
'@font_size': this.props.plugin.popup.font_size,
|
|
57
|
+
'@font_family': this.props.plugin.popup.font_family,
|
|
58
|
+
'@text_color': this.props.plugin.popup.text_color,
|
|
59
|
+
'@primary_color': this.props.plugin.popup.primary_color,
|
|
60
|
+
'@background': this.props.plugin.popup.background,
|
|
61
|
+
'@spacer0': spacer / 2 + 'px',
|
|
62
|
+
'@spacer': spacer + 'px',
|
|
63
|
+
'@spacer2': spacer * 2 + 'px',
|
|
64
|
+
'@spacer3': spacer * 3 + 'px'
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
renderMapButton(button) {
|
|
69
|
+
let icon = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("svg", {
|
|
70
|
+
width: "20px",
|
|
71
|
+
"aria-hidden": "true",
|
|
72
|
+
focusable: "false",
|
|
73
|
+
"data-prefix": "fas",
|
|
74
|
+
"data-icon": "map-marker-alt",
|
|
75
|
+
role: "img",
|
|
76
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
77
|
+
viewBox: "0 0 384 512",
|
|
78
|
+
class: "svg-inline--fa fa-map-marker-alt fa-w-12 fa-3x"
|
|
79
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("path", {
|
|
80
|
+
fill: "red",
|
|
81
|
+
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",
|
|
82
|
+
class: ""
|
|
83
|
+
}));
|
|
84
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
85
|
+
class: "contact_button",
|
|
86
|
+
onClick: this.showMap
|
|
87
|
+
}, this.renderMapModal(button), icon);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async setMap(lat, lng) {
|
|
91
|
+
console.log('HEE');
|
|
92
|
+
await this.initMap();
|
|
93
|
+
console.log('HEE22');
|
|
94
|
+
window.gmap = this.gmap;
|
|
95
|
+
this.gmap.map.setCenter(new google.maps.LatLng(lat, lng));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
renderMapModal(button) {
|
|
99
|
+
let cls = 'map_modal';
|
|
100
|
+
if (this.state.map) cls += ' map_modal__show';else cls += ' map_modal__hide';
|
|
101
|
+
let overlaycls = 'overlay';
|
|
102
|
+
if (!this.state.map) overlaycls += ' overlay__hidden';
|
|
103
|
+
let $locations = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].map */ .Z.map(button.map.locations, loc => {
|
|
104
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
105
|
+
class: "map_location",
|
|
106
|
+
onClick: e => this.setMap(loc.latitude, loc.longitude)
|
|
107
|
+
}, (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));
|
|
108
|
+
});
|
|
109
|
+
$locations.unshift((0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
110
|
+
class: "map_title"
|
|
111
|
+
}, button.map.title));
|
|
112
|
+
let $map = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
113
|
+
id: "map",
|
|
114
|
+
style: "height: 100%; width: 100%"
|
|
115
|
+
}, ' ');
|
|
116
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
117
|
+
class: overlaycls,
|
|
118
|
+
onClick: this.hideMap
|
|
119
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
120
|
+
class: cls,
|
|
121
|
+
onClick: e => e.stopPropagation()
|
|
122
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
123
|
+
class: "map_body"
|
|
124
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
125
|
+
class: "map_locations"
|
|
126
|
+
}, $locations), $map, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
127
|
+
class: "mapouter"
|
|
128
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
129
|
+
class: "gmap_canvas"
|
|
130
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("iframe", {
|
|
131
|
+
width: "300",
|
|
132
|
+
height: "400",
|
|
133
|
+
id: "gmap_canvas",
|
|
134
|
+
src: "https://maps.google.com/maps?q=2880%20Broadway,%20New%20York&t=&z=13&ie=UTF8&iwloc=&output=embed",
|
|
135
|
+
frameborder: "0",
|
|
136
|
+
scrolling: "no",
|
|
137
|
+
marginheight: "0",
|
|
138
|
+
marginwidth: "0"
|
|
139
|
+
}))))));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
hideMap(e) {
|
|
143
|
+
e.stopPropagation();
|
|
144
|
+
this.setState({
|
|
145
|
+
map: false
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
showMap() {
|
|
150
|
+
this.setState({
|
|
151
|
+
map: true
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
renderZaloButton(button) {
|
|
156
|
+
let icon = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("svg", {
|
|
157
|
+
width: "20px ",
|
|
158
|
+
"aria-hidden": "true",
|
|
159
|
+
focusable: "false",
|
|
160
|
+
"data-prefix": "fab",
|
|
161
|
+
"data-icon": "facebook-f",
|
|
162
|
+
role: "img",
|
|
163
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
164
|
+
viewBox: "0 0 320 512",
|
|
165
|
+
class: "svg-inline--fa fa-facebook-f fa-w-10 fa-5x"
|
|
166
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("path", {
|
|
167
|
+
fill: "currentColor",
|
|
168
|
+
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",
|
|
169
|
+
class: ""
|
|
170
|
+
}));
|
|
171
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
172
|
+
class: "contact_button"
|
|
173
|
+
}, icon);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
renderFacebookButton(button) {
|
|
177
|
+
let icon = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("svg", {
|
|
178
|
+
width: "20px ",
|
|
179
|
+
"aria-hidden": "true",
|
|
180
|
+
focusable: "false",
|
|
181
|
+
"data-prefix": "fab",
|
|
182
|
+
"data-icon": "facebook-f",
|
|
183
|
+
role: "img",
|
|
184
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
185
|
+
viewBox: "0 0 320 512",
|
|
186
|
+
class: "svg-inline--fa fa-facebook-f fa-w-10 fa-5x"
|
|
187
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("path", {
|
|
188
|
+
fill: "currentColor",
|
|
189
|
+
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",
|
|
190
|
+
class: ""
|
|
191
|
+
}));
|
|
192
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
193
|
+
class: "contact_button"
|
|
194
|
+
}, icon);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
renderChatButton() {
|
|
198
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, "Chat");
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
renderCallButton() {
|
|
202
|
+
let icon = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("svg", {
|
|
203
|
+
width: "20px",
|
|
204
|
+
"aria-hidden": "true",
|
|
205
|
+
focusable: "false",
|
|
206
|
+
"data-prefix": "fas",
|
|
207
|
+
"data-icon": "phone",
|
|
208
|
+
role: "img",
|
|
209
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
210
|
+
viewBox: "0 0 512 512",
|
|
211
|
+
class: "svg-inline--fa fa-phone fa-w-16 fa-7x"
|
|
212
|
+
}, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("path", {
|
|
213
|
+
fill: "currentColor",
|
|
214
|
+
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",
|
|
215
|
+
class: ""
|
|
216
|
+
}));
|
|
217
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, icon);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
renderButtons(buttons) {
|
|
221
|
+
if (_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].size */ .Z.size(buttons) === 0) return null;
|
|
222
|
+
return _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].map */ .Z.map(buttons, button => {
|
|
223
|
+
if (button.type === 'map') return this.renderMapButton(button);
|
|
224
|
+
if (button.type === 'zalo') return this.renderZaloButton(button);
|
|
225
|
+
if (button.type === 'facebook') return this.renderFacebookButton(button);
|
|
226
|
+
if (button.type === 'call') return this.renderCallButton(button);
|
|
227
|
+
if (button.type === 'chat') return this.renderChatButton(button);
|
|
228
|
+
return null;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
renderByLayoutSideByStandard() {
|
|
233
|
+
let $buttons = this.renderButtons(this.props.plugin.contact.buttons);
|
|
234
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", null, $buttons);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
renderLineComponent(com) {
|
|
238
|
+
let style = Object.assign({}, com.style, this.props.mobile ? com.mobile_style : {});
|
|
239
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
240
|
+
style: this.js2css(style)
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
renderTextComponent(com) {
|
|
245
|
+
let style = Object.assign({}, com.style, this.props.mobile ? com.mobile_style : {});
|
|
246
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
247
|
+
class: "text",
|
|
248
|
+
style: this.js2css(style),
|
|
249
|
+
dangerouslySetInnerHTML: {
|
|
250
|
+
__html: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(com, 'text.html')
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
async refreshCSS() {
|
|
256
|
+
let css = (await CSS).default.default.toString();
|
|
257
|
+
var outcss = replaceCssVariable(css, this.props.plugin.popup);
|
|
258
|
+
_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].setCss */ .Z.setCss(this.props.plugin.id, this.$cssStyleDiv, outcss);
|
|
259
|
+
this.setState({
|
|
260
|
+
cssready: true
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
componentDidMount() {
|
|
265
|
+
this.$cssStyleDiv = document.createElement('style');
|
|
266
|
+
document.head.appendChild(this.$cssStyleDiv);
|
|
267
|
+
this.$cssStyleDiv.type = 'text/css';
|
|
268
|
+
this.$cssStyleDiv.id = 'subiz-style-for-' + this.props.plugin.id;
|
|
269
|
+
this.refreshCSS();
|
|
270
|
+
let pluginstringify = JSON.stringify(this.props.plugin);
|
|
271
|
+
this.setState({
|
|
272
|
+
pluginjson: pluginstringify
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
render() {
|
|
277
|
+
if (!this.state.cssready) return null;
|
|
278
|
+
let pluginstringify = JSON.stringify(this.props.plugin);
|
|
279
|
+
|
|
280
|
+
if (this.state.pluginjson !== pluginstringify) {
|
|
281
|
+
this.refreshCSS();
|
|
282
|
+
setTimeout(() => this.setState({
|
|
283
|
+
pluginjson: pluginstringify
|
|
284
|
+
}));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (this.state.close) return null;
|
|
288
|
+
let containercss = '';
|
|
289
|
+
let bodycss = '';
|
|
290
|
+
let layout = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, 'contact.layout', 'standard');
|
|
291
|
+
let $body = null;
|
|
292
|
+
|
|
293
|
+
if (layout === 'standard' || !layout) {
|
|
294
|
+
$body = this.renderByLayoutSideByStandard();
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (layout === 'footer') {
|
|
298
|
+
$body = this.renderByLayoutFooter(_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, `popup.pages.${this.state.pageIndex}`));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (layout === 'mini') {
|
|
302
|
+
$body = this.renderByLayoutMini(_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, `popup.pages.${this.state.pageIndex}`));
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (layout === 'docked') {
|
|
306
|
+
$body = this.renderByLayoutDocked(_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, `popup.pages.${this.state.pageIndex}`));
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
let left, right, bottom, top, transform;
|
|
310
|
+
let position = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(this.props.plugin, 'contact.position', 'bottom-left');
|
|
311
|
+
|
|
312
|
+
if (position === 'center-left') {
|
|
313
|
+
left = '0';
|
|
314
|
+
top = '50%';
|
|
315
|
+
transform = 'translateY(-50%)';
|
|
316
|
+
} else if (position === 'top-left') {
|
|
317
|
+
left = '0';
|
|
318
|
+
top = '20px';
|
|
319
|
+
} else if (position === 'bottom-right') {
|
|
320
|
+
right = '0';
|
|
321
|
+
bottom = '20px';
|
|
322
|
+
} else if (position === 'center-right') {
|
|
323
|
+
right = '0';
|
|
324
|
+
top = '50%';
|
|
325
|
+
transform = 'translateY(-50%)';
|
|
326
|
+
} else if (position === 'top-right') {
|
|
327
|
+
right = '0';
|
|
328
|
+
top = '20px';
|
|
329
|
+
} else {
|
|
330
|
+
left = '0';
|
|
331
|
+
bottom = '20px';
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
|
|
335
|
+
style: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css({
|
|
336
|
+
position: 'absolute',
|
|
337
|
+
left,
|
|
338
|
+
right,
|
|
339
|
+
bottom,
|
|
340
|
+
top,
|
|
341
|
+
transform,
|
|
342
|
+
display: 'flex',
|
|
343
|
+
align_items: 'center',
|
|
344
|
+
justify_content: 'center',
|
|
345
|
+
overflow: 'hidden'
|
|
346
|
+
}),
|
|
347
|
+
onClick: e => e.stopPropagation()
|
|
348
|
+
}, $body);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function isEmpty(value) {
|
|
354
|
+
return value === undefined || value === null || value === '';
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
async function runCampaign(byTrigger) {
|
|
358
|
+
if (ran && byTrigger !== 'area_clicked') return;
|
|
359
|
+
ran = true;
|
|
360
|
+
pageIndex = 0;
|
|
361
|
+
let page = sb.get(camp, `pages.${pageIndex}`) || {};
|
|
362
|
+
showPage(page);
|
|
363
|
+
triggerType = byTrigger;
|
|
364
|
+
let {
|
|
365
|
+
body: impression
|
|
366
|
+
} = await store.sendImpression(camp.id, byTrigger);
|
|
367
|
+
impressionToken = sb.get(impression, 'impression_token') || '';
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function eq(a, b) {
|
|
371
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function replaceCssVariable(css, setting) {
|
|
375
|
+
var tokens = [css];
|
|
376
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@font_family'");
|
|
377
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@font_size'");
|
|
378
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@text_color'");
|
|
379
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@primary_color'");
|
|
380
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@background'");
|
|
381
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@spacer'");
|
|
382
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@spacer0'");
|
|
383
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@spacer2'");
|
|
384
|
+
tokens = _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].tokenize */ .Z.tokenize(tokens, "'@spacer3'");
|
|
385
|
+
var ret = [];
|
|
386
|
+
|
|
387
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
388
|
+
var item = tokens[i];
|
|
389
|
+
|
|
390
|
+
if (typeof item === 'string') {
|
|
391
|
+
ret.push(item);
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
var path = item.type.substr(2, item.type.length - 3);
|
|
396
|
+
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) || '';
|
|
397
|
+
ret.push(val);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return ret.join('');
|
|
401
|
+
}
|
|
402
|
+
const DEFVAL = {
|
|
403
|
+
font_size: '16px',
|
|
404
|
+
font_family: 'roboto',
|
|
405
|
+
text_color: '#333',
|
|
406
|
+
primary_color: '#333'
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
/***/ })
|
|
410
|
+
|
|
411
|
+
}]);
|