@htmlbricks/hb-payment-paypal 0.5.39 → 0.5.40
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 +3 -3
- package/release/release.js +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@htmlbricks/hb-payment-paypal",
|
|
3
3
|
"displayName": "Svelte Paypal Payment WebComponent",
|
|
4
4
|
"description": "Svelte Paypal Payment WebComponent",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.40",
|
|
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.5.
|
|
30
|
+
"@htmlbricks/hb-jsutils": "^0.5.40",
|
|
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": "
|
|
79
|
+
"gitHead": "42eadb84cb6f3bd7a098151302bc32c71fd0855a"
|
|
80
80
|
}
|
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,n){t.insertBefore(e,n||null)}function s(t){t.parentNode.removeChild(t)}function c(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function d(t){const e={};for(const n of t)e[n.name]=n.value;return e}let u;function l(t){u=t}function f(){if(!u)throw new Error("Function called outside component initialization");return u}function p(){const t=f();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 b=[],h=[],m=[],g=[],y=Promise.resolve();let w=!1;function $(t){m.push(t)}const v=new Set;let E=0;function x(){const t=u;do{for(;E<b.length;){const t=b[E];E++,l(t),k(t.$$)}for(l(null),b.length=0,E=0;h.length;)h.pop()();for(let t=0;t<m.length;t+=1){const e=m[t];v.has(e)||(v.add(e),e())}m.length=0}while(b.length);for(;g.length;)g.pop()();w=!1,v.clear(),l(t)}function k(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($)}}const _=new Set;function j(t,e){-1===t.$$.dirty[0]&&(b.push(t),w||(w=!0,y.then(x)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function S(i,a,c,d,f,p,b,h=[-1]){const m=u;l(i);const g=i.$$={fragment:null,ctx:null,props:p,update:t,not_equal:f,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(m?m.$$.context:[])),callbacks:n(),dirty:h,skip_bound:!1,root:a.target||m.$$.root};b&&b(g.root);let y=!1;if(g.ctx=c?c(i,a.props||{},((t,e,...n)=>{const r=n.length?n[0]:e;return g.ctx&&f(g.ctx[t],g.ctx[t]=r)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](r),y&&j(i,t)),e})):[],g.update(),y=!0,r(g.before_update),g.fragment=!!d&&d(g.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);g.fragment&&g.fragment.l(t),t.forEach(s)}else g.fragment&&g.fragment.c();a.intro&&((w=i.$$.fragment)&&w.i&&(_.delete(w),w.i(v))),function(t,n,i,a){const{fragment:s,on_mount:c,on_destroy:d,after_update:u}=t.$$;s&&s.m(n,i),a||$((()=>{const n=c.map(e).filter(o);d?d.push(...n):r(n),t.$$.on_mount=[]})),u.forEach($)}(i,a.target,a.anchor,a.customElement),x()}var w,v;l(m)}let A;"function"==typeof HTMLElement&&(A=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 C="0.5.39";function P(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],n=t["data-merchant-id"],r="",o="";Array.isArray(e)?e.length>1?(r="*",o=e.toString()):r=e.toString():"string"==typeof e&&e.length>0?r=e:"string"==typeof n&&n.length>0&&(r="*",o=n);t["merchant-id"]=r,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,n){var r=t[n].toString();return"data-"===n.substring(0,5)?e.dataAttributes[n]=r:e.queryParams[n]=r,e}),{queryParams:{},dataAttributes:{}}),r=n.queryParams,o=n.dataAttributes;return{url:"".concat(e,"?").concat(O(r)),dataAttributes:o}}function O(t){var e="";return Object.keys(t).forEach((function(n){0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function R(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach((function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function B(t,e){if(void 0===e&&(e=U()),M(t,e),"undefined"==typeof window)return e.resolve(null);var n=P(t),r=n.url,o=n.dataAttributes,i=o["data-namespace"]||"paypal",a=L(i);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var r=R(t,e),o=n.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(r.dataset).length)return null;var i=!0;return Object.keys(o.dataset).forEach((function(t){o.dataset[t]!==r.dataset[t]&&(i=!1)})),i?n:null}(r,o)&&a?e.resolve(a):function(t,e){void 0===e&&(e=U());M(t,e);var n=t.url,r=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==r&&"object"!=typeof r)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,n=t.attributes,r=t.onSuccess,o=t.onError,i=R(e,n);i.onerror=o,i.onload=r,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:r,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(n){return 200===n.status&&e(t),n.text()})).then((function(t){var n=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(n))})).catch((function(t){e(t)})):e(t)}})}))}({url:r,attributes:o},e).then((function(){var t=L(i);if(t)return t;throw new Error("The window.".concat(i," global variable is not available."))}))}function U(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function L(t){return window[t]}function M(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}function N(e){let n;return{c(){n=function(t){return document.createElement(t)}("div"),this.c=t,c(n,"part","btn"),c(n,"id","paypalbtn")},m(t,e){a(t,n,e)},p:t,i:t,o:t,d(t){t&&s(n)}}}function T(t,e,n){let r,o,{id:i}=e,{paypalid:a}=e,{currency:s}=e,{total:c}=e,d=!1;function u(){r&&r.close(),a&&o&&!d&&(d=!0,B({"client-id":a,currency:s}).then((t=>{console.info("configured paypal payment"),r=t,d=!1,r.Buttons({style:{layout:"horizontal",tagline:!1,height:40,width:"100%"},createOrder:(t,e)=>e.order.create({purchase_units:[{amount:{value:c.toString()}}]}),onApprove:(t,e)=>e.order.capture().then((function(t){!function(t,e){h(t,e),b.dispatchEvent&&b.dispatchEvent(new CustomEvent(t,{detail:e}))}("paymentCompleted",{method:"paypal",total:c})}))}).render(o).catch((t=>{console.error("failed to render the PayPal Buttons",t)}))})).catch((t=>{console.error("failed to load the PayPal JS SDK script",t)})))}var l;l=()=>(o=b.shadowRoot.getElementById("paypalbtn"),u(),()=>{try{r.close()}catch(t){}}),f().$$.on_mount.push(l);const b=f(),h=p();return function(t){if(!document.getElementById("hb-"+t+"-script")){const e=document.createElement("script");e.id="hb-"+t+"-script",e.src=`https://cdn.jsdelivr.net/npm/@htmlbricks/hb-${t}@${C}/release/release.js`,location.href.includes("localhost")&&(e.src=`http://localhost:6006/${t}/dist/release.js`),document.head.appendChild(e)}}("form"),t.$$set=t=>{"id"in t&&n(0,i=t.id),"paypalid"in t&&n(1,a=t.paypalid),"currency"in t&&n(2,s=t.currency),"total"in t&&n(3,c=t.total)},t.$$.update=()=>{15&t.$$.dirty&&(i||n(0,i=null),n(3,c=c?Number(c):null),n(2,s=s?s.toUpperCase():"EUR"),a?u():n(1,a=null))},[i,a,s,c]}class I extends A{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");@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@latest/font/bootstrap-icons.css");:host{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--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:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#07689f;--bs-secondary:#c9d6df;--bs-success:#11d3bc;--bs-info:#a2d5f2;--bs-warning:#ff7e67;--bs-danger:#f67280;--bs-light:#fafafa;--bs-dark:#4e4e4e;--bs-primary-rgb:7, 104, 159;--bs-secondary-rgb:201, 214, 223;--bs-success-rgb:17, 211, 188;--bs-info-rgb:162, 213, 242;--bs-warning-rgb:255, 126, 103;--bs-danger-rgb:246, 114, 128;--bs-light-rgb:250, 250, 250;--bs-dark-rgb:78, 78, 78;--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){}@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{}:host{--hb-checkout-border:0.5px solid rgba(197, 197, 197, 0.808);font-family:"Roboto", sans-serif}</style>',S(this,{target:this.shadowRoot,props:d(this.attributes),customElement:!0},T,N,i,{id:0,paypalid:1,currency:2,total:3},null),t&&(t.target&&a(t.target,this,t.anchor),t.props&&(this.$set(t.props),x()))}static get observedAttributes(){return["id","paypalid","currency","total"]}get id(){return this.$$.ctx[0]}set id(t){this.$$set({id:t}),x()}get paypalid(){return this.$$.ctx[1]}set paypalid(t){this.$$set({paypalid:t}),x()}get currency(){return this.$$.ctx[2]}set currency(t){this.$$set({currency:t}),x()}get total(){return this.$$.ctx[3]}set total(t){this.$$set({total:t}),x()}}return customElements.define("hb-payment-paypal",I),I}();
|
|
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,n){t.insertBefore(e,n||null)}function s(t){t.parentNode.removeChild(t)}function c(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function d(t){const e={};for(const n of t)e[n.name]=n.value;return e}let u;function l(t){u=t}function f(){if(!u)throw new Error("Function called outside component initialization");return u}function p(){const t=f();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 b=[],h=[],m=[],g=[],y=Promise.resolve();let w=!1;function $(t){m.push(t)}const v=new Set;let E=0;function x(){const t=u;do{for(;E<b.length;){const t=b[E];E++,l(t),k(t.$$)}for(l(null),b.length=0,E=0;h.length;)h.pop()();for(let t=0;t<m.length;t+=1){const e=m[t];v.has(e)||(v.add(e),e())}m.length=0}while(b.length);for(;g.length;)g.pop()();w=!1,v.clear(),l(t)}function k(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($)}}const _=new Set;function j(t,e){-1===t.$$.dirty[0]&&(b.push(t),w||(w=!0,y.then(x)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function S(i,a,c,d,f,p,b,h=[-1]){const m=u;l(i);const g=i.$$={fragment:null,ctx:null,props:p,update:t,not_equal:f,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a.context||(m?m.$$.context:[])),callbacks:n(),dirty:h,skip_bound:!1,root:a.target||m.$$.root};b&&b(g.root);let y=!1;if(g.ctx=c?c(i,a.props||{},((t,e,...n)=>{const r=n.length?n[0]:e;return g.ctx&&f(g.ctx[t],g.ctx[t]=r)&&(!g.skip_bound&&g.bound[t]&&g.bound[t](r),y&&j(i,t)),e})):[],g.update(),y=!0,r(g.before_update),g.fragment=!!d&&d(g.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);g.fragment&&g.fragment.l(t),t.forEach(s)}else g.fragment&&g.fragment.c();a.intro&&((w=i.$$.fragment)&&w.i&&(_.delete(w),w.i(v))),function(t,n,i,a){const{fragment:s,on_mount:c,on_destroy:d,after_update:u}=t.$$;s&&s.m(n,i),a||$((()=>{const n=c.map(e).filter(o);d?d.push(...n):r(n),t.$$.on_mount=[]})),u.forEach($)}(i,a.target,a.anchor,a.customElement),x()}var w,v;l(m)}let A;"function"==typeof HTMLElement&&(A=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 C="0.5.40";function P(t){var e="https://www.paypal.com/sdk/js";t.sdkBaseURL&&(e=t.sdkBaseURL,delete t.sdkBaseURL),function(t){var e=t["merchant-id"],n=t["data-merchant-id"],r="",o="";Array.isArray(e)?e.length>1?(r="*",o=e.toString()):r=e.toString():"string"==typeof e&&e.length>0?r=e:"string"==typeof n&&n.length>0&&(r="*",o=n);t["merchant-id"]=r,t["data-merchant-id"]=o}(t);var n=Object.keys(t).filter((function(e){return void 0!==t[e]&&null!==t[e]&&""!==t[e]})).reduce((function(e,n){var r=t[n].toString();return"data-"===n.substring(0,5)?e.dataAttributes[n]=r:e.queryParams[n]=r,e}),{queryParams:{},dataAttributes:{}}),r=n.queryParams,o=n.dataAttributes;return{url:"".concat(e,"?").concat(O(r)),dataAttributes:o}}function O(t){var e="";return Object.keys(t).forEach((function(n){0!==e.length&&(e+="&"),e+=n+"="+t[n]})),e}function R(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach((function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])})),n}function B(t,e){if(void 0===e&&(e=U()),M(t,e),"undefined"==typeof window)return e.resolve(null);var n=P(t),r=n.url,o=n.dataAttributes,i=o["data-namespace"]||"paypal",a=L(i);return function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var r=R(t,e),o=n.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(r.dataset).length)return null;var i=!0;return Object.keys(o.dataset).forEach((function(t){o.dataset[t]!==r.dataset[t]&&(i=!1)})),i?n:null}(r,o)&&a?e.resolve(a):function(t,e){void 0===e&&(e=U());M(t,e);var n=t.url,r=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==r&&"object"!=typeof r)throw new Error("Expected attributes to be an object.");return new e((function(t,e){if("undefined"==typeof window)return t();!function(t){var e=t.url,n=t.attributes,r=t.onSuccess,o=t.onError,i=R(e,n);i.onerror=o,i.onload=r,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:r,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load.'));return window.fetch?fetch(n).then((function(n){return 200===n.status&&e(t),n.text()})).then((function(t){var n=function(t){var e=t.split("/* Original Error:")[1];return e?e.replace(/\n/g,"").replace("*/","").trim():t}(t);e(new Error(n))})).catch((function(t){e(t)})):e(t)}})}))}({url:r,attributes:o},e).then((function(){var t=L(i);if(t)return t;throw new Error("The window.".concat(i," global variable is not available."))}))}function U(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function L(t){return window[t]}function M(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}function N(e){let n;return{c(){n=function(t){return document.createElement(t)}("div"),this.c=t,c(n,"part","btn"),c(n,"id","paypalbtn")},m(t,e){a(t,n,e)},p:t,i:t,o:t,d(t){t&&s(n)}}}function T(t,e,n){let r,o,{id:i}=e,{paypalid:a}=e,{currency:s}=e,{total:c}=e,d=!1;function u(){r&&r.close(),a&&o&&!d&&(d=!0,B({"client-id":a,currency:s}).then((t=>{console.info("configured paypal payment"),r=t,d=!1,r.Buttons({style:{layout:"horizontal",tagline:!1,height:40,width:"100%"},createOrder:(t,e)=>e.order.create({purchase_units:[{amount:{value:c.toString()}}]}),onApprove:(t,e)=>e.order.capture().then((function(t){!function(t,e){h(t,e),b.dispatchEvent&&b.dispatchEvent(new CustomEvent(t,{detail:e}))}("paymentCompleted",{method:"paypal",total:c})}))}).render(o).catch((t=>{console.error("failed to render the PayPal Buttons",t)}))})).catch((t=>{console.error("failed to load the PayPal JS SDK script",t)})))}var l;l=()=>(o=b.shadowRoot.getElementById("paypalbtn"),u(),()=>{try{r.close()}catch(t){}}),f().$$.on_mount.push(l);const b=f(),h=p();return function(t){if(!document.getElementById("hb-"+t+"-script")){const e=document.createElement("script");e.id="hb-"+t+"-script",e.src=`https://cdn.jsdelivr.net/npm/@htmlbricks/hb-${t}@${C}/release/release.js`,location.href.includes("localhost")&&(e.src=`http://localhost:6006/${t}/dist/release.js`),document.head.appendChild(e)}}("form"),t.$$set=t=>{"id"in t&&n(0,i=t.id),"paypalid"in t&&n(1,a=t.paypalid),"currency"in t&&n(2,s=t.currency),"total"in t&&n(3,c=t.total)},t.$$.update=()=>{15&t.$$.dirty&&(i||n(0,i=null),n(3,c=c?Number(c):null),n(2,s=s?s.toUpperCase():"EUR"),a?u():n(1,a=null))},[i,a,s,c]}class I extends A{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");@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@latest/font/bootstrap-icons.css");:host{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-white:#fff;--bs-gray:#6c757d;--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:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#07689f;--bs-secondary:#c9d6df;--bs-success:#11d3bc;--bs-info:#a2d5f2;--bs-warning:#ff7e67;--bs-danger:#f67280;--bs-light:#fafafa;--bs-dark:#4e4e4e;--bs-primary-rgb:7, 104, 159;--bs-secondary-rgb:201, 214, 223;--bs-success-rgb:17, 211, 188;--bs-info-rgb:162, 213, 242;--bs-warning-rgb:255, 126, 103;--bs-danger-rgb:246, 114, 128;--bs-light-rgb:250, 250, 250;--bs-dark-rgb:78, 78, 78;--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){}@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{}:host{--hb-checkout-border:0.5px solid rgba(197, 197, 197, 0.808);font-family:"Roboto", sans-serif}</style>',S(this,{target:this.shadowRoot,props:d(this.attributes),customElement:!0},T,N,i,{id:0,paypalid:1,currency:2,total:3},null),t&&(t.target&&a(t.target,this,t.anchor),t.props&&(this.$set(t.props),x()))}static get observedAttributes(){return["id","paypalid","currency","total"]}get id(){return this.$$.ctx[0]}set id(t){this.$$set({id:t}),x()}get paypalid(){return this.$$.ctx[1]}set paypalid(t){this.$$set({paypalid:t}),x()}get currency(){return this.$$.ctx[2]}set currency(t){this.$$set({currency:t}),x()}get total(){return this.$$.ctx[3]}set total(t){this.$$set({total:t}),x()}}return customElements.define("hb-payment-paypal",I),I}();
|
|
2
2
|
//# sourceMappingURL=release.js.map
|