big boi refactor to customer inof from passenger info

This commit is contained in:
user
2025-10-20 21:46:26 +03:00
parent 2cc0ca4c51
commit 2fdb934ec9
53 changed files with 702 additions and 2068 deletions

View File

@@ -1,4 +1,4 @@
import { get } from "svelte/store";
import { page } from "$app/state";
import {
CKActionType,
SessionOutcome,
@@ -6,25 +6,25 @@ import {
type PendingAction,
type PendingActions,
} from "$lib/domains/ckflow/data/entities";
import { trpcApiStore } from "$lib/stores/api";
import { toast } from "svelte-sonner";
import { flightTicketStore } from "$lib/domains/ticket/data/store";
import {
customerInfoModel,
type CustomerInfo,
} from "$lib/domains/passengerinfo/data/entities";
import { passengerInfoVM } from "$lib/domains/passengerinfo/view/passenger.info.vm.svelte";
import { paymentInfoVM } from "$lib/domains/ticket/view/checkout/payment-info-section/payment.info.vm.svelte";
import { ticketCheckoutVM } from "$lib/domains/ticket/view/checkout/flight-checkout.vm.svelte";
import type { PaymentDetailsPayload } from "$lib/domains/paymentinfo/data/entities";
import { PaymentMethod } from "$lib/domains/paymentinfo/data/entities";
import {
CheckoutStep,
type FlightPriceDetails,
} from "$lib/domains/ticket/data/entities";
import { PaymentMethod } from "$lib/domains/paymentinfo/data/entities";
import { page } from "$app/state";
import { ClientLogger } from "@pkg/logger/client";
import { flightTicketStore } from "$lib/domains/ticket/data/store";
import { ticketCheckoutVM } from "$lib/domains/ticket/view/checkout/flight-checkout.vm.svelte";
import { billingDetailsVM } from "$lib/domains/ticket/view/checkout/payment-info-section/billing.details.vm.svelte";
import {
passengerPIIModel,
type PassengerPII,
} from "$lib/domains/passengerinfo/data/entities";
import type { PaymentDetailsPayload } from "$lib/domains/paymentinfo/data/entities";
import { paymentInfoVM } from "$lib/domains/ticket/view/checkout/payment-info-section/payment.info.vm.svelte";
import { trpcApiStore } from "$lib/stores/api";
import { ClientLogger } from "@pkg/logger/client";
import { toast } from "svelte-sonner";
import { get } from "svelte/store";
class ActionRunner {
async run(actions: PendingActions) {
@@ -248,7 +248,7 @@ export class CKFlowViewModel {
this.setupDone = true;
}
debouncePersonalInfoSync(personalInfo: PassengerPII) {
debouncePersonalInfoSync(personalInfo: CustomerInfo) {
this.clearPersonalInfoDebounce();
this.personalInfoDebounceTimer = setTimeout(() => {
this.syncPersonalInfo(personalInfo);
@@ -276,12 +276,12 @@ export class CKFlowViewModel {
);
}
isPersonalInfoValid(personalInfo: PassengerPII): boolean {
const parsed = passengerPIIModel.safeParse(personalInfo);
isPersonalInfoValid(personalInfo: CustomerInfo): boolean {
const parsed = customerInfoModel.safeParse(personalInfo);
return !parsed.error && !!parsed.data;
}
async syncPersonalInfo(personalInfo: PassengerPII) {
async syncPersonalInfo(personalInfo: CustomerInfo) {
if (!this.flowId || !this.setupDone) {
return;
}