feat(chat): show first recharge offer in header
This commit is contained in:
@@ -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"
|
||||
}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user