@subiz/widget-v4 4.1.4 → 4.1.6

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/dist/605.js CHANGED
@@ -215,7 +215,7 @@ class Notif extends _common_js__WEBPACK_IMPORTED_MODULE_2__/* .Com */ .up {
215
215
  if (_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(op, 'attributes.bold')) out = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("b", null, out);
216
216
  if (_util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].get */ .Z.get(op, 'attributes.italic')) out = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("b", null, out);
217
217
  return out;
218
- });
218
+ }).filter(a => a);
219
219
  }
220
220
  render() {
221
221
  if (!this.props.t) return null;
@@ -240,6 +240,19 @@ class Notif extends _common_js__WEBPACK_IMPORTED_MODULE_2__/* .Com */ .up {
240
240
  let st = 'position: fixed !important; z-index: 1000000000 !important';
241
241
  if (this.props.plugin._preview) st = 'position: absolute !important;';
242
242
  if (this.state.closeAnimation) animation = 'fadeOut';
243
+ let $avatar = null;
244
+ if (user.avatar_url) $avatar = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("img", {
245
+ alt: "notification avatar",
246
+ class: "notif_avatar__img",
247
+ src: user.avatar_url
248
+ });
249
+ let $time = (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
250
+ class: "notif_time",
251
+ style: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css(notif.subtext_style)
252
+ }, this.state.timestamp);
253
+ let $title = this.renderTextFromQuillDelta(this.state.title, user);
254
+ let $message = this.renderTextFromQuillDelta(this.state.message, user);
255
+ if (!lo.size($title) && !lo.size($message)) $time = null;
243
256
  return (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
244
257
  class: animation + ' notif' + ' notif__' + pos,
245
258
  onClick: e => this.onClick(e),
@@ -256,22 +269,15 @@ class Notif extends _common_js__WEBPACK_IMPORTED_MODULE_2__/* .Com */ .up {
256
269
  }), this.renderCloseButton(), (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
257
270
  class: "notif_avatar",
258
271
  style: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css(notif.avatar_style)
259
- }, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("img", {
260
- alt: "notification avatar",
261
- class: "notif_avatar__img",
262
- src: user.avatar_url
263
- })), (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
272
+ }, $avatar), (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
264
273
  class: "notif_body"
265
274
  }, (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
266
275
  class: "notif_title",
267
276
  style: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css(notif.title_style)
268
- }, this.renderTextFromQuillDelta(this.state.title, user)), (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
277
+ }, $title), (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
269
278
  class: "notif_message",
270
279
  style: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css(notif.message_style)
271
- }, this.renderTextFromQuillDelta(this.state.message, user)), (0,preact__WEBPACK_IMPORTED_MODULE_1__.h)("div", {
272
- class: "notif_time",
273
- style: _util_index_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"].js2css */ .Z.js2css(notif.subtext_style)
274
- }, this.state.timestamp))));
280
+ }, $message), $time)));
275
281
  }
276
282
  }
277
283
  function randomName() {
package/dist/HASH CHANGED
@@ -1 +1 @@
1
- 185588facf6
1
+ 18575b13d4f
@@ -4,4 +4,4 @@
4
4
  }
