@subiz/widget-v4 4.1.207 → 4.1.208

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 (124) hide show
  1. package/compiled_src/chatbox/block.js +5 -0
  2. package/package.json +1 -1
  3. package/src/chatbox/block.js +6 -1
  4. package/dist/127.js +0 -273
  5. package/dist/132.js +0 -2817
  6. package/dist/185.js +0 -1917
  7. package/dist/1a0475c4721.127.js +0 -1
  8. package/dist/1a0475c4721.132.js +0 -1
  9. package/dist/1a0475c4721.185.js +0 -1
  10. package/dist/1a0475c4721.27.js +0 -1
  11. package/dist/1a0475c4721.278.js +0 -1
  12. package/dist/1a0475c4721.339.js +0 -1
  13. package/dist/1a0475c4721.459.js +0 -1
  14. package/dist/1a0475c4721.490.js +0 -1
  15. package/dist/1a0475c4721.74.js +0 -1
  16. package/dist/1a0475c4721.997.js +0 -1
  17. package/dist/1a0475c4721.app.js +0 -1
  18. package/dist/1a0475c4721.chat.html +0 -1
  19. package/dist/1a0475c4721.chat.js +0 -1
  20. package/dist/1a0475c4721.form.html +0 -1
  21. package/dist/1a0475c4721.form.js +0 -1
  22. package/dist/1a0475c4721.index.html +0 -1
  23. package/dist/1a0475c4721.library.html +0 -1
  24. package/dist/1a0475c4721.library.js +0 -1
  25. package/dist/1a0475c4721.preview.html +0 -1
  26. package/dist/1a0475c4721.preview.js +0 -1
  27. package/dist/1a0475c4721.webview.js +0 -1
  28. package/dist/27.js +0 -37
  29. package/dist/459.js +0 -37
  30. package/dist/490.js +0 -305
  31. package/dist/74.js +0 -376
  32. package/dist/997.js +0 -37
  33. package/dist/HASH +0 -1
  34. package/dist/app.js +0 -1406
  35. package/dist/assets/img/Facebook.64607ec.png +0 -0
  36. package/dist/assets/img/Zalo.6845707.png +0 -0
  37. package/dist/assets/img/award1a.1a58e10.png +0 -0
  38. package/dist/assets/img/award3a.3b74423.png +0 -0
  39. package/dist/assets/img/award4a.ed6ccd4.png +0 -0
  40. package/dist/assets/img/award5.39eb7ae.png +0 -0
  41. package/dist/assets/img/bubble_default.7d5e4ab.svg +0 -20
  42. package/dist/assets/img/caret.998eb8f.svg +0 -1
  43. package/dist/assets/img/convos_empty.2353007.svg +0 -72
  44. package/dist/assets/img/default.06e6ee0.jpg +0 -0
  45. package/dist/assets/img/default_avatar.e449b04.png +0 -0
  46. package/dist/assets/img/default_logo.dd13a2b.svg +0 -5
  47. package/dist/assets/img/done_gray.d7e8203.svg +0 -4
  48. package/dist/assets/img/done_green.b817fd4.svg +0 -4
  49. package/dist/assets/img/emoji/messenger/sub_23.529_58.824.d5faf14.png +0 -0
  50. package/dist/assets/img/emoji/messenger/sub_23.529_60.784.1420241.png +0 -0
  51. package/dist/assets/img/emoji/messenger/sub_25.490_0.000.1e6b2c0.png +0 -0
  52. package/dist/assets/img/emoji/messenger/sub_25.490_45.098.3dfbc08.png +0 -0
  53. package/dist/assets/img/emoji/messenger/sub_25.490_5.882.4b49e94.png +0 -0
  54. package/dist/assets/img/emoji/messenger/sub_27.451_72.549.7114f58.png +0 -0
  55. package/dist/assets/img/emoji/messenger/sub_27.451_84.314.231e2b7.png +0 -0
  56. package/dist/assets/img/emoji/messenger/sub_27.451_96.078.ddbb008.png +0 -0
  57. package/dist/assets/img/emoji/messenger/sub_29.412_5.882.61f3359.png +0 -0
  58. package/dist/assets/img/emoji/messenger/sub_58.824_100.000.6df72bc.png +0 -0
  59. package/dist/assets/img/emoji/messenger/sub_58.824_45.098.3d7a7ad.png +0 -0
  60. package/dist/assets/img/emoji/messenger/sub_58.824_47.059.0f4d6e2.png +0 -0
  61. package/dist/assets/img/emoji/messenger/sub_58.824_54.902.65724c1.png +0 -0
  62. package/dist/assets/img/emoji/messenger/sub_58.824_64.706.9da3cba.png +0 -0
  63. package/dist/assets/img/emoji/messenger/sub_58.824_72.549.edca5cf.png +0 -0
  64. package/dist/assets/img/emoji/messenger/sub_58.824_78.431.f910f2a.png +0 -0
  65. package/dist/assets/img/emoji/messenger/sub_58.824_88.235.def4e71.png +0 -0
  66. package/dist/assets/img/emoji/messenger/sub_60.784_11.765.49c03d0.png +0 -0
  67. package/dist/assets/img/emoji/messenger/sub_60.784_27.451.46b54e5.png +0 -0
  68. package/dist/assets/img/emoji/messenger/sub_60.784_29.412.e36d284.png +0 -0
  69. package/dist/assets/img/emoji/messenger/sub_60.784_3.922.bb191b0.png +0 -0
  70. package/dist/assets/img/emoji/messenger/sub_60.784_35.294.af7b927.png +0 -0
  71. package/dist/assets/img/emoji/messenger/sub_60.784_7.843.98f2a99.png +0 -0
  72. package/dist/assets/img/empty.29bed2d.svg +0 -23
  73. package/dist/assets/img/empty_1.0b98af0.svg +0 -11
  74. package/dist/assets/img/examplte_logo.f86535f.svg +0 -1
  75. package/dist/assets/img/external-link.90577cc.svg +0 -1
  76. package/dist/assets/img/fb_inverse_circle.36c2cfc.png +0 -0
  77. package/dist/assets/img/ghn.070f8e3.svg +0 -17
  78. package/dist/assets/img/ghtk.326eac1.svg +0 -18
  79. package/dist/assets/img/image_default.be0698b.png +0 -0
  80. package/dist/assets/img/info.ebce7ea.svg +0 -1
  81. package/dist/assets/img/loader.37000a7.svg +0 -1
  82. package/dist/assets/img/loading_static.a27f0ac.svg +0 -10
  83. package/dist/assets/img/main-service1.d536cc2.png +0 -0
  84. package/dist/assets/img/main-service2.9b99549.png +0 -0
  85. package/dist/assets/img/not_found_search.2ddb8d1.png +0 -0
  86. package/dist/assets/img/package.8d37d0f.svg +0 -5
  87. package/dist/assets/img/package_fade.763c001.svg +0 -1
  88. package/dist/assets/img/rating--average.1ea492c.svg +0 -12
  89. package/dist/assets/img/rating--great.e3d712e.svg +0 -16
  90. package/dist/assets/img/rating--poor.2938a25.svg +0 -12
  91. package/dist/assets/img/search.f9705ff.svg +0 -1
  92. package/dist/assets/img/send.6db52a9.svg +0 -3
  93. package/dist/assets/img/shop.f7dc7d8.svg +0 -1
  94. package/dist/assets/img/shop_faded.df7845a.svg +0 -1
  95. package/dist/assets/img/stars_v2.79cf728.png +0 -0
  96. package/dist/assets/img/subiz-mono.8fbc067.svg +0 -3
  97. package/dist/assets/img/x.26fdfa3.svg +0 -5
  98. package/dist/chat.html +0 -10
  99. package/dist/chat.js +0 -1395
  100. package/dist/form.html +0 -10
  101. package/dist/form.js +0 -609
  102. package/dist/index.html +0 -90
  103. package/dist/inject.html +0 -20
  104. package/dist/inject.js +0 -1395
  105. package/dist/library.html +0 -90
  106. package/dist/library.js +0 -1385
  107. package/dist/malicious-app.js +0 -17
  108. package/dist/order.html +0 -32
  109. package/dist/order.js +0 -810
  110. package/dist/preview.html +0 -784
  111. package/dist/preview.js +0 -1455
  112. package/dist/screenshoot.html +0 -15
  113. package/dist/screenshoot.js +0 -1385
  114. package/dist/src_chatbox_OrderAttachments_js.js +0 -22
  115. package/dist/src_chatbox_Order_js.js +0 -206
  116. package/dist/src_chatbox_css_js.js +0 -306
  117. package/dist/src_contact_contact_js.js +0 -22
  118. package/dist/src_contact_css_js.js +0 -32
  119. package/dist/src_form_css_js.js +0 -32
  120. package/dist/src_notif_css_js.js +0 -32
  121. package/dist/src_notif_notif_js.js +0 -22
  122. package/dist/src_popup_css_js.js +0 -32
  123. package/dist/src_popup_popup_js.js +0 -84
  124. package/dist/webview.js +0 -1406
