@htmlbricks/hb-page-checkout 0.9.1 → 0.9.2
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 +5 -5
- package/release/release.js +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@htmlbricks/hb-page-checkout",
|
|
3
3
|
"displayName": "Svelte Page Payment WebComponent",
|
|
4
4
|
"description": "Svelte Page Payment WebComponent",
|
|
5
|
-
"version": "0.9.
|
|
5
|
+
"version": "0.9.2",
|
|
6
6
|
"main": "release/release.js",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"prepublish": "npm run build:release"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@htmlbricks/hb-jsutils": "^0.9.
|
|
33
|
+
"@htmlbricks/hb-jsutils": "^0.9.2",
|
|
34
34
|
"@htmlbricks/manifester": "^0.0.9",
|
|
35
35
|
"@rollup/plugin-alias": "^3.1.2",
|
|
36
36
|
"@rollup/plugin-commonjs": "^18.0.0",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"typescript-transform-paths": "^2.2.3"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@htmlbricks/hb-checkout": "^0.9.
|
|
74
|
-
"@htmlbricks/hb-checkout-shopping-cart": "^0.9.
|
|
73
|
+
"@htmlbricks/hb-checkout": "^0.9.2",
|
|
74
|
+
"@htmlbricks/hb-checkout-shopping-cart": "^0.9.2",
|
|
75
75
|
"dayjs": "^1.10.7",
|
|
76
76
|
"debounce": "^1.2.1"
|
|
77
77
|
},
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"html5-webcomponents"
|
|
83
83
|
],
|
|
84
84
|
"contributors": [],
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "a1e77b5ecd7c93bd5b6314301436712e2670218f"
|
|
86
86
|
}
|
package/release/release.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function o(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function d(t){t.parentNode.removeChild(t)}function c(t){return document.createElement(t)}function l(){return t=" ",document.createTextNode(t);var t}function u(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function p(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function f(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:p(t,e,n)}function m(t,e,n,r){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function h(t){const e={};for(const n of t)e[n.name]=n.value;return e}let g;function b(t){g=t}function y(){if(!g)throw new Error("Function called outside component initialization");return g}function v(){const t=y();return(e,n)=>{const r=t.$$.callbacks[e];if(r){const o=function(t,e,n=!1){const r=document.createEvent("CustomEvent");return r.initCustomEvent(t,n,!1,e),r}(e,n);r.slice().forEach((e=>{e.call(t,o)}))}}}const w=[],x=[],$=[],k=[],E=Promise.resolve();let C=!1;function T(t){$.push(t)}const S=new Set;let _=0;function N(){const t=g;do{for(;_<w.length;){const t=w[_];_++,b(t),O(t.$$)}for(b(null),w.length=0,_=0;x.length;)x.pop()();for(let t=0;t<$.length;t+=1){const e=$[t];S.has(e)||(S.add(e),e())}$.length=0}while(w.length);for(;k.length;)k.pop()();C=!1,S.clear(),b(t)}function O(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(T)}}const L=new Set;function V(t,e){-1===t.$$.dirty[0]&&(w.push(t),C||(C=!0,E.then(N)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function A(i,a,s,c,l,u,p,f=[-1]){const m=g;b(i);const h=i.$$={fragment:null,ctx:null,props:u,update:t,not_equal:l,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(m?m.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:a.target||m.$$.root};p&&p(h.root);let y=!1;if(h.ctx=s?s(i,a.props||{},((t,e,...n)=>{const r=n.length?n[0]:e;return h.ctx&&l(h.ctx[t],h.ctx[t]=r)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](r),y&&V(i,t)),e})):[],h.update(),y=!0,r(h.before_update),h.fragment=!!c&&c(h.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);h.fragment&&h.fragment.l(t),t.forEach(d)}else h.fragment&&h.fragment.c();a.intro&&((v=i.$$.fragment)&&v.i&&(L.delete(v),v.i(w))),function(t,n,i,a){const{fragment:s,on_mount:d,on_destroy:c,after_update:l}=t.$$;s&&s.m(n,i),a||T((()=>{const n=d.map(e).filter(o);c?c.push(...n):r(n),t.$$.on_mount=[]})),l.forEach(T)}(i,a.target,a.anchor,a.customElement),N()}var v,w;b(m)}let j;"function"==typeof HTMLElement&&(j=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(o);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){r(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var M="0.9.1";var J,D,P=(J=function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=e.getChildStyleToPass=void 0,e.getChildStyleToPass=function(t,e){var n,r,o="";if(t&&(null==e?void 0:e.length)&&(null===(n=Object.keys(t))||void 0===n?void 0:n.length)&&(null===(r=null==e?void 0:e.filter((function(e){return Object.keys(t).includes(e.name)})))||void 0===r?void 0:r.length))for(var i=function(n){(null==e?void 0:e.filter((function(e){return e.name===n&&e.defaultValue!==t[n]})))&&(o+="".concat(n,":").concat(t[n],";"))},a=0,s=Object.keys(t);a<s.length;a++)i(s[a]);return o},e.addComponent=function(t,e,n){if(!document.getElementById("hb-"+t+"-script")){var r=document.createElement("script");r.id="hb-"+t+"-script",r.src="https://cdn.jsdelivr.net/npm/@htmlbricks/hb-".concat(t,"@").concat(e,"/release/release.js"),n&&location.href.includes("localhost")&&(r.src="http://localhost:6006/".concat(t,"/dist/release.js")),document.head.appendChild(r)}};var n=function(){function t(t){if(!(null==t?void 0:t.dictionary))throw new Error("no dictionary provided");this.dictionary=t.dictionary,this.setLang(null==t?void 0:t.lang)}return t.prototype.setLang=function(e){e||(e=t.getDefaultLang()),this.lang=e},t.prototype.translateWord=function(e,n){return t.getDictionaryWord(e,this.dictionary,n||this.lang)},t.prototype.translateDate=function(e,n,r){return t.formatDate(e,n,r||this.lang)},t.getDefaultLang=function(){var t,e,n,r,o,i="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(e=null===(t=navigator.languages[0])||void 0===t?void 0:t.split("-")[0])||void 0===e?void 0:e.toLowerCase())||void 0===n?void 0:n.length)&&(i=null===(o=null===(r=navigator.languages[0])||void 0===r?void 0:r.split("-")[0])||void 0===o?void 0:o.toLowerCase()),i},t.getDictionaryWord=function(e,n,r){var o;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(r&&(null===(o=n[r])||void 0===o?void 0:o[e]))return n[r][e];var i="",a=t.getDefaultLang();if(!r||a!==r){var s=null==n?void 0:n[a];(null==s?void 0:s[e])&&(i=s[e])}return i},t.formatDate=function(e,n,r){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(r||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n},J(D={exports:{}},D.exports),D.exports),U={vars:[{name:"--edit-color",defaultValue:"green",description:"",valueType:"color"},{name:"--paypal-button-color",defaultValue:"yellow",description:"",valueType:"color"},{name:"--hb-heckout-border",defaultValue:"0.5px solid rgba(197, 197, 197, 0.808)",description:"",valueType:"string"},{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[{name:"title"},{name:"subtitle"}]},F={vars:[{name:"--hb-checkout-border",description:"",defaultValue:"0.5px solid rgba(197, 197, 197, 0.808)",valueType:"string"},{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[]},I=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,z=/^\s*/,H=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,q=/^:\s*/,W=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,B=/^[;\s]*/,K=/^\s+|\s+$/g,G="";function Q(t){return t?t.replace(K,G):G}var X=function(t,e){var n,r=null;if(!t||"string"!=typeof t)return r;for(var o,i,a=function(t,e){if("string"!=typeof t)throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function o(t){var e=t.match(R);e&&(n+=e.length);var o=t.lastIndexOf("\n");r=~o?t.length-o:r+t.length}function i(){var t={line:n,column:r};return function(e){return e.position=new a(t),c(),e}}function a(t){this.start=t,this.end={line:n,column:r},this.source=e.source}function s(o){var i=new Error(e.source+":"+n+":"+r+": "+o);if(i.reason=o,i.filename=e.source,i.line=n,i.column=r,i.source=t,!e.silent)throw i}function d(e){var n=e.exec(t);if(n){var r=n[0];return o(r),t=t.slice(r.length),n}}function c(){d(z)}function l(t){var e;for(t=t||[];e=u();)!1!==e&&t.push(e);return t}function u(){var e=i();if("/"==t.charAt(0)&&"*"==t.charAt(1)){for(var n=2;G!=t.charAt(n)&&("*"!=t.charAt(n)||"/"!=t.charAt(n+1));)++n;if(n+=2,G===t.charAt(n-1))return s("End of comment missing");var a=t.slice(2,n-2);return r+=2,o(a),t=t.slice(n),r+=2,e({type:"comment",comment:a})}}function p(){var t=i(),e=d(H);if(e){if(u(),!d(q))return s("property missing ':'");var n=d(W),r=t({type:"declaration",property:Q(e[0].replace(I,G)),value:n?Q(n[0].replace(I,G)):G});return d(B),r}}return a.prototype.content=t,c(),function(){var t,e=[];for(l(e);t=p();)!1!==t&&(e.push(t),l(e));return e}()}(t),s="function"==typeof e,d=0,c=a.length;d<c;d++)o=(n=a[d]).property,i=n.value,s?e(o,i,n):i&&(r||(r={}),r[o]=i);return r};function Y(e){let n,o,i,h,g,b,y,v,w,x,$,k,E;return{c(){n=c("div"),o=c("div"),i=c("div"),h=c("hb-checkout"),v=l(),w=c("div"),x=c("hb-checkout-shopping-cart"),this.c=t,f(h,"style",e[5]),f(h,"completed",e[4]),f(h,"user",e[1]),f(h,"shipments",g=JSON.stringify(e[0])),f(h,"gateways",b=JSON.stringify(e[3])),f(h,"payment",y=JSON.stringify(e[2])),p(i,"class","col-7"),m(i,"padding-right","30px"),f(x,"style",e[6]),f(x,"completed",e[4]),f(x,"payment",$=JSON.stringify(e[2])),p(w,"class","col-5"),m(w,"padding-left","30px"),p(o,"class","row"),p(n,"class","container")},m(t,r){s(t,n,r),a(n,o),a(o,i),a(i,h),a(o,v),a(o,w),a(w,x),k||(E=[u(h,"paymentCompleted",e[14]),u(h,"saveUser",e[15]),u(h,"saveShipment",e[16])],k=!0)},p(t,[e]){32&e&&f(h,"style",t[5]),16&e&&f(h,"completed",t[4]),2&e&&f(h,"user",t[1]),1&e&&g!==(g=JSON.stringify(t[0]))&&f(h,"shipments",g),8&e&&b!==(b=JSON.stringify(t[3]))&&f(h,"gateways",b),4&e&&y!==(y=JSON.stringify(t[2]))&&f(h,"payment",y),64&e&&f(x,"style",t[6]),16&e&&f(x,"completed",t[4]),4&e&&$!==($=JSON.stringify(t[2]))&&f(x,"payment",$)},i:t,o:t,d(t){t&&d(n),k=!1,r(E)}}}function Z(t,e,n){var r;let o,{style:i}=e,a="",s="",{id:d}=e,{shipments:c}=e,{user:l}=e,{payment:u}=e,{gateways:p}=e,{completed:f}=e;const m={merchantName:"merchant",countryCode:"IT",total:0,currencyCode:"EUR",items:[]},h=y(),g=v();function b(t,e){g(t,e),h.dispatchEvent&&h.dispatchEvent(new CustomEvent(t,{detail:e}))}function w(t){const e=c.findIndex((e=>e.id===t.id)),r=c[e];c.forEach((t=>t.selected=!1)),r.selected=!0,n(2,u.shipmentFee=r.price,u),console.log("sss",r,t)}function x(t){t.completed?(n(4,f="yes"),b("paymentCompleted",t)):console.warn(t)}P.addComponent("checkout-shopping-cart",M),P.addComponent("checkout",M);return t.$$set=t=>{"style"in t&&n(11,i=t.style),"id"in t&&n(10,d=t.id),"shipments"in t&&n(0,c=t.shipments),"user"in t&&n(1,l=t.user),"payment"in t&&n(2,u=t.payment),"gateways"in t&&n(3,p=t.gateways),"completed"in t&&n(4,f=t.completed)},t.$$.update=()=>{if(15391&t.$$.dirty){d||n(10,d=null),i&&(n(13,o=X(i)),n(5,a=P.getChildStyleToPass(o,null==U?void 0:U.vars)),n(6,s=P.getChildStyleToPass(o,null==F?void 0:F.vars))),f||n(4,f="no"),c?"string"==typeof c&&n(0,c=JSON.parse(c)||[]):n(0,c=[]),p?"string"==typeof p&&n(3,p=JSON.parse(p)||[]):n(3,p=[]),u?"string"==typeof u&&n(2,u=JSON.parse(u)):n(2,u=m),(c.find((t=>t.selected))||c.find((t=>t.standard)))&&n(2,u.shipmentFee=(c.find((t=>t.selected))||c.find((t=>t.standard))).price,u),l||n(1,l=null);let t,e=(null==u?void 0:u.shipmentFee)||0;for(const t of u.items)e+=t.unitaryPrice*(t.quantity||1)+Math.round(.01*t.taxPercentage*t.unitaryPrice*(t.quantity||1)*100)/100;null===n(12,r=null==u?void 0:u.countryCode)||void 0===r||r.toUpperCase(),t="EUR",n(2,u.total=Math.round(100*e)/100,u),n(2,u.currencyCode=t,u)}},[c,l,u,p,f,a,s,b,w,x,d,i,r,o,t=>x(t.detail),t=>b("saveUser",t.detail),t=>w(t.detail)]}class tt extends j{constructor(t){super(),this.shadowRoot.innerHTML='<style>@charset "UTF-8";@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host{font-family:"Roboto", sans-serif;display:block;margin:40px 0px 40px 0px;--hb-checkout-border:0.5px solid rgba(197, 197, 197, 0.808)}:host{--bs-blue:var(--bs-primary,#07689f);--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:var(--bs-danger,#f67280);--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:var(--bs-warning,#ffc107);--bs-teal:#20c997;--bs-cyan:var(--bs-info,#a2d5f2);--bs-white:#fff;--bs-gray:var(--bs-secondary,#c9d6df);--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:var(--bs-secondary,#c9d6df);--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:var(--bs-primary,#07689f);--bs-secondary:var(--bs-secondary,#c9d6df);--bs-success:var(--bs-warning,#ffc107);--bs-info:var(--bs-info,#a2d5f2);--bs-warning:#ffc107;--bs-danger:var(--bs-danger,#f67280);--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:33, 37, 41;--bs-body-bg-rgb:255, 255, 255;--bs-font-sans-serif:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-bg:#fff}*,*::before,*::after{box-sizing:border-box}@media(prefers-reduced-motion: no-preference){:host{scroll-behavior:smooth}}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}::-moz-focus-inner{padding:0;border-style:none}@media(min-width: 1200px){}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}.container{width:100%;padding-right:var(--bs-gutter-x, 0.75rem);padding-left:var(--bs-gutter-x, 0.75rem);margin-right:auto;margin-left:auto}@media(min-width: 576px){.container{max-width:540px}}@media(min-width: 768px){.container{max-width:720px}}@media(min-width: 992px){.container{max-width:960px}}@media(min-width: 1200px){.container{max-width:1140px}}@media(min-width: 1400px){.container{max-width:1320px}}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-0.5 * var(--bs-gutter-x));margin-left:calc(-0.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * 0.5);padding-left:calc(var(--bs-gutter-x) * 0.5);margin-top:var(--bs-gutter-y)}.col-5{flex:0 0 auto;width:41.66666667%}.col-7{flex:0 0 auto;width:58.33333333%}@media(min-width: 576px){}@media(min-width: 768px){}@media(min-width: 992px){}@media(min-width: 1200px){}@media(min-width: 1400px){}@media(prefers-reduced-motion: reduce){}@media(min-width: 576px){}@media(min-width: 768px){}@media(min-width: 992px){}@media(min-width: 1200px){}@media(min-width: 1400px){}@media(min-width: 1200px){}@media print{}hb-checkout-shopping-cart{border:var(--hb-checkout-border);--hb-checkout-border:0.5px solid rgba(197, 197, 197, 0.808)}</style>',A(this,{target:this.shadowRoot,props:h(this.attributes),customElement:!0},Z,Y,i,{style:11,id:10,shipments:0,user:1,payment:2,gateways:3,completed:4},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),N()))}static get observedAttributes(){return["style","id","shipments","user","payment","gateways","completed"]}get style(){return this.$$.ctx[11]}set style(t){this.$$set({style:t}),N()}get id(){return this.$$.ctx[10]}set id(t){this.$$set({id:t}),N()}get shipments(){return this.$$.ctx[0]}set shipments(t){this.$$set({shipments:t}),N()}get user(){return this.$$.ctx[1]}set user(t){this.$$set({user:t}),N()}get payment(){return this.$$.ctx[2]}set payment(t){this.$$set({payment:t}),N()}get gateways(){return this.$$.ctx[3]}set gateways(t){this.$$set({gateways:t}),N()}get completed(){return this.$$.ctx[4]}set completed(t){this.$$set({completed:t}),N()}}return customElements.define("hb-page-checkout",tt),tt}();
|
|
1
|
+
var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function o(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function s(t,e,n){t.insertBefore(e,n||null)}function d(t){t.parentNode.removeChild(t)}function c(t){return document.createElement(t)}function l(){return t=" ",document.createTextNode(t);var t}function u(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function p(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function f(t,e,n){e in t?t[e]="boolean"==typeof t[e]&&""===n||n:p(t,e,n)}function m(t,e,n,r){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function h(t){const e={};for(const n of t)e[n.name]=n.value;return e}let g;function b(t){g=t}function y(){if(!g)throw new Error("Function called outside component initialization");return g}function v(){const t=y();return(e,n)=>{const r=t.$$.callbacks[e];if(r){const o=function(t,e,n=!1){const r=document.createEvent("CustomEvent");return r.initCustomEvent(t,n,!1,e),r}(e,n);r.slice().forEach((e=>{e.call(t,o)}))}}}const w=[],x=[],$=[],k=[],E=Promise.resolve();let C=!1;function T(t){$.push(t)}const S=new Set;let _=0;function N(){const t=g;do{for(;_<w.length;){const t=w[_];_++,b(t),O(t.$$)}for(b(null),w.length=0,_=0;x.length;)x.pop()();for(let t=0;t<$.length;t+=1){const e=$[t];S.has(e)||(S.add(e),e())}$.length=0}while(w.length);for(;k.length;)k.pop()();C=!1,S.clear(),b(t)}function O(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(T)}}const L=new Set;function V(t,e){-1===t.$$.dirty[0]&&(w.push(t),C||(C=!0,E.then(N)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function A(i,a,s,c,l,u,p,f=[-1]){const m=g;b(i);const h=i.$$={fragment:null,ctx:null,props:u,update:t,not_equal:l,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(m?m.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:a.target||m.$$.root};p&&p(h.root);let y=!1;if(h.ctx=s?s(i,a.props||{},((t,e,...n)=>{const r=n.length?n[0]:e;return h.ctx&&l(h.ctx[t],h.ctx[t]=r)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](r),y&&V(i,t)),e})):[],h.update(),y=!0,r(h.before_update),h.fragment=!!c&&c(h.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);h.fragment&&h.fragment.l(t),t.forEach(d)}else h.fragment&&h.fragment.c();a.intro&&((v=i.$$.fragment)&&v.i&&(L.delete(v),v.i(w))),function(t,n,i,a){const{fragment:s,on_mount:d,on_destroy:c,after_update:l}=t.$$;s&&s.m(n,i),a||T((()=>{const n=d.map(e).filter(o);c?c.push(...n):r(n),t.$$.on_mount=[]})),l.forEach(T)}(i,a.target,a.anchor,a.customElement),N()}var v,w;b(m)}let j;"function"==typeof HTMLElement&&(j=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(o);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){r(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var M="0.9.2";var J,D,P=(J=function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=e.getChildStyleToPass=void 0,e.getChildStyleToPass=function(t,e){var n,r,o="";if(t&&(null==e?void 0:e.length)&&(null===(n=Object.keys(t))||void 0===n?void 0:n.length)&&(null===(r=null==e?void 0:e.filter((function(e){return Object.keys(t).includes(e.name)})))||void 0===r?void 0:r.length))for(var i=function(n){(null==e?void 0:e.filter((function(e){return e.name===n&&e.defaultValue!==t[n]})))&&(o+="".concat(n,":").concat(t[n],";"))},a=0,s=Object.keys(t);a<s.length;a++)i(s[a]);return o},e.addComponent=function(t,e,n){if(!document.getElementById("hb-"+t+"-script")){var r=document.createElement("script");r.id="hb-"+t+"-script",r.src="https://cdn.jsdelivr.net/npm/@htmlbricks/hb-".concat(t,"@").concat(e,"/release/release.js"),n&&location.href.includes("localhost")&&(r.src="http://localhost:6006/".concat(t,"/dist/release.js")),document.head.appendChild(r)}};var n=function(){function t(t){if(!(null==t?void 0:t.dictionary))throw new Error("no dictionary provided");this.dictionary=t.dictionary,this.setLang(null==t?void 0:t.lang)}return t.prototype.setLang=function(e){e||(e=t.getDefaultLang()),this.lang=e},t.prototype.translateWord=function(e,n){return t.getDictionaryWord(e,this.dictionary,n||this.lang)},t.prototype.translateDate=function(e,n,r){return t.formatDate(e,n,r||this.lang)},t.getDefaultLang=function(){var t,e,n,r,o,i="en";return(null===navigator||void 0===navigator?void 0:navigator.languages)&&(null===(n=null===(e=null===(t=navigator.languages[0])||void 0===t?void 0:t.split("-")[0])||void 0===e?void 0:e.toLowerCase())||void 0===n?void 0:n.length)&&(i=null===(o=null===(r=navigator.languages[0])||void 0===r?void 0:r.split("-")[0])||void 0===o?void 0:o.toLowerCase()),i},t.getDictionaryWord=function(e,n,r){var o;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(r&&(null===(o=n[r])||void 0===o?void 0:o[e]))return n[r][e];var i="",a=t.getDefaultLang();if(!r||a!==r){var s=null==n?void 0:n[a];(null==s?void 0:s[e])&&(i=s[e])}return i},t.formatDate=function(e,n,r){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(r||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n},J(D={exports:{}},D.exports),D.exports),U={vars:[{name:"--edit-color",defaultValue:"green",description:"",valueType:"color"},{name:"--paypal-button-color",defaultValue:"yellow",description:"",valueType:"color"},{name:"--hb-heckout-border",defaultValue:"0.5px solid rgba(197, 197, 197, 0.808)",description:"",valueType:"string"},{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[{name:"title"},{name:"subtitle"}]},F={vars:[{name:"--hb-checkout-border",description:"",defaultValue:"0.5px solid rgba(197, 197, 197, 0.808)",valueType:"string"},{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}],parts:[]},I=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,R=/\n/g,z=/^\s*/,H=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,q=/^:\s*/,W=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,B=/^[;\s]*/,K=/^\s+|\s+$/g,G="";function Q(t){return t?t.replace(K,G):G}var X=function(t,e){var n,r=null;if(!t||"string"!=typeof t)return r;for(var o,i,a=function(t,e){if("string"!=typeof t)throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function o(t){var e=t.match(R);e&&(n+=e.length);var o=t.lastIndexOf("\n");r=~o?t.length-o:r+t.length}function i(){var t={line:n,column:r};return function(e){return e.position=new a(t),c(),e}}function a(t){this.start=t,this.end={line:n,column:r},this.source=e.source}function s(o){var i=new Error(e.source+":"+n+":"+r+": "+o);if(i.reason=o,i.filename=e.source,i.line=n,i.column=r,i.source=t,!e.silent)throw i}function d(e){var n=e.exec(t);if(n){var r=n[0];return o(r),t=t.slice(r.length),n}}function c(){d(z)}function l(t){var e;for(t=t||[];e=u();)!1!==e&&t.push(e);return t}function u(){var e=i();if("/"==t.charAt(0)&&"*"==t.charAt(1)){for(var n=2;G!=t.charAt(n)&&("*"!=t.charAt(n)||"/"!=t.charAt(n+1));)++n;if(n+=2,G===t.charAt(n-1))return s("End of comment missing");var a=t.slice(2,n-2);return r+=2,o(a),t=t.slice(n),r+=2,e({type:"comment",comment:a})}}function p(){var t=i(),e=d(H);if(e){if(u(),!d(q))return s("property missing ':'");var n=d(W),r=t({type:"declaration",property:Q(e[0].replace(I,G)),value:n?Q(n[0].replace(I,G)):G});return d(B),r}}return a.prototype.content=t,c(),function(){var t,e=[];for(l(e);t=p();)!1!==t&&(e.push(t),l(e));return e}()}(t),s="function"==typeof e,d=0,c=a.length;d<c;d++)o=(n=a[d]).property,i=n.value,s?e(o,i,n):i&&(r||(r={}),r[o]=i);return r};function Y(e){let n,o,i,h,g,b,y,v,w,x,$,k,E;return{c(){n=c("div"),o=c("div"),i=c("div"),h=c("hb-checkout"),v=l(),w=c("div"),x=c("hb-checkout-shopping-cart"),this.c=t,f(h,"style",e[5]),f(h,"completed",e[4]),f(h,"user",e[1]),f(h,"shipments",g=JSON.stringify(e[0])),f(h,"gateways",b=JSON.stringify(e[3])),f(h,"payment",y=JSON.stringify(e[2])),p(i,"class","col-7"),m(i,"padding-right","30px"),f(x,"style",e[6]),f(x,"completed",e[4]),f(x,"payment",$=JSON.stringify(e[2])),p(w,"class","col-5"),m(w,"padding-left","30px"),p(o,"class","row"),p(n,"class","container")},m(t,r){s(t,n,r),a(n,o),a(o,i),a(i,h),a(o,v),a(o,w),a(w,x),k||(E=[u(h,"paymentCompleted",e[14]),u(h,"saveUser",e[15]),u(h,"saveShipment",e[16])],k=!0)},p(t,[e]){32&e&&f(h,"style",t[5]),16&e&&f(h,"completed",t[4]),2&e&&f(h,"user",t[1]),1&e&&g!==(g=JSON.stringify(t[0]))&&f(h,"shipments",g),8&e&&b!==(b=JSON.stringify(t[3]))&&f(h,"gateways",b),4&e&&y!==(y=JSON.stringify(t[2]))&&f(h,"payment",y),64&e&&f(x,"style",t[6]),16&e&&f(x,"completed",t[4]),4&e&&$!==($=JSON.stringify(t[2]))&&f(x,"payment",$)},i:t,o:t,d(t){t&&d(n),k=!1,r(E)}}}function Z(t,e,n){var r;let o,{style:i}=e,a="",s="",{id:d}=e,{shipments:c}=e,{user:l}=e,{payment:u}=e,{gateways:p}=e,{completed:f}=e;const m={merchantName:"merchant",countryCode:"IT",total:0,currencyCode:"EUR",items:[]},h=y(),g=v();function b(t,e){g(t,e),h.dispatchEvent&&h.dispatchEvent(new CustomEvent(t,{detail:e}))}function w(t){const e=c.findIndex((e=>e.id===t.id)),r=c[e];c.forEach((t=>t.selected=!1)),r.selected=!0,n(2,u.shipmentFee=r.price,u),console.log("sss",r,t)}function x(t){t.completed?(n(4,f="yes"),b("paymentCompleted",t)):console.warn(t)}P.addComponent("checkout-shopping-cart",M),P.addComponent("checkout",M);return t.$$set=t=>{"style"in t&&n(11,i=t.style),"id"in t&&n(10,d=t.id),"shipments"in t&&n(0,c=t.shipments),"user"in t&&n(1,l=t.user),"payment"in t&&n(2,u=t.payment),"gateways"in t&&n(3,p=t.gateways),"completed"in t&&n(4,f=t.completed)},t.$$.update=()=>{if(15391&t.$$.dirty){d||n(10,d=null),i&&(n(13,o=X(i)),n(5,a=P.getChildStyleToPass(o,null==U?void 0:U.vars)),n(6,s=P.getChildStyleToPass(o,null==F?void 0:F.vars))),f||n(4,f="no"),c?"string"==typeof c&&n(0,c=JSON.parse(c)||[]):n(0,c=[]),p?"string"==typeof p&&n(3,p=JSON.parse(p)||[]):n(3,p=[]),u?"string"==typeof u&&n(2,u=JSON.parse(u)):n(2,u=m),(c.find((t=>t.selected))||c.find((t=>t.standard)))&&n(2,u.shipmentFee=(c.find((t=>t.selected))||c.find((t=>t.standard))).price,u),l||n(1,l=null);let t,e=(null==u?void 0:u.shipmentFee)||0;for(const t of u.items)e+=t.unitaryPrice*(t.quantity||1)+Math.round(.01*t.taxPercentage*t.unitaryPrice*(t.quantity||1)*100)/100;null===n(12,r=null==u?void 0:u.countryCode)||void 0===r||r.toUpperCase(),t="EUR",n(2,u.total=Math.round(100*e)/100,u),n(2,u.currencyCode=t,u)}},[c,l,u,p,f,a,s,b,w,x,d,i,r,o,t=>x(t.detail),t=>b("saveUser",t.detail),t=>w(t.detail)]}class tt extends j{constructor(t){super(),this.shadowRoot.innerHTML='<style>@charset "UTF-8";@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host{font-family:"Roboto", sans-serif;display:block;margin:40px 0px 40px 0px;--hb-checkout-border:0.5px solid rgba(197, 197, 197, 0.808)}:host{--bs-blue:var(--bs-primary,#07689f);--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:var(--bs-danger,#f67280);--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:var(--bs-warning,#ffc107);--bs-teal:#20c997;--bs-cyan:var(--bs-info,#a2d5f2);--bs-white:#fff;--bs-gray:var(--bs-secondary,#c9d6df);--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:var(--bs-secondary,#c9d6df);--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:var(--bs-primary,#07689f);--bs-secondary:var(--bs-secondary,#c9d6df);--bs-success:var(--bs-warning,#ffc107);--bs-info:var(--bs-info,#a2d5f2);--bs-warning:#ffc107;--bs-danger:var(--bs-danger,#f67280);--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13, 110, 253;--bs-secondary-rgb:108, 117, 125;--bs-success-rgb:25, 135, 84;--bs-info-rgb:13, 202, 240;--bs-warning-rgb:255, 193, 7;--bs-danger-rgb:220, 53, 69;--bs-light-rgb:248, 249, 250;--bs-dark-rgb:33, 37, 41;--bs-white-rgb:255, 255, 255;--bs-black-rgb:0, 0, 0;--bs-body-color-rgb:33, 37, 41;--bs-body-bg-rgb:255, 255, 255;--bs-font-sans-serif:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--bs-font-monospace:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-bg:#fff}*,*::before,*::after{box-sizing:border-box}@media(prefers-reduced-motion: no-preference){:host{scroll-behavior:smooth}}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}::-moz-focus-inner{padding:0;border-style:none}@media(min-width: 1200px){}::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-text,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}@media(min-width: 1200px){}.container{width:100%;padding-right:var(--bs-gutter-x, 0.75rem);padding-left:var(--bs-gutter-x, 0.75rem);margin-right:auto;margin-left:auto}@media(min-width: 576px){.container{max-width:540px}}@media(min-width: 768px){.container{max-width:720px}}@media(min-width: 992px){.container{max-width:960px}}@media(min-width: 1200px){.container{max-width:1140px}}@media(min-width: 1400px){.container{max-width:1320px}}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-0.5 * var(--bs-gutter-x));margin-left:calc(-0.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * 0.5);padding-left:calc(var(--bs-gutter-x) * 0.5);margin-top:var(--bs-gutter-y)}.col-5{flex:0 0 auto;width:41.66666667%}.col-7{flex:0 0 auto;width:58.33333333%}@media(min-width: 576px){}@media(min-width: 768px){}@media(min-width: 992px){}@media(min-width: 1200px){}@media(min-width: 1400px){}@media(prefers-reduced-motion: reduce){}@media(min-width: 576px){}@media(min-width: 768px){}@media(min-width: 992px){}@media(min-width: 1200px){}@media(min-width: 1400px){}@media(min-width: 1200px){}@media print{}hb-checkout-shopping-cart{border:var(--hb-checkout-border);--hb-checkout-border:0.5px solid rgba(197, 197, 197, 0.808)}</style>',A(this,{target:this.shadowRoot,props:h(this.attributes),customElement:!0},Z,Y,i,{style:11,id:10,shipments:0,user:1,payment:2,gateways:3,completed:4},null),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),N()))}static get observedAttributes(){return["style","id","shipments","user","payment","gateways","completed"]}get style(){return this.$$.ctx[11]}set style(t){this.$$set({style:t}),N()}get id(){return this.$$.ctx[10]}set id(t){this.$$set({id:t}),N()}get shipments(){return this.$$.ctx[0]}set shipments(t){this.$$set({shipments:t}),N()}get user(){return this.$$.ctx[1]}set user(t){this.$$set({user:t}),N()}get payment(){return this.$$.ctx[2]}set payment(t){this.$$set({payment:t}),N()}get gateways(){return this.$$.ctx[3]}set gateways(t){this.$$set({gateways:t}),N()}get completed(){return this.$$.ctx[4]}set completed(t){this.$$set({completed:t}),N()}}return customElements.define("hb-page-checkout",tt),tt}();
|
|
2
2
|
//# sourceMappingURL=release.js.map
|