Redirect to Angular app - angularjs

I tried google to search the answer but may be I am not asking the correct question.
My Scneario is, I have an angular app(APP1) with a grid. The grid has a link in one of its cell which points to an external asp.net web application(APP2). When the user clicks on the link he/she will be navigated to APP2, where they will perform some actions. Once done the user will click a button on APP2 which will save the data and generate an ID and Navigate back to APP1(angular app).I need to get hold of this id that is returned from APP2 and do some operations in APP1.
Let me know if its not clear what I am trying to do.
App1(angular)->App2/someparameter(asp.net webform app)->App1/id(angular)
How can I achieve this?

Related

React PayPal Payment process checkout

I'm new to the react web app, I trying to create cart payment checkout process. All the modules PayPal button open in same page with POPUP. I want to redirect from my site to the PayPal site and return back to my site. Currently i'm using the below example. Is there any module to create order and redirect.
https://www.npmjs.com/package/react-paypal-button-v2
Why do you want to redirect away from your site? That's how things were done 5+ years ago.
It's much better to keep your site loaded and present in the background and show payers an in-context approval experience, instead of redirecting them over to a new and possibly unfamiliar login page.
You are asking for how to do something you shouldn't even be trying to do, and which will result in an inferior buyer experience and fewer completed checkouts, which is the opposite of what you should want.
But since you ask, the way to do it is not not use the PayPal JavaScript SDK button. Just use the /v2/checkout/orders REST API to create an order and receive an approval_url, which you can redirect to with a static "Checkout with PayPal" button from, say, https://www.paypal.com/us/webapps/mpp/logos-buttons
Again, full page redirects are an old integration method that give a poor buyer experience and you shouldn't use this method.

Best options to display a popup for angularjs app based on conditions

I have an angularjs app with ASP.NET WebAPI2 REST APIs. There is a scenario where I have a display a popup for initiating a survey for end users (both authenticated and anonymous types). On clicking the popup options, the user will be redirected to another applicaiton which captures all the responses provided by the user.
There is no relation between the angularjs app and the survey application.
Now next time if the user revisits the application then in that case based on the previous action taken to fill the survey , I have to take a decision to display or hide the popup for the user.
I thought of cookies and localStorage as the options but I think are not ideal choices for this scenario.
Can anyone help me to know are there any other possible options to handle this scenario?
You can solve this using the redirection link.
For example if he finished correctly the Survey you will redirect him to:
www.myapp.com/survey/success
Than in the App you can do something like: get the URL parameters, if the parameters is success store it on localStorage so next time he revisits the web-page the Popup wont show.
Otherwise direct him to:
www.myapp.com/survey/
I think the best option here is to save this information in the database using your ASP.NET WebAPI2 REST APIs. In the moment that the end user clicks the survey you can also make an Api call which will save in the database info about user's action(this will probably be sth you can do for authenticated users). For not authenticated users you can just save that information in localStorage in the moment they are clicking the survey.

Adding custom action buttons to Wagtail Admin

In Wagtail, I currently have content which I wish to update based on API calls to another website:
I have a VideoPage with fields like url, title and description. When adding a VideoPage I'd like to be able to enter just the url , click a button, and it'll try to prepopulate the other fields by making API calls (via either the front end or back end)
I also have a ChannelPage, which VideoPages are children of. I'd ideally like a way to click a button in admin, have my server check whether the channel has new videos, then create new VideoPage children accordingly.
From the above use cases, I believe my problem comes down to this: is it possible to add standalone action buttons to the admin area for a Page which, when clicked, allows the backend to edit fields, create new pages, etc. accordingly?

Showing custom view based on user role in angularjs

I want to show different views based on the user of my application for example if the user is admin he can see all the controls or when it is acting as user he can only see a subset of controls and UI and he can perform the limited action.
One solution that comes to my mind is sending the role information with the page as a JSON but that would require me to have knowledge of the logged in user so, basically I can first check if the user is logged in or not through the cookie? if no I can just load the lightweight version of the login page and after user logs in then I can send a new page altogether with user's profile information embedded in it.
The other approach that I see is that I can bootstrap my angular application and then check the login status and if the login is done, then bring the profile information through a JSON and update the view, but I think it would be slow and error-prone.
I don't know what is best / recommended approach.
First approach seems to be a better approach out of these 2.
Problem with the second approach is you are sending 2 requests to the server - one for login and then 2nd one to get the user role/profile. If you are choosing this approach then you may have few issues depending how are you going to implement it:
If you are updating your UI after login then you will have to decide what should be shown to the user since you don't know the user profile yet. Even if you come up with some minimal privilege UI, there will be another request to get the profile which will kind of refresh the UI again - 2 UI refreshes could be annoying for the user. Not to mention that there 2 requests going which could make your site slow.
If you decide not to update the UI after login but only after you get user profile, still the delay would be more as you will have to wait for response of 2 separate requests. Could be a major issue with slow networks(consider mobile)
If you are using the first approach, you'll get away with above mentioned problems.

Lightning experience deep link to custom Visualforce tab

Do you know if it is possible to deep link a custom tab on the left hand navigation?
In my web app I allow the user to login through SSO from Salesforce ( so I use salesforce as authentication provider ), than when the user credentials are ensured i redirect the user to the tab using an aspex url like the following:
https://{domain}/apex/{VisualforceTabsName}?sfdc.tabName={VisualforceTabsRef}
or a servlet integration link like the following:
https://na15.salesforce.com/servlet/servlet.Integration?lid={lid}&ic=1&linkToken={linkToken}
I got those links simply right clicking the tabs and copy the link, now this is not going to work on the new ligthening experience where the link is something like the following;
https://gs0.lightning.force.com/one/one.app?source=aloha#{token}
Now it seems to me that the token in this case is user specific, so it can't be used as high level reference to the Visualforce tab.
Do you know if there is a way to do the same in the Lightening Experience (Spring 16' release)? Or if there is a different way to achieve the same result?
Thanks
In Lightning Experience, you can reference custom tabs using the developer name of the tab (note that this is the API name of the tab containing the Visualforce page, not of the page itself). This URL should work:
{domain}/lightning/n/{tabName}
This assumes that you have already created a tab for your Visualforce page.

Resources