@redonvn/zalo-ads-sdk 0.2.17 → 0.2.18

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.
package/dist/index.mjs CHANGED
@@ -570,6 +570,13 @@ var ZaloAuthManager = class {
570
570
  if (session.zpsidFingerprint && session.zpsidFingerprint !== currentFingerprint) {
571
571
  return false;
572
572
  }
573
+ if (session.domain === "ads.zalo.me" && this.accountScope?.memberId && String(this.accountScope.memberId) !== "0" && !this.accountScope.isRoot) {
574
+ const expectedMemberId = String(this.accountScope.memberId);
575
+ const activeMemberId = String(session.playSessionPayload?.data?.id ?? "");
576
+ if (activeMemberId && activeMemberId !== expectedMemberId) {
577
+ return false;
578
+ }
579
+ }
573
580
  return true;
574
581
  }
575
582
  async resolveZpsid() {
@@ -646,7 +653,13 @@ var ZaloAuthManager = class {
646
653
  if (whoamiJson?.data) {
647
654
  adsProfile = whoamiJson.data;
648
655
  }
649
- if (this.accountScope?.memberId && String(this.accountScope.memberId) !== "0" && !this.accountScope.isRoot && !explicitPlaySession) {
656
+ const currentActiveId = String(
657
+ decodePlaySessionJwt(cookies["PLAY_SESSION"] || "")?.data?.id ?? ""
658
+ );
659
+ const shouldSwitchContext = Boolean(
660
+ this.accountScope?.memberId && String(this.accountScope.memberId) !== "0" && !this.accountScope.isRoot && (!explicitPlaySession || currentActiveId && currentActiveId !== String(this.accountScope.memberId))
661
+ );
662
+ if (shouldSwitchContext) {
650
663
  const memberIdStr = String(this.accountScope.memberId);
651
664
  const switchUrls = [];
652
665
  if (this.accountScope.accountType === "ACCESSOR") {