@postnord/pn-marketweb-components 2.0.6-beta6 → 2.0.6-beta9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,43 +4,34 @@
|
|
|
4
4
|
return;
|
|
5
5
|
}
|
|
6
6
|
document.body.dataset["marketwebComponentsSalesforceInit"] = true;
|
|
7
|
+
|
|
8
|
+
const header = document.createElement('pn-marketweb-header');
|
|
9
|
+
const footer = document.createElement('pn-marketweb-footer');
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const injectElements = originalParams.get('inject').split(',').map(function(item) { return item.trim(); });
|
|
15
|
-
injectElements.forEach(function(element) {
|
|
16
|
-
const s = document.createElement('script');
|
|
17
|
-
let injectSrc = originSrc.replace('pn-marketweb-init.js', 'pn-marketweb-inject.js');
|
|
18
|
-
injectSrc = injectSrc.substring(0, injectSrc.indexOf('?'));
|
|
19
|
-
const params = new URLSearchParams(originalQueryString);
|
|
20
|
-
params.delete('inject');
|
|
21
|
-
params.set('inject', element);
|
|
11
|
+
[header, footer].forEach((comp) => {
|
|
12
|
+
comp.setAttribute('market', 'dk');
|
|
13
|
+
comp.setAttribute('language', 'da');
|
|
14
|
+
})
|
|
15
|
+
document.body.insertBefore(header, document.body.firstElementChild);
|
|
16
|
+
document.body.appendChild(footer);
|
|
22
17
|
|
|
23
|
-
if (element.indexOf('header') !== -1) {
|
|
24
|
-
params.set('domlocation', 'top');
|
|
25
|
-
}
|
|
26
|
-
if (element.indexOf('footer') !== -1) {
|
|
27
|
-
params.set('domlocation', 'bottom');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
s.setAttribute("src", `${injectSrc}?${params.toString()}`);
|
|
31
|
-
document.querySelector("head").appendChild(s);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
18
|
|
|
35
19
|
const s = document.createElement('script');
|
|
36
|
-
// const currentScriptTag = document.querySelector('script[src*="pn-marketweb-init.js"]');
|
|
37
|
-
// const currentScriptSrc = currentScriptTag.getAttribute('src');
|
|
38
|
-
|
|
39
|
-
const currentScriptSrc = 'https://unpkg.com/@postnord/pn-marketweb-components@2.0.6-beta6/umd/pn-marketweb-salesforce.js?market=se&language=en&inject=pn-marketweb-siteheader,pn-marketweb-sitefooter,cssoverride';
|
|
40
|
-
checkParameters(currentScriptSrc);
|
|
41
|
-
const loaderScriptSrc = currentScriptSrc.replace('pn-marketweb-salesforce.js', 'standalone-loader.js');
|
|
42
20
|
s.setAttribute("type", "module");
|
|
43
|
-
s.setAttribute("src",
|
|
21
|
+
s.setAttribute("src", "https://unpkg.com/@postnord/pn-marketweb-components@2.0.6-beta9/umd/standalone-loader-salesforce.js");
|
|
44
22
|
document.querySelector("head").appendChild(s);
|
|
23
|
+
|
|
45
24
|
|
|
25
|
+
|
|
26
|
+
const unlockScripts = function() {
|
|
27
|
+
const blockedScripts = [...document.querySelectorAll('[data-locker-src]:not([src])')];
|
|
28
|
+
if (blockedScripts && blockedScripts.length > 0) {
|
|
29
|
+
blockedScripts.forEach((item) => {
|
|
30
|
+
item.setAttribute('src', item.getAttribute('data-locker-src'))
|
|
31
|
+
console.log('attempt to let this script load', item)
|
|
32
|
+
});
|
|
33
|
+
window.clearInterval(window["marketwebComponentsSalesforce-timer"]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
window["marketwebComponentsSalesforce-timer"] = window.setInterval(unlockScripts, 100);
|
|
46
37
|
})();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
# No webpack loader
|
|
3
|
+
See the documentation in readme.md on how to properly setup this script.
|
|
4
|
+
You need to change the relative directories as well as the resourceUrl property to make files load from the correct directories.
|
|
5
|
+
|
|
6
|
+
<script type="module" src="/scripts/no-webpack-loader.js"></script>
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import './modules/@webcomponents/custom-elements/src/native-shim.js';
|
|
10
|
+
import { defineCustomElements as defineCustomElementsMarketWeb } from '../esm-es5/loader.js';
|
|
11
|
+
import { defineCustomElements } from './modules/@postnord/web-components/esm-es5/loader.js';
|
|
12
|
+
|
|
13
|
+
window['marketweb-components'] = {};
|
|
14
|
+
window['marketweb-components']['defineCustomElementsMarketWeb'] = defineCustomElementsMarketWeb;
|
|
15
|
+
window['marketweb-components']['defineCustomElements'] = defineCustomElements;
|
|
16
|
+
(function(){
|
|
17
|
+
if (typeof window['marketweb-components'] === "undefined") {
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
window['marketweb-components']['defineCustomElements'](window, { resourcesUrl: '/scripts/' });
|
|
22
|
+
window['marketweb-components']['defineCustomElementsMarketWeb'](window, { resourcesUrl: '/scripts/' });
|
|
23
|
+
})();
|