feat(payment): support user-bound seven-discount offers
Docker Image / Build and Push Docker Image (push) Successful in 1m55s
Docker Image / Build and Push Docker Image (push) Successful in 1m55s
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user