@subiz/widget-v4 4.1.139 → 4.1.141

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.
@@ -17,302 +17,303 @@
17
17
  @spacer3: @spacer * 1.5; // 15px;
18
18
  @spacer4: @spacer * 2; // 22.5px
19
19
 
20
- // stop client css rule on all elements inside #subiz
21
- #sbz92 * {
22
- all: unset !important;
20
+ @import './font.less';
21
+ @import 'base.less';
22
+
23
+ * {
24
+ font-family: @font-family-sans-serif;
25
+ font-size: @font-size-base;
26
+
27
+ -webkit-box-sizing: border-box; // Safari/Chrome, other WebKit
28
+ -moz-box-sizing: border-box; // Firefox, other Gecko
29
+ box-sizing: border-box; // Opera/IE 8+
30
+
31
+ margin: 0;
32
+ padding: 0;
33
+ border: 0;
34
+ vertical-align: baseline;
23
35
  }
24
36
 
25
- #sbz92 {
26
- #makeImportant() !important;
37
+ button:focus {
38
+ outline: none;
27
39
  }
28
40
 
29
- // prevent #subiz inheriting client site styles
30
- div#sbz92 {
31
- all: initial;
41
+ .pos-relative {
42
+ position: relative;
32
43
  }
33
44
 
34
- // prevent #subiz inheriting client site !important styles
35
- body div#sbz92 {
36
- all: initial !important;
45
+ // flex utils
46
+ .flex-row {
47
+ flex-direction: row;
48
+ }
49
+ .flex-column {
50
+ flex-direction: column;
51
+ }
52
+ .flex-grow-1 {
53
+ flex-grow: 1;
54
+ }
55
+ .align-self-end {
56
+ align-self: flex-end;
57
+ }
58
+ .align-items-end {
59
+ align-items: flex-end;
60
+ }
61
+ .justify-content-center {
62
+ justify-content: center;
63
+ }
64
+ .h-full {
65
+ height: 100%;
66
+ }
67
+ .w-full {
68
+ width: 100%;
69
+ }
70
+ .text-muted {
71
+ .color(@text-muted);
72
+ }
73
+ .text-lg {
74
+ font-size: 18px;
75
+ }
76
+ .text-xl {
77
+ font-size: 20px;
78
+ }
79
+ .text-center {
80
+ text-align: center;
81
+ }
82
+ .text-danger {
83
+ .color(@red);
84
+ }
85
+ .red {
86
+ .color(@red);
37
87
  }
38
88
 
39
- @import './font.less';
40
- #makeImportant() {
41
- @import 'base.less';
89
+ .text-italic {
90
+ font-style: italic;
91
+ }
42
92
 
43
- * {
44
- font-family: @font-family-sans-serif;
45
- font-size: @font-size-base;
93
+ // display utils
94
+ .d-none {
95
+ display: none;
96
+ }
46
97
 
47
- -webkit-box-sizing: border-box; // Safari/Chrome, other WebKit
48
- -moz-box-sizing: border-box; // Firefox, other Gecko
49
- box-sizing: border-box; // Opera/IE 8+
98
+ .d-flex {
99
+ display: flex;
100
+ }
50
101
 
51
- margin: 0;
52
- padding: 0;
53
- border: 0;
54
- vertical-align: baseline;
55
- }
102
+ .d-inline-block {
103
+ display: inline-block;
104
+ }
56
105
 
