cleanup: ckflow, order, checkout page

This commit is contained in:
user
2025-10-21 16:21:26 +03:00
parent de2fbd41d6
commit 49abd1246b
7 changed files with 62 additions and 42 deletions

View File

@@ -1,4 +1,6 @@
<script lang="ts">
import Title from "$lib/components/atoms/title.svelte";
import { checkoutSessionIdStore } from "$lib/domains/checkout/sid.store";
import { onMount } from "svelte";
import { toast } from "svelte-sonner";
import type { PageData } from "./$types";
@@ -7,17 +9,37 @@
onMount(() => {
toast("Do the check here to then either redirect or show the error");
if (data.error) {
return;
}
setTimeout(() => {
toast("redirect to checkout naw");
if (!data.data) {
toast.error("An error occurred during checkout", {
description: "Please try again later or contact support",
});
return;
}
toast("Please hold...", {
description: "Preparing checkout session",
});
window.location.replace(
`/checkout/${$checkoutSessionIdStore}/${data.data.id}`,
);
}, 3000);
});
</script>
{#if data.data}
<span>
Either show the user the product as being valid and redirecting them to
the checkout
</span>
{:else}
<span>Show the user an error around "page not found" or "expired link"</span>
{/if}
<div class="flex w-full flex-col items-center justify-center gap-8 p-20">
{#if data.data}
<Title size="h3" weight="medium">{data.data.title}</Title>
<p>{data.data.description}</p>
<span>
Either show the user the product as being valid and redirecting them
to the checkout
</span>
{:else}
<span
>Show the user an error around "page not found" or "expired link"</span
>
{/if}
</div>

View File

@@ -3,18 +3,17 @@
import Title from "$lib/components/atoms/title.svelte";
import MaxWidthWrapper from "$lib/components/molecules/max-width-wrapper.svelte";
import Button from "$lib/components/ui/button/button.svelte";
import CheckoutConfirmationSection from "$lib/domains/checkout/checkout-confirmation-section.svelte";
import CheckoutLoadingSection from "$lib/domains/checkout/checkout-loading-section.svelte";
import CheckoutStepsIndicator from "$lib/domains/checkout/checkout-steps-indicator.svelte";
import { checkoutVM } from "$lib/domains/checkout/checkout.vm.svelte";
import InitialInfoSection from "$lib/domains/checkout/initial-info-section.svelte";
import PaymentInfoSection from "$lib/domains/checkout/payment-info-section/index.svelte";
import PaymentSummary from "$lib/domains/checkout/payment-summary.svelte";
import PaymentVerificationSection from "$lib/domains/checkout/payment-verification-section.svelte";
import { ckFlowVM } from "$lib/domains/ckflow/view/ckflow.vm.svelte";
import { CheckoutStep } from "$lib/domains/order/data/entities";
import { flightTicketStore } from "$lib/domains/ticket/data/store";
import CheckoutConfirmationSection from "$lib/domains/ticket/view/checkout/checkout-confirmation-section.svelte";
import CheckoutLoadingSection from "$lib/domains/ticket/view/checkout/checkout-loading-section.svelte";
import CheckoutStepsIndicator from "$lib/domains/ticket/view/checkout/checkout-steps-indicator.svelte";
import { checkoutVM } from "$lib/domains/ticket/view/checkout/checkout.vm.svelte";
import InitialInfoSection from "$lib/domains/ticket/view/checkout/initial-info-section.svelte";
import PaymentInfoSection from "$lib/domains/ticket/view/checkout/payment-info-section/index.svelte";
import PaymentSummary from "$lib/domains/ticket/view/checkout/payment-summary.svelte";
import PaymentVerificationSection from "$lib/domains/ticket/view/checkout/payment-verification-section.svelte";
import UpdatePriceDialog from "$lib/domains/ticket/view/checkout/update-price-dialog.svelte";
import { onDestroy, onMount } from "svelte";
import { toast } from "svelte-sonner";
import SearchIcon from "~icons/solar/magnifer-linear";
@@ -46,8 +45,6 @@
});
</script>
<UpdatePriceDialog />
<div class="grid h-full w-full place-items-center">
<MaxWidthWrapper cls="p-4 md:p-8 lg:p-10 3xl:p-0">
{#if !pageData.data || !!pageData.error}