84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 36466d3530b7d918.083c839b6e.js
|
|
* Module id: 521527
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(358379);
|
|
e.i(370357);
|
|
var r = e.i(436178);
|
|
function a(e) {
|
|
if (!e) return null;
|
|
try {
|
|
return JSON.parse(e).modelKey ?? null;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
function n(e) {
|
|
let { missRemark: t } = (function (e) {
|
|
if (!e) return {};
|
|
try {
|
|
return JSON.parse(e);
|
|
} catch {
|
|
return {};
|
|
}
|
|
})(e.showContent);
|
|
return t
|
|
? { benefit: e, missRemark: t, activityEndTime: e.activityEndTime }
|
|
: null;
|
|
}
|
|
function o(e) {
|
|
return new Date(e.endTime) > new Date();
|
|
}
|
|
function i(e) {
|
|
let i = (0, r.commercialStore)((e) => e.activityBenefitList);
|
|
return (0, t.useMemo)(() => {
|
|
if (!e || !i?.length) return null;
|
|
let t = String(e),
|
|
r = Number(e),
|
|
s = !isNaN(r) && r > 0;
|
|
for (let e of i)
|
|
if (
|
|
o(e) &&
|
|
((s && e.modelVersionId === r) ||
|
|
a(e.targetParams) === t ||
|
|
String(e.targetKey) === t)
|
|
)
|
|
return n(e);
|
|
return null;
|
|
}, [e, i]);
|
|
}
|
|
function s(e) {
|
|
let i = (0, r.commercialStore)((e) => e.activityBenefitList);
|
|
return (0, t.useMemo)(() => {
|
|
let t = new Map();
|
|
if (!e?.length || !i?.length) return t;
|
|
let r = new Set(e);
|
|
for (let e of i) {
|
|
if (!o(e)) continue;
|
|
let i = n(e);
|
|
if (!i) continue;
|
|
let s = a(e.targetParams);
|
|
if (s && r.has(s) && !t.has(s)) {
|
|
t.set(s, i);
|
|
continue;
|
|
}
|
|
let l = String(e.targetKey);
|
|
r.has(l) && !t.has(l) && t.set(l, i);
|
|
}
|
|
return t;
|
|
}, [e, i]);
|
|
}
|
|
e.s([
|
|
"useActivityBenefitMatch",
|
|
() => i,
|
|
"useActivityBenefitMatchMap",
|
|
() => s,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|