57
- button:focus {
58
- outline: none;
59
- }
106
+ // spacing utils
107
+ .ml-1 {
108
+ margin-left: @spacer1;
109
+ }
110
+ .pl-2 {
111
+ padding-left: @spacer2;
112
+ }
113
+ .pr-2 {
114
+ padding-right: @spacer2;
115
+ }
116
+ .pb-2 {
117
+ padding-bottom: @spacer2;
118
+ }
119
+ .mt-1 {
120
+ margin-top: @spacer1;
121
+ }
122
+ .mt-2 {
123
+ margin-top: @spacer2;
124
+ }
125
+ .ml-2 {
126
+ margin-left: @spacer2;
127
+ }
128
+ .mr-2 {
129
+ margin-right: @spacer2;
130
+ }
131
+ .pt-3 {
132
+ padding-top: @spacer3;
133
+ }
134
+ .pl-3 {
135
+ padding-left: @spacer3;
136
+ }
137
+ .pr-3 {
138
+ padding-right: @spacer3;
139
+ }
140
+ .pb-3 {
141
+ padding-bottom: @spacer3;
142
+ }
143
+ .mt-3 {
144
+ margin-top: @spacer3;
145
+ }
146
+ .ml-3 {
147
+ margin-left: @spacer3;
148
+ }
149
+ .mr-3 {
150
+ margin-right: @spacer3;
151
+ }
152
+ .mb-3 {
153
+ margin-bottom: @spacer3;
154
+ }
155
+ .mb-2 {
156
+ margin-bottom: @spacer2;
157
+ }
158
+ .mb-1 {
159
+ margin-bottom: @spacer1;
160
+ }
60
161
 
61
- .pos-relative {
62
- position: relative;
63
- }
162
+ .muted {
163
+ .color(@text-muted);
164
+ }
64
165
 
65
- // flex utils
66
- .flex-row {
67
- flex-direction: row;
68
- }
69
- .flex-column {
70
- flex-direction: column;
71
- }
72
- .flex-grow-1 {
73
- flex-grow: 1;
74
- }
75
- .align-self-end {
76
- align-self: flex-end;
77
- }
78
- .align-items-end {
79
- align-items: flex-end;
80
- }
81
- .justify-content-center {
82
- justify-content: center;
83
- }
84
- .h-full {
85
- height: 100%;
86
- }
87
- .w-full {
88
- width: 100%;
89
- }
90
- .text-muted {
91
- .color(@text-muted);
92
- }
93
- .text-lg {
94
- font-size: 18px;
95
- }
96
- .text-xl {
97
- font-size: 20px;
98
- }
99
- .text-center {
100
- text-align: center;
101
- }
102
- .text-danger {
103
- .color(@red);
104
- }
105
- .red {
106
- .color(@red);
107
- }
166
+ .i {
167
+ font-style: italic;
168
+ }
108
169
 
109
- .text-italic {
110
- font-style: italic;
111
- }
170
+ .align-items-center {
171
+ align-items: center;
172
+ }
112
173
 
113
- // display utils
114
- .d-none {
115
- display: none;
116
- }
174
+ .text-truncate {
175
+ text-overflow: ellipsis;
176
+ white-space: nowrap;
177
+ overflow: hidden;
178
+ }
117
179
 
118
- .d-flex {
119
- display: flex;
120
- }
180
+ .flex_1 {
181
+ flex: 1;
182
+ flex-shrink: 0;
183
+ }
121
184
 
122
- .d-inline-block {
123
- display: inline-block;
124
- }
185
+ .justify-content-between {
186
+ justify-content: space-between;
187
+ }
125
188
 
126
- // spacing utils
127
- .ml-1 {
128
- margin-left: @spacer1;
129
- }
130
- .pl-2 {
131
- padding-left: @spacer2;
132
- }
133
- .pr-2 {
134
- padding-right: @spacer2;
135
- }
136
- .pb-2 {
137
- padding-bottom: @spacer2;
138
- }
139
- .mt-1 {
140
- margin-top: @spacer1;
141
- }
142
- .mt-2 {
143
- margin-top: @spacer2;
144
- }
145
- .ml-2 {
146
- margin-left: @spacer2;
147
- }
148
- .mr-2 {
149
- margin-right: @spacer2;
150
- }
151
- .pt-3 {
152
- padding-top: @spacer3;
153
- }
154
- .pl-3 {
155
- padding-left: @spacer3;
156
- }
157
- .pr-3 {
158
- padding-right: @spacer3;
159
- }
160
- .pb-3 {
161
- padding-bottom: @spacer3;
162
- }
163
- .mt-3 {
164
- margin-top: @spacer3;
165
- }
166
- .ml-3 {
167
- margin-left: @spacer3;
168
- }
169
- .mr-3 {
170
- margin-right: @spacer3;
171
- }
172
- .mb-3 {
173
- margin-bottom: @spacer3;
174
- }
175
- .mb-2 {
176
- margin-bottom: @spacer2;
177
- }
178
- .mb-1 {
179
- margin-bottom: @spacer1;
180
- }
189
+ .no-shrink {
190
+ flex-shrink: 0;
191
+ }
192
+ .form-page {
193
+ max-width: 700px;
194
+ width: 100%;
195
+ margin: 0 auto;
196
+ padding: 40px 20px;
197
+ }
181
198
 
