Salesforce-Inspector-reloaded icon indicating copy to clipboard operation
Salesforce-Inspector-reloaded copied to clipboard

Feat: add incognito login as

Open alanjaouen opened this issue 2 years ago β€’ 20 comments

Describe your changes

Add a new button in user detail, calling method loginAsInIncognito(userId) that encapsulate getLoginAsLink(userId) in a new incognito window

Issue ticket number and link

#381

Checklist before requesting a review

  • [x] I have read and understand the Contributions section
  • [x] Target branch is releaseCandidate and not master
  • [x] I have performed a self-review of my code
  • [x] I ran the unit tests and my PR does not break any tests
  • [x] I documented the changes I've made on the CHANGES.md and followed actual conventions
  • [x] I added a new section on how-to.md (optional)

alanjaouen avatar Apr 08 '24 14:04 alanjaouen

Great addition @alanjaouen πŸ‘ For now I think we are missing a margin when the user is also a portal user (we could also provide an incognito link for this !)

image

To be honest I was not very satisfied when I added the Login to experience button but now I think we have too many buttons.

I was thinking of a combination of key press + click to open the link in an anonymous window but I'm 100% sure that no one reads the doc and will be aware of this new feature πŸ˜„

We could use icons instead of buttons but not sure if it will be very UI friendly .. Would you have something in mind ? @nshulman any idea ?

Maybe an option to enable user's action icons instead of buttons with text ?

image

tprouvot avatar Apr 08 '24 15:04 tprouvot

@tprouvot yes in fact there is a lot of button now ^^ didn't wanted to break everything for my first PR ahah

for now I will fix marging and add incognito for experience

alanjaouen avatar Apr 08 '24 17:04 alanjaouen

@tprouvot I can experiment and see how some options look later this week. I can't remember where I saw it but someone suggested button visibility in options so they can hide the ones they will not use, that could be a useful, easy solution to start with (maybe a More or expandable menu for any hidden ones). I like the icons option idea too and can add more slds icons.

nshulman avatar Apr 08 '24 17:04 nshulman

@tprouvot factorised between platform/experience user & created method openUrlInIncognito but feels like UserDetails may be not the right spot to put it, let me know if there is a class somewhere I can put this

alanjaouen avatar Apr 08 '24 17:04 alanjaouen

@alanjaouen I'm ok with adding the method in User details since I think those are the only use cases where we need to open an incognito window. Thanks for adding it to Experience button !

tprouvot avatar Apr 08 '24 19:04 tprouvot

Since some methods are chrome dependent could you test this functionality on firefox ? You should have a firefox branch which contains some small differences which allows you to test locally the plugin on firefox

tprouvot avatar Apr 10 '24 09:04 tprouvot

What about this one ?

image

tprouvot avatar Apr 11 '24 11:04 tprouvot

@jefersonchaves had a good idea with button menu :

image

tprouvot avatar Apr 11 '24 13:04 tprouvot

Hi @tprouvot, I didn't manage to make the addon works in firefox (addon is enable, but is not displayed in salesforce page) :/ is there something more to do than https://github.com/tprouvot/Salesforce-Inspector-reloaded?tab=readme-ov-file#firefox ?

alanjaouen avatar Apr 14 '24 22:04 alanjaouen

Hi @tprouvot, I didn't manage to make the addon works in firefox (addon is enable, but is not displayed in salesforce page) :/ is there something more to do than https://github.com/tprouvot/Salesforce-Inspector-reloaded?tab=readme-ov-file#firefox ?

Hi @alanjaouen,

I updated the documentation which was not up to date, could you try with those guidelines ?

  1. Checkout branch firefoxAddon and enter addon directory.
  2. Click on the cog icon and select Debug Add-ons
  3. Click Load Temporary Add-on….
  4. Select the file addon/manifest.json.

tprouvot avatar Apr 15 '24 09:04 tprouvot

Hi guys, @alanjaouen @nshulman @jefersonchaves

What do you think about this ?

image

I'm not sure about the UI and the extra clicks that would require [edit] solve the extra clicks by using onMouseEnter and onMouseLeave

tprouvot avatar Apr 16 '24 08:04 tprouvot

@tprouvot - It looks like a good compromise.

jefersonchaves avatar Apr 16 '24 08:04 jefersonchaves

@alanjaouen does the login to portal (incognito) works for you ? Because it doesn't on my side. That being said, I'm realizing that unless the login as for crm users, the login as portal doesn't kill the previous session which means you can keep both sessions in parallel. So maybe we don't need the incognito mode for portal users ..

tprouvot avatar Apr 16 '24 10:04 tprouvot

@alanjaouen I'm ok with current design but I tested on firefox and LoginAs incognito does not work, I deployed your PR on this branch for firefox testing

image

tprouvot avatar Apr 18 '24 13:04 tprouvot

@alanjaouen does the login to portal (incognito) works for you ? Because it doesn't on my side. That being said, I'm realizing that unless the login as for crm users, the login as portal doesn't kill the previous session which means you can keep both sessions in parallel. So maybe we don't need the incognito mode for portal users ..

@tprouvot indeed, this feature is not needed for portal user

Hi @alanjaouen, I updated the documentation which was not up to date, could you try with those guidelines ? Checkout branch firefoxAddon and enter addon directory. Click on the cog icon and select Debug Add-ons Click Load Temporary Add-on…. Select the file addon/manifest.json.

I tried, the addon now loads, but I cannot see the popup in any salesforce org

alanjaouen avatar Apr 21 '24 14:04 alanjaouen

On my side I'm trying to use browser.extension.isAllowedIncognitoAccess() and browser.windows.create to be compatible with firefox but I'm facing errors like

Uncaught TypeError: browser.extension.isAllowedIncognitoAccess is not a function and Uncaught TypeError: can't access property "create", browser.windows is undefined

tprouvot avatar Apr 22 '24 07:04 tprouvot

@tprouvot I find out that browser.extension.isAllowedIncognitoAccess is not accessible in background script (works well on front tho)

for Uncaught TypeError: can't access property "create", browser.windows is undefined, we can access it by moving the windows creation to the background script itself, and using messaging to trigger it

alanjaouen avatar Apr 28 '24 12:04 alanjaouen

Hi @alanjaouen, I'm ok with adding the method in background where browser is not undefined πŸ‘

I was wondering why there was some conflicts with the manifest file and I found out that you merged firefoxAddon branch into you PR which is not the intention.

manifest file is quite different (still in manifest v2 and other browser differences) I did create a branch to test your PR on firefox. But at the end the changes made for firefox should not integrate releaseCandidate branch.

Could you revert the merge ? I'm available if you want to discuss it by call

tprouvot avatar Apr 30 '24 10:04 tprouvot

hi @tprouvot,

oh yes, totally screw locally between remotes, reverted the merge, we should rebase the PR when ready to merge, so the history will be clean

the actual code is working on both chrome and firefox

one thing that can be improve is the error management: as the actual code does not check is extension is enabled in incognito (thus this is not requiered in firefox), in chrome an error is raise if the extention is not enabled, but no message are displayed to the user

alanjaouen avatar May 01 '24 22:05 alanjaouen

@alanjaouen I think we are close ! I'll do some tests on firefox also but should be ok soon, thank you very much this is a great feature πŸ‘

tprouvot avatar May 16 '24 14:05 tprouvot

Thank you @alanjaouen for this great improvement !

tprouvot avatar May 22 '24 10:05 tprouvot