@subiz/widget-v4 4.0.61 → 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.
Files changed (154) hide show
  1. package/assets/img/caret.svg +1 -0
  2. package/assets/img/done_green.svg +4 -0
  3. package/assets/img/empty_1.svg +11 -0
  4. package/assets/img/ghn.svg +17 -0
  5. package/assets/img/ghtk.svg +18 -0
  6. package/assets/img/home.svg +1 -0
  7. package/assets/img/info.svg +1 -0
  8. package/assets/img/loader.svg +1 -0
  9. package/assets/img/map-pin.svg +1 -0
  10. package/assets/img/not_found_search.png +0 -0
  11. package/assets/img/package.svg +5 -0
  12. package/assets/img/package_fade.svg +1 -0
  13. package/assets/img/phone.svg +1 -0
  14. package/assets/img/search.svg +1 -0
  15. package/assets/img/shop.svg +1 -0
  16. package/assets/img/shop_faded.svg +1 -0
  17. package/assets/img/user.svg +1 -0
  18. package/assets/img/x.svg +5 -0
  19. package/assets/less/chatbox.less +33 -0
  20. package/assets/less/dropdown_select.less +130 -0
  21. package/assets/less/form.less +7 -20
  22. package/assets/less/order.less +489 -0
  23. package/assets/less/rating.less +3 -8
  24. package/compiled_src/call/call.js +12 -15
  25. package/compiled_src/chatbox/DropdownSelect.js +239 -0
  26. package/compiled_src/chatbox/Event.js +4 -2
  27. package/compiled_src/chatbox/Events.js +1 -0
  28. package/compiled_src/chatbox/MessageInput.js +4 -7
  29. package/compiled_src/chatbox/Order.js +281 -0
  30. package/compiled_src/chatbox/OrderAttachments.js +2 -1
  31. package/compiled_src/chatbox/Rating.js +7 -10
  32. package/compiled_src/chatbox/TextMessage.js +9 -2
  33. package/compiled_src/chatbox/Widget.js +40 -3
  34. package/compiled_src/chatbox/spinner.js +1 -1
  35. package/compiled_src/chatbox/time.js +3 -1
  36. package/compiled_src/common.js +40 -1
  37. package/compiled_src/contact/contact.js +7 -12
  38. package/compiled_src/lib.js +9 -14
  39. package/compiled_src/notif/notif.js +12 -15
  40. package/compiled_src/order/address_picker.js +241 -0
  41. package/compiled_src/order/icon.js +62 -0
  42. package/compiled_src/order/index.js +113 -0
  43. package/compiled_src/order/order.js +1220 -0
  44. package/compiled_src/plugin.js +9 -42
  45. package/compiled_src/popup/countdown.js +4 -7
  46. package/compiled_src/popup/popup.js +9 -12
  47. package/compiled_src/store/api.js +80 -90
  48. package/compiled_src/store/api_fake.js +55 -82
  49. package/compiled_src/store/store.js +163 -158
  50. package/compiled_src/util/common.js +36 -2
  51. package/dist/0b82fa7e5c3b07b40a44.png +1 -0
  52. package/dist/0f4af006e38ee8b93633.png +1 -0
  53. package/dist/{74.js → 132.js} +2232 -235
  54. package/dist/178.js +341 -174
  55. package/dist/17e757ccadd.132.js +1 -0
  56. package/dist/17e757ccadd.178.js +1 -0
  57. package/dist/17e757ccadd.213.js +1 -0
  58. package/dist/17e757ccadd.335.js +1 -0
  59. package/dist/17e757ccadd.362.js +1 -0
  60. package/dist/17e757ccadd.441.js +1 -0
  61. package/dist/17e757ccadd.605.js +1 -0
  62. package/dist/17e757ccadd.678.js +1 -0
  63. package/dist/17e757ccadd.782.js +1 -0
  64. package/dist/17e757ccadd.app.js +1 -0
  65. package/dist/{17db8166252.index.html → 17e757ccadd.index.html} +1 -1
  66. package/dist/{17db8166252.library.html → 17e757ccadd.library.html} +1 -1
  67. package/dist/17e757ccadd.library.js +1 -0
  68. package/dist/{17db8166252.preview.html → 17e757ccadd.preview.html} +1 -1
  69. package/dist/17e757ccadd.preview.js +1 -0
  70. package/dist/17e757ccadd.screenshoot.js +1 -0
  71. package/dist/1ea1c6cd21d25176810c.png +1 -0
  72. package/dist/213.js +18 -88
  73. package/dist/292d42404e1b03398f61.png +1 -0
  74. package/dist/312d376370831b7bea83.png +1 -0
  75. package/dist/313d1bfc1cf776d1aefe.png +1 -0
  76. package/dist/335.js +408 -0
  77. package/dist/362.js +71 -21
  78. package/dist/441.js +69 -43
  79. package/dist/4aa58bb7a66bb44975aa.png +1 -0
  80. package/dist/56ce063bc6c81adb7322.png +1 -0
  81. package/dist/605.js +13 -79
  82. package/dist/678.js +70 -20
  83. package/dist/6a411166ef5cc79e0714.png +1 -0
  84. package/dist/6faf403782fefacc1649.png +1 -0
  85. package/dist/782.js +118 -21
  86. package/dist/79dca33c68fab79c067f.png +1 -0
  87. package/dist/82da1578fa84f9debaeb.png +1 -0
  88. package/dist/8b8e0f0824743974b282.png +1 -0
  89. package/dist/8d551390d81e39130a3c.png +1 -0
  90. package/dist/9fc61b9479877ebdb6c7.png +1 -0
  91. package/dist/HASH +1 -1
  92. package/dist/a165d31dcb3dc90f1057.png +1 -0
  93. package/dist/a98d4a5698812c4426b3.png +1 -0
  94. package/dist/assets/img/caret.998eb8f.svg +1 -0
  95. package/dist/assets/img/done_green.b817fd4.svg +4 -0
  96. package/dist/assets/img/empty_1.0b98af0.svg +11 -0
  97. package/dist/assets/img/ghn.070f8e3.svg +17 -0
  98. package/dist/assets/img/ghtk.326eac1.svg +18 -0
  99. package/dist/assets/img/info.ebce7ea.svg +1 -0
  100. package/dist/assets/img/loader.37000a7.svg +1 -0
  101. package/dist/assets/img/not_found_search.2ddb8d1.png +0 -0
  102. package/dist/assets/img/package.8d37d0f.svg +5 -0
  103. package/dist/assets/img/package_fade.763c001.svg +1 -0
  104. package/dist/assets/img/search.f9705ff.svg +1 -0
  105. package/dist/assets/img/shop.f7dc7d8.svg +1 -0
  106. package/dist/assets/img/shop_faded.df7845a.svg +1 -0
  107. package/dist/assets/img/x.26fdfa3.svg +5 -0
  108. package/dist/c41606bf9d1b604e46d5.png +1 -0
  109. package/dist/ce1f7450ce6c1aacd330.png +1 -0
  110. package/dist/cf8c01e88f4770a6e3e5.png +1 -0
  111. package/dist/dfbcfeab1d5622a737e2.png +1 -0
  112. package/dist/e4893ed8c2f7b8329919.png +1 -0
  113. package/dist/ec2ab4eb4ef73d186186.png +1 -0
  114. package/dist/screenshoot.html +1 -1
  115. package/dist/screenshoot.js +448 -386
  116. package/order.html +19 -771
  117. package/package.json +12 -13
  118. package/src/chatbox/DropdownSelect.js +229 -0
  119. package/src/chatbox/Event.js +2 -2
  120. package/src/chatbox/Events.js +43 -42
  121. package/src/chatbox/Order.js +232 -0
  122. package/src/chatbox/OrderAttachments.js +2 -1
  123. package/src/chatbox/TextMessage.js +21 -12
  124. package/src/chatbox/Widget.js +34 -4
  125. package/src/chatbox/spinner.js +1 -1
  126. package/src/chatbox/time.js +1 -1
  127. package/src/common.js +52 -8
  128. package/src/contact/contact.js +1 -1
  129. package/src/order/address_picker.js +235 -0
  130. package/src/order/icon.js +32 -0
  131. package/src/order/index.js +86 -0
  132. package/src/order/order.js +1157 -0
  133. package/src/order/scratch +211 -0
  134. package/src/plugin.js +7 -52
  135. package/src/store/api.js +26 -1
  136. package/src/store/store.js +46 -9
  137. package/src/util/common.js +48 -2
  138. package/webpack.dev.js +2 -0
  139. package/dist/17db8166252.178.js +0 -1
  140. package/dist/17db8166252.213.js +0 -1
  141. package/dist/17db8166252.362.js +0 -1
  142. package/dist/17db8166252.441.js +0 -1
  143. package/dist/17db8166252.605.js +0 -1
  144. package/dist/17db8166252.619.js +0 -1
  145. package/dist/17db8166252.678.js +0 -1
  146. package/dist/17db8166252.74.js +0 -1
  147. package/dist/17db8166252.782.js +0 -1
  148. package/dist/17db8166252.app.js +0 -1
  149. package/dist/17db8166252.library.js +0 -1
  150. package/dist/17db8166252.preview.js +0 -1
  151. package/dist/17db8166252.screenshoot.js +0 -1
  152. package/dist/619.js +0 -777
  153. package/order.js +0 -0
  154. package/test.js +0 -1
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
+ }]);