@subiz/widget-v4 4.1.14 → 4.1.15

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 (99) hide show
  1. package/compiled_src/popup/popup.js +6 -1
  2. package/compiled_src/store/store.js +36 -62
  3. package/compiled_src/util/common.js +2 -2
  4. package/inject.js +254 -98
  5. package/package.json +4 -4
  6. package/src/popup/popup.js +8 -1
  7. package/src/store/store.js +32 -61
  8. package/src/util/common.js +2 -2
  9. package/dist/132.js +0 -6612
  10. package/dist/178.js +0 -406
  11. package/dist/1857b1f5c4f.132.js +0 -1
  12. package/dist/1857b1f5c4f.178.js +0 -1
  13. package/dist/1857b1f5c4f.213.js +0 -1
  14. package/dist/1857b1f5c4f.335.js +0 -1
  15. package/dist/1857b1f5c4f.362.js +0 -1
  16. package/dist/1857b1f5c4f.441.js +0 -1
  17. package/dist/1857b1f5c4f.605.js +0 -1
  18. package/dist/1857b1f5c4f.678.js +0 -1
  19. package/dist/1857b1f5c4f.782.js +0 -1
  20. package/dist/1857b1f5c4f.app.js +0 -1
  21. package/dist/1857b1f5c4f.index.html +0 -26
  22. package/dist/1857b1f5c4f.library.html +0 -26
  23. package/dist/1857b1f5c4f.library.js +0 -1
  24. package/dist/1857b1f5c4f.preview.html +0 -759
  25. package/dist/1857b1f5c4f.preview.js +0 -1
  26. package/dist/1857b1f5c4f.screenshoot.js +0 -1
  27. package/dist/1857b1f5c4f.webview.js +0 -1
  28. package/dist/213.js +0 -2774
  29. package/dist/335.js +0 -372
  30. package/dist/362.js +0 -107
  31. package/dist/441.js +0 -2855
  32. package/dist/605.js +0 -305
  33. package/dist/678.js +0 -107
  34. package/dist/782.js +0 -107
  35. package/dist/HASH +0 -1
  36. package/dist/assets/img/Facebook.64607ec.png +0 -0
  37. package/dist/assets/img/Zalo.6845707.png +0 -0
  38. package/dist/assets/img/award1a.1a58e10.png +0 -0
  39. package/dist/assets/img/award3a.3b74423.png +0 -0
  40. package/dist/assets/img/award4a.ed6ccd4.png +0 -0
  41. package/dist/assets/img/award5.39eb7ae.png +0 -0
  42. package/dist/assets/img/bubble_default.7d5e4ab.svg +0 -20
  43. package/dist/assets/img/caret.998eb8f.svg +0 -1
  44. package/dist/assets/img/convos_empty.2353007.svg +0 -72
  45. package/dist/assets/img/default.06e6ee0.jpg +0 -0
  46. package/dist/assets/img/default_avatar.5b74dc1.png +0 -0
  47. package/dist/assets/img/done_gray.d7e8203.svg +0 -4
  48. package/dist/assets/img/done_green.b817fd4.svg +0 -4
  49. package/dist/assets/img/emoji/messenger/sub_23.529_58.824.d5faf14.png +0 -0
  50. package/dist/assets/img/emoji/messenger/sub_23.529_60.784.1420241.png +0 -0
  51. package/dist/assets/img/emoji/messenger/sub_25.490_0.000.1e6b2c0.png +0 -0
  52. package/dist/assets/img/emoji/messenger/sub_25.490_45.098.3dfbc08.png +0 -0
  53. package/dist/assets/img/emoji/messenger/sub_25.490_5.882.4b49e94.png +0 -0
  54. package/dist/assets/img/emoji/messenger/sub_27.451_72.549.7114f58.png +0 -0
  55. package/dist/assets/img/emoji/messenger/sub_27.451_84.314.231e2b7.png +0 -0
  56. package/dist/assets/img/emoji/messenger/sub_27.451_96.078.ddbb008.png +0 -0
  57. package/dist/assets/img/emoji/messenger/sub_29.412_5.882.61f3359.png +0 -0
  58. package/dist/assets/img/emoji/messenger/sub_58.824_100.000.6df72bc.png +0 -0
  59. package/dist/assets/img/emoji/messenger/sub_58.824_45.098.3d7a7ad.png +0 -0
  60. package/dist/assets/img/emoji/messenger/sub_58.824_47.059.0f4d6e2.png +0 -0
  61. package/dist/assets/img/emoji/messenger/sub_58.824_54.902.65724c1.png +0 -0
  62. package/dist/assets/img/emoji/messenger/sub_58.824_64.706.9da3cba.png +0 -0
  63. package/dist/assets/img/emoji/messenger/sub_58.824_72.549.edca5cf.png +0 -0
  64. package/dist/assets/img/emoji/messenger/sub_58.824_78.431.f910f2a.png +0 -0
  65. package/dist/assets/img/emoji/messenger/sub_58.824_88.235.def4e71.png +0 -0
  66. package/dist/assets/img/emoji/messenger/sub_60.784_11.765.49c03d0.png +0 -0
  67. package/dist/assets/img/emoji/messenger/sub_60.784_27.451.46b54e5.png +0 -0
  68. package/dist/assets/img/emoji/messenger/sub_60.784_29.412.e36d284.png +0 -0
  69. package/dist/assets/img/emoji/messenger/sub_60.784_3.922.bb191b0.png +0 -0
  70. package/dist/assets/img/emoji/messenger/sub_60.784_35.294.af7b927.png +0 -0
  71. package/dist/assets/img/emoji/messenger/sub_60.784_7.843.98f2a99.png +0 -0
  72. package/dist/assets/img/empty.29bed2d.svg +0 -23
  73. package/dist/assets/img/empty_1.0b98af0.svg +0 -11
  74. package/dist/assets/img/examplte_logo.f86535f.svg +0 -1
  75. package/dist/assets/img/external-link.90577cc.svg +0 -1
  76. package/dist/assets/img/fb_inverse_circle.36c2cfc.png +0 -0
  77. package/dist/assets/img/ghn.070f8e3.svg +0 -17
  78. package/dist/assets/img/ghtk.326eac1.svg +0 -18
  79. package/dist/assets/img/image_default.be0698b.png +0 -0
  80. package/dist/assets/img/info.ebce7ea.svg +0 -1
  81. package/dist/assets/img/loader.37000a7.svg +0 -1
  82. package/dist/assets/img/loading_static.8f403ae.svg +0 -10
  83. package/dist/assets/img/main-service1.d536cc2.png +0 -0
  84. package/dist/assets/img/main-service2.9b99549.png +0 -0
  85. package/dist/assets/img/not_found_search.2ddb8d1.png +0 -0
  86. package/dist/assets/img/package.8d37d0f.svg +0 -5
  87. package/dist/assets/img/package_fade.763c001.svg +0 -1
  88. package/dist/assets/img/rating--average.1ea492c.svg +0 -12
  89. package/dist/assets/img/rating--great.e3d712e.svg +0 -16
  90. package/dist/assets/img/rating--poor.2938a25.svg +0 -12
  91. package/dist/assets/img/search.f9705ff.svg +0 -1
  92. package/dist/assets/img/send.6db52a9.svg +0 -3
  93. package/dist/assets/img/shop.f7dc7d8.svg +0 -1
  94. package/dist/assets/img/shop_faded.df7845a.svg +0 -1
  95. package/dist/assets/img/subiz-mono.877e9f5.svg +0 -3
  96. package/dist/assets/img/x.26fdfa3.svg +0 -5
  97. package/dist/malicious-app.js +0 -13
  98. package/dist/screenshoot.html +0 -7
  99. package/dist/screenshoot.js +0 -5607
