@subiz/widget-v4 4.1.126 → 4.1.130

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 (62) hide show
  1. package/assets/less/avatar.less +1 -1
  2. package/assets/less/chatbox.less +28 -2
  3. package/assets/less/form.less +77 -2
  4. package/assets/less/message.less +4 -0
  5. package/assets/less/widget.less +20 -0
  6. package/assets/less/widget_header.less +0 -2
  7. package/compiled_src/chatbox/ChatButton.js +10 -4
  8. package/compiled_src/chatbox/ConnectionStatus.js +58 -0
  9. package/compiled_src/chatbox/Event.js +10 -8
  10. package/compiled_src/chatbox/FormAttachment2.js +97 -0
  11. package/compiled_src/chatbox/Widget.js +5 -0
  12. package/compiled_src/form/Form.js +276 -0
  13. package/compiled_src/form/FormPage.js +131 -0
  14. package/compiled_src/form/index.js +72 -0
  15. package/compiled_src/store/api.js +3 -0
  16. package/compiled_src/store/realtime_fake.js +4 -0
  17. package/compiled_src/store/store.js +25 -0
  18. package/compiled_src/util/campaign.js +3 -5
  19. package/compiled_src/util/common.js +2 -2
  20. package/dist/{1964f21ffc8.127.js → 1967c022bc1.127.js} +1 -1
  21. package/dist/{1964f21ffc8.132.js → 1967c022bc1.132.js} +1 -1
  22. package/dist/{1964f21ffc8.185.js → 1967c022bc1.185.js} +1 -1
  23. package/dist/1967c022bc1.278.js +1 -0
  24. package/dist/{1964f21ffc8.490.js → 1967c022bc1.490.js} +1 -1
  25. package/dist/{1964f21ffc8.74.js → 1967c022bc1.74.js} +1 -1
  26. package/dist/1967c022bc1.app.js +1 -0
  27. package/dist/1967c022bc1.form.html +1 -0
  28. package/dist/1967c022bc1.form.js +1 -0
  29. package/dist/{1964f21ffc8.index.html → 1967c022bc1.index.html} +1 -1
  30. package/dist/{1964f21ffc8.library.html → 1967c022bc1.library.html} +1 -1
  31. package/dist/1967c022bc1.library.js +1 -0
  32. package/dist/{1964f21ffc8.preview.html → 1967c022bc1.preview.html} +1 -1
  33. package/dist/1967c022bc1.preview.js +1 -0
  34. package/dist/1967c022bc1.webview.js +1 -0
  35. package/dist/278.js +1 -1
  36. package/dist/HASH +1 -1
  37. package/dist/screenshoot.js +1198 -1001
  38. package/form.html +10 -0
  39. package/package.json +5 -4
  40. package/src/chatbox/ChatButton.js +10 -8
  41. package/src/chatbox/ConnectionStatus.js +42 -0
  42. package/src/chatbox/Event.js +10 -10
  43. package/src/chatbox/FormAttachment2.js +73 -0
  44. package/src/chatbox/Widget.js +2 -0
  45. package/src/form/Form.js +295 -0
  46. package/src/form/FormPage.js +95 -0
  47. package/src/form/index.js +79 -0
  48. package/src/store/api.js +8 -0
  49. package/src/store/realtime_fake.js +8 -4
  50. package/src/store/store.js +29 -0
  51. package/src/util/campaign.js +3 -5
  52. package/src/util/common.js +2 -2
  53. package/webpack.dev.js +2 -0
  54. package/webpack.prod.js +7 -0
  55. package/dist/1964f21ffc8.278.js +0 -1
  56. package/dist/1964f21ffc8.app.js +0 -1
  57. package/dist/1964f21ffc8.library.js +0 -1
  58. package/dist/1964f21ffc8.preview.js +0 -1
  59. package/dist/1964f21ffc8.webview.js +0 -1
  60. /package/dist/{1964f21ffc8.27.js → 1967c022bc1.27.js} +0 -0
  61. /package/dist/{1964f21ffc8.459.js → 1967c022bc1.459.js} +0 -0
  62. /package/dist/{1964f21ffc8.997.js → 1967c022bc1.997.js} +0 -0
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _common = require("../common.js");
8
+ var _preact = require("preact");
9
+ var _index = _interopRequireDefault(require("../util/index.js"));
10
+ var _block = _interopRequireDefault(require("../chatbox/block.js"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ 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; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
14
+ 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); }
15
+ class Form2 extends _common.Com {
16
+ constructor(props) {
17
+ super(props);
18
+ _defineProperty(this, "state", {
19
+ errorFields: {},
20
+ submiting: false
21
+ });
22
+ _defineProperty(this, "renderFormComponent", (com, idx) => {
23
+ if (com.type === 'input') return this.renderField(com, idx);
24
+ if (com.type === 'button') return this.renderSubmitButton(com, idx);
25
+ if (this.props.isSubmited) return;
26
+ return (0, _preact.h)("div", {
27
+ class: "form-component form-component-block"
28
+ }, (0, _preact.h)(_block.default, {
29
+ block: com
30
+ }));
31
+ });
32
+ _defineProperty(this, "renderSubmitButton", (com, idx) => {
33
+ if (this.props.isSubmited) return;
34
+ return (0, _preact.h)("div", {
35
+ class: "form-component form-component-submit-button"
36
+ }, this.props.errorMessage && (0, _preact.h)("div", {
37
+ class: "form-control--valid-input--error mb-1"
38
+ }, this.props.errorMessage), (0, _preact.h)("div", null, (0, _preact.h)("button", {
39
+ class: "btn--start-convo",
40
+ disabled: this.props.submiting
41
+ }, com.label)));
42
+ });
43
+ _defineProperty(this, "renderField", (com, idx) => {
44
+ let errorMsg = this.state.errorFields[com.key];
45
+ if (this.props.isSubmited) {
46
+ let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
47
+ val = val.value || '""';
48
+ val = _index.default.parseJSON(val);
49
+ if (Array.isArray(val)) val = val.join(', ');
50
+ return (0, _preact.h)("div", {
51
+ class: "form-component submitted",
52
+ key: com.key
53
+ }, (0, _preact.h)("label", {
54
+ class: "label"
55
+ }, com.label), (0, _preact.h)("div", null, val || (0, _preact.h)("span", {
56
+ class: "text-muted text-italic"
57
+ }, this.props.t('no_info_input'))));
58
+ }
59
+ return (0, _preact.h)("div", {
60
+ class: "form-component",
61
+ key: com.key
62
+ }, (0, _preact.h)("label", {
63
+ class: "label"
64
+ }, com.label, " ", com.is_required && (0, _preact.h)("span", {
65
+ class: "red"
66
+ }, "*")), com.input_type === 'text' && this.renderFieldTextInput(com, idx), com.input_type === 'multiple' && this.renderFieldTextareaInput(com, idx), com.input_type === 'date' && this.renderFieldDateInput(com, idx), com.input_type === 'radio' && this.renderFieldRadioInput(com, idx), com.input_type === 'checkbox' && this.renderFieldCheckboxInput(com, idx), com.input_type === 'dropdown' && this.renderFieldDropdownInput(com, idx), errorMsg && (0, _preact.h)("div", {
67
+ class: "form-control--valid-input--error"
68
+ }, errorMsg));
69
+ });
70
+ _defineProperty(this, "renderFieldTextInput", (com, idx) => {
71
+ let cls = 'form-control';
72
+ if (this.state.errorFields[com.key]) cls = 'form-control input--error';
73
+ let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
74
+ val = val.value || '""';
75
+ val = _index.default.parseJSON(val);
76
+ return (0, _preact.h)("input", {
77
+ ref: this[`${com.key}_input`],
78
+ type: "text",
79
+ class: cls,
80
+ placeholder: com.placeholder,
81
+ value: val,
82
+ onInput: e => {
83
+ this.onChangeValue(com.key, e.target.value);
84
+ this.clearError(com.key);
85
+ }
86
+ });
87
+ });
88
+ _defineProperty(this, "renderFieldDateInput", (com, idx) => {
89
+ let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
90
+ val = val.value || '""';
91
+ val = _index.default.parseJSON(val);
92
+ let cls = 'form-control';
93
+ if (this.state.errorFields[com.key]) cls = 'form-control input--error';
94
+ return (0, _preact.h)("input", {
95
+ ref: this[`${com.key}_input`],
96
+ class: cls,
97
+ type: "date",
98
+ value: val,
99
+ onInput: e => {
100
+ this.onChangeValue(com.key, e.target.value);
101
+ this.clearError(com.key);
102
+ }
103
+ });
104
+ });
105
+ _defineProperty(this, "renderFieldRadioInput", (com, idx) => {
106
+ let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
107
+ val = val.value || '""';
108
+ val = _index.default.parseJSON(val);
109
+ return _index.default.map(com.input_options, (option, oidx) => {
110
+ let id = com.key + '_' + oidx;
111
+ return (0, _preact.h)("div", {
112
+ class: "radio"
113
+ }, (0, _preact.h)("input", {
114
+ type: "radio",
115
+ name: com.key,
116
+ id: id,
117
+ checked: option.value === val,
118
+ onChange: () => this.toggleRadioField(com.key, option.value)
119
+ }), (0, _preact.h)("label", {
120
+ class: "radio--label",
121
+ for: id
122
+ }, option.label), (0, _preact.h)("div", {
123
+ class: "radio--check"
124
+ }));
125
+ });
126
+ });
127
+ _defineProperty(this, "renderFieldCheckboxInput", (com, idx) => {
128
+ let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
129
+ val = val.value || '[]';
130
+ val = _index.default.parseJSON(val);
131
+ return _index.default.map(com.input_options, (option, oidx) => {
132
+ let id = com.key + '_' + oidx;
133
+ return (0, _preact.h)("div", {
134
+ class: "checkbox"
135
+ }, (0, _preact.h)("input", {
136
+ type: "checkbox",
137
+ name: com.key,
138
+ id: id,
139
+ checked: val.includes(option.value),
140
+ onChange: () => this.toggleCheckboxField(com.key, option.value)
141
+ }), (0, _preact.h)("label", {
142
+ class: "checkbox--label",
143
+ for: id
144
+ }, option.label), (0, _preact.h)("div", {
145
+ class: "checkbox--check"
146
+ }));
147
+ });
148
+ });
149
+ _defineProperty(this, "renderFieldDropdownInput", (com, idx) => {
150
+ let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
151
+ val = val.value || '""';
152
+ val = _index.default.parseJSON(val);
153
+ return (0, _preact.h)("select", {
154
+ class: "form-control",
155
+ ref: this[`${com.key}_input`],
156
+ onChange: e => {
157
+ this.onChangeValue(com.key, e.target.value);
158
+ this.clearError(com.key);
159
+ }
160
+ }, _index.default.map(com.input_options, option => {
161
+ return (0, _preact.h)("option", {
162
+ value: option.value
163
+ }, option.label);
164
+ }));
165
+ });
166
+ _defineProperty(this, "renderFieldTextareaInput", (com, idx) => {
167
+ let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
168
+ val = val.value || '""';
169
+ val = _index.default.parseJSON(val);
170
+ return (0, _preact.h)("textarea", {
171
+ onInput: e => {
172
+ this.onChangeValue(com.key, e.target.value);
173
+ this.clearError(com.key);
174
+ },
175
+ ref: this[`${com.key}_input`],
176
+ rows: "3",
177
+ class: "form-control",
178
+ placeholder: com.placeholder
179
+ });
180
+ });
181
+ _defineProperty(this, "onSubmit", e => {
182
+ e.preventDefault();
183
+ if (!this.validateForm()) return;
184
+ this.props.onSubmit();
185
+ });
186
+ _defineProperty(this, "validateForm", () => {
187
+ let result = true;
188
+ let ref = '';
189
+ let errors = {};
190
+ let components = _index.default.get(this.props.formSetting, 'components') || [];
191
+ _index.default.each(components, com => {
192
+ if (com.type === 'input') {
193
+ if (com.is_required) {
194
+ let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
195
+ val = val.value || '""';
196
+ val = _index.default.parseJSON(val);
197
+ if (typeof val === 'string' && !val.trim()) {
198
+ result = false;
199
+ errors[com.key] = this.props.t('cannot_be_empty');
200
+ if (!ref && com.input_type !== 'checkbox' && com.input_type !== 'radio') ref = `${com.key}_input`;
201
+ }
202
+ if (Array.isArray(val) && val.length === 0) {
203
+ result = false;
204
+ errors[com.key] = this.props.t('cannot_be_empty');
205
+ }
206
+ }
207
+ }
208
+ });
209
+ if (ref && this[ref] && this[ref].current) {
210
+ this[ref].current.focus();
211
+ }
212
+ this.setState({
213
+ errorFields: errors
214
+ });
215
+ return result;
216
+ });
217
+ _defineProperty(this, "onChangeValue", (key, v) => {
218
+ let formValues = _index.default.get(this.props.submission, 'values') || [];
219
+ let f = _index.default.find(formValues, field => field.key === key);
220
+ if (!f) {
221
+ formValues.push({
222
+ key,
223
+ value: JSON.stringify(v)
224
+ });
225
+ } else {
226
+ f.value = JSON.stringify(v);
227
+ }
228
+ this.props.onChangeFormValues(formValues);
229
+ });
230
+ _defineProperty(this, "clearError", key => {
231
+ let errors = this.state.errorFields;
232
+ errors[key] = '';
233
+ this.setState({
234
+ errorFields: errors
235
+ });
236
+ });
237
+ let _components = _index.default.get(this.props.formSetting, 'components') || [];
238
+ _index.default.each(_components, com => {
239
+ if (com.type === 'input' && com.input_type !== 'checkbox' && com.input_type !== 'radio') {
240
+ this[`${com.key}_input`] = (0, _preact.createRef)();
241
+ }
242
+ });
243
+ }
244
+ toggleRadioField(key, v) {
245
+ this.clearError(key);
246
+ this.onChangeValue(key, v);
247
+ }
248
+ toggleCheckboxField(key, v) {
249
+ let currentValues = _index.default.find(this.props.submission.values, f => f.key === key) || {};
250
+ currentValues = currentValues.value || '[]';
251
+ currentValues = _index.default.parseJSON(currentValues);
252
+ if (currentValues.includes(v)) {
253
+ currentValues = currentValues.filter(s => s !== v);
254
+ } else {
255
+ currentValues.push(v);
256
+ }
257
+ this.clearError(key);
258
+ this.onChangeValue(key, currentValues);
259
+ }
260
+ render() {
261
+ let components = _index.default.get(this.props.formSetting, 'components') || [];
262
+ let title = _index.default.get(this.props.formSetting, 'title') || '';
263
+ let cls = 'form-wrapper form';
264
+ if (this.props.mode === 'attachment') cls += ' form-wrapper-attachment';
265
+ return (0, _preact.h)("div", {
266
+ class: cls
267
+ }, this.props.isSubmited && (0, _preact.h)("div", {
268
+ class: "form-component"
269
+ }, this.props.t('you_have_submitted_info_successfully')), (0, _preact.h)("form", {
270
+ onSubmit: this.onSubmit
271
+ }, (0, _preact.h)("div", {
272
+ class: "form-component form-component-block"
273
+ }, title), _index.default.map(components, this.renderFormComponent)));
274
+ }
275
+ }
276
+ exports.default = Form2;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _common = require("../common.js");
8
+ var _preact = require("preact");
9
+ var _Form = _interopRequireDefault(require("./Form.js"));
10
+ var _index = _interopRequireDefault(require("../util/index.js"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ 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; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
14
+ 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); }
15
+ class FormPage extends _common.Com {
16
+ constructor(props) {
17
+ super(props);
18
+ _defineProperty(this, "fetchFormSetting", async () => {
19
+ if (this.state.loading) return;
20
+ this.setState({
21
+ loading: true
22
+ });
23
+ let res = await this.props.store.checkFormToken(this.props.token);
24
+ if (res.error) {
25
+ this.setState({
26
+ loading: false,
27
+ loadError: true
28
+ });
29
+ return;
30
+ }
31
+ let formSetting = _index.default.get(res, 'body.form') || {};
32
+ let submission = _index.default.get(res, 'body.submission') || {};
33
+ let isSubmited = _index.default.size(submission) > 0;
34
+ this.setState({
35
+ loading: false,
36
+ loadError: false,
37
+ formSetting,
38
+ submission,
39
+ isSubmited
40
+ });
41
+ });
42
+ _defineProperty(this, "onChangeFormValues", values => {
43
+ this.setState({
44
+ submission: {
45
+ values
46
+ }
47
+ });
48
+ });
49
+ _defineProperty(this, "onSubmit", async () => {
50
+ this.setState({
51
+ errorMessage: ''
52
+ });
53
+ if (this.state.submiting) return;
54
+ this.setState({
55
+ submiting: true
56
+ });
57
+ let res = await this.props.store.submitForm2(this.props.token, this.state.submission);
58
+ if (res.error) {
59
+ this.setState({
60
+ submiting: false,
61
+ errorMessage: this.props.t('form_submission_error')
62
+ });
63
+ return;
64
+ }
65
+ this.setState({
66
+ submiting: false,
67
+ isSubmited: true
68
+ });
69
+ });
70
+ this.state = {
71
+ submission: {},
72
+ formSetting: {},
73
+ submiting: false,
74
+ errorMessage: '',
75
+ isSubmited: false,
76
+ loading: false,
77
+ loadError: ''
78
+ };
79
+ }
80
+ componentDidMount() {
81
+ this.fetchFormSetting();
82
+ }
83
+ render() {
84
+ const {
85
+ formSetting,
86
+ loading,
87
+ loadError,
88
+ submission,
89
+ errorMessage,
90
+ isSubmited,
91
+ submiting
92
+ } = this.state;
93
+ if (loading && !loadError) {
94
+ return (0, _preact.h)("div", {
95
+ class: "h-full w-full d-flex justify-content-center align-items-center"
96
+ }, (0, _preact.h)("div", {
97
+ class: "text-muted text-xl"
98
+ }, this.props.t('loading_data'), " ..."));
99
+ }
100
+ if (loadError) {
101
+ return (0, _preact.h)("div", {
102
+ class: "h-full w-full d-flex justify-content-center align-items-center"
103
+ }, (0, _preact.h)("div", {
104
+ class: "text-center"
105
+ }, (0, _preact.h)("div", {
106
+ class: "text-danger text-lg mb-2"
107
+ }, this.props.t('error_occurs_when_load_data')), (0, _preact.h)("br", null), (0, _preact.h)("button", {
108
+ disabled: loading,
109
+ type: "button",
110
+ class: "btn--start-convo",
111
+ onClick: this.fetchFormSetting
112
+ }, this.props.t('try_again'))));
113
+ }
114
+ return (0, _preact.h)("div", {
115
+ class: "form-page"
116
+ }, (0, _preact.h)("div", {
117
+ class: "form-page-header"
118
+ }, 'HEADER'), (0, _preact.h)(_Form.default, {
119
+ store: this.props.store,
120
+ formSetting: formSetting,
121
+ t: this.props.t,
122
+ submission: submission,
123
+ errorMessage: errorMessage,
124
+ isSubmited: isSubmited,
125
+ submiting: submiting,
126
+ onChangeFormValues: this.onChangeFormValues,
127
+ onSubmit: this.onSubmit
128
+ }));
129
+ }
130
+ }
131
+ exports.default = FormPage;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ var _store = _interopRequireDefault(require("../store/store.js"));
4
+ var common = _interopRequireWildcard(require("../common.js"));
5
+ var _index = _interopRequireDefault(require("../util/index.js"));
6
+ var _preact = require("preact");
7
+ var _FormPage = _interopRequireDefault(require("./FormPage.js"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ let promiseMainCSS = (() => Promise.resolve().then(() => _interopRequireWildcard(require('../chatbox/css.js'))))();
12
+ const config = require('../../config.js');
13
+ function findChatbox(store) {
14
+ let pluginM = store.matchPlugin();
15
+ let chatboxs = _index.default.filter(pluginM, plugin => plugin.type === 'chatbox');
16
+ if (_index.default.size(chatboxs) === 0) {
17
+ console.error('no chatbox found.');
18
+ return;
19
+ }
20
+ return chatboxs[0];
21
+ }
22
+ function getUrlParameter(name) {
23
+ name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
24
+ var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
25
+ var results = regex.exec(location.search);
26
+ return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
27
+ }
28
+ var $link = document.createElement('link');
29
+ $link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap';
30
+ $link.rel = 'stylesheet';
31
+ document.head.append($link);
32
+ _index.default.preloadWebfonts(['Inter'], [400, 500]);
33
+ async function load() {
34
+ let store = new _store.default(config.ApiURL, config.FileURL, config.RealtimeURL, true);
35
+ window.store = store;
36
+ let accid = getUrlParameter('id') || getUrlParameter('acc_id') || getUrlParameter('account_id') || 'acqsulrowbxiugvginhw';
37
+ let mask = accid + '@' + 'abcd';
38
+ let token = getUrlParameter('token');
39
+ await store.init(accid, mask);
40
+ let acc = store.matchAccount() || {};
41
+ let plugin = findChatbox(store) || {};
42
+ let css = (await promiseMainCSS).default.default.toString();
43
+ var outcss = _index.default.replaceCssVariable(css, plugin.chatbox);
44
+ let $cssStyleDiv = document.createElement('style');
45
+ document.head.appendChild($cssStyleDiv);
46
+ $cssStyleDiv.type = 'text/css';
47
+ $cssStyleDiv.id = 'subiz-style-for-order';
48
+ _index.default.setCss('form', $cssStyleDiv, outcss);
49
+ let t = key => {
50
+ if (_locale === 'debug') return `{{${key}}}`;
51
+ let messages = _index.default.get(common.langMessages, _locale, []);
52
+ let message = _index.default.find(messages, message => message.key === key);
53
+ return _index.default.get(message, 'message', key);
54
+ };
55
+ let _locale = plugin.locale || acc.locale || 'vi-VN';
56
+ t.i18n = i18nText => {
57
+ if (!i18nText) return '';
58
+ let fallbackLocale = plugin.locale || acc.locale || 'vi-VN';
59
+ fallbackLocale = fallbackLocale.replace('-', '_');
60
+ let locale = _locale.replace('-', '_');
61
+ return i18nText[locale] || i18nText[fallbackLocale];
62
+ };
63
+ t.locale = () => _locale;
64
+ common.downloadLanguage(store, _locale).then(() => {
65
+ (0, _preact.render)((0, _preact.h)(_FormPage.default, {
66
+ store: store,
67
+ t: t,
68
+ token: token
69
+ }), document.getElementById('form'));
70
+ });
71
+ }
72
+ load();
@@ -110,6 +110,8 @@ class _default {
110
110
  _defineProperty(this, "list_provinces", () => this.apireq.get(`/accounts/${this.accid}/provinces`));
111
111
  _defineProperty(this, "list_districts", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/districts`));
112
112
  _defineProperty(this, "list_wards", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/wards`));
113
+ _defineProperty(this, "checkFormToken", token => this.api41.get(`/submissions/${token}`));
114
+ _defineProperty(this, "submitForm2", (token, data) => this.api41.post(`/submissions/${token}`, data));
113
115
  _defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
114
116
  keyword: keyword
115
117
  }).get(`/accounts/${this.accid}/addresses`));
