@htmlbricks/hb-page-checkout 0.7.5 → 0.7.9

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
@@ -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.7.5",
5
+ "version": "0.7.9",
6
6
  "main": "release/release.js",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -27,7 +27,7 @@
27
27
  "prepublish": "npm run build:release"
28
28
  },
29
29
  "devDependencies": {
30
- "@htmlbricks/hb-jsutils": "^0.7.5",
30
+ "@htmlbricks/hb-jsutils": "^0.7.9",
31
31
  "@rollup/plugin-alias": "^3.1.2",
32
32
  "@rollup/plugin-commonjs": "^18.0.0",
33
33
  "@rollup/plugin-json": "^4.1.0",
@@ -76,5 +76,5 @@
76
76
  "html5-webcomponents"
77
77
  ],
78
78
  "contributors": [],
79
- "gitHead": "5c10098a7760e88b44796b37487d93ac412157d9"
79
+ "gitHead": "7e0dcdbf413bf4816fdbafd67129a4006f972783"
80
80
  }
@@ -1,2 +1,2 @@
1
- var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function i(t){t.forEach(e)}function o(t){return"function"==typeof t}function r(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,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}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,i){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,i?"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 w(){const t=y();return(e,n)=>{const i=t.$$.callbacks[e];if(i){const o=function(t,e,n=!1){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n,!1,e),i}(e,n);i.slice().forEach((e=>{e.call(t,o)}))}}}const v=[],x=[],$=[],k=[],E=Promise.resolve();let C=!1;function S(t){$.push(t)}const _=new Set;let N=0;function L(){const t=g;do{for(;N<v.length;){const t=v[N];N++,b(t),O(t.$$)}for(b(null),v.length=0,N=0;x.length;)x.pop()();for(let t=0;t<$.length;t+=1){const e=$[t];_.has(e)||(_.add(e),e())}$.length=0}while(v.length);for(;k.length;)k.pop()();C=!1,_.clear(),b(t)}function O(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(S)}}const j=new Set;function M(t,e){-1===t.$$.dirty[0]&&(v.push(t),C||(C=!0,E.then(L)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function J(r,a,s,c,l,u,p,f=[-1]){const m=g;b(r);const h=r.$$={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(r,a.props||{},((t,e,...n)=>{const i=n.length?n[0]:e;return h.ctx&&l(h.ctx[t],h.ctx[t]=i)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](i),y&&M(r,t)),e})):[],h.update(),y=!0,i(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&&((w=r.$$.fragment)&&w.i&&(j.delete(w),w.i(v))),function(t,n,r,a){const{fragment:s,on_mount:d,on_destroy:c,after_update:l}=t.$$;s&&s.m(n,r),a||S((()=>{const n=d.map(e).filter(o);c?c.push(...n):i(n),t.$$.on_mount=[]})),l.forEach(S)}(r,a.target,a.anchor,a.customElement),L()}var w,v;b(m)}let T;"function"==typeof HTMLElement&&(T=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(){i(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(i(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 D="0.7.5";var U,P,R=(U=function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=e.getChildStyleToPass=void 0,e.getChildStyleToPass=function(t,e){var n,i,o="";if(t&&(null==e?void 0:e.length)&&(null===(n=Object.keys(t))||void 0===n?void 0:n.length)&&(null===(i=null==e?void 0:e.filter((function(e){return Object.keys(t).includes(e.name)})))||void 0===i?void 0:i.length))for(var r=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++)r(s[a]);return o},e.addComponent=function(t,e,n){if(!document.getElementById("hb-"+t+"-script")){var i=document.createElement("script");i.id="hb-"+t+"-script",i.src="https://cdn.jsdelivr.net/npm/@htmlbricks/hb-".concat(t,"@").concat(e,"/release/release.js"),n&&location.href.includes("localhost")&&(i.src="http://localhost:6006/".concat(t,"/dist/release.js")),document.head.appendChild(i)}};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,i){return t.formatDate(e,n,i||this.lang)},t.getDefaultLang=function(){var t,e,n,i,o,r="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)&&(r=null===(o=null===(i=navigator.languages[0])||void 0===i?void 0:i.split("-")[0])||void 0===o?void 0:o.toLowerCase()),r},t.getDictionaryWord=function(e,n,i){var o;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(i&&(null===(o=n[i])||void 0===o?void 0:o[e]))return n[i][e];var r="",a=t.getDefaultLang();if(!i||a!==i){var s=null==n?void 0:n[a];(null==s?void 0:s[e])&&(r=s[e])}return r},t.formatDate=function(e,n,i){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(i||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n},U(P={exports:{}},P.exports),P.exports);function A(e){let n,o,r,h,g,b,y,w,v,x,$,k,E;return{c(){n=c("div"),o=c("div"),r=c("div"),h=c("hb-checkout"),w=l(),v=c("div"),x=c("hb-checkout-shopping-cart"),this.c=t,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(r,"class","col-7"),m(r,"padding-right","30px"),f(x,"completed",e[4]),f(x,"payment",$=JSON.stringify(e[2])),p(v,"class","col-5"),m(v,"padding-left","30px"),p(o,"class","row"),p(n,"class","container")},m(t,i){s(t,n,i),a(n,o),a(o,r),a(r,h),a(o,w),a(o,v),a(v,x),k||(E=[u(h,"paymentCompleted",e[10]),u(h,"saveUser",e[11]),u(h,"saveShipment",e[12])],k=!0)},p(t,[e]){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),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,i(E)}}}function F(t,e,n){var i;let{id:o}=e,{shipments:r}=e,{user:a}=e,{payment:s}=e,{gateways:d}=e,{completed:c}=e;const l={merchantName:"merchant",countryCode:"IT",total:0,currencyCode:"EUR",items:[]},u=y(),p=w();function f(t,e){p(t,e),u.dispatchEvent&&u.dispatchEvent(new CustomEvent(t,{detail:e}))}function m(t){const e=r.findIndex((e=>e.id===t.id)),i=r[e];r.forEach((t=>t.selected=!1)),i.selected=!0,n(2,s.shipmentFee=i.price,s),console.log("sss",i,t)}function h(t){t.completed?(n(4,c="yes"),f("paymentCompleted",t)):console.warn(t)}R.addComponent("checkout-shopping-cart",D),R.addComponent("checkout",D);return t.$$set=t=>{"id"in t&&n(8,o=t.id),"shipments"in t&&n(0,r=t.shipments),"user"in t&&n(1,a=t.user),"payment"in t&&n(2,s=t.payment),"gateways"in t&&n(3,d=t.gateways),"completed"in t&&n(4,c=t.completed)},t.$$.update=()=>{if(799&t.$$.dirty){o||n(8,o=null),c||n(4,c="no"),r?"string"==typeof r&&n(0,r=JSON.parse(r)||[]):n(0,r=[]),d?"string"==typeof d&&n(3,d=JSON.parse(d)||[]):n(3,d=[]),s?"string"==typeof s&&n(2,s=JSON.parse(s)):n(2,s=l),(r.find((t=>t.selected))||r.find((t=>t.standard)))&&n(2,s.shipmentFee=(r.find((t=>t.selected))||r.find((t=>t.standard))).price,s),a||n(1,a=null);let t,e=(null==s?void 0:s.shipmentFee)||0;for(const t of s.items)e+=t.unitaryPrice*(t.quantity||1)+Math.round(.01*t.taxPercentage*t.unitaryPrice*(t.quantity||1)*100)/100;null===n(9,i=null==s?void 0:s.countryCode)||void 0===i||i.toUpperCase(),t="EUR",n(2,s.total=Math.round(100*e)/100,s),n(2,s.currencyCode=t,s)}},[r,a,s,d,c,f,m,h,o,i,t=>h(t.detail),t=>f("saveUser",t.detail),t=>m(t.detail)]}class I extends T{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>',J(this,{target:this.shadowRoot,props:h(this.attributes),customElement:!0},F,A,r,{id:8,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),L()))}static get observedAttributes(){return["id","shipments","user","payment","gateways","completed"]}get id(){return this.$$.ctx[8]}set id(t){this.$$set({id:t}),L()}get shipments(){return this.$$.ctx[0]}set shipments(t){this.$$set({shipments:t}),L()}get user(){return this.$$.ctx[1]}set user(t){this.$$set({user:t}),L()}get payment(){return this.$$.ctx[2]}set payment(t){this.$$set({payment:t}),L()}get gateways(){return this.$$.ctx[3]}set gateways(t){this.$$set({gateways:t}),L()}get completed(){return this.$$.ctx[4]}set completed(t){this.$$set({completed:t}),L()}}return customElements.define("hb-page-checkout",I),I}();
1
+ var release=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function i(t){t.forEach(e)}function o(t){return"function"==typeof t}function r(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,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}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,i){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,i?"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 w(){const t=y();return(e,n)=>{const i=t.$$.callbacks[e];if(i){const o=function(t,e,n=!1){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n,!1,e),i}(e,n);i.slice().forEach((e=>{e.call(t,o)}))}}}const v=[],x=[],$=[],k=[],E=Promise.resolve();let C=!1;function S(t){$.push(t)}const _=new Set;let N=0;function L(){const t=g;do{for(;N<v.length;){const t=v[N];N++,b(t),O(t.$$)}for(b(null),v.length=0,N=0;x.length;)x.pop()();for(let t=0;t<$.length;t+=1){const e=$[t];_.has(e)||(_.add(e),e())}$.length=0}while(v.length);for(;k.length;)k.pop()();C=!1,_.clear(),b(t)}function O(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(S)}}const j=new Set;function M(t,e){-1===t.$$.dirty[0]&&(v.push(t),C||(C=!0,E.then(L)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function J(r,a,s,c,l,u,p,f=[-1]){const m=g;b(r);const h=r.$$={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(r,a.props||{},((t,e,...n)=>{const i=n.length?n[0]:e;return h.ctx&&l(h.ctx[t],h.ctx[t]=i)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](i),y&&M(r,t)),e})):[],h.update(),y=!0,i(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&&((w=r.$$.fragment)&&w.i&&(j.delete(w),w.i(v))),function(t,n,r,a){const{fragment:s,on_mount:d,on_destroy:c,after_update:l}=t.$$;s&&s.m(n,r),a||S((()=>{const n=d.map(e).filter(o);c?c.push(...n):i(n),t.$$.on_mount=[]})),l.forEach(S)}(r,a.target,a.anchor,a.customElement),L()}var w,v;b(m)}let T;"function"==typeof HTMLElement&&(T=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(){i(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(i(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 D="0.7.9";var U,P,R=(U=function(t,e){e.__esModule=!0,e.LanguageTranslator=e.addComponent=e.getChildStyleToPass=void 0,e.getChildStyleToPass=function(t,e){var n,i,o="";if(t&&(null==e?void 0:e.length)&&(null===(n=Object.keys(t))||void 0===n?void 0:n.length)&&(null===(i=null==e?void 0:e.filter((function(e){return Object.keys(t).includes(e.name)})))||void 0===i?void 0:i.length))for(var r=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++)r(s[a]);return o},e.addComponent=function(t,e,n){if(!document.getElementById("hb-"+t+"-script")){var i=document.createElement("script");i.id="hb-"+t+"-script",i.src="https://cdn.jsdelivr.net/npm/@htmlbricks/hb-".concat(t,"@").concat(e,"/release/release.js"),n&&location.href.includes("localhost")&&(i.src="http://localhost:6006/".concat(t,"/dist/release.js")),document.head.appendChild(i)}};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,i){return t.formatDate(e,n,i||this.lang)},t.getDefaultLang=function(){var t,e,n,i,o,r="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)&&(r=null===(o=null===(i=navigator.languages[0])||void 0===i?void 0:i.split("-")[0])||void 0===o?void 0:o.toLowerCase()),r},t.getDictionaryWord=function(e,n,i){var o;if(!e)throw new Error("no wordKey provided");if(!n)throw new Error("no dictionary provided");if(i&&(null===(o=n[i])||void 0===o?void 0:o[e]))return n[i][e];var r="",a=t.getDefaultLang();if(!i||a!==i){var s=null==n?void 0:n[a];(null==s?void 0:s[e])&&(r=s[e])}return r},t.formatDate=function(e,n,i){if(!e)throw new Error("no date provided");if("function"!=typeof e.getMonth)throw new Error("wrong date format");return new Intl.DateTimeFormat(i||t.getDefaultLang(),n).format(e)},t}();e.LanguageTranslator=n},U(P={exports:{}},P.exports),P.exports);function A(e){let n,o,r,h,g,b,y,w,v,x,$,k,E;return{c(){n=c("div"),o=c("div"),r=c("div"),h=c("hb-checkout"),w=l(),v=c("div"),x=c("hb-checkout-shopping-cart"),this.c=t,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(r,"class","col-7"),m(r,"padding-right","30px"),f(x,"completed",e[4]),f(x,"payment",$=JSON.stringify(e[2])),p(v,"class","col-5"),m(v,"padding-left","30px"),p(o,"class","row"),p(n,"class","container")},m(t,i){s(t,n,i),a(n,o),a(o,r),a(r,h),a(o,w),a(o,v),a(v,x),k||(E=[u(h,"paymentCompleted",e[10]),u(h,"saveUser",e[11]),u(h,"saveShipment",e[12])],k=!0)},p(t,[e]){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),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,i(E)}}}function F(t,e,n){var i;let{id:o}=e,{shipments:r}=e,{user:a}=e,{payment:s}=e,{gateways:d}=e,{completed:c}=e;const l={merchantName:"merchant",countryCode:"IT",total:0,currencyCode:"EUR",items:[]},u=y(),p=w();function f(t,e){p(t,e),u.dispatchEvent&&u.dispatchEvent(new CustomEvent(t,{detail:e}))}function m(t){const e=r.findIndex((e=>e.id===t.id)),i=r[e];r.forEach((t=>t.selected=!1)),i.selected=!0,n(2,s.shipmentFee=i.price,s),console.log("sss",i,t)}function h(t){t.completed?(n(4,c="yes"),f("paymentCompleted",t)):console.warn(t)}R.addComponent("checkout-shopping-cart",D),R.addComponent("checkout",D);return t.$$set=t=>{"id"in t&&n(8,o=t.id),"shipments"in t&&n(0,r=t.shipments),"user"in t&&n(1,a=t.user),"payment"in t&&n(2,s=t.payment),"gateways"in t&&n(3,d=t.gateways),"completed"in t&&n(4,c=t.completed)},t.$$.update=()=>{if(799&t.$$.dirty){o||n(8,o=null),c||n(4,c="no"),r?"string"==typeof r&&n(0,r=JSON.parse(r)||[]):n(0,r=[]),d?"string"==typeof d&&n(3,d=JSON.parse(d)||[]):n(3,d=[]),s?"string"==typeof s&&n(2,s=JSON.parse(s)):n(2,s=l),(r.find((t=>t.selected))||r.find((t=>t.standard)))&&n(2,s.shipmentFee=(r.find((t=>t.selected))||r.find((t=>t.standard))).price,s),a||n(1,a=null);let t,e=(null==s?void 0:s.shipmentFee)||0;for(const t of s.items)e+=t.unitaryPrice*(t.quantity||1)+Math.round(.01*t.taxPercentage*t.unitaryPrice*(t.quantity||1)*100)/100;null===n(9,i=null==s?void 0:s.countryCode)||void 0===i||i.toUpperCase(),t="EUR",n(2,s.total=Math.round(100*e)/100,s),n(2,s.currencyCode=t,s)}},[r,a,s,d,c,f,m,h,o,i,t=>h(t.detail),t=>f("saveUser",t.detail),t=>m(t.detail)]}class I extends T{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>',J(this,{target:this.shadowRoot,props:h(this.attributes),customElement:!0},F,A,r,{id:8,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),L()))}static get observedAttributes(){return["id","shipments","user","payment","gateways","completed"]}get id(){return this.$$.ctx[8]}set id(t){this.$$set({id:t}),L()}get shipments(){return this.$$.ctx[0]}set shipments(t){this.$$set({shipments:t}),L()}get user(){return this.$$.ctx[1]}set user(t){this.$$set({user:t}),L()}get payment(){return this.$$.ctx[2]}set payment(t){this.$$set({payment:t}),L()}get gateways(){return this.$$.ctx[3]}set gateways(t){this.$$set({gateways:t}),L()}get completed(){return this.$$.ctx[4]}set completed(t){this.$$set({completed:t}),L()}}return customElements.define("hb-page-checkout",I),I}();
2
2
  //# sourceMappingURL=release.js.map