woocommerce/plugins/woocommerce-admin/client/utils/plugins.ts

12 lines
334 B
TypeScript

export function getPluginSlug( id: string ): string {
return ( id || '' ).split( ':', 1 )[ 0 ];
}
export function getPluginTrackKey( id: string ): string {
const slug = getPluginSlug( id );
const key = /^woocommerce(-|_)payments$/.test( slug )
? 'wcpay'
: `${ slug.replace( /-/g, '_' ) }`.split( ':', 1 )[ 0 ];
return key;
}