I’ve done a little digging. I think we have some challenges to solve regarding supporting both Eik and Asset pipe in the manifest file.
- in the manifest file must have the legacy field populated with asset pipe hash and the new js and css arrays must be populated with Eik absolute URLs
- the first time
podlet.js
orpodlet.css
is called, the legacy field is populated, subsequent calls do not reset the legacy field so it is important that the asset pipe stuff is done before the Eik stuff - Even when
podlet.js
andpodlet.css
are called in the correct order, the legacy field is added to the array of modern fields
podlet.js({ type: 'module', value: 'https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js' });
podlet.js({ value: '/s2d1fs31fd2s31df2s3df12s3312f312' });
Results in a manifest file:
{
"name": "newsletter",
"version": "1591330871297",
"content": "/",
"fallback": "/fallback",
"assets": {
"js": "https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js",
"css": ""
},
"css": [
],
"js": [
{
"value": "https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js",
"type": "module"
},
{
"value": "/s2d1fs31fd2s31df2s3df12s3312f312",
"type": "default"
}
],
"proxy": {
"accept": "/accept"
}
}
So the asset pipe hash only ends up in the new js array which totally wont fly as we want it in the legacy field
podlet.js({ value: '/s2d1fs31fd2s31df2s3df12s3312f312' });
podlet.js({ type: 'module', value: 'https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js' });
Results in a manifest file:
{
"name": "newsletter",
"version": "1591330123063",
"content": "/",
"fallback": "/fallback",
"assets": {
"js": "/s2d1fs31fd2s31df2s3df12s3312f312",
"css": ""
},
"css": [],
"js": [
{
"value": "/s2d1fs31fd2s31df2s3df12s3312f312",
"type": "default"
},
{
"value": "https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js",
"type": "module"
}
],
"proxy": {
"accept": "/accept"
}
}
So the asset pipe hash ends up in both the legacy section AND ALSO the new js array which is not idea as the layout will need to do some hacky filtering to remove the asset pipe hash
Calling podlet.js where you want the legacy fields to be blank (eg. header, footer and consent-newsletter podlets)
podlet.js({ type: 'module', value: 'https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js' });
Results in a manifest file:
{
"name": "newsletter",
"version": "1591331128610",
"content": "/",
"fallback": "/fallback",
"assets": {
"js": "https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js",
"css": ""
},
"css": [
],
"js": [
{
"value": "https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js",
"type": "module"
}
],
"proxy": {
"accept": "/accept"
}
}
So the Eik values end up in both the legacy and new fields which means we then have to hackily filter them out in the manifest route
A JSON file for this needs to look like this
{
"name": "newsletter",
"version": "1591331128610",
"content": "/",
"fallback": "/fallback",
"assets": {
"js": "",
"css": ""
},
"css": [
],
"js": [
{
"value": "https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js",
"type": "module"
}
],
"proxy": {
"accept": "/accept"
}
}
A JSON file for this needs to look like:
{
"name": "newsletter",
"version": "1591331128610",
"content": "/",
"fallback": "/fallback",
"assets": {
"js": "/d1f23s123ds12df3s1df23sdf12s3df12s3f1d23sf1",
"css": ""
},
"css": [
],
"js": [
{
"value": "https://assets.finn.no/pkg/consent-newsletter/1.0.2/main/index.js",
"type": "module"
}
],
"proxy": {
"accept": "/accept"
}
}