@@ -38,7 +38,7 @@ function hashLicenseKey(key) {
3838}
3939
4040// Helper function to handle gating for direct menu commands
41- function ensureDirectCommandGate ( commandName , executeCommand , preferences , UUID ) {
41+ function ensureDirectCommandGate ( commandName , executeCommand , preferences , UUID , license ) {
4242 if ( shouldShowCountdown ( ) ) {
4343 // Show UI with countdown for unlicensed users
4444 figma . showUI ( __html__ , { width : 360 , height : UI_HEIGHT } )
@@ -50,7 +50,8 @@ function ensureDirectCommandGate(commandName, executeCommand, preferences, UUID)
5050 type : 'init-direct' ,
5151 UUID : UUID ,
5252 cmd : commandName ,
53- preferences : preferences
53+ preferences : preferences ,
54+ license : license
5455 } )
5556
5657 // Then send countdown start message
@@ -167,7 +168,8 @@ Storage.getMultiple([
167168 type : 'init-hidden' ,
168169 UUID : UUID ,
169170 cmd : cmd ,
170- preferences : preferences
171+ preferences : preferences ,
172+ license : license
171173 } )
172174
173175 // Command triggered by user
@@ -176,28 +178,28 @@ Storage.getMultiple([
176178 ensureDirectCommandGate ( 'rename' , ( ) => {
177179 cmdRename ( preferences . rename_strategy , preferences . start_name , preferences . layout_paradigm || 'rows' )
178180 figma . notify ( 'Super Tidy: Rename' )
179- } , preferences , UUID )
181+ } , preferences , UUID , license )
180182 } else
181183 if ( cmd == 'reorder' ) {
182184 // RUNS WITH COUNTDOWN GATE
183185 ensureDirectCommandGate ( 'reorder' , ( ) => {
184186 cmdReorder ( preferences . layout_paradigm || 'rows' )
185187 figma . notify ( 'Super Tidy: Reorder' )
186- } , preferences , UUID )
188+ } , preferences , UUID , license )
187189 } else
188190 if ( cmd == 'tidy' ) {
189191 // RUNS WITH COUNTDOWN GATE
190192 ensureDirectCommandGate ( 'tidy' , ( ) => {
191193 cmdTidy ( preferences . spacing . x , preferences . spacing . y , preferences . wrap_instances , preferences . layout_paradigm || 'rows' )
192194 figma . notify ( 'Super Tidy: Tidy' )
193- } , preferences , UUID )
195+ } , preferences , UUID , license )
194196 } else
195197 if ( cmd == 'pager' ) {
196198 // RUNS WITH COUNTDOWN GATE
197199 ensureDirectCommandGate ( 'pager' , ( ) => {
198200 cmdPager ( preferences . pager_variable , preferences . layout_paradigm || 'rows' )
199201 figma . notify ( 'Super Tidy: Pager' )
200- } , preferences , UUID )
202+ } , preferences , UUID , license )
201203 } else
202204 if ( cmd == 'all' ) {
203205 // RUNS WITH COUNTDOWN GATE
@@ -207,7 +209,7 @@ Storage.getMultiple([
207209 cmdRename ( preferences . rename_strategy , preferences . start_name , preferences . layout_paradigm || 'rows' )
208210 cmdPager ( preferences . pager_variable , preferences . layout_paradigm || 'rows' )
209211 figma . notify ( 'Super Tidy' )
210- } , preferences , UUID )
212+ } , preferences , UUID , license )
211213 } else
212214 if ( cmd == 'options' ) {
213215 // OPEN UI
@@ -217,6 +219,7 @@ Storage.getMultiple([
217219 UUID : UUID ,
218220 cmd : cmd ,
219221 preferences : preferences ,
222+ license : license ,
220223 AD_LAST_SHOWN_DATE : AD_LAST_SHOWN_DATE ,
221224 AD_LAST_SHOWN_IMPRESSION : AD_LAST_SHOWN_IMPRESSION
222225 } )
@@ -261,26 +264,6 @@ Storage.getMultiple([
261264 if ( msg . type === 'resetImpression' ) {
262265 Storage . set ( Storage . getKey ( 'AD_LAST_SHOWN_IMPRESSION' ) , 0 )
263266 } else
264- if ( msg . type === 'get-license' ) {
265- // Return stored license data to UI
266- Storage . get ( Storage . getKey ( 'LICENSE_V1' ) )
267- . then ( license => {
268- figma . ui . postMessage ( {
269- type : 'license-data' ,
270- license : license || null
271- } )
272- } )
273- } else
274- if ( msg . type === 'get-license-for-gate' ) {
275- // Return license data specifically for gate cache updates
276- Storage . get ( Storage . getKey ( 'LICENSE_V1' ) )
277- . then ( license => {
278- figma . ui . postMessage ( {
279- type : 'license-data-for-gate' ,
280- license : license || null
281- } )
282- } )
283- } else
284267 if ( msg . type === 'activate-license' ) {
285268 // Store license data from UI
286269 const licenseData = {
0 commit comments