feat: replace desktop membership with permanent point wallet

This commit is contained in:
2026-09-22 11:43:04 +08:00
parent 2f82b9f79c
commit a1cce428af
24 changed files with 1343 additions and 1707 deletions

View File

@@ -187,37 +187,6 @@ export type WorksSpeechTranscriptionInput = {
model?: string;
};
export type WorksTokenPointBalance = {
plan_code: string | null;
plan_name: string | null;
cycle_start: string | null;
cycle_end: string | null;
next_refresh_at: string | null;
weekly_allowance: string | null;
weekly_used: string | null;
weekly_reserved: string | null;
weekly_remaining: string | null;
permanent_total: string | null;
permanent_used: string | null;
permanent_reserved: string | null;
permanent_remaining: string | null;
total_remaining: string | null;
entitlement_source: 'self' | 'family_owner' | 'shared_group';
family_shared: boolean;
can_manage_membership: boolean;
upgrade_action: 'self_service' | 'contact_family_owner';
shared_available: boolean | null;
};
export type WorksResetCard = {
id: string;
status: 'available' | 'expired' | 'redeemed';
granted_at: string;
expires_at: string;
redeemed_at: string | null;
redeemed_cycle_id: string | null;
};
export type PlazaCard = {
id: string;
title: string;
@@ -424,46 +393,6 @@ export async function fetchMyWorksProjects(
return assertSuccess(response, 'page', 'Failed to load your Works Square projects');
}
export async function fetchWorksTokenPointBalance(accessToken: string): Promise<WorksTokenPointBalance> {
const response = await hostApiFetch<WorksActionResponse<'points', WorksTokenPointBalance>>(
'/api/works/billing/points',
{
headers: {
'X-NianCode-Access-Token': accessToken,
},
},
);
return assertSuccess(response, 'points', 'Failed to load Works Square token points');
}
export async function fetchWorksResetCards(accessToken: string): Promise<WorksResetCard[]> {
const response = await hostApiFetch<WorksActionResponse<'cards', WorksResetCard[]>>(
'/api/works/billing/reset-cards',
{
headers: {
'X-NianCode-Access-Token': accessToken,
},
},
);
return assertSuccess(response, 'cards', 'Failed to load Works Square reset cards');
}
export async function redeemWorksResetCard(
accessToken: string,
cardId: string,
): Promise<WorksResetCard> {
const response = await hostApiFetch<WorksActionResponse<'card', WorksResetCard>>(
`/api/works/billing/reset-cards/${encodeURIComponent(cardId)}/redeem`,
{
method: 'POST',
headers: {
'X-NianCode-Access-Token': accessToken,
},
},
);
return assertSuccess(response, 'card', 'Failed to redeem Works Square reset card');
}
export async function fetchMyWorksProjectStatus(
accessToken: string,
appId: string,