182
- .muted {
183
- .color(@text-muted);
184
- }
199
+ .form-page-header {
200
+ margin-bottom: 20px;
201
+ }
185
202
 
186
- .i {
187
- font-style: italic;
188
- }
203
+ .form-page-title {
204
+ font-size: @form-page-header-font-size;
205
+ font-family: @form-page-header-font-family;
206
+ }
189
207
 
190
- .align-items-center {
191
- align-items: center;
192
- }
208
+ .form-page-desc {
209
+ color: @text-muted;
210
+ margin-top: 2px;
211
+ font-size: @form-page-desc-font-size;
212
+ font-family: @form-page-desc-font-family;
213
+ }
193
214
 
194
- .text-truncate {
195
- text-overflow: ellipsis;
196
- white-space: nowrap;
197
- overflow: hidden;
198
- }
215
+ .form-page-logo-wrapper {
216
+ margin-bottom: 30px;
217
+ }
199
218
 
200
- .flex_1 {
201
- flex: 1;
202
- flex-shrink: 0;
203
- }
219
+ img.form-page-logo {
220
+ width: 200px;
221
+ height: 45px;
222
+ }
204
223
 
205
- .justify-content-between {
206
- justify-content: space-between;
224
+ .form-page-logo-text {
225
+ color: @primary-color;
226
+ font-size: 18px;
227
+ font-weight: 500;
228
+ &:hover {
229
+ color: @primary-color;
207
230
  }
231
+ }
208
232
 
209
- .no-shrink {
210
- flex-shrink: 0;
211
- }
212
- .form-page {
213
- max-width: 700px;
214
- width: 100%;
215
- margin: 0 auto;
216
- padding: 40px 20px;
217
- }
233
+ .form-page .form-component .label {
234
+ font-size: @form-page-input-label-font-size;
235
+ font-family: @form-page-input-label-font-family;
236
+ }
218
237
 
219
- .form-page-header {
220
- margin-bottom: 20px;
221
- }
238
+ .form-page-body {
239
+ width: 100%;
240
+ height: 100%;
241
+ overflow: auto;
242
+ background-color: @form-page-background-color;
243
+ }
222
244
 
223
- .form-page-title {
224
- font-size: @form-page-header-font-size;
225
- font-family: @form-page-header-font-family;
245
+ .btn--start-convo {
246
+ border-radius: 7px;
247
+ flex-shrink: 0;
248
+ display: flex;
249
+ align-items: center;
250
+ justify-content: center;
251
+ padding-left: 32px;
252
+ padding-right: 32px;
253
+ height: 40px;
254
+ .color(@text-color);
255
+ font-size: 16px;
256
+ font-weight: 500;
257
+ line-height: 20px;
258
+ text-align: center;
259
+ background: @primary-color;
260
+ // max-width: 270px;
261
+ width: 100%;
262
+ text-overflow: ellipsis;
263
+ white-space: nowrap;
264
+ overflow: hidden;
265
+
266
+ transition: filter 250ms ease;
267
+
268
+ &::after {
269
+ display: none;
226
270
  }
227
-
228
- .form-page-desc {
229
- color: @text-muted;
230
- margin-top: 2px;
231
- font-size: @form-page-desc-font-size;
232
- font-family: @form-page-desc-font-family;
271
+ &:hover {
272
+ filter: brightness(1.1);
233
273
  }
274
+ }
234
275
 
235
- .form-page-logo-wrapper {
236
- margin-bottom: 30px;
237
- }
276
+ .btn--start-convo:disabled {
277
+ opacity: 0.5;
278
+ cursor: default;
279
+ pointer-events: none;
280
+ }
238
281
 
239
- img.form-page-logo {
240
- width: 200px;
241
- height: 45px;
242
- }
282
+ .form-wrapper.form select.form-control {
283
+ height: 40px;
284
+ }
243
285
 
244
- .form-page-logo-text {
245
- color: @primary-color;
246
- font-size: 18px;
247
- font-weight: 500;
248
- &:hover {
249
- color: @primary-color;
250
- }
251
- }
286
+ .form-page-header-bg {
287
+ width: 100%;
288
+ height: 200px;
289
+ background-color: @form-page-background-color;
290
+ }
252
291
 
253
- .form-page .form-component .label {
254
- font-size: @form-page-input-label-font-size;
255
- font-family: @form-page-input-label-font-family;
256
- }
292
+ select.form-control {
293
+ background-color: #fff;
294
+ }
257
295
 
258
- .form-page-body {
259
- width: 100%;
260
- height: 100%;
261
- overflow: auto;
262
- background-color: @form-page-background-color;
263
- }
296
+ .form-page-preview-noti {
297
+ background: #fef7e0;
298
+ text-align: center;
299
+ border-radius: 6px;
300
+ padding: 8px 12px;
301
+ color: #202122;
302
+ width: 100%;
303
+ }
264
304
 
265
- .btn--start-convo {
266
- border-radius: 7px;
267
- flex-shrink: 0;
268
- display: flex;
269
- align-items: center;
270
- justify-content: center;
271
- padding-left: 32px;
272
- padding-right: 32px;
273
- height: 40px;
274
- .color(@text-color);
275
- font-size: 16px;
276
- font-weight: 500;
277
- line-height: 20px;
278
- text-align: center;
279
- background: @primary-color;
280
- // max-width: 270px;
281
- width: 100%;
282
- text-overflow: ellipsis;
283
- white-space: nowrap;
284
- overflow: hidden;
285
-
286
- transition: filter 250ms ease;
287
-
288
- &::after {
289
- display: none;
290
- }
291
- &:hover {
292
- filter: brightness(1.1);
293
- }
294
- }
305
+ .form-page.sketch {
306
+ margin-top: -150px;
307
+ }
295
308
 
296
- .btn--start-convo:disabled {
297
- opacity: 0.5;
298
- cursor: default;
299
- pointer-events: none;
300
- }
309
+ @import 'form.less';
301
310
 
302
- .form-wrapper.form select.form-control {
303
- height: 40px;
311
+ @media only screen and (max-width: 600px) {
312
+ .form-page-header-bg {
313
+ height: 100px;
304
314
  }
305
315
 
306
- .form-page-preview-noti {
307
- background: #fef7e0;
308
- text-align: center;
309
- border-radius: 6px;
310
- margin-top: 10px;
311
- margin-left: 15px;
312
- margin-right: 15px;
313
- padding: 8px 12px;
314
- color: #202122;
315
- }
316
-
317
- @import 'form.less';
316
+ .form-page.sketch {
317
+ margin-top: -15px;
318
+ }
318
319
  }
@@ -436,6 +436,10 @@ select {
436
436
  }
437
437
  }
438
438
 
439
+ .form-component.form-component-submit-button {
440
+ margin-top: 20px;
441
+ }
442
+
439
443
  .form-wrapper.form {
440
444
  padding: 20px;
441
445
  background-color: #fff;
@@ -466,6 +470,14 @@ select {
466
470
  margin-bottom: 0;
467
471
  }
468
472
  }
473
+
474
+ &:first-child .label {
475
+ margin-top: 0;
476
+ }
477
+ }
478
+
479
+ .form-component.form-component-submit-button {
480
+ margin-top: 16px;
469
481
  }
470
482
 
471
483
  .label {
@@ -263,6 +263,43 @@ class Form2 extends _common.Com {
263
263
  errorFields: errors
264
264
  });
265
265
  });
