Find the Team and Bundle IDs of a macOS Package
There are many reasons you would need to find the team or bundle id of a specific macOS package, the one I stumbled upon recently was to use them when creating a PPPC profile that whitelists the application and approves its extensions without the need of user approval.
Find the bundle id
There are three (possibly more) different methods to find the bundle id of a macOS package these are:
Using osascript
osascript -e 'id of app "Finder"'
Using Info.plist
cat /Applications/Firefox.app/Contents/Info.plist
Look for a key named CFBundleIdentifier, the bundle id will be a string on the line below it.
Using Online Tools
There are some online websites that can help you find the bundle id of an app (example), just search for the app name and you will get the information.
Find the team id
Just as with the bundle id, there are multiple ways to find this identifier, here are the ones I know of:
Using CodeSign
codesign -dv --verbose=4 /Applications/Firefox.app
Look for TeamIdentifier, that's the one.