Skip to content

Commit 0e7358a

Browse files
committed
Convert checkout to standalone
1 parent 89b9f06 commit 0e7358a

File tree

13 files changed

+34
-90
lines changed

13 files changed

+34
-90
lines changed

apps/demo/src/app/app-routing.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const appRoutes: Routes = [
3939
},
4040
{
4141
path: 'checkout',
42-
loadChildren: () => import('./checkout/checkout.module').then(m => m.CheckoutModule),
42+
loadChildren: () => import('./checkout/checkout.routes').then(m => m.demoCheckoutRoutes),
4343
},
4444
{ path: '404', component: NotFoundComponent },
4545
{

apps/demo/src/app/checkout/checkout-state.module.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { importProvidersFrom } from '@angular/core';
2+
import { EffectsModule } from '@ngrx/effects';
3+
4+
import { CheckoutEffects } from './effects/checkout.effects';
5+
6+
export const provideDemoCheckoutState = () => [
7+
importProvidersFrom(EffectsModule.forFeature([CheckoutEffects])),
8+
];

apps/demo/src/app/checkout/checkout.module.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
import {
2-
NgModule,
2+
importProvidersFrom,
33
inject,
44
} from '@angular/core';
55
import {
66
ActivatedRouteSnapshot,
7-
RouterModule,
8-
RouterStateSnapshot,
97
Routes,
8+
RouterStateSnapshot,
109
} from '@angular/router';
1110

1211
import {
1312
DaffCartInStockItemsGuard,
1413
DaffCartItemsGuard,
15-
DaffCartRoutingModule,
1614
DaffResolveCartGuard,
15+
DaffCartRoutingModule,
1716
} from '@daffodil/cart/routing';
1817
import { daffRouterComposeGuards } from '@daffodil/router';
1918

19+
import { provideDemoCheckoutState } from './checkout-state.provider';
2020
import { DemoCheckoutViewComponent } from './pages/checkout-view/checkout-view.component';
2121
import { ThankYouViewComponent } from '../thank-you/pages/thank-you-view.component';
2222

23-
const routes: Routes = [
23+
export const demoCheckoutRoutes: Routes = [
2424
{
2525
path: '',
2626
pathMatch: 'full',
27+
providers: [
28+
provideDemoCheckoutState(),
29+
importProvidersFrom(DaffCartRoutingModule),
30+
],
2731
children: [
2832
{ path: '', component: DemoCheckoutViewComponent },
2933
{ path: 'thank-you', component: ThankYouViewComponent },
@@ -44,14 +48,3 @@ const routes: Routes = [
4448
],
4549
},
4650
];
47-
48-
@NgModule({
49-
imports: [
50-
RouterModule.forChild(routes),
51-
DaffCartRoutingModule,
52-
],
53-
exports: [
54-
RouterModule,
55-
],
56-
})
57-
export class CheckoutRoutingModule { }

apps/demo/src/app/checkout/components/payment/payment-form/payment-form.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {
1212

1313
import { DaffAuthorizeNetCreditCard } from '@daffodil/authorizenet';
1414
import { DaffCartAddress } from '@daffodil/cart';
15-
import { DaffButtonComponent } from '@daffodil/design/button';
16-
import { DaffCheckboxModule } from '@daffodil/design/checkbox';
15+
import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
16+
import { DAFF_CHECKBOX_COMPONENTS } from '@daffodil/design/checkbox';
1717
import { DaffInputComponent } from '@daffodil/design/input';
1818

1919
import { DemoGeographyAddressSummaryComponent } from '../../../../geography/components/address-summary/address-summary.component';
@@ -31,8 +31,8 @@ import { PaymentInfoFormFactory } from '../payment-info-form/factories/payment-i
3131
ReactiveFormsModule,
3232
DaffInputComponent,
3333
DemoCheckoutPaymentInfoFormComponent,
34-
DaffButtonComponent,
35-
DaffCheckboxModule,
34+
DAFF_BUTTON_COMPONENTS,
35+
DAFF_CHECKBOX_COMPONENTS,
3636
DemoCheckoutAddressFormComponent,
3737
DemoGeographyAddressSummaryComponent,
3838
],

apps/demo/src/app/checkout/components/payment/payment-summary/payment-summary.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { DaffAuthorizeNetCreditCard } from '@daffodil/authorizenet';
1111
selector: 'demo-checkout-payment-summary',
1212
templateUrl: './payment-summary.component.html',
1313
styleUrls: ['./payment-summary.component.scss'],
14-
standalone: true,
1514
})
1615
export class DemoCheckoutPaymentSummaryComponent {
1716
@Input() paymentInfo: DaffAuthorizeNetCreditCard;

apps/demo/src/app/checkout/components/place-order/place-order.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { AsyncPipe } from '@angular/common';
12
import {
23
Component,
34
OnInit,
@@ -9,12 +10,16 @@ import {
910
DaffCartFacade,
1011
DaffCartPlaceOrder,
1112
} from '@daffodil/cart/state';
13+
import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
1214

1315
@Component({
1416
selector: 'demo-place-order',
1517
templateUrl: './place-order.component.html',
1618
styleUrls: ['./place-order.component.scss'],
17-
standalone: false,
19+
imports: [
20+
DAFF_BUTTON_COMPONENTS,
21+
AsyncPipe,
22+
],
1823
})
1924
export class PlaceOrderComponent implements OnInit {
2025
enablePlaceOrderButton$: Observable<boolean>;

apps/demo/src/app/checkout/components/place-order/place-order.module.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

apps/demo/src/app/checkout/components/shipping-address/form/shipping-address-form.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from '@angular/core';
88
import { ReactiveFormsModule } from '@angular/forms';
99

10-
import { DaffButtonComponent } from '@daffodil/design/button';
10+
import { DAFF_BUTTON_COMPONENTS } from '@daffodil/design/button';
1111
import { DaffPersonalAddress } from '@daffodil/geography';
1212

1313
import { DemoCheckoutAddressFormComponent } from '../../forms/address/components/address-form/address-form.component';
@@ -24,7 +24,7 @@ import {
2424
imports: [
2525
DemoCheckoutAddressFormComponent,
2626
ReactiveFormsModule,
27-
DaffButtonComponent,
27+
DAFF_BUTTON_COMPONENTS,
2828
],
2929
})
3030
export class DemoCheckoutShippingAddressFormComponent implements OnInit {

0 commit comments

Comments
 (0)