// Action: "Deactivate license" — clears the stored key locally. Does NOT // revoke the key server-side (only the seller can revoke, from their licensing // server's admin dashboard). The operator is reminded of this. import { sdk } from '../sdk' import { PRODUCT_DISPLAY_NAME } from '../licensing/config' export const deactivateLicense = sdk.Action.withoutInput( 'deactivate-license', async ({ effects }) => ({ name: 'Deactivate license', description: `Remove the stored license key from this ${PRODUCT_DISPLAY_NAME} ` + `install. The key itself is NOT revoked — to revoke, contact the seller.`, warning: `This only clears the key from this device. If you want the key ` + `disabled everywhere (e.g. because it leaked), ask the seller to ` + `revoke it server-side.`, allowedStatuses: 'any', group: 'License', visibility: 'enabled', }), async ({ effects }) => { await sdk.store.getOwn(effects, sdk.StorePath).merge({ license_key: null, license_activated_at: null, license_last_status: 'deactivated', license_pending_invoice_id: null, }) return { message: `License cleared. ${PRODUCT_DISPLAY_NAME} will no longer consider itself licensed on next start.`, } }, )