@subiz/widget-v4 4.1.20 → 4.1.24

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.
@@ -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
  };