package/dist/185.js DELETED
@@ -1,1917 +0,0 @@
1
- (self["webpackChunk_subiz_widget_v4"] = self["webpackChunk_subiz_widget_v4"] || []).push([[185],{
2
-
3
- /***/ 4185
4
- (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5
-
6
- "use strict";
7
- // ESM COMPAT FLAG
8
- __webpack_require__.r(__webpack_exports__);
9
-
10
- // EXPORTS
11
- __webpack_require__.d(__webpack_exports__, {
12
- "default": () => (/* binding */ Order)
13
- });
14
-
15
- // EXTERNAL MODULE: ./assets/img/caret.svg
16
- var caret_namespaceFn = () => {
17
- return __webpack_require__(7741);
18
- };
19
-
20
- // EXTERNAL MODULE: ./assets/img/default.jpg
21
- var default_namespaceFn = () => {
22
- return __webpack_require__(2876);
23
- };
24
-
25
- // EXTERNAL MODULE: ./assets/img/default_avatar.png
26
- var default_avatar_namespaceFn = () => {
27
- return __webpack_require__(2538);
28
- };
29
-
30
- // EXTERNAL MODULE: ./assets/img/done_green.svg
31
- var done_green_namespaceFn = () => {
32
- return __webpack_require__(5860);
33
- };
34
-
35
- // EXTERNAL MODULE: ./assets/img/empty_1.svg
36
- var empty_1_namespaceFn = () => {
37
- return __webpack_require__(6907);
38
- };
39
-
40
- // EXTERNAL MODULE: ./assets/img/external-link.svg
41
- var external_link_namespaceFn = () => {
42
- return __webpack_require__(3266);
43
- };
44
-
45
- // EXTERNAL MODULE: ./assets/img/ghn.svg
46
- var ghn_namespaceFn = () => {
47
- return __webpack_require__(1113);
48
- };
49
-
50
- // EXTERNAL MODULE: ./assets/img/ghtk.svg
51
- var ghtk_namespaceFn = () => {
52
- return __webpack_require__(7362);
53
- };
54
-
55
- // EXTERNAL MODULE: ./assets/img/image_default.png
56
- var image_default_namespaceFn = () => {
57
- return __webpack_require__(3582);
58
- };
59
-
60
- // EXTERNAL MODULE: ./assets/img/info.svg
61
- var info_namespaceFn = () => {
62
- return __webpack_require__(7324);
63
- };
64
-
65
- // EXTERNAL MODULE: ./assets/img/loader.svg
66
- var loader_namespaceFn = () => {
67
- return __webpack_require__(185);
68
- };
69
-
70
- // EXTERNAL MODULE: ./assets/img/not_found_search.png
71
- var not_found_search_namespaceFn = () => {
72
- return __webpack_require__(3142);
73
- };
74
-
75
- // EXTERNAL MODULE: ./assets/img/package.svg
76
- var package_namespaceFn = () => {
77
- return __webpack_require__(8512);
78
- };
79
-
80
- // EXTERNAL MODULE: ./assets/img/package_fade.svg
81
- var package_fade_namespaceFn = () => {
82
- return __webpack_require__(6857);
83
- };
84
-
85
- // EXTERNAL MODULE: ./assets/img/search.svg
86
- var search_namespaceFn = () => {
87
- return __webpack_require__(5452);
88
- };
89
-
90
- // EXTERNAL MODULE: ./assets/img/shop.svg
91
- var shop_namespaceFn = () => {
92
- return __webpack_require__(5244);
93
- };
94
-
95
- // EXTERNAL MODULE: ./assets/img/shop_faded.svg
96
- var shop_faded_namespaceFn = () => {
97
- return __webpack_require__(2523);
98
- };
99
-
100
- // EXTERNAL MODULE: ./assets/img/x.svg
101
- var x_namespaceFn = () => {
102
- return __webpack_require__(3080);
103
- };
104
-
105
- // EXTERNAL MODULE: ./src/util/index.js + 6 modules
106
- var util = __webpack_require__(8026);
107
- // EXTERNAL MODULE: ./src/chatbox/releaseAnimation.js
108
- var releaseAnimation = __webpack_require__(2988);
109
- // EXTERNAL MODULE: ./src/chatbox/time.js
110
- var time = __webpack_require__(1620);
111
- // EXTERNAL MODULE: ./src/common.js
112
- var common = __webpack_require__(2840);
113
- // EXTERNAL MODULE: ./node_modules/preact/dist/preact.module.js
114
- var preact_module = __webpack_require__(172);
115
- // EXTERNAL MODULE: ./src/chatbox/spinner.js
116
- var spinner = __webpack_require__(4188);
117
- ;// ./src/chatbox/DropdownSelect.js
118
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
119
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
120
- 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); }
121
- ;
122
-
123
-
124
-
125
- class DropdownSelect extends common/* Com */.Mw {
126
- constructor(props) {
127
- super(props);
128
- _defineProperty(this, "state", {
129
- show: false,
130
- searchValue: ''
131
- });
132
- _defineProperty(this, "filterRef", (0,preact_module/* createRef */._3)());
133
- _defineProperty(this, "overlayRef", (0,preact_module/* createRef */._3)());
134
- _defineProperty(this, "onTouchMove", e => {
135
- if (e.target === this.overlayRef.current) {
136
- e.preventDefault();
137
- e.stopPropagation();
138
- }
139
- });
140
- _defineProperty(this, "hideDropdown", () => {
141
- this.setState({
142
- show: false,
143
- searchValue: ''
144
- });
145
- });
146
- _defineProperty(this, "onKeydown", e => {
147
- if (e.key === 'Escape') {
148
- if (!this.state.show) return;
149
- if (this.state.searchValue) this.setState({
150
- searchValue: ''
151
- });else this.hideDropdown();
152
- e.preventDefault();
153
- e.stopPropagation();
154
- }
155
- });
156
- _defineProperty(this, "hasSearch", () => {
157
- if (this.props.has_search) return true;
158
- return util/* default */.A.size(this.props.items) >= 10;
159
- });
160
- _defineProperty(this, "getFilteredOptions", () => {
161
- let items = this.props.items;
162
- if (this.state.searchValue && this.hasSearch()) {
163
- items = util/* default */.A.filter(items, item => {
164
- let optionName = util/* default */.A.unicodeToAscii(item.name).toLowerCase().replace(/ /g, '');
165
- let optionDesc = util/* default */.A.unicodeToAscii(item.desc).toLowerCase().replace(/ /g, '');
166
- let searchValue = util/* default */.A.unicodeToAscii(this.state.searchValue).toLowerCase().replace(/ /g, '');
167
- return optionName.indexOf(searchValue) != -1 || optionDesc.indexOf(searchValue) != -1;
168
- });
169
- }
170
- return items;
171
- });
172
- _defineProperty(this, "onChangeSearchValue", e => {
173
- this.setState({
174
- searchValue: e.target.value
175
- });
176
- });
177
- _defineProperty(this, "toogleDropdown", async () => {
178
- await this.setState({
179
- show: true,
180
- searchValue: ''
181
- });
182
- this.focusFilter();
183
- });
184
- _defineProperty(this, "onSelect", item => {
185
- this.props.onSelect(item);
186
- this.hideDropdown();
187
- });
188
- _defineProperty(this, "onBackgroundScroll", e => {
189
- console.log('EEEEEEE', e);
190
- alert('y');
191
- });
192
- document.addEventListener('touchmove', function (e) {});
193
- }
194
- componentDidMount() {
195
- window.addEventListener('keydown', this.onKeydown);
196
- }
197
- componentWillUnmount() {
198
- window.removeEventListener('keydown', this.onKeydown);
199
- }
200
- renderEmpty() {
201
- return (0,preact_module.h)("div", {
202
- class: "dropdown_select_filter__empty"
203
- }, (0,preact_module.h)("img", {
204
- class: "dropdown_select_filter__empty_img",
205
- src: not_found_search_namespaceFn()
206
- }), (0,preact_module.h)("div", {
207
- class: "muted",
208
- style: "text-align: center !important;"
209
- }, "Kh\xF4ng c\xF3 k\u1EBFt qu\u1EA3"));
210
- }
211
- renderLoading() {
212
- return (0,preact_module.h)("div", {
213
- class: "dropdown_select_filter__empty pt-3"
214
- }, (0,preact_module.h)(spinner/* default */.A, {
215
- size: "40",
216
- static: true
217
- }), (0,preact_module.h)("div", {
218
- class: "muted mt-2",
219
- style: "text-align: center !important;"
220
- }, "\u0110ang t\u1EA3i d\u1EEF li\u1EC7u"));
221
- }
222
- focusFilter() {
223
- if (!this.filterRef.current) return;
224
- this.filterRef.current.focus();
225
- util/* default */.A.setTimeout(() => {
226
- if (!this.filterRef.current) return;
227
- this.filterRef.current.focus();
228
- }, 100);
229
- }
230
- renderDropdown() {
231
- if (!this.state.show) return null;
232
- let items = this.getFilteredOptions();
233
- let $items = util/* default */.A.map(items, item => {
234
- return (0,preact_module.h)("div", {
235
- class: "dropdown_select__item",
236
- onClick: _ => this.onSelect(item)
237
- }, item.name);
238
- });
239
- let $filter = null;
240
- if (this.hasSearch()) {
241
- let $img = (0,preact_module.h)("img", {
242
- class: "dropdown_select_filter__icon",
243
- src: search_namespaceFn()
244
- });
245
- if (this.props.loading) {
246
- $img = (0,preact_module.h)("img", {
247
- class: "dropdown_select_filter__icon",
248
- src: loader_namespaceFn()
249
- });
250
- }
251
- $filter = (0,preact_module.h)("div", {
252
- class: "dropdown_select_filter"
253
- }, $img, (0,preact_module.h)("input", {
254
- ref: this.filterRef,
255
- value: this.state.searchValue,
256
- onInput: this.onChangeSearchValue,
257
- type: "text",
258
- class: "dropdown_select_filter_input "
259
- }));
260
- }
261
- if ($items.length == 0) $items = this.renderEmpty();
262
- if (this.props.loading) $items = this.renderLoading();
263
- let style = `width: ${this.props.width || '150px'} !important;`;
264
- if (this.props.full) {
265
- style = ` top: 20px !important; left: 20px !important; right: 20px !important; width: unset !important; `;
266
- return (0,preact_module.h)("div", {
267
- class: "dropdown_select__overlay",
268
- ref: this.overlayRef,
269
- onClick: this.hideDropdown,
270
- onTouchMove: this.onTouchMove
271
- }, (0,preact_module.h)("div", {
272
- class: "dropdown_select",
273
- style: style,
274
- onClick: e => {
275
- e.preventDefault();
276
- e.stopPropagation();
277
- }
278
- }, $filter, (0,preact_module.h)("div", {
279
- class: "dropdown_select__items"
280
- }, $items)));
281
- }
282
- return (0,preact_module.h)("div", {
283
- class: "dropdown_select",
284
- style: style
285
- }, $filter, (0,preact_module.h)("div", {
286
- class: "dropdown_select__items"
287
- }, $items));
288
- }
289
- render() {
290
- let $name = (0,preact_module.h)("div", {
291
- class: "muted text-truncate",
292
- style: "flex: 1 !important;"
293
- }, "Ch\u1ECDn m\u1ED9t ph\u1EA7n t\u1EED");
294
- if (util/* default */.A.get(this.props, 'selected.name')) $name = (0,preact_module.h)("div", {
295
- class: "text-truncate",
296
- style: "flex: 1 !important;"
297
- }, util/* default */.A.get(this.props, 'selected.name'));
298
- let style = 'position: relative !important;';
299
- if (this.props.full) {
300
- style = '';
301
- }
302
- return (0,preact_module.h)("div", {
303
- style: style
304
- }, (0,preact_module.h)(common/* Clickaway */.tW, {
305
- onClickaway: this.hideDropdown
306
- }, (0,preact_module.h)("div", {
307
- type: "text",
308
- class: 'dropdown_select_input ' + this.props.extra_cls,
309
- onClick: this.toogleDropdown
310
- }, $name, "\xA0", (0,preact_module.h)("img", {
311
- class: "dropdown_select__caret",
312
- src: caret_namespaceFn()
313
- })), this.renderDropdown()));
314
- }
315
- }
316
- ;// ./src/order/address_picker.js
317
- function address_picker_defineProperty(e, r, t) { return (r = address_picker_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
318
- function address_picker_toPropertyKey(t) { var i = address_picker_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
319
- function address_picker_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); }
320
- ;
321
-
322
-
323
-
324
- class AddressPicker extends common/* Com */.Mw {
325
- constructor(props) {
326
- super(props);
327
- address_picker_defineProperty(this, "state", {
328
- show: false,
329
- searchValue: '',
330
- addresses: []
331
- });
332
- address_picker_defineProperty(this, "filterRef", (0,preact_module/* createRef */._3)());
333
- address_picker_defineProperty(this, "overlayRef", (0,preact_module/* createRef */._3)());
334
- address_picker_defineProperty(this, "onTouchMove", e => {
335
- if (e.target === this.overlayRef.current) {
336
- e.preventDefault();
337
- e.stopPropagation();
338
- }
339
- });
340
- address_picker_defineProperty(this, "hideDropdown", () => {
341
- this.setState({
342
- show: false,
343
- searchValue: ''
344
- });
345
- });
346
- address_picker_defineProperty(this, "onKeydown", e => {
347
- if (e.key === 'Escape') {
348
- if (!this.state.show) return;
349
- if (this.state.searchValue) this.setState({
350
- searchValue: ''
351
- });else this.hideDropdown();
352
- e.preventDefault();
353
- e.stopPropagation();
354
- }
355
- if (e.key == 'Enter') {}
356
- });
357
- address_picker_defineProperty(this, "doSearch", util/* default */.A.throttle(async () => {
358
- let requestId = Date.now();
359
- this.requestId = requestId;
360
- let res = await this.props.store.suggest_addresses(this.state.searchValue);
361
- if (this.requestId !== requestId) return;
362
- this.setState({
363
- addresses: util/* default */.A.get(res, 'body.addresses', [])
364
- });
365
- }, 100));
366
- address_picker_defineProperty(this, "onChangeSearchValue", e => {
367
- this.setState({
368
- searchValue: e.target.value
369
- });
370
- this.props.onChangeAddress(e.target.value);
371
- this.doSearch();
372
- });
373
- address_picker_defineProperty(this, "toogleDropdown", async () => {
374
- await this.setState({
375
- show: true,
376
- searchValue: this.props.initAddress || ''
377
- });
378
- this.focusFilter();
379
- });
380
- address_picker_defineProperty(this, "onSelect", item => {
381
- this.props.onSelect(item);
382
- this.hideDropdown();
383
- });
384
- address_picker_defineProperty(this, "onBackgroundScroll", e => {
385
- console.log('EEEEEEE', e);
386
- });
387
- document.addEventListener('touchmove', function (e) {});
388
- }
389
- componentDidMount() {
390
- window.addEventListener('keydown', this.onKeydown);
391
- }
392
- componentWillUnmount() {
393
- window.removeEventListener('keydown', this.onKeydown);
394
- }
395
- renderEmpty() {
396
- return (0,preact_module.h)("div", {
397
- class: "dropdown_select_filter__empty"
398
- }, (0,preact_module.h)("img", {
399
- class: "dropdown_select_filter__empty_img",
400
- src: not_found_search_namespaceFn()
401
- }), (0,preact_module.h)("div", {
402
- class: "muted",
403
- style: "text-align: center !important;"
404
- }, "Kh\xF4ng c\xF3 k\u1EBFt qu\u1EA3"));
405
- }
406
- renderLoading() {
407
- return (0,preact_module.h)("div", {
408
- class: "dropdown_select_filter__empty pt-3"
409
- }, (0,preact_module.h)(spinner/* default */.A, {
410
- size: "40",
411
- static: true
412
- }), (0,preact_module.h)("div", {
413
- class: "muted mt-2",
414
- style: "text-align: center !important;"
415
- }, "\u0110ang t\u1EA3i d\u1EEF li\u1EC7u"));
416
- }
417
- focusFilter() {
418
- if (!this.filterRef.current) return;
419
- this.filterRef.current.focus();
420
- util/* default */.A.setTimeout(() => {
421
- if (!this.filterRef.current) return;
422
- this.filterRef.current.focus();
423
- }, 100);
424
- }
425
- renderDropdown() {
426
- if (!this.state.show) return null;
427
- let $items = util/* default */.A.map(this.state.addresses, (addr, i) => {
428
- let label = [((addr.address || '') + ' ' + normalize(addr.street)).trim()].join(', ');
429
- let desc = [normalize(addr.ward), normalize(addr.district), normalize(addr.province)].join(', ');
430
- return (0,preact_module.h)("div", {
431
- class: "dropdown_select__item",
432
- onClick: _ => this.onSelect(addr),
433
- key: i
434
- }, (0,preact_module.h)("div", null, (0,preact_module.h)("b", null, label)), (0,preact_module.h)("div", {
435
- style: "opacity: 0.7 !important;"
436
- }, desc));
437
- });
438
- let $filter = null;
439
- let $img = (0,preact_module.h)("img", {
440
- class: "dropdown_select_filter__icon",
441
- src: search_namespaceFn()
442
- });
443
- if (this.props.loading) {
444
- $img = (0,preact_module.h)("img", {
445
- class: "dropdown_select_filter__icon",
446
- src: loader_namespaceFn()
447
- });
448
- }
449
- $filter = (0,preact_module.h)("div", {
450
- class: "dropdown_select_filter"
451
- }, $img, (0,preact_module.h)("input", {
452
- ref: this.filterRef,
453
- value: this.state.searchValue,
454
- onInput: this.onChangeSearchValue,
455
- type: "text",
456
- class: "dropdown_select_filter_input "
457
- }));
458
- if ($items.length == 0) $items = this.renderEmpty();
459
- if (this.props.loading) $items = this.renderLoading();
460
- let style = `width: ${this.props.width || '150px'} !important;`;
461
- if (this.props.full) {
462
- style = ` top: 20px !important; left: 20px !important; right: 20px !important; width: unset !important; `;
463
- return (0,preact_module.h)("div", {
464
- class: "dropdown_select__overlay",
465
- ref: this.overlayRef,
466
- onClick: this.hideDropdown,
467
- onTouchMove: this.onTouchMove
468
- }, (0,preact_module.h)("div", {
469
- class: "dropdown_select",
470
- style: style,
471
- onClick: e => {
472
- e.preventDefault();
473
- e.stopPropagation();
474
- }
475
- }, $filter, (0,preact_module.h)("div", {
476
- class: "dropdown_select__items"
477
- }, $items)));
478
- }
479
- return (0,preact_module.h)("div", {
480
- class: "dropdown_select",
481
- style: style
482
- }, $filter, (0,preact_module.h)("div", {
483
- class: "dropdown_select__items"
484
- }, $items));
485
- }
486
- render() {
487
- let $name = (0,preact_module.h)("div", {
488
- class: "text-truncate",
489
- style: "flex: 1 !important;"
490
- }, this.props.initAddress);
491
- let style = 'position: relative !important;';
492
- if (this.props.full) {
493
- style = '';
494
- }
495
- return (0,preact_module.h)("div", {
496
- style: style
497
- }, (0,preact_module.h)(common/* Clickaway */.tW, {
498
- onClickaway: this.hideDropdown
499
- }, (0,preact_module.h)("div", {
500
- type: "text",
501
- class: 'dropdown_select_input ' + this.props.extra_cls,
502
- onClick: this.toogleDropdown
503
- }, $name), this.renderDropdown()));
504
- }
505
- }
506
- function normalize(s) {
507
- let ls = (s + '').toLowerCase();
508
- if (ls.startsWith('tp ')) return s.substr(3);
509
- if (ls.startsWith('thanh pho ')) return s.substr('thanh pho '.length);
510
- if (ls.startsWith('thành phố ')) return s.substr('thành phố '.length);
511
- if (ls.startsWith('tỉnh ')) return s.substr('tỉnh '.length);
512
- if (ls.startsWith('huyện ')) return s.substr('huyện '.length);
513
- if (ls.startsWith('tỉnh ')) return s.substr('tỉnh '.length);
514
- if (ls.startsWith('xã ')) return s.substr('xã '.length);
515
- if (ls.startsWith('thị trấn ')) return s.substr('thị trấn '.length);
516
- if (ls.startsWith('thị xã ')) return s.substr('thị xã '.length);
517
- if (ls.startsWith('đường ') && (s[7] < '0' || s[7] > '9')) return s.substr('đường '.length);
518
- if (ls.startsWith('phường ') && (s[7] < '0' || s[7] > '9')) return s.substr('phường '.length);
519
- if (ls.startsWith('quận ') && (s[7] < '0' || s[7] > '9')) return s.substr('quận '.length);
520
- return s;
521
- }
522
- ;// ./src/order/icon.js
523
-
524
- let promiseMainCSS = (() => Promise.resolve(/* import() */).then(() => (__webpack_require__(9278))))();
525
- var $link = document.createElement('link');
526
- $link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
527
- $link.rel = 'stylesheet';
528
- document.head.append($link);
529
- util/* default */.A.preloadWebfonts(['Inter'], [400, 500]);
530
-
531
- let defaultAvatar = default_avatar_namespaceFn();
532
-
533
-
534
-
535
- class Icon extends common/* Com */.Mw {
536
- render() {
537
- if (this.props.name == 'package') {
538
- if (this.props.active) return (0,preact_module.h)("img", {
539
- style: "width: 18px !important;",
540
- src: package_namespaceFn()
541
- });
542
- return (0,preact_module.h)("img", {
543
- style: "width: 18px !important;",
544
- src: package_fade_namespaceFn()
545
- });
546
- }
547
- if (this.props.name === 'shop') {
548
- if (this.props.active) return (0,preact_module.h)("img", {
549
- style: "width: 18px !important;",
550
- src: shop_namespaceFn()
551
- });
552
- return (0,preact_module.h)("img", {
553
- style: "width: 18px !important;",
554
- src: shop_faded_namespaceFn()
555
- });
556
- }
557
- }
558
- }
559
- ;// ./src/order/order.js
560
- function order_defineProperty(e, r, t) { return (r = order_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
561
- function order_toPropertyKey(t) { var i = order_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
562
- function order_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); }
563
- ;
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
- var checkedimg = done_green_namespaceFn();
572
- var ximg = x_namespaceFn();
573
- class order_Order extends common/* Com */.Mw {
574
- constructor(props) {
575
- super(props);
576
- order_defineProperty(this, "state", {
577
- loadProvince: true,
578
- g_err: '',
579
- fullname: '',
580
- email: '',
581
- phone: '',
582
- loading: true,
583
- order: {},
584
- err: {},
585
- shipping_address: 'new',
586
- selectedProvince: null,
587
- selectedDistrict: null,
588
- selectedWard: null,
589
- street: '',
590
- address: '',
591
- sending: false,
592
- step: ''
593
- });
594
- order_defineProperty(this, "renderMobileSuccess", order => {
595
- return (0,preact_module.h)("div", {
596
- class: "order",
597
- style: "height: 100% !important"
598
- }, (0,preact_module.h)("div", {
599
- style: "display: flex !important; align-items: center !important; padding-top: 40px !important; padding-bottom: 20px !important; flex-direction: column !important; height: 100% !important"
600
- }, (0,preact_module.h)("img", {
601
- style: "width: 60px !important; height: 60px !important;",
602
- width: "60",
603
- height: "60",
604
- src: checkedimg
605
- }), (0,preact_module.h)("div", {
606
- style: "margin-top: 20px !important; margin-bottom: 10px !important"
607
- }, (0,preact_module.h)("b", {
608
- style: "font-size: 18px !important;"
609
- }, "\u0110\u01A1n h\xE0ng c\u1EE7a b\u1EA1n \u0111\xE3 \u0111\u01B0\u1EE3c ghi nh\u1EADn")), (0,preact_module.h)("div", {
610
- class: "muted"
611
- }, "T\xF4i s\u1EBD li\xEAn h\u1EC7 l\u1EA1i v\u1EDBi b\u1EA1n khi \u0111\u01A1n h\xE0ng \u0111\u01B0\u1EE3c x\u1EED l\xFD"), (0,preact_module.h)("div", {
612
- style: "flex:1 !important"
613
- }), (0,preact_module.h)("div", {
614
- style: "margin-top: 20px !important; padding: 0px 20px 0 20px !important; width: 100% !important"
615
- }, (0,preact_module.h)("div", {
616
- class: "order_btn order__btn__light",
617
- onClick: this.close
618
- }, this.props.t('close')))));
619
- });
620
- order_defineProperty(this, "onSelectProvince", async item => {
621
- this.setState({
622
- selectedProvince: item,
623
- err: {},
624
- g_err: ''
625
- });
626
- this.setState({
627
- loadDistrict: true
628
- });
629
- let out = await this.props.store.list_districts({
630
- id: item.id
631
- });
632
- this.setState({
633
- loadDistrict: false
634
- });
635
- if (!out.error) this.setState({
636
- districts: util/* default */.A.get(out, 'body.addresses')
637
- });
638
- });
639
- order_defineProperty(this, "onSelectDistrict", async item => {
640
- this.setState({
641
- selectedDistrict: item,
642
- err: {},
643
- g_err: ''
644
- });
645
- this.setState({
646
- loadWard: true
647
- });
648
- let out = await this.props.store.list_wards({
649
- id: item.id
650
- });
651
- this.setState({
652
- loadWard: false
653
- });
654
- if (!out.error) this.setState({
655
- wards: util/* default */.A.get(out, 'body.addresses')
656
- });
657
- });
658
- order_defineProperty(this, "onSelectWard", item => this.setState({
659
- selectedWard: item,
660
- err: {},
661
- g_err: ''
662
- }));
663
- order_defineProperty(this, "onChangeFullname", e => this.setState({
664
- fullname: e.target.value,
665
- err: {},
666
- g_err: ''
667
- }));
668
- order_defineProperty(this, "onChangeAddress", e => this.setState({
669
- address: e,
670
- err: {},
671
- g_err: ''
672
- }));
673
- order_defineProperty(this, "onSelectAddress", addr => {
674
- if (!addr) return;
675
- this.setState({
676
- address: [util/* default */.A.trim(addr.address), util/* default */.A.trim(addr.street)].join(' ').trim(),
677
- street: addr.street,
678
- err: {},
679
- g_err: ''
680
- });
681
- this.onSelectWard({
682
- id: addr.ward_id,
683
- name: addr.ward
684
- });
685
- this.onSelectDistrict({
686
- id: addr.district_id,
687
- name: addr.district
688
- });
689
- this.onSelectProvince({
690
- id: addr.province_id,
691
- name: addr.province
692
- });
693
- });
694
- order_defineProperty(this, "onChangeEmail", e => this.setState({
695
- email: e.target.value,
696
- err: {},
697
- g_err: ''
698
- }));
699
- order_defineProperty(this, "onChangePhone", e => this.setState({
700
- phone: e.target.value,
701
- err: {},
702
- g_err: ''
703
- }));
704
- order_defineProperty(this, "onChangePaymentMethod", id => this.setState({
705
- pm: id
706
- }));
707
- order_defineProperty(this, "onChangeQuantity", (item, text) => {
708
- let qty = parseInt(text) || 1;
709
- item.quantity = qty;
710
- this.forceUpdate();
711
- });
712
- order_defineProperty(this, "confirm", async () => {
713
- this.setState({
714
- g_err: ''
715
- });
716
- let err = {};
717
- if (!this.state.shipping) {
718
- this.setState({
719
- g_err: 'Mời bạn chọn địa chỉ giao hàng trước khi xác nhận'
720
- });
721
- }
722
- if (this.state.shipping === 'shop') {
723
- if (!util/* default */.A.isPhone(this.state.phone)) {
724
- err.phone = true;
725
- }
726
- if (!util/* default */.A.trim(this.state.fullname)) {
727
- err.name = true;
728
- }
729
- if (!util/* default */.A.trim(this.state.email)) {
730
- err.email = true;
731
- }
732
- } else if (this.state.shipping_address == 'new') {
733
- if (!util/* default */.A.isPhone(this.state.phone)) {
734
- err.phone = true;
735
- }
736
- if (!util/* default */.A.trim(this.state.fullname)) {
737
- err.name = true;
738
- }
739
- if (!util/* default */.A.trim(this.state.address)) {
740
- err.address = true;
741
- }
742
- if (util/* default */.A.size(this.state.selectedWard) == 0) {
743
- err.ward = true;
744
- }
745
- if (util/* default */.A.size(this.state.selectedDistrict) == 0) {
746
- err.district = true;
747
- }
748
- if (util/* default */.A.size(this.state.selectedProvince) == 0) {
749
- err.province = true;
750
- }
751
- }
752
- if (util/* default */.A.size(err) > 0) {
753
- this.setState({
754
- err,
755
- g_err: this.props.t('input_shipping_info_err')
756
- });
757
- return;
758
- }
759
- let user = this.props.store.matchUser();
760
- let ufullname = util/* default */.A.getUserAttr(user, 'fullname', 'text');
761
- let uemail = util/* default */.A.getUserAttr(user, 'emails', 'text');
762
- let uphone = util/* default */.A.getUserAttr(user, 'phones', 'text');
763
- let order = util/* default */.A.cloneDeep(this.state.order);
764
- if (this.state.shipping === 'shop') {
765
- util/* default */.A.set(order, 'shipping.pickup_at_shop', true);
766
- util/* default */.A.set(order, 'shipping.address.phone', this.state.phone);
767
- util/* default */.A.set(order, 'shipping.address.fullname', this.state.fullname);
768
- util/* default */.A.set(order, 'shipping.address.email', this.state.email);
769
- } else {
770
- if (this.state.shipping_address == 'new') {
771
- let out = await this.props.store.createShippingAddress({
772
- address: this.state.address,
773
- country: 'Việt Nam',
774
- fullname: this.state.fullname,
775
- email: this.state.email,
776
- phone: this.state.phone,
777
- district: this.state.selectedDistrict.name,
778
- district_id: this.state.selectedDistrict.id,
779
- province: this.state.selectedProvince.name,
780
- province_id: this.state.selectedProvince.id,
781
- ward: this.state.selectedWard.name,
782
- street: this.state.street,
783
- ward_id: this.state.selectedWard.id
784
- });
785
- if (out.error) return this.setState({
786
- g_err: this.props.t('update_failed')
787
- });
788
- util/* default */.A.set(order, 'shipping.address', out.body);
789
- } else {
790
- let addresses = this.props.store.matchShippingAddresses();
791
- let sa = util/* default */.A.find(addresses, addr => addr.id === this.state.shipping_address);
792
- if (!sa) {
793
- return this.setState({
794
- err,
795
- g_err: this.props.t('input_shipping_info_err')
796
- });
797
- }
798
- util/* default */.A.set(order, 'shipping.address', sa);
799
- }
800
- }
801
- let changeduser = false;
802
- if (!ufullname && this.state.fullname) {
803
- changeduser = true;
804
- util/* default */.A.setUserAttr(user, {
805
- key: 'fullname',
806
- text: this.state.fullname
807
- });
808
- }
809
- if (!uemail && this.state.email) {
810
- changeduser = true;
811
- util/* default */.A.setUserAttr(user, {
812
- key: 'emails',
813
- text: this.state.email
814
- });
815
- }
816
- if (!uphone && this.state.phone) {
817
- changeduser = true;
818
- util/* default */.A.setUserAttr(user, {
819
- key: 'phones',
820
- text: this.state.phone
821
- });
822
- }
823
- if (changeduser) this.props.store.setUser(user);
824
- this.setState({
825
- sending: true
826
- });
827
- order.user_confirmation = 'confirmed';
828
- let out = await this.props.store.updateOrder(order);
829
- this.setState({
830
- sending: false
831
- });
832
- if (out.error) {
833
- return this.setState({
834
- g_err: this.props.t('update_failed')
835
- });
836
- }
837
- this.setState({
838
- step: 'success'
839
- });
840
- if (this.props.onResponse) this.props.onResponse('confirmed');
841
- });
842
- order_defineProperty(this, "onCancel", () => {
843
- if (this.props.onResponse) this.props.onResponse('rejected');
844
- if (this.props.cid && !this.state.order.user_confirmation) {
845
- let order = util/* default */.A.cloneDeep(this.state.order);
846
- order.user_confirmation = 'rejected';
847
- this.props.store.updateOrder(order);
848
- }
849
- this.close();
850
- });
851
- order_defineProperty(this, "close", () => {
852
- if (this.props.onClose) this.props.onClose();
853
- });
854
- this.load();
855
- }
856
- async load() {
857
- if (!this.props.order_id) return;
858
- let orderout = await this.props.store.fetchOrder(this.props.order_id);
859
- this.setState({
860
- loading: false
861
- });
862
- if (!orderout.error) {
863
- this.setState({
864
- order: orderout.body
865
- });
866
- } else {
867
- this.setState({
868
- error: orderout.error
869
- });
870
- }
871
- let user = this.props.store.matchUser();
872
- let attributes = util/* default */.A.get(this.props.store.matchUser(), 'attributes', []);
873
- let fullname = util/* default */.A.get(util/* default */.A.find(attributes, att => att.key === 'fullname'), 'text');
874
- let email = util/* default */.A.get(util/* default */.A.find(attributes, att => att.key === 'emails'), 'text');
875
- let phone = util/* default */.A.get(util/* default */.A.find(attributes, att => att.key === 'phones'), 'text');
876
- this.setState({
877
- fullname,
878
- email,
879
- phone
880
- });
881
- await this.props.store.fetchShippingAddresses();
882
- let out = await this.props.store.list_provinces();
883
- this.setState({
884
- loadProvince: false
885
- });
886
- if (!out.error) this.setState({
887
- provinces: util/* default */.A.get(out, 'body.addresses')
888
- });
889
- }
890
- isMobile() {
891
- if (this.props.cid) return true;
892
- if (this.props.isMobile) return true;
893
- return this.props.store.isMobile();
894
- }
895
- onChangeShippingAddress(id) {
896
- this.setState({
897
- shipping_address: id,
898
- err: {},
899
- g_err: ''
900
- });
901
- }
902
- onChangeShipping(id) {
903
- this.setState({
904
- shipping: id,
905
- err: {},
906
- g_err: ''
907
- });
908
- }
909
- renderDesktopPaymentMethod(order) {
910
- return null;
911
- // removed by dead control flow
912
-
913
- // removed by dead control flow
914
-
915
- // removed by dead control flow
916
-
917
- // removed by dead control flow
918
-
919
- // removed by dead control flow
920
-
921
- // removed by dead control flow
922
-
923
- // removed by dead control flow
924
-
925
- // removed by dead control flow
926
-
927
- // removed by dead control flow
928
-
929
- // removed by dead control flow
930
-
931
- }
932
- renderDesktopShipping(order) {
933
- let editmode = false;
934
- if (!order.status || order.status == 'open') {
935
- editmode = !order.user_confirmation;
936
- }
937
- let user = this.props.store.matchUser();
938
- if (editmode) {
939
- let addresses = this.props.store.matchShippingAddresses();
940
- let provinces = util/* default */.A.map(this.state.provinces, province => ({
941
- id: province.id,
942
- name: province.province
943
- }));
944
- let districts = util/* default */.A.map(this.state.districts, district => ({
945
- id: district.id,
946
- name: district.district
947
- }));
948
- let wards = util/* default */.A.map(this.state.wards, ward => ({
949
- id: ward.id,
950
- name: ward.ward
951
- }));
952
- let cls = 'ship_card';
953
- let $body = null;
954
- let ship_icon_active = false;
955
- if (this.state.shipping === 'ship') {
956
- ship_icon_active = true;
957
- let $preaddrs = util/* default */.A.map(addresses, addr => {
958
- let fulladdr = [addr.street, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
959
- let $phone = null;
960
- if (addr.phone) {
961
- $phone = (0,preact_module.h)(preact_module/* Fragment */.FK, null, "\xA0\xB7\xA0", this.props.t('phn'), " ", addr.phone);
962
- }
963
- return (0,preact_module.h)("div", {
964
- style: "margin-bottom: 15px !important"
965
- }, (0,preact_module.h)("div", {
966
- class: "radio d-flex "
967
- }, (0,preact_module.h)("input", {
968
- type: "radio",
969
- id: 'shipping_addr.' + addr.id,
970
- onInput: e => this.onChangeShippingAddress(addr.id),
971
- name: "shipping_address",
972
- checked: this.state.shipping_address === addr.id
973
- }), (0,preact_module.h)("label", {
974
- class: "radio--label",
975
- for: 'shipping_addr.' + addr.id,
976
- style: `font-weight: ${this.state.shipping_address === addr.id ? 500 : 400} !important`
977
- }, addr.fullname, $phone, (0,preact_module.h)("div", {
978
- class: "mt-1 muted"
979
- }, "DC ", fulladdr)), (0,preact_module.h)("div", {
980
- class: "radio--check"
981
- }, (0,preact_module.h)("div", {
982
- class: "inside"
983
- }))));
984
- });
985
- $preaddrs.push((0,preact_module.h)("div", {
986
- style: ""
987
- }, (0,preact_module.h)("div", {
988
- class: "radio d-flex "
989
- }, (0,preact_module.h)("input", {
990
- type: "radio",
991
- id: 'shipping_addr.new',
992
- onInput: e => this.onChangeShippingAddress('new'),
993
- name: "shipping_address",
994
- checked: this.state.shipping_address === 'new'
995
- }), (0,preact_module.h)("label", {
996
- class: "radio--label",
997
- for: 'shipping_addr.new'
998
- }, this.state.shipping_address === 'new' ? (0,preact_module.h)("b", null, "T\u1EDBi \u0111\u1ECBa ch\u1EC9 kh\xE1c") : 'Tới địa chỉ khác'), (0,preact_module.h)("div", {
999
- class: "radio--check"
1000
- }, (0,preact_module.h)("div", {
1001
- class: "inside"
1002
- })))));
1003
- let $new = (0,preact_module.h)("div", {
1004
- style: "padding-left: 22px !important;"
1005
- }, (0,preact_module.h)("div", {
1006
- class: "d-flex"
1007
- }, (0,preact_module.h)("div", {
1008
- class: "mr-2",
1009
- style: "flex: 1 !important;"
1010
- }, (0,preact_module.h)("div", {
1011
- class: "order_form_label"
1012
- }, this.props.t('fullname')), (0,preact_module.h)("input", {
1013
- type: "text",
1014
- class: 'form-control ' + (this.state.err.name && 'err'),
1015
- onInput: this.onChangeFullname,
1016
- value: this.state.fullname
1017
- })), (0,preact_module.h)("div", {
1018
- class: "ml-2",
1019
- style: "flex: 1 !important;"
1020
- }, (0,preact_module.h)("div", {
1021
- class: "order_form_label"
1022
- }, this.props.t('phones')), (0,preact_module.h)("input", {
1023
- type: "text",
1024
- class: 'form-control ' + (this.state.err.phone && 'err'),
1025
- onInput: this.onChangePhone,
1026
- value: this.state.phone
1027
- }))), (0,preact_module.h)("div", {
1028
- class: "",
1029
- style: "width: 100% !important"
1030
- }, (0,preact_module.h)("div", {
1031
- class: "order_form_label"
1032
- }, this.props.t('address')), (0,preact_module.h)(AddressPicker, {
1033
- initAddress: this.state.address,
1034
- store: this.props.store,
1035
- width: "100%",
1036
- onChangeAddress: this.onChangeAddress,
1037
- full: this.isMobile(),
1038
- onSelect: this.onSelectAddress,
1039
- extra_cls: this.state.err.address && 'err'
1040
- })), (0,preact_module.h)("div", {
1041
- class: "d-flex",
1042
- style: "justify-content: space-between !important;"
1043
- }, (0,preact_module.h)("div", {
1044
- style: "flex: 1 !important; overflow:hidden !important; margin-right: 7px !important;"
1045
- }, (0,preact_module.h)("div", {
1046
- class: "order_form_label"
1047
- }, this.props.t('province')), (0,preact_module.h)(DropdownSelect, {
1048
- width: "194",
1049
- full: this.isMobile(),
1050
- has_search: true,
1051
- loading: this.state.loadProvince,
1052
- items: provinces,
1053
- selected: this.state.selectedProvince,
1054
- onSelect: this.onSelectProvince,
1055
- extra_cls: this.state.err.province && 'err'
1056
- })), (0,preact_module.h)("div", {
1057
- style: "flex: 1 !important; overflow:hidden !important; margin-left: 7px !important;"
1058
- }, (0,preact_module.h)("div", {
1059
- class: "order_form_label"
1060
- }, this.props.t('district')), (0,preact_module.h)(DropdownSelect, {
1061
- width: "194",
1062
- full: this.isMobile(),
1063
- selected: this.state.selectedDistrict,
1064
- has_search: true,
1065
- onSelect: this.onSelectDistrict,
1066
- loading: this.state.loadDistrict,
1067
- extra_cls: this.state.err.district && 'err',
1068
- items: districts
1069
- }))), (0,preact_module.h)("div", {
1070
- class: "d-flex",
1071
- style: "justify-content: space-between !important;"
1072
- }, (0,preact_module.h)("div", {
1073
- style: "flex: 1 !important; overflow:hidden !important; margin-right: 7px !important;"
1074
- }, (0,preact_module.h)("div", {
1075
- class: "order_form_label"
1076
- }, this.props.t('ward')), (0,preact_module.h)(DropdownSelect, {
1077
- width: "194",
1078
- selected: this.state.selectedWard,
1079
- full: this.isMobile(),
1080
- has_search: true,
1081
- onSelect: this.onSelectWard,
1082
- extra_cls: this.state.err.ward && 'err',
1083
- loading: this.state.loadWard,
1084
- items: wards
1085
- })), (0,preact_module.h)("div", {
1086
- style: "flex: 1 !important; margin-left: 7px !important;"
1087
- })));
1088
- cls += ' ship_card__active';
1089
- if (util/* default */.A.size(addresses) == 0) {
1090
- $body = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
1091
- class: 'mt-3 mb-2 '
1092
- }, this.props.t('input_shipping_info')), $new);
1093
- } else {
1094
- if (this.state.shipping_address !== 'new') $new = null;
1095
- $body = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
1096
- class: "mt-3 mb-2",
1097
- style: "margin-bottom: 10px !important;"
1098
- }, "Vui l\xF2ng ch\u1ECDn \u0111\u1ECBa ch\u1EC9 giao h\xE0ng"), (0,preact_module.h)("div", {
1099
- class: "form"
1100
- }, $preaddrs), $new);
1101
- }
1102
- }
1103
- let shopcls = 'ship_card';
1104
- let shop_icon_active = false;
1105
- if (this.state.shipping === 'shop') {
1106
- shop_icon_active = true;
1107
- shopcls += ' ship_card__active';
1108
- $body = (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
1109
- class: "d-flex"
1110
- }, (0,preact_module.h)("div", {
1111
- class: "mr-2",
1112
- style: "flex: 3 !important;"
1113
- }, (0,preact_module.h)("div", {
1114
- class: "order_form_label"
1115
- }, this.props.t('fullname')), (0,preact_module.h)("input", {
1116
- type: "text",
1117
- class: 'form-control ' + (this.state.err.name && 'err'),
1118
- onInput: this.onChangeFullname,
1119
- value: this.state.fullname
1120
- })), (0,preact_module.h)("div", {
1121
- class: "ml-2",
1122
- style: "flex: 2 !important;"
1123
- }, (0,preact_module.h)("div", {
1124
- class: "order_form_label"
1125
- }, this.props.t('phones')), (0,preact_module.h)("input", {
1126
- type: "text",
1127
- class: 'form-control ' + (this.state.err.phone && 'err'),
1128
- onInput: this.onChangePhone,
1129
- value: this.state.phone
1130
- }))), (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
1131
- class: "order_form_label"
1132
- }, this.props.t('email')), (0,preact_module.h)("input", {
1133
- type: "text",
1134
- class: 'form-control ' + (this.state.err.email && 'err'),
1135
- onInput: this.onChangeEmail,
1136
- value: this.state.email
1137
- })));
1138
- }
1139
- let seccls = 'card_section';
1140
- if (this.isMobile()) seccls = 'order_section';
1141
- return (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
1142
- class: "order_section__line"
1143
- }), (0,preact_module.h)("div", {
1144
- class: seccls
1145
- }, (0,preact_module.h)("div", {
1146
- class: "order_label"
1147
- }, this.props.t('ship_to')), (0,preact_module.h)("div", {
1148
- class: "d-flex"
1149
- }, (0,preact_module.h)("div", {
1150
- class: shopcls + ' mr-3',
1151
- onClick: e => this.onChangeShipping('shop')
1152
- }, (0,preact_module.h)(Icon, {
1153
- name: "shop",
1154
- active: shop_icon_active
1155
- }), " ", (0,preact_module.h)("b", {
1156
- class: "ml-2"
1157
- }, "Nh\u1EADn h\xE0ng t\u1EA1i shop")), (0,preact_module.h)("div", {
1158
- class: cls,
1159
- onClick: e => this.onChangeShipping('ship')
1160
- }, (0,preact_module.h)(Icon, {
1161
- name: "package",
1162
- active: ship_icon_active
1163
- }), " ", (0,preact_module.h)("b", {
1164
- class: "ml-2"
1165
- }, "Giao h\xE0ng cho t\xF4i"))), $body));
1166
- }
1167
- let addr = util/* default */.A.get(order, 'shipping.address') || {};
1168
- let fulladdr = [addr.address, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
1169
- let $phone = null;
1170
- if (addr.phone) $phone = (0,preact_module.h)("div", {
1171
- class: "mt-1 muted"
1172
- }, this.props.t('phn'), ":\xA0", addr.phone);
1173
- if (util/* default */.A.get(order, 'shipping.pickup_at_shop')) {
1174
- fulladdr = 'Nhận hàng tại cửa hàng';
1175
- }
1176
- let $addr = fulladdr ? (0,preact_module.h)("div", null, fulladdr) : (0,preact_module.h)("i", {
1177
- class: "i muted"
1178
- }, "Ch\u01B0a c\xF3 \u0111\u1ECBa ch\u1EC9 giao h\xE0ng");
1179
- let seccls = 'card_section';
1180
- if (this.isMobile()) seccls = 'order_section';
1181
- return (0,preact_module.h)("div", {
1182
- class: seccls
1183
- }, (0,preact_module.h)("div", {
1184
- class: "order_label "
1185
- }, this.props.t('ship_to')), $addr, $phone);
1186
- }
1187
- renderDesktopSummary(order) {
1188
- let $deposit = null;
1189
- if (order.deposit > 0) {
1190
- $deposit = (0,preact_module.h)("span", {
1191
- class: "muted"
1192
- }, "(c\u1ECDc ", util/* default */.A.formatCurrency(order.deposit), ")");
1193
- }
1194
- let $discount = null;
1195
- if (order.total_discount > 0) {
1196
- $discount = (0,preact_module.h)("div", {
1197
- class: "order_summary_line"
1198
- }, (0,preact_module.h)("div", null, "Gi\u1EA3m gi\xE1"), (0,preact_module.h)("div", null, util/* default */.A.formatCurrency(order.total_discount)));
1199
- }
1200
- let $pay = null;
1201
- if ($deposit || order.payment_made) {
1202
- $pay = (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
1203
- class: "order_summary_line"
1204
- }, (0,preact_module.h)("div", null, "B\u1EA1n \u0111\xE3 tr\u1EA3"), (0,preact_module.h)("div", null, $deposit, " ", util/* default */.A.formatCurrency(order.payment_made))), (0,preact_module.h)("div", {
1205
- class: "order_summary_line"
1206
- }, (0,preact_module.h)("div", null, "B\u1EA1n ch\u01B0a tr\u1EA3"), (0,preact_module.h)("div", null, util/* default */.A.formatCurrency((order.total || 0) - (order.payment_made || 0)))));
1207
- }
1208
- let $tax = (0,preact_module.h)("div", {
1209
- class: "order_summary_line"
1210
- }, (0,preact_module.h)("div", null, "Ti\u1EC1n thu\u1EBF"), (0,preact_module.h)("div", null, util/* default */.A.formatCurrency(order.total_tax)));
1211
- let $ship = (0,preact_module.h)("div", {
1212
- class: "order_summary_line"
1213
- }, (0,preact_module.h)("div", null, "Ph\xED v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", null, util/* default */.A.get(order, 'shipping.fee', 0), " d"));
1214
- let editmode = false;
1215
- if (!order.status || order.status == 'open') {
1216
- editmode = !order.user_confirmation;
1217
- }
1218
- let $note = null;
1219
- if (editmode) {
1220
- $ship = null;
1221
- $tax = null;
1222
- $note = (0,preact_module.h)("div", {
1223
- class: "muted"
1224
- }, (0,preact_module.h)("img", {
1225
- class: "order_ship_icon",
1226
- src: info_namespaceFn()
1227
- }), "\xA0 Ch\u01B0a bao g\u1ED3m thu\u1EBF v\xE0 ph\xED v\u1EADn chuy\u1EC3n");
1228
- }
1229
- let seccls = '';
1230
- if (this.isMobile()) seccls = 'order_section';
1231
- return (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
1232
- class: "order_section__line"
1233
- }), (0,preact_module.h)("div", {
1234
- class: seccls
1235
- }, (0,preact_module.h)("div", {
1236
- class: "order_label"
1237
- }, "T\xF3m t\u1EAFt"), (0,preact_module.h)("div", {
1238
- class: "order_summary_line"
1239
- }, (0,preact_module.h)("div", null, "T\u1ED5ng ti\u1EC1n h\xE0ng"), (0,preact_module.h)("div", null, util/* default */.A.formatCurrency(order.subtotal))), $tax, $discount, $ship, $note, (0,preact_module.h)("div", {
1240
- class: "order_summary_line",
1241
- style: "margin-top: 10px !important; padding-top: 15px !important; border-top: 1px solid #eee !important"
1242
- }, (0,preact_module.h)("div", null, "B\u1EA1n ph\u1EA3i tr\u1EA3"), (0,preact_module.h)("div", {
1243
- class: "order__total"
1244
- }, util/* default */.A.formatCurrency(order.total))), $pay));
1245
- }
1246
- renderStatusBadge(order) {
1247
- let status = order.status || 'open';
1248
- return (0,preact_module.h)("div", {
1249
- style: "float: right !important;",
1250
- class: 'order_status order_status__' + status
1251
- }, status);
1252
- }
1253
- renderShippingInfo(order) {
1254
- if (order.status != 'open' || order.user_confirmation) {}
1255
- let shipping_provider = util/* default */.A.get(order, 'shipping.shipping_provider');
1256
- if (!shipping_provider) return null;
1257
- let shipping_code = util/* default */.A.get(order, 'shipping.shipping_code');
1258
- let $tracking_code = null;
1259
- if (shipping_code) $tracking_code = (0,preact_module.h)("div", {
1260
- class: "muted",
1261
- style: "margin-top: 3px !important"
1262
- }, "V\u1EADn \u0111\u01A1n\xA0", (0,preact_module.h)("a", {
1263
- class: "order_tracking_link",
1264
- target: "_blank",
1265
- href: 'https://giaohangtietkiem.vn/tra-cuu-van-don/' + shipping_code
1266
- }, shipping_code, "\xA0", (0,preact_module.h)("img", {
1267
- class: "order_tracking_link_icon",
1268
- src: external_link_namespaceFn()
1269
- })));
1270
- if (shipping_provider == 'ghtk') {
1271
- return (0,preact_module.h)("div", {
1272
- class: "order_section"
1273
- }, (0,preact_module.h)("div", {
1274
- class: "order_section_label"
1275
- }, "\u0110\u01A1n v\u1ECB v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", {
1276
- class: "d-flex align-items-center"
1277
- }, (0,preact_module.h)("img", {
1278
- class: "order_shipping_provider_logo",
1279
- src: ShippingProvider.ghtk.logo
1280
- }), (0,preact_module.h)("div", null, ShippingProvider.ghtk.name, $tracking_code)));
1281
- }
1282
- return null;
1283
- }
1284
- renderDesktopShippingInfo(order) {
1285
- let shipping_provider = util/* default */.A.get(order, 'shipping.shipping_provider');
1286
- if (!shipping_provider) return null;
1287
- let shipping_code = util/* default */.A.get(order, 'shipping.shipping_code');
1288
- let $tracking_code = null;
1289
- if (shipping_code) $tracking_code = (0,preact_module.h)("div", {
1290
- class: "muted",
1291
- style: "margin-top: 3px !important"
1292
- }, "V\u1EADn \u0111\u01A1n\xA0", (0,preact_module.h)("a", {
1293
- class: "order_tracking_link",
1294
- target: "_blank",
1295
- href: 'https://giaohangtietkiem.vn/tra-cuu-van-don/' + shipping_code
1296
- }, shipping_code, "\xA0", (0,preact_module.h)("img", {
1297
- class: "order_tracking_link_icon",
1298
- src: external_link_namespaceFn()
1299
- })));
1300
- if (shipping_provider == 'ghtk') {
1301
- return (0,preact_module.h)(preact_module/* Fragment */.FK, null, (0,preact_module.h)("div", {
1302
- class: "order_label"
1303
- }, "\u0110\u01A1n v\u1ECB v\u1EADn chuy\u1EC3n"), (0,preact_module.h)("div", {
1304
- class: "d-flex align-items-center"
1305
- }, (0,preact_module.h)("img", {
1306
- class: "order_shipping_provider_logo",
1307
- src: ShippingProvider.ghtk.logo
1308
- }), (0,preact_module.h)("div", null, ShippingProvider.ghtk.name, $tracking_code)));
1309
- }
1310
- return null;
1311
- }
1312
- renderProducts(order) {
1313
- let $products = null;
1314
- $products = util/* default */.A.map(order.items, item => {
1315
- if (!item || !item.product) return null;
1316
- let product = item.product;
1317
- return (0,preact_module.h)("div", {
1318
- class: "order_attachment__product"
1319
- }, (0,preact_module.h)("img", {
1320
- class: "order_attachment__product_img",
1321
- alt: '' + product.id,
1322
- src: util/* default */.A.get(product, 'images.0') || default_namespaceFn()
1323
- }), (0,preact_module.h)("div", {
1324
- style: "overflow: hidden !important;"
1325
- }, (0,preact_module.h)("div", {
1326
- class: "order_attachment__product_name"
1327
- }, product.name), (0,preact_module.h)("div", {
1328
- class: "order_attachment__product_desc"
1329
- }, product.description || product.long_description), (0,preact_module.h)("div", {
1330
- class: "order_attachment__product_desc"
1331
- }, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", util/* default */.A.formatCurrency(product.price))));
1332
- });
1333
- if (!this.isMobile()) return (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
1334
- class: "order_label"
1335
- }, this.props.t('product')), $products);
1336
- return (0,preact_module.h)("div", {
1337
- class: "order_section"
1338
- }, (0,preact_module.h)("div", {
1339
- class: "order_section_label"
1340
- }, this.props.t('product')), $products);
1341
- }
1342
- renderDesktopProducts(order) {
1343
- let $products = null;
1344
- let editmode = false;
1345
- if (!order.status || order.status == 'open') {
1346
- editmode = !order.user_confirmation;
1347
- }
1348
- if (editmode) {
1349
- $products = util/* default */.A.map(order.items, item => {
1350
- if (!item || !item.product) return null;
1351
- let product = item.product;
1352
- return (0,preact_module.h)("div", {
1353
- class: "order_attachment__product"
1354
- }, (0,preact_module.h)("img", {
1355
- class: "order_attachment__product_img",
1356
- alt: '' + product.id,
1357
- src: util/* default */.A.get(product, 'images.0') || default_namespaceFn()
1358
- }), (0,preact_module.h)("div", {
1359
- style: "overflow: hidden !important; flex: 1 !important"
1360
- }, (0,preact_module.h)("div", {
1361
- class: "order_attachment__product_name"
1362
- }, product.name), (0,preact_module.h)("div", {
1363
- class: "order_attachment__product_desc"
1364
- }, product.description || product.long_description), (0,preact_module.h)("div", {
1365
- class: "order_attachment__product_desc"
1366
- }, util/* default */.A.formatCurrency(product.price))), (0,preact_module.h)("input", {
1367
- class: "form-control",
1368
- style: "text-align: center !important; font-weight: 400 !important; width: 50px !important",
1369
- value: item.quantity,
1370
- onInput: e => this.onChangeQuantity(item, e.target.value),
1371
- type: "text"
1372
- }), (0,preact_module.h)("div", {
1373
- style: "width: 80px !important; text-align: right !important; "
1374
- }, (0,preact_module.h)("b", null, util/* default */.A.formatCurrency(item.quantity * product.price))));
1375
- });
1376
- } else {
1377
- $products = util/* default */.A.map(order.items, item => {
1378
- if (!item || !item.product) return null;
1379
- let product = item.product;
1380
- return (0,preact_module.h)("div", {
1381
- class: "order_attachment__product"
1382
- }, (0,preact_module.h)("img", {
1383
- class: "order_attachment__product_img",
1384
- alt: '' + product.id,
1385
- src: util/* default */.A.get(product, 'images.0') || default_namespaceFn()
1386
- }), (0,preact_module.h)("div", {
1387
- style: "overflow: hidden !important; flex: 1 !important"
1388
- }, (0,preact_module.h)("div", {
1389
- class: "order_attachment__product_name"
1390
- }, product.name), (0,preact_module.h)("div", {
1391
- class: "order_attachment__product_desc"
1392
- }, product.description || product.long_description), (0,preact_module.h)("div", {
1393
- class: "order_attachment__product_desc"
1394
- }, util/* default */.A.formatCurrency(product.price))), (0,preact_module.h)("div", {
1395
- style: "text-align: center !important; font-weight: 400 !important; width: 50px !important"
1396
- }, item.quantity), (0,preact_module.h)("div", {
1397
- style: "width: 80px !important; text-align: right !important; "
1398
- }, (0,preact_module.h)("b", null, util/* default */.A.formatCurrency(item.total))));
1399
- });
1400
- }
1401
- return (0,preact_module.h)("div", {
1402
- class: "card_section"
1403
- }, (0,preact_module.h)("div", {
1404
- class: "desktop_order__heading"
1405
- }, this.renderStatusBadge(order), (0,preact_module.h)("b", {
1406
- style: "font-size: 18px !important;"
1407
- }, this.props.t('order'), " #", order.order_number || order.id), (0,preact_module.h)("div", {
1408
- class: "muted"
1409
- }, (0,preact_module.h)(time/* default */.A, {
1410
- style: "font-size: 13px !important;",
1411
- time: order.issue_date || order.created
1412
- }))), (0,preact_module.h)("div", {
1413
- class: "order_label d-flex",
1414
- style: "margin-top: 20px !important;justify-content: space-between !important; align-items: flex-end !important;"
1415
- }, (0,preact_module.h)("div", {
1416
- style: "flex: 1 !important;"
1417
- }, this.props.t('product')), (0,preact_module.h)("div", {
1418
- style: "font-weight: 400 !important; text-align:center !important; width: 50px !important"
1419
- }, this.props.t('qty')), (0,preact_module.h)("div", {
1420
- style: "font-weight: 400 !important; text-align: right !important; width: 80px !important;"
1421
- }, this.props.t('total'))), $products);
1422
- }
1423
- renderMobile(order) {
1424
- if (this.state.step === 'success') return this.renderMobileSuccess(order);
1425
- let $error = null;
1426
- if (this.state.g_err) {
1427
- $error = (0,preact_module.h)("div", {
1428
- class: "mb-2 text__danger"
1429
- }, (0,preact_module.h)("img", {
1430
- style: "margin-top: -4px !important; height: 15px !important;",
1431
- src: ximg
1432
- }), "\xA0", (0,preact_module.h)("b", null, this.state.g_err));
1433
- }
1434
- let $status = (0,preact_module.h)("div", null, $error, (0,preact_module.h)("div", {
1435
- class: "btn-confirm-order",
1436
- style: "margin-top: 0 !important;",
1437
- onClick: this.confirm
1438
- }, this.props.t('confirm_order')));
1439
- let $close = (0,preact_module.h)("div", {
1440
- class: "order_btn order__btn__light mt-3",
1441
- onClick: this.onCancel
1442
- }, this.props.t('cancel_order'));
1443
- if (order.user_confirmation || order.status != 'open') {
1444
- $status = null;
1445
- if (this.props.cid) $close = (0,preact_module.h)("div", {
1446
- class: "order_btn order__btn__light mt-3",
1447
- onClick: this.close
1448
- }, this.props.t('close'));
1449
- }
1450
- return (0,preact_module.h)("div", {
1451
- class: "order",
1452
- style: "height: 100% !important"
1453
- }, (0,preact_module.h)("div", {
1454
- class: "order--content"
1455
- }, (0,preact_module.h)("div", {
1456
- class: "order--heading"
1457
- }, this.renderStatusBadge(order), (0,preact_module.h)("b", {
1458
- style: "font-size: 16px !important;"
1459
- }, this.props.t('order'), " #", order.order_number || order.id), (0,preact_module.h)("div", {
1460
- class: "muted"
1461
- }, (0,preact_module.h)(time/* default */.A, {
1462
- style: "font-size: 13px !important;",
1463
- time: order.issue_date || order.created
1464
- }))), this.renderProducts(order), this.renderDesktopShipping(order), this.renderShippingInfo(order), this.renderDesktopPaymentMethod(order), this.renderDesktopSummary(order), (0,preact_module.h)("div", {
1465
- class: "order_section pb-3",
1466
- style: "padding-top: 0 !important;"
1467
- }, $status, $close)));
1468
- }
1469
- renderActions(order) {
1470
- let $actions = null;
1471
- let editmode = false;
1472
- if (!order.status || order.status == 'open') {
1473
- editmode = !order.user_confirmation;
1474
- }
1475
- if (this.state.step === 'success') return (0,preact_module.h)("div", {
1476
- class: "d-flex",
1477
- style: "align-items: center !important; justify-content: flex-end !important"
1478
- }, (0,preact_module.h)("div", null, "Ghi nh\u1EADn th\xE0nh c\xF4ng"), "\xA0", (0,preact_module.h)("img", {
1479
- style: "width: 16px !important; height: 16px !important;",
1480
- width: "16",
1481
- height: "16",
1482
- src: checkedimg
1483
- }));
1484
- if (editmode) {
1485
- let $error = null;
1486
- if (this.state.g_err) {
1487
- $error = (0,preact_module.h)("div", {
1488
- class: "mb-2 text__danger"
1489
- }, (0,preact_module.h)("img", {
1490
- style: "margin-top: -4px !important; height: 15px !important;",
1491
- src: ximg
1492
- }), "\xA0", (0,preact_module.h)("b", null, this.state.g_err));
1493
- }
1494
- $actions = (0,preact_module.h)("div", null, $error, (0,preact_module.h)("div", {
1495
- class: "btn-confirm-order",
1496
- onClick: this.confirm
1497
- }, this.props.t('confirm_order')), (0,preact_module.h)("div", {
1498
- class: "btn-cancel-order",
1499
- onClick: this.onCancel
1500
- }, this.props.t('cancel_order')));
1501
- }
1502
- return $actions;
1503
- }
1504
- renderDesktop(order) {
1505
- let acc = this.props.store.matchAccount();
1506
- var uri = acc.logo_url || image_default_namespaceFn();
1507
- return (0,preact_module.h)("div", {
1508
- class: "desktop order"
1509
- }, (0,preact_module.h)("div", {
1510
- class: "order_acc_header"
1511
- }, (0,preact_module.h)("img", {
1512
- class: "order_acc_logo",
1513
- src: uri
1514
- }), (0,preact_module.h)("div", {
1515
- class: "order_acc_name"
1516
- }, acc.name)), (0,preact_module.h)("div", {
1517
- class: "desktop_order__content"
1518
- }, (0,preact_module.h)("div", {
1519
- style: "flex: 1 !important; padding-right: 20px !important;"
1520
- }, this.renderDesktopProducts(order), this.renderDesktopShipping(order), this.renderDesktopShippingInfo(order), this.renderDesktopPaymentMethod(order), (0,preact_module.h)("div", {
1521
- class: "order__footer"
1522
- }, (0,preact_module.h)("a", {
1523
- target: "_blank",
1524
- href: "https://subiz.com.vn",
1525
- class: "order__footer_link"
1526
- }, "Cung c\u1EA5p b\u1EDFi ", (0,preact_module.h)("b", null, "Subiz")), (0,preact_module.h)("div", {
1527
- class: "order__footer_delimiter"
1528
- }), (0,preact_module.h)("a", {
1529
- target: "_blank",
1530
- href: "https://subiz.com.vn/vi/terms-of-service.html",
1531
- class: "order__footer_link"
1532
- }, "\u0110i\u1EC1u kho\u1EA3n"), (0,preact_module.h)("a", {
1533
- target: "_blank",
1534
- href: "https://subiz.com.vn/vi/privacy-policy.html",
1535
- class: "order__footer_link"
1536
- }, "Quy\u1EC1n ri\xEAng t\u01B0"))), (0,preact_module.h)("div", null, (0,preact_module.h)("div", {
1537
- class: "order_recap"
1538
- }, this.renderDesktopSummary(order), this.renderActions(order)))));
1539
- }
1540
- render() {
1541
- if (this.state.loading) return (0,preact_module.h)("div", {
1542
- class: "order_error"
1543
- }, (0,preact_module.h)(spinner/* default */.A, {
1544
- class: "mt-4",
1545
- size: "60",
1546
- static: true
1547
- }));
1548
- if (this.state.error) return (0,preact_module.h)("div", {
1549
- class: "order_error"
1550
- }, (0,preact_module.h)("img", {
1551
- class: "mt-3",
1552
- src: empty_1_namespaceFn()
1553
- }), (0,preact_module.h)("div", {
1554
- class: "mt-3"
1555
- }, this.props.t('order_load_error')));
1556
- let order = this.state.order;
1557
- if (this.isMobile()) return this.renderMobile(order);
1558
- return this.renderDesktop(order);
1559
- }
1560
- }
1561
- let ShippingProvider = {
1562
- ghtk: {
1563
- name: 'Giao hàng tiết kiệm',
1564
- logo: ghtk_namespaceFn()
1565
- },
1566
- ghn: {
1567
- name: 'Giao hàng nhanh',
1568
- logo: ghn_namespaceFn()
1569
- }
1570
- };
1571
- ;// ./src/chatbox/Order.js
1572
- function Order_defineProperty(e, r, t) { return (r = Order_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
1573
- function Order_toPropertyKey(t) { var i = Order_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
1574
- function Order_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); }
1575
- ;
1576
-
1577
-
1578
- const POPUP_MAX_HEIGHT = 400;
1579
- const POPUP_HARD_MAX_HEIGHT = 500;
1580
- const POPUP_MIN_HEIGHT = 0;
1581
- let Order_defaultAvatar = default_avatar_namespaceFn();
1582
-
1583
-
1584
-
1585
- class Order extends common/* Com */.Mw {
1586
- constructor(props) {
1587
- super(props);
1588
- Order_defineProperty(this, "state", {
1589
- hide: true,
1590
- ratingHeight: 0,
1591
- overlayOpacity: 0.3
1592
- });
1593
- Order_defineProperty(this, "onResponse", response => {
1594
- this.setState({
1595
- response
1596
- });
1597
- });
1598
- Order_defineProperty(this, "confirm", () => {
1599
- this.props.store.sendConvoEvent(this.props.cid, 'message_sent', {
1600
- message: {
1601
- format: 'plaintext',
1602
- text: 'confirm',
1603
- attachments: [{
1604
- type: 'postback',
1605
- postback: {
1606
- payload: JSON.stringify({
1607
- type: 'order_confirmation',
1608
- status: 'confirmed'
1609
- })
1610
- }
1611
- }]
1612
- }
1613
- });
1614
- });
1615
- Order_defineProperty(this, "close", async () => {
1616
- await util/* default */.A.sleep(100);
1617
- if (this.state.response === 'confirmed') {
1618
- this.props.store.sendConvoEvent(this.props.cid, 'message_sent', {
1619
- message: {
1620
- format: 'plaintext',
1621
- text: this.props.t('confirm_order'),
1622
- attachments: [{
1623
- type: 'postback',
1624
- postback: {
1625
- payload: JSON.stringify({
1626
- type: 'order_confirmation',
1627
- status: 'confirmed'
1628
- })
1629
- }
1630
- }]
1631
- }
1632
- });
1633
- } else if (this.state.response === 'rejected') {
1634
- this.props.store.sendConvoEvent(this.props.cid, 'message_sent', {
1635
- message: {
1636
- format: 'plaintext',
1637
- text: this.props.t('cancel_order'),
1638
- attachments: [{
1639
- type: 'postback',
1640
- postback: {
1641
- payload: JSON.stringify({
1642
- type: 'order_confirmation',
1643
- status: 'cancelled'
1644
- })
1645
- }
1646
- }]
1647
- }
1648
- });
1649
- } else {}
1650
- this.setState({
1651
- response: ''
1652
- });
1653
- if (this.state.hide) return;
1654
- if (!this.refRating.current) return;
1655
- var popupStyle = this.refRating.current.currentStyle || window.getComputedStyle(this.refRating.current);
1656
- var h0 = parseFloat(popupStyle.height);
1657
- this.animation.play(20, h0, h => {
1658
- this.setState({
1659
- ratingHeight: h,
1660
- overlayOpacity: Math.min(1, (h - POPUP_MIN_HEIGHT) / (POPUP_HARD_MAX_HEIGHT - POPUP_MIN_HEIGHT))
1661
- });
1662
- if (h < POPUP_MIN_HEIGHT + 10) {
1663
- if (!this.state.hide) {
1664
- this.setState({
1665
- hide: true
1666
- });
1667
- }
1668
- }
1669
- });
1670
- this.props.onClose();
1671
- });
1672
- this.refRating = (0,preact_module/* createRef */._3)();
1673
- this.refHandle = (0,preact_module/* createRef */._3)();
1674
- }
1675
- componentDidMount() {
1676
- this.mouseUp = e => this.onMouseUp(e);
1677
- this.mouseMove = e => this.onMouseMove(e);
1678
- this.mouseDown = e => this.onMouseDown(e);
1679
- var $ratingHandle = this.refHandle.current;
1680
- $ratingHandle.addEventListener('mousedown', this.mouseDown, {
1681
- passive: true
1682
- });
1683
- $ratingHandle.addEventListener('touchstart', this.mouseDown, {
1684
- passive: true
1685
- });
1686
- window.addEventListener('mouseup', this.mouseUp, {
1687
- passive: true
1688
- });
1689
- window.addEventListener('touchend', this.mouseUp, {
1690
- passive: true
1691
- });
1692
- window.addEventListener('mousemove', this.mouseMove, {
1693
- passive: true
1694
- });
1695
- window.addEventListener('touchmove', this.mouseMove, {
1696
- passive: true
1697
- });
1698
- this.animation = new releaseAnimation/* default */.A({
1699
- maxY: POPUP_MAX_HEIGHT,
1700
- minY: POPUP_MIN_HEIGHT,
1701
- duration: 150
1702
- });
1703
- this.close();
1704
- }
1705
- componentWillUnmount() {
1706
- var $ratingHandle = this.refHandle.current;
1707
- $ratingHandle.removeEventListener('mousedown', this.mouseDown, 0);
1708
- $ratingHandle.removeEventListener('touchstart', this.mouseDown, 0);
1709
- window.removeEventListener('mouseup', this.mouseUp, 0);
1710
- window.removeEventListener('touchend', this.mouseUp, 0);
1711
- window.removeEventListener('mousemove', this.mouseMove, 0);
1712
- window.removeEventListener('touchmove', this.mouseMove, 0);
1713
- }
1714
- render() {
1715
- if (this._show != this.props.show) {
1716
- this._show = this.props.show;
1717
- util/* default */.A.setTimeout(() => {
1718
- if (!this._show) this.close();else this.open();
1719
- });
1720
- }
1721
- let cls = this.state.hide ? 'd-none' : '';
1722
- return (0,preact_module.h)("div", {
1723
- class: cls
1724
- }, (0,preact_module.h)("div", {
1725
- class: "extension--overlay",
1726
- style: `opacity: ${this.state.overlayOpacity * 0.5} !important;`
1727
- }), (0,preact_module.h)("div", {
1728
- class: "extension",
1729
- ref: this.refRating,
1730
- style: `height: ${this.state.ratingHeight}px !important;`
1731
- }, (0,preact_module.h)("div", {
1732
- class: "extension--close-btn",
1733
- onClick: this.close
1734
- }, this.props.t('close')), (0,preact_module.h)("div", {
1735
- class: "extension--handle",
1736
- ref: this.refHandle
1737
- }, (0,preact_module.h)("div", {
1738
- class: "extension--thumb"
1739
- })), (0,preact_module.h)("div", {
1740
- style: "overflow-x: hidden !important; overflow-y: scroll !important; height: 100% !important;"
1741
- }, (0,preact_module.h)(order_Order, {
1742
- key: this.props.order_id,
1743
- store: this.props.store,
1744
- onResponse: this.onResponse,
1745
- onClose: this.close,
1746
- t: this.props.t,
1747
- order_id: this.props.order_id,
1748
- cid: this.props.cid
1749
- }))));
1750
- }
1751
- open() {
1752
- if (!this.state.hide) return;
1753
- if (!this.props.order_id) return;
1754
- this.setState({
1755
- hide: false
1756
- });
1757
- if (!this.refRating.current) return;
1758
- var popupStyle = this.refRating.current.currentStyle || window.getComputedStyle(this.refRating.current);
1759
- var h0 = parseFloat(popupStyle.height);
1760
- this.animation.play(-20, h0, h => {
1761
- this.setState({
1762
- ratingHeight: h,
1763
- overlayOpacity: Math.min(1, (h - POPUP_MIN_HEIGHT) / (POPUP_HARD_MAX_HEIGHT - POPUP_MIN_HEIGHT))
1764
- });
1765
- });
1766
- }
1767
- onMouseDown(e) {
1768
- this.mousePushed = true;
1769
- this.animation.stop();
1770
- e.preventDefault();
1771
- if (e.touches && e.touches[0]) e = e.touches[0];
1772
- this.mousePushedDy = e.pageY - window.pageYOffset - this.refRating.current.getBoundingClientRect().y;
1773
- }
1774
- onMouseUp(e) {
1775
- if (!this.mousePushed) return;
1776
- if (e.touches && e.touches[0]) e = e.touches[0];
1777
- this.mousePushed = false;
1778
- var popupStyle = this.refRating.current.currentStyle || window.getComputedStyle(this.refRating.current);
1779
- var h0 = parseFloat(popupStyle.height);
1780
- this.animation.play(this.mouseVelocity, h0, h => {
1781
- this.setState({
1782
- ratingHeight: h,
1783
- overlayOpacity: Math.min(1, (h - POPUP_MIN_HEIGHT) / (POPUP_HARD_MAX_HEIGHT - POPUP_MIN_HEIGHT))
1784
- });
1785
- if (h < POPUP_MIN_HEIGHT + 10) {
1786
- if (!this.state.hide) {
1787
- this.setState({
1788
- hide: true
1789
- });
1790
- this.props.onRate && this.props.onRate({
1791
- no_rating: true
1792
- });
1793
- }
1794
- }
1795
- });
1796
- }
1797
- onMouseMove(e) {
1798
- if (!this.mousePushed) return;
1799
- if (e.touches && e.touches[0]) e = e.touches[0];
1800
- var my = e.pageY;
1801
- this.mouseVelocity = my - this.lastMouseY;
1802
- this.lastMouseY = my;
1803
- my = my - this.mousePushedDy;
1804
- var K = 10000;
1805
- var height = this.refRating.current.getBoundingClientRect().bottom - my;
1806
- if (height > POPUP_MAX_HEIGHT) {
1807
- var beta = K / (POPUP_HARD_MAX_HEIGHT - POPUP_MAX_HEIGHT) - POPUP_MAX_HEIGHT;
1808
- height = POPUP_HARD_MAX_HEIGHT - K / (height + beta);
1809
- }
1810
- this.setState({
1811
- ratingHeight: height,
1812
- overlayOpacity: Math.min(1, (height - POPUP_MIN_HEIGHT) / (POPUP_HARD_MAX_HEIGHT - POPUP_MIN_HEIGHT))
1813
- });
1814
- }
1815
- }
1816
-
1817
- /***/ },
1818
-
1819
- /***/ 7741
1820
- (module, __unused_webpack_exports, __webpack_require__) {
1821
-
1822
- module.exports = __webpack_require__.p + "assets/img/caret.998eb8f.svg";
1823
-
1824
- /***/ },
1825
-
1826
- /***/ 5860
1827
- (module, __unused_webpack_exports, __webpack_require__) {
1828
-
1829
- module.exports = __webpack_require__.p + "assets/img/done_green.b817fd4.svg";
1830
-
1831
- /***/ },
1832
-
1833
- /***/ 6907
1834
- (module, __unused_webpack_exports, __webpack_require__) {
1835
-
1836
- module.exports = __webpack_require__.p + "assets/img/empty_1.0b98af0.svg";
1837
-
1838
- /***/ },
1839
-
1840
- /***/ 1113
1841
- (module, __unused_webpack_exports, __webpack_require__) {
1842
-
1843
- module.exports = __webpack_require__.p + "assets/img/ghn.070f8e3.svg";
1844
-
1845
- /***/ },
1846
-
1847
- /***/ 7362
1848
- (module, __unused_webpack_exports, __webpack_require__) {
1849
-
1850
- module.exports = __webpack_require__.p + "assets/img/ghtk.326eac1.svg";
1851
-
1852
- /***/ },
1853
-
1854
- /***/ 7324
1855
- (module, __unused_webpack_exports, __webpack_require__) {
1856
-
1857
- module.exports = __webpack_require__.p + "assets/img/info.ebce7ea.svg";
1858
-
1859
- /***/ },
1860
-
1861
- /***/ 185
1862
- (module, __unused_webpack_exports, __webpack_require__) {
1863
-
1864
- module.exports = __webpack_require__.p + "assets/img/loader.37000a7.svg";
1865
-
1866
- /***/ },
1867
-
1868
- /***/ 3142
1869
- (module, __unused_webpack_exports, __webpack_require__) {
1870
-
1871
- module.exports = __webpack_require__.p + "assets/img/not_found_search.2ddb8d1.png";
1872
-
1873
- /***/ },
1874
-
1875
- /***/ 8512
1876
- (module, __unused_webpack_exports, __webpack_require__) {
1877
-
1878
- module.exports = __webpack_require__.p + "assets/img/package.8d37d0f.svg";
1879
-
1880
- /***/ },
1881
-
1882
- /***/ 6857
1883
- (module, __unused_webpack_exports, __webpack_require__) {
1884
-
1885
- module.exports = __webpack_require__.p + "assets/img/package_fade.763c001.svg";
1886
-
1887
- /***/ },
1888
-
1889
- /***/ 5452
1890
- (module, __unused_webpack_exports, __webpack_require__) {
1891
-
1892
- module.exports = __webpack_require__.p + "assets/img/search.f9705ff.svg";
1893
-
1894
- /***/ },
1895
-
1896
- /***/ 5244
1897
- (module, __unused_webpack_exports, __webpack_require__) {
1898
-
1899
- module.exports = __webpack_require__.p + "assets/img/shop.f7dc7d8.svg";
1900
-
1901
- /***/ },
1902
-
1903
- /***/ 2523
1904
- (module, __unused_webpack_exports, __webpack_require__) {
1905
-
1906
- module.exports = __webpack_require__.p + "assets/img/shop_faded.df7845a.svg";
1907
-
1908
- /***/ },
1909
-
1910
- /***/ 3080
1911
- (module, __unused_webpack_exports, __webpack_require__) {
1912
-
1913
- module.exports = __webpack_require__.p + "assets/img/x.26fdfa3.svg";
1914
-
1915
- /***/ }
1916
-
1917
- }]);