Spartacus | load some pages from accelerator and some pages from Spartacus for 1 application in hybris - sap-commerce-cloud

we are planning to migrate 1 hybris application from the accelerator storefront to Spartacus.
we planned page by page approach, that some pages loaded from the accelerator storefront and some pages from Spartacus.
can someone provide some idea on how we can implement this?
For example :
this catalog page loads from spartacus :
http://localhost:4200/electronics-spa/en/USD/Open-Catalogue/Cameras/Digital-Cameras/c/575
and this cart page loads from accelerator storefront-
http://localhost:4200/electronics-spa/en/USD/cart

The out of the box Spartacus offers external routes to solve this problem. This is build on top of the angular routerlink
You can specify which routes are handled by the angular application, and which need to be fetched from the backend (accelerator setup)
ConfigModule.withConfig({
routing: {
internal: [
'/',
'/cart',
'/product/*/*',
'/**/p/**',
]
}
})
With this config, you specify what routes are served by the single page applications, the others will be fetched from the backend
If you make use of a single page application (SPA), you will also need to configure the service worker to bypass the caching worker. this in done in ngsw-config.json
"navigationUrls": [
// prefix `/*/*/*/` handles the three site context URL segments
'/*/*/*/',
'/*/*/*/cart',
'/*/*/*/product/*/*',
'/*/*/*/**/p/**',
]
For more information:
https://sap.github.io/spartacus-docs/external-routes/#using-spartacus-and-another-system-to-run-a-single-storefront

Related

See Azure web app pages with zero views in Azure Application Insights

If it is even possible...
Goal: See a report of the number of views each page in my Azure web app has, and include the pages that have received zero views
Currently the page views report in Azure Application Insights that I have managed to create (based on the default report, shows all pages with >= 1 view. I would like to include in that report pages that have 0 views.
This is bare-bones version of the query I'm using in logs:
pageViews
| where timestamp between(datetime("2020-03-06T00:00:00.000Z")..datetime("2020-06-06T00:00:00.000Z"))
| summarize Ocurrences=count() by tostring(url)
The pages are in an Azure web app.
Does anyone know how to accomplish this, either using this method or another I'm not thinking of? Thank you for any help.
If the pages have zero view from client, it means that from client, there is no "page view" telemetry data being sent to application insights. Thus, application insights will not collect these zero-viewed page urls.
If you want to add these zero-viewd page to your report, you should hard-code these zero-viewed page urls in the query.
Here is an example, I use the datatable operator and union operator:
//use thie query to add the zero-viewd page url in this datatable
let query1=datatable (url:string,Ocurrences:long)
[
"https://localhost:44364/home/url1",0,
"https://localhost:44364/home/url2",0,
"https://localhost:44364/home/url3",0,
];
//use the query below for non-zero-viewd page
let query2=pageViews
| summarize Ocurrences=count() by tostring(url);
//union the 2 queries
union withsource=TableName query1,query2 | project url,Ocurrences
Here is the test result:

How to update index page content of shopify store using API like we are update other pages content using shopify admin API

I am developing shopify public app. I just want to know that can I get store home page content for upadte and add new content there.
I am getting all pages details and it contents by using shopify admin API for get page,create page,update page and delete page
like here we use following path for update particular page with page_id
PUT /admin/api/2019-04/pages/#{page_id}.json
{
"page": {
"id": 131092082,
"body_html": "<p>Returns accepted if we receive the items 14 days after purchase.</p>"
}
}
I had details of all static pages but i don't know how to update home page details like this
Can any one please help me that how I can get home page content and update that content using API or refer me any admin API to get this. Thank you
The smart way to do this is as follows. In the theme itself, you can tell when you are on the index page since Shopify renders index.liquid. In there, you can make a callback to your App using the App Proxy. The App then provides custom data as JSON or perhaps even Liquid. So the index page can now render with your App being part of the cycle.
That is probably the best pattern for you to work with for your specifics.
Finally got the solution to update index.liquid page of shopify store as follow
First you have to get themes by following
GET https://shop_domain/admin/api/2019-04/themes.json
This API give you thmes.json which contains all themes details used in this store.
Now you have to get theme_id from theme.json for update particular page by theme_id.
Update asset API for update content of index page
URL for update assets by theme_id
PUT https://shop_domain/admin/api/2019-04/themes/#{theme_id}/assets.json
require body for update API
{
"asset": {
"key": "templates/index.liquid",
"value": "add your content"
}
}
And this will update index page content with your content . It work successfully for me Thank you

Universal Link for IOS is not working

Hi I have done with following steps to implement Universal Link for IOS.
1.My sub domain is npd.nowconfer.com, and my apple-app-site-association file contains,
{
"applinks": {
"apps": [],
"details": [
{
"appID":"R3UDJNSN2P.com.sampleUniversal.teledna",
"paths": ["*"]
}
]
}
}
this file is uploaded into my subdomain npd.nowconfer.com and its serveing over https.
2.I tested using AASA Validator i.e https://branch.io/resources/aasa-validator/#resultsbox and i got Test result as all pass.
you can see attached screenshot.
3.Now In app side,my colleague did configuration such as
Added the domain to Capabilities i.e applinks:nowconfer.com and applinks:npd.nowconfer.com
Handled Universal Links in app i.e in delegate like this
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
NSURL *url = userActivity.webpageURL;
// handle url
}
4.my universalink is https://npd.nowconfer.com:5000/calendar/deeplink?url=nowconfer when i click on this link from email ,my app is not opening instead it is redirecting to app store(becasue server side request came handling to redirect app shore if app is not installed on device)
But when i tested universalink validator here https://search.developer.apple.com/appsearch-validation-tool ,i have got some error
Link to Application : Error no apps with domain entitlements
The entitlement data used to verify deep link dual authentication is from the current released version of your app. This data may take 48 hours to update.
I have seen lot of tutorials but not used anything for me.Can you guys help me to figure out what is happening here?
Universal Links have to be standard http:// or https:// links. This means they need to use the standard web ports, of which 5000 is not one. That is why your link is not working — it's not actually a valid Universal Link.
The Apple validator checks for some additional things, and is also somewhat unreliable. This particular error message is confusing, but it has nothing to do with whether your Universal Linking configuration is correct. What it actually means is Apple can't detect applinks: entitlements and 'proper' handling of passed-in link values in the version of your app that is currently live in the App Store. This is expected if you are just implementing Universal Links for the first time. You don't need to worry about this — a number of large and successful apps with working Universal Links implementations fail this step too.

