stripe-pwa-elements 4.0.0 → 4.0.1
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/dist/cjs/{factory-da3xAKkz.js → factory-Cd2VI_N2.js} +22 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stripe-address-element.cjs.entry.js +8 -1
- package/dist/cjs/stripe-card-element-modal.cjs.entry.js +1 -1
- package/dist/cjs/stripe-card-element_2.cjs.entry.js +24 -6
- package/dist/cjs/stripe-currency-selector.cjs.entry.js +8 -1
- package/dist/cjs/stripe-elements.cjs.js +1 -1
- package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +8 -1
- package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +8 -1
- package/dist/cjs/stripe-payment-element.cjs.entry.js +95 -38
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +22 -15
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/stripe-address-element/stripe-address-element.js +7 -0
- package/dist/collection/components/stripe-card-element/stripe-card-element.js +7 -0
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +1 -1
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +7 -0
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +7 -0
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +7 -0
- package/dist/collection/components/stripe-modal/stripe-modal.js +18 -6
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +94 -37
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +15 -8
- package/dist/collection/services/stripe-service.js +22 -4
- package/dist/components/factory.js +1 -1
- package/dist/components/stripe-address-element.js +1 -1
- package/dist/components/stripe-card-element-modal.js +1 -1
- package/dist/components/stripe-card-element2.js +1 -1
- package/dist/components/stripe-currency-selector.js +1 -1
- package/dist/components/stripe-express-checkout-element.js +1 -1
- package/dist/components/stripe-link-authentication-element.js +1 -1
- package/dist/components/stripe-modal2.js +1 -1
- package/dist/components/stripe-payment-element.js +1 -1
- package/dist/components/stripe-payment-request-button2.js +1 -1
- package/dist/esm/{factory-DeqoYLf_.js → factory-VTa1Gc94.js} +22 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stripe-address-element.entry.js +8 -1
- package/dist/esm/stripe-card-element-modal.entry.js +1 -1
- package/dist/esm/stripe-card-element_2.entry.js +24 -6
- package/dist/esm/stripe-currency-selector.entry.js +8 -1
- package/dist/esm/stripe-elements.js +1 -1
- package/dist/esm/stripe-express-checkout-element.entry.js +8 -1
- package/dist/esm/stripe-link-authentication-element.entry.js +8 -1
- package/dist/esm/stripe-payment-element.entry.js +95 -38
- package/dist/esm/stripe-payment-request-button.entry.js +17 -10
- package/dist/stripe-elements/p-1bd46766.entry.js +1 -0
- package/dist/stripe-elements/p-1c6e0a45.entry.js +1 -0
- package/dist/stripe-elements/p-3f42ca0c.entry.js +1 -0
- package/dist/stripe-elements/p-74de1556.entry.js +1 -0
- package/dist/stripe-elements/p-76e57d78.entry.js +1 -0
- package/dist/stripe-elements/p-840d499f.entry.js +1 -0
- package/dist/stripe-elements/{p--sA2m1ad.js → p-CrjrbGJ3.js} +1 -1
- package/dist/stripe-elements/{p-38e7b187.entry.js → p-ae0c336e.entry.js} +1 -1
- package/dist/stripe-elements/p-cfd8e081.entry.js +1 -0
- package/dist/stripe-elements/stripe-elements.esm.js +1 -1
- package/dist/types/components/stripe-address-element/stripe-address-element.d.ts +6 -0
- package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +6 -0
- package/dist/types/components/stripe-currency-selector/stripe-currency-selector.d.ts +6 -0
- package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +6 -0
- package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
- package/dist/types/components/stripe-modal/stripe-modal.d.ts +1 -0
- package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +18 -0
- package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +6 -1
- package/dist/types/services/interfaces.d.ts +1 -0
- package/dist/types/services/stripe-service.d.ts +6 -2
- package/package.json +1 -1
- package/readme.md +4 -4
- package/dist/stripe-elements/p-44495284.entry.js +0 -1
- package/dist/stripe-elements/p-4ba675fa.entry.js +0 -1
- package/dist/stripe-elements/p-c24ae181.entry.js +0 -1
- package/dist/stripe-elements/p-d9e86451.entry.js +0 -1
- package/dist/stripe-elements/p-f09c86a0.entry.js +0 -1
- package/dist/stripe-elements/p-f64f394d.entry.js +0 -1
- package/dist/stripe-elements/p-f6d2425e.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as e,proxyCustomElement as o,HTMLElement as a,createEvent as t,h as i,Host as
|
|
1
|
+
import{transformTag as e,proxyCustomElement as o,HTMLElement as a,createEvent as t,h as i,Host as n}from"@stencil/core/internal/client";import{c}from"./utils.js";import{d as l}from"./icon.js";const d=o(class extends a{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.close=t(this,"close",7),this.showCloseButton=!0,this.open=!1,this.renderedOpen=!1}onOpenChange(e){e?this.openModalAnimation():(this.renderedOpen=!1,this.close.emit())}async toggleModal(){this.open?await this.closeModal():await this.openModal()}async openModal(){this.open=!0}async closeModal(){this.open=!1}componentDidLoad(){const e=c();e&&this.el.classList.add(e),this.open&&this.openModalAnimation()}openModalAnimation(){if(!this.el.shadowRoot)return void(this.renderedOpen=!0);const e=this.el.shadowRoot.querySelector(".modal-child");e.classList.add("loading"),e.style.willChange="transform",e.addEventListener("transitionend",(()=>{e.style.willChange="auto",e.classList.remove("loading")}),{once:!0}),requestAnimationFrame((()=>{this.renderedOpen=this.open}))}render(){const{renderedOpen:e,showCloseButton:o}=this;return i(n,{key:"38fb86acf7cf5887a426c67b1a1271f7fae7048c"},i("div",{key:"f751d92c327ee2e564edfcd4d18f4dca43c20c37",class:"modal-row"+(e?" open":""),onClick:()=>this.closeModal()},i("div",{key:"11519ccd44a5069df3247c530a2c1e114eab7aef",class:"modal-child",onClick:e=>e.stopPropagation()},o?i("div",{class:"modal-close-button-wrap"},i("ion-icon",{name:"close",size:"large",class:"modal-close-button",onClick:()=>this.closeModal()})):null,i("div",{key:"a41f7f263b488b5bbc2a999cbabf6b9e407bca85",class:"modal-loading"},i("svg",{key:"0b3b25cb2812bc4d837fb4b7e6af4a5f42f0247e",version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2400 2400"},i("g",{key:"10a9f9ec59699e6d2988b9c65cd02da1754fd760","stroke-width":"200","stroke-linecap":"round",stroke:"currentColor",fill:"none",id:"spinner"},i("line",{key:"ed271fa584b930ceed5397c271b31e0d48c72f72",x1:"1200",y1:"600",x2:"1200",y2:"100"}),i("line",{key:"3cf855a84f3ab58b914b7aeb784fbc5b95d8ae94",opacity:"0.5",x1:"1200",y1:"2300",x2:"1200",y2:"1800"}),i("line",{key:"2cce4b62a276399235509e94f47a63acf9c69a0f",opacity:"0.917",x1:"900",y1:"680.4",x2:"650",y2:"247.4"}),i("line",{key:"64c175ef068591417b043f7630a44d34eae7cb59",opacity:"0.417",x1:"1750",y1:"2152.6",x2:"1500",y2:"1719.6"}),i("line",{key:"0856a654e3aa756dfb1e9fc316b8b379fa9d5a4e",opacity:"0.833",x1:"680.4",y1:"900",x2:"247.4",y2:"650"}),i("line",{key:"c60f1f8495df9b8cdcc8941255d08c01a0e1c02f",opacity:"0.333",x1:"2152.6",y1:"1750",x2:"1719.6",y2:"1500"}),i("line",{key:"204bc2a7765e43b86f91c3fb9b1e72a3a39bb323",opacity:"0.75",x1:"600",y1:"1200",x2:"100",y2:"1200"}),i("line",{key:"7584b272f9efd7f746c1bcc5c8a5576098b02381",opacity:"0.25",x1:"2300",y1:"1200",x2:"1800",y2:"1200"}),i("line",{key:"7a053e9eb5f0da3fbf6fb7c9680bf73073bb126d",opacity:"0.667",x1:"680.4",y1:"1500",x2:"247.4",y2:"1750"}),i("line",{key:"f8b817095143d739589e45c99b03c7afbdfc8293",opacity:"0.167",x1:"2152.6",y1:"650",x2:"1719.6",y2:"900"}),i("line",{key:"aae0e36dbdfff44196f9758c8a5ed2337139ebe0",opacity:"0.583",x1:"900",y1:"1719.6",x2:"650",y2:"2152.6"}),i("line",{key:"3a257b30cb289f29ba386ccca7519bcdc22c3786",opacity:"0.083",x1:"1750",y1:"247.4",x2:"1500",y2:"680.4"}),i("animateTransform",{key:"c6b8e73025589403dd3d08f84b02eb824763d056",attributeName:"transform",attributeType:"XML",type:"rotate",keyTimes:"0;0.08333;0.16667;0.25;0.33333;0.41667;0.5;0.58333;0.66667;0.75;0.83333;0.91667",values:"0 1199 1199;30 1199 1199;60 1199 1199;90 1199 1199;120 1199 1199;150 1199 1199;180 1199 1199;210 1199 1199;240 1199 1199;270 1199 1199;300 1199 1199;330 1199 1199",dur:"0.83333s",begin:"0s",repeatCount:"indefinite",calcMode:"discrete"})))),i("div",{key:"da5ef8031e5b826d854a065d8172389cdd84fbf0",class:"modal-content"},i("slot",{key:"fbe97a3a4d5489de5ae6f49342c58d537b317842"})))))}get el(){return this}static get watchers(){return{open:[{onOpenChange:0}]}}static get style(){return':root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}:host{box-sizing:border-box}:host *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}:host button{cursor:pointer}:host{display:block}.modal-row{opacity:0;pointer-events:none;will-change:transform}.modal-row.open{opacity:1;pointer-events:auto;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:1ch;background:rgba(0, 0, 0, 0.3)}.modal-row .modal-child{transform:translateY(100%);transition:transform 420ms ease;position:relative}.modal-row .modal-child .modal-loading{display:none;position:absolute;top:160px;left:50%;transform:translateX(-50%);width:24px;height:24px}.modal-row .modal-child.loading .modal-loading{display:flex;justify-content:center;align-items:center}.modal-row .modal-child.loading .modal-loading svg{width:24px;height:24px}.modal-row .modal-child.loading .modal-content{visibility:hidden}.modal-row.open .modal-child{transform:translateY(0%)}.modal-child{padding:16px 8px 24px;background-color:#fff;width:100%}.modal-close-button-wrap{padding-left:8px}.modal-close-button-wrap .modal-close-button{width:32px;display:block;fill:var(--color-label);cursor:pointer}'}},[257,"stripe-modal",{showCloseButton:[4,"show-close-button"],open:[1028],renderedOpen:[32],toggleModal:[64],openModal:[64],closeModal:[64]},void 0,{open:[{onOpenChange:0}]}]);function s(){"undefined"!=typeof customElements&&["stripe-modal","ion-icon"].forEach((o=>{switch(o){case"stripe-modal":customElements.get(e(o))||customElements.define(e(o),d);break;case"ion-icon":customElements.get(e(o))||l()}}))}s();export{d as S,s as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as t,proxyCustomElement as e,HTMLElement as i,createEvent as s,h as n}from"@stencil/core/internal/client";import{c as r}from"./utils.js";import{s as o,i as a}from"./factory.js";import{S as c}from"./error.js";const l=t=>{const{stripe:e,isCheckoutSession:i,checkout:s,checkoutSessionClientSecret:n,elements:r,intentClientSecret:o}=t,a={stripe:e};return i?null==s?{error:"Checkout not properly initialized"}:(a.checkout=s,a.checkoutSessionClientSecret=n,{props:a}):null==r?{error:"Elements not properly initialized"}:(a.elements=r,a.intentClientSecret=o,{props:a})},p=e(class extends i{async initStripe(t,e){if(await this.stripeService.initialize(t,{stripeAccount:null==e?void 0:e.stripeAccount,applicationName:this.applicationName}),"success"===this.stripeService.state.loadStripeStatus)await this.initElement(),this.stripeLoadedEventHandler();else{const t=this.stripeService.onChange("loadStripeStatus",(async e=>{"success"===e&&(await this.initElement(),this.stripeLoadedEventHandler(),t())}))}}async initStripeWithCheckoutSession(t,e,i){if(await this.stripeService.initializeWithCheckoutSession(t,e,{stripeAccount:null==i?void 0:i.stripeAccount,applicationName:this.applicationName,elementsOptions:null==i?void 0:i.elementsOptions}),"success"===this.stripeService.state.loadStripeStatus)await this.initElement(),this.stripeLoadedEventHandler();else{const t=this.stripeService.onChange("loadStripeStatus",(async e=>{"success"===e&&(await this.initElement(),this.stripeLoadedEventHandler(),t())}))}}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.paymentElementManager.setError(t),this}updatePublishableKey(t){const e={};e.stripeAccount=this.stripeService.state.stripeAccount;const i=Object.values(e).filter((t=>null!=t&&""!==t)).length>0;this.initStripe(t,i?e:void 0)}updateStripeAccountId(t){this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:t})}async updateIntentClientSecret(){"success"===this.stripeService.state.loadStripeStatus&&await this.initElement()}async updateCheckoutSessionClientSecret(t){null!=this.publishableKey&&""!==this.publishableKey&&null!=t&&""!==t&&await this.initStripeWithCheckoutSession(this.publishableKey,t,{stripeAccount:this.stripeAccount})}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=this.stripeService.getStripe(),e=!0===this.stripeService.state.isCheckoutSession;if(null==t)return void console.error("Stripe not properly initialized");const i=l({stripe:t,isCheckoutSession:e,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});"error"in i?console.error(i.error):this.formSubmit.emit(i.props)}async defaultFormSubmitResultHandler(t){this.defaultFormSubmitResult.emit(t)}async checkoutSessionConfirmResultHandler(t){this.checkoutSessionConfirmResult.emit(t)}componentWillRender(){const{publishableKey:t}=this.stripeService.state;null!=t&&""!==t&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}))}async defaultFormSubmitAction(t,{stripe:e,elements:i}){t.preventDefault();try{const t=window.location.href,s=await(async(t,e,i,s)=>{const n=await("payment"===i?t.confirmPayment({elements:e,confirmParams:{return_url:s},redirect:"if_required"}):t.confirmSetup({elements:e,confirmParams:{return_url:s},redirect:"if_required"}));if(n.error)throw new c(n.error);return n})(e,i,this.intentType,t);this.defaultFormSubmitResultHandler(s)}catch(t){throw console.error(t),this.defaultFormSubmitResultHandler(t),t}}async checkoutSessionFormSubmitAction(t,e){t.preventDefault();try{const t=window.location.href,i=await(async(t,e)=>{var i;const s=await t.loadActions();if("error"===s.type)throw new c({type:"api_error",code:s.error.code||"checkout_session_error",message:s.error.message});const{actions:n}=s,r=await n.confirm({returnUrl:e,redirect:"if_required"});if("error"===r.type){const t={type:"card_error",code:r.error.code||"payment_failed",message:r.error.message,decline_code:"paymentFailed"===r.error.code?null===(i=r.error.paymentFailed)||void 0===i?void 0:i.declineCode:void 0};throw new c(t)}return r})(e,t);this.checkoutSessionConfirmResultHandler(i)}catch(t){throw console.error(t),this.checkoutSessionConfirmResultHandler(t instanceof Error?t:Error(t+"")),t}}constructor(t){super(),!1!==t&&this.__registerHost(),this.stripeLoaded=s(this,"stripeLoaded",7),this.formSubmit=s(this,"formSubmit",7),this.defaultFormSubmitResult=s(this,"defaultFormSubmitResult",7),this.checkoutSessionConfirmResult=s(this,"checkoutSessionConfirmResult",7),this.intentType="payment",this.sheetTitle="Add your payment information",this.buttonLabel="Pay",this.progress="",this.applicationName="stripe-pwa-elements",this.shouldUseDefaultFormSubmitAction=!0,this.stripeService=o.createStripeService(),this.paymentElementManager=o.createPaymentElementManager(this.stripeService),null!=this.publishableKey&&""!==this.publishableKey&&this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount})}async initElement(){await this.paymentElementManager.initialize(this.el);const t=this.el.querySelector("#stripe-payment-element");null!=t?(null!=this._submitHandler&&t.removeEventListener("submit",this._submitHandler),this._submitHandler=async t=>{const e=this.stripeService.getStripe(),i=!0===this.stripeService.state.isCheckoutSession;if(null==e)return void console.error("Stripe not properly initialized");const s=l({stripe:e,isCheckoutSession:i,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});if("error"in s)return void console.error(s.error);const n=s.props;this.progress="loading";try{null!=this.handleSubmit?await this.handleSubmit(t,n):!0===this.shouldUseDefaultFormSubmitAction?i&&null!=n.checkout?await this.checkoutSessionFormSubmitAction(t,n.checkout):null!=this.intentClientSecret&&""!==this.intentClientSecret?await this.defaultFormSubmitAction(t,n):t.preventDefault():t.preventDefault(),await this.formSubmitEventHandler(),null==this.handleSubmit&&!0!==this.shouldUseDefaultFormSubmitAction||(this.progress="success")}catch(t){this.paymentElementManager.setError(t instanceof Error?t.message:t+""),this.progress="failure"}},t.addEventListener("submit",this._submitHandler)):console.error("Form element #stripe-payment-element not found")}componentDidLoad(){this.el.classList.add(r())}disconnectedCallback(){if(this.paymentElementManager.unmount(),null!=this._submitHandler){const t=this.el.querySelector("#stripe-payment-element");null!=t&&t.removeEventListener("submit",this._submitHandler)}}render(){const{loadStripeStatus:t,isCheckoutSession:e}=this.stripeService.state,{errorMessage:i}=this.paymentElementManager.getState();if("failure"===t)return n("p",null,a.t("Failed to load Stripe"));const s=(t=>{const{progress:e,isCheckoutSession:i,loadStripeStatus:s,intentClientSecret:n}=t;return"loading"===e||!(i?"success"===s:null!=n&&""!==n)})({progress:this.progress,isCheckoutSession:!0===e,loadStripeStatus:t,intentClientSecret:this.intentClientSecret});return n("div",{class:"stripe-payment-sheet-wrap"},n("form",{id:"stripe-payment-element"},n("div",{class:"stripe-heading"},a.t(this.sheetTitle)),n("div",null,n("div",{class:"stripe-section-title"},a.t("Payment information"))),n("div",{class:"payment-info visible"},n("div",{id:"payment-element"})),n("div",{id:"payment-errors",class:"stripe-element-errors"},i),n("div",{style:{marginTop:"32px"}},n("button",{type:"submit",disabled:s},a.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return this}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}}static get style(){return':root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info{margin-top:8px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}'}},[0,"stripe-payment-element",{intentType:[1,"intent-type"],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],intentClientSecret:[1,"intent-client-secret"],checkoutSessionClientSecret:[1,"checkout-session-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],initStripeWithCheckoutSession:[64],updateProgress:[64],setErrorMessage:[64]},void 0,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}]);function h(){"undefined"!=typeof customElements&&["stripe-payment-element"].forEach((e=>{"stripe-payment-element"===e&&(customElements.get(t(e))||customElements.define(t(e),p))}))}h();const u=p,d=h;export{u as StripePaymentElement,d as defineCustomElement}
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as i,createEvent as s,h as n}from"@stencil/core/internal/client";import{c as r}from"./utils.js";import{s as o,i as a}from"./factory.js";import{S as c}from"./error.js";const l=t=>{const{stripe:e,isCheckoutSession:i,checkout:s,checkoutSessionClientSecret:n,elements:r,intentClientSecret:o}=t,a={stripe:e};return i?null==s?{error:"Checkout not properly initialized"}:(a.checkout=s,a.checkoutSessionClientSecret=n,{props:a}):null==r?{error:"Elements not properly initialized"}:(a.elements=r,a.intentClientSecret=o,{props:a})},h=e(class extends i{async initStripe(t,e){const i=++this.initGeneration;await this.stripeService.initialize(t,{stripeAccount:null==e?void 0:e.stripeAccount,applicationName:this.applicationName,clientSecret:this.intentClientSecret}),await this.mountWhenLoaded(i)}async initStripeWithCheckoutSession(t,e,i){const s=++this.initGeneration;await this.stripeService.initializeWithCheckoutSession(t,e,{stripeAccount:null==i?void 0:i.stripeAccount,applicationName:this.applicationName,elementsOptions:null==i?void 0:i.elementsOptions}),await this.mountWhenLoaded(s)}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.paymentElementManager.setError(t),this}updatePublishableKey(t){const e={};e.stripeAccount=this.stripeService.state.stripeAccount;const i=Object.values(e).filter((t=>null!=t&&""!==t)).length>0;this.hasCheckoutSessionClientSecret()?this.initStripeWithCheckoutSession(t,this.checkoutSessionClientSecret,{stripeAccount:e.stripeAccount}):this.initStripe(t,i?e:void 0)}updateStripeAccountId(t){this.hasCheckoutSessionClientSecret()?this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:t}):this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:t})}async updateIntentClientSecret(){if(null!=this.checkoutSessionClientSecret&&""!==this.checkoutSessionClientSecret)return;const{publishableKey:t,stripeAccount:e}=this.stripeService.state;null!=t&&""!==t&&await this.initStripe(t,{stripeAccount:e})}async updateCheckoutSessionClientSecret(t){null!=this.publishableKey&&""!==this.publishableKey&&null!=t&&""!==t&&await this.initStripeWithCheckoutSession(this.publishableKey,t,{stripeAccount:this.stripeAccount})}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=this.stripeService.getStripe(),e=!0===this.stripeService.state.isCheckoutSession;if(null==t)return void console.error("Stripe not properly initialized");const i=l({stripe:t,isCheckoutSession:e,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});"error"in i?console.error(i.error):this.formSubmit.emit(i.props)}async defaultFormSubmitResultHandler(t){this.defaultFormSubmitResult.emit(t)}async checkoutSessionConfirmResultHandler(t){this.checkoutSessionConfirmResult.emit(t)}componentWillRender(){const{publishableKey:t}=this.stripeService.state;null!=t&&""!==t&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||(null==this.checkoutSessionClientSecret||""===this.checkoutSessionClientSecret?this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}):this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:this.stripeService.state.stripeAccount})))}async defaultFormSubmitAction(t,{stripe:e,elements:i}){t.preventDefault();try{const t=window.location.href,s=await(async(t,e,i,s)=>{const n=await("payment"===i?t.confirmPayment({elements:e,confirmParams:{return_url:s},redirect:"if_required"}):t.confirmSetup({elements:e,confirmParams:{return_url:s},redirect:"if_required"}));if(n.error)throw new c(n.error);return n})(e,i,this.intentType,t);this.defaultFormSubmitResultHandler(s)}catch(t){throw console.error(t),this.defaultFormSubmitResultHandler(t),t}}async checkoutSessionFormSubmitAction(t,e){t.preventDefault();try{const t=window.location.href,i=await(async(t,e)=>{var i;const s=await t.loadActions();if("error"===s.type)throw new c({type:"api_error",code:s.error.code||"checkout_session_error",message:s.error.message});const{actions:n}=s,r=await n.confirm({returnUrl:e,redirect:"if_required"});if("error"===r.type){const t={type:"card_error",code:r.error.code||"payment_failed",message:r.error.message,decline_code:"paymentFailed"===r.error.code?null===(i=r.error.paymentFailed)||void 0===i?void 0:i.declineCode:void 0};throw new c(t)}return r})(e,t);this.checkoutSessionConfirmResultHandler(i)}catch(t){throw console.error(t),this.checkoutSessionConfirmResultHandler(t instanceof Error?t:Error(t+"")),t}}constructor(t){super(),!1!==t&&this.__registerHost(),this.stripeLoaded=s(this,"stripeLoaded",7),this.formSubmit=s(this,"formSubmit",7),this.defaultFormSubmitResult=s(this,"defaultFormSubmitResult",7),this.checkoutSessionConfirmResult=s(this,"checkoutSessionConfirmResult",7),this.initGeneration=0,this.intentType="payment",this.sheetTitle="Add your payment information",this.buttonLabel="Pay",this.progress="",this.applicationName="stripe-pwa-elements",this.shouldUseDefaultFormSubmitAction=!0,this.stripeService=o.createStripeService(),this.paymentElementManager=o.createPaymentElementManager(this.stripeService)}componentWillLoad(){this.startStripe()}async mountWhenLoaded(t){if(t!==this.initGeneration)return;if("success"===this.stripeService.state.loadStripeStatus){if(await this.initElement(),t!==this.initGeneration)return;return void this.stripeLoadedEventHandler()}const e=this.stripeService.onChange("loadStripeStatus",(async i=>{t===this.initGeneration?"success"===i&&(await this.initElement(),t===this.initGeneration?(this.stripeLoadedEventHandler(),e()):e()):e()}))}hasCheckoutSessionClientSecret(){return null!=this.checkoutSessionClientSecret&&""!==this.checkoutSessionClientSecret}startStripe(){null!=this.publishableKey&&""!==this.publishableKey&&(null==this.checkoutSessionClientSecret||""===this.checkoutSessionClientSecret?this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount}):this.initStripeWithCheckoutSession(this.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:this.stripeAccount}))}async initElement(){await this.paymentElementManager.initialize(this.el);const t=this.el.querySelector("#stripe-payment-element");null!=t?(null!=this._submitHandler&&t.removeEventListener("submit",this._submitHandler),this._submitHandler=async t=>{const e=this.stripeService.getStripe(),i=!0===this.stripeService.state.isCheckoutSession;if(null==e)return void console.error("Stripe not properly initialized");const s=l({stripe:e,isCheckoutSession:i,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});if("error"in s)return void console.error(s.error);const n=s.props;this.progress="loading";try{null!=this.handleSubmit?await this.handleSubmit(t,n):!0===this.shouldUseDefaultFormSubmitAction?i&&null!=n.checkout?await this.checkoutSessionFormSubmitAction(t,n.checkout):null!=this.intentClientSecret&&""!==this.intentClientSecret?await this.defaultFormSubmitAction(t,n):t.preventDefault():t.preventDefault(),await this.formSubmitEventHandler(),null==this.handleSubmit&&!0!==this.shouldUseDefaultFormSubmitAction||(this.progress="success")}catch(t){this.paymentElementManager.setError(t instanceof Error?t.message:t+""),this.progress="failure"}},t.addEventListener("submit",this._submitHandler)):console.error("Form element #stripe-payment-element not found")}componentDidLoad(){this.el.classList.add(r())}disconnectedCallback(){if(this.paymentElementManager.unmount(),null!=this._submitHandler){const t=this.el.querySelector("#stripe-payment-element");null!=t&&t.removeEventListener("submit",this._submitHandler)}}render(){const{loadStripeStatus:t,isCheckoutSession:e}=this.stripeService.state,{errorMessage:i}=this.paymentElementManager.getState();if("failure"===t)return n("p",null,a.t("Failed to load Stripe"));const s=(t=>{const{progress:e,isCheckoutSession:i,loadStripeStatus:s,intentClientSecret:n}=t;return"loading"===e||!(i?"success"===s:null!=n&&""!==n)})({progress:this.progress,isCheckoutSession:!0===e,loadStripeStatus:t,intentClientSecret:this.intentClientSecret});return n("div",{class:"stripe-payment-sheet-wrap"},n("form",{id:"stripe-payment-element"},n("div",{class:"stripe-heading"},a.t(this.sheetTitle)),n("div",null,n("div",{class:"stripe-section-title"},a.t("Payment information"))),n("div",{class:"payment-info visible"},n("div",{id:"payment-element"})),n("div",{id:"payment-errors",class:"stripe-element-errors"},i),n("div",{style:{marginTop:"32px"}},n("button",{type:"submit",disabled:s},a.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return this}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}}static get style(){return':root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info{margin-top:8px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}'}},[0,"stripe-payment-element",{intentType:[1,"intent-type"],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],intentClientSecret:[1,"intent-client-secret"],checkoutSessionClientSecret:[1,"checkout-session-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],initStripeWithCheckoutSession:[64],updateProgress:[64],setErrorMessage:[64]},void 0,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}]);function p(){"undefined"!=typeof customElements&&["stripe-payment-element"].forEach((e=>{"stripe-payment-element"===e&&(customElements.get(t(e))||customElements.define(t(e),h))}))}p();const u=h,d=p;export{u as StripePaymentElement,d as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformTag as e,proxyCustomElement as t,HTMLElement as s,createEvent as i,h as n,Host as a}from"@stencil/core/internal/client";import{l as o}from"./index2.js";const r=t(class extends s{async isAvailable(e){if(void 0===this.publishableKey)throw new Error("You should set publishableKey before calling this method.");const t=(await o(this.publishableKey,{stripeAccount:this.stripeAccount})).paymentRequest({country:"US",currency:"usd",total:{label:"Demo total",amount:1099},disableWallets:["applePay","googlePay","browserCard"].filter((t=>t!==e))}),s=await t.canMakePayment();if(!s||"applePay"===e&&!s[e]||"googlePay"===e&&!s[e])throw new Error(`This device cannot use ${e}.`)}async setPaymentMethodEventHandler(e){this.paymentMethodEventHandler=e}async setPaymentRequestShippingOptionEventHandler(e){this.shippingOptionEventHandler=e}async setPaymentRequestShippingAddressEventHandler(e){this.shippingAddressEventHandler=e}stripeLoadedEventHandler(){const e={stripe:this.stripe};this.stripeDidLoaded&&this.stripeDidLoaded(e),this.stripeLoaded.emit(e)}
|
|
1
|
+
import{transformTag as e,proxyCustomElement as t,HTMLElement as s,createEvent as i,h as n,Host as a}from"@stencil/core/internal/client";import{l as o}from"./index2.js";const r=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.stripeLoaded=i(this,"stripeLoaded",7),this.loadStripeStatus="",this.applicationName="stripe-pwa-elements"}async isAvailable(e){if(void 0===this.publishableKey)throw new Error("You should set publishableKey before calling this method.");const t=(await o(this.publishableKey,{stripeAccount:this.stripeAccount})).paymentRequest({country:"US",currency:"usd",total:{label:"Demo total",amount:1099},disableWallets:["applePay","googlePay","browserCard"].filter((t=>t!==e))}),s=await t.canMakePayment();if(!s||"applePay"===e&&!s[e]||"googlePay"===e&&!s[e])throw new Error(`This device cannot use ${e}.`)}async setPaymentMethodEventHandler(e){this.paymentMethodEventHandler=e}async setPaymentRequestShippingOptionEventHandler(e){this.shippingOptionEventHandler=e}async setPaymentRequestShippingAddressEventHandler(e){this.shippingAddressEventHandler=e}stripeLoadedEventHandler(){const e={stripe:this.stripe};this.stripeDidLoaded&&this.stripeDidLoaded(e),this.stripeLoaded.emit(e)}componentWillLoad(){void 0!==this.publishableKey&&void 0!==this.paymentRequestOption?this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount}):this.loadStripeStatus="failure"}connectedCallback(){console.warn("[stripe-pwa-elements] <stripe-payment-request-button> is deprecated. stripe.paymentRequest() is being removed in Stripe.js 9.x (deprecated 2025-09-30 / removed 2026-03-25). Please migrate to <stripe-express-checkout-element>, which supports Apple Pay, Google Pay, Link, PayPal, and more. Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/")}async setPaymentRequestOption(e){return this.paymentRequestOption=e,this}async initStripe(e,t){this.loadStripeStatus="loading",o(e,{stripeAccount:null==t?void 0:t.stripeAccount}).then((e=>{this.loadStripeStatus="success",e.registerAppInfo({name:this.applicationName}),this.stripe=e})).catch((e=>{console.log(e),this.loadStripeStatus="failure"})).then((()=>{if(this.stripe)return this.initElement(0==!(null==t?void 0:t.showButton))})).then((()=>{this.stripe&&this.stripeLoadedEventHandler()}))}async initElement(e=!0){const t=this.stripe.paymentRequest(this.paymentRequestOption);if(!await t.canMakePayment())throw new Error("Payment Request is not supported.");if(this.paymentMethodEventHandler&&t.on("paymentmethod",(e=>{this.paymentMethodEventHandler(e,this.stripe)})),this.shippingOptionEventHandler&&t.on("shippingoptionchange",(e=>{this.shippingOptionEventHandler(e,this.stripe)})),this.shippingAddressEventHandler&&t.on("shippingaddresschange",(e=>{this.shippingAddressEventHandler(e,this.stripe)})),e){this.paymentRequestElement&&this.paymentRequestElement.unmount();const e=this.stripe.elements().create("paymentRequestButton",{paymentRequest:t});this.paymentRequestElement=e;const s=this.el.querySelector("#payment-request-button");e.mount(s),this.el.querySelector("#payment-request").classList.add("visible")}else t.show()}disconnectedCallback(){this.paymentRequestElement&&(this.paymentRequestElement.unmount(),this.paymentRequestElement=void 0),this.stripe=void 0}render(){return n(a,{key:"dd3ae348f9e9c798acdeca095ad9c157afd4734f"},n("div",{key:"f2e13b6980318ede1812d4f54223b7aeb9cfc51b",id:"payment-request"},n("div",{key:"ff6c1218924044d1ffc11354909f25c1745ef254",id:"payment-request-button"})),n("slot",{key:"ec2131a0503baa15cdcf3571040e9ce6040da708"}))}get el(){return this}static get style(){return":host{display:block}"}},[260,"stripe-payment-request-button",{paymentMethodEventHandler:[16],shippingOptionEventHandler:[16],shippingAddressEventHandler:[16],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],stripeDidLoaded:[1040],loadStripeStatus:[32],stripe:[32],paymentRequestOption:[32],isAvailable:[64],setPaymentMethodEventHandler:[64],setPaymentRequestShippingOptionEventHandler:[64],setPaymentRequestShippingAddressEventHandler:[64],setPaymentRequestOption:[64],initStripe:[64]}]);function p(){"undefined"!=typeof customElements&&["stripe-payment-request-button"].forEach((t=>{"stripe-payment-request-button"===t&&(customElements.get(e(t))||customElements.define(e(t),r))}))}p();export{r as S,p as d}
|
|
@@ -3099,6 +3099,8 @@ class StripeServiceClass {
|
|
|
3099
3099
|
applicationName: 'stripe-pwa-elements',
|
|
3100
3100
|
isCheckoutSession: false,
|
|
3101
3101
|
});
|
|
3102
|
+
/** Incremented on every init so that a slower, older call cannot overwrite newer state */
|
|
3103
|
+
this.initGeneration = 0;
|
|
3102
3104
|
this.changeListeners = new Map();
|
|
3103
3105
|
}
|
|
3104
3106
|
/**
|
|
@@ -3126,12 +3128,20 @@ class StripeServiceClass {
|
|
|
3126
3128
|
/**
|
|
3127
3129
|
* Initialize Stripe.js client with Payment Intent mode
|
|
3128
3130
|
* @param publishableKey - Your Stripe publishable API key
|
|
3129
|
-
* @param options - Optional configuration
|
|
3131
|
+
* @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
|
|
3130
3132
|
*/
|
|
3131
3133
|
async initialize(publishableKey, options) {
|
|
3134
|
+
const generation = ++this.initGeneration;
|
|
3135
|
+
// Capture the previous config before overwriting it, so we can detect real changes
|
|
3136
|
+
const isUpToDate = this.store.state.stripe != null &&
|
|
3137
|
+
!this.store.state.isCheckoutSession &&
|
|
3138
|
+
this.store.state.publishableKey === publishableKey &&
|
|
3139
|
+
this.store.state.stripeAccount === (options === null || options === void 0 ? void 0 : options.stripeAccount) &&
|
|
3140
|
+
this.intentClientSecret === (options === null || options === void 0 ? void 0 : options.clientSecret);
|
|
3132
3141
|
// Update configuration
|
|
3133
3142
|
this.store.state.publishableKey = publishableKey;
|
|
3134
3143
|
this.store.state.isCheckoutSession = false;
|
|
3144
|
+
this.intentClientSecret = options === null || options === void 0 ? void 0 : options.clientSecret;
|
|
3135
3145
|
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3136
3146
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3137
3147
|
}
|
|
@@ -3139,7 +3149,7 @@ class StripeServiceClass {
|
|
|
3139
3149
|
this.store.state.applicationName = options.applicationName;
|
|
3140
3150
|
}
|
|
3141
3151
|
// If Stripe.js already loaded with same config, do nothing
|
|
3142
|
-
if (
|
|
3152
|
+
if (isUpToDate) {
|
|
3143
3153
|
return;
|
|
3144
3154
|
}
|
|
3145
3155
|
this.store.state.loadStripeStatus = 'loading';
|
|
@@ -3147,12 +3157,16 @@ class StripeServiceClass {
|
|
|
3147
3157
|
const stripe = await loadStripe(publishableKey, {
|
|
3148
3158
|
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
3149
3159
|
});
|
|
3160
|
+
if (generation !== this.initGeneration) {
|
|
3161
|
+
return;
|
|
3162
|
+
}
|
|
3150
3163
|
// Register app info
|
|
3151
3164
|
stripe.registerAppInfo({
|
|
3152
3165
|
name: this.store.state.applicationName,
|
|
3153
3166
|
});
|
|
3154
3167
|
this.store.state.stripe = stripe;
|
|
3155
|
-
|
|
3168
|
+
// Payment Element requires the client secret at Elements creation time
|
|
3169
|
+
this.store.state.elements = (options === null || options === void 0 ? void 0 : options.clientSecret) != null && options.clientSecret !== '' ? stripe.elements({ clientSecret: options.clientSecret }) : stripe.elements();
|
|
3156
3170
|
this.store.state.checkout = undefined;
|
|
3157
3171
|
this.store.state.loadStripeStatus = 'success';
|
|
3158
3172
|
}
|
|
@@ -3165,9 +3179,10 @@ class StripeServiceClass {
|
|
|
3165
3179
|
* Initialize Stripe.js client with Checkout Session mode
|
|
3166
3180
|
* @param publishableKey - Your Stripe publishable API key
|
|
3167
3181
|
* @param checkoutSessionClientSecret - The client secret from Checkout Session
|
|
3168
|
-
* @param options - Optional configuration
|
|
3182
|
+
* @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
|
|
3169
3183
|
*/
|
|
3170
3184
|
async initializeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, options) {
|
|
3185
|
+
const generation = ++this.initGeneration;
|
|
3171
3186
|
// Update configuration
|
|
3172
3187
|
this.store.state.publishableKey = publishableKey;
|
|
3173
3188
|
this.store.state.isCheckoutSession = true;
|
|
@@ -3182,6 +3197,9 @@ class StripeServiceClass {
|
|
|
3182
3197
|
const stripe = await loadStripe(publishableKey, {
|
|
3183
3198
|
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
3184
3199
|
});
|
|
3200
|
+
if (generation !== this.initGeneration) {
|
|
3201
|
+
return;
|
|
3202
|
+
}
|
|
3185
3203
|
// Register app info
|
|
3186
3204
|
stripe.registerAppInfo({
|
|
3187
3205
|
name: this.store.state.applicationName,
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["stripe-card-element-modal",[[0,"stripe-card-element-modal",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4],"getStripeCardElementElement":[64],"present":[64],"updateProgress":[64],"destroy":[64],"setPaymentRequestButton":[64]}]]],["stripe-address-element",[[0,"stripe-address-element",{"mode":[1],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"defaultCountry":[1,"default-country"],"allowedCountries":[16],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getValue":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-currency-selector",[[0,"stripe-currency-selector",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"handleCurrencyChange":[1040],"stripeDidLoaded":[1040],"initStripe":[64],"setErrorMessage":[64],"getSelectedCurrency":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-express-checkout-element",[[0,"stripe-express-checkout-element",{"intentType":[1,"intent-type"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"amount":[2],"currency":[1],"buttonHeight":[1,"button-height"],"shouldUseDefaultConfirmAction":[4,"should-use-default-confirm-action"],"stripeDidLoaded":[1040],"progress":[32],"updateProgress":[64],"setErrorMessage":[64],"initStripe":[64],"updateElementOptions":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-link-authentication-element",[[0,"stripe-link-authentication-element",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"defaultEmail":[1,"default-email"],"handleChange":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getEmail":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-payment-element",[[0,"stripe-payment-element",{"intentType":[1,"intent-type"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"intentClientSecret":[1,"intent-client-secret"],"checkoutSessionClientSecret":[1,"checkout-session-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"initStripeWithCheckoutSession":[64],"updateProgress":[64],"setErrorMessage":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}],"intentClientSecret":[{"updateIntentClientSecret":0}],"checkoutSessionClientSecret":[{"updateCheckoutSessionClientSecret":0}]}]]],["ion-icon",[[1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]},null,{"name":[{"loadIcon":0}],"src":[{"loadIcon":0}],"icon":[{"loadIcon":0}],"ios":[{"loadIcon":0}],"md":[{"loadIcon":0}]}]]],["stripe-payment-request-button",[[260,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32],"isAvailable":[64],"setPaymentMethodEventHandler":[64],"setPaymentRequestShippingOptionEventHandler":[64],"setPaymentRequestShippingAddressEventHandler":[64],"setPaymentRequestOption":[64],"initStripe":[64]}]]],["stripe-card-element_2",[[0,"stripe-card-element",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"zipCode":[32],"paymentRequestOption":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"setPaymentRequestOption":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}],[257,"stripe-modal",{"showCloseButton":[4,"show-close-button"],"open":[
|
|
8
|
+
return bootstrapLazy([["stripe-card-element-modal",[[0,"stripe-card-element-modal",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4],"getStripeCardElementElement":[64],"present":[64],"updateProgress":[64],"destroy":[64],"setPaymentRequestButton":[64]}]]],["stripe-address-element",[[0,"stripe-address-element",{"mode":[1],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"defaultCountry":[1,"default-country"],"allowedCountries":[16],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getValue":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-currency-selector",[[0,"stripe-currency-selector",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"handleCurrencyChange":[1040],"stripeDidLoaded":[1040],"initStripe":[64],"setErrorMessage":[64],"getSelectedCurrency":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-express-checkout-element",[[0,"stripe-express-checkout-element",{"intentType":[1,"intent-type"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"amount":[2],"currency":[1],"buttonHeight":[1,"button-height"],"shouldUseDefaultConfirmAction":[4,"should-use-default-confirm-action"],"stripeDidLoaded":[1040],"progress":[32],"updateProgress":[64],"setErrorMessage":[64],"initStripe":[64],"updateElementOptions":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-link-authentication-element",[[0,"stripe-link-authentication-element",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"defaultEmail":[1,"default-email"],"handleChange":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getEmail":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-payment-element",[[0,"stripe-payment-element",{"intentType":[1,"intent-type"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"intentClientSecret":[1,"intent-client-secret"],"checkoutSessionClientSecret":[1,"checkout-session-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"initStripeWithCheckoutSession":[64],"updateProgress":[64],"setErrorMessage":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}],"intentClientSecret":[{"updateIntentClientSecret":0}],"checkoutSessionClientSecret":[{"updateCheckoutSessionClientSecret":0}]}]]],["ion-icon",[[1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]},null,{"name":[{"loadIcon":0}],"src":[{"loadIcon":0}],"icon":[{"loadIcon":0}],"ios":[{"loadIcon":0}],"md":[{"loadIcon":0}]}]]],["stripe-payment-request-button",[[260,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32],"isAvailable":[64],"setPaymentMethodEventHandler":[64],"setPaymentRequestShippingOptionEventHandler":[64],"setPaymentRequestShippingAddressEventHandler":[64],"setPaymentRequestOption":[64],"initStripe":[64]}]]],["stripe-card-element_2",[[0,"stripe-card-element",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"zipCode":[32],"paymentRequestOption":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"setPaymentRequestOption":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}],[257,"stripe-modal",{"showCloseButton":[4,"show-close-button"],"open":[1028],"renderedOpen":[32],"toggleModal":[64],"openModal":[64],"closeModal":[64]},null,{"open":[{"onOpenChange":0}]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, h, g as getElement } from './index-C6bbmyga.js';
|
|
2
|
-
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-
|
|
2
|
+
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-VTa1Gc94.js';
|
|
3
3
|
import './index-CBXaOfXU.js';
|
|
4
4
|
|
|
5
5
|
const stripeAddressElementCss = () => `:root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap #address-element{margin-top:16px}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info.address{margin-bottom:16px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap .submit-button-wrapper{margin-top:32px}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}`;
|
|
@@ -189,6 +189,13 @@ const StripeAddressElement = class {
|
|
|
189
189
|
// Dependency Injection via factory
|
|
190
190
|
this.stripeService = serviceFactory.createStripeService();
|
|
191
191
|
this.addressElementManager = serviceFactory.createAddressElementManager(this.stripeService);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Props are not yet populated inside the constructor when the component is registered via
|
|
195
|
+
* the custom-elements build (`dist/components/*`), so initialization that depends on them
|
|
196
|
+
* must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
|
|
197
|
+
*/
|
|
198
|
+
componentWillLoad() {
|
|
192
199
|
if (this.publishableKey != null && this.publishableKey !== '') {
|
|
193
200
|
this.initStripe(this.publishableKey, {
|
|
194
201
|
stripeAccount: this.stripeAccount,
|
|
@@ -99,7 +99,7 @@ const StripeCardElementModal = class {
|
|
|
99
99
|
cardElement.setPaymentRequestOption(options);
|
|
100
100
|
}
|
|
101
101
|
render() {
|
|
102
|
-
return (h("stripe-modal", { key: '
|
|
102
|
+
return (h("stripe-modal", { key: 'a0229c55472e3c6f417086fa08d79e1ec8a8c485', open: this.open, showCloseButton: this.showCloseButton }, h("stripe-card-element", { key: '799f08c781bad089cec8b1338e9a714d080abd51', showLabel: this.showLabel, publishableKey: this.publishableKey, intentClientSecret: this.intentClientSecret, shouldUseDefaultFormSubmitAction: this.shouldUseDefaultFormSubmitAction, handleSubmit: this.handleSubmit, stripeDidLoaded: this.stripeDidLoaded, intentType: this.intentType, zip: this.zip, buttonLabel: this.buttonLabel, sheetTitle: this.sheetTitle, applicationName: this.applicationName })));
|
|
103
103
|
}
|
|
104
104
|
get el() { return getElement(this); }
|
|
105
105
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, h, g as getElement, d as Host } from './index-C6bbmyga.js';
|
|
2
|
-
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-
|
|
2
|
+
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-VTa1Gc94.js';
|
|
3
3
|
import { S as StripeAPIError } from './error-XRfh5Wrs.js';
|
|
4
4
|
import './index-CBXaOfXU.js';
|
|
5
5
|
|
|
@@ -299,6 +299,13 @@ const StripeCardElement = class {
|
|
|
299
299
|
// Dependency Injection via factory
|
|
300
300
|
this.stripeService = serviceFactory.createStripeService();
|
|
301
301
|
this.cardElementManager = serviceFactory.createCardElementManager(this.stripeService);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Props are not yet populated inside the constructor when the component is registered via
|
|
305
|
+
* the custom-elements build (`dist/components/*`), so initialization that depends on them
|
|
306
|
+
* must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
|
|
307
|
+
*/
|
|
308
|
+
componentWillLoad() {
|
|
302
309
|
if (this.publishableKey != null && this.publishableKey !== '') {
|
|
303
310
|
this.initStripe(this.publishableKey, buildInitStripeOptionsFromAccount(this.stripeAccount));
|
|
304
311
|
}
|
|
@@ -449,6 +456,15 @@ const StripeModal = class {
|
|
|
449
456
|
*/
|
|
450
457
|
this.renderedOpen = false;
|
|
451
458
|
}
|
|
459
|
+
onOpenChange(open) {
|
|
460
|
+
if (open) {
|
|
461
|
+
this.openModalAnimation();
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
this.renderedOpen = false;
|
|
465
|
+
this.close.emit();
|
|
466
|
+
}
|
|
467
|
+
}
|
|
452
468
|
/**
|
|
453
469
|
* Toggle modal state
|
|
454
470
|
*/
|
|
@@ -460,15 +476,12 @@ const StripeModal = class {
|
|
|
460
476
|
*/
|
|
461
477
|
async openModal() {
|
|
462
478
|
this.open = true;
|
|
463
|
-
this.openModalAnimation();
|
|
464
479
|
}
|
|
465
480
|
/**
|
|
466
481
|
* Close the modal
|
|
467
482
|
*/
|
|
468
483
|
async closeModal() {
|
|
469
484
|
this.open = false;
|
|
470
|
-
this.renderedOpen = false;
|
|
471
|
-
this.close.emit();
|
|
472
485
|
}
|
|
473
486
|
componentDidLoad() {
|
|
474
487
|
const platformName = checkPlatform();
|
|
@@ -492,14 +505,19 @@ const StripeModal = class {
|
|
|
492
505
|
modalChild.classList.remove('loading');
|
|
493
506
|
}, { once: true });
|
|
494
507
|
requestAnimationFrame(() => {
|
|
495
|
-
this.renderedOpen =
|
|
508
|
+
this.renderedOpen = this.open;
|
|
496
509
|
});
|
|
497
510
|
}
|
|
498
511
|
render() {
|
|
499
512
|
const { renderedOpen, showCloseButton } = this;
|
|
500
|
-
return (h(Host, { key: '
|
|
513
|
+
return (h(Host, { key: '38fb86acf7cf5887a426c67b1a1271f7fae7048c' }, h("div", { key: 'f751d92c327ee2e564edfcd4d18f4dca43c20c37', class: `modal-row${renderedOpen ? ' open' : ''}`, onClick: () => this.closeModal() }, h("div", { key: '11519ccd44a5069df3247c530a2c1e114eab7aef', class: "modal-child", onClick: e => e.stopPropagation() }, showCloseButton ? (h("div", { class: "modal-close-button-wrap" }, h("ion-icon", { name: "close", size: "large", class: "modal-close-button", onClick: () => this.closeModal() }))) : null, h("div", { key: 'a41f7f263b488b5bbc2a999cbabf6b9e407bca85', class: "modal-loading" }, h("svg", { key: '0b3b25cb2812bc4d837fb4b7e6af4a5f42f0247e', version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 2400 2400" }, h("g", { key: '10a9f9ec59699e6d2988b9c65cd02da1754fd760', "stroke-width": "200", "stroke-linecap": "round", stroke: "currentColor", fill: "none", id: "spinner" }, h("line", { key: 'ed271fa584b930ceed5397c271b31e0d48c72f72', x1: "1200", y1: "600", x2: "1200", y2: "100" }), h("line", { key: '3cf855a84f3ab58b914b7aeb784fbc5b95d8ae94', opacity: "0.5", x1: "1200", y1: "2300", x2: "1200", y2: "1800" }), h("line", { key: '2cce4b62a276399235509e94f47a63acf9c69a0f', opacity: "0.917", x1: "900", y1: "680.4", x2: "650", y2: "247.4" }), h("line", { key: '64c175ef068591417b043f7630a44d34eae7cb59', opacity: "0.417", x1: "1750", y1: "2152.6", x2: "1500", y2: "1719.6" }), h("line", { key: '0856a654e3aa756dfb1e9fc316b8b379fa9d5a4e', opacity: "0.833", x1: "680.4", y1: "900", x2: "247.4", y2: "650" }), h("line", { key: 'c60f1f8495df9b8cdcc8941255d08c01a0e1c02f', opacity: "0.333", x1: "2152.6", y1: "1750", x2: "1719.6", y2: "1500" }), h("line", { key: '204bc2a7765e43b86f91c3fb9b1e72a3a39bb323', opacity: "0.75", x1: "600", y1: "1200", x2: "100", y2: "1200" }), h("line", { key: '7584b272f9efd7f746c1bcc5c8a5576098b02381', opacity: "0.25", x1: "2300", y1: "1200", x2: "1800", y2: "1200" }), h("line", { key: '7a053e9eb5f0da3fbf6fb7c9680bf73073bb126d', opacity: "0.667", x1: "680.4", y1: "1500", x2: "247.4", y2: "1750" }), h("line", { key: 'f8b817095143d739589e45c99b03c7afbdfc8293', opacity: "0.167", x1: "2152.6", y1: "650", x2: "1719.6", y2: "900" }), h("line", { key: 'aae0e36dbdfff44196f9758c8a5ed2337139ebe0', opacity: "0.583", x1: "900", y1: "1719.6", x2: "650", y2: "2152.6" }), h("line", { key: '3a257b30cb289f29ba386ccca7519bcdc22c3786', opacity: "0.083", x1: "1750", y1: "247.4", x2: "1500", y2: "680.4" }), h("animateTransform", { key: 'c6b8e73025589403dd3d08f84b02eb824763d056', attributeName: "transform", attributeType: "XML", type: "rotate", keyTimes: "0;0.08333;0.16667;0.25;0.33333;0.41667;0.5;0.58333;0.66667;0.75;0.83333;0.91667", values: "0 1199 1199;30 1199 1199;60 1199 1199;90 1199 1199;120 1199 1199;150 1199 1199;180 1199 1199;210 1199 1199;240 1199 1199;270 1199 1199;300 1199 1199;330 1199 1199", dur: "0.83333s", begin: "0s", repeatCount: "indefinite", calcMode: "discrete" })))), h("div", { key: 'da5ef8031e5b826d854a065d8172389cdd84fbf0', class: "modal-content" }, h("slot", { key: 'fbe97a3a4d5489de5ae6f49342c58d537b317842' }))))));
|
|
501
514
|
}
|
|
502
515
|
get el() { return getElement(this); }
|
|
516
|
+
static get watchers() { return {
|
|
517
|
+
"open": [{
|
|
518
|
+
"onOpenChange": 0
|
|
519
|
+
}]
|
|
520
|
+
}; }
|
|
503
521
|
};
|
|
504
522
|
StripeModal.style = stripeModalCss();
|
|
505
523
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, h, g as getElement } from './index-C6bbmyga.js';
|
|
2
|
-
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-
|
|
2
|
+
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-VTa1Gc94.js';
|
|
3
3
|
import './index-CBXaOfXU.js';
|
|
4
4
|
|
|
5
5
|
const stripeCurrencySelectorCss = () => `:root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}:host{box-sizing:border-box}:host *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}:host button{cursor:pointer}:host{display:block;width:100%}.stripe-currency-selector-wrap{width:100%;padding:0;margin:0}.stripe-currency-selector-wrap #currency-selector{width:100%;min-height:40px}.stripe-currency-selector-wrap #currency-selector-errors{margin-top:8px}`;
|
|
@@ -127,6 +127,13 @@ const StripeCurrencySelector = class {
|
|
|
127
127
|
// Dependency Injection via factory
|
|
128
128
|
this.stripeService = serviceFactory.createStripeService();
|
|
129
129
|
this.currencySelectorElementManager = serviceFactory.createCurrencySelectorElementManager(this.stripeService);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Props are not yet populated inside the constructor when the component is registered via
|
|
133
|
+
* the custom-elements build (`dist/components/*`), so initialization that depends on them
|
|
134
|
+
* must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
|
|
135
|
+
*/
|
|
136
|
+
componentWillLoad() {
|
|
130
137
|
if (this.publishableKey) {
|
|
131
138
|
this.initStripe(this.publishableKey, {
|
|
132
139
|
stripeAccount: this.stripeAccount,
|
|
@@ -44,5 +44,5 @@ var patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
|
44
44
|
|
|
45
45
|
patchBrowser().then(async (options) => {
|
|
46
46
|
await globalScripts();
|
|
47
|
-
return bootstrapLazy([["stripe-card-element-modal",[[0,"stripe-card-element-modal",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4],"getStripeCardElementElement":[64],"present":[64],"updateProgress":[64],"destroy":[64],"setPaymentRequestButton":[64]}]]],["stripe-address-element",[[0,"stripe-address-element",{"mode":[1],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"defaultCountry":[1,"default-country"],"allowedCountries":[16],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getValue":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-currency-selector",[[0,"stripe-currency-selector",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"handleCurrencyChange":[1040],"stripeDidLoaded":[1040],"initStripe":[64],"setErrorMessage":[64],"getSelectedCurrency":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-express-checkout-element",[[0,"stripe-express-checkout-element",{"intentType":[1,"intent-type"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"amount":[2],"currency":[1],"buttonHeight":[1,"button-height"],"shouldUseDefaultConfirmAction":[4,"should-use-default-confirm-action"],"stripeDidLoaded":[1040],"progress":[32],"updateProgress":[64],"setErrorMessage":[64],"initStripe":[64],"updateElementOptions":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-link-authentication-element",[[0,"stripe-link-authentication-element",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"defaultEmail":[1,"default-email"],"handleChange":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getEmail":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-payment-element",[[0,"stripe-payment-element",{"intentType":[1,"intent-type"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"intentClientSecret":[1,"intent-client-secret"],"checkoutSessionClientSecret":[1,"checkout-session-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"initStripeWithCheckoutSession":[64],"updateProgress":[64],"setErrorMessage":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}],"intentClientSecret":[{"updateIntentClientSecret":0}],"checkoutSessionClientSecret":[{"updateCheckoutSessionClientSecret":0}]}]]],["ion-icon",[[1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]},null,{"name":[{"loadIcon":0}],"src":[{"loadIcon":0}],"icon":[{"loadIcon":0}],"ios":[{"loadIcon":0}],"md":[{"loadIcon":0}]}]]],["stripe-payment-request-button",[[260,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32],"isAvailable":[64],"setPaymentMethodEventHandler":[64],"setPaymentRequestShippingOptionEventHandler":[64],"setPaymentRequestShippingAddressEventHandler":[64],"setPaymentRequestOption":[64],"initStripe":[64]}]]],["stripe-card-element_2",[[0,"stripe-card-element",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"zipCode":[32],"paymentRequestOption":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"setPaymentRequestOption":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}],[257,"stripe-modal",{"showCloseButton":[4,"show-close-button"],"open":[
|
|
47
|
+
return bootstrapLazy([["stripe-card-element-modal",[[0,"stripe-card-element-modal",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4],"getStripeCardElementElement":[64],"present":[64],"updateProgress":[64],"destroy":[64],"setPaymentRequestButton":[64]}]]],["stripe-address-element",[[0,"stripe-address-element",{"mode":[1],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"defaultCountry":[1,"default-country"],"allowedCountries":[16],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getValue":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-currency-selector",[[0,"stripe-currency-selector",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"handleCurrencyChange":[1040],"stripeDidLoaded":[1040],"initStripe":[64],"setErrorMessage":[64],"getSelectedCurrency":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-express-checkout-element",[[0,"stripe-express-checkout-element",{"intentType":[1,"intent-type"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"amount":[2],"currency":[1],"buttonHeight":[1,"button-height"],"shouldUseDefaultConfirmAction":[4,"should-use-default-confirm-action"],"stripeDidLoaded":[1040],"progress":[32],"updateProgress":[64],"setErrorMessage":[64],"initStripe":[64],"updateElementOptions":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-link-authentication-element",[[0,"stripe-link-authentication-element",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"defaultEmail":[1,"default-email"],"handleChange":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getEmail":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-payment-element",[[0,"stripe-payment-element",{"intentType":[1,"intent-type"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"intentClientSecret":[1,"intent-client-secret"],"checkoutSessionClientSecret":[1,"checkout-session-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"initStripeWithCheckoutSession":[64],"updateProgress":[64],"setErrorMessage":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}],"intentClientSecret":[{"updateIntentClientSecret":0}],"checkoutSessionClientSecret":[{"updateCheckoutSessionClientSecret":0}]}]]],["ion-icon",[[1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]},null,{"name":[{"loadIcon":0}],"src":[{"loadIcon":0}],"icon":[{"loadIcon":0}],"ios":[{"loadIcon":0}],"md":[{"loadIcon":0}]}]]],["stripe-payment-request-button",[[260,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32],"isAvailable":[64],"setPaymentMethodEventHandler":[64],"setPaymentRequestShippingOptionEventHandler":[64],"setPaymentRequestShippingAddressEventHandler":[64],"setPaymentRequestOption":[64],"initStripe":[64]}]]],["stripe-card-element_2",[[0,"stripe-card-element",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"zipCode":[32],"paymentRequestOption":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"setPaymentRequestOption":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}],[257,"stripe-modal",{"showCloseButton":[4,"show-close-button"],"open":[1028],"renderedOpen":[32],"toggleModal":[64],"openModal":[64],"closeModal":[64]},null,{"open":[{"onOpenChange":0}]}]]]], options);
|
|
48
48
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, h, g as getElement } from './index-C6bbmyga.js';
|
|
2
|
-
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-
|
|
2
|
+
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-VTa1Gc94.js';
|
|
3
3
|
import { S as StripeAPIError } from './error-XRfh5Wrs.js';
|
|
4
4
|
import './index-CBXaOfXU.js';
|
|
5
5
|
|
|
@@ -149,6 +149,13 @@ const StripeExpressCheckoutElement = class {
|
|
|
149
149
|
// Dependency Injection via factory
|
|
150
150
|
this.stripeService = serviceFactory.createStripeService();
|
|
151
151
|
this.expressCheckoutManager = serviceFactory.createExpressCheckoutElementManager(this.stripeService);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Props are not yet populated inside the constructor when the component is registered via
|
|
155
|
+
* the custom-elements build (`dist/components/*`), so initialization that depends on them
|
|
156
|
+
* must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
|
|
157
|
+
*/
|
|
158
|
+
componentWillLoad() {
|
|
152
159
|
if (this.publishableKey != null && this.publishableKey !== '') {
|
|
153
160
|
this.initStripe(this.publishableKey, {
|
|
154
161
|
stripeAccount: this.stripeAccount,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, h, g as getElement } from './index-C6bbmyga.js';
|
|
2
|
-
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-
|
|
2
|
+
import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-VTa1Gc94.js';
|
|
3
3
|
import './index-CBXaOfXU.js';
|
|
4
4
|
|
|
5
5
|
const stripeLinkAuthenticationElementCss = () => `:root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-link-authentication-wrap{box-sizing:border-box}.stripe-link-authentication-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-link-authentication-wrap button{cursor:pointer}.stripe-link-authentication-wrap{display:block;width:100%;background:#fff;padding:16px}.stripe-link-authentication-wrap .stripe-link-authentication-container #link-authentication-element .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-link-authentication-wrap .stripe-link-authentication-container #link-authentication-element .StripeElement>.__PrivateStripeElement{width:100%}.stripe-link-authentication-wrap .stripe-link-authentication-container .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}`;
|
|
@@ -168,6 +168,13 @@ const StripeLinkAuthenticationElement = class {
|
|
|
168
168
|
// Dependency Injection via factory
|
|
169
169
|
this.stripeService = serviceFactory.createStripeService();
|
|
170
170
|
this.linkAuthenticationElementManager = serviceFactory.createLinkAuthenticationElementManager(this.stripeService);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Props are not yet populated inside the constructor when the component is registered via
|
|
174
|
+
* the custom-elements build (`dist/components/*`), so initialization that depends on them
|
|
175
|
+
* must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
|
|
176
|
+
*/
|
|
177
|
+
componentWillLoad() {
|
|
171
178
|
if (this.publishableKey) {
|
|
172
179
|
this.initStripe(this.publishableKey, {
|
|
173
180
|
stripeAccount: this.stripeAccount,
|