@postnord/pn-marketweb-components 2.4.21 → 2.4.22
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/cjs/index-4199ff85.js +8 -4
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-address-autofill.cjs.entry.js +322 -0
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-marketweb-input.cjs.entry.js +36 -25
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +3 -3
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +3 -3
- package/cjs/pn-proxio-findprice.cjs.entry.js +3 -3
- package/cjs/pn-proxio-pricegroup.cjs.entry.js +3 -3
- package/collection/collection-manifest.json +2 -1
- package/collection/components/input/pn-address-autofill/pn-address-autofill.css +45 -0
- package/collection/components/input/pn-address-autofill/pn-address-autofill.js +537 -0
- package/collection/components/input/pn-address-autofill/pn-address-autofill.stories.js +40 -0
- package/collection/components/input/pn-marketweb-input/pn-marketweb-input.js +50 -39
- package/collection/components/input/pn-multi-formfield/types.js +1 -0
- package/components/index.d.ts +2 -1
- package/components/index.js +1 -0
- package/components/index2.js +63 -52
- package/components/index3.js +52 -63
- package/components/pn-address-autofill.d.ts +11 -0
- package/components/pn-address-autofill.js +359 -0
- package/components/pn-animated-tile.js +1 -1
- package/components/pn-dropdown-choice-adds-row.js +1 -1
- package/components/pn-marketweb-input2.js +36 -25
- package/components/pn-marketweb-sitefooter.js +1 -1
- package/components/pn-marketweb-siteheader.js +1 -1
- package/components/pn-multi-formfield.js +1 -1
- package/components/pn-proxio-findprice.js +1 -1
- package/components/pn-proxio-pricegroup.js +1 -1
- package/components/pn-spotlight.js +1 -1
- package/esm/index-ee44c065.js +8 -4
- package/esm/loader.js +1 -1
- package/esm/pn-address-autofill.entry.js +318 -0
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-marketweb-input.entry.js +36 -25
- package/esm/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm/pn-marketweb-siteheader.entry.js +1 -1
- package/esm/pn-proxio-findprice.entry.js +1 -1
- package/esm/pn-proxio-pricegroup.entry.js +1 -1
- package/esm-es5/FetchHelper-62dc55bf.js +1 -0
- package/esm-es5/index-ee44c065.js +1 -1
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-address-autofill.entry.js +1 -0
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-input.entry.js +1 -1
- package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
- package/esm-es5/pn-proxio-findprice.entry.js +1 -1
- package/esm-es5/pn-proxio-pricegroup.entry.js +1 -1
- package/package.json +1 -1
- package/pn-market-web-components/{p-7e99f631.system.entry.js → p-18aca162.system.entry.js} +1 -1
- package/pn-market-web-components/{p-6e11edfe.entry.js → p-1b282c2b.entry.js} +1 -1
- package/pn-market-web-components/{p-3c38a67e.system.entry.js → p-256ba011.system.entry.js} +1 -1
- package/pn-market-web-components/{p-21bf0e64.system.entry.js → p-356a937e.system.entry.js} +1 -1
- package/pn-market-web-components/{p-1a8d7eb8.entry.js → p-372b4cad.entry.js} +1 -1
- package/{esm-es5/MarketWebContextService-f6a33f17.js → pn-market-web-components/p-439d5d73.system.js} +1 -1
- package/pn-market-web-components/p-4afba818.entry.js +1 -0
- package/pn-market-web-components/p-592b66fc.system.entry.js +1 -0
- package/pn-market-web-components/{p-1e5756b9.system.entry.js → p-89fcb948.system.entry.js} +1 -1
- package/pn-market-web-components/{p-5427a6ba.entry.js → p-90d2fb46.entry.js} +1 -1
- package/pn-market-web-components/p-9ad0ceb0.js +1 -0
- package/pn-market-web-components/p-b1527c0c.entry.js +1 -0
- package/pn-market-web-components/{p-0ae0b140.system.entry.js → p-c06e3588.system.entry.js} +1 -1
- package/pn-market-web-components/{p-9ae49b8a.entry.js → p-da9e05c0.entry.js} +1 -1
- package/pn-market-web-components/p-fcdb7381.system.js +1 -1
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/input/pn-address-autofill/pn-address-autofill.d.ts +56 -0
- package/types/components/input/pn-address-autofill/types.d.ts +40 -0
- package/types/components.d.ts +50 -1
- package/pn-market-web-components/p-33322417.system.js +0 -1
- package/pn-market-web-components/p-5d21372b.js +0 -1
- package/pn-market-web-components/p-f0078106.entry.js +0 -1
- package/cjs/{MarketWebContextService-17053565.js → FetchHelper-2130dacf.js} +84 -84
- package/collection/components/{layout-components/pn-multi-formfield → input/pn-address-autofill}/types.js +0 -0
- package/collection/components/{layout-components → input}/pn-multi-formfield/multi-formfield.stories.js +0 -0
- package/collection/components/{layout-components → input}/pn-multi-formfield/pn-multi-formfield.css +0 -0
- package/collection/components/{layout-components → input}/pn-multi-formfield/pn-multi-formfield.js +0 -0
- package/components/{MarketWebContextService.js → FetchHelper.js} +84 -84
- package/esm/{MarketWebContextService-f6a33f17.js → FetchHelper-62dc55bf.js} +84 -84
- /package/types/components/{layout-components → input}/pn-multi-formfield/pn-multi-formfield.d.ts +0 -0
- /package/types/components/{layout-components → input}/pn-multi-formfield/types.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class t{constructor(t=""){this.storagePrefix="",this.store={get:(t,o=!1)=>{const i=o?window.localStorage:window.sessionStorage,n=o?window.sessionStorage:window.localStorage;let s=i.getItem(`${this.storagePrefix}-${t}`);if(s||(s=n.getItem(`${this.storagePrefix}-${t}`)),!s)return s;if(0===s.indexOf("{"))try{return JSON.parse(s)}catch(e){}return-1!==s.indexOf(",")?s.split(","):s},set:(t,o,i=!1)=>{(i?window.localStorage:window.sessionStorage).setItem(`${this.storagePrefix}-${t}`,"object"!=typeof o||void 0!==o.length?o:JSON.stringify(o))},remove:t=>{window.sessionStorage.removeItem(`${this.storagePrefix}-${t}`)}},this.storagePrefix=t}async fetchJson(t,o={},i=!1,n=null){return new Promise((async s=>{let e=!0;const r="string"==typeof t?t:t.url;let c=null,d=null;if(i&&(d=this.store.get(r),d&&!d.permanent&&(e=!1),d&&d.data&&(c=d.data,s(c))),e){const e=await window.fetch(t,o);c=await e.json(),s(c),i&&("function"==typeof n&&null!=d&&n(c),this.store.set(r,this.wrapJson(c,!0),!0),this.store.set(r,this.wrapJson(c,!1),!1))}}))}wrapJson(t,o=!1){const i=new Date;return{timestamp:i.getTime(),time:i.toISOString(),data:t,permanent:o}}}class o{constructor(t=window.location.href){this.href="",this.market="",this.language="",this.environment="",this.url=null,this.allowedLanguages=["sv","da","fi","no","en","de","zh","fr","es","it","nl"],this.allowedMarkets=["se","dk","fi","no","com","de","tpl"],this.wwwMarkets=["se","dk","fi","no","de","com"],this.developmentDomains=["localhost",".local","local.",".dev","dev."],this.markets={se:{fallbackLanguage:"sv",integration:"se-integration.postnord.com",preproduction:"se-preproduction.postnord.com",production:"se-production.postnord.com",live:"www.postnord.se"},dk:{fallbackLanguage:"da",integration:"dk-integration.postnord.com",preproduction:"dk-preproduction.postnord.com",production:"dk-production.postnord.com",live:"www.postnord.dk"},fi:{fallbackLanguage:"fi",integration:"fi-integration.postnord.com",preproduction:"fi-preproduction.postnord.com",production:"fi-production.postnord.com",live:"www.postnord.fi"},no:{fallbackLanguage:"no",integration:"no-integration.postnord.com",preproduction:"no-preproduction.postnord.com",production:"no-production.postnord.com",live:"www.postnord.no"},com:{fallbackLanguage:"en",integration:"com-integration.postnord.com",preproduction:"com-preproduction.postnord.com",production:"com-production.postnord.com",live:"www.postnord.com"},de:{fallbackLanguage:"en",integration:"de-integration.postnord.com",preproduction:"de-preproduction.postnord.com",production:"de-production.postnord.com",live:"www.postnord.de"},tpl:{fallbackLanguage:"sv",integration:"tpl-integration.postnord.com",preproduction:"tpl-preproduction.postnord.com",production:"tpl-production.postnord.com",live:"tpl.postnord.com"}},this.environmentTypes=["integration","preproduction","production"],this.environments={production:{name:"production",url:"https://www.postnord.xx/"},preproduction:{name:"preproduction",url:"https://com-preproduction.postnord.com/"},integration:{name:"integration",url:"https://com-integration.postnord.com/"}},this.href=t,this.url=new URL(this.href)}async getLanguage(){return this.language||await this.resolveLanguage(),this.language}async getMarket(){return this.market||await this.resolveMarket(),this.market}async getEndpoint(t,o=""){let i=this.environments.production.url;if(this.markets[o]&&this.markets[o][t]){if("production"===t&&0===window.location.hostname.indexOf(this.markets[o].live))return"https://"+this.markets[o].live;if(0===window.location.hostname.indexOf(this.markets[o][t]))return"https://"+this.markets[o][t]}return this.environments[t]&&(i=this.environments[t].url,t===this.environments.production.name&&(-1!==this.wwwMarkets.indexOf(o)?i=i.replace(".xx","."+o):(i=i.replace(".xx",".com"),i=i.replace("www.",o+".")))),i}async getEnvironmentName(){const t=this.environmentTypes.filter((t=>-1!==this.url.hostname.indexOf("-"+t)))[0];return t?(this.environment=t,this.environment):-1!==this.url.hostname.indexOf("www.")?(this.environment=this.environments.production.name,this.environment):(this.environment=this.environments.integration.name,this.environment)}isDevEnvironment(){return this.developmentDomains.filter((t=>-1!==this.url.hostname.indexOf(t)))[0].length>0}async resolveMarket(){if(-1!==this.href.indexOf("//www.")){const t=this.url.hostname.substring(this.url.hostname.lastIndexOf(".")+1,this.url.hostname.length);t&&this.markets[t]?this.market=t:console.warn("Unable to define market from www. domain",this.href)}const t=this.environmentTypes.filter((t=>-1!==this.url.hostname.indexOf("-"+t)));if(!this.market&&t&&t.length>0){const o=this.url.hostname.substring(0,this.url.hostname.indexOf("-"+t[0]));o&&this.markets[o]?this.market=o:console.warn("Unable to define market from preset environment names",this.href)}if(!this.market&&-1===this.url.hostname.indexOf("www")&&this.url.hostname.indexOf(".postnord.")>0){const t=this.url.hostname.indexOf(".")!==this.url.hostname.indexOf(".postnord")?this.url.hostname.indexOf("."):0,o=this.url.hostname.substring(t,this.url.hostname.indexOf(".postnord."));if(-1!==this.allowedMarkets.indexOf(o))return void(this.market=o)}if(!this.market){const t=this.developmentDomains.filter((t=>-1!==this.url.hostname.indexOf(t)))[0];if(!t)return void(this.market=this.allowedMarkets[0]);const o=this.href.replace(t,"");let i=this.allowedMarkets.filter((t=>["."+t,t+".","/"+t+"/"].filter((t=>-1!==o.indexOf(t))).length>0))[0];if(i)this.market=i;else{let t=Object.entries(this.markets).filter((t=>["."+t[1].fallbackLanguage,t[1].fallbackLanguage+".","/"+t[1].fallbackLanguage+"/"].filter((t=>-1!==o.indexOf(t))).length>0))[0];t&&t[0]&&(this.market=t[0])}}this.market||(console.info("Was unable to detect market, used fallback"),this.market=this.allowedMarkets[0])}async resolveLanguage(){var t,o,i,n;this.language||([null===(t=document.querySelector("html[lang]"))||void 0===t?void 0:t.getAttribute("lang"),null===(o=document.querySelector('[http-equiv="content-language"][content]'))||void 0===o?void 0:o.getAttribute("content"),null===(i=document.querySelector('[property="og:locale"][content]'))||void 0===i?void 0:i.getAttribute("content"),null===(n=document.querySelector("[lang]"))||void 0===n?void 0:n.getAttribute("lang")].filter((t=>t)).forEach((t=>{this.allowedLanguages.indexOf(t)&&(this.language=t)})),!this.language&&this.market&&(this.language=this.markets[this.market].fallbackLanguage))}}export{t as F,o as M}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,a as e}from"./p-57d37022.js";const n=class{constructor(i){t(this,i),this.disabled=!1,this.error="",this.invalid=!1,this.helpertext="",this.label="",this.placeholder="",this.inputid=`${Math.random()}`,this.name="",this.required=null,this.type="text",this.autocomplete="",this.valid=null,this.value="",this.maxlength="",this.min="",this.max="",this.step="",this.pattern="",this.showText=!1}getTextMessage(){return this.error?this.error:this.helpertext?this.helpertext:null}toggleTextVisibility(){this.showText=!this.showText}getInputType(){return["text","password","url","tel","search","number","email","date","datetime-local","month","week","time"].includes(this.type)&&!this.showText?this.type:"text"}setVal(t){var i;const e=null===(i=t.composedPath)||void 0===i?void 0:i.call(t)[0];this.value=e.value}getClassNames(){let t="pn-input ";return(this.error.length>0||this.invalid)&&(t+="error "),this.valid&&(t+="valid "),"password"===this.type&&(t+="password "),(this.error||this.invalid||this.valid)&&(t+="icon "),t}render(){return i(e,{class:this.getClassNames()},(this.label||this.maxlength)&&i("div",{class:"label-container"},this.label&&i("label",{htmlFor:this.inputid},this.label),parseInt(this.maxlength)>0&&i("label",{class:"char-count",htmlFor:this.inputid},`${this.value.length}/${this.maxlength}`)),i("div",{class:"input-container"},i("input",{type:this.getInputType(),value:this.value,id:this.inputid,name:this.name,placeholder:this.placeholder,disabled:this.disabled,autocomplete:this.autocomplete,onInput:t=>this.setVal(t),maxlength:this.maxlength?this.maxlength:null,min:this.min?this.min:null,max:this.max?this.max:null,step:this.step?this.step:null,pattern:this.pattern?this.pattern:null}),i("svg",{class:"pn-input-checkmark",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none"},i("polyline",{class:"checkmark-path",points:"4,12 9,17 20,6","stroke-width":"3"})),"password"===this.type&&!this.disabled&&i("button",{onClick:()=>this.toggleTextVisibility()},"Show")),this.getTextMessage()&&i("small",null,this.error&&i("pn-icon",{symbol:"alert-exclamation-circle",small:!0,color:"warning"}),this.getTextMessage()))}};n.style="pn--marketweb-input{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}pn-marketweb-input input{padding:0.75em;font-size:1em;font-weight:500;-webkit-font-smoothing:antialiased;outline:none;border-radius:0.8rem;border:0.1rem solid #5E554A;-webkit-transition:border 0.15s, -webkit-box-shadow 0.15s;transition:border 0.15s, -webkit-box-shadow 0.15s;transition:box-shadow 0.15s, border 0.15s;transition:box-shadow 0.15s, border 0.15s, -webkit-box-shadow 0.15s;color:#000000;width:100%}pn-marketweb-input input::-webkit-input-placeholder{color:#969087;font-weight:normal}pn-marketweb-input input::-moz-placeholder{color:#969087;font-weight:normal}pn-marketweb-input input:-ms-input-placeholder{color:#969087;font-weight:normal}pn-marketweb-input input::-ms-input-placeholder{color:#969087;font-weight:normal}pn-marketweb-input input::placeholder{color:#969087;font-weight:normal}pn-marketweb-input input:focus{border:0.1rem solid #005D92;-webkit-box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #005D92;box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #005D92}pn-marketweb-input input:hover{border:0.1rem solid #00A0D6}pn-marketweb-input input:disabled{background:#F3F2F2;border:none}pn-marketweb-input>.input-container{position:relative}pn-marketweb-input>.input-container>button{position:absolute;right:1.2rem;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);background:none;border:none;cursor:pointer;color:#005D92;padding:0.6rem;border-radius:0.8rem;outline:none;-webkit-transition:border 0.1s, background 0.2s, color 0.1s;transition:border 0.1s, background 0.2s, color 0.1s;border:0.1rem solid transparent}pn-marketweb-input>.input-container>button:focus{border:0.1rem solid #005D92}pn-marketweb-input>.input-container>button:hover{background:#E0F8FF}pn-marketweb-input>.input-container>button:active{background:#005D92;color:white}pn-marketweb-input>.input-container>svg{position:absolute;right:0.75em;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);height:1.5em;width:1.5em;pointer-events:none}pn-marketweb-input>.input-container>svg polyline{stroke-linecap:round;-webkit-transition:stroke-dashoffset 0.2s cubic-bezier(0.79, 0.14, 0.15, 0.86);transition:stroke-dashoffset 0.2s cubic-bezier(0.79, 0.14, 0.15, 0.86)}pn-marketweb-input>.input-container>svg.pn-input-checkmark polyline{stroke:#005E41;stroke-dashoffset:23;stroke-dasharray:23}pn-marketweb-input .label-container{margin-bottom:0.4rem;color:#5E554A;font-size:0.875em;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:end;align-items:flex-end}pn-marketweb-input .label-container label{cursor:pointer;-webkit-transition:color 0.2s;transition:color 0.2s}.label-container label.char-count{-ms-flex-negative:0;flex-shrink:0;padding-left:0.5em}pn-marketweb-input small{font-size:0.75em;font-size:max(.6em, 1.2rem);-webkit-transition:-webkit-transform 0.2s cubic-bezier(0.79, 0.14, 0.15, 0.86);transition:-webkit-transform 0.2s cubic-bezier(0.79, 0.14, 0.15, 0.86);transition:transform 0.2s cubic-bezier(0.79, 0.14, 0.15, 0.86);transition:transform 0.2s cubic-bezier(0.79, 0.14, 0.15, 0.86), -webkit-transform 0.2s cubic-bezier(0.79, 0.14, 0.15, 0.86);margin-top:0.5em;color:#5E554A}pn-input.error{color:#A70707}pn-input.error label{color:#A70707}pn-input.error small{color:#A70707}pn-input.error small>pn-icon{margin-right:0.25em}pn-input.error input{border:0.1rem solid #A70707}pn-input.error input:focus{border:0.1rem solid #A70707;-webkit-box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #A70707;box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #A70707}pn-input.error input:hover{border:0.1rem solid #F06365}pn-input.valid{color:#005E41}pn-input.valid .input-container>svg.pn-input-checkmark polyline{stroke-dashoffset:0}pn-input.valid label{color:#005E41}pn-input.valid input{border:0.1rem solid #005E41}pn-input.valid input:focus{border:0.1rem solid #005E41;-webkit-box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #005E41;box-shadow:0 0 0 0.2rem #fff, 0 0 0 0.4rem #005E41}pn-input.valid input:hover{border:0.1rem solid #5EC584}pn-marketweb-input.password input{padding-right:4em}pn-marketweb-input.icon input{padding-right:2.3em}";export{n as pn_marketweb_input}
|
|
@@ -1,89 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
class FetchHelper {
|
|
4
|
-
constructor(namespace = "") {
|
|
5
|
-
this.storagePrefix = "";
|
|
6
|
-
this.store = {
|
|
7
|
-
get: (key, permanentStorageFirst = false) => {
|
|
8
|
-
const firstProfider = permanentStorageFirst ? window.localStorage : window.sessionStorage;
|
|
9
|
-
const secondProvider = permanentStorageFirst ? window.sessionStorage : window.localStorage;
|
|
10
|
-
let value = firstProfider.getItem(`${this.storagePrefix}-${key}`);
|
|
11
|
-
if (!value) {
|
|
12
|
-
value = secondProvider.getItem(`${this.storagePrefix}-${key}`);
|
|
13
|
-
}
|
|
14
|
-
if (!value) {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
if (value.indexOf('{') === 0) {
|
|
18
|
-
try {
|
|
19
|
-
return JSON.parse(value);
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (value.indexOf(',') !== -1) {
|
|
25
|
-
return value.split(',');
|
|
26
|
-
}
|
|
27
|
-
return value;
|
|
28
|
-
},
|
|
29
|
-
set: (key, value, permanent = false) => {
|
|
30
|
-
const provider = permanent ? window.localStorage : window.sessionStorage;
|
|
31
|
-
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
32
|
-
provider.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
provider.setItem(`${this.storagePrefix}-${key}`, value);
|
|
36
|
-
},
|
|
37
|
-
remove: (key) => {
|
|
38
|
-
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
this.storagePrefix = namespace;
|
|
42
|
-
}
|
|
43
|
-
async fetchJson(input, init = {}, useCache = false, onCacheUpdated = null) {
|
|
44
|
-
const requestPromise = new Promise(async (resolve) => {
|
|
45
|
-
let doFetchRequest = true;
|
|
46
|
-
const url = (typeof input === "string") ? input : input.url;
|
|
47
|
-
const cacheKey = url;
|
|
48
|
-
let jsonData = null;
|
|
49
|
-
let cachedData = null;
|
|
50
|
-
if (useCache) {
|
|
51
|
-
cachedData = this.store.get(cacheKey);
|
|
52
|
-
// If the data was stored in session storage, then we don't need to do a full request
|
|
53
|
-
if (cachedData && !cachedData.permanent) {
|
|
54
|
-
doFetchRequest = false;
|
|
55
|
-
}
|
|
56
|
-
if (cachedData && cachedData.data) {
|
|
57
|
-
jsonData = cachedData.data;
|
|
58
|
-
resolve(jsonData);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (doFetchRequest) {
|
|
62
|
-
const response = await window.fetch(input, init);
|
|
63
|
-
jsonData = await response.json();
|
|
64
|
-
resolve(jsonData);
|
|
65
|
-
if (useCache) {
|
|
66
|
-
if (typeof onCacheUpdated === "function" && cachedData != null) {
|
|
67
|
-
onCacheUpdated(jsonData);
|
|
68
|
-
}
|
|
69
|
-
this.store.set(cacheKey, this.wrapJson(jsonData, true), true);
|
|
70
|
-
this.store.set(cacheKey, this.wrapJson(jsonData, false), false);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return requestPromise;
|
|
75
|
-
}
|
|
76
|
-
wrapJson(data, permanent = false) {
|
|
77
|
-
const now = new Date();
|
|
78
|
-
return {
|
|
79
|
-
timestamp: now.getTime(),
|
|
80
|
-
time: now.toISOString(),
|
|
81
|
-
data: data,
|
|
82
|
-
permanent: permanent
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
3
|
class MarketWebContextService {
|
|
88
4
|
constructor(href = window.location.href) {
|
|
89
5
|
this.href = '';
|
|
@@ -317,5 +233,89 @@ class MarketWebContextService {
|
|
|
317
233
|
}
|
|
318
234
|
}
|
|
319
235
|
|
|
236
|
+
class FetchHelper {
|
|
237
|
+
constructor(namespace = "") {
|
|
238
|
+
this.storagePrefix = "";
|
|
239
|
+
this.store = {
|
|
240
|
+
get: (key, permanentStorageFirst = false) => {
|
|
241
|
+
const firstProfider = permanentStorageFirst ? window.localStorage : window.sessionStorage;
|
|
242
|
+
const secondProvider = permanentStorageFirst ? window.sessionStorage : window.localStorage;
|
|
243
|
+
let value = firstProfider.getItem(`${this.storagePrefix}-${key}`);
|
|
244
|
+
if (!value) {
|
|
245
|
+
value = secondProvider.getItem(`${this.storagePrefix}-${key}`);
|
|
246
|
+
}
|
|
247
|
+
if (!value) {
|
|
248
|
+
return value;
|
|
249
|
+
}
|
|
250
|
+
if (value.indexOf('{') === 0) {
|
|
251
|
+
try {
|
|
252
|
+
return JSON.parse(value);
|
|
253
|
+
}
|
|
254
|
+
catch (e) {
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (value.indexOf(',') !== -1) {
|
|
258
|
+
return value.split(',');
|
|
259
|
+
}
|
|
260
|
+
return value;
|
|
261
|
+
},
|
|
262
|
+
set: (key, value, permanent = false) => {
|
|
263
|
+
const provider = permanent ? window.localStorage : window.sessionStorage;
|
|
264
|
+
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
265
|
+
provider.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
provider.setItem(`${this.storagePrefix}-${key}`, value);
|
|
269
|
+
},
|
|
270
|
+
remove: (key) => {
|
|
271
|
+
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
this.storagePrefix = namespace;
|
|
275
|
+
}
|
|
276
|
+
async fetchJson(input, init = {}, useCache = false, onCacheUpdated = null) {
|
|
277
|
+
const requestPromise = new Promise(async (resolve) => {
|
|
278
|
+
let doFetchRequest = true;
|
|
279
|
+
const url = (typeof input === "string") ? input : input.url;
|
|
280
|
+
const cacheKey = url;
|
|
281
|
+
let jsonData = null;
|
|
282
|
+
let cachedData = null;
|
|
283
|
+
if (useCache) {
|
|
284
|
+
cachedData = this.store.get(cacheKey);
|
|
285
|
+
// If the data was stored in session storage, then we don't need to do a full request
|
|
286
|
+
if (cachedData && !cachedData.permanent) {
|
|
287
|
+
doFetchRequest = false;
|
|
288
|
+
}
|
|
289
|
+
if (cachedData && cachedData.data) {
|
|
290
|
+
jsonData = cachedData.data;
|
|
291
|
+
resolve(jsonData);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (doFetchRequest) {
|
|
295
|
+
const response = await window.fetch(input, init);
|
|
296
|
+
jsonData = await response.json();
|
|
297
|
+
resolve(jsonData);
|
|
298
|
+
if (useCache) {
|
|
299
|
+
if (typeof onCacheUpdated === "function" && cachedData != null) {
|
|
300
|
+
onCacheUpdated(jsonData);
|
|
301
|
+
}
|
|
302
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, true), true);
|
|
303
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, false), false);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return requestPromise;
|
|
308
|
+
}
|
|
309
|
+
wrapJson(data, permanent = false) {
|
|
310
|
+
const now = new Date();
|
|
311
|
+
return {
|
|
312
|
+
timestamp: now.getTime(),
|
|
313
|
+
time: now.toISOString(),
|
|
314
|
+
data: data,
|
|
315
|
+
permanent: permanent
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
320
|
exports.FetchHelper = FetchHelper;
|
|
321
321
|
exports.MarketWebContextService = MarketWebContextService;
|
|
File without changes
|
|
File without changes
|
package/collection/components/{layout-components → input}/pn-multi-formfield/pn-multi-formfield.css
RENAMED
|
File without changes
|
package/collection/components/{layout-components → input}/pn-multi-formfield/pn-multi-formfield.js
RENAMED
|
File without changes
|
|
@@ -1,87 +1,3 @@
|
|
|
1
|
-
class FetchHelper {
|
|
2
|
-
constructor(namespace = "") {
|
|
3
|
-
this.storagePrefix = "";
|
|
4
|
-
this.store = {
|
|
5
|
-
get: (key, permanentStorageFirst = false) => {
|
|
6
|
-
const firstProfider = permanentStorageFirst ? window.localStorage : window.sessionStorage;
|
|
7
|
-
const secondProvider = permanentStorageFirst ? window.sessionStorage : window.localStorage;
|
|
8
|
-
let value = firstProfider.getItem(`${this.storagePrefix}-${key}`);
|
|
9
|
-
if (!value) {
|
|
10
|
-
value = secondProvider.getItem(`${this.storagePrefix}-${key}`);
|
|
11
|
-
}
|
|
12
|
-
if (!value) {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
if (value.indexOf('{') === 0) {
|
|
16
|
-
try {
|
|
17
|
-
return JSON.parse(value);
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (value.indexOf(',') !== -1) {
|
|
23
|
-
return value.split(',');
|
|
24
|
-
}
|
|
25
|
-
return value;
|
|
26
|
-
},
|
|
27
|
-
set: (key, value, permanent = false) => {
|
|
28
|
-
const provider = permanent ? window.localStorage : window.sessionStorage;
|
|
29
|
-
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
30
|
-
provider.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
provider.setItem(`${this.storagePrefix}-${key}`, value);
|
|
34
|
-
},
|
|
35
|
-
remove: (key) => {
|
|
36
|
-
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
this.storagePrefix = namespace;
|
|
40
|
-
}
|
|
41
|
-
async fetchJson(input, init = {}, useCache = false, onCacheUpdated = null) {
|
|
42
|
-
const requestPromise = new Promise(async (resolve) => {
|
|
43
|
-
let doFetchRequest = true;
|
|
44
|
-
const url = (typeof input === "string") ? input : input.url;
|
|
45
|
-
const cacheKey = url;
|
|
46
|
-
let jsonData = null;
|
|
47
|
-
let cachedData = null;
|
|
48
|
-
if (useCache) {
|
|
49
|
-
cachedData = this.store.get(cacheKey);
|
|
50
|
-
// If the data was stored in session storage, then we don't need to do a full request
|
|
51
|
-
if (cachedData && !cachedData.permanent) {
|
|
52
|
-
doFetchRequest = false;
|
|
53
|
-
}
|
|
54
|
-
if (cachedData && cachedData.data) {
|
|
55
|
-
jsonData = cachedData.data;
|
|
56
|
-
resolve(jsonData);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (doFetchRequest) {
|
|
60
|
-
const response = await window.fetch(input, init);
|
|
61
|
-
jsonData = await response.json();
|
|
62
|
-
resolve(jsonData);
|
|
63
|
-
if (useCache) {
|
|
64
|
-
if (typeof onCacheUpdated === "function" && cachedData != null) {
|
|
65
|
-
onCacheUpdated(jsonData);
|
|
66
|
-
}
|
|
67
|
-
this.store.set(cacheKey, this.wrapJson(jsonData, true), true);
|
|
68
|
-
this.store.set(cacheKey, this.wrapJson(jsonData, false), false);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return requestPromise;
|
|
73
|
-
}
|
|
74
|
-
wrapJson(data, permanent = false) {
|
|
75
|
-
const now = new Date();
|
|
76
|
-
return {
|
|
77
|
-
timestamp: now.getTime(),
|
|
78
|
-
time: now.toISOString(),
|
|
79
|
-
data: data,
|
|
80
|
-
permanent: permanent
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
1
|
class MarketWebContextService {
|
|
86
2
|
constructor(href = window.location.href) {
|
|
87
3
|
this.href = '';
|
|
@@ -315,4 +231,88 @@ class MarketWebContextService {
|
|
|
315
231
|
}
|
|
316
232
|
}
|
|
317
233
|
|
|
234
|
+
class FetchHelper {
|
|
235
|
+
constructor(namespace = "") {
|
|
236
|
+
this.storagePrefix = "";
|
|
237
|
+
this.store = {
|
|
238
|
+
get: (key, permanentStorageFirst = false) => {
|
|
239
|
+
const firstProfider = permanentStorageFirst ? window.localStorage : window.sessionStorage;
|
|
240
|
+
const secondProvider = permanentStorageFirst ? window.sessionStorage : window.localStorage;
|
|
241
|
+
let value = firstProfider.getItem(`${this.storagePrefix}-${key}`);
|
|
242
|
+
if (!value) {
|
|
243
|
+
value = secondProvider.getItem(`${this.storagePrefix}-${key}`);
|
|
244
|
+
}
|
|
245
|
+
if (!value) {
|
|
246
|
+
return value;
|
|
247
|
+
}
|
|
248
|
+
if (value.indexOf('{') === 0) {
|
|
249
|
+
try {
|
|
250
|
+
return JSON.parse(value);
|
|
251
|
+
}
|
|
252
|
+
catch (e) {
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (value.indexOf(',') !== -1) {
|
|
256
|
+
return value.split(',');
|
|
257
|
+
}
|
|
258
|
+
return value;
|
|
259
|
+
},
|
|
260
|
+
set: (key, value, permanent = false) => {
|
|
261
|
+
const provider = permanent ? window.localStorage : window.sessionStorage;
|
|
262
|
+
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
263
|
+
provider.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
provider.setItem(`${this.storagePrefix}-${key}`, value);
|
|
267
|
+
},
|
|
268
|
+
remove: (key) => {
|
|
269
|
+
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
this.storagePrefix = namespace;
|
|
273
|
+
}
|
|
274
|
+
async fetchJson(input, init = {}, useCache = false, onCacheUpdated = null) {
|
|
275
|
+
const requestPromise = new Promise(async (resolve) => {
|
|
276
|
+
let doFetchRequest = true;
|
|
277
|
+
const url = (typeof input === "string") ? input : input.url;
|
|
278
|
+
const cacheKey = url;
|
|
279
|
+
let jsonData = null;
|
|
280
|
+
let cachedData = null;
|
|
281
|
+
if (useCache) {
|
|
282
|
+
cachedData = this.store.get(cacheKey);
|
|
283
|
+
// If the data was stored in session storage, then we don't need to do a full request
|
|
284
|
+
if (cachedData && !cachedData.permanent) {
|
|
285
|
+
doFetchRequest = false;
|
|
286
|
+
}
|
|
287
|
+
if (cachedData && cachedData.data) {
|
|
288
|
+
jsonData = cachedData.data;
|
|
289
|
+
resolve(jsonData);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (doFetchRequest) {
|
|
293
|
+
const response = await window.fetch(input, init);
|
|
294
|
+
jsonData = await response.json();
|
|
295
|
+
resolve(jsonData);
|
|
296
|
+
if (useCache) {
|
|
297
|
+
if (typeof onCacheUpdated === "function" && cachedData != null) {
|
|
298
|
+
onCacheUpdated(jsonData);
|
|
299
|
+
}
|
|
300
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, true), true);
|
|
301
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, false), false);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
return requestPromise;
|
|
306
|
+
}
|
|
307
|
+
wrapJson(data, permanent = false) {
|
|
308
|
+
const now = new Date();
|
|
309
|
+
return {
|
|
310
|
+
timestamp: now.getTime(),
|
|
311
|
+
time: now.toISOString(),
|
|
312
|
+
data: data,
|
|
313
|
+
permanent: permanent
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
318
|
export { FetchHelper as F, MarketWebContextService as M };
|
|
@@ -1,87 +1,3 @@
|
|
|
1
|
-
class FetchHelper {
|
|
2
|
-
constructor(namespace = "") {
|
|
3
|
-
this.storagePrefix = "";
|
|
4
|
-
this.store = {
|
|
5
|
-
get: (key, permanentStorageFirst = false) => {
|
|
6
|
-
const firstProfider = permanentStorageFirst ? window.localStorage : window.sessionStorage;
|
|
7
|
-
const secondProvider = permanentStorageFirst ? window.sessionStorage : window.localStorage;
|
|
8
|
-
let value = firstProfider.getItem(`${this.storagePrefix}-${key}`);
|
|
9
|
-
if (!value) {
|
|
10
|
-
value = secondProvider.getItem(`${this.storagePrefix}-${key}`);
|
|
11
|
-
}
|
|
12
|
-
if (!value) {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
if (value.indexOf('{') === 0) {
|
|
16
|
-
try {
|
|
17
|
-
return JSON.parse(value);
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (value.indexOf(',') !== -1) {
|
|
23
|
-
return value.split(',');
|
|
24
|
-
}
|
|
25
|
-
return value;
|
|
26
|
-
},
|
|
27
|
-
set: (key, value, permanent = false) => {
|
|
28
|
-
const provider = permanent ? window.localStorage : window.sessionStorage;
|
|
29
|
-
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
30
|
-
provider.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
provider.setItem(`${this.storagePrefix}-${key}`, value);
|
|
34
|
-
},
|
|
35
|
-
remove: (key) => {
|
|
36
|
-
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
this.storagePrefix = namespace;
|
|
40
|
-
}
|
|
41
|
-
async fetchJson(input, init = {}, useCache = false, onCacheUpdated = null) {
|
|
42
|
-
const requestPromise = new Promise(async (resolve) => {
|
|
43
|
-
let doFetchRequest = true;
|
|
44
|
-
const url = (typeof input === "string") ? input : input.url;
|
|
45
|
-
const cacheKey = url;
|
|
46
|
-
let jsonData = null;
|
|
47
|
-
let cachedData = null;
|
|
48
|
-
if (useCache) {
|
|
49
|
-
cachedData = this.store.get(cacheKey);
|
|
50
|
-
// If the data was stored in session storage, then we don't need to do a full request
|
|
51
|
-
if (cachedData && !cachedData.permanent) {
|
|
52
|
-
doFetchRequest = false;
|
|
53
|
-
}
|
|
54
|
-
if (cachedData && cachedData.data) {
|
|
55
|
-
jsonData = cachedData.data;
|
|
56
|
-
resolve(jsonData);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (doFetchRequest) {
|
|
60
|
-
const response = await window.fetch(input, init);
|
|
61
|
-
jsonData = await response.json();
|
|
62
|
-
resolve(jsonData);
|
|
63
|
-
if (useCache) {
|
|
64
|
-
if (typeof onCacheUpdated === "function" && cachedData != null) {
|
|
65
|
-
onCacheUpdated(jsonData);
|
|
66
|
-
}
|
|
67
|
-
this.store.set(cacheKey, this.wrapJson(jsonData, true), true);
|
|
68
|
-
this.store.set(cacheKey, this.wrapJson(jsonData, false), false);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return requestPromise;
|
|
73
|
-
}
|
|
74
|
-
wrapJson(data, permanent = false) {
|
|
75
|
-
const now = new Date();
|
|
76
|
-
return {
|
|
77
|
-
timestamp: now.getTime(),
|
|
78
|
-
time: now.toISOString(),
|
|
79
|
-
data: data,
|
|
80
|
-
permanent: permanent
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
1
|
class MarketWebContextService {
|
|
86
2
|
constructor(href = window.location.href) {
|
|
87
3
|
this.href = '';
|
|
@@ -315,4 +231,88 @@ class MarketWebContextService {
|
|
|
315
231
|
}
|
|
316
232
|
}
|
|
317
233
|
|
|
234
|
+
class FetchHelper {
|
|
235
|
+
constructor(namespace = "") {
|
|
236
|
+
this.storagePrefix = "";
|
|
237
|
+
this.store = {
|
|
238
|
+
get: (key, permanentStorageFirst = false) => {
|
|
239
|
+
const firstProfider = permanentStorageFirst ? window.localStorage : window.sessionStorage;
|
|
240
|
+
const secondProvider = permanentStorageFirst ? window.sessionStorage : window.localStorage;
|
|
241
|
+
let value = firstProfider.getItem(`${this.storagePrefix}-${key}`);
|
|
242
|
+
if (!value) {
|
|
243
|
+
value = secondProvider.getItem(`${this.storagePrefix}-${key}`);
|
|
244
|
+
}
|
|
245
|
+
if (!value) {
|
|
246
|
+
return value;
|
|
247
|
+
}
|
|
248
|
+
if (value.indexOf('{') === 0) {
|
|
249
|
+
try {
|
|
250
|
+
return JSON.parse(value);
|
|
251
|
+
}
|
|
252
|
+
catch (e) {
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (value.indexOf(',') !== -1) {
|
|
256
|
+
return value.split(',');
|
|
257
|
+
}
|
|
258
|
+
return value;
|
|
259
|
+
},
|
|
260
|
+
set: (key, value, permanent = false) => {
|
|
261
|
+
const provider = permanent ? window.localStorage : window.sessionStorage;
|
|
262
|
+
if (typeof value === "object" && typeof value.length === "undefined") {
|
|
263
|
+
provider.setItem(`${this.storagePrefix}-${key}`, JSON.stringify(value));
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
provider.setItem(`${this.storagePrefix}-${key}`, value);
|
|
267
|
+
},
|
|
268
|
+
remove: (key) => {
|
|
269
|
+
window.sessionStorage.removeItem(`${this.storagePrefix}-${key}`);
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
this.storagePrefix = namespace;
|
|
273
|
+
}
|
|
274
|
+
async fetchJson(input, init = {}, useCache = false, onCacheUpdated = null) {
|
|
275
|
+
const requestPromise = new Promise(async (resolve) => {
|
|
276
|
+
let doFetchRequest = true;
|
|
277
|
+
const url = (typeof input === "string") ? input : input.url;
|
|
278
|
+
const cacheKey = url;
|
|
279
|
+
let jsonData = null;
|
|
280
|
+
let cachedData = null;
|
|
281
|
+
if (useCache) {
|
|
282
|
+
cachedData = this.store.get(cacheKey);
|
|
283
|
+
// If the data was stored in session storage, then we don't need to do a full request
|
|
284
|
+
if (cachedData && !cachedData.permanent) {
|
|
285
|
+
doFetchRequest = false;
|
|
286
|
+
}
|
|
287
|
+
if (cachedData && cachedData.data) {
|
|
288
|
+
jsonData = cachedData.data;
|
|
289
|
+
resolve(jsonData);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (doFetchRequest) {
|
|
293
|
+
const response = await window.fetch(input, init);
|
|
294
|
+
jsonData = await response.json();
|
|
295
|
+
resolve(jsonData);
|
|
296
|
+
if (useCache) {
|
|
297
|
+
if (typeof onCacheUpdated === "function" && cachedData != null) {
|
|
298
|
+
onCacheUpdated(jsonData);
|
|
299
|
+
}
|
|
300
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, true), true);
|
|
301
|
+
this.store.set(cacheKey, this.wrapJson(jsonData, false), false);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
return requestPromise;
|
|
306
|
+
}
|
|
307
|
+
wrapJson(data, permanent = false) {
|
|
308
|
+
const now = new Date();
|
|
309
|
+
return {
|
|
310
|
+
timestamp: now.getTime(),
|
|
311
|
+
time: now.toISOString(),
|
|
312
|
+
data: data,
|
|
313
|
+
permanent: permanent
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
318
|
export { FetchHelper as F, MarketWebContextService as M };
|
/package/types/components/{layout-components → input}/pn-multi-formfield/pn-multi-formfield.d.ts
RENAMED
|
File without changes
|
|
File without changes
|