@subiz/widget-v4 4.1.184 → 4.1.185

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.
@@ -99,7 +99,7 @@ class ChatButton extends _common.Com {
99
99
  let hiddenButtonDesktop = _index.default.get(accountSetting, 'desktop_button.hidden');
100
100
  if (hiddenButtonDesktop) return null;
101
101
  let cls = 'widget-layout widget-layout--' + position;
102
- if (!this.props.isShow || !this.state.ready) {
102
+ if (!this.props.isShow) {
103
103
  cls += ' widget-layout--hidden';
104
104
  }
105
105
  return (0, _preact.h)("div", {
@@ -446,6 +446,7 @@ class ChatButton extends _common.Com {
446
446
  height: ${imgheight - 4}px !important;
447
447
 
448
448
  `;
449
+ if (!this.state.ready) cls += ' hidden';
449
450
  return (0, _preact.h)("div", {
450
451
  class: cls,
451
452
  onClick: e => this.onClick(e)
@@ -153,21 +153,7 @@ class Store {
153
153
  _defineProperty(this, "reconnectGate", new _index.default.Gate(true));
154
154
  _defineProperty(this, "wsGate", new _index.default.Gate(true));
155
155
  _defineProperty(this, "matchLastview", () => {
156
- let lastView = this.kv.match('lastview') || {};
157
- let user = this.cache.match('user') || {};
158
- if (!user.id) return {
159
- screen: 'preview'
160
- };
161
- if (lastView.user_id != user.id) return {
162
- screen: 'preview'
163
- };
164
- if (!lastView.screen) {
165
- lastView.screen = 'preview';
166
- if (lastView.view === 'list' || lastView.view === 'chat') {
167
- lastView.screen = 'widget';
168
- }
169
- }
170
- return lastView;
156
+ return this.kv.match('lastview') || {};
171
157
  });
172
158
  _defineProperty(this, "matchIsOpen", () => !!this.kv.match('isopen'));
173
159
  _defineProperty(this, "matchClosePreviewAt", () => this.kv.match('close_preview_at') || 0);
@@ -524,6 +510,20 @@ class Store {
524
510
  user_mask: mask
525
511
  });
526
512
  }
513
+ standardlizeLastview() {
514
+ let lastView = this.kv.match('lastview') || {};
515
+ let user = this.cache.match('user') || {};
516
+ if (!user.id) lastView = {};
517
+ if (lastView.user_id != user.id) lastView = {};
518
+ if (!lastView.screen) {
519
+ lastView.screen = 'preview';
520
+ if (lastView.view === 'list' || lastView.view === 'chat') {
521
+ lastView.screen = 'widget';
522
+ }
523
+ }
524
+ if (this.isMobile()) lastView.screen = 'button';
525
+ this.kv.put('lastview', lastView);
526
+ }
527
527
  async _initResource(accid, auth, realtimep) {
528
528
  this.g_sync = {};
529
529
  let user = await this.api.setAuth(auth);
@@ -549,6 +549,7 @@ class Store {
549
549
  await this.reconnect({
550
550
  user: user
551
551
  });
552
+ this.standardlizeLastview();
552
553
  if (typeof sbz_info != 'undefined') sbz_info.store_10 = true;
553
554
  this.readyGate.open();
554
555
  this.reconnectWs(accid, user.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.184",
3
+ "version": "4.1.185",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",