@subiz/widget-v4 4.1.142 → 4.1.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/compiled_src/bot.js +1 -2
- package/compiled_src/call/call.js +1 -2
- package/compiled_src/chatbox/Event.js +1 -2
- package/compiled_src/chatbox/Widget.js +3 -4
- package/compiled_src/chatbox/main.js +1 -2
- package/compiled_src/contact/contact.js +1 -2
- package/compiled_src/form/FormPage.js +1 -2
- package/compiled_src/form/index.js +1 -2
- package/compiled_src/form.js +1 -2
- package/compiled_src/notif/notif.js +1 -2
- package/compiled_src/order/icon.js +1 -2
- package/compiled_src/order/index.js +1 -2
- package/compiled_src/order/order.js +1 -2
- package/compiled_src/plugin.js +1 -2
- package/compiled_src/popup/popup.js +1 -2
- package/compiled_src/store/store.js +1255 -0
- package/compiled_src/util/campaign.js +88 -0
- package/compiled_src/util/common.js +1294 -0
- package/compiled_src/util/common.test.js +496 -0
- package/compiled_src/util/extractor.test.js +299 -0
- package/compiled_src/util/gate.js +38 -0
- package/compiled_src/util/gate.test.js +18 -0
- package/compiled_src/util/index.js +19 -0
- package/compiled_src/util/mutex.js +31 -0
- package/compiled_src/util/op.js +55 -0
- package/compiled_src/util/pubsub.js +29 -0
- package/compiled_src/util/pubsub.test.js +35 -0
- package/dist/196d3465f26.278.js +1 -0
- package/dist/196d3465f26.339.js +1 -0
- package/dist/196d3465f26.app.js +1 -0
- package/dist/196d3465f26.form.html +1 -0
- package/dist/196d3465f26.form.js +1 -0
- package/dist/{1967c022bc1.index.html → 196d3465f26.index.html} +15 -1
- package/dist/{1967c022bc1.library.html → 196d3465f26.library.html} +15 -1
- package/dist/196d3465f26.library.js +1 -0
- package/dist/{1967c022bc1.preview.html → 196d3465f26.preview.html} +1 -1
- package/dist/196d3465f26.preview.js +1 -0
- package/dist/196d3465f26.webview.js +1 -0
- package/dist/278.js +81 -70
- package/dist/HASH +1 -1
- package/dist/assets/img/stars_v2.79cf728.png +0 -0
- package/dist/screenshoot.js +317 -118
- package/index.html +14 -0
- package/package.json +10 -10
- package/src/chatbox/Widget.js +2 -2
- package/src/store/store.js +1 -1
- package/dist/1967c022bc1.278.js +0 -1
- package/dist/1967c022bc1.app.js +0 -1
- package/dist/1967c022bc1.form.html +0 -1
- package/dist/1967c022bc1.form.js +0 -1
- package/dist/1967c022bc1.library.js +0 -1
- package/dist/1967c022bc1.preview.js +0 -1
- package/dist/1967c022bc1.webview.js +0 -1
- /package/dist/{1967c022bc1.127.js → 196d3465f26.127.js} +0 -0
- /package/dist/{1967c022bc1.132.js → 196d3465f26.132.js} +0 -0
- /package/dist/{1967c022bc1.185.js → 196d3465f26.185.js} +0 -0
- /package/dist/{1967c022bc1.27.js → 196d3465f26.27.js} +0 -0
- /package/dist/{1967c022bc1.459.js → 196d3465f26.459.js} +0 -0
- /package/dist/{1967c022bc1.490.js → 196d3465f26.490.js} +0 -0
- /package/dist/{1967c022bc1.74.js → 196d3465f26.74.js} +0 -0
- /package/dist/{1967c022bc1.997.js → 196d3465f26.997.js} +0 -0
package/dist/screenshoot.js
CHANGED
|
@@ -691,13 +691,11 @@ var {xhrsend, parseJSON, Pubsub} = __webpack_require__(7695)
|
|
|
691
691
|
function Conn(apiUrl, credential, onDead, onEvents, callAPI, accid) {
|
|
692
692
|
callAPI = callAPI || xhrsend // allow hook
|
|
693
693
|
credential = credential || {}
|
|
694
|
-
|
|
695
694
|
var lastToken = ''
|
|
696
695
|
if (!accid) accid = ''
|
|
697
|
-
|
|
698
696
|
var is_dead = false // tell if the connection is dead
|
|
699
697
|
var is_polling_stuck = false // tell if we've having trouble doing /poll
|
|
700
|
-
var is_sub_stuck =
|
|
698
|
+
var is_sub_stuck = true // tell if we've having trouble doing /subscribe
|
|
701
699
|
|
|
702
700
|
// The long polling loop runs sequentially, with each poll starting immediately
|
|
703
701
|
// after the previous one completes. If an error occurs, the loop will pause
|
|
@@ -706,7 +704,7 @@ function Conn(apiUrl, credential, onDead, onEvents, callAPI, accid) {
|
|
|
706
704
|
// The first loop begins after the first subscription call completes successfully
|
|
707
705
|
var polling = function (backoff) {
|
|
708
706
|
if (is_dead) return
|
|
709
|
-
callAPI('get', apiUrl + 'poll?token=' + lastToken + '&account-id=' + accid, undefined, function (body, code) {
|
|
707
|
+
callAPI('get', apiUrl + 'poll?token=' + lastToken + '&v=5&account-id=' + accid, undefined, function (body, code) {
|
|
710
708
|
if (is_dead) return
|
|
711
709
|
if (retryable(code)) {
|
|
712
710
|
is_polling_stuck = true
|
|
@@ -751,6 +749,7 @@ function Conn(apiUrl, credential, onDead, onEvents, callAPI, accid) {
|
|
|
751
749
|
// too long, kill
|
|
752
750
|
if (done) return
|
|
753
751
|
done = true
|
|
752
|
+
is_sub_stuck = true
|
|
754
753
|
resolve(repeat('dead', topics.length))
|
|
755
754
|
if (is_dead) return
|
|
756
755
|
kill('subs')
|
|
@@ -774,7 +773,8 @@ function Conn(apiUrl, credential, onDead, onEvents, callAPI, accid) {
|
|
|
774
773
|
else if (credential.user_mask) query += '&user-mask=' + encodeURIComponent(credential.user_mask)
|
|
775
774
|
else if (access_token) query += '&access-token=' + access_token
|
|
776
775
|
|
|
777
|
-
var fullurl =
|
|
776
|
+
var fullurl =
|
|
777
|
+
apiUrl + 'subs' + query + '&v=5&account-id=' + encodeURIComponent(accid || credential.account_id)
|
|
778
778
|
callAPI('post', fullurl, JSON.stringify({events: topics}), function (body, code) {
|
|
779
779
|
if (done) return
|
|
780
780
|
if (is_dead) {
|
|
@@ -884,7 +884,7 @@ function Realtime(apiUrls, credential, callAPI, accid, skipautoreconnect) {
|
|
|
884
884
|
return conn.getStatus()
|
|
885
885
|
}
|
|
886
886
|
|
|
887
|
-
|
|
887
|
+
var subscribe = function (events) {
|
|
888
888
|
if (!conn) return Promise.resolve({error: 'dead'})
|
|
889
889
|
if (typeof events === 'string') events = [events]
|
|
890
890
|
if (!Array.isArray(events)) return Promise.resolve({error: 'param should be an array or string'})
|
|
@@ -904,20 +904,22 @@ function Realtime(apiUrls, credential, callAPI, accid, skipautoreconnect) {
|
|
|
904
904
|
return {}
|
|
905
905
|
})
|
|
906
906
|
}
|
|
907
|
+
this.subscribe = subscribe
|
|
907
908
|
|
|
908
909
|
// reconnect make sure there is alway a Conn running in the background
|
|
909
910
|
// if the Conn is dead, it recreate a new one
|
|
910
911
|
var conn
|
|
911
|
-
|
|
912
|
+
var reconnect = function () {
|
|
912
913
|
var randomUrl = apiUrls[Math.floor(Math.random() * apiUrls.length)]
|
|
913
914
|
if (conn) conn.kill() // kill old connection
|
|
914
|
-
|
|
915
|
+
var myconn = new Conn(
|
|
915
916
|
randomUrl,
|
|
916
917
|
credential,
|
|
917
918
|
function (code, body, status) {
|
|
918
919
|
if (myconn != conn) return // outdated
|
|
920
|
+
conn = undefined // prevent dupplicate dead fire
|
|
919
921
|
pubsub.emit('interrupted', code, body, status)
|
|
920
|
-
if (!skipautoreconnect) setTimeout(
|
|
922
|
+
// if (!skipautoreconnect) setTimeout(reconnect, 2000) // reconnect and resubscribe after 2 sec
|
|
921
923
|
},
|
|
922
924
|
function (events) {
|
|
923
925
|
if (myconn != conn) return
|
|
@@ -927,13 +929,13 @@ function Realtime(apiUrls, credential, callAPI, accid, skipautoreconnect) {
|
|
|
927
929
|
accid,
|
|
928
930
|
)
|
|
929
931
|
conn = myconn
|
|
930
|
-
|
|
931
932
|
var copyTopics = Object.keys(topics)
|
|
932
933
|
topics = {}
|
|
933
934
|
// resubscribe all subscribed events
|
|
934
|
-
return
|
|
935
|
+
return subscribe(copyTopics)
|
|
935
936
|
}
|
|
936
|
-
this.reconnect
|
|
937
|
+
this.reconnect = reconnect
|
|
938
|
+
reconnect()
|
|
937
939
|
}
|
|
938
940
|
|
|
939
941
|
// calcNextBackoff returns number of seconds we must wait
|
|
@@ -2772,6 +2774,13 @@ function replaceCssVariable(css, setting) {
|
|
|
2772
2774
|
tokens = tokenize(tokens, "'@z_index_3'");
|
|
2773
2775
|
tokens = tokenize(tokens, "'@z_index_4'");
|
|
2774
2776
|
tokens = tokenize(tokens, "'@z_index_5'");
|
|
2777
|
+
tokens = tokenize(tokens, "'@form_background_color'");
|
|
2778
|
+
tokens = tokenize(tokens, "'@form_header_font_size'");
|
|
2779
|
+
tokens = tokenize(tokens, "'@form_header_font_family'");
|
|
2780
|
+
tokens = tokenize(tokens, "'@form_desc_font_size'");
|
|
2781
|
+
tokens = tokenize(tokens, "'@form_desc_font_family'");
|
|
2782
|
+
tokens = tokenize(tokens, "'@form_input_label_font_size'");
|
|
2783
|
+
tokens = tokenize(tokens, "'@form_input_label_font_family'");
|
|
2775
2784
|
var primary_color = op.get(setting, 'primary_color') || op.get(DEFVAL, 'primary_color');
|
|
2776
2785
|
let parseColor = parseCssColor(primary_color);
|
|
2777
2786
|
if (!parseColor) parseColor = {
|
|
@@ -2817,7 +2826,7 @@ function replaceCssVariable(css, setting) {
|
|
|
2817
2826
|
var path = item.type.substr(2, item.type.length - 3);
|
|
2818
2827
|
var val = op.get(setting, path) || op.get(DEFVAL, path) || '';
|
|
2819
2828
|
val = norm2(val);
|
|
2820
|
-
if (['mobile_button.width', 'mobile_button.height', 'mobile_button.margin_x', 'mobile_button.margin_y', 'desktop_button.width', 'desktop_button.height', 'desktop_button.margin_x', 'desktop_button.margin_y', 'width', 'height'].includes(path)) {
|
|
2829
|
+
if (['mobile_button.width', 'mobile_button.height', 'mobile_button.margin_x', 'mobile_button.margin_y', 'desktop_button.width', 'desktop_button.height', 'desktop_button.margin_x', 'desktop_button.margin_y', 'form_header_font_size', 'form_desc_font_size', 'form_input_label_font_size', 'width', 'height'].includes(path)) {
|
|
2821
2830
|
val += 'px';
|
|
2822
2831
|
}
|
|
2823
2832
|
if (path === 'height' && op.get(setting, 'window_mode') === 'full') {
|
|
@@ -3793,8 +3802,8 @@ function jsonifyTextPlain(param, done) {
|
|
|
3793
3802
|
_defineProperty(this, "list_provinces", () => this.apireq.get(`/accounts/${this.accid}/provinces`));
|
|
3794
3803
|
_defineProperty(this, "list_districts", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/districts`));
|
|
3795
3804
|
_defineProperty(this, "list_wards", p => this.apireq.setQuery(p).get(`/accounts/${this.accid}/wards`));
|
|
3796
|
-
_defineProperty(this, "checkFormToken", token => this.api41.get(`/submissions/${token}`));
|
|
3797
|
-
_defineProperty(this, "submitForm2", (token, data) => this.api41.post(`/submissions/${token}`, data));
|
|
3805
|
+
_defineProperty(this, "checkFormToken", (accid, token) => this.api41.addQuery('account-id', accid).get(`/submissions/${token}`));
|
|
3806
|
+
_defineProperty(this, "submitForm2", (accid, token, data) => this.api41.addQuery('account-id', accid).post(`/submissions/${token}`, data));
|
|
3798
3807
|
_defineProperty(this, "suggest_address", keyword => this.apireq.setQuery({
|
|
3799
3808
|
keyword: keyword
|
|
3800
3809
|
}).get(`/accounts/${this.accid}/addresses`));
|
|
@@ -4849,8 +4858,8 @@ class Store {
|
|
|
4849
4858
|
store_defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
|
|
4850
4859
|
store_defineProperty(this, "matchHasManuallyClosed", () => !!this.kv.match('hasManuallyClosed'));
|
|
4851
4860
|
store_defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
|
|
4852
|
-
store_defineProperty(this, "checkFormToken", token => this.api.checkFormToken(token));
|
|
4853
|
-
store_defineProperty(this, "submitForm2", (token, data) => this.api.submitForm2(token, data));
|
|
4861
|
+
store_defineProperty(this, "checkFormToken", (accid, token) => this.api.checkFormToken(accid, token));
|
|
4862
|
+
store_defineProperty(this, "submitForm2", (accid, token, data) => this.api.submitForm2(accid, token, data));
|
|
4854
4863
|
store_defineProperty(this, "sendPresence", util/* default */.A.throttle(async () => {
|
|
4855
4864
|
if (this._die) return dieErr;
|
|
4856
4865
|
await this.readyGate.entry();
|
|
@@ -7395,6 +7404,128 @@ class QuickReplies extends common/* Com */.Mw {
|
|
|
7395
7404
|
}, $replies);
|
|
7396
7405
|
}
|
|
7397
7406
|
}
|
|
7407
|
+
;// ./src/form/rating-stars.js
|
|
7408
|
+
function rating_stars_defineProperty(e, r, t) { return (r = rating_stars_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7409
|
+
function rating_stars_toPropertyKey(t) { var i = rating_stars_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
7410
|
+
function rating_stars_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); }
|
|
7411
|
+
|
|
7412
|
+
|
|
7413
|
+
|
|
7414
|
+
class rating_stars_Form2 extends common/* Com */.Mw {
|
|
7415
|
+
constructor(props) {
|
|
7416
|
+
super(props);
|
|
7417
|
+
rating_stars_defineProperty(this, "state", {
|
|
7418
|
+
hovering: 0,
|
|
7419
|
+
selected: 0
|
|
7420
|
+
});
|
|
7421
|
+
rating_stars_defineProperty(this, "onMouseEnter", v => {
|
|
7422
|
+
let {
|
|
7423
|
+
selected,
|
|
7424
|
+
hovering
|
|
7425
|
+
} = this.state;
|
|
7426
|
+
if (v <= selected) {
|
|
7427
|
+
this.setState({
|
|
7428
|
+
hovering: selected
|
|
7429
|
+
});
|
|
7430
|
+
return;
|
|
7431
|
+
}
|
|
7432
|
+
this.setState({
|
|
7433
|
+
hovering: v
|
|
7434
|
+
});
|
|
7435
|
+
});
|
|
7436
|
+
rating_stars_defineProperty(this, "onMouseLeave", () => {
|
|
7437
|
+
let {
|
|
7438
|
+
selected,
|
|
7439
|
+
hovering
|
|
7440
|
+
} = this.state;
|
|
7441
|
+
this.setState({
|
|
7442
|
+
hovering: 0
|
|
7443
|
+
});
|
|
7444
|
+
});
|
|
7445
|
+
}
|
|
7446
|
+
onToggleValue(v) {
|
|
7447
|
+
let {
|
|
7448
|
+
selected
|
|
7449
|
+
} = this.state;
|
|
7450
|
+
let newVal = v;
|
|
7451
|
+
if (v === selected) newVal = 0;
|
|
7452
|
+
this.setState({
|
|
7453
|
+
selected: newVal,
|
|
7454
|
+
hovering: newVal
|
|
7455
|
+
});
|
|
7456
|
+
this.props.onChange(newVal);
|
|
7457
|
+
}
|
|
7458
|
+
render() {
|
|
7459
|
+
let {
|
|
7460
|
+
selected,
|
|
7461
|
+
hovering
|
|
7462
|
+
} = this.state;
|
|
7463
|
+
let star1Cls = 'star-wrapper';
|
|
7464
|
+
if (selected >= 1) {
|
|
7465
|
+
star1Cls += ' selected';
|
|
7466
|
+
} else if (hovering >= 1) {
|
|
7467
|
+
star1Cls += ' hovering';
|
|
7468
|
+
}
|
|
7469
|
+
let star2Cls = 'star-wrapper';
|
|
7470
|
+
if (selected >= 2) {
|
|
7471
|
+
star2Cls += ' selected';
|
|
7472
|
+
} else if (hovering >= 2) {
|
|
7473
|
+
star2Cls += ' hovering';
|
|
7474
|
+
}
|
|
7475
|
+
let star3Cls = 'star-wrapper';
|
|
7476
|
+
if (selected >= 3) {
|
|
7477
|
+
star3Cls += ' selected';
|
|
7478
|
+
} else if (hovering >= 3) {
|
|
7479
|
+
star3Cls += ' hovering';
|
|
7480
|
+
}
|
|
7481
|
+
let star4Cls = 'star-wrapper';
|
|
7482
|
+
if (selected >= 4) {
|
|
7483
|
+
star4Cls += ' selected';
|
|
7484
|
+
} else if (hovering >= 4) {
|
|
7485
|
+
star4Cls += ' hovering';
|
|
7486
|
+
}
|
|
7487
|
+
let star5Cls = 'star-wrapper';
|
|
7488
|
+
if (selected >= 5) {
|
|
7489
|
+
star5Cls += ' selected';
|
|
7490
|
+
} else if (hovering >= 5) {
|
|
7491
|
+
star5Cls += ' hovering';
|
|
7492
|
+
}
|
|
7493
|
+
return (0,preact_module.h)("div", {
|
|
7494
|
+
class: "form-ratings-wrapper",
|
|
7495
|
+
onMouseLeave: () => this.onMouseLeave()
|
|
7496
|
+
}, (0,preact_module.h)("div", {
|
|
7497
|
+
class: star1Cls,
|
|
7498
|
+
onClick: () => this.onToggleValue(1),
|
|
7499
|
+
onMouseEnter: () => this.onMouseEnter(1)
|
|
7500
|
+
}, (0,preact_module.h)("div", {
|
|
7501
|
+
class: "star"
|
|
7502
|
+
})), (0,preact_module.h)("div", {
|
|
7503
|
+
class: star2Cls,
|
|
7504
|
+
onClick: () => this.onToggleValue(2),
|
|
7505
|
+
onMouseEnter: () => this.onMouseEnter(2)
|
|
7506
|
+
}, (0,preact_module.h)("div", {
|
|
7507
|
+
class: "star"
|
|
7508
|
+
})), (0,preact_module.h)("div", {
|
|
7509
|
+
class: star3Cls,
|
|
7510
|
+
onClick: () => this.onToggleValue(3),
|
|
7511
|
+
onMouseEnter: () => this.onMouseEnter(3)
|
|
7512
|
+
}, (0,preact_module.h)("div", {
|
|
7513
|
+
class: "star"
|
|
7514
|
+
})), (0,preact_module.h)("div", {
|
|
7515
|
+
class: star4Cls,
|
|
7516
|
+
onClick: () => this.onToggleValue(4),
|
|
7517
|
+
onMouseEnter: () => this.onMouseEnter(4)
|
|
7518
|
+
}, (0,preact_module.h)("div", {
|
|
7519
|
+
class: "star"
|
|
7520
|
+
})), (0,preact_module.h)("div", {
|
|
7521
|
+
class: star5Cls,
|
|
7522
|
+
onClick: () => this.onToggleValue(5),
|
|
7523
|
+
onMouseEnter: () => this.onMouseEnter(5)
|
|
7524
|
+
}, (0,preact_module.h)("div", {
|
|
7525
|
+
class: "star"
|
|
7526
|
+
})));
|
|
7527
|
+
}
|
|
7528
|
+
}
|
|
7398
7529
|
;// ./src/form/Form.js
|
|
7399
7530
|
function Form_defineProperty(e, r, t) { return (r = Form_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7400
7531
|
function Form_toPropertyKey(t) { var i = Form_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -7403,6 +7534,7 @@ function Form_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var
|
|
|
7403
7534
|
|
|
7404
7535
|
|
|
7405
7536
|
|
|
7537
|
+
|
|
7406
7538
|
class Form2 extends common/* Com */.Mw {
|
|
7407
7539
|
constructor(props) {
|
|
7408
7540
|
super(props);
|
|
@@ -7412,7 +7544,7 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7412
7544
|
});
|
|
7413
7545
|
Form_defineProperty(this, "renderFormComponent", (com, idx) => {
|
|
7414
7546
|
if (com.type === 'input') return this.renderField(com, idx);
|
|
7415
|
-
if (com.type === '
|
|
7547
|
+
if (com.type === 'button') return this.renderSubmitButton(com, idx);
|
|
7416
7548
|
if (this.props.isSubmited) return;
|
|
7417
7549
|
return (0,preact_module.h)("div", {
|
|
7418
7550
|
class: "form-component form-component-block"
|
|
@@ -7424,8 +7556,8 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7424
7556
|
if (this.props.isSubmited) return;
|
|
7425
7557
|
return (0,preact_module.h)("div", {
|
|
7426
7558
|
class: "form-component form-component-submit-button"
|
|
7427
|
-
}, (0,preact_module.h)("div", {
|
|
7428
|
-
class: "form-control--valid-input--error"
|
|
7559
|
+
}, this.props.errorMessage && (0,preact_module.h)("div", {
|
|
7560
|
+
class: "form-control--valid-input--error mb-1"
|
|
7429
7561
|
}, this.props.errorMessage), (0,preact_module.h)("div", null, (0,preact_module.h)("button", {
|
|
7430
7562
|
class: "btn--start-convo",
|
|
7431
7563
|
disabled: this.props.submiting
|
|
@@ -7434,7 +7566,7 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7434
7566
|
Form_defineProperty(this, "renderField", (com, idx) => {
|
|
7435
7567
|
let errorMsg = this.state.errorFields[com.key];
|
|
7436
7568
|
if (this.props.isSubmited) {
|
|
7437
|
-
let val = util/* default */.A.find(this.props.
|
|
7569
|
+
let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
|
|
7438
7570
|
val = val.value || '""';
|
|
7439
7571
|
val = util/* default */.A.parseJSON(val);
|
|
7440
7572
|
if (Array.isArray(val)) val = val.join(', ');
|
|
@@ -7454,14 +7586,14 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7454
7586
|
class: "label"
|
|
7455
7587
|
}, com.label, " ", com.is_required && (0,preact_module.h)("span", {
|
|
7456
7588
|
class: "red"
|
|
7457
|
-
}, "*")), com.input_type === 'text' && this.renderFieldTextInput(com, idx), com.input_type === '
|
|
7589
|
+
}, "*")), com.input_type === 'text' && this.renderFieldTextInput(com, idx), com.input_type === 'textarea' && 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' || com.input_type === 'select') && this.renderFieldDropdownInput(com, idx), com.input_type === 'rating' && this.renderFieldRatingInput(com, idx), errorMsg && (0,preact_module.h)("div", {
|
|
7458
7590
|
class: "form-control--valid-input--error"
|
|
7459
7591
|
}, errorMsg));
|
|
7460
7592
|
});
|
|
7461
7593
|
Form_defineProperty(this, "renderFieldTextInput", (com, idx) => {
|
|
7462
7594
|
let cls = 'form-control';
|
|
7463
7595
|
if (this.state.errorFields[com.key]) cls = 'form-control input--error';
|
|
7464
|
-
let val = util/* default */.A.find(this.props.
|
|
7596
|
+
let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
|
|
7465
7597
|
val = val.value || '""';
|
|
7466
7598
|
val = util/* default */.A.parseJSON(val);
|
|
7467
7599
|
return (0,preact_module.h)("input", {
|
|
@@ -7477,12 +7609,14 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7477
7609
|
});
|
|
7478
7610
|
});
|
|
7479
7611
|
Form_defineProperty(this, "renderFieldDateInput", (com, idx) => {
|
|
7480
|
-
let val = util/* default */.A.find(this.props.
|
|
7612
|
+
let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
|
|
7481
7613
|
val = val.value || '""';
|
|
7482
7614
|
val = util/* default */.A.parseJSON(val);
|
|
7615
|
+
let cls = 'form-control';
|
|
7616
|
+
if (this.state.errorFields[com.key]) cls = 'form-control input--error';
|
|
7483
7617
|
return (0,preact_module.h)("input", {
|
|
7484
7618
|
ref: this[`${com.key}_input`],
|
|
7485
|
-
class:
|
|
7619
|
+
class: cls,
|
|
7486
7620
|
type: "date",
|
|
7487
7621
|
value: val,
|
|
7488
7622
|
onInput: e => {
|
|
@@ -7492,10 +7626,14 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7492
7626
|
});
|
|
7493
7627
|
});
|
|
7494
7628
|
Form_defineProperty(this, "renderFieldRadioInput", (com, idx) => {
|
|
7495
|
-
let val = util/* default */.A.find(this.props.
|
|
7629
|
+
let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
|
|
7496
7630
|
val = val.value || '""';
|
|
7497
7631
|
val = util/* default */.A.parseJSON(val);
|
|
7498
|
-
|
|
7632
|
+
let wrappercls = 'form-radios-wrapper';
|
|
7633
|
+
if (util/* default */.A.size(com.input_options) >= 3 && this.props.mode !== 'attachment') wrappercls += ' horizontal';
|
|
7634
|
+
return (0,preact_module.h)("div", {
|
|
7635
|
+
class: wrappercls
|
|
7636
|
+
}, util/* default */.A.map(com.input_options, (option, oidx) => {
|
|
7499
7637
|
let id = com.key + '_' + oidx;
|
|
7500
7638
|
return (0,preact_module.h)("div", {
|
|
7501
7639
|
class: "radio"
|
|
@@ -7511,13 +7649,17 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7511
7649
|
}, option.label), (0,preact_module.h)("div", {
|
|
7512
7650
|
class: "radio--check"
|
|
7513
7651
|
}));
|
|
7514
|
-
});
|
|
7652
|
+
}));
|
|
7515
7653
|
});
|
|
7516
7654
|
Form_defineProperty(this, "renderFieldCheckboxInput", (com, idx) => {
|
|
7517
|
-
let val = util/* default */.A.find(this.props.
|
|
7655
|
+
let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
|
|
7518
7656
|
val = val.value || '[]';
|
|
7519
7657
|
val = util/* default */.A.parseJSON(val);
|
|
7520
|
-
|
|
7658
|
+
let wrappercls = 'form-checkboxes-wrapper';
|
|
7659
|
+
if (util/* default */.A.size(com.input_options) >= 3 && this.props.mode !== 'attachment') wrappercls += ' horizontal';
|
|
7660
|
+
return (0,preact_module.h)("div", {
|
|
7661
|
+
class: wrappercls
|
|
7662
|
+
}, util/* default */.A.map(com.input_options, (option, oidx) => {
|
|
7521
7663
|
let id = com.key + '_' + oidx;
|
|
7522
7664
|
return (0,preact_module.h)("div", {
|
|
7523
7665
|
class: "checkbox"
|
|
@@ -7533,27 +7675,32 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7533
7675
|
}, option.label), (0,preact_module.h)("div", {
|
|
7534
7676
|
class: "checkbox--check"
|
|
7535
7677
|
}));
|
|
7536
|
-
});
|
|
7678
|
+
}));
|
|
7537
7679
|
});
|
|
7538
7680
|
Form_defineProperty(this, "renderFieldDropdownInput", (com, idx) => {
|
|
7539
|
-
let val = util/* default */.A.find(this.props.
|
|
7681
|
+
let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
|
|
7540
7682
|
val = val.value || '""';
|
|
7541
7683
|
val = util/* default */.A.parseJSON(val);
|
|
7684
|
+
let cls = 'form-control';
|
|
7685
|
+
if (this.state.errorFields[com.key]) cls += ' input--error';
|
|
7686
|
+
if (!val) cls += ' form-control--empty';
|
|
7542
7687
|
return (0,preact_module.h)("select", {
|
|
7543
|
-
class:
|
|
7688
|
+
class: cls,
|
|
7544
7689
|
ref: this[`${com.key}_input`],
|
|
7545
7690
|
onChange: e => {
|
|
7546
7691
|
this.onChangeValue(com.key, e.target.value);
|
|
7547
7692
|
this.clearError(com.key);
|
|
7548
7693
|
}
|
|
7549
|
-
},
|
|
7694
|
+
}, (0,preact_module.h)("option", {
|
|
7695
|
+
value: ""
|
|
7696
|
+
}, "-- ", this.props.t('no_select'), " --"), util/* default */.A.map(com.input_options, option => {
|
|
7550
7697
|
return (0,preact_module.h)("option", {
|
|
7551
7698
|
value: option.value
|
|
7552
7699
|
}, option.label);
|
|
7553
7700
|
}));
|
|
7554
7701
|
});
|
|
7555
7702
|
Form_defineProperty(this, "renderFieldTextareaInput", (com, idx) => {
|
|
7556
|
-
let val = util/* default */.A.find(this.props.
|
|
7703
|
+
let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
|
|
7557
7704
|
val = val.value || '""';
|
|
7558
7705
|
val = util/* default */.A.parseJSON(val);
|
|
7559
7706
|
return (0,preact_module.h)("textarea", {
|
|
@@ -7567,6 +7714,11 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7567
7714
|
placeholder: com.placeholder
|
|
7568
7715
|
});
|
|
7569
7716
|
});
|
|
7717
|
+
Form_defineProperty(this, "renderFieldRatingInput", (com, idx) => {
|
|
7718
|
+
return (0,preact_module.h)(rating_stars_Form2, {
|
|
7719
|
+
onChange: v => this.onChangeValue(com.key, v)
|
|
7720
|
+
});
|
|
7721
|
+
});
|
|
7570
7722
|
Form_defineProperty(this, "onSubmit", e => {
|
|
7571
7723
|
e.preventDefault();
|
|
7572
7724
|
if (!this.validateForm()) return;
|
|
@@ -7579,18 +7731,42 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7579
7731
|
let components = util/* default */.A.get(this.props.formSetting, 'components') || [];
|
|
7580
7732
|
util/* default */.A.each(components, com => {
|
|
7581
7733
|
if (com.type === 'input') {
|
|
7734
|
+
let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
|
|
7735
|
+
val = val.value || '""';
|
|
7736
|
+
val = util/* default */.A.parseJSON(val);
|
|
7582
7737
|
if (com.is_required) {
|
|
7583
|
-
let
|
|
7584
|
-
val
|
|
7585
|
-
val
|
|
7586
|
-
if (
|
|
7738
|
+
let isEmpty = false;
|
|
7739
|
+
if (typeof val === 'string' && !val.trim()) isEmpty = true;
|
|
7740
|
+
if (Array.isArray(val) && val.length === 0) isEmpty = true;
|
|
7741
|
+
if (isEmpty) {
|
|
7587
7742
|
result = false;
|
|
7588
7743
|
errors[com.key] = this.props.t('cannot_be_empty');
|
|
7589
|
-
|
|
7744
|
+
ref = `${com.key}_input`;
|
|
7590
7745
|
}
|
|
7591
|
-
|
|
7746
|
+
}
|
|
7747
|
+
if (com.validation && !Array.isArray(val)) {
|
|
7748
|
+
let isInvalid = false;
|
|
7749
|
+
let validationText = '';
|
|
7750
|
+
if (com.validation === 'email' && !util/* default */.A.isEmail(val)) {
|
|
7751
|
+
validationText = 'Email';
|
|
7752
|
+
isInvalid = true;
|
|
7753
|
+
}
|
|
7754
|
+
if (com.validation === 'phone' && !util/* default */.A.isPhone(val)) {
|
|
7755
|
+
validationText = this.props.t('phn');
|
|
7756
|
+
isInvalid = true;
|
|
7757
|
+
}
|
|
7758
|
+
if (com.validation === 'number' && !util/* default */.A.isNumber(val)) {
|
|
7759
|
+
validationText = this.props.t('number');
|
|
7760
|
+
isInvalid = true;
|
|
7761
|
+
}
|
|
7762
|
+
if (com.validation === 'url' && !util/* default */.A.isURL(val)) {
|
|
7763
|
+
isInvalid = true;
|
|
7764
|
+
validationText = 'URL';
|
|
7765
|
+
}
|
|
7766
|
+
if (isInvalid) {
|
|
7592
7767
|
result = false;
|
|
7593
|
-
errors[com.key] = this.props.t('
|
|
7768
|
+
errors[com.key] = this.props.t('format_is_invalid') + ' ' + validationText;
|
|
7769
|
+
ref = `${com.key}_input`;
|
|
7594
7770
|
}
|
|
7595
7771
|
}
|
|
7596
7772
|
}
|
|
@@ -7604,7 +7780,7 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7604
7780
|
return result;
|
|
7605
7781
|
});
|
|
7606
7782
|
Form_defineProperty(this, "onChangeValue", (key, v) => {
|
|
7607
|
-
let formValues = this.props.
|
|
7783
|
+
let formValues = util/* default */.A.get(this.props.submission, 'values') || [];
|
|
7608
7784
|
let f = util/* default */.A.find(formValues, field => field.key === key);
|
|
7609
7785
|
if (!f) {
|
|
7610
7786
|
formValues.push({
|
|
@@ -7623,6 +7799,43 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7623
7799
|
errorFields: errors
|
|
7624
7800
|
});
|
|
7625
7801
|
});
|
|
7802
|
+
Form_defineProperty(this, "renderFormHeader", () => {
|
|
7803
|
+
let title = util/* default */.A.get(this.props.formSetting, 'title') || '';
|
|
7804
|
+
let desc = util/* default */.A.get(this.props.formSetting, 'description') || '';
|
|
7805
|
+
if (this.props.mode === 'attachment') {
|
|
7806
|
+
if (title.trim() || desc.trim()) {
|
|
7807
|
+
return (0,preact_module.h)("div", {
|
|
7808
|
+
class: "form-component form-component-block"
|
|
7809
|
+
}, title && (0,preact_module.h)("div", null, title), desc && (0,preact_module.h)("div", {
|
|
7810
|
+
class: "text-sm text-muted"
|
|
7811
|
+
}, desc));
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7814
|
+
let brandLogo = util/* default */.A.get(this.props.formSetting, 'logo.url');
|
|
7815
|
+
let brandUrl = util/* default */.A.get(this.props.formSetting, 'brand_url');
|
|
7816
|
+
let $logo = null;
|
|
7817
|
+
if (brandLogo) {
|
|
7818
|
+
$logo = (0,preact_module.h)("div", {
|
|
7819
|
+
class: "form-page-logo-wrapper"
|
|
7820
|
+
}, (0,preact_module.h)("a", {
|
|
7821
|
+
href: brandUrl || 'javascript:;'
|
|
7822
|
+
}, (0,preact_module.h)("img", {
|
|
7823
|
+
src: brandLogo,
|
|
7824
|
+
class: "form-page-logo"
|
|
7825
|
+
})));
|
|
7826
|
+
}
|
|
7827
|
+
let $header = null;
|
|
7828
|
+
if (title.trim() || desc.trim()) {
|
|
7829
|
+
$header = (0,preact_module.h)("div", {
|
|
7830
|
+
class: "form-page-header"
|
|
7831
|
+
}, (0,preact_module.h)("div", {
|
|
7832
|
+
class: "form-page-title"
|
|
7833
|
+
}, title), desc && (0,preact_module.h)("div", {
|
|
7834
|
+
class: "form-page-desc"
|
|
7835
|
+
}, desc));
|
|
7836
|
+
}
|
|
7837
|
+
return (0,preact_module.h)(preact_module/* Fragment */.FK, null, $logo, $header);
|
|
7838
|
+
});
|
|
7626
7839
|
let _components = util/* default */.A.get(this.props.formSetting, 'components') || [];
|
|
7627
7840
|
util/* default */.A.each(_components, com => {
|
|
7628
7841
|
if (com.type === 'input' && com.input_type !== 'checkbox' && com.input_type !== 'radio') {
|
|
@@ -7635,7 +7848,7 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7635
7848
|
this.onChangeValue(key, v);
|
|
7636
7849
|
}
|
|
7637
7850
|
toggleCheckboxField(key, v) {
|
|
7638
|
-
let currentValues = util/* default */.A.find(this.props.
|
|
7851
|
+
let currentValues = util/* default */.A.find(this.props.submission.values, f => f.key === key) || {};
|
|
7639
7852
|
currentValues = currentValues.value || '[]';
|
|
7640
7853
|
currentValues = util/* default */.A.parseJSON(currentValues);
|
|
7641
7854
|
if (currentValues.includes(v)) {
|
|
@@ -7648,6 +7861,8 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7648
7861
|
}
|
|
7649
7862
|
render() {
|
|
7650
7863
|
let components = util/* default */.A.get(this.props.formSetting, 'components') || [];
|
|
7864
|
+
let title = util/* default */.A.get(this.props.formSetting, 'title') || '';
|
|
7865
|
+
let desc = util/* default */.A.get(this.props.formSetting, 'description') || '';
|
|
7651
7866
|
let cls = 'form-wrapper form';
|
|
7652
7867
|
if (this.props.mode === 'attachment') cls += ' form-wrapper-attachment';
|
|
7653
7868
|
return (0,preact_module.h)("div", {
|
|
@@ -7656,7 +7871,7 @@ class Form2 extends common/* Com */.Mw {
|
|
|
7656
7871
|
class: "form-component"
|
|
7657
7872
|
}, this.props.t('you_have_submitted_info_successfully')), (0,preact_module.h)("form", {
|
|
7658
7873
|
onSubmit: this.onSubmit
|
|
7659
|
-
}, util/* default */.A.map(components, this.renderFormComponent)));
|
|
7874
|
+
}, this.renderFormHeader(), util/* default */.A.map(components, this.renderFormComponent)));
|
|
7660
7875
|
}
|
|
7661
7876
|
}
|
|
7662
7877
|
;// ./src/chatbox/FormAttachment2.js
|
|
@@ -7670,20 +7885,29 @@ function FormAttachment2_toPrimitive(t, r) { if ("object" != typeof t || !t) ret
|
|
|
7670
7885
|
class FormAttachment extends common/* Com */.Mw {
|
|
7671
7886
|
constructor(props) {
|
|
7672
7887
|
super(props);
|
|
7673
|
-
FormAttachment2_defineProperty(this, "
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7888
|
+
FormAttachment2_defineProperty(this, "fetchFormSetting", () => {
|
|
7889
|
+
let attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments') || [];
|
|
7890
|
+
let formAttachment = util/* default */.A.find(attachments, att => att.type === 'form');
|
|
7891
|
+
if (!formAttachment) return;
|
|
7892
|
+
let url = formAttachment.url;
|
|
7893
|
+
this.token = getUrlParameter(url, 'token');
|
|
7894
|
+
let formSetting = formAttachment.form || {};
|
|
7895
|
+
let submission = formAttachment.form_submission || {};
|
|
7896
|
+
let isSubmited = util/* default */.A.size(submission) > 0;
|
|
7897
|
+
this.setState({
|
|
7898
|
+
formSetting,
|
|
7899
|
+
submission,
|
|
7900
|
+
isSubmited
|
|
7901
|
+
});
|
|
7679
7902
|
});
|
|
7680
7903
|
FormAttachment2_defineProperty(this, "onChangeFormValues", values => {
|
|
7681
7904
|
this.setState({
|
|
7682
|
-
|
|
7905
|
+
submission: {
|
|
7906
|
+
values
|
|
7907
|
+
}
|
|
7683
7908
|
});
|
|
7684
7909
|
});
|
|
7685
7910
|
FormAttachment2_defineProperty(this, "onSubmit", async () => {
|
|
7686
|
-
console.log('submittttttt', this.state.formValues);
|
|
7687
7911
|
this.setState({
|
|
7688
7912
|
errorMessage: ''
|
|
7689
7913
|
});
|
|
@@ -7691,72 +7915,41 @@ class FormAttachment extends common/* Com */.Mw {
|
|
|
7691
7915
|
this.setState({
|
|
7692
7916
|
submiting: true
|
|
7693
7917
|
});
|
|
7694
|
-
|
|
7918
|
+
let res = await this.props.store.submitForm2(this.props.store.matchAccount().id, this.token, this.state.submission);
|
|
7919
|
+
if (res.error) {
|
|
7920
|
+
this.setState({
|
|
7921
|
+
submiting: false,
|
|
7922
|
+
errorMessage: util/* default */.A.get(res, 'error.code')
|
|
7923
|
+
});
|
|
7924
|
+
return;
|
|
7925
|
+
}
|
|
7695
7926
|
this.setState({
|
|
7696
7927
|
submiting: false,
|
|
7697
7928
|
isSubmited: true
|
|
7698
7929
|
});
|
|
7699
7930
|
});
|
|
7931
|
+
this.state = {
|
|
7932
|
+
submission: {},
|
|
7933
|
+
formSetting: {},
|
|
7934
|
+
submiting: false,
|
|
7935
|
+
errorMessage: '',
|
|
7936
|
+
isSubmited: false
|
|
7937
|
+
};
|
|
7938
|
+
}
|
|
7939
|
+
componentDidMount() {
|
|
7940
|
+
this.fetchFormSetting();
|
|
7700
7941
|
}
|
|
7701
7942
|
render() {
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
placeholder: 'Nguyen Van A',
|
|
7713
|
-
label: 'Họ và tên',
|
|
7714
|
-
input_type: 'text',
|
|
7715
|
-
is_required: true
|
|
7716
|
-
}, {
|
|
7717
|
-
type: 'input',
|
|
7718
|
-
key: 'phone',
|
|
7719
|
-
validation: 'phone',
|
|
7720
|
-
label: 'SĐT',
|
|
7721
|
-
input_type: 'text',
|
|
7722
|
-
is_required: true
|
|
7723
|
-
}, {
|
|
7724
|
-
type: 'input',
|
|
7725
|
-
label: 'Chọn ca',
|
|
7726
|
-
is_required: true,
|
|
7727
|
-
input_type: 'radio',
|
|
7728
|
-
key: 'shift',
|
|
7729
|
-
input_options: [{
|
|
7730
|
-
value: 'Buổi sáng',
|
|
7731
|
-
label: 'Buổi sáng'
|
|
7732
|
-
}, {
|
|
7733
|
-
value: 'Buổi chiều',
|
|
7734
|
-
label: 'Buổi chiều'
|
|
7735
|
-
}]
|
|
7736
|
-
}, {
|
|
7737
|
-
type: 'input',
|
|
7738
|
-
label: 'Chọn ca 2',
|
|
7739
|
-
is_required: true,
|
|
7740
|
-
input_type: 'checkbox',
|
|
7741
|
-
key: 'shift_2',
|
|
7742
|
-
input_options: [{
|
|
7743
|
-
value: 'Buổi sáng',
|
|
7744
|
-
label: 'Buổi sáng'
|
|
7745
|
-
}, {
|
|
7746
|
-
value: 'Buổi chiều',
|
|
7747
|
-
label: 'Buổi chiều'
|
|
7748
|
-
}]
|
|
7749
|
-
}, {
|
|
7750
|
-
type: 'input',
|
|
7751
|
-
key: 'schedule',
|
|
7752
|
-
label: 'Chọn ngày',
|
|
7753
|
-
is_required: true,
|
|
7754
|
-
input_type: 'date'
|
|
7755
|
-
}, {
|
|
7756
|
-
type: 'submit_button',
|
|
7757
|
-
label: 'Submit'
|
|
7758
|
-
}]
|
|
7759
|
-
};
|
|
7943
|
+
let attachments = util/* default */.A.get(this.props.ev, 'data.message.attachments') || [];
|
|
7944
|
+
let formAttachment = util/* default */.A.find(attachments, att => att.type === 'form');
|
|
7945
|
+
if (!formAttachment) return;
|
|
7946
|
+
const {
|
|
7947
|
+
submission,
|
|
7948
|
+
formSetting,
|
|
7949
|
+
errorMessage,
|
|
7950
|
+
isSubmited,
|
|
7951
|
+
submiting
|
|
7952
|
+
} = this.state;
|
|
7760
7953
|
return (0,preact_module.h)("div", {
|
|
7761
7954
|
onClick: e => e.stopPropagation()
|
|
7762
7955
|
}, (0,preact_module.h)(Form2, {
|
|
@@ -7764,15 +7957,21 @@ class FormAttachment extends common/* Com */.Mw {
|
|
|
7764
7957
|
formSetting: formSetting,
|
|
7765
7958
|
mode: "attachment",
|
|
7766
7959
|
t: this.props.t,
|
|
7767
|
-
|
|
7768
|
-
errorMessage:
|
|
7769
|
-
isSubmited:
|
|
7770
|
-
submiting:
|
|
7960
|
+
submission: submission,
|
|
7961
|
+
errorMessage: errorMessage,
|
|
7962
|
+
isSubmited: isSubmited,
|
|
7963
|
+
submiting: submiting,
|
|
7771
7964
|
onChangeFormValues: this.onChangeFormValues,
|
|
7772
7965
|
onSubmit: this.onSubmit
|
|
7773
7966
|
}));
|
|
7774
7967
|
}
|
|
7775
7968
|
}
|
|
7969
|
+
function getUrlParameter(url, name) {
|
|
7970
|
+
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
7971
|
+
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
|
7972
|
+
var results = regex.exec(url);
|
|
7973
|
+
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
7974
|
+
}
|
|
7776
7975
|
;// ./src/chatbox/FormSubmitAttachments.js
|
|
7777
7976
|
|
|
7778
7977
|
|
|
@@ -9985,9 +10184,9 @@ class Widget extends common/* Com */.Mw {
|
|
|
9985
10184
|
});
|
|
9986
10185
|
} else if (util/* default */.A.get(field, 'def.select') === 'checkbox') {
|
|
9987
10186
|
$field = this.renderCheckboxField(field);
|
|
9988
|
-
} else if (util/* default */.A.get(field, 'def.select') === 'radio') {
|
|
10187
|
+
} else if (util/* default */.A.get(field, 'def.select') === 'radio' && util/* default */.A.size(util/* default */.A.get(field, 'def.items', [])) < 5) {
|
|
9989
10188
|
$field = this.renderRadioField(field);
|
|
9990
|
-
} else if (util/* default */.A.get(field, 'def.select') === 'dropdown') {
|
|
10189
|
+
} else if (util/* default */.A.get(field, 'def.select') === 'dropdown' || util/* default */.A.size(util/* default */.A.get(field, 'def.items', [])) >= 5) {
|
|
9991
10190
|
$field = this.renderDropdownField(field);
|
|
9992
10191
|
} else {
|
|
9993
10192
|
$field = (0,preact_module.h)("input", {
|