Loading Chrome Extension's manifest.json on a web page

I am developing a Extension-detect site that can detect whether the client has installed my extensions.
I try to load the manifest.json file so that I can know.
But when I tried, I got a:
Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.
So I put my website in the json, like:
"web_accessible_resources": [ "www.mysite.com/*", "mysite.com/*" ]
But it still doesn't work.
Is there anything I need to fix?
Thanks
web_accessible_resources is a list of files packed in your extension that can be requested by any webpage loaded by your users browser. So if you want to load your manifest from your site you need an entry like this:
"web_accessible_resources": [ "manifest.json" ]
However this will allow any site your users visit to discover if your extension is installed so the recommended approach is to use a content_script that adds a class to the body of all the pages on your domain. That way your sites JS can check for the class for installation but no information will be accessible to other sites.
// content_script run on your domains
document.documentElement.classList.add('ext-name-installed');
On your site you can now check to see if the extension is installed with
// Run on website to test for extension
if(document.documentElement.classList.contains('ext-name-installed')) {
// Extension is installed
}

How do I secure all the admin actions in all controllers in cakePHP

I am developing an application using cakePHP v 1.3 on windows (XAMPP).
Most of the controllers are baked with the admin routing enabled. I want to secure the admin actions of every controller with a login page. How can I do this without repeating much ?
One solution to the problem is that "I check for login information in the admin_index action of every controller" and then show the login screen accordingly.
Is there any better way of doing this ?
The detault URL to admin (http://localhost/app/admin) is pointing to the index_admin action of users controller (created a new route for this in routes.php file)
Use the Authentication component. You can set it up just for admin routes with something like this:
// AppController::beforeFilter
function beforeFilter() {
if (isset($this->params['prefix']) && $this->params['prefix'] == 'admin') {
$this->Auth->deny('*');
...
}
}
Checking only in the index actions is pointless, that's just obscurity, not security. The AuthComponent will check permissions for every single page load.

Resources