@subiz/widget-v4 4.1.143 → 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.
Files changed (50) hide show
  1. package/README.md +5 -1
  2. package/compiled_src/bot.js +1 -2
  3. package/compiled_src/call/call.js +1 -2
  4. package/compiled_src/chatbox/Event.js +1 -2
  5. package/compiled_src/chatbox/Widget.js +1 -2
  6. package/compiled_src/chatbox/main.js +1 -2
  7. package/compiled_src/contact/contact.js +1 -2
  8. package/compiled_src/form/FormPage.js +1 -2
  9. package/compiled_src/form/index.js +1 -2
  10. package/compiled_src/form.js +1 -2
  11. package/compiled_src/notif/notif.js +1 -2
  12. package/compiled_src/order/icon.js +1 -2
  13. package/compiled_src/order/index.js +1 -2
  14. package/compiled_src/order/order.js +1 -2
  15. package/compiled_src/plugin.js +1 -2
  16. package/compiled_src/popup/popup.js +1 -2
  17. package/compiled_src/store/store.js +1 -3
  18. package/compiled_src/util/index.js +1 -2
  19. package/dist/196d3465f26.278.js +1 -0
  20. package/dist/196d3465f26.339.js +1 -0
  21. package/dist/196d3465f26.app.js +1 -0
  22. package/dist/{19680dc0775.form.html → 196d3465f26.form.html} +1 -1
  23. package/dist/196d3465f26.form.js +1 -0
  24. package/dist/{19680dc0775.index.html → 196d3465f26.index.html} +15 -1
  25. package/dist/{19680dc0775.library.html → 196d3465f26.library.html} +15 -1
  26. package/dist/196d3465f26.library.js +1 -0
  27. package/dist/{19680dc0775.preview.html → 196d3465f26.preview.html} +1 -1
  28. package/dist/196d3465f26.preview.js +1 -0
  29. package/dist/196d3465f26.webview.js +1 -0
  30. package/dist/278.js +81 -70
  31. package/dist/HASH +1 -1
  32. package/dist/assets/img/stars_v2.79cf728.png +0 -0
  33. package/dist/screenshoot.js +242 -32
  34. package/index.html +14 -0
  35. package/package.json +10 -10
  36. package/src/store/store.js +1 -1
  37. package/dist/19680dc0775.278.js +0 -1
  38. package/dist/19680dc0775.app.js +0 -1
  39. package/dist/19680dc0775.form.js +0 -1
  40. package/dist/19680dc0775.library.js +0 -1
  41. package/dist/19680dc0775.preview.js +0 -1
  42. package/dist/19680dc0775.webview.js +0 -1
  43. /package/dist/{19680dc0775.127.js → 196d3465f26.127.js} +0 -0
  44. /package/dist/{19680dc0775.132.js → 196d3465f26.132.js} +0 -0
  45. /package/dist/{19680dc0775.185.js → 196d3465f26.185.js} +0 -0
  46. /package/dist/{19680dc0775.27.js → 196d3465f26.27.js} +0 -0
  47. /package/dist/{19680dc0775.459.js → 196d3465f26.459.js} +0 -0
  48. /package/dist/{19680dc0775.490.js → 196d3465f26.490.js} +0 -0
  49. /package/dist/{19680dc0775.74.js → 196d3465f26.74.js} +0 -0
  50. /package/dist/{19680dc0775.997.js → 196d3465f26.997.js} +0 -0
package/dist/HASH CHANGED
@@ -1 +1 @@
1
- 19680dc0775
1
+ 196d3465f26
@@ -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 = false // tell if we've having trouble doing /subscribe
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 = apiUrl + 'subs' + query + '&account-id=' + encodeURIComponent(accid || credential.account_id)
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
- this.subscribe = function (events) {
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
- this.reconnect = function () {
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
- let myconn = new Conn(
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(this.reconnect, 2000) // reconnect and resubscribe after 2 sec
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 this.subscribe(copyTopics)
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') {
@@ -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);
@@ -7454,7 +7586,7 @@ 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 === '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_module.h)("div", {
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
  });
@@ -7497,7 +7629,11 @@ class Form2 extends common/* Com */.Mw {
7497
7629
  let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
7498
7630
  val = val.value || '""';
7499
7631
  val = util/* default */.A.parseJSON(val);
7500
- return util/* default */.A.map(com.input_options, (option, oidx) => {
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) => {
7501
7637
  let id = com.key + '_' + oidx;
7502
7638
  return (0,preact_module.h)("div", {
7503
7639
  class: "radio"
@@ -7513,13 +7649,17 @@ class Form2 extends common/* Com */.Mw {
7513
7649
  }, option.label), (0,preact_module.h)("div", {
7514
7650
  class: "radio--check"
7515
7651
  }));
7516
- });
7652
+ }));
7517
7653
  });