266
+ _defineProperty(this, "renderFormHeader", () => {
267
+ let title = _index.default.get(this.props.formSetting, 'title') || '';
268
+ let desc = _index.default.get(this.props.formSetting, 'description') || '';
269
+ if (this.props.mode === 'attachment') {
270
+ if (title.trim() || desc.trim()) {
271
+ return (0, _preact.h)("div", {
272
+ class: "form-component form-component-block"
273
+ }, title && (0, _preact.h)("div", null, title), desc && (0, _preact.h)("div", {
274
+ class: "text-sm text-muted"
275
+ }, desc));
276
+ }
277
+ }
278
+ let brandLogo = _index.default.get(this.props.formSetting, 'logo.url');
279
+ let brandUrl = _index.default.get(this.props.formSetting, 'brand_url');
280
+ let $logo = null;
281
+ if (brandLogo) {
282
+ $logo = (0, _preact.h)("div", {
283
+ class: "form-page-logo-wrapper"
284
+ }, (0, _preact.h)("a", {
285
+ href: brandUrl || 'javascript:;'
286
+ }, (0, _preact.h)("img", {
287
+ src: brandLogo,
288
+ class: "form-page-logo"
289
+ })));
290
+ }
291
+ let $header = null;
292
+ if (title.trim() || desc.trim()) {
293
+ $header = (0, _preact.h)("div", {
294
+ class: "form-page-header"
295
+ }, (0, _preact.h)("div", {
296
+ class: "form-page-title"
297
+ }, title), desc && (0, _preact.h)("div", {
298
+ class: "form-page-desc"
299
+ }, desc));
300
+ }
301
+ return (0, _preact.h)(_preact.Fragment, null, $logo, $header);
302
+ });
266
303
  let _components = _index.default.get(this.props.formSetting, 'components') || [];
