MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / buildLuckmailPurchaseView

Function buildLuckmailPurchaseView

background.js:2192–2224  ·  view source on GitHub ↗
(purchase, state = {})

Source from the content-addressed store, hash-verified

2190}
2191
2192function buildLuckmailPurchaseView(purchase, state = {}) {
2193 const normalizedPurchase = normalizeLuckmailPurchase(purchase);
2194 const usedPurchases = getLuckmailUsedPurchases(state);
2195 const preserveTagInfo = getLuckmailPreserveTagInfo(state);
2196
2197 return {
2198 id: normalizedPurchase.id,
2199 email_address: normalizedPurchase.email_address,
2200 project_name: normalizeLuckmailProjectName(normalizedPurchase.project_name) || DEFAULT_LUCKMAIL_PROJECT_CODE,
2201 price: normalizedPurchase.price,
2202 status: normalizedPurchase.status,
2203 tag_id: normalizedPurchase.tag_id,
2204 tag_name: normalizedPurchase.tag_name,
2205 user_disabled: normalizedPurchase.user_disabled,
2206 warranty_hours: normalizedPurchase.warranty_hours,
2207 warranty_until: normalizedPurchase.warranty_until,
2208 created_at: normalizedPurchase.created_at,
2209 used: Boolean(usedPurchases[normalizeLuckmailPurchaseId(normalizedPurchase.id)]),
2210 preserved: isLuckmailPurchasePreserved(normalizedPurchase, {
2211 preserveTagId: preserveTagInfo.id,
2212 preserveTagName: preserveTagInfo.name,
2213 }),
2214 disabled: normalizedPurchase.user_disabled === 1,
2215 current: Number(getCurrentLuckmailPurchase(state)?.id) === normalizedPurchase.id,
2216 reusable: isLuckmailPurchaseReusable(normalizedPurchase, {
2217 projectCode: DEFAULT_LUCKMAIL_PROJECT_CODE,
2218 usedPurchases,
2219 preserveTagId: preserveTagInfo.id,
2220 preserveTagName: preserveTagInfo.name,
2221 now: Date.now(),
2222 }),
2223 };
2224}
2225
2226async function getAllLuckmailPurchases(state, options = {}) {
2227 const client = options.client || createLuckmailClient(state);

Tested by

no test coverage detected