feat(payment): support user-bound seven-discount offers
Docker Image / Build and Push Docker Image (push) Successful in 1m55s

This commit is contained in:
Codex
2026-07-23 16:11:20 +08:00
parent 02f6964484
commit 4dae805a88
39 changed files with 418 additions and 28 deletions
+20 -5
View File
@@ -35,24 +35,30 @@ function initializeCatalogState(
planCatalog === "tip" &&
((event.category ?? null) !== context.selectedGiftCategory ||
(event.planId ?? null) !== (context.selectedPlanId || null));
const commercialOfferId =
planCatalog === "default" ? (event.commercialOfferId ?? null) : null;
const offerChanged = commercialOfferId !== context.commercialOfferId;
return {
planCatalog,
...(event.payChannel ? { payChannel: event.payChannel } : {}),
giftCharacterId,
commercialOfferId,
requestedGiftCategory:
planCatalog === "tip" ? (event.category ?? null) : null,
requestedGiftPlanId:
planCatalog === "tip" ? (event.planId ?? null) : null,
...(catalogChanged || characterChanged || selectionChanged
...(catalogChanged || characterChanged || selectionChanged || offerChanged
? {
...resetOrderState(),
plans: [],
giftCategories: [],
giftProducts: [],
selectedGiftCategory: null,
selectedPlanId: "",
selectedPlanId:
planCatalog === "default" ? (event.planId ?? "") : "",
isFirstRecharge: false,
commercialOffer: null,
autoRenew: planCatalog !== "tip",
}
: {}),
@@ -207,7 +213,10 @@ export const loadingCachedPlansState =
catalogMachineSetup.createStateConfig({
invoke: {
src: "loadCachedPlans",
input: ({ context }) => ({ catalog: context.planCatalog }),
input: ({ context }) => ({
catalog: context.planCatalog,
commercialOfferId: context.commercialOfferId,
}),
onDone: [
{
guard: ({ event }) => (event.output?.plans.length ?? 0) > 0,
@@ -223,7 +232,10 @@ export const loadingCachedPlansState =
export const loadingPlansState = catalogMachineSetup.createStateConfig({
invoke: {
src: "refreshPlans",
input: ({ context }) => ({ catalog: context.planCatalog }),
input: ({ context }) => ({
catalog: context.planCatalog,
commercialOfferId: context.commercialOfferId,
}),
onDone: {
target: "ready",
actions: hydratePlansAction,
@@ -238,7 +250,10 @@ export const loadingPlansState = catalogMachineSetup.createStateConfig({
export const refreshingPlansState = catalogMachineSetup.createStateConfig({
invoke: {
src: "refreshPlans",
input: ({ context }) => ({ catalog: context.planCatalog }),
input: ({ context }) => ({
catalog: context.planCatalog,
commercialOfferId: context.commercialOfferId,
}),
onDone: {
target: "ready",
actions: refreshPlansAction,