267
304
  _index.default.each(_components, com => {
268
305
  if (com.type === 'input' && com.input_type !== 'checkbox' && com.input_type !== 'radio') {
@@ -298,11 +335,7 @@ class Form2 extends _common.Com {
298
335
  class: "form-component"
299
336
  }, this.props.t('you_have_submitted_info_successfully')), (0, _preact.h)("form", {
300
337
  onSubmit: this.onSubmit
301
- }, this.props.mode === 'attachment' && (title || desc) && (0, _preact.h)("div", {
302
- class: "form-component form-component-block"
303
- }, title && (0, _preact.h)("div", null, title), desc && (0, _preact.h)("div", {
304
- class: "text-sm text-muted"
305
- }, desc)), _index.default.map(components, this.renderFormComponent)));
338
+ }, this.renderFormHeader(), _index.default.map(components, this.renderFormComponent)));
306
339
  }
307
340
  }
308
341
  exports.default = Form2;
@@ -197,29 +197,20 @@ class FormPage extends _common.Com {
197
197
  }, this.props.t('try_again'))));
198
198
  }
199
199
  let brandLogo = _index.default.get(formSetting, 'logo.url');
200
+ let coverUrl = _index.default.get(formSetting, 'cover_image.url');
201
+ let wrappercls = 'form-page';
202
+ if (coverUrl) wrappercls += ' sketch';
200
203
  return (0, _preact.h)("div", {
201
204
  class: "form-page-body",
202
205
  key: "form"
203
206
  }, this.props.previewJson && (0, _preact.h)("div", {
204
207
  class: "form-page-preview-noti"
205
- }, 'Form ở trạng thái xem thử, không ghi nhận phản hồi'), (0, _preact.h)("div", {
206
- class: "form-page"
207
- }, (0, _preact.h)("div", {
208
- class: "form-page-logo-wrapper"
209
- }, (0, _preact.h)("a", {
210
- href: formSetting.brand_url || 'javascript:;'
211
- }, brandLogo ? (0, _preact.h)("img", {
212
- src: brandLogo,
213
- class: "form-page-logo"
214
- }) : (0, _preact.h)("div", {
215
- class: "form-page-logo-text"
216
- }, _index.default.get(this.props.store.matchAccount(), 'name')))), (formSetting.title || formSetting.description) && (0, _preact.h)("div", {
217
- class: "form-page-header"
218
- }, (0, _preact.h)("div", {
219
- class: "form-page-title"
220
- }, formSetting.title), formSetting.description && (0, _preact.h)("div", {
221
- class: "form-page-desc"
222
- }, formSetting.description)), (0, _preact.h)(_Form.default, {
208
+ }, 'Form ở trạng thái xem thử, không ghi nhận phản hồi'), coverUrl && (0, _preact.h)("div", {
209
+ class: "form-page-header-bg",
210
+ style: `background: url(${coverUrl}); background-size: cover;`
211
+ }), (0, _preact.h)("div", {
212
+ class: wrappercls
213
+ }, (0, _preact.h)(_Form.default, {
223
214
  store: this.props.store,
224
215
  formSetting: formSetting,
225
216
  t: this.props.t,
@@ -20,9 +20,10 @@ async function renderForm(form, chatbox, $div) {
20
20
  }
21
21
  const LANG = {
22
22
  no_select: 'Chưa chọn',
23
- cannot_be_empty: 'không thể để trống',
23
+ cannot_be_empty: 'Không thể để trống',
24
24
  you_have_submitted_info_successfully: 'Form được gửi thành công',
25
- no_info_input: 'Chưa nhập'
25
+ no_info_input: 'Chưa nhập',
26
+ phn: 'SĐT'
26
27
  };
27
28
  (0, _preact.render)((0, _preact.h)(_Form.default, {
28
29
  mode: "attachment",
@@ -32,7 +33,7 @@ async function renderForm(form, chatbox, $div) {
32
33
  submission: {
33
34
  values: []
34
35
  },
35
- t: key => LANG[key]
36
+ t: key => LANG[key] || key
36
37
  }), $div);
37
38
  }
38
39
  async function initCss(chatbox) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.139",
3
+ "version": "4.1.141",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
package/src/form/Form.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {Com} from '../common.js'
2
- import {h, createRef} from 'preact'
2
+ import {h, createRef, Fragment} from 'preact'
3
3
  import sb from '../util/index.js'
4
4
  import Block from '../chatbox/block.js'
5
5
 
@@ -303,6 +303,51 @@ export default class Form2 extends Com {
303
303
  this.setState({errorFields: errors})
304
304
  }
305
305
 
306
+ renderFormHeader = () => {
307
+ let title = sb.get(this.props.formSetting, 'title') || ''
308
+ let desc = sb.get(this.props.formSetting, 'description') || ''
309
+
310
+ if (this.props.mode === 'attachment') {
311
+ if (title.trim() || desc.trim()) {
312
+ return (
313
+ <div class='form-component form-component-block'>
314
+ {title && <div>{title}</div>}
315
+ {desc && <div class='text-sm text-muted'>{desc}</div>}
316
+ </div>
317
+ )
318
+ }
319
+ }
320
+
321
+ let brandLogo = sb.get(this.props.formSetting, 'logo.url')
322
+ let brandUrl = sb.get(this.props.formSetting, 'brand_url')
323
+ let $logo = null
324
+ if (brandLogo) {
325
+ $logo = (
326
+ <div class='form-page-logo-wrapper'>
327
+ <a href={brandUrl || 'javascript:;'}>
328
+ <img src={brandLogo} class='form-page-logo' />
329
+ </a>
330
+ </div>
331
+ )
332
+ }
333
+ let $header = null
334
+ if (title.trim() || desc.trim()) {
335
+ $header = (
336
+ <div class='form-page-header'>
337
+ <div class='form-page-title'>{title}</div>
338
+ {desc && <div class='form-page-desc'>{desc}</div>}
339
+ </div>
340
+ )
341
+ }
342
+
343
+ return (
344
+ <Fragment>
345
+ {$logo}
346
+ {$header}
347
+ </Fragment>
348
+ )
349
+ }
350
+
306
351
  render() {
307
352
  let components = sb.get(this.props.formSetting, 'components') || []
308
353
  let title = sb.get(this.props.formSetting, 'title') || ''
@@ -315,12 +360,7 @@ export default class Form2 extends Com {
315
360
  <div class='form-component'>{this.props.t('you_have_submitted_info_successfully')}</div>
316
361
  )}
317
362
  <form onSubmit={this.onSubmit}>
318
- {this.props.mode === 'attachment' && (title || desc) && (
319
- <div class='form-component form-component-block'>
320
- {title && <div>{title}</div>}
321
- {desc && <div class='text-sm text-muted'>{desc}</div>}
322
- </div>
323
- )}
363
+ {this.renderFormHeader()}
324
364
  {sb.map(components, this.renderFormComponent)}
325
365
  </form>
326
366
  </div>
@@ -168,27 +168,20 @@ export default class FormPage extends Com {
168
168
  }
169
169
 
170
170
  let brandLogo = sb.get(formSetting, 'logo.url')
171
+ let coverUrl = sb.get(formSetting, 'cover_image.url')
172
+ //coverUrl =
173
+ //'https://lh7-us.googleusercontent.com/fX5mhofX-12ygFkS6I3UbMh6_NYtd7ySVQkuFxm7Y7ArYMvWu_Ew65l4Ic3QC8eMaBJpUU_5ZNITgigAbqkNJcQRbPjnddxGGE7YOaNBACoWws7b6AuNaAjlisDDY3GCvPHFhh-99Jt0SBiJKnNloWrxxdel_EkVI6MMf6ENTwj2NDQ8MvkCI8ow6z75pwK9C1ZMxDZn?key=-6fBH6GC0hPnLatLRgG5tA'
174
+ let wrappercls = 'form-page'
175
+ if (coverUrl) wrappercls += ' sketch'
171
176
  return (
172
177
  <div class='form-page-body' key='form'>
173
178
  {this.props.previewJson && (
174
179
  <div class='form-page-preview-noti'>{'Form ở trạng thái xem thử, không ghi nhận phản hồi'}</div>
175
180
  )}
176
- <div class='form-page'>
177
- <div class='form-page-logo-wrapper'>
178
- <a href={formSetting.brand_url || 'javascript:;'}>
179
- {brandLogo ? (
180
- <img src={brandLogo} class='form-page-logo' />
181
- ) : (
182
- <div class='form-page-logo-text'>{sb.get(this.props.store.matchAccount(), 'name')}</div>
183
- )}
184
- </a>
185
- </div>
186
- {(formSetting.title || formSetting.description) && (
187
- <div class='form-page-header'>
188
- <div class='form-page-title'>{formSetting.title}</div>
189
- {formSetting.description && <div class='form-page-desc'>{formSetting.description}</div>}
190
- </div>
191
- )}
181
+ {coverUrl && (
182
+ <div class='form-page-header-bg' style={`background: url(${coverUrl}); background-size: cover;`} />
183
+ )}
184
+ <div class={wrappercls}>
192
185
  <Form
193
186
  store={this.props.store}
194
187
  formSetting={formSetting}
package/src/form.js CHANGED
@@ -12,9 +12,10 @@ export default async function renderForm(form, chatbox, $div) {
12
12
  }
13
13
  const LANG = {
14
14
  no_select: 'Chưa chọn',
15
- cannot_be_empty: 'không thể để trống',
15
+ cannot_be_empty: 'Không thể để trống',
16
16
  you_have_submitted_info_successfully: 'Form được gửi thành công',
17
17
  no_info_input: 'Chưa nhập',
18
+ phn: 'SĐT',
18
19
  }
19
20
  render(
20
21
  <Form
@@ -23,7 +24,7 @@ export default async function renderForm(form, chatbox, $div) {
23
24
  onSubmit={() => {}}
24
25
  formSetting={form}
25
26
  submission={{values: []}}
26
- t={(key) => LANG[key]}
27
+ t={(key) => LANG[key] || key}
27
28
  />,
28
29
  $div,
29
30
  )