5
5
  body {
6
6
  background: #ddd;
7
- }</style></head><body><script defer="defer" src="https://vcdn.subiz-cdn.com/widget-v4/public/185588facf6.screenshoot.js"></script></body></html>
7
+ }</style></head><body><script defer="defer" src="https://vcdn.subiz-cdn.com/widget-v4/public/18575b13d4f.screenshoot.js"></script></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.4",
3
+ "version": "4.1.6",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -76,7 +76,8 @@ export default class Notif extends Com {
76
76
  height='24'
77
77
  viewBox='0 0 24 24'
78
78
  stroke-linecap='round'
79
- stroke-linejoin='round'>
79
+ stroke-linejoin='round'
80
+ >
80
81
  <line x1='18' y1='6' x2='6' y2='18' style='stroke-width: 3 !important;'></line>
81
82
  <line x1='6' y1='6' x2='18' y2='18' style='stroke-width: 3 !important;'></line>
82
83
  </svg>
@@ -196,22 +197,24 @@ export default class Notif extends Com {
196
197
  renderTextFromQuillDelta(quilldelta, profile) {
197
198
  let qd = sb.parseJSON(quilldelta)
198
199
  if (!qd || !qd.ops) return null
199
- return sb.map(qd.ops, (op) => {
200
- let out = null
201
- if (!op.insert) return null
202
-
203
- if (typeof op.insert == 'string') out = op.insert
204
- if (sb.get(op, 'insert.dynamicField')) {
205
- let key = sb.get(op, 'insert.dynamicField.key')
206
- if (key === 'user.fullname') out = profile.fullname
207
- if (key === 'user.email') out = profile.email
208
- if (key === 'user.address') out = profile.address
209
- if (key === 'user.phone') out = profile.phone
210
- }
211
- if (sb.get(op, 'attributes.bold')) out = <b>{out}</b>
212
- if (sb.get(op, 'attributes.italic')) out = <b>{out}</b>
213
- return out
214
- })
200
+ return sb
201
+ .map(qd.ops, (op) => {
202
+ let out = null
203
+ if (!op.insert) return null
204
+
205
+ if (typeof op.insert == 'string') out = op.insert
206
+ if (sb.get(op, 'insert.dynamicField')) {
207
+ let key = sb.get(op, 'insert.dynamicField.key')
208
+ if (key === 'user.fullname') out = profile.fullname
209
+ if (key === 'user.email') out = profile.email
210
+ if (key === 'user.address') out = profile.address
211
+ if (key === 'user.phone') out = profile.phone
212
+ }
213
+ if (sb.get(op, 'attributes.bold')) out = <b>{out}</b>
214
+ if (sb.get(op, 'attributes.italic')) out = <b>{out}</b>
215
+ return out
216
+ })
217
+ .filter((a) => a)
215
218
  }
216
219
 
217
220
  render() {
@@ -245,13 +248,27 @@ export default class Notif extends Com {
245
248
  let st = 'position: fixed !important; z-index: 1000000000 !important'
246
249
  if (this.props.plugin._preview) st = 'position: absolute !important;'
247
250
  if (this.state.closeAnimation) animation = 'fadeOut'
251
+ let $avatar = null
252
+ if (user.avatar_url) $avatar = <img alt='notification avatar' class='notif_avatar__img' src={user.avatar_url} />
253
+
254
+ let $time = (
255
+ <div class='notif_time' style={sb.js2css(notif.subtext_style)}>
256
+ {this.state.timestamp}
257
+ </div>
258
+ )
259
+
260
+ let $title = this.renderTextFromQuillDelta(this.state.title, user)
261
+ let $message = this.renderTextFromQuillDelta(this.state.message, user)
262
+ if (!lo.size($title) && !lo.size($message)) $time = null
263
+
248
264
  return (
249
265
  <div
250
266
  class={animation + ' notif' + ' notif__' + pos}
251
267
  onClick={(e) => this.onClick(e)}
252
268
  onmouseover={(e) => this.setOver(true)}
253
269
  style={st}
254
- onmouseleave={(e) => this.setOver(false)}>
270
+ onmouseleave={(e) => this.setOver(false)}
271
+ >
255
272
  <div style='position: relative !important; display: flex !important; align-items: center !important;'>
256
273
  <img
257
274
  alt='notification background'
@@ -261,18 +278,16 @@ export default class Notif extends Com {
261
278
  />
262
279
  {this.renderCloseButton()}
263
280
  <div class='notif_avatar' style={sb.js2css(notif.avatar_style)}>
264
- <img alt='notification avatar' class='notif_avatar__img' src={user.avatar_url} />
281
+ {$avatar}
265
282
  </div>
266
283
  <div class='notif_body'>
267
284
  <div class='notif_title' style={sb.js2css(notif.title_style)}>
268
- {this.renderTextFromQuillDelta(this.state.title, user)}
285
+ {$title}
269
286
  </div>
270
287
  <div class='notif_message' style={sb.js2css(notif.message_style)}>
271
- {this.renderTextFromQuillDelta(this.state.message, user)}
272
- </div>
273
- <div class='notif_time' style={sb.js2css(notif.subtext_style)}>
274
- {this.state.timestamp}
288
+ {$message}
275
289
  </div>
290
+ {$time}
276
291
  </div>
277
292
  </div>
278
293
  </div>
@@ -303,12 +318,7 @@ function ramdomPhone() {
303
318
  }
304
319
 
305
320
  function randomEmail() {
306
- return (
307
- randomName()
308
- .split(' ')
309
- .join('.')
310
- .toLowerCase() + '@gmail.com'
311
- )
321
+ return randomName().split(' ').join('.').toLowerCase() + '@gmail.com'
312
322
  }
313
323
 
314
324
  function randomAddress() {
@@ -32,7 +32,7 @@ export default class {
32
32
  this.accid = obj.accid
33
33
  this.mask = obj.mask
34
34
  this.uid = obj.uid
35
- return {account_id: accid, id: 'usqzgtgfake'}
35
+ return {account_id: this.accid, id: 'usqzgtgfake'}
36
36
  }
37
37
 
38
38
  listConversations = (_) => {