chat-customer-47net 1.2.6 → 1.2.8

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.
@@ -834,7 +834,7 @@ var timezoneExports = timezone$1.exports;
834
834
  const timezone = /* @__PURE__ */getDefaultExportFromCjs(timezoneExports);
835
835
  dayjs.extend(utc);
836
836
  dayjs.extend(timezone);
837
- const version = "1.2.6";
837
+ const version = "1.2.8";
838
838
  const publicDateFormat = "MM/DD/YY";
839
839
  const serverLocal = "America/New_York";
840
840
  const getTime = dateTime => {
@@ -7705,19 +7705,21 @@ const __vue2_script = {
7705
7705
  if (e.newValue === this.onCurrentValue) return;
7706
7706
  if (this.storageDebounce) clearTimeout(this.storageDebounce);
7707
7707
  this.storageDebounce = setTimeout(async () => {
7708
+ console.log("processTokenChange", 1);
7708
7709
  this.processTokenChange(e);
7709
7710
  }, 200);
7710
7711
  },
7711
7712
  async processTokenChange(e) {
7712
7713
  if (this.isHandlingStorage) return;
7713
7714
  this.isHandlingStorage = true;
7715
+ const accessToken = getToken();
7714
7716
  try {
7715
7717
  const {
7716
7718
  key,
7717
7719
  newValue
7718
7720
  } = e;
7719
7721
  if (key === "auth._token.login") {
7720
- if (newValue && newValue !== "false") {
7722
+ if (newValue && newValue !== "false" && accessToken && accessToken !== "false") {
7721
7723
  try {
7722
7724
  this.changeRoute("cover");
7723
7725
  const user = await getNxcUserOrCreate({}, this.initData.socketUrl);
@@ -7741,6 +7743,7 @@ const __vue2_script = {
7741
7743
  this.$refs.consultContainer.updateUserId();
7742
7744
  }
7743
7745
  } else {
7746
+ console.log("logout");
7744
7747
  setClientId("");
7745
7748
  this.userId = "";
7746
7749
  this.$set(this.initData, "user", {});
@@ -7901,6 +7904,7 @@ const __vue2_script = {
7901
7904
  this.onUpdateUserUnRead();
7902
7905
  this.audio = new Audio(`${data.socketUrl}/static/audio/unread.mp3`);
7903
7906
  if (accessToken && accessToken !== "false") {
7907
+ console.log("processTokenChange", 2);
7904
7908
  this.processTokenChange({
7905
7909
  key: "auth._token.login",
7906
7910
  newValue: accessToken
@@ -900,7 +900,7 @@ var __defProp = Object.defineProperty,
900
900
  data: () => ({
901
901
  touchStartTime: 0,
902
902
  chatShowDateTime: y,
903
- version: "1.2.6"
903
+ version: "1.2.8"
904
904
  }),
905
905
  methods: {
906
906
  handleStartNewConversation() {
@@ -5541,33 +5541,33 @@ var __defProp = Object.defineProperty,
5541
5541
  }, 200));
5542
5542
  },
5543
5543
  async processTokenChange(e) {
5544
- if (!this.isHandlingStorage) {
5545
- this.isHandlingStorage = !0;
5546
- try {
5547
- const {
5548
- key: i,
5549
- newValue: r
5550
- } = e;
5551
- if ("auth._token.login" === i) if (r && "false" !== r) {
5552
- try {
5553
- this.changeRoute("cover");
5554
- const e = await (t = {}, s = this.initData.socketUrl, kn({
5555
- url: "/api/users/getNxcUserOrCreate",
5556
- method: "get",
5557
- params: t,
5558
- baseURL: s
5559
- }));
5560
- this.userId = e.userId, this.$set(this.initData, "user", e), v(this.userId), this.conversations = [], this.getConversations(), this.onCurrentValue = r;
5561
- } catch (n) {
5562
- 401 === n.status && (this.userId = "", this.$set(this.initData, "user", {}), this.conversations = [], this.changeRoute("cover"), this.getInitData(), this.onCurrentValue = "false");
5563
- }
5564
- this.$refs.consultContainer && this.$refs.consultContainer.updateUserId();
5565
- } else v(""), this.userId = "", this.$set(this.initData, "user", {}), this.conversations = [], this.logOut(), this.changeRoute("cover"), this.onCurrentValue = "false";
5566
- } finally {
5567
- this.isHandlingStorage = !1;
5568
- }
5569
- var t, s;
5544
+ if (this.isHandlingStorage) return;
5545
+ this.isHandlingStorage = !0;
5546
+ const t = _();
5547
+ try {
5548
+ const {
5549
+ key: r,
5550
+ newValue: o
5551
+ } = e;
5552
+ if ("auth._token.login" === r) if (o && "false" !== o && t && "false" !== t) {
5553
+ try {
5554
+ this.changeRoute("cover");
5555
+ const e = await (s = {}, n = this.initData.socketUrl, kn({
5556
+ url: "/api/users/getNxcUserOrCreate",
5557
+ method: "get",
5558
+ params: s,
5559
+ baseURL: n
5560
+ }));
5561
+ this.userId = e.userId, this.$set(this.initData, "user", e), v(this.userId), this.conversations = [], this.getConversations(), this.onCurrentValue = o;
5562
+ } catch (i) {
5563
+ 401 === i.status && (this.userId = "", this.$set(this.initData, "user", {}), this.conversations = [], this.changeRoute("cover"), this.getInitData(), this.onCurrentValue = "false");
5564
+ }
5565
+ this.$refs.consultContainer && this.$refs.consultContainer.updateUserId();
5566
+ } else v(""), this.userId = "", this.$set(this.initData, "user", {}), this.conversations = [], this.logOut(), this.changeRoute("cover"), this.onCurrentValue = "false";
5567
+ } finally {
5568
+ this.isHandlingStorage = !1;
5570
5569
  }
5570
+ var s, n;
5571
5571
  },
5572
5572
  handleClick() {
5573
5573
  this.showView = !0, "dialog" === this.onRoute && (this.updateOpenView(!0), this.clearClinetUnRead(), this.$refs.consultContainer && this.$refs.consultContainer.scrollToBottom());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chat-customer-47net",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "",
5
5
  "main": "chat-customer-47net.es.js",
6
6
  "scripts": {