@@ -13,6 +13,7 @@ import {
1313 getBaselinePreset ,
1414 getCustomAccountData ,
1515 getCustomEventsData ,
16+ getCustomGrantsData ,
1617 getCustomMaintenanceData ,
1718 getCustomNotificationsData ,
1819 getCustomProfileData ,
@@ -26,6 +27,7 @@ import {
2627 saveBaselinePreset ,
2728 saveCustomAccountData ,
2829 saveCustomEventsData ,
30+ saveCustomGrantsData ,
2931 saveCustomMaintenanceData ,
3032 saveCustomNotificationsData ,
3133 saveCustomProfileData ,
@@ -42,6 +44,7 @@ import type {
4244 Account ,
4345 AccountMaintenance ,
4446 Event ,
47+ Grants ,
4548 Notification ,
4649 PermissionType ,
4750 Profile ,
@@ -92,6 +95,9 @@ export const ServiceWorkerTool = () => {
9295 const [ customEventsData , setCustomEventsData ] = React . useState <
9396 Event [ ] | null | undefined
9497 > ( getCustomEventsData ( ) ) ;
98+ const [ customGrantsData , setCustomGrantsData ] = React . useState <
99+ Grants | null | undefined
100+ > ( getCustomGrantsData ( ) ) ;
95101 const [ customMaintenanceData , setCustomMaintenanceData ] = React . useState <
96102 AccountMaintenance [ ] | null | undefined
97103 > ( getCustomMaintenanceData ( ) ) ;
@@ -118,6 +124,7 @@ export const ServiceWorkerTool = () => {
118124
119125 React . useEffect ( ( ) => {
120126 const currentAccountData = getCustomAccountData ( ) ;
127+ const currentGrantsData = getCustomGrantsData ( ) ;
121128 const currentProfileData = getCustomProfileData ( ) ;
122129 const currentUserAccountPermissionsData =
123130 getCustomUserAccountPermissionsData ( ) ;
@@ -128,6 +135,8 @@ export const ServiceWorkerTool = () => {
128135 const currentNotificationsData = getCustomNotificationsData ( ) ;
129136 const hasCustomAccountChanges =
130137 JSON . stringify ( currentAccountData ) !== JSON . stringify ( customAccountData ) ;
138+ const hasCustomGrantsChanges =
139+ JSON . stringify ( currentGrantsData ) !== JSON . stringify ( customGrantsData ) ;
131140 const hasCustomProfileChanges =
132141 JSON . stringify ( currentProfileData ) !== JSON . stringify ( customProfileData ) ;
133142 const hasCustomEventsChanges =
@@ -148,6 +157,7 @@ export const ServiceWorkerTool = () => {
148157
149158 if (
150159 hasCustomAccountChanges ||
160+ hasCustomGrantsChanges ||
151161 hasCustomProfileChanges ||
152162 hasCustomEventsChanges ||
153163 hasCustomMaintenanceChanges ||
@@ -164,6 +174,7 @@ export const ServiceWorkerTool = () => {
164174 customAccountData ,
165175 customEventsData ,
166176 customMaintenanceData ,
177+ customGrantsData ,
167178 customNotificationsData ,
168179 customProfileData ,
169180 customUserAccountPermissionsData ,
@@ -183,8 +194,13 @@ export const ServiceWorkerTool = () => {
183194 saveCustomAccountData ( customAccountData ) ;
184195 }
185196
186- if ( extraPresets . includes ( 'profile:custom' ) && customProfileData ) {
187- saveCustomProfileData ( customProfileData ) ;
197+ if ( extraPresets . includes ( 'profile-grants:custom' ) ) {
198+ if ( customProfileData ) {
199+ saveCustomProfileData ( customProfileData ) ;
200+ }
201+ if ( customGrantsData ) {
202+ saveCustomGrantsData ( customGrantsData ) ;
203+ }
188204 }
189205 if ( extraPresets . includes ( 'events:custom' ) && customEventsData ) {
190206 saveCustomEventsData ( customEventsData ) ;
@@ -238,6 +254,7 @@ export const ServiceWorkerTool = () => {
238254 setSeedsCountMap ( getSeedsCountMap ( ) ) ;
239255 setPresetsCountMap ( getExtraPresetsMap ( ) ) ;
240256 setCustomAccountData ( getCustomAccountData ( ) ) ;
257+ setCustomGrantsData ( getCustomGrantsData ( ) ) ;
241258 setCustomProfileData ( getCustomProfileData ( ) ) ;
242259 setCustomEventsData ( getCustomEventsData ( ) ) ;
243260 setCustomMaintenanceData ( getCustomMaintenanceData ( ) ) ;
@@ -261,6 +278,7 @@ export const ServiceWorkerTool = () => {
261278 setExtraPresets ( [ ] ) ;
262279 setPresetsCountMap ( { } ) ;
263280 setCustomAccountData ( null ) ;
281+ setCustomGrantsData ( null ) ;
264282 setCustomProfileData ( null ) ;
265283 setCustomEventsData ( null ) ;
266284 setCustomMaintenanceData ( null ) ;
@@ -275,6 +293,7 @@ export const ServiceWorkerTool = () => {
275293 saveExtraPresetsMap ( { } ) ;
276294 saveCustomAccountData ( null ) ;
277295 saveCustomProfileData ( null ) ;
296+ saveCustomGrantsData ( null ) ;
278297 saveCustomEventsData ( null ) ;
279298 saveCustomMaintenanceData ( null ) ;
280299 saveCustomNotificationsData ( null ) ;
@@ -492,6 +511,7 @@ export const ServiceWorkerTool = () => {
492511 < ExtraPresetOptions
493512 customAccountData = { customAccountData }
494513 customEventsData = { customEventsData }
514+ customGrantsData = { customGrantsData }
495515 customMaintenanceData = { customMaintenanceData }
496516 customNotificationsData = { customNotificationsData }
497517 customProfileData = { customProfileData }
@@ -504,6 +524,7 @@ export const ServiceWorkerTool = () => {
504524 handlers = { extraPresets }
505525 onCustomAccountChange = { setCustomAccountData }
506526 onCustomEventsChange = { setCustomEventsData }
527+ onCustomGrantsChange = { setCustomGrantsData }
507528 onCustomMaintenanceChange = { setCustomMaintenanceData }
508529 onCustomNotificationsChange = { setCustomNotificationsData }
509530 onCustomProfileChange = { setCustomProfileData }
0 commit comments