7518
7654
  Form_defineProperty(this, "renderFieldCheckboxInput", (com, idx) => {
7519
7655
  let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
7520
7656
  val = val.value || '[]';
7521
7657
  val = util/* default */.A.parseJSON(val);
7522
- return util/* default */.A.map(com.input_options, (option, oidx) => {
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) => {
7523
7663
  let id = com.key + '_' + oidx;
7524
7664
  return (0,preact_module.h)("div", {
7525
7665
  class: "checkbox"
@@ -7535,20 +7675,25 @@ class Form2 extends common/* Com */.Mw {
7535
7675
  }, option.label), (0,preact_module.h)("div", {
7536
7676
  class: "checkbox--check"
7537
7677
  }));
7538
- });
7678
+ }));
7539
7679
  });
7540
7680
  Form_defineProperty(this, "renderFieldDropdownInput", (com, idx) => {
7541
7681
  let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
7542
7682
  val = val.value || '""';
7543
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';
7544
7687
  return (0,preact_module.h)("select", {
7545
- class: "form-control",
7688
+ class: cls,
7546
7689
  ref: this[`${com.key}_input`],
7547
7690
  onChange: e => {
7548
7691
  this.onChangeValue(com.key, e.target.value);
7549
7692
  this.clearError(com.key);
7550
7693
  }
7551
- }, util/* default */.A.map(com.input_options, option => {
7694
+ }, (0,preact_module.h)("option", {
7695
+ value: ""
7696
+ }, "-- ", this.props.t('no_select'), " --"), util/* default */.A.map(com.input_options, option => {
7552
7697
  return (0,preact_module.h)("option", {
7553
7698
  value: option.value
7554
7699
  }, option.label);
@@ -7569,6 +7714,11 @@ class Form2 extends common/* Com */.Mw {
7569
7714
  placeholder: com.placeholder
7570
7715
  });
7571
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
+ });
7572
7722
  Form_defineProperty(this, "onSubmit", e => {
7573
7723
  e.preventDefault();
7574
7724
  if (!this.validateForm()) return;
@@ -7581,18 +7731,42 @@ class Form2 extends common/* Com */.Mw {
7581
7731
  let components = util/* default */.A.get(this.props.formSetting, 'components') || [];
7582
7732
  util/* default */.A.each(components, com => {
7583
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);
7584
7737
  if (com.is_required) {
7585
- let val = util/* default */.A.find(this.props.submission.values, f => f.key === com.key) || {};
7586
- val = val.value || '""';
7587
- val = util/* default */.A.parseJSON(val);
7588
- if (typeof val === 'string' && !val.trim()) {
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) {
7589
7742
  result = false;
7590
7743
  errors[com.key] = this.props.t('cannot_be_empty');
7591
- if (!ref && com.input_type !== 'checkbox' && com.input_type !== 'radio') ref = `${com.key}_input`;
7744
+ ref = `${com.key}_input`;
7745
+ }
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';
7592
7765
  }
7593
- if (Array.isArray(val) && val.length === 0) {
7766
+ if (isInvalid) {
7594
7767
  result = false;
7595
- errors[com.key] = this.props.t('cannot_be_empty');
7768
+ errors[com.key] = this.props.t('format_is_invalid') + ' ' + validationText;
7769
+ ref = `${com.key}_input`;
7596
7770
  }
7597
7771
  }
7598
7772
  }
@@ -7625,6 +7799,43 @@ class Form2 extends common/* Com */.Mw {
7625
7799
  errorFields: errors
7626
7800
  });
7627
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
+ });
7628
7839
  let _components = util/* default */.A.get(this.props.formSetting, 'components') || [];
7629
7840
  util/* default */.A.each(_components, com => {
7630
7841
  if (com.type === 'input' && com.input_type !== 'checkbox' && com.input_type !== 'radio') {
@@ -7651,6 +7862,7 @@ class Form2 extends common/* Com */.Mw {
7651
7862
  render() {
7652
7863
  let components = util/* default */.A.get(this.props.formSetting, 'components') || [];
7653
7864
  let title = util/* default */.A.get(this.props.formSetting, 'title') || '';
7865
+ let desc = util/* default */.A.get(this.props.formSetting, 'description') || '';
7654
7866
  let cls = 'form-wrapper form';
7655
7867
  if (this.props.mode === 'attachment') cls += ' form-wrapper-attachment';
7656
7868
  return (0,preact_module.h)("div", {
@@ -7659,9 +7871,7 @@ class Form2 extends common/* Com */.Mw {
7659
7871
  class: "form-component"
7660
7872
  }, this.props.t('you_have_submitted_info_successfully')), (0,preact_module.h)("form", {
7661
7873
  onSubmit: this.onSubmit
7662
- }, (0,preact_module.h)("div", {
7663
- class: "form-component form-component-block"
7664
- }, title), util/* default */.A.map(components, this.renderFormComponent)));
7874
+ }, this.renderFormHeader(), util/* default */.A.map(components, this.renderFormComponent)));
7665
7875
  }
7666
7876
  }
7667
7877
  ;// ./src/chatbox/FormAttachment2.js
@@ -9974,9 +10184,9 @@ class Widget extends common/* Com */.Mw {
9974
10184
  });
9975
10185
  } else if (util/* default */.A.get(field, 'def.select') === 'checkbox') {
9976
10186
  $field = this.renderCheckboxField(field);
9977
- } 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) {
9978
10188
  $field = this.renderRadioField(field);
9979
- } 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) {
9980
10190
  $field = this.renderDropdownField(field);
9981
10191
  } else {
9982
10192
  $field = (0,preact_module.h)("input", {
package/index.html CHANGED
@@ -70,6 +70,20 @@
70
70
  })
71
71
  })
