@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.js CHANGED
@@ -737,6 +737,13 @@ var ZaloAuthManager = class {
737
737
  if (session.zpsidFingerprint && session.zpsidFingerprint !== currentFingerprint) {
738
738
  return false;
739
739
  }
740
+ if (session.domain === "ads.zalo.me" && this.accountScope?.memberId && String(this.accountScope.memberId) !== "0" && !this.accountScope.isRoot) {
741
+ const expectedMemberId = String(this.accountScope.memberId);
742
+ const activeMemberId = String(session.playSessionPayload?.data?.id ?? "");
743
+ if (activeMemberId && activeMemberId !== expectedMemberId) {
744
+ return false;
745
+ }
746
+ }
740
747
  return true;
741
748
  }
742
749
  async resolveZpsid() {
@@ -813,7 +820,13 @@ var ZaloAuthManager = class {
813
820
  if (whoamiJson?.data) {
814
821
  adsProfile = whoamiJson.data;
815
822
  }
816
- if (this.accountScope?.memberId && String(this.accountScope.memberId) !== "0" && !this.accountScope.isRoot && !explicitPlaySession) {
823
+ const currentActiveId = String(
824
+ decodePlaySessionJwt(cookies["PLAY_SESSION"] || "")?.data?.id ?? ""
825
+ );
826
+ const shouldSwitchContext = Boolean(
827
+ this.accountScope?.memberId && String(this.accountScope.memberId) !== "0" && !this.accountScope.isRoot && (!explicitPlaySession || currentActiveId && currentActiveId !== String(this.accountScope.memberId))
828
+ );
829
+ if (shouldSwitchContext) {
817
830
  const memberIdStr = String(this.accountScope.memberId);
818
831
  const switchUrls = [];
819
832
  if (this.accountScope.accountType === "ACCESSOR") {