Skip to content
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

fix: (CXSPA-9006) customer service create dialog issues fix #19919

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6a11ca0
fix: (CXSPA-9006) customer service create dialog issues fix
ulates-sap Jan 23, 2025
92fe1fb
Merge branch 'develop' into feature/CXSPA-9006
uroslates Jan 23, 2025
d9753da
fix: (CXSPA-9006) fix ng-select focus issue in customer ticketing dialog
ulates-sap Jan 23, 2025
cdd2874
fix: (CXSPA-9006) fix ng-select form saving issue in customer ticketi…
ulates-sap Jan 23, 2025
e16473a
fix: (CXSPA-9006) fix prettier issues
ulates-sap Jan 23, 2025
5e266c8
Merge branch 'develop' into feature/CXSPA-9006
uroslates Jan 23, 2025
7587b45
fix: (CXSPA-9006) fix dependencies issues
ulates-sap Jan 23, 2025
a9048e2
fix: (CXSPA-9006) fix falied test
ulates-sap Jan 23, 2025
716512a
Merge branch 'develop' into feature/CXSPA-9006
uroslates Jan 23, 2025
9fe7eb4
Merge branch 'develop' into feature/CXSPA-9006
ulates-sap Jan 27, 2025
3570a04
fix: (CXSPA-9006) fix config issues
ulates-sap Jan 27, 2025
701f8f9
Merge branch 'develop' into feature/CXSPA-9006
uroslates Jan 27, 2025
ee9432a
Trigger Build
ulates-sap Jan 27, 2025
a110890
Merge branch 'develop' into feature/CXSPA-9006
uroslates Jan 28, 2025
674d334
fix: (CXSPA-9006) address PR comments - introduce feature flags
ulates-sap Jan 28, 2025
ad30c33
Merge branch 'develop' into feature/CXSPA-9006
uroslates Jan 28, 2025
514b238
fix: (CXSPA-9006) address PR comments
ulates-sap Jan 29, 2025
adc4e00
fix: (CXSPA-9006) address PR comments
ulates-sap Jan 29, 2025
fb31114
Merge branch 'develop' into feature/CXSPA-9006
ulates-sap Jan 29, 2025
c5ac85d
Merge branch 'develop' into feature/CXSPA-9006
uroslates Jan 30, 2025
1eb8fc0
Merge branch 'develop' into feature/CXSPA-9006
ulates-sap Jan 30, 2025
3621afd
Merge branch 'develop' into feature/CXSPA-9006
uroslates Jan 30, 2025
66862a0
fix: (CXSPA-9006) fix e2e test issues
ulates-sap Feb 3, 2025
66bedff
Merge branch 'develop' into feature/CXSPA-9006
uroslates Feb 3, 2025
32ee9cf
fix: (CXSPA-9006) address prettier issues
ulates-sap Feb 3, 2025
f82a180
Merge branch 'develop' into feature/CXSPA-9006
uroslates Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</span>
<textarea
[maxLength]="inputCharactersForSubject"
required="true"
class="form-control"
formControlName="subject"
rows="1"
Expand All @@ -62,7 +63,13 @@
{{ 'createCustomerTicket.category' | cxTranslate }}
<ng-template [ngTemplateOutlet]="requiredAsterisk"></ng-template>
</span>
<select class="form-control" formControlName="ticketCategory">
<select
*cxFeature="
'!a11ySelectImprovementsCustomerTicketingCreateSelectbox'
"
class="form-control"
formControlName="ticketCategory"
>
<option value="" disabled selected>
{{ 'createCustomerTicket.selectCategory' | cxTranslate }}
</option>
Expand All @@ -74,8 +81,27 @@
{{ category.name }}
</option>
</select>
<ng-select
*cxFeature="
'a11ySelectImprovementsCustomerTicketingCreateSelectbox'
"
[inputAttrs]="{ required: 'true' }"
class="ticket-category-select"
id="ticket-category-select"
[searchable]="false"
[clearable]="false"
[items]="ticketCategories"
[placeholder]="'createCustomerTicket.selectCategory' | cxTranslate"
bindLabel="name"
formControlName="ticketCategory"
[cxNgSelectA11y]="{}"
[attr.aria-describedby]="'ticketCategoryError'"
>
</ng-select>

