feat(chat): show first recharge offer in header

This commit is contained in:
2026-07-02 18:45:08 +08:00
parent efd89de0b0
commit 3592c6bb56
14 changed files with 427 additions and 350 deletions
+29
View File
@@ -70,6 +70,27 @@ export class AppStorage {
return SpAsyncUtil.setString(StorageKeys.lastAppInfoReported, todayString);
}
// ---- first recharge offer banner ----
static async getFirstRechargeOfferBannerDismissed(
userId: string | null | undefined,
): Promise<ResultT<boolean>> {
const r = await SpAsyncUtil.getBool(
AppStorage.firstRechargeOfferBannerDismissedKey(userId),
);
if (!r.success) return r;
return Result.ok(r.data === true);
}
static recordFirstRechargeOfferBannerDismissed(
userId: string | null | undefined,
): Promise<ResultT<void>> {
return SpAsyncUtil.setBool(
AppStorage.firstRechargeOfferBannerDismissedKey(userId),
true,
);
}
// ---- internal helpers ----
/**
@@ -87,4 +108,12 @@ export class AppStorage {
if (!r.success) return r;
return Result.ok(r.data === null || r.data !== todayString);
}
private static firstRechargeOfferBannerDismissedKey(
userId: string | null | undefined,
): string {
return `${StorageKeys.firstRechargeOfferBannerDismissed}:${
userId || "anonymous"
}`;
}
}
+1
View File
@@ -32,6 +32,7 @@ export const StorageKeys = {
lastExternalBrowserDialogShown: "last_external_browser_dialog_shown",
lastPwaEventReported: "last_pwa_event_reported",
lastAppInfoReported: "last_app_info_reported",
firstRechargeOfferBannerDismissed: "first_recharge_offer_banner_dismissed",
// payment
pendingPaymentOrder: "pending_payment_order",