139 lines
4.5 KiB
JavaScript
139 lines
4.5 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 495c32611aa3cc4b.f38a372c79.js
|
|
* Module id: 547632
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(462214),
|
|
n = e.i(358379),
|
|
o = e.i(963527),
|
|
i = e.i(50721),
|
|
r = e.i(841183);
|
|
e.i(606823);
|
|
var a = e.i(687517);
|
|
e.i(370357);
|
|
var s = e.i(185264),
|
|
l = e.i(586011),
|
|
d = e.i(284309),
|
|
u = e.i(777784),
|
|
c = e.i(211478),
|
|
f = e.i(542703),
|
|
p = e.i(677588);
|
|
let m = "vipModalPendingAfterLogin",
|
|
h = (0, l.default)(() => e.A(899249).then((e) => e.VipModel), {
|
|
loadableGenerated: { modules: [17482] },
|
|
ssr: !1,
|
|
}),
|
|
v = (0, l.default)(() => e.A(899249).then((e) => e.PopGuideHub), {
|
|
loadableGenerated: { modules: [17482] },
|
|
ssr: !1,
|
|
});
|
|
function x() {
|
|
let { isLogin: e } = (0, a.useLoginHook)(),
|
|
l = (0, d.useRouter)(),
|
|
x = (0, d.usePathname)(),
|
|
E = (0, d.useSearchParams)(),
|
|
{ syncVipInfo: C } = (0, s.useUserVipInfo)(),
|
|
{ fetchInitData: g } = (0, i.useCommercialInitData)(),
|
|
{ checkIfInTimelimit: _ } = (0, r.useTimelimitHooks)(),
|
|
{ openLogin: b } = (0, c.useLogin)();
|
|
(0, p.useReportLogReceiver)(), (0, f.useLibtvRefreshVipAfterPayment)(!!e);
|
|
let y = (0, n.useRef)(null),
|
|
S = (0, n.useRef)(!1),
|
|
j = (0, n.useRef)(!1),
|
|
[k, A] = (0, n.useState)(!1),
|
|
O = (0, n.useRef)(!1),
|
|
N = (0, n.useCallback)(() => {
|
|
if (!S.current || !j.current) return;
|
|
let e = (function () {
|
|
try {
|
|
let e = sessionStorage.getItem(m);
|
|
if (!e) return null;
|
|
return sessionStorage.removeItem(m), JSON.parse(e);
|
|
} catch {
|
|
return sessionStorage.removeItem(m), null;
|
|
}
|
|
})();
|
|
e && (0, o.openVipModel)(e);
|
|
}, []);
|
|
(0, n.useEffect)(() => {
|
|
let e = (e) => {
|
|
try {
|
|
if (!e.data) return;
|
|
let t =
|
|
"object" == typeof e.data ? e.data : JSON.parse(String(e.data));
|
|
("show_purchase_dialog" === t.type ||
|
|
"show_train_purchase_dialog" === t.type) &&
|
|
(y.current = t.data ?? {}),
|
|
"onLoadPageFinished" === t.type && ((S.current = !0), A(!0), N());
|
|
} catch {}
|
|
};
|
|
return (
|
|
window.addEventListener("message", e),
|
|
() => window.removeEventListener("message", e)
|
|
);
|
|
}, [N]),
|
|
(0, n.useEffect)(() => {
|
|
e && (C(), _(), (j.current = !0), N()), g();
|
|
}, [e]),
|
|
(0, n.useEffect)(() => {
|
|
let e = E?.get("paywall");
|
|
if (
|
|
!k ||
|
|
O.current ||
|
|
("personal" !== e &&
|
|
"team" !== e &&
|
|
"group" !== e &&
|
|
"team-yearly" !== e)
|
|
)
|
|
return;
|
|
(O.current = !0),
|
|
(0, o.openVipModel)({ intent: "purchase_vip", paywall: e });
|
|
let t = new URLSearchParams(E?.toString() ?? "");
|
|
t.delete("paywall");
|
|
let n = t.toString();
|
|
l.replace(n ? `${x}?${n}` : x, { scroll: !1 });
|
|
}, [E, k, l, x]),
|
|
(0, n.useEffect)(() => {
|
|
let e = E?.get("powerCharge");
|
|
if (!k || O.current || ("general" !== e && "modelPointsCard" !== e))
|
|
return;
|
|
(O.current = !0),
|
|
(0, o.openVipModel)({
|
|
intent: "purchase_vip",
|
|
isShowChargePop: !0,
|
|
chargeType: "general" === e ? 1 : 2,
|
|
});
|
|
let t = new URLSearchParams(E?.toString() ?? "");
|
|
t.delete("powerCharge");
|
|
let n = t.toString();
|
|
l.replace(n ? `${x}?${n}` : x, { scroll: !1 });
|
|
}, [E, k, l, x]);
|
|
let T = (0, n.useCallback)(() => {
|
|
try {
|
|
var e = y.current ?? {};
|
|
try {
|
|
sessionStorage.setItem(m, JSON.stringify(e));
|
|
} catch {}
|
|
} catch {}
|
|
b();
|
|
}, [b]);
|
|
return (0, t.jsxs)(t.Fragment, {
|
|
children: [
|
|
(0, t.jsx)(h, {
|
|
isTrainSku: !1,
|
|
openSource: "webui",
|
|
onLoginRequired: T,
|
|
onCheckSuccess: (e) => u.Notify.success(e),
|
|
}),
|
|
(0, t.jsx)(v, { isPopGuideExcluded: !1, guideConfigId: "200" }),
|
|
],
|
|
});
|
|
}
|
|
e.s(["default", () => x], 547632);
|
|
};
|
|
|
|
export default moduleFactory;
|