<cx-form-errors
id="ticketCategoryError"
aria-live="off"
[control]="form.get('ticketCategory')"
></cx-form-errors>
</label>
Expand All @@ -87,7 +113,13 @@
<span class="cx-customer-ticket-label label-content">
{{ 'createCustomerTicket.associateTo' | cxTranslate }}
</span>
<select class="form-control" formControlName="associatedTo">
<select
*cxFeature="
'!a11ySelectImprovementsCustomerTicketingCreateSelectbox'
"
class="form-control"
formControlName="associatedTo"
>
<option value="" disabled selected>
{{
'createCustomerTicket.optionallySelectAssociatedObject'
Expand All @@ -105,6 +137,30 @@
{{ associatedObject.code }}
</option>
</select>
<ng-select
StanislavSukhanov marked this conversation as resolved.
Show resolved Hide resolved
*cxFeature="
'a11ySelectImprovementsCustomerTicketingCreateSelectbox'
"
[clearable]="false"
[items]="ticketAssociatedObjects"
[placeholder]="
'createCustomerTicket.optionallySelectAssociatedObject'
| cxTranslate
"
[searchable]="false"
formControlName="associatedTo"
id="associated-to-select"
[cxNgSelectA11y]="{}"
>
<ng-template
ng-option-tmp
let-item="item"
let-search="searchTerm"
let-index="index"
>
<span>{{ item.type + ' ' + item.code }}</span>
</ng-template>
</ng-select>
</label>
</ng-container>

Expand All @@ -114,6 +170,7 @@
<ng-template [ngTemplateOutlet]="requiredAsterisk"></ng-template>
</span>
<textarea
required="true"
[maxLength]="inputCharactersLimit"
class="form-control"
formControlName="message"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import {
FormErrorsModule,
ICON_TYPE,
LaunchDialogService,
NgSelectA11yModule,
} from '@spartacus/storefront';
import { EMPTY, Observable, of, throwError } from 'rxjs';
import { CustomerTicketingCreateDialogComponent } from './customer-ticketing-create-dialog.component';
import createSpy = jasmine.createSpy;
import { NgSelectModule } from '@ng-select/ng-select';

const mockCategories = [
{
Expand Down Expand Up @@ -121,6 +123,8 @@ describe('CustomerTicketingCreateDialogComponent', () => {
ReactiveFormsModule,
FormErrorsModule,
FileUploadModule,
NgSelectModule,
NgSelectA11yModule,
],
declarations: [
CustomerTicketingCreateDialogComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

import { Component, inject, Input, OnDestroy, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import {
FeatureConfigService,
GlobalMessageService,
GlobalMessageType,
HttpErrorModel,
TranslationService,
} from '@spartacus/core';
import {
AssociatedObject,
Category,
Expand All @@ -15,14 +22,8 @@ import {
} from '@spartacus/customer-ticketing/root';
import { FormUtils } from '@spartacus/storefront';
import { Observable, of, Subscription } from 'rxjs';
import { catchError, first, map, tap } from 'rxjs/operators';
import { CustomerTicketingDialogComponent } from '../../../shared/customer-ticketing-dialog/customer-ticketing-dialog.component';
import {
GlobalMessageService,
GlobalMessageType,
HttpErrorModel,
TranslationService,
} from '@spartacus/core';
import { catchError, first, tap } from 'rxjs/operators';

@Component({
selector: 'cx-customer-ticketing-create-dialog',
Expand All @@ -41,6 +42,12 @@ export class CustomerTicketingCreateDialogComponent
);
ticketAssociatedObjects$: Observable<AssociatedObject[]> =
this.customerTicketingFacade.getTicketAssociatedObjects().pipe(
map((ao) =>
ao.map((cao) => ({
...cao,
label: `${cao.type} ${cao.code}`,
}))
),
catchError((error: any) => {
this.handleError(error);
return of([]);
Expand All @@ -60,6 +67,8 @@ export class CustomerTicketingCreateDialogComponent

protected translationService = inject(TranslationService);

protected featureService = inject(FeatureConfigService, { optional: true });

protected getCreateTicketPayload(form: FormGroup): TicketStarter {
return {
message: form?.get('message')?.value,
Expand All @@ -71,6 +80,15 @@ export class CustomerTicketingCreateDialogComponent

ngOnInit(): void {
this.buildForm();

if (
this.featureService?.isEnabled(
'a11ySelectImprovementsCustomerTicketingCreateSelectbox'
)
) {
this.focusConfig.trap = false;
this.focusConfig.trapTabOnly = true;
}
}

protected buildForm(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import {
FormErrorsModule,
IconModule,
KeyboardFocusModule,
NgSelectA11yModule,
} from '@spartacus/storefront';
import { CustomerTicketingCreateDialogComponent } from './customer-ticketing-create-dialog/customer-ticketing-create-dialog.component';
import { CustomerTicketingCreateComponent } from './customer-ticketing-create.component';
import { NgSelectModule } from '@ng-select/ng-select';

@NgModule({
imports: [
Expand All @@ -27,6 +29,8 @@ import { CustomerTicketingCreateComponent } from './customer-ticketing-create.co
FormErrorsModule,
FileUploadModule,
FeaturesConfigModule,
NgSelectModule,
NgSelectA11yModule,
],
declarations: [
CustomerTicketingCreateComponent,
Expand Down
1 change: 1 addition & 0 deletions feature-libs/customer-ticketing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@angular/core": "^19.0.3",
"@angular/forms": "^19.0.3",
"@angular/router": "^19.0.3",
"@ng-select/ng-select": "^14.1.0",
"@spartacus/cart": "2211.35.0-1",
"@spartacus/core": "2211.35.0-1",
"@spartacus/schematics": "2211.35.0-1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,14 @@ export interface FeatureTogglesInterface {
*/
a11yNgSelectCloseDropdownOnEscape?: boolean;

/**
* 'NgSelectA11yDirective' will close a dropdown with options on Escape key press
* when a screen reader is used.
* Replaces select with ng-select component in the following component:
* `CustomerTicketingCreateDialogComponent`
*/
a11ySelectImprovementsCustomerTicketingCreateSelectbox?: boolean;

/**
* Removes duplicated error message from 'CancelOrderComponent'.
*/
Expand Down Expand Up @@ -1084,6 +1092,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yDeliveryModeRadiogroup: false,
a11yNgSelectOptionsCount: false,
a11yNgSelectCloseDropdownOnEscape: false,
a11ySelectImprovementsCustomerTicketingCreateSelectbox: false,
a11yRepeatedCancelOrderError: false,
a11yAddedToCartActiveDialog: false,
a11yNgSelectMobileReadout: false,
Expand Down
1 change: 1 addition & 0 deletions projects/schematics/src/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"@angular/core": "^19.0.3",
"@angular/forms": "^19.0.3",
"@angular/router": "^19.0.3",
"@ng-select/ng-select": "^14.1.0",
"@spartacus/cart": "2211.35.0-1",
"@spartacus/core": "2211.35.0-1",
"@spartacus/schematics": "2211.35.0-1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ if (environment.cpq) {
*/
a11yNgSelectOptionsCount: false,
a11yNgSelectCloseDropdownOnEscape: true,
a11ySelectImprovementsCustomerTicketingCreateSelectbox: true,
a11yRepeatedCancelOrderError: true,
a11yAddedToCartActiveDialog: true,
a11yNgSelectMobileReadout: true,
Expand Down
Loading