Skip to content

feat: initial structure for components and b2b flow #20103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 26, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { Card, ICON_TYPE } from '@spartacus/storefront';
import { combineLatest, Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { CheckoutStepService } from '../services/checkout-step.service';
import '@spartacus/checkout/b2b/root';

@Component({
selector: 'cx-review-submit',
Expand All @@ -37,6 +38,7 @@ export class CheckoutReviewSubmitComponent {
readonly cartOutlets = CartOutlets;
iconTypes = ICON_TYPE;

checkoutStepTypePaymentType = CheckoutStepType.PAYMENT_TYPE;
checkoutStepTypeDeliveryAddress = CheckoutStepType.DELIVERY_ADDRESS;
checkoutStepTypePaymentDetails = CheckoutStepType.PAYMENT_DETAILS;
checkoutStepTypeDeliveryMode = CheckoutStepType.DELIVERY_MODE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const enum CheckoutStepType {
DELIVERY_MODE = 'deliveryMode',
PAYMENT_DETAILS = 'paymentDetails',
REVIEW_ORDER = 'reviewOrder',
// TODO: Add augmentation from OPF LIB
OPF_PAYMENT_AND_REVIEW = 'opfPaymentAndReview',
}

export const enum CheckoutStepState {
Expand Down
2 changes: 1 addition & 1 deletion integration-libs/opf/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $opf-components-allowlist: cx-opf-payment-method-details,
cx-opf-checkout-billing-address-form, cx-opf-checkout-payment-wrapper,
cx-opf-checkout-terms-and-conditions-alert, cx-opf-error-modal,
cx-opf-cta-element, cx-opf-google-pay, cx-opf-apple-pay,
cx-opf-quick-buy-buttons !default;
cx-opf-quick-buy-buttons, cx-opf-b2b-checkout-payment-type !default;

$skipComponentStyles: () !default;

Expand Down
1 change: 1 addition & 0 deletions integration-libs/opf/base/root/model/opf-base.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface OpfActiveConfiguration {
displayName?: string;
acquirerCountryCode?: string;
logoUrl?: string;
code?: string;
}

export interface OpfActiveConfigurationsPagination {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
"opfCheckout": {
"tabs": {
"paymentType": "Method of payment",
"shipping": "Shipping",
"deliveryMethod": "Delivery Method",
"paymentAndReview": "Payment & Review"
},
"paymentAndReviewTitle": "Payment and review",
"billingAddress": "Billing Address",
"paymentOption": "Payment option",
"paymentMethod": "Method of Payment",
"noPaymentMethod": "No payment method selected",
"editCardDefaultLabel": "Edit",
"editPaymentMethod": "Edit payment method",
"poNumber": "Purchase Order Number",
"noPoNumber": "None",
"editPoNumber": "Edit purchase order number",
"termsAndConditions": "Terms & Conditions",
"closeTermsAndConditionsAlert": "Close alert",
"itemsToBeShipped": "Items to be shipped",
Expand Down
8 changes: 8 additions & 0 deletions integration-libs/opf/checkout/components/b2b/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2025 SAP Spartacus team <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

export * from './opf-b2b-checkout-components.module';
export * from './opf-b2b-checkout-payment-type/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* SPDX-FileCopyrightText: 2025 SAP Spartacus team <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

import { NgModule } from '@angular/core';

import { OpfB2bCheckoutPaymentTypeModule } from './opf-b2b-checkout-payment-type';

@NgModule({
imports: [OpfB2bCheckoutPaymentTypeModule],
})
export class OpfB2bCheckoutComponentsModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2025 SAP Spartacus team <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

export * from './opf-b2b-checkout-payment-type.component';
export * from './opf-b2b-checkout-payment-type.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<h2 class="cx-checkout-title d-none d-lg-block d-xl-block">
{{ 'checkoutB2B.methodOfPayment.paymentType' | cxTranslate }}
</h2>
<ng-container
*ngIf="(typeSelected$ | async) && !(isUpdating$ | async); else loading"
>
<ng-container>
<div
*cxFeature="'!a11yRemoveStatusLoadedRole'"
role="status"
[attr.aria-label]="'common.loaded' | cxTranslate"
></div>
<div class="row">
<div class="col-md-12 col-lg-6">
<label>
<span class="label-content">{{
'checkoutB2B.poNumber' | cxTranslate
}}</span>
<input
#poNumber
class="form-control"
formControlName="poNumber"
type="text"
placeholder="{{ 'checkoutB2B.placeholder' | cxTranslate }}"
/>
</label>
</div>
</div>

<cx-opf-checkout-payments
[isHeadingDisplayed]="false"
[isPaymentRenderBelow]="false"
[isPaymentInfoMessageEnabled]="false"
(paymentChange)="handlePaymentChange($event)"
></cx-opf-checkout-payments>

<div class="cx-checkout-btns row">
<div class="col-md-12 col-lg-6">
<button class="btn btn-block btn-secondary" (click)="back()">
{{ 'checkout.backToCart' | cxTranslate }}
</button>
</div>
<div class="col-md-12 col-lg-6">
<button class="btn btn-block btn-primary" (click)="next()">
{{ 'common.continue' | cxTranslate }}
</button>
</div>
</div>
</ng-container>
</ng-container>
<ng-template #loading>
<div class="cx-spinner" *ngIf="!paymentTypesError">
<cx-spinner></cx-spinner>
</div>
</ng-template>
Loading