@subiz/widget-v4 4.1.21 → 4.1.25

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 (100) hide show
  1. package/compiled_src/chatbox/Widget.js +1 -1
  2. package/compiled_src/store/api_fake.js +10 -2
  3. package/compiled_src/store/store.js +20 -4
  4. package/compiled_src/util/campaign.js +2 -2
  5. package/package.json +1 -1
  6. package/src/chatbox/Widget.js +1 -1
  7. package/src/store/api_fake.js +23 -2
  8. package/src/store/store.js +27 -2
  9. package/src/util/campaign.js +2 -2
  10. package/dist/132.js +0 -6598
  11. package/dist/178.js +0 -406
  12. package/dist/186965b8487.132.js +0 -1
  13. package/dist/186965b8487.178.js +0 -1
  14. package/dist/186965b8487.213.js +0 -1
  15. package/dist/186965b8487.335.js +0 -1
  16. package/dist/186965b8487.362.js +0 -1
  17. package/dist/186965b8487.441.js +0 -1
  18. package/dist/186965b8487.605.js +0 -1
  19. package/dist/186965b8487.678.js +0 -1
  20. package/dist/186965b8487.782.js +0 -1
  21. package/dist/186965b8487.app.js +0 -1
  22. package/dist/186965b8487.index.html +0 -26
  23. package/dist/186965b8487.library.html +0 -26
  24. package/dist/186965b8487.library.js +0 -1
  25. package/dist/186965b8487.preview.html +0 -759
  26. package/dist/186965b8487.preview.js +0 -1
  27. package/dist/186965b8487.screenshoot.js +0 -1
  28. package/dist/186965b8487.webview.js +0 -1
  29. package/dist/213.js +0 -2780
  30. package/dist/335.js +0 -372
  31. package/dist/362.js +0 -107
  32. package/dist/441.js +0 -2855
  33. package/dist/605.js +0 -305
  34. package/dist/678.js +0 -107
  35. package/dist/782.js +0 -107
  36. package/dist/HASH +0 -1
  37. package/dist/assets/img/Facebook.64607ec.png +0 -0
  38. package/dist/assets/img/Zalo.6845707.png +0 -0
  39. package/dist/assets/img/award1a.1a58e10.png +0 -0
  40. package/dist/assets/img/award3a.3b74423.png +0 -0
  41. package/dist/assets/img/award4a.ed6ccd4.png +0 -0
  42. package/dist/assets/img/award5.39eb7ae.png +0 -0
  43. package/dist/assets/img/bubble_default.7d5e4ab.svg +0 -20
  44. package/dist/assets/img/caret.998eb8f.svg +0 -1
  45. package/dist/assets/img/convos_empty.2353007.svg +0 -72
  46. package/dist/assets/img/default.06e6ee0.jpg +0 -0
  47. package/dist/assets/img/default_avatar.5b74dc1.png +0 -0
  48. package/dist/assets/img/done_gray.d7e8203.svg +0 -4
  49. package/dist/assets/img/done_green.b817fd4.svg +0 -4
  50. package/dist/assets/img/emoji/messenger/sub_23.529_58.824.d5faf14.png +0 -0
  51. package/dist/assets/img/emoji/messenger/sub_23.529_60.784.1420241.png +0 -0
  52. package/dist/assets/img/emoji/messenger/sub_25.490_0.000.1e6b2c0.png +0 -0
  53. package/dist/assets/img/emoji/messenger/sub_25.490_45.098.3dfbc08.png +0 -0
  54. package/dist/assets/img/emoji/messenger/sub_25.490_5.882.4b49e94.png +0 -0
  55. package/dist/assets/img/emoji/messenger/sub_27.451_72.549.7114f58.png +0 -0
  56. package/dist/assets/img/emoji/messenger/sub_27.451_84.314.231e2b7.png +0 -0
  57. package/dist/assets/img/emoji/messenger/sub_27.451_96.078.ddbb008.png +0 -0
  58. package/dist/assets/img/emoji/messenger/sub_29.412_5.882.61f3359.png +0 -0
  59. package/dist/assets/img/emoji/messenger/sub_58.824_100.000.6df72bc.png +0 -0
  60. package/dist/assets/img/emoji/messenger/sub_58.824_45.098.3d7a7ad.png +0 -0
  61. package/dist/assets/img/emoji/messenger/sub_58.824_47.059.0f4d6e2.png +0 -0
  62. package/dist/assets/img/emoji/messenger/sub_58.824_54.902.65724c1.png +0 -0
  63. package/dist/assets/img/emoji/messenger/sub_58.824_64.706.9da3cba.png +0 -0
  64. package/dist/assets/img/emoji/messenger/sub_58.824_72.549.edca5cf.png +0 -0
  65. package/dist/assets/img/emoji/messenger/sub_58.824_78.431.f910f2a.png +0 -0
  66. package/dist/assets/img/emoji/messenger/sub_58.824_88.235.def4e71.png +0 -0
  67. package/dist/assets/img/emoji/messenger/sub_60.784_11.765.49c03d0.png +0 -0
  68. package/dist/assets/img/emoji/messenger/sub_60.784_27.451.46b54e5.png +0 -0
  69. package/dist/assets/img/emoji/messenger/sub_60.784_29.412.e36d284.png +0 -0
  70. package/dist/assets/img/emoji/messenger/sub_60.784_3.922.bb191b0.png +0 -0
  71. package/dist/assets/img/emoji/messenger/sub_60.784_35.294.af7b927.png +0 -0
  72. package/dist/assets/img/emoji/messenger/sub_60.784_7.843.98f2a99.png +0 -0
  73. package/dist/assets/img/empty.29bed2d.svg +0 -23
  74. package/dist/assets/img/empty_1.0b98af0.svg +0 -11
  75. package/dist/assets/img/examplte_logo.f86535f.svg +0 -1
  76. package/dist/assets/img/external-link.90577cc.svg +0 -1
  77. package/dist/assets/img/fb_inverse_circle.36c2cfc.png +0 -0
  78. package/dist/assets/img/ghn.070f8e3.svg +0 -17
  79. package/dist/assets/img/ghtk.326eac1.svg +0 -18
  80. package/dist/assets/img/image_default.be0698b.png +0 -0
  81. package/dist/assets/img/info.ebce7ea.svg +0 -1
  82. package/dist/assets/img/loader.37000a7.svg +0 -1
  83. package/dist/assets/img/loading_static.a27f0ac.svg +0 -10
  84. package/dist/assets/img/main-service1.d536cc2.png +0 -0
  85. package/dist/assets/img/main-service2.9b99549.png +0 -0
  86. package/dist/assets/img/not_found_search.2ddb8d1.png +0 -0
  87. package/dist/assets/img/package.8d37d0f.svg +0 -5
  88. package/dist/assets/img/package_fade.763c001.svg +0 -1
  89. package/dist/assets/img/rating--average.1ea492c.svg +0 -12
  90. package/dist/assets/img/rating--great.e3d712e.svg +0 -16
  91. package/dist/assets/img/rating--poor.2938a25.svg +0 -12
  92. package/dist/assets/img/search.f9705ff.svg +0 -1
  93. package/dist/assets/img/send.6db52a9.svg +0 -3
  94. package/dist/assets/img/shop.f7dc7d8.svg +0 -1
  95. package/dist/assets/img/shop_faded.df7845a.svg +0 -1
  96. package/dist/assets/img/subiz-mono.877e9f5.svg +0 -3
  97. package/dist/assets/img/x.26fdfa3.svg +0 -5
  98. package/dist/malicious-app.js +0 -13
  99. package/dist/screenshoot.html +0 -7
  100. package/dist/screenshoot.js +0 -5625