72
72
  })
73
+ setTimeout(function () {
74
+ if (accid === 'acshaomzfkhqtwlxmtfo' && getUrlParameter('chat-only')) {
75
+ subiz('overrideChatbox', {
76
+ chatbox: {
77
+ offline_form: {
78
+ enabled: false,
79
+ },
80
+ prechat_form: {
81
+ enabled: false,
82
+ },
83
+ },
84
+ })
85
+ }
86
+ })
73
87
  </script>
74
88
  </body>
75
89
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.143",
3
+ "version": "4.1.144",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -11,27 +11,27 @@
11
11
  "dependencies": {
12
12
  "@subiz/ajax": "^3.0.19",
13
13
  "@subiz/flow": "^1.1.0",
14
- "@subiz/wsclient": "^4.0.31",
14
+ "@subiz/wsclient": "^4.0.34",
15
15
  "cookie_js": "1.4.2",
16
- "core-js": "^3.41.0",
16
+ "core-js": "^3.42.0",
17
17
  "css-loader": "5.2.7",
18
18
  "file-loader": "^6.2.0",
19
19
  "less": "^4.3.0",
20
- "less-loader": "^12.2.0",
20
+ "less-loader": "^12.3.0",
21
21
  "preact": "10.19.3"
22
22
  },
23
23
  "devDependencies": {
24
- "@babel/cli": "^7.27.0",
25
- "@babel/core": "^7.26.10",
24
+ "@babel/cli": "^7.27.2",
25
+ "@babel/core": "^7.27.1",
26
26
  "@babel/plugin-proposal-class-properties": "^7.18.6",
27
- "@babel/plugin-transform-react-jsx": "^7.25.9",
28
- "@babel/preset-env": "^7.26.9",
27
+ "@babel/plugin-transform-react-jsx": "^7.27.1",
28
+ "@babel/preset-env": "^7.27.2",
29
29
  "babel-loader": "^10.0.0",
30
30
  "babel-plugin-syntax-jsx": "^6.18.0",
31
31
  "html-webpack-plugin": "^5.6.3",
32
32
  "prettier": "^3.5.3",
33
- "puppeteer": "^24.7.2",
34
- "webpack": "^5.99.7",
33
+ "puppeteer": "^24.8.2",
34
+ "webpack": "^5.99.8",
35
35
  "webpack-bundle-analyzer": "^4.10.2",
36
36
  "webpack-cli": "^6.0.1",
37
37
  "webpack-dev-server": "^5.2.1"
@@ -134,7 +134,7 @@ export default class Store {
134
134
  if (!this.realtime.getStatus || !this.realtime.reconnect) continue
135
135
 
136
136
  if (this.connectionStatus === 'dead') {
137
- await this.realtime.reconnect()
137
+ //await this.realtime.reconnect()
138
138
  }
139
139
 
140
140
  let currentStatus = this.connectionStatus