84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: fb331b08bcf9fa6e.3b67e0d42a.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 o(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 i(e) {
|
|
return new Date(e.endTime) > new Date();
|
|
}
|
|
function a(e) {
|
|
let a = (0, r.commercialStore)((e) => e.activityBenefitList);
|
|
return (0, t.useMemo)(() => {
|
|
if (!e || !a?.length) return null;
|
|
let t = String(e),
|
|
r = Number(e),
|
|
l = !isNaN(r) && r > 0;
|
|
for (let e of a)
|
|
if (
|
|
i(e) &&
|
|
((l && e.modelVersionId === r) ||
|
|
o(e.targetParams) === t ||
|
|
String(e.targetKey) === t)
|
|
)
|
|
return n(e);
|
|
return null;
|
|
}, [e, a]);
|
|
}
|
|
function l(e) {
|
|
let a = (0, r.commercialStore)((e) => e.activityBenefitList);
|
|
return (0, t.useMemo)(() => {
|
|
let t = new Map();
|
|
if (!e?.length || !a?.length) return t;
|
|
let r = new Set(e);
|
|
for (let e of a) {
|
|
if (!i(e)) continue;
|
|
let a = n(e);
|
|
if (!a) continue;
|
|
let l = o(e.targetParams);
|
|
if (l && r.has(l) && !t.has(l)) {
|
|
t.set(l, a);
|
|
continue;
|
|
}
|
|
let s = String(e.targetKey);
|
|
r.has(s) && !t.has(s) && t.set(s, a);
|
|
}
|
|
return t;
|
|
}, [e, a]);
|
|
}
|
|
e.s([
|
|
"useActivityBenefitMatch",
|
|
() => a,
|
|
"useActivityBenefitMatchMap",
|
|
() => l,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|