@@ -5,6 +5,7 @@ import type {
55 ProjectChangeCountriesAction ,
66 ProjectChangeCountryTaxRateFallbackEnabledAction ,
77 ProjectChangeCurrenciesAction ,
8+ ProjectChangeCustomerSearchStatusAction ,
89 ProjectChangeLanguagesAction ,
910 ProjectChangeMessagesConfigurationAction ,
1011 ProjectChangeNameAction ,
@@ -95,6 +96,18 @@ class ProjectUpdateHandler
9596 resource . currencies = currencies ;
9697 }
9798
99+ changeCustomerSearchStatus (
100+ context : RepositoryContext ,
101+ resource : Writable < Project > ,
102+ { status } : ProjectChangeCustomerSearchStatusAction ,
103+ ) {
104+ if ( ! resource . searchIndexing ?. customers ) {
105+ throw new Error ( "Invalid project state" ) ;
106+ }
107+ resource . searchIndexing . customers . status = status ;
108+ resource . searchIndexing . customers . lastModifiedAt = new Date ( ) . toISOString ( ) ;
109+ }
110+
98111 changeLanguages (
99112 context : RepositoryContext ,
100113 resource : Writable < Project > ,
@@ -150,8 +163,20 @@ class ProjectUpdateHandler
150163 changeProductSearchIndexingEnabled (
151164 context : RepositoryContext ,
152165 resource : Writable < Project > ,
153- { enabled } : ProjectChangeProductSearchIndexingEnabledAction ,
166+ { enabled, mode } : ProjectChangeProductSearchIndexingEnabledAction ,
154167 ) {
168+ if ( mode === "ProductsSearch" ) {
169+ if ( ! resource . searchIndexing ?. productsSearch ) {
170+ throw new Error ( "Invalid project state" ) ;
171+ }
172+ resource . searchIndexing . productsSearch . status = enabled
173+ ? "Activated"
174+ : "Deactivated" ;
175+ resource . searchIndexing . productsSearch . lastModifiedAt =
176+ new Date ( ) . toISOString ( ) ;
177+ return ;
178+ }
179+
155180 if ( ! resource . searchIndexing ?. products ) {
156181 throw new Error ( "Invalid project state" ) ;
157182 }
0 commit comments