@@ -585,7 +585,7 @@ class Widget extends _common.Com {
585
585
  let convoM = this.props.store.matchConvo('*');
586
586
  var convos = _index.default.map(convoM, convo => this.props.store.matchConvo(convo.id));
587
587
  convos = _index.default.filter(convos, convo => !!convo);
588
- convos = _index.default.orderBy(convos, 'created', 'desc');
588
+ convos = _index.default.orderBy(convos, 'actived', 'desc');
589
589
  var $convos = _index.default.map(convos, convo => {
590
590
  let ags = _index.default.filter(convo.members, m => {
591
591
  return (m.type === 'agent' || m.type === 'bot') && m.membership === 'active';
@@ -66,7 +66,11 @@ class _default {
66
66
  _defineProperty(this, "getUser", _ => Promise.resolve({
67
67
  code: 200,
68
68
  body: {
69
- id: '-'
69
+ id: 'usqzgtgfake',
70
+ attributes: [{
71
+ key: 'fullname',
72
+ text: 'Kiều Thanh'
73
+ }]
70
74
  }
71
75
  }));
72
76
  _defineProperty(this, "getAccountSetting", () => this.apireq.get(`/accounts/${this.accid}/settings`));
@@ -85,7 +89,11 @@ class _default {
85
89
  this.uid = obj.uid;
86
90
  return {
87
91
  account_id: this.accid,
88
- id: 'usqzgtgfake'
92
+ id: 'usqzgtgfake',
93
+ attributes: [{
94
+ key: 'fullname',
95
+ text: 'Kiều Thanh'
96
+ }]
89
97
  };
90
98
  }
91
99
  }
@@ -78,7 +78,6 @@ class Store {
78
78
  _defineProperty(this, "list_provinces", () => this.api.list_provinces());
79
79
  _defineProperty(this, "list_districts", p => this.api.list_districts(p));
80
80
  _defineProperty(this, "list_wards", p => this.api.list_wards(p));
81
- _defineProperty(this, "list_provices", void 0);
82
81
  _defineProperty(this, "listEvents", id => {
83
82
  if (!id || id === '*' || typeof id !== 'string') return;
84
83
  if (!this.isInsync('events' + id)) {
@@ -325,9 +324,6 @@ class Store {
325
324
  async init(accid, mask, userRef) {
326
325
  this.readyGate.close();
327
326
  accid = (accid || '').trim();
328
- this.api.setAuth({
329
- accid: accid
330
- });
331
327
  this.g_sync = {};
332
328
  if (!userRef) {
333
329
  try {
@@ -353,6 +349,12 @@ class Store {
353
349
  }
354
350
  }
355
351
  }
352
+ if (this.cookie.get('__sbref', userRef) != userRef) {
353
+ cleanMyLocalStorage();
354
+ }
355
+ this.api.setAuth({
356
+ accid: accid
357
+ });
356
358
  if (userRef) this.cookie.set('__sbref', userRef);
357
359
  let user = await this.api.setAuth({
358
360
  accid: accid,
@@ -1060,4 +1062,18 @@ let cleanLocalStorage = () => {
1060
1062
  }
1061
1063
  }
1062
1064
  });
1065
+ };
1066
+ let cleanMyLocalStorage = () => {
1067
+ try {
1068
+ localStorage;
1069
+ } catch (e) {
1070
+ return;
1071
+ }
1072
+ _index.default.setTimeout(() => {
1073
+ for (var key in localStorage) {
1074
+ if (key && (key.startsWith('cbz2020') || key.startsWith('sbz2020') || key.startsWith('sbz2022') || key.startsWith('sbz2023'))) {
1075
+ localStorage.removeItem(key);
1076
+ }
1077
+ }
1078
+ });
1063
1079
  };
@@ -44,7 +44,7 @@ function trackAreaClicked(selector, cb) {
44
44
  });
45
45
  });
46
46
  }
47
- function trackInactivity(seconds, cb) {
47
+ function trackInactivity(seconds = 0, cb) {
48
48
  let events = ['scroll', 'keyup', 'keydown', 'mousemove', 'mousewheel', 'mouseenter', 'mouseover', 'mousedown', 'touchstart', 'touchmove', 'touchenter'];
49
49
  let inactiveSeconds = 0;
50
50
  let resetTime = () => {
@@ -67,7 +67,7 @@ let timeOnPage = 0;
67
67
  common.setInterval(() => {
68
68
  timeOnPage += 5;
69
69
  }, 5000);
70
- function trackTimeOnPage(seconds, cb) {
70
+ function trackTimeOnPage(seconds = 0, cb) {
71
71
  if (seconds < 1) {
72
72
  return common.setTimeout(function () {
73
73
  cb(seconds);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.21",
3
+ "version": "4.1.25",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -586,7 +586,7 @@ export default class Widget extends Com {
586
586
  let convoM = this.props.store.matchConvo('*')
587
587
  var convos = sb.map(convoM, (convo) => this.props.store.matchConvo(convo.id))
588
588
  convos = sb.filter(convos, (convo) => !!convo)
589
- convos = sb.orderBy(convos, 'created', 'desc')
589
+ convos = sb.orderBy(convos, 'actived', 'desc')
590
590
 
591
591
  var $convos = sb.map(convos, (convo) => {
592
592
  let ags = sb.filter(convo.members, (m) => {
@@ -28,7 +28,16 @@ export default class {
28
28
  this.accid = obj.accid
29
29
  this.mask = obj.mask
30
30
  this.uid = obj.uid
31
- return {account_id: this.accid, id: 'usqzgtgfake'}
31
+ return {
32
+ account_id: this.accid,
33
+ id: 'usqzgtgfake',
34
+ attributes: [
35
+ {
36
+ key: 'fullname',
37
+ text: 'Kiều Thanh',
38
+ },
39
+ ],
40
+ }
32
41
  }
33
42
 
34
43
  listConversations = (_) => {
@@ -68,7 +77,19 @@ export default class {
68
77
  time = (_) => Promise.resolve({code: 200, body: new sb.Date().toISOString()})
69
78
  updateUser = (data) => OK200
70
79
 
71
- getUser = (_) => Promise.resolve({code: 200, body: {id: '-'}})
80
+ getUser = (_) =>
81
+ Promise.resolve({
82
+ code: 200,
83
+ body: {
84
+ id: 'usqzgtgfake',
85
+ attributes: [
86
+ {
87
+ key: 'fullname',
88
+ text: 'Kiều Thanh',
89
+ },
90
+ ],
91
+ },
92
+ })
72
93
  getAccountSetting = () => this.apireq.get(`/accounts/${this.accid}/settings`)
73
94
  getIsOnline = () => this.apireq.get(`/accounts/${this.accid}/is_online`)
74
95
 
@@ -290,7 +290,6 @@ export default class Store {
290
290
  list_districts = (p) => this.api.list_districts(p)
291
291
  list_wards = (p) => this.api.list_wards(p)
292
292
 
293
- list_provices
294
293
  listEvents = (id) => {
295
294
  if (!id || id === '*' || typeof id !== 'string') return
296
295
  if (!this.isInsync('events' + id)) {
@@ -374,8 +373,8 @@ export default class Store {
374
373
  async init(accid, mask, userRef) {
375
374
  this.readyGate.close()
376
375
  accid = (accid || '').trim()
377
- this.api.setAuth({accid: accid})
378
376
  this.g_sync = {}
377
+
379
378
  if (!userRef) {
380
379
  // try to find userRef in cookie
381
380
  try {
@@ -408,6 +407,11 @@ export default class Store {
408
407
  }
409
408
  }
410
409
 
410
+ if (this.cookie.get('__sbref', userRef) != userRef) {
411
+ cleanMyLocalStorage()
412
+ }
413
+
414
+ this.api.setAuth({accid: accid})
411
415
  // set cookie forever
412
416
  if (userRef) this.cookie.set('__sbref', userRef)
413
417
 
@@ -1274,3 +1278,24 @@ let cleanLocalStorage = () => {
1274
1278
  }
1275
1279
  })
1276
1280
  }
1281
+
1282
+ let cleanMyLocalStorage = () => {
1283
+ try {
1284
+ localStorage
1285
+ } catch (e) {
1286
+ return
1287
+ }
1288
+ sb.setTimeout(() => {
1289
+ for (var key in localStorage) {
1290
+ if (
1291
+ key &&
1292
+ (key.startsWith('cbz2020') ||
1293
+ key.startsWith('sbz2020') ||
1294
+ key.startsWith('sbz2022') ||
1295
+ key.startsWith('sbz2023'))
1296
+ ) {
1297
+ localStorage.removeItem(key)
1298
+ }
1299
+ }
1300
+ })
1301
+ }
@@ -47,7 +47,7 @@ export function trackAreaClicked(selector, cb) {
47
47
  }
48
48
 
49
49
  // callback when user has stopped all activity (clicking, scrolling, ...)
50
- export function trackInactivity(seconds, cb) {
50
+ export function trackInactivity(seconds = 0, cb) {
51
51
  let events = [
52
52
  'scroll',
53
53
  'keyup',
@@ -86,7 +86,7 @@ common.setInterval(() => {
86
86
  }, 5000)
87
87
 
88
88
  // when user has been on the page for at least X seconds
89
- export function trackTimeOnPage(seconds, cb) {
89
+ export function trackTimeOnPage(seconds = 0, cb) {
90
90
  if (seconds < 1) {
91
91
  return common.setTimeout(function () {
92
92
  cb(seconds)