Skip to content

Commit 31da6ee

Browse files
authored
Revert "feat/CXSPA-9270 CXSPA-7795: Order code and Quote code link in details page" (#20122)
1 parent 5ea9821 commit 31da6ee

File tree

19 files changed

+12
-276
lines changed

19 files changed

+12
-276
lines changed

Diff for: feature-libs/order/assets/translations/en/order.json

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
"placed": "Placed",
1111
"placedBy": "Placed By",
1212
"unit": "Unit",
13-
"quoteCode": "Quote ID {{id}}",
14-
"quoteDetail": "Quote Detail",
1513
"costCenter": "Cost Center",
1614
"costCenterAndUnit": "Cost Center / Unit",
1715
"costCenterAndUnitValue": "{{costCenterName}} / {{unitName}}",

Diff for: feature-libs/order/components/order-details/order-overview/order-overview.component.html

-32
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@
6363
[content]="getOrderStatusCardContent(order.statusDisplay) | async"
6464
></cx-card>
6565

66-
<ng-container
67-
*ngTemplateOutlet="
68-
showQuoteCode;
69-
context: { sapQuoteCode: order.sapQuoteCode }
70-
"
71-
></ng-container>
72-
7366
<ng-template
7467
[cxOutlet]="cartOutlets.ORDER_OVERVIEW"
7568
[cxOutletContext]="{ item: order, readonly: true }"
@@ -160,13 +153,6 @@
160153
[content]="getOrderStatusCardContent(order.statusDisplay) | async"
161154
></cx-card>
162155

163-
<ng-container
164-
*ngTemplateOutlet="
165-
showQuoteCode;
166-
context: { sapQuoteCode: order.sapQuoteCode }
167-
"
168-
></ng-container>
169-
170156
<ng-template
171157
[cxOutlet]="cartOutlets.ORDER_OVERVIEW"
172158
[cxOutletContext]="{ item: order, readonly: true }"
@@ -182,21 +168,3 @@
182168
</div>
183169
</ng-container>
184170
</div>
185-
186-
<ng-template #showQuoteCode let-quoteCode="sapQuoteCode">
187-
<ng-container *cxFeature="'showOrderQuoteLink'">
188-
<div id="quote-container" class="card-body cx-card-body" *ngIf="quoteCode">
189-
<div class="cx-card-title">
190-
{{ 'orderDetails.quoteCode' | cxTranslate: { id: quoteCode } }}
191-
</div>
192-
<a
193-
[routerLink]="
194-
{ cxRoute: 'quoteDetails', params: { quoteId: quoteCode } } | cxUrl
195-
"
196-
class="cx-card-actions"
197-
>
198-
{{ 'orderDetails.quoteDetail' | cxTranslate }}
199-
</a>
200-
</div>
201-
</ng-container>
202-
</ng-template>

Diff for: feature-libs/order/components/order-details/order-overview/order-overview.component.spec.ts

+2-36
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, Pipe, PipeTransform } from '@angular/core';
1+
import { Component, Input } from '@angular/core';
22
import { ComponentFixture, TestBed } from '@angular/core/testing';
33
import { DeliveryMode } from '@spartacus/cart/base/root';
44
import {
@@ -14,7 +14,6 @@ import { EMPTY, Observable, of } from 'rxjs';
1414
import { OrderDetailsService } from '../order-details.service';
1515
import { OrderOverviewComponent } from './order-overview.component';
1616
import { OrderOverviewComponentService } from './order-overview-component.service';
17-
import { MockFeatureDirective } from 'projects/storefrontlib/shared/test/mock-feature-directive';
1817

1918
@Component({
2019
selector: 'cx-card',
@@ -26,14 +25,6 @@ class MockCardComponent {
2625
content: Card;
2726
}
2827

29-
@Pipe({
30-
name: 'cxUrl',
31-
standalone: false,
32-
})
33-
class MockUrlPipe implements PipeTransform {
34-
transform() {}
35-
}
36-
3728
const mockDeliveryAddress: Address = {
3829
firstName: 'John',
3930
lastName: 'Smith',
@@ -163,12 +154,7 @@ describe('OrderOverviewComponent', () => {
163154
beforeEach(() => {
164155
TestBed.configureTestingModule({
165156
imports: [I18nTestingModule],
166-
declarations: [
167-
OrderOverviewComponent,
168-
MockCardComponent,
169-
MockUrlPipe,
170-
MockFeatureDirective,
171-
],
157+
declarations: [OrderOverviewComponent, MockCardComponent],
172158
providers: [
173159
{ provide: TranslationService, useClass: MockTranslationService },
174160
{
@@ -566,24 +552,4 @@ describe('OrderOverviewComponent', () => {
566552
);
567553
});
568554
});
569-
570-
it('should render quote code in UI', () => {
571-
component.order$ = of({ ...mockOrder, sapQuoteCode: '12345' });
572-
fixture.detectChanges();
573-
const quoteContainer =
574-
fixture.nativeElement.querySelector('#quote-container');
575-
expect(quoteContainer).not.toBeNull();
576-
const quoteTemplate = quoteContainer.querySelector('.cx-card-title');
577-
expect(quoteTemplate.textContent).toContain('12345');
578-
const quoteLink = quoteContainer.querySelector('.cx-card-actions');
579-
expect(quoteLink.innerText).toEqual('orderDetails.quoteDetail');
580-
});
581-
582-
it('should not render quote code in UI', () => {
583-
component.order$ = of({ ...mockOrder });
584-
fixture.detectChanges();
585-
const quoteContainer =
586-
fixture.nativeElement.querySelector('#quote-container');
587-
expect(quoteContainer).toBeNull();
588-
});
589555
});

Diff for: feature-libs/order/occ/adapters/occ-order-history.adapter.spec.ts

-31
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
ConverterService,
1313
OccConfig,
1414
OccEndpointsService,
15-
OccFieldsService,
1615
} from '@spartacus/core';
1716
import {
1817
CancellationRequestEntryInputList,
@@ -49,7 +48,6 @@ describe('OccOrderHistoryAdapter', () => {
4948
let httpMock: HttpTestingController;
5049
let converter: ConverterService;
5150
let occEnpointsService: OccEndpointsService;
52-
let occFieldsService: OccFieldsService;
5351

5452
beforeEach(() => {
5553
TestBed.configureTestingModule({
@@ -69,7 +67,6 @@ describe('OccOrderHistoryAdapter', () => {
6967
httpMock = TestBed.inject(HttpTestingController);
7068
converter = TestBed.inject(ConverterService);
7169
occEnpointsService = TestBed.inject(OccEndpointsService);
72-
occFieldsService = TestBed.inject(OccFieldsService);
7370
spyOn(converter, 'pipeable').and.callThrough();
7471
spyOn(converter, 'convert').and.callThrough();
7572
spyOn(occEnpointsService, 'buildUrl').and.callThrough();
@@ -125,42 +122,14 @@ describe('OccOrderHistoryAdapter', () => {
125122
});
126123

127124
describe('getOrder', () => {
128-
it('should fetch a single order without quote code', waitForAsync(() => {
129-
spyOn(
130-
(occOrderHistoryAdapter as any).featureConfigService,
131-
'isEnabled'
132-
).and.returnValue(false);
133-
occOrderHistoryAdapter.load(userId, orderData.code).subscribe();
134-
httpMock.expectOne((req: HttpRequest<any>) => {
135-
return req.method === 'GET';
136-
}, `GET a single order`);
137-
expect(occEnpointsService.buildUrl).toHaveBeenCalledWith('orderDetail', {
138-
urlParams: { userId, orderId: orderData.code },
139-
});
140-
expect(occEnpointsService.buildUrl).not.toHaveBeenCalledWith(
141-
'quoteCode',
142-
{
143-
urlParams: { userId, orderId: orderData.code },
144-
}
145-
);
146-
}));
147125
it('should fetch a single order', waitForAsync(() => {
148-
spyOn(occFieldsService, 'getOptimalUrlGroups').and.callThrough();
149-
spyOn(
150-
(occOrderHistoryAdapter as any).featureConfigService,
151-
'isEnabled'
152-
).and.returnValue(true);
153126
occOrderHistoryAdapter.load(userId, orderData.code).subscribe();
154127
httpMock.expectOne((req: HttpRequest<any>) => {
155128
return req.method === 'GET';
156129
}, `GET a single order`);
157130
expect(occEnpointsService.buildUrl).toHaveBeenCalledWith('orderDetail', {
158131
urlParams: { userId, orderId: orderData.code },
159132
});
160-
expect(occEnpointsService.buildUrl).toHaveBeenCalledWith('quoteCode', {
161-
urlParams: { userId, orderId: orderData.code },
162-
});
163-
expect(occFieldsService.getOptimalUrlGroups).toHaveBeenCalled();
164133
}));
165134

166135
it('should use converter', () => {

Diff for: feature-libs/order/occ/adapters/occ-order-history.adapter.ts

+3-23
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
88
import { Injectable, inject } from '@angular/core';
99
import {
1010
ConverterService,
11-
FeatureConfigService,
1211
InterceptorUtil,
1312
LoggerService,
1413
OCC_USER_ID_ANONYMOUS,
1514
OCC_USER_ID_CURRENT,
1615
Occ,
1716
OccEndpointsService,
18-
OccFieldsService,
19-
ScopedDataWithUrl,
2017
USE_CLIENT_TOKEN,
2118
normalizeHttpError,
2219
} from '@spartacus/core';
@@ -45,8 +42,6 @@ const CONTENT_TYPE_JSON_HEADER = { 'Content-Type': 'application/json' };
4542
@Injectable()
4643
export class OccOrderHistoryAdapter implements OrderHistoryAdapter {
4744
protected logger = inject(LoggerService);
48-
private occFieldsService = inject(OccFieldsService);
49-
private featureConfigService = inject(FeatureConfigService);
5045

5146
constructor(
5247
protected http: HttpClient,
@@ -55,24 +50,9 @@ export class OccOrderHistoryAdapter implements OrderHistoryAdapter {
5550
) {}
5651

5752
public load(userId: string, orderCode: string): Observable<Order> {
58-
const url = this.featureConfigService.isEnabled('showOrderQuoteLink')
59-
? (() => {
60-
const scopes = ['orderDetail', 'quoteCode'];
61-
const scopedDataWithUrls: ScopedDataWithUrl[] = scopes.map(
62-
(scope) => ({
63-
scopedData: { scope, userId, orderCode },
64-
url: this.occEndpoints.buildUrl(scope, {
65-
urlParams: { userId, orderId: orderCode },
66-
}),
67-
})
68-
);
69-
const mergedUrl =
70-
this.occFieldsService.getOptimalUrlGroups(scopedDataWithUrls);
71-
return Object.keys(mergedUrl)[0];
72-
})()
73-
: this.occEndpoints.buildUrl('orderDetail', {
74-
urlParams: { userId, orderId: orderCode },
75-
});
53+
const url = this.occEndpoints.buildUrl('orderDetail', {
54+
urlParams: { userId, orderId: orderCode },
55+
});
7656

7757
let headers = new HttpHeaders();
7858
if (userId === OCC_USER_ID_ANONYMOUS) {

Diff for: feature-libs/order/occ/config/default-occ-order-config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export const defaultOccOrderConfig: OccConfig = {
1313
/* eslint-disable max-len */
1414
orderHistory: 'users/${userId}/orders',
1515
orderDetail: 'users/${userId}/orders/${orderId}?fields=FULL',
16-
quoteCode: 'users/${userId}/orders/${orderId}?fields=sapQuoteCode',
1716
consignmentTracking:
1817
'users/${userId}/orders/${orderCode}/consignments/${consignmentCode}/tracking',
1918
cancelOrder: 'users/${userId}/orders/${orderId}/cancellation',

Diff for: feature-libs/order/occ/model/occ-order-endpoints.model.ts

-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ export interface OrderOccEndpoints {
1919
* @member {string}
2020
*/
2121
orderDetail?: string | OccEndpoint;
22-
/**
23-
* Endpoint for Quote Code associated with the Order. The Quote Code is present if the order was placed from a quote.
24-
*
25-
* @member {string}
26-
*/
27-
quoteCode?: string | OccEndpoint;
2822
/**
2923
* Endpoint for consignment tracking
3024
*

Diff for: feature-libs/order/root/model/order.model.ts

-1
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,4 @@ export interface Order {
142142
user?: Principal;
143143
returnable?: boolean;
144144
cancellable?: boolean;
145-
sapQuoteCode?: string;
146145
}

Diff for: feature-libs/quote/assets/translations/en/quote.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,10 @@
176176
"newCart": "New Cart",
177177
"quotes": "Quotes",
178178
"download": "Download Proposal",
179-
"order": "Order Detail",
180179
"a11y": {
181180
"newCart": "Create new empty cart and navigate to it.",
182181
"quotes": "Navigate to quote search result list.",
183-
"download": "Start downloading a quote proposal",
184-
"order": "Navigate to order associated with this quote"
182+
"download": "Start downloading a quote proposal"
185183
}
186184
},
187185
"list": {

Diff for: feature-libs/quote/components/links/quote-links.component.html

-16
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,6 @@
4040
{{ 'quote.links.download' | cxTranslate }}
4141
</button>
4242
</li>
43-
<ng-container *cxFeature="'showOrderQuoteLink'">
44-
<li *ngIf="quoteDetails.sapOrderCode">
45-
<a
46-
[attr.aria-label]="'quote.links.a11y.order' | cxTranslate"
47-
class="link cx-action-link"
48-
[routerLink]="
49-
{
50-
cxRoute: 'orderDetails',
51-
params: { code: quoteDetails.sapOrderCode },
52-
} | cxUrl
53-
"
54-
>
55-
{{ 'quote.links.order' | cxTranslate }}</a
56-
>
57-
</li>
58-
</ng-container>
5943
</ul>
6044
</section>
6145
</ng-container>

Diff for: feature-libs/quote/components/links/quote-links.component.spec.ts

+1-32
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { createEmptyQuote } from '../../core/testing/quote-test-utils';
3232
import { CommonQuoteTestUtilsService } from '../testing/common-quote-test-utils.service';
3333
import { QuoteLinksComponent } from './quote-links.component';
3434
import createSpy = jasmine.createSpy;
35-
import { MockFeatureDirective } from 'projects/storefrontlib/shared/test/mock-feature-directive';
3635

3736
class MockCartUtilsService implements Partial<CartUtilsService> {
3837
goToNewCart = createSpy();
@@ -58,11 +57,6 @@ const mockQuote: Quote = {
5857
totalPrice: totalPrice,
5958
};
6059

61-
const mockWithOrderCode: Quote = {
62-
...mockQuote,
63-
sapOrderCode: '12345',
64-
};
65-
6660
const mockQuoteAttachment = (): File => {
6761
const blob = new Blob([''], { type: 'application/pdf' });
6862
return blob as File;
@@ -120,7 +114,7 @@ describe('QuoteLinksComponent', () => {
120114
UrlTestingModule,
121115
RouterModule.forRoot(mockRoutes),
122116
],
123-
declarations: [QuoteLinksComponent, MockFeatureDirective],
117+
declarations: [QuoteLinksComponent],
124118
providers: [
125119
{
126120
provide: QuoteFacade,
@@ -325,29 +319,4 @@ describe('QuoteLinksComponent', () => {
325319
});
326320
});
327321
});
328-
329-
describe('order details link', () => {
330-
it('should not show order details link when order code is present', () => {
331-
const anchorElements =
332-
fixture.nativeElement.querySelectorAll('a.cx-action-link');
333-
const orderLink = Array.from(anchorElements).find(
334-
(el: any) => el.innerText.trim() === 'quote.links.order'
335-
);
336-
expect(orderLink).toBeUndefined();
337-
});
338-
it('should show order details link when order code is present', async () => {
339-
mockQuoteDetails$.next(mockWithOrderCode);
340-
fixture.detectChanges();
341-
const anchorElements =
342-
fixture.nativeElement.querySelectorAll('a.cx-action-link');
343-
const orderLink = Array.from(anchorElements).find(
344-
(el: any) => el.innerText.trim() === 'quote.links.order'
345-
);
346-
expect(orderLink).not.toBeUndefined();
347-
expect((orderLink as HTMLAnchorElement).href).toContain(
348-
'cxRoute:orderDetails'
349-
);
350-
expect((orderLink as HTMLAnchorElement).href).toContain('code:12345');
351-
});
352-
});
353322
});

Diff for: feature-libs/quote/components/links/quote-links.module.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,14 @@ import { RouterModule } from '@angular/router';
1010
import {
1111
AuthGuard,
1212
CmsConfig,
13-
FeaturesConfigModule,
1413
I18nModule,
1514
provideDefaultConfig,
1615
UrlModule,
1716
} from '@spartacus/core';
1817
import { QuoteLinksComponent } from './quote-links.component';
1918

2019
@NgModule({
21-
imports: [
22-
CommonModule,
23-
I18nModule,
24-
RouterModule,
25-
UrlModule,
26-
FeaturesConfigModule,
27-
],
20+
imports: [CommonModule, I18nModule, RouterModule, UrlModule],
2821
providers: [
2922
provideDefaultConfig(<CmsConfig>{
3023
cmsComponents: {

0 commit comments

Comments
 (0)