@@ -117,6 +119,7 @@ class _default {
117
119
  this.refreshLock = new _index.default.Mutex();
118
120
  this.FileURL = FileURL;
119
121
  this.ApiURL = ApiURL;
122
+ this.api41 = ajax.setBaseUrl('https://api5.subiz.com.vn/4.1').withCredentials(true).setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json');
120
123
  this.apireq = ajax.setBaseUrl(ApiURL).withCredentials(true).addQuery('v', '6').setContentType('text/plain').beforeHook(jsonifyTextPlain).setParser('json').beforeHook((param, done) => {
121
124
  if (this.token_generator) {
122
125
  let user_id = this.profile_id;
@@ -9,5 +9,9 @@ class _default {
9
9
  onInterrupted() {}
10
10
  subscribe() {}
11
11
  stop() {}
12
+ getStatus() {
13
+ return 'active';
14
+ }
15
+ reconnect() {}
12
16
  }
13
17
  exports.default = _default;
@@ -27,6 +27,7 @@ class Store {
27
27
  constructor(ApiURL, FileURL, RealtimeURL, inmem, fakeapi) {
28
28
  _defineProperty(this, "inmem", false);
29
29
  _defineProperty(this, "cookie", cookie);
30
+ _defineProperty(this, "getConnectionStatus", () => this.connectionStatus);
30
31
  _defineProperty(this, "_currentViewingProduct", {});
31
32
  _defineProperty(this, "new_visitor", true);
32
33
  _defineProperty(this, "matchUser", () => {
@@ -134,6 +135,8 @@ class Store {
134
135
  _defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
135
136
  _defineProperty(this, "matchHasManuallyClosed", () => !!this.kv.match('hasManuallyClosed'));
136
137
  _defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
138
+ _defineProperty(this, "checkFormToken", token => this.api.checkFormToken(token));
139
+ _defineProperty(this, "submitForm2", (token, data) => this.api.submitForm2(token, data));
137
140
  _defineProperty(this, "sendPresence", _index.default.throttle(async () => {
138
141
  if (this._die) return dieErr;
139
142
  await this.readyGate.entry();
@@ -160,6 +163,7 @@ class Store {
160
163
  this.seenQueue.push(id);
161
164
  });
162
165
  _defineProperty(this, "onUpdate", (o, cb) => this.pubsub.on2(o, 'account', cb));
166
+ _defineProperty(this, "onConnection", (o, cb) => this.pubsub.on2(o, 'connection', cb));
163
167
  _defineProperty(this, "onResetCSS", (o, cb) => this.pubsub.on2(o, 'resetCSS', cb));
164
168
  _defineProperty(this, "onHighlight", (o, cb) => this.pubsub.on2(o, 'highlight', cb));
165
169
  _defineProperty(this, "setHasManuallyClosed", () => this.kv.put('hasManuallyClosed', true));
@@ -181,6 +185,9 @@ class Store {
181
185
  });
182
186
  });
183
187
  _defineProperty(this, "timeDiff", 0);
188
+ this.connectionStatus = 'active';
189
+ this.CONNECTION_CHECK_INTERVAL = 3000;
190
+ this.reconnectTimestamp = 0;
184
191
  this.g_sync = {};
185
192
  this._die = false;
186
193
  this.forceDevice = null;
@@ -267,6 +274,23 @@ class Store {
267
274
  }
268
275
  }, 2000);
269
276
  }
277
+ async loopCheckConnectionStatus() {
278
+ while (true) {
279
+ if (this._die) break;
280
+ await _index.default.sleep(this.CONNECTION_CHECK_INTERVAL);
281
+ if (!this.realtime) continue;
282
+ if (!this.realtime.getStatus || !this.realtime.reconnect) continue;
283
+ if (this.connectionStatus === 'dead') {
284
+ await this.realtime.reconnect();
285
+ }
286
+ let currentStatus = this.connectionStatus;
287
+ this.connectionStatus = this.realtime.getStatus();
288
+ if (currentStatus !== this.connectionStatus) {
289
+ console.log('publish connectionStatus', this.connectionStatus);
290
+ this.pubsub.publish('connection');
291
+ }
292
+ }
293
+ }
270
294
  linkProduct(p) {
271
295
  if (!p) {
272
296
  this._currentViewingProduct = {};
@@ -445,6 +469,7 @@ class Store {
445
469
  });
446
470
  this.readyGate.open();
447
471
  this.reconnectWs(accid, user.id);
472
+ this.loopCheckConnectionStatus();
448
473
  return user;
449
474
  }
450
475
  async login(accid, user_id, tokenGenerator) {
@@ -56,10 +56,7 @@ function trackInactivity(seconds = 0, cb) {
56
56
  document.addEventListener(ev, resetTime, false);
57
57
  }
58
58
  }
59
- let timeOnPage = 0;
60
- common.setInterval(() => {
61
- timeOnPage += 5;
62
- }, 5000);
59
+ let _pageLoaded = common.Date.now();
63
60
  function trackTimeOnPage(seconds = 0, cb) {
64
61
  if (seconds < 1) {
65
62
  return common.setTimeout(function () {
@@ -67,10 +64,11 @@ function trackTimeOnPage(seconds = 0, cb) {
67
64
  }, 100);
68
65
  }
69
66
  let timer = common.setInterval(() => {
67
+ let timeOnPage = (common.Date.now() - _pageLoaded) / 1000;
70
68
  if (timeOnPage < seconds) return;
71
69
  if (cb) cb(timeOnPage);
72
70
  common.clearInterval(timer);
73
- }, 1000);
71
+ }, 200);
74
72
  }
75
73
  function on(eventName, selector, fn) {
76
74
  document.addEventListener(eventName, function (event) {
@@ -1219,12 +1219,12 @@ function isBlockEmpty(block) {
1219
1219
  return _isBlockEmpty(block);
1220
1220
  }
1221
1221
  function _isBlockEmpty(block = {}) {
1222
- if (!size(block.contents)) {
1222
+ if (!size(block.content)) {
1223
1223
  if ((block.text || '').trim()) return false;
1224
1224
  return true;
1225
1225
  }
1226
1226
  let result = true;
1227
- map(block.contents, content => {
1227
+ map(block.content, content => {
1228
1228
  result = result && _isBlockEmpty(content);
1229
1229
  });
1230
1230
  return result;
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[127],{6127:(t,e,n)=>{n.r(e),n.d(e,{default:()=>i});var a=n(8150),r=n(2840),s=n(172);class i extends r.Mw{render(){let t=a.A.get(this.props.ev,"by.type");if("user"===t)return null;this.props.store.matchAccount();var e=a.A.get(this.props.ev,"data.message.attachments",[]);let r=a.A.filter(e,(t=>"order"===t.type&&t.order)).map((t=>t.order));return 0===r.length?null:a.A.map(r,((e,r)=>{!function(t){let e=0,n=0,a=0;op.map(t.items,(t=>{if(!t.product)return 0;let r=op.get(t,"product.price",0)*(t.quantity||0);a+=r,"percentage"==t.discount_type?t.discount_percentage>0&&(n+=r*t.discount_percentage/1e4,r*=1-(t.discount_percentage||0)/1e4):"amount"==t.discount_type&&t.discount_amount>0&&(n+=t.discount_amount,r-=t.discount_amount||0,r<=0&&(r=0)),t.total=r,e+=r}));let r={};op.map(t.items,((t,e)=>{if(!t.product)return;let n=t.product.tax;if(!n)return;if(!n.id)return;let a=t.total*n.percentage/1e4;t.total_tax=a,r[e]={tax:n,taxprice:a}}));let s=0;op.map(r,(t=>s+=t.taxprice));let i=0;"percentage"==t.discount_type&&t.discount_percentage>0?i=(e+s)*t.discount_percentage/1e4:"amount"==t.discount_type&&(i=t.discount_amount||0);let o=op.get(t,"shipping.nominal_fee",0);if(o>0&&op.get(t,"shipping.tax.id")){let e=t.shipping.tax,n=o*(e.percentage/1e4);r.ship={tax:e,taxprice:n},t.shipping.total_tax=n}s=0,op.map(r,(t=>s+=t.taxprice));let l=e+s-i+o;l+=t.adjustment||0,l<0&&(l=0),t.subtotal=e,t._computed_discount=i,t._taxM=r,t.total=l,t.total_tax=s,t._discount_before_tax=n,t._order_value=a}(e);let i=null;e.note&&(i=(0,s.h)("div",null,(0,s.h)("div",{class:"order_attachment__label"},this.props.t("note")),(0,s.h)("div",{class:"order_attachment__note",title:e.note},e.note)));let l=null;a.A.size(e.items)>0&&(l=(0,s.h)("div",null,(0,s.h)("div",{class:"order_attachment__label"},this.props.t("product")),a.A.map(e.items,(t=>{let e=t.product||{};return(0,s.h)("div",{class:"order_attachment__product"},(0,s.h)("img",{class:"order_attachment__product_img",alt:""+a.A.get(e,"id"),src:a.A.get(e,"image",n(2876))}),(0,s.h)("div",{style:"overflow: hidden !important;"},(0,s.h)("div",{class:"order_attachment__product_name",title:this.props.t.i18n(e.i18n_name)||e.name},this.props.t.i18n(e.i18n_name)||e.name),(0,s.h)("div",{class:"order_attachment__product_desc"},function(t,e=" - "){let n=op.get(t,"options",[]),a=op.get(t,"props",[]),r=op.filter(n,(t=>op.size(t.values)>1)),s=[];return op.each(r,(t=>{let e=op.find(a,(e=>e.key===t.key))||{};e.value&&s.push(e.value)})),s.join(e)}(e," / ")),(0,s.h)("div",{class:"order_attachment__product_desc"},this.props.t("qty")," ",t.quantity," · ",a.A.formatCurrency(e.price))))}))));let c=(0,s.h)("div",{class:"order_attachment__footer"},(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",null,this.props.t("total"))," ",(0,s.h)("div",null,(0,s.h)("b",{class:"order_attachment__total"},a.A.formatCurrency(e.total))))),d=a.A.find(a.A.get(e,"user.attributes",[]),(t=>"phones"===t.key))||{key:"phones",text:""},_=a.A.get(e,"shipping.address.phone","").trim();_=_||a.A.trim(d.text),_&&(_=this.props.t("phn")+": "+_);let p=null;(o(e)||_)&&(p=(0,s.h)("div",null,(0,s.h)("div",{class:"order_attachment__label"},this.props.t("ship_to")),(0,s.h)("div",null,o(e)),(0,s.h)("div",{class:"order_attachment__text_truncate"},_)));let u=null;e._discount_before_tax&&(u=(0,s.h)("div",{class:"order_attachment__footer"},(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("subtotal_before_tax"))," ",(0,s.h)("div",null,a.A.formatCurrency(e._order_value))),(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_before_tax"))," ",(0,s.h)("div",null,"-",a.A.formatCurrency(e._discount_before_tax)))));let h=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("subtotal"))," ",(0,s.h)("div",{style:""},a.A.formatCurrency(e.subtotal))),m=null;if(e.total_tax){let t="";if(1===a.A.size(e._taxM)){let n=a.A.get(e._taxM,"0.tax",{});n.name&&n.percentage&&(t=`(${n.name} ${Math.round(n.percentage||0)/100}%)`)}m=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("tax")," ",t),(0,s.h)("div",{style:""},a.A.formatCurrency(e.total_tax)))}let g=null;"percentage"===e.discount_type&&e.discount_percentage&&(g=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_after_tax")," (",Math.round(e.discount_percentage/100),"%)")," ",(0,s.h)("div",{style:""},"-",a.A.formatCurrency(e._computed_discount)))),"amount"===e.discount_type&&e.discount_amount&&(g=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_after_tax"))," ",(0,s.h)("div",{class:"no-shrink"},"-",a.A.formatCurrency(e._computed_discount))));let f=null;a.A.get(e,"shipping.nominal_fee")&&(f=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("shipping_fee"))," ",(0,s.h)("div",{style:""},a.A.formatCurrency(a.A.get(e,"shipping.nominal_fee",0)))));let v=null;return e.adjustment&&(v=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},e.adjustment_description)," ",(0,s.h)("div",{class:"no-shrink"},a.A.formatCurrency(e.adjustment)))),h=(0,s.h)("div",{class:"order_attachment__footer"},h,m,f,g,v),f||v||g||m||(h=null),(0,s.h)("div",{class:`order_attachment order_attachment__${t}`},(0,s.h)("div",{class:"order_attachment__header"},this.props.t("order"),(0,s.h)("span",{class:"order_attachment__text_muted order_attachment__text_sm"},function(t={}){return t.number||t.id||""}(e))),l,p,i,u,h,c)}))}}function o(t,e){let n=op.get(t,"shipping.address",{}),a=[n.address,n.ward,n.district,n.province].filter((t=>t)).join(", ").trim();return e&&(a=(a||"").replace(/Hà Nội/gi,"HN").replace(/Hồ Chí Minh/gi,"HCM").replace(/Thành Phố/gi,"TP")),a}}}]);
1
+ "use strict";(self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[127],{6127:(t,e,n)=>{n.r(e),n.d(e,{default:()=>i});var a=n(5922),r=n(2840),s=n(172);class i extends r.Mw{render(){let t=a.A.get(this.props.ev,"by.type");if("user"===t)return null;this.props.store.matchAccount();var e=a.A.get(this.props.ev,"data.message.attachments",[]);let r=a.A.filter(e,(t=>"order"===t.type&&t.order)).map((t=>t.order));return 0===r.length?null:a.A.map(r,((e,r)=>{!function(t){let e=0,n=0,a=0;op.map(t.items,(t=>{if(!t.product)return 0;let r=op.get(t,"product.price",0)*(t.quantity||0);a+=r,"percentage"==t.discount_type?t.discount_percentage>0&&(n+=r*t.discount_percentage/1e4,r*=1-(t.discount_percentage||0)/1e4):"amount"==t.discount_type&&t.discount_amount>0&&(n+=t.discount_amount,r-=t.discount_amount||0,r<=0&&(r=0)),t.total=r,e+=r}));let r={};op.map(t.items,((t,e)=>{if(!t.product)return;let n=t.product.tax;if(!n)return;if(!n.id)return;let a=t.total*n.percentage/1e4;t.total_tax=a,r[e]={tax:n,taxprice:a}}));let s=0;op.map(r,(t=>s+=t.taxprice));let i=0;"percentage"==t.discount_type&&t.discount_percentage>0?i=(e+s)*t.discount_percentage/1e4:"amount"==t.discount_type&&(i=t.discount_amount||0);let o=op.get(t,"shipping.nominal_fee",0);if(o>0&&op.get(t,"shipping.tax.id")){let e=t.shipping.tax,n=o*(e.percentage/1e4);r.ship={tax:e,taxprice:n},t.shipping.total_tax=n}s=0,op.map(r,(t=>s+=t.taxprice));let l=e+s-i+o;l+=t.adjustment||0,l<0&&(l=0),t.subtotal=e,t._computed_discount=i,t._taxM=r,t.total=l,t.total_tax=s,t._discount_before_tax=n,t._order_value=a}(e);let i=null;e.note&&(i=(0,s.h)("div",null,(0,s.h)("div",{class:"order_attachment__label"},this.props.t("note")),(0,s.h)("div",{class:"order_attachment__note",title:e.note},e.note)));let l=null;a.A.size(e.items)>0&&(l=(0,s.h)("div",null,(0,s.h)("div",{class:"order_attachment__label"},this.props.t("product")),a.A.map(e.items,(t=>{let e=t.product||{};return(0,s.h)("div",{class:"order_attachment__product"},(0,s.h)("img",{class:"order_attachment__product_img",alt:""+a.A.get(e,"id"),src:a.A.get(e,"image",n(2876))}),(0,s.h)("div",{style:"overflow: hidden !important;"},(0,s.h)("div",{class:"order_attachment__product_name",title:this.props.t.i18n(e.i18n_name)||e.name},this.props.t.i18n(e.i18n_name)||e.name),(0,s.h)("div",{class:"order_attachment__product_desc"},function(t,e=" - "){let n=op.get(t,"options",[]),a=op.get(t,"props",[]),r=op.filter(n,(t=>op.size(t.values)>1)),s=[];return op.each(r,(t=>{let e=op.find(a,(e=>e.key===t.key))||{};e.value&&s.push(e.value)})),s.join(e)}(e," / ")),(0,s.h)("div",{class:"order_attachment__product_desc"},this.props.t("qty")," ",t.quantity," · ",a.A.formatCurrency(e.price))))}))));let c=(0,s.h)("div",{class:"order_attachment__footer"},(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",null,this.props.t("total"))," ",(0,s.h)("div",null,(0,s.h)("b",{class:"order_attachment__total"},a.A.formatCurrency(e.total))))),d=a.A.find(a.A.get(e,"user.attributes",[]),(t=>"phones"===t.key))||{key:"phones",text:""},_=a.A.get(e,"shipping.address.phone","").trim();_=_||a.A.trim(d.text),_&&(_=this.props.t("phn")+": "+_);let p=null;(o(e)||_)&&(p=(0,s.h)("div",null,(0,s.h)("div",{class:"order_attachment__label"},this.props.t("ship_to")),(0,s.h)("div",null,o(e)),(0,s.h)("div",{class:"order_attachment__text_truncate"},_)));let u=null;e._discount_before_tax&&(u=(0,s.h)("div",{class:"order_attachment__footer"},(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("subtotal_before_tax"))," ",(0,s.h)("div",null,a.A.formatCurrency(e._order_value))),(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_before_tax"))," ",(0,s.h)("div",null,"-",a.A.formatCurrency(e._discount_before_tax)))));let h=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("subtotal"))," ",(0,s.h)("div",{style:""},a.A.formatCurrency(e.subtotal))),m=null;if(e.total_tax){let t="";if(1===a.A.size(e._taxM)){let n=a.A.get(e._taxM,"0.tax",{});n.name&&n.percentage&&(t=`(${n.name} ${Math.round(n.percentage||0)/100}%)`)}m=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("tax")," ",t),(0,s.h)("div",{style:""},a.A.formatCurrency(e.total_tax)))}let g=null;"percentage"===e.discount_type&&e.discount_percentage&&(g=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_after_tax")," (",Math.round(e.discount_percentage/100),"%)")," ",(0,s.h)("div",{style:""},"-",a.A.formatCurrency(e._computed_discount)))),"amount"===e.discount_type&&e.discount_amount&&(g=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_after_tax"))," ",(0,s.h)("div",{class:"no-shrink"},"-",a.A.formatCurrency(e._computed_discount))));let f=null;a.A.get(e,"shipping.nominal_fee")&&(f=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},this.props.t("shipping_fee"))," ",(0,s.h)("div",{style:""},a.A.formatCurrency(a.A.get(e,"shipping.nominal_fee",0)))));let v=null;return e.adjustment&&(v=(0,s.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,s.h)("div",{class:"order_attachment__label no_margin"},e.adjustment_description)," ",(0,s.h)("div",{class:"no-shrink"},a.A.formatCurrency(e.adjustment)))),h=(0,s.h)("div",{class:"order_attachment__footer"},h,m,f,g,v),f||v||g||m||(h=null),(0,s.h)("div",{class:`order_attachment order_attachment__${t}`},(0,s.h)("div",{class:"order_attachment__header"},this.props.t("order"),(0,s.h)("span",{class:"order_attachment__text_muted order_attachment__text_sm"},function(t={}){return t.number||t.id||""}(e))),l,p,i,u,h,c)}))}}function o(t,e){let n=op.get(t,"shipping.address",{}),a=[n.address,n.ward,n.district,n.province].filter((t=>t)).join(", ").trim();return e&&(a=(a||"").replace(/Hà Nội/gi,"HN").replace(/Hồ Chí Minh/gi,"HCM").replace(/Thành Phố/gi,"TP")),a}}}]);