@@ -292,6 +292,9 @@ class Popup extends _common.Com {
292
292
  primarystyle.font_weight = primarystyle.font_weight || '500';
293
293
  primarystyle.font_size = primarystyle.font_size || popup.font_size || '14px';
294
294
  primarystyle.background = primarystyle.background || popup.text_color;
295
+ if (this.props.mobile && com.mobile_style) {
296
+ primarystyle = Object.assign(primarystyle, com.mobile_style);
297
+ }
295
298
  let $primary = null;
296
299
  if (com.buttons.primary_enabled && com.buttons.primary_text) {
297
300
  let style = Object.assign({
@@ -310,6 +313,9 @@ class Popup extends _common.Com {
310
313
  let style = Object.assign({
311
314
  font_size: popup.font_size || '14px'
312
315
  }, page.secondary_button);
316
+ if (this.props.mobile && com.mobile_style) {
317
+ style = Object.assign(style, com.mobile_style);
318
+ }
313
319
  $secondary = (0, _preact.h)("div", {
314
320
  class: 'btn btn__secondary',
315
321
  style: this.js2css(style),
@@ -659,7 +665,6 @@ class Popup extends _common.Com {
659
665
  white_space: 'pre-wrap'
660
666
  }, this.props.mobile && com.mobile_style || com.style);
661
667
  delete style.margin_top;
662
- delete style.margin_bottom;
663
668
  return (0, _preact.h)("div", {
664
669
  class: "text popup_component",
665
670
  style: this.js2css(style),
@@ -29,7 +29,7 @@ class Store {
29
29
  _defineProperty(this, "new_visitor", true);
30
30
  _defineProperty(this, "matchUser", () => {
31
31
  this._touchAcc();
32
- return this.cache.match('user');
32
+ return this.kv.match('user');
33
33
  });
34
34
  _defineProperty(this, "suggest_addresses", keyword => this.api.suggest_address(keyword));
35
35
  _defineProperty(this, "matchAccount", () => this.cache.match('account'));
@@ -82,7 +82,7 @@ class Store {
82
82
  _defineProperty(this, "listEvents", id => {
83
83
  if (!id || id === '*' || typeof id !== 'string') return;
84
84
  if (!this.isInsync('events' + id)) {
85
- _index.default.setTimeout(async () => {
85
+ setTimeout(async () => {
86
86
  await this.readyGate.entry();
87
87
  await this.reconnectGate.entry(undefined, true);
88
88
  if (this.isInsync('events' + id)) return this.reconnectGate.open();
@@ -109,20 +109,14 @@ class Store {
109
109
  _defineProperty(this, "convoGate", new _index.default.Gate(true));
110
110
  _defineProperty(this, "reconnectGate", new _index.default.Gate(true));
111
111
  _defineProperty(this, "wsGate", new _index.default.Gate(true));
112
- _defineProperty(this, "matchLastview", () => {
113
- let lastView = this.kv.match('lastview') || {};
114
- let user = this.cache.match('user') || {};
115
- if (!user.id) return {};
116
- if (lastView.user_id != user.id) return {};
117
- return lastView;
118
- });
112
+ _defineProperty(this, "matchLastview", () => this.kv.match('lastview') || {});
119
113
  _defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
120
114
  _defineProperty(this, "matchHasManuallyClosed", () => !!this.kv.match('hasManuallyClosed'));
121
115
  _defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
122
116
  _defineProperty(this, "sendPresence", _index.default.throttle(async () => {
123
117
  await this.readyGate.entry();
124
- if (!_index.default.get(this.cache.match('user'), 'id')) return;
125
- if (_index.default.isUserBanned(this.cache.match('user'))) return;
118
+ if (!_index.default.get(this.kv.match('user'), 'id')) return;
119
+ if (_index.default.isUserBanned(this.kv.match('user'))) return;
126
120
  let hasfocus = this.browserVisibility === 'visible' && document.hasFocus();
127
121
  if (!hasfocus) {
128
122
  this.api.sendLostFocus(this.device, this._currentViewingProduct.id, this._currentViewingProduct.source_id, this._currentViewingProduct.sku);
@@ -155,15 +149,10 @@ class Store {
155
149
  }
156
150
  });
157
151
  _defineProperty(this, "closePreview", () => this.kv.put('close_preview_at', new _index.default.Date().getTime()));
158
- _defineProperty(this, "setLastview", (view, opts) => {
159
- let user = this.cache.match('user') || {};
160
- if (!user.id) return;
161
- this.kv.put('lastview', {
162
- user_id: user.id,
163
- view,
164
- opts
165
- });
166
- });
152
+ _defineProperty(this, "setLastview", (view, opts) => this.kv.put('lastview', {
153
+ view,
154
+ opts
155
+ }));
167
156
  _defineProperty(this, "timeDiff", 0);
168
157
  this.g_sync = {};
169
158
  this.forceDevice = null;
@@ -186,25 +175,24 @@ class Store {
186
175
  this.inmem = inmem;
187
176
  this.cookie = inmemCookie;
188
177
  }
189
- cleanLocalStorage();
190
178
  this.pubsub = new _index.default.Pubsub();
191
- this.kv = new _storage.default.kv(new _storage.default.lsdb('sbz2023', this.inmem), 'kv');
192
- this.cache = new _storage.default.kv(new _storage.default.lsdb('sbz2023', true), 'kv');
193
- this.chain = new _storage.default.chain(new _storage.default.lsdb('cbz2023', true), 'ch');
179
+ this.kv = new _storage.default.kv(new _storage.default.lsdb('sbz2020', this.inmem), 'kv');
180
+ this.cache = new _storage.default.kv(new _storage.default.lsdb('sbz2020', true), 'kv');
181
+ this.chain = new _storage.default.chain(new _storage.default.lsdb('cbz2020', true), 'ch');
194
182
  this.getLocaleContent = this.api.getLocaleContent;
195
183
  this.g_haveSentSeenM = {};
196
184
  window.addEventListener('blur', () => this.sendPresence());
197
185
  window.addEventListener('focus', () => this.sendPresence());
198
- _index.default.setInterval(() => this.browserVisibility === 'visible' && document.hasFocus() && this.sendPresence(), 20000);
199
- _index.default.setInterval(() => (this.browserVisibility !== 'visible' || document.hasFocus()) && this.sendPresence(), 60000);
186
+ setInterval(() => this.browserVisibility === 'visible' && document.hasFocus() && this.sendPresence(), 20000);
187
+ setInterval(() => (this.browserVisibility !== 'visible' || document.hasFocus()) && this.sendPresence(), 60000);
200
188
  onVisibilityChange(val => {
201
189
  this.browserVisibility = val;
202
190
  this.sendPresence();
203
191
  });
204
192
  this.loopTime();
205
193
  this.device = this.getDeviceInfo();
206
- const _gaInterval = _index.default.setInterval(() => {
207
- let user = this.cache.match('user') || {};
194
+ const _gaInterval = setInterval(() => {
195
+ let user = this.kv.match('user') || {};
208
196
  if (!user.id) return;
209
197
  var dev = this.getDeviceInfo();
210
198
  if (!dev.ga_tracking_ids || !dev.ga_client_id) return;
@@ -262,7 +250,7 @@ class Store {
262
250
  await this.readyGate.entry();
263
251
  this.disconnect('account');
264
252
  await this.reconnect();
265
- _index.default.setTimeout(this.pubsub.publish('resetCSS'), 10);
253
+ setTimeout(this.pubsub.publish('resetCSS'), 10);
266
254
  }
267
255
  getDeviceInfo() {
268
256
  let device = {
@@ -406,9 +394,9 @@ class Store {
406
394
  seenLoop() {
407
395
  this.seenQueue = [];
408
396
  clearInterval(this._seenInterval);
409
- this._seenInterval = _index.default.setInterval(() => {
397
+ this._seenInterval = setInterval(() => {
410
398
  this.seenQueue = [...new Set(this.seenQueue)];
411
- let user = this.cache.match('user') || {};
399
+ let user = this.kv.match('user') || {};
412
400
  _index.default.map(this.seenQueue, id => {
413
401
  var events = this.listEvents(id);
414
402
  if (!events) return;
@@ -467,7 +455,7 @@ class Store {
467
455
  }
468
456
  _setUser(user) {
469
457
  user = _index.default.cloneDeep(user);
470
- let olduser = this.cache.match('user') || {};
458
+ let olduser = this.kv.match('user') || {};
471
459
  var accid = olduser.account_id || user.account_id;
472
460
  var id = olduser.id || user.id;
473
461
  _index.default.each(user.attributes, newattr => {
@@ -481,7 +469,7 @@ class Store {
481
469
  olduser.attributes = olduser.attributes.concat(user.attributes);
482
470
  olduser.account_id = accid;
483
471
  olduser.id = id;
484
- this.cache.put('user', olduser);
472
+ this.kv.put('user', olduser);
485
473
  this.pubsub.publish('account');
486
474
  }
487
475
  async setSetting(setting) {
@@ -551,13 +539,13 @@ class Store {
551
539
  if (!ev || !ev.type) return;
552
540
  ev.created = _index.default.getMs(ev.created);
553
541
  if (ev.type === 'user_info_updated') {
554
- let user = _index.default.cloneDeep(this.cache.match('user'));
542
+ let user = _index.default.cloneDeep(this.kv.match('user'));
555
543
  let attrs = _index.default.get(ev, 'data.user.attributes') || [];
556
544
  _index.default.map(attrs, attr => _index.default.setUserAttr(user, attr));
557
545
  this._setUser(user);
558
546
  return;
559
547
  }
560
- let user = this.cache.match('user') || {};
548
+ let user = this.kv.match('user') || {};
561
549
  let cid = _index.default.convoOfEv(ev);
562
550
  let convo;
563
551
  let alreadyFetched = false;
@@ -580,7 +568,7 @@ class Store {
580
568
  this.pubsub.publish('events', ev);
581
569
  if (ev.type === 'conversation_joined') {
582
570
  let members = _index.default.get(ev, 'data.conversation.members', []);
583
- let me = _index.default.find(members, m => m.id === this.cache.match('user').id);
571
+ let me = _index.default.find(members, m => m.id === this.kv.match('user').id);
584
572
  if (me) {
585
573
  await this.chain.reload(cid, (type, anchor, limit) => this.listmessageapi(type, anchor, limit));
586
574
  this.markSync('events' + cid);
@@ -610,7 +598,7 @@ class Store {
610
598
  }
611
599
  }
612
600
  async restConvoEvent(ev) {
613
- let user = this.cache.match('user');
601
+ let user = this.kv.match('user');
614
602
  let cid = _index.default.convoOfEv(ev);
615
603
  let convo = this.cache.match('convo_' + cid) || {};
616
604
  if (ev.type === 'conversation_state_updated') {
@@ -716,7 +704,7 @@ class Store {
716
704
  async sendConvoEvent(cid, type, data) {
717
705
  await this.readyGate.entry();
718
706
  var idempotency = _index.default.randomString(36);
719
- let user = this.cache.match('user') || {};
707
+ let user = this.kv.match('user') || {};
720
708
  var event = {
721
709
  id: idempotency,
722
710
  by: {
@@ -779,7 +767,7 @@ class Store {
779
767
  }
780
768
  _setConvo(convo) {
781
769
  let count = 0;
782
- let user = this.cache.match('user');
770
+ let user = this.kv.match('user');
783
771
  let channel = _index.default.get(convo, 'touchpoint.channel', '');
784
772
  if (channel && channel != 'subiz') return;
785
773
  let allconvo = {};
@@ -816,7 +804,7 @@ class Store {
816
804
  this.kv.put('bot_run_logs', log);
817
805
  }
818
806
  sendImpression(id) {
819
- let user = this.cache.match('user') || {};
807
+ let user = this.kv.match('user') || {};
820
808
  let log = this.kv.match('plugin_run_logs') || {};
821
809
  log[id] = {
822
810
  web_plugin_id: id,
@@ -833,7 +821,7 @@ class Store {
833
821
  });
834
822
  }
835
823
  sendConversion(id, fields, impressionToken) {
836
- let user = this.cache.match('user') || {};
824
+ let user = this.kv.match('user') || {};
837
825
  let submission = {
838
826
  account_id: user.account_id,
839
827
  user_id: user.id,
@@ -874,7 +862,7 @@ class Store {
874
862
  value: event
875
863
  };
876
864
  });
877
- let user = this.cache.match('user') || {};
865
+ let user = this.kv.match('user') || {};
878
866
  for (let i = 0; i < events.length; i++) {
879
867
  let ev = events[i].value;
880
868
  if (ev.type !== 'message_sent') continue;
@@ -888,17 +876,17 @@ class Store {
888
876
  }
889
877
  async loopTime() {
890
878
  let startms = _index.default.Date.now();
891
- if (!_index.default.get(this.cache.match('user'), 'id')) return _index.default.setTimeout(() => this.loopTime(), 240000);
879
+ if (!_index.default.get(this.kv.match('user'), 'id')) return setTimeout(() => this.loopTime(), 240000);
892
880
  let {
893
881
  body: t,
894
882
  error
895
883
  } = await this.api.time();
896
- if (error) return _index.default.setTimeout(() => this.loopTime(), 30000);
884
+ if (error) return setTimeout(() => this.loopTime(), 30000);
897
885
  var latences = Math.abs(_index.default.Date.now() - startms) / 2;
898
886
  var serverMs = new _index.default.Date(t).getTime() + latences;
899
887
  var localMs = _index.default.Date.now();
900
888
  this.timeDiff = Math.floor(serverMs - localMs);
901
- _index.default.setTimeout(() => this.loopTime(), 240000);
889
+ setTimeout(() => this.loopTime(), 240000);
902
890
  }
903
891
  replaceFileUrl(src) {
904
892
  if (!src) return '';
@@ -926,9 +914,9 @@ class Store {
926
914
  if ((k || '').startsWith('__sb')) this.cookie.remove(k);
927
915
  });
928
916
  this.kv.destroy();
929
- this.kv = new _storage.default.kv(new _storage.default.lsdb('sbz2023', this.inmem), 'kv');
917
+ this.kv = new _storage.default.kv(new _storage.default.lsdb('sbz2020', this.inmem), 'kv');
930
918
  this.chain.destroy();
931
- this.chain = new _storage.default.chain(new _storage.default.lsdb('cbz2023', true), 'ch');
919
+ this.chain = new _storage.default.chain(new _storage.default.lsdb('cbz2020', true), 'ch');
932
920
  }
933
921
  destroy() {
934
922
  this._die = true;
@@ -1046,18 +1034,4 @@ function sendEventToThirdParty(category, action, label) {
1046
1034
  let mobileCheck = function (a) {
1047
1035
  return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
1048
1036
  }(navigator.userAgent || navigator.vendor || window.opera);
1049
- let tabletCheck = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(navigator.userAgent);
1050
- let cleanLocalStorage = () => {
1051
- try {
1052
- localStorage;
1053
- } catch (e) {
1054
- return;
1055
- }
1056
- _index.default.setTimeout(() => {
1057
- for (var key in localStorage) {
1058
- if (key && key.startsWith('cbz2020') || key.startsWith('sbz2020')) {
1059
- localStorage.removeItem(key);
1060
- }
1061
- }
1062
- });
1063
- };
1037
+ let tabletCheck = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(navigator.userAgent);
@@ -80,9 +80,9 @@ var Date = f.contentWindow.Date;
80
80
  exports.Date = Date;
81
81
  var requestAnimationFrame = f.contentWindow.requestAnimationFrame;
82
82
  exports.requestAnimationFrame = requestAnimationFrame;
83
- var setTimeout = f.contentWindow.setTimeout.bind(f.contentWindow);
83
+ var setTimeout = f.contentWindow.setTimeout;
84
84
  exports.setTimeout = setTimeout;
85
- var setInterval = f.contentWindow.setInterval.bind(f.contentWindow);
85
+ var setInterval = f.contentWindow.setInterval;
86
86
  exports.setInterval = setInterval;
87
87
  function convoOfEv(ev) {
88
88
  if (!ev) return '';
package/inject.js CHANGED
@@ -11,128 +11,284 @@ function getUrlParameter(name) {
11
11
  }
12
12
 
13
13
  function runChatbox(subiz) {
14
- subiz._overridePlugin([
15
- {
16
- account_id: 'acqsulrowbxiugvginhw',
17
- id: 'wpwidget',
18
- name: 'Default chatbox',
19
- type: 'chatbox',
20
- created: 1595816243130,
21
- created_by: 'agqygncqpyaxoujpfc',
22
- updated: 1622003701148,
23
- updated_by: 'agqsulrowbxilyzhds',
24
- enabled: true,
25
- triggers: [
14
+ let popup = {
15
+ account_id: 'acqsulrowbxiugvginhw',
16
+ id: 'cprolocggdxtgbzrdtvkp',
17
+ name: 'Lì xì đầu năm',
18
+ type: 'popup',
19
+ created: 1675306404915,
20
+ created_by: 'agqsulrowbxilyzhds',
21
+ updated: 1675307604095,
22
+ updated_by: 'agqsulrowbxilyzhds',
23
+ triggers: [
24
+ {
25
+ type: 'after_pageview',
26
+ },
27
+ ],
28
+ initiative_frequency: {
29
+ once_per_session: true,
30
+ },
31
+ locale: 'vi-VN',
32
+ locales: ['vi-VN'],
33
+ popup: {
34
+ position: 'center',
35
+ type: 'modal',
36
+ animation: true,
37
+ show_close_button: true,
38
+ overlay: true,
39
+ text_color: '#333',
40
+ font_family: 'Roboto',
41
+ font_size: '16px',
42
+ background: 'white',
43
+ spacer: '10',
44
+ theme: 'bold',
45
+ pages: [
26
46
  {
27
- type: 'after_pageview',
28
- },
29
- ],
30
- chatbox: {
31
- account_id: 'acqsulrowbxiugvginhw',
32
- widget_version: 'v4',
33
- language: 'en',
34
- is_online: true,
35
- window_mode: 'mini',
36
- header: {
37
- layout: 'social',
38
- links: [
47
+ components: [
39
48
  {
40
- type: 'facebook',
41
- url: 'https://facebook.com/102463231712586',
49
+ type: 'image',
50
+ style: {
51
+ background_position: '0% 100%',
52
+ left: '0px',
53
+ right: '0px',
54
+ top: '0px',
55
+ bottom: '0px',
56
+ },
57
+ mobile_style: {
58
+ background_position: '0% 100%',
59
+ left: '0px',
60
+ right: '0px',
61
+ top: '0px',
62
+ bottom: '0px',
63
+ },
64
+ image: {
65
+ url: 'https://vcdn.subiz-cdn.com/file/firobdruwymdykrgoikj-10.png',
66
+ },
42
67
  },
43
68
  {
44
- type: 'zalo',
45
- url: 'https://zalo.com.vn',
69
+ type: 'text',
70
+ style: {
71
+ font_family: 'Dancing Script',
72
+ color: 'rgba(207,32,47,1)',
73
+ text_align: 'center',
74
+ font_style: 'normal',
75
+ font_weight: 'bold',
76
+ margin_bottom: '20px',
77
+ font_size: '72px',
78
+ },
79
+ mobile_style: {
80
+ font_family: 'Dancing Script',
81
+ color: 'rgba(207,32,47,1)',
82
+ text_align: 'center',
83
+ font_style: 'normal',
84
+ font_weight: 'bold',
85
+ margin_bottom: '10px',
86
+ font_size: '14px',
87
+ },
88
+ text: {
89
+ html: 'Đăng ký nhận ưu đãi khủng',
90
+ i18n_html: {
91
+ en_US: 'Lì xì đầu năm',
92
+ vi_VN: 'Lì xì đầu năm',
93
+ },
94
+ i18n_quill_delta: {},
95
+ },
46
96
  },
47
- ],
48
- agent_ids: ['agqsulrowbxilyzhds', 'agqsuorpukqwddqrtn', 'agqxufisjmshlniwof'],
49
- },
50
- height: 705,
51
- width: 375,
52
- primary_color: 'rgb(15, 220, 174)',
53
- background: 'linear-gradient(135deg, rgb(13, 223, 169) 0%, rgb(41, 183, 248) 100%)',
54
- offline_form: {
55
- fields: [
56
97
  {
57
- key: 'fullname',
58
- label: 'Họ và tên',
59
- i18n_label: {
60
- vi_VN: 'Ho ten',
61
- en_US: 'Fullname',
62
- },
63
98
  type: 'text',
99
+ style: {
100
+ font_family: 'Montserrat',
101
+ text_align: 'center',
102
+ font_style: 'normal',
103
+ font_weight: 'normal',
104
+ margin_bottom: '20px',
105
+ font_size: '20px',
106
+ },
107
+ mobile_style: {
108
+ font_family: 'Montserrat',
109
+ text_align: 'center',
110
+ font_style: 'normal',
111
+ font_weight: 'normal',
112
+ margin_bottom: '10px',
113
+ font_size: '10px',
114
+ },
115
+ text: {
116
+ html: 'Giảm giá tới 95%\nMiễn phí vận chuyển nội thành',
117
+ i18n_html: {
118
+ en_US:
119
+ 'Mừng xuân mới, tặng ngay bao lì xì \nmệnh giá 100.000 đến 500.000 VND \ncho 50 đơn hàng đầu tiên',
120
+ vi_VN:
121
+ 'Mừng xuân mới, tặng ngay bao lì xì \nmệnh giá 100.000 đến 500.000 VND \ncho 50 đơn hàng đầu tiên',
122
+ },
123
+ i18n_quill_delta: {},
124
+ },
64
125
  },
65
126
  {
66
- key: 'emails',
67
- label: 'Địa chỉ email',
68
- i18n_label: {
69
- vi_VN: 'THU DIEN TU',
70
- en_US: 'EMAIL',
127
+ type: 'buttons',
128
+ style: {
129
+ border_radius: '12px',
130
+ background: 'rgba(207,32,47,1)',
131
+ flex_direction: 'column',
132
+ },
133
+ mobile_style: {
134
+ font_size: '10px',
135
+ padding_top: '5px',
136
+ padding_bottom: '5px',
137
+ },
138
+ buttons: {
139
+ primary_enabled: true,
140
+ primary_actions: [
141
+ {
142
+ action: 'open_url',
143
+ url: 'https://subiz.com.vn',
144
+ new_tab: true,
145
+ },
146
+ {
147
+ action: 'close',
148
+ },
149
+ ],
150
+ primary_text: 'Đăng ký ngay',
151
+ i18n_primary_text: {
152
+ en_US: 'Đăng ký ngay',
153
+ vi_VN: 'Đăng ký ngay',
154
+ },
155
+ secondary_actions: [
156
+ {
157
+ action: 'close',
158
+ },
159
+ ],
160
+ i18n_secondary_text: {
161
+ en_US: 'Cancel',
162
+ vi_VN: 'Đăng ký ngay',
163
+ },
71
164
  },
72
- type: 'text',
73
165
  },
74
166
  ],
75
- title:
76
- 'Chào bạn! ↵Hiện các agent đang offline. Bạn vui lòng để lại thông tin để chúng tôi tiếp tục hỗ trợ bạn khi quay lại làm việc. Cảm ơn bạn!',
77
- enable_when: 'all_agents_offline',
78
- i18n_question_label: {
79
- vi_VN: 'Tin nhan',
80
- en_US: 'Your answer',
81
- },
82
- i18n_title: {
83
- vi_VN: 'Xin chao qui vi va cac ban',
84
- en_US: 'Holaa lkalalal',
167
+ style: {
168
+ background: 'rgba(255,255,255,0)',
169
+ width: '800px',
170
+ height: '565px',
171
+ padding_left: '40px',
172
+ padding_right: '40px',
173
+ padding_top: '40px',
174
+ padding_bottom: '40px',
175
+ margin_left: '150px',
176
+ margin_right: '150px',
177
+ margin_top: '120px',
178
+ margin_bottom: '120px',
179
+ overflow: 'hidden',
85
180
  },
86
-
87
- i18n_group_label: {
88
- vi_VN: 'Tro chuyen voi',
89
- en_US: 'Chat with',
181
+ mobile_style: {
182
+ background: 'rgba(255,255,255,0)',
183
+ width: '300px',
184
+ height: '200px',
185
+ padding_left: '40px',
186
+ padding_right: '40px',
187
+ padding_top: '40px',
188
+ padding_bottom: '40px',
189
+ margin_left: '0px',
190
+ margin_right: '0px',
191
+ margin_top: '0px',
192
+ margin_bottom: '0px',
90
193
  },
91
- enabled: true,
194
+ layout: 'row',
195
+ mobile_layout: 'row',
92
196
  },
93
- prechat_form: {
94
- fields: [
197
+ {
198
+ components: [
95
199
  {
96
- key: 'emails',
97
- label: 'Địa chỉ email',
98
200
  type: 'text',
201
+ style: {
202
+ text_align: 'center',
203
+ margin_bottom: '10px',
204
+ font_size: '20px',
205
+ },
206
+ mobile_style: {
207
+ text_align: 'center',
208
+ margin_bottom: '10px',
209
+ font_size: '40px',
210
+ },
211
+ text: {
212
+ html: 'Cảm ơn',
213
+ i18n_html: {
214
+ en_US: 'Thank you',
215
+ vi_VN: 'Thank you',
216
+ },
217
+ i18n_quill_delta: {},
218
+ },
99
219
  },
100
220
  {
101
- key: 'fullname',
102
- label: 'Họ và tên',
103
- is_required: true,
104
221
  type: 'text',
222
+ style: {
223
+ text_align: 'center',
224
+ margin_bottom: '20px',
225
+ font_size: '16px',
226
+ },
227
+ text: {
228
+ html: 'Chúng tôi đã ghi nhận được yêu cầu của bạn',
229
+ i18n_html: {
230
+ en_US: 'We had received your request',
231
+ vi_VN: 'We had received your request',
232
+ },
233
+ i18n_quill_delta: {},
234
+ },
235
+ },
236
+ {
237
+ type: 'buttons',
238
+ style: {
239
+ flex_direction: 'column',
240
+ align_items: 'center',
241
+ },
242
+ mobile_style: {
243
+ flex_direction: 'column',
244
+ align_items: 'center',
245
+ },
246
+ buttons: {
247
+ primary_enabled: true,
248
+ primary_actions: [
249
+ {
250
+ action: 'close',
251
+ },
252
+ ],
253
+ primary_text: 'Đóng',
254
+ i18n_primary_text: {
255
+ en_US: 'Close',
256
+ vi_VN: 'Close',
257
+ },
258
+ i18n_secondary_text: {
259
+ vi_VN: 'Close',
260
+ },
261
+ },
105
262
  },
106
263
  ],
107
- group_required: true,
108
- title: 'Xin chào',
109
- question_label: 'tin nhan',
110
- },
111
- desktop_button: {
112
- background_mask_url: 'https://public-gcs.subiz-cdn.com/dashboard-v4/public/img/bubble_00.dcaf1b50.svg',
113
- margin_x: 50,
114
- margin_y: 50,
115
- position: 'right',
116
- },
117
- mobile_button: {
118
- background_mask_url: 'https://public-gcs.subiz-cdn.com/dashboard-v4/public/img/bubble_00.dcaf1b50.svg',
119
- margin_x: 20,
120
- margin_y: 20,
121
- position: 'right',
122
- },
123
- greeting: {
124
- message: 'Holla amigo',
125
- enabled: false,
126
- agent_id: 'agqsuorpukqwddqrtn',
264
+ style: {
265
+ width: '300px',
266
+ padding_left: '40px',
267
+ padding_right: '40px',
268
+ padding_top: '40px',
269
+ padding_bottom: '40px',
270
+ overflow: 'hidden',
271
+ },
272
+ mobile_style: {
273
+ width: '300px',
274
+ padding_left: '40px',
275
+ padding_right: '40px',
276
+ padding_top: '40px',
277
+ padding_bottom: '40px',
278
+ },
127
279
  },
128
- title: 'Bất động sản An Cư',
129
- introduction: 'Chúng tôi luôn sẵn sàng hỗ trợ',
130
- auto_request_rating: true,
131
- },
132
- thumbnail_url: 'https://file-subiz.com/fiqzxywfwuvymbiqumbzwpwidget.jpg',
133
- locale: 'vi-VN',
280
+ ],
134
281
  },
135
- ])
282
+ conversion_notification: {
283
+ all_agents: true,
284
+ },
285
+ template_categories: ['Năm mới'],
286
+ template_title: 'Lì xì đầu năm',
287
+ thumbnail_url:
288
+ 'https://vcdn.subiz-cdn.com/file/firobhhkwjwiirovikuh-firobhhkfosiufzphxicwptp1673839749423clmwirrp.jpg',
289
+ }
290
+ subiz._overridePlugin([popup])
291
+ console.log('GGGGGGG', popup)
136
292
 
137
293
  setTimeout(() => {
138
294
  subiz.showWidget()