SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
738 stars 383 forks source link

[dev2] Add the webApplicationInjector to Spartacus #367

Closed Xymmer closed 5 years ago

Xymmer commented 5 years ago

SmartEdit's webApplicationInjector is a js file needed for SmartEdit to do its thing. You load it into your html and it will try to connect to SmartEdit.

Speak to SmartEdit contact about where we find this file and get latest version.

Copy into our source, link into our html. We'll refine later on how and when to load it.

Acceptance criteria:

WeizhengSap commented 5 years ago

PR: https://github.com/SAP/cloud-commerce-spartacus-storefront/pull/484

PR in spaacceleratorsamplesaddon: https://stash.hybris.com/projects/C3PO/repos/spacceleratorsamplesaddon/pull-requests/6/overview

WeizhengSap commented 5 years ago

import this in hac:

INSERT_UPDATE SmartEditConfiguration;key[unique=true];value ;whiteListedStorefronts;"[""*""]"

Note: I use *, you can set to localhost:4200 INSERT_UPDATE SmartEditConfiguration;key[unique=true];value ;whiteListedStorefronts;"[""http://localhost:4200""]"

webApplicationInjector.js is loaded in app. screen shot 2018-11-29 at 7 57 40 pm

In smart edit, open browser console, you should not see errors. The warning: "Missing SmartEdit attributes on body element of the stoerfront ..."

screen shot 2018-12-02 at 4 04 48 pm

plabadie commented 5 years ago

Strange, there are unit test failures on the pipeline.

WeizhengSap commented 5 years ago

StoreFinder unit test fails on Weekend (because store close on Weekend, so cannot get open time).

plabadie commented 5 years ago

Thanks I didn't know that. The should pass when we re-run them.

WeizhengSap commented 5 years ago

Create https://github.com/SAP/cloud-commerce-spartacus-storefront/issues/507 for improvement.

plabadie commented 5 years ago

The webApplicationInjector is indeed added to spartacus.

However, the latest version of webApplicationInjector seems to have a bug in it. We see an errors in the console. A ticket is open for the smartedit team.

Here is what it looks like:

screen shot 2018-12-04 at 2 21 39 pm
WeizhengSap commented 5 years ago

Create one smart edit ticket: https://jira.hybris.com/browse/CMSX-8096

plabadie commented 5 years ago

The most severe errors are solved by the latest version of the webAppInjector file.

There are a few warnings left that we will need to take a look at when we further stabilize the smartedit integration.

screen shot 2018-12-04 at 5 09 08 pm
WeizhengSap commented 5 years ago

I reopen it, because I found that webApplicationInjector.js is not added into dist folder.

Now, I can see it in dist screen shot 2018-12-05 at 9 04 41 am

WeizhengSap commented 5 years ago

PR: https://github.com/SAP/cloud-commerce-spartacus-storefront/pull/544