@subiz/widget-v4 4.1.177 → 4.1.178

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,6 +17,9 @@
17
17
  @yellow: #ffc107;
18
18
  @green: #28a745;
19
19
 
20
+ @link: #0d6efd;
21
+ @link-hover: #024dbc;
22
+
20
23
  ::-webkit-scrollbar {
21
24
  width: 7px;
22
25
  height: 7px;
@@ -412,7 +412,7 @@ a.message_error {
412
412
  padding: 10px 18px;
413
413
  display: block;
414
414
  text-align: center;
415
- .color(@black);
415
+ .color(@link);
416
416
  border: 1px solid @black;
417
417
  border-radius: 12px;
418
418
  text-overflow: ellipsis;
@@ -420,7 +420,7 @@ a.message_error {
420
420
  font-weight: 500;
421
421
  text-decoration: underline;
422
422
  &:hover {
423
- .color(@primary-color);
423
+ .color(@link-hover);
424
424
  }
425
425
  white-space: nowrap;
426
426
  }
@@ -507,8 +507,7 @@ a.message_error {
507
507
  }
508
508
 
509
509
  .url-button-attachment {
510
- font-weight: 500;
511
-
510
+ text-decoration: none;
512
511
  padding: 10px;
513
512
  display: block;
514
513
  padding-top: 9px;
@@ -522,7 +521,7 @@ a.message_error {
522
521
  padding: 0px 13px;
523
522
  margin-top: 13px;
524
523
  .color(@black);
525
- font-weight: 500;
524
+ font-weight: 600;
526
525
  font-size: 16px;
527
526
  line-height: 20px;
528
527
  white-space: normal;
@@ -541,6 +540,17 @@ a.message_error {
541
540
  }
542
541
  }
543
542
 
543
+ .generic-attachment--element.clickable {
544
+ cursor: pointer;
545
+ .generic-attachment--element-title {
546
+ .color(@link);
547
+ }
548
+
549
+ &:hover .generic-attachment--element-title {
550
+ .color(@link-hover);
551
+ }
552
+ }
553
+
544
554
  .widget_body__events__error_msg {
545
555
  margin-top: 50px;
546
556
  .color(@text-muted);
@@ -51,8 +51,12 @@ class GenericTemplateAttachments extends _common.Com {
51
51
  if (!ele.image_url) {
52
52
  imgsrc = require('../../assets/img/default.jpg');
53
53
  }
54
+ let defaultActionUrl = ['url_button', 'web_url'].includes(_index.default.get(ele, 'default_action.type')) && _index.default.get(ele, 'default_action.url');
55
+ let cls = 'generic-attachment--element swiper-slide';
56
+ if (defaultActionUrl) cls += ' clickable';
54
57
  return (0, _preact.h)("div", {
55
- class: "generic-attachment--element swiper-slide"
58
+ class: cls,
59
+ onClick: () => defaultActionUrl && window.open(defaultActionUrl, '_blank')
56
60
  }, (0, _preact.h)("div", null, (0, _preact.h)("img", {
57
61
  alt: "generic attachment element",
58
62
  class: "generic-attachment--element-img",
@@ -359,6 +359,18 @@ class Widget extends _common.Com {
359
359
  await this.props.store.submitForm('chatbox_' + formName, formData, user);
360
360
  await _index.default.sleep(500);
361
361
  if (_creating != this._creating) return;
362
+ if (this.props.cid && this.props.cid.startsWith('cslight')) {
363
+ this.sendMessage({
364
+ text: firstmsg,
365
+ format: 'plaintext',
366
+ fields: [{
367
+ key: 'to_agent_group',
368
+ value: _index.default.stringify(groupid)
369
+ }],
370
+ attachments: this.state.quickReplyMessage.attachments
371
+ });
372
+ return;
373
+ }
362
374
  if (this.props.cid) {
363
375
  this.setState({
364
376
  clickedJoin: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.177",
3
+ "version": "4.1.178",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -29,7 +29,7 @@
29
29
  "babel-loader": "^10.0.0",
30
30
  "babel-plugin-syntax-jsx": "^6.18.0",
31
31
  "html-webpack-plugin": "^5.6.4",
32
- "puppeteer": "^24.20.0",
32
+ "puppeteer": "^24.22.2",
33
33
  "webpack": "^5.101.3",
34
34
  "webpack-bundle-analyzer": "^4.10.2",
35
35
  "webpack-cli": "^6.0.1",
@@ -40,14 +40,23 @@ export default class GenericTemplateAttachments extends Com {
40
40
  let title = this.props.t.i18n(ele.i18n_title) || ele.title
41
41
  let subtitle = this.props.t.i18n(ele.i18n_subtitle) || ele.subtitle
42
42
  let $title = title ? <div class='generic-attachment--element-title'>{title}</div> : null
43
- let $subtitle = subtitle ? <div class='generic-attachment--element-subtitle' title={subtitle}>{subtitle}</div> : null
43
+ let $subtitle = subtitle ? (
44
+ <div class='generic-attachment--element-subtitle' title={subtitle}>
45
+ {subtitle}
46
+ </div>
47
+ ) : null
44
48
 
45
49
  let imgsrc = this.props.store.replaceFileUrl(ele.image_url)
46
50
  if (!ele.image_url) {
47
51
  imgsrc = require('../../assets/img/default.jpg')
48
52
  }
53
+
54
+ let defaultActionUrl =
55
+ ['url_button', 'web_url'].includes(sb.get(ele, 'default_action.type')) && sb.get(ele, 'default_action.url')
56
+ let cls = 'generic-attachment--element swiper-slide'
57
+ if (defaultActionUrl) cls += ' clickable'
49
58
  return (
50
- <div class='generic-attachment--element swiper-slide'>
59
+ <div class={cls} onClick={() => defaultActionUrl && window.open(defaultActionUrl, '_blank')}>
51
60
  <div>
52
61
  <img alt='generic attachment element' class='generic-attachment--element-img' src={imgsrc} />
53
62
  </div>
@@ -250,6 +250,15 @@ export default class Widget extends Com {
250
250
  await sb.sleep(500)
251
251
 
252
252
  if (_creating != this._creating) return // outdated
253
+ if (this.props.cid && this.props.cid.startsWith('cslight')) {
254
+ this.sendMessage({
255
+ text: firstmsg,
256
+ format: 'plaintext',
257
+ fields: [{key: 'to_agent_group', value: sb.stringify(groupid)}],
258
+ attachments: this.state.quickReplyMessage.attachments,
259
+ })
260
+ return
261
+ }
253
262
  if (this.props.cid) {
254
263
  // this.props.store.setUser(user)
255
264
  this.setState({clickedJoin: false})