@justifi/webcomponents 6.13.3 → 6.13.4
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/{Analytics-DusgFP9U.js → Analytics-Bnqim3De.js} +2 -2
- package/dist/cjs/{Api-BioDE5he.js → Api-DiVnyVMc.js} +19 -3
- package/dist/cjs/additional-questions-form-step_15.cjs.entry.js +4 -4
- package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
- package/dist/cjs/{business.service-DOGeb2O6.js → business.service-xyk3nSbS.js} +1 -1
- package/dist/cjs/card-form.cjs.entry.js +2 -2
- package/dist/cjs/{check-pkg-version-DD7fjCqn.js → check-pkg-version-DdEYSubN.js} +1 -1
- package/dist/cjs/{checkout.service-Bdr5qUHj.js → checkout.service-BvQmucoL.js} +1 -1
- package/dist/cjs/dispute-notification_2.cjs.entry.js +5 -5
- package/dist/cjs/{event-types-DWDQKDv4.js → event-types-Dzra0qB3.js} +1 -1
- package/dist/cjs/{get-subaccounts-Dgl7ECtg.js → get-subaccounts-h69ubhBi.js} +1 -1
- package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
- package/dist/cjs/justifi-apple-pay_11.cjs.entry.js +6 -6
- package/dist/cjs/justifi-bank-account-billing-form-simple.cjs.entry.js +4 -4
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +4 -4
- package/dist/cjs/justifi-business-details.cjs.entry.js +5 -5
- package/dist/cjs/justifi-business-form.cjs.entry.js +6 -6
- package/dist/cjs/justifi-card-form.cjs.entry.js +4 -4
- package/dist/cjs/justifi-checkout-qr-code.cjs.entry.js +4 -4
- package/dist/cjs/justifi-checkout.cjs.entry.js +4 -4
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +6 -6
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +5 -5
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +4 -4
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payment-details.cjs.entry.js +5 -5
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +15 -6
- package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +5 -5
- package/dist/cjs/justifi-payments-list.cjs.entry.js +5 -5
- package/dist/cjs/justifi-payout-details.cjs.entry.js +5 -5
- package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +5 -5
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +6 -6
- package/dist/cjs/justifi-qr-terminal.cjs.entry.js +5 -5
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +5 -5
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +4 -4
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +4 -4
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +6 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{package-DeCbZvnG.js → package-CuQyxWw2.js} +1 -1
- package/dist/cjs/{payment-provisioning-actions-B4x7lnyF.js → payment-provisioning-actions-DwgI9weK.js} +5 -4
- package/dist/cjs/{payment.service-a5EL3s2d.js → payment.service-BdK_wsu2.js} +1 -1
- package/dist/cjs/{payout.service-BJtGBHsQ.js → payout.service-CVSqMmCW.js} +1 -1
- package/dist/cjs/{plaid.service-DpiLY-5D.js → plaid.service-Dj-AZOjk.js} +1 -1
- package/dist/cjs/{terminal.service-DN2A-bNx.js → terminal.service-Dzukw0o7.js} +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/api/Api.js +19 -3
- package/dist/collection/components/business-forms/payment-provisioning/justifi-payment-provisioning.js +7 -0
- package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-actions.js +5 -4
- package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-submission-failed.js +6 -0
- package/dist/docs.json +1 -1
- package/dist/esm/{Analytics-CtVZmAya.js → Analytics-CkhiYS1_.js} +3 -3
- package/dist/esm/{Api-DjAL73GZ.js → Api-CTkszAxp.js} +20 -4
- package/dist/esm/{Plaid-C8qoMZLV.js → Plaid-XJ1Wi_Qy.js} +1 -1
- package/dist/esm/additional-questions-details_5.entry.js +1 -1
- package/dist/esm/additional-questions-form-step_15.entry.js +7 -7
- package/dist/esm/bank-account-document-form-inputs.entry.js +2 -2
- package/dist/esm/bank-account-form.entry.js +3 -3
- package/dist/esm/{business.service-BGXqAyxu.js → business.service-CJrHGJHW.js} +2 -2
- package/dist/esm/card-form.entry.js +3 -3
- package/dist/esm/{check-pkg-version-DcFIDA70.js → check-pkg-version-CoKEouKg.js} +1 -1
- package/dist/esm/{checkout-actions-D8JS2l5e.js → checkout-actions-CheVrS18.js} +2 -2
- package/dist/esm/{checkout.service-sHKaW-M0.js → checkout.service-fPRUtr9H.js} +2 -2
- package/dist/esm/dispute-notification_2.entry.js +8 -8
- package/dist/esm/{event-types-ynZLear3.js → event-types-BtWMbtaC.js} +2 -2
- package/dist/esm/form-control-monetary.entry.js +1 -1
- package/dist/esm/{get-business-DAv_b3vf.js → get-business-DTNQJoh_.js} +2 -2
- package/dist/esm/{get-payment-details-Bipad3jX.js → get-payment-details-CSX5fwOG.js} +2 -2
- package/dist/esm/{get-subaccounts-FqCT2s3S.js → get-subaccounts-Cy2mYsaE.js} +3 -3
- package/dist/esm/hidden-input_2.entry.js +1 -1
- package/dist/esm/justifi-apple-pay_11.entry.js +10 -10
- package/dist/esm/justifi-bank-account-billing-form-simple.entry.js +6 -6
- package/dist/esm/justifi-bank-account-form.entry.js +6 -6
- package/dist/esm/justifi-business-details.entry.js +9 -9
- package/dist/esm/justifi-business-form.entry.js +9 -9
- package/dist/esm/justifi-card-form.entry.js +6 -6
- package/dist/esm/justifi-checkout-qr-code.entry.js +6 -6
- package/dist/esm/justifi-checkout.entry.js +6 -6
- package/dist/esm/justifi-checkouts-list-filters.entry.js +2 -2
- package/dist/esm/justifi-checkouts-list.entry.js +9 -9
- package/dist/esm/justifi-dispute-management.entry.js +8 -8
- package/dist/esm/justifi-gross-payment-chart.entry.js +7 -7
- package/dist/esm/justifi-order-terminals.entry.js +10 -10
- package/dist/esm/justifi-payment-details.entry.js +9 -9
- package/dist/esm/justifi-payment-provisioning.entry.js +18 -9
- package/dist/esm/justifi-payment-transactions-list.entry.js +8 -8
- package/dist/esm/justifi-payments-list-filters.entry.js +1 -1
- package/dist/esm/justifi-payments-list.entry.js +8 -8
- package/dist/esm/justifi-payout-details.entry.js +9 -9
- package/dist/esm/justifi-payout-transactions-list.entry.js +8 -8
- package/dist/esm/justifi-payouts-list-filters.entry.js +2 -2
- package/dist/esm/justifi-payouts-list.entry.js +10 -10
- package/dist/esm/justifi-qr-terminal.entry.js +9 -9
- package/dist/esm/justifi-refund-payment.entry.js +9 -9
- package/dist/esm/justifi-season-interruption-insurance.entry.js +7 -7
- package/dist/esm/justifi-terminal-orders-list-filters.entry.js +2 -2
- package/dist/esm/justifi-terminal-orders-list.entry.js +7 -7
- package/dist/esm/justifi-terminals-list-filters.entry.js +2 -2
- package/dist/esm/justifi-terminals-list.entry.js +9 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{package-Bx2_PW91.js → package-BP7jEC_K.js} +1 -1
- package/dist/esm/{payment-provisioning-actions-DI3QUsjh.js → payment-provisioning-actions-DjjVhIsC.js} +7 -6
- package/dist/esm/{payment.service-wSNYSRyl.js → payment.service-DqqhXGIA.js} +2 -2
- package/dist/esm/{payout.service-CTAksNmD.js → payout.service-pXbxWGPO.js} +2 -2
- package/dist/esm/{payouts-status-CeZoirpf.js → payouts-status-Ch05ZKVP.js} +2 -2
- package/dist/esm/{plaid.service-5EpJEdwX.js → plaid.service-Bb_mVHR9.js} +2 -2
- package/dist/esm/{terminal.service-xjfU0mJT.js → terminal.service-AK9uBpcb.js} +2 -2
- package/dist/esm/{utils-myniydlM.js → utils-ByihSvdD.js} +1 -1
- package/dist/esm/{utils-CcA8Y5hs.js → utils-UkIEdf2x.js} +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/module/Api.js +19 -3
- package/dist/module/justifi-order-terminals.js +1 -1
- package/dist/module/justifi-payment-provisioning.js +11 -1
- package/dist/module/justifi-season-interruption-insurance.js +1 -1
- package/dist/module/justifi-terminals-list.js +1 -1
- package/dist/module/package.js +1 -1
- package/dist/module/payment-provisioning-actions.js +5 -4
- package/dist/module/utils2.js +1 -1
- package/dist/types/components/business-forms/payment-provisioning/justifi-payment-provisioning.d.ts +1 -0
- package/dist/types/components/business-forms/payment-provisioning/payment-provisioning-submission-failed.d.ts +1 -0
- package/dist/webcomponents/p-0ef51b2d.entry.js +1 -0
- package/dist/webcomponents/p-1f88e411.entry.js +1 -0
- package/dist/webcomponents/p-28f92f1f.entry.js +1 -0
- package/dist/webcomponents/{p-3918fb44.entry.js → p-2cd01fae.entry.js} +1 -1
- package/dist/webcomponents/{p-b89a5053.entry.js → p-2dee737f.entry.js} +1 -1
- package/dist/webcomponents/p-36638161.entry.js +1 -0
- package/dist/webcomponents/{p-7b6cf400.entry.js → p-36b16db2.entry.js} +1 -1
- package/dist/webcomponents/{p-2c798125.entry.js → p-37e7429c.entry.js} +1 -1
- package/dist/webcomponents/{p-9d11aaf2.entry.js → p-483dc944.entry.js} +1 -1
- package/dist/webcomponents/{p-c6eea99e.entry.js → p-529c5c9f.entry.js} +1 -1
- package/dist/webcomponents/{p-708aee06.entry.js → p-625830fe.entry.js} +1 -1
- package/dist/webcomponents/{p-8771e52a.entry.js → p-64d72b86.entry.js} +1 -1
- package/dist/webcomponents/{p-c8bcc54f.entry.js → p-67da2742.entry.js} +1 -1
- package/dist/webcomponents/{p-f6d49f21.entry.js → p-68034a17.entry.js} +1 -1
- package/dist/webcomponents/{p-4fab9314.entry.js → p-6d52cdd4.entry.js} +1 -1
- package/dist/webcomponents/{p-f4baf684.entry.js → p-727e9ddd.entry.js} +1 -1
- package/dist/webcomponents/{p-1fced37f.entry.js → p-76709384.entry.js} +1 -1
- package/dist/webcomponents/{p-4a30693b.entry.js → p-7776b52e.entry.js} +1 -1
- package/dist/webcomponents/{p-98bbdf10.entry.js → p-880e3388.entry.js} +1 -1
- package/dist/webcomponents/p-90fdadf7.entry.js +1 -0
- package/dist/webcomponents/{p-ebee139f.entry.js → p-938e41c9.entry.js} +1 -1
- package/dist/webcomponents/{p-C7hX61pS.js → p-B7wfdVBf.js} +1 -1
- package/dist/webcomponents/{p-BSs-2JKu.js → p-BM88Upl5.js} +1 -1
- package/dist/webcomponents/p-BP7jEC_K.js +1 -0
- package/dist/webcomponents/p-BaZTheg9.js +1 -0
- package/dist/webcomponents/{p-CfIGO7TJ.js → p-Bo36V7ni.js} +1 -1
- package/dist/webcomponents/p-CI-XifDo.js +1 -0
- package/dist/webcomponents/p-CP0Y19co.js +1 -0
- package/dist/webcomponents/p-CWook735.js +1 -0
- package/dist/webcomponents/{p-DXTa04jn.js → p-Cl5FLD11.js} +1 -1
- package/dist/webcomponents/{p-CqOzVXGL.js → p-CxNdigHC.js} +1 -1
- package/dist/webcomponents/{p-zZn1OXja.js → p-CykiDks3.js} +1 -1
- package/dist/webcomponents/p-DGsgQXco.js +1 -0
- package/dist/webcomponents/{p-CO8ZGkfN.js → p-DItiYtAy.js} +1 -1
- package/dist/webcomponents/p-DWdj6UhE.js +1 -0
- package/dist/webcomponents/{p-CxBrydeX.js → p-D_MQLfzf.js} +1 -1
- package/dist/webcomponents/{p-R_0S69Pr.js → p-D_ULdupf.js} +1 -1
- package/dist/webcomponents/{p-CdwzNfP1.js → p-IFhZFB4v.js} +1 -1
- package/dist/webcomponents/p-UEdJ7AYc.js +1 -0
- package/dist/webcomponents/{p-f01fd4ff.entry.js → p-a30af70b.entry.js} +1 -1
- package/dist/webcomponents/{p-65908b5f.entry.js → p-a5443425.entry.js} +1 -1
- package/dist/webcomponents/{p-7495aa96.entry.js → p-b6c15db5.entry.js} +1 -1
- package/dist/webcomponents/{p-e3f8541c.entry.js → p-b73bbc07.entry.js} +1 -1
- package/dist/webcomponents/p-bfd73ef0.entry.js +1 -0
- package/dist/webcomponents/{p-4383dfdc.entry.js → p-c9be0d54.entry.js} +1 -1
- package/dist/webcomponents/{p-2a0ab07f.entry.js → p-cc0cfbed.entry.js} +1 -1
- package/dist/webcomponents/{p-dde22375.entry.js → p-ce7c1141.entry.js} +4 -4
- package/dist/webcomponents/{p-dfe66300.entry.js → p-df340d99.entry.js} +1 -1
- package/dist/webcomponents/{p-67364f1d.entry.js → p-e033ced2.entry.js} +1 -1
- package/dist/webcomponents/{p-291b9a48.entry.js → p-e47d21e5.entry.js} +1 -1
- package/dist/webcomponents/p-ee900ccf.entry.js +1 -0
- package/dist/webcomponents/{p-a62ef857.entry.js → p-f266fafb.entry.js} +1 -1
- package/dist/webcomponents/{p-9c0760b9.entry.js → p-f805c9ac.entry.js} +1 -1
- package/dist/webcomponents/{p-84b643f7.entry.js → p-fb86e6f0.entry.js} +1 -1
- package/dist/webcomponents/{p-8fce7a9c.entry.js → p-fb8c8999.entry.js} +1 -1
- package/dist/webcomponents/{p-Cn7z5L7J.js → p-ph646MSj.js} +1 -1
- package/dist/webcomponents/{p-B62JX_Dh.js → p-rhS9V7qg.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/webcomponents/p-0b9263f3.entry.js +0 -1
- package/dist/webcomponents/p-17f8c3e7.entry.js +0 -1
- package/dist/webcomponents/p-2b64659a.entry.js +0 -1
- package/dist/webcomponents/p-5ea486b6.entry.js +0 -1
- package/dist/webcomponents/p-6f71bf5f.entry.js +0 -1
- package/dist/webcomponents/p-BB8Ce9rp.js +0 -1
- package/dist/webcomponents/p-BUHsyQpA.js +0 -1
- package/dist/webcomponents/p-Bx2_PW91.js +0 -1
- package/dist/webcomponents/p-CPJC6tlj.js +0 -1
- package/dist/webcomponents/p-DP9ysr2K.js +0 -1
- package/dist/webcomponents/p-Da3fPDxu.js +0 -1
- package/dist/webcomponents/p-De4Pig-y.js +0 -1
- package/dist/webcomponents/p-NzPaWKbY.js +0 -1
- package/dist/webcomponents/p-db17a828.entry.js +0 -1
- package/dist/webcomponents/p-e9494d8f.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as s,g as n}from"./p-CV0Pyo1O.js";import{A as a}from"./p-De4Pig-y.js";import{A as o,r,s as l,t as h,u as c,v as d,w as u,C as p,b as y,c as m,I as v,x as g,y as f,z as b}from"./p-DXTa04jn.js";import{S as M}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as k}from"./p-uZ5KAseb.js";import{c as w,o as j,a as P,g as T,b as A}from"./p-DyPk4BJt.js";import{t as C,r as N}from"./p-CPKMvyV_.js";import{f as I}from"./p-BSs-2JKu.js";import{w as E,c as D}from"./p-DVJaoI_m.js";import{H as O}from"./p-jIDKmNHy.js";import{H as S,b as L,h as x,i as z}from"./p-C-Jgmek8.js";import{H as _}from"./p-DYHjzFnJ.js";import{J as R}from"./p-CfIGO7TJ.js";import{c as U}from"./p-CqOzVXGL.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{m as B,a as Y}from"./p-B62JX_Dh.js";import{C as F}from"./p-Cn7z5L7J.js";import{P as V}from"./p-DP9ysr2K.js";import{P as Q,a as H,b as G}from"./p-DkoufM1t.js";import{C as W}from"./p-ZpPDShvP.js";import"./p-D8GTwl9v.js";import"./p-Bx2_PW91.js";import"./p-CdwzNfP1.js";const J=class{constructor(i){t(this,i),this.radioClick=e(this,"radio-click",7),this.checked=!1,this.hidden=!1}render(){return i(M,{key:"02955940079320bd9c6bf94e239545385ac36458"},i("radio-list-item",{key:"fc6b98e456e4326b843b2b3248b7327436767cf4",name:this.name,value:this.value,label:this.label,checked:this.checked,hidden:this.hidden,class:this.class,"onRadio-click":t=>this.radioClick.emit(t.detail)}))}};var Z;!function(t){t.UNAVAILABLE="UNAVAILABLE",t.SESSION_ERROR="SESSION_ERROR",t.MERCHANT_VALIDATION_ERROR="MERCHANT_VALIDATION_ERROR",t.PAYMENT_PROCESSING_ERROR="PAYMENT_PROCESSING_ERROR",t.USER_CANCELLED="USER_CANCELLED"}(Z||(Z={}));class q{constructor(){this.api=a()}initialize(t){if(this.applePayConfig=new o(t),!this.applePayConfig.isValid)throw new Error("Invalid Apple Pay configuration provided")}async validateMerchant(t,e){try{return await this.api.post({endpoint:"apple_pay/merchant_session",authToken:t,headers:{"Sub-Account":e},body:{domain:window.location.hostname,display_name:this.applePayConfig.displayName}})}catch(t){throw console.error("Backend validation failed:",t),new Error("Merchant validation failed")}}async processPayment(t,e,i){const s=await this.api.post({endpoint:"apple_pay/process_token",authToken:t,body:i,headers:{"Sub-Account":e}});return{success:s.id&&!!s.data.token,data:s}}isAvailable(){return r.isApplePaySupported()&&r.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await r.canMakePaymentsWithActiveCard(this.applePayConfig.merchantIdentifier)}async startPaymentSession(t,e,i){if(!this.applePayConfig)throw console.error("[ApplePayService] Missing applePayConfig. Did you call initialize()?"),new Error("Apple Pay not initialized. Call initialize() first.");const s=new l(t);if(!s.isValid){const t=[];throw s.countryCode||t.push("countryCode"),s.currencyCode||t.push("currencyCode"),s.merchantCapabilities&&0!==s.merchantCapabilities.length||t.push("merchantCapabilities"),s.supportedNetworks&&0!==s.supportedNetworks.length||t.push("supportedNetworks"),s.total&&s.total.label&&s.total.amount||t.push("total"),console.error("[ApplePayService] Payment request is invalid. Missing/invalid:",t),new Error("Invalid payment request provided")}return this.currentPaymentRequest=s,new Promise(((t,n)=>{try{if("undefined"==typeof window||!("ApplePaySession"in window))return console.error("[ApplePayService] ApplePaySession not available on window"),n({success:!1,error:{code:Z.UNAVAILABLE,message:"ApplePaySession API is not available in this environment"}});this.currentSession=new window.ApplePaySession(3,s),this.setupSessionEventHandlers(t,n,e,i),this.currentSession.begin()}catch(t){console.error("[ApplePayService] Exception while starting session:",t),n({success:!1,error:{code:Z.SESSION_ERROR,message:t instanceof Error?t.message:"Failed to start Apple Pay session"}})}}))}abortPaymentSession(){this.currentSession&&(this.currentSession.abort(),this.currentSession=void 0,this.currentPaymentRequest=void 0)}setupSessionEventHandlers(t,e,i,s){this.currentSession&&this.applePayConfig&&this.currentPaymentRequest?(this.currentSession.onvalidatemerchant=async()=>{try{if(!i)throw console.error("[ApplePayService] Missing authToken for merchant validation"),new Error("Authentication token not provided.");const t=await this.validateMerchant(i,s);try{this.currentSession.completeMerchantValidation(t)}catch(t){throw console.error("Error calling completeMerchantValidation:",t),t}}catch(t){console.error("=== MERCHANT VALIDATION ERROR ==="),console.error("Error during merchant validation:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.abort(),e({success:!1,error:{code:Z.MERCHANT_VALIDATION_ERROR,message:t instanceof Error?t.message:"Merchant validation failed"}})}},this.currentSession.onpaymentauthorized=async n=>{try{const a=n.payment,o=Object.assign(Object.assign({},a.token),{product_details:{name:this.currentPaymentRequest.total.label,price:r.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),l=await this.processPayment(i,s,o);l.success?(this.currentSession.completePayment({status:h.STATUS_SUCCESS}),t({success:!0,token:a.token,paymentMethodId:l.data.id})):(console.error("PSP reported payment failure:",l.data),this.currentSession.completePayment({status:h.STATUS_FAILURE}),e({success:!1,error:{code:Z.PAYMENT_PROCESSING_ERROR,message:"Payment processing failed"}}))}catch(t){console.error("=== PAYMENT PROCESSING ERROR ==="),console.error("Error processing payment:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.completePayment({status:h.STATUS_FAILURE}),e({success:!1,error:{code:Z.PAYMENT_PROCESSING_ERROR,message:t instanceof Error?t.message:"Payment processing failed"}})}finally{this.currentSession=void 0,this.currentPaymentRequest=void 0}},this.currentSession.onpaymentmethodselected=()=>{const t={newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]};try{this.currentSession.completePaymentMethodSelection(t)}catch(t){console.error("Error completing payment method selection:",t),this.currentSession.abort()}},this.currentSession.onshippingmethodselected=()=>{this.currentSession.completeShippingMethodSelection({status:h.STATUS_SUCCESS,newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]})},this.currentSession.oncancel=t=>{if(t.sessionError)switch(console.error(t.sessionError),t.sessionError.code){case"unknown":console.error("Unknown error - likely merchant validation issue"),console.error("This usually means:"),console.error("1. Merchant certificate is invalid or expired"),console.error("2. Merchant identifier mismatch"),console.error("3. Backend validation endpoint issues");break;case"invalidMerchantSession":console.error("Invalid merchant session provided"),console.error("Check that the merchant session from backend is valid");break;case"userCancel":console.error("User cancelled the payment");break;default:console.error("Other error code:",t.sessionError.code)}this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:Z.USER_CANCELLED,message:"User cancelled the Apple Pay session"}})},"onerror"in this.currentSession&&(this.currentSession.onerror=t=>{console.error("=== APPLE PAY SESSION ERROR ==="),console.error("Session error:",t),this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:Z.SESSION_ERROR,message:"Apple Pay session error occurred"}})})):console.error("[ApplePayService] setupSessionEventHandlers called without required state",{hasSession:Boolean(this.currentSession),hasConfig:Boolean(this.applePayConfig),hasPaymentRequest:Boolean(this.currentPaymentRequest)})}static createPaymentRequest(t,e,i="US",s="USD"){return{countryCode:i,currencyCode:s,merchantCapabilities:r.getDefaultMerchantCapabilities(),supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const K=t=>{const{isLoading:e}=t;return e?i("div",{class:"container-fluid p-0"},i("div",{class:"row mb-3"},i("div",{class:"col-12 align-content-center"},i(k,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null},X=t=>i("div",{class:"apple-pay-button-container"},i("button",Object.assign({class:(()=>{let e="apple-pay-button";switch(t.buttonStyle){case c.WHITE:e+=" apple-pay-button-white";break;case c.WHITE_OUTLINE:e+=" apple-pay-button-white-outline";break;default:e+=" apple-pay-button-black"}switch(t.buttonType){case d.BUY:e+=" apple-pay-button-type-buy";break;case d.DONATE:e+=" apple-pay-button-type-donate";break;default:e+=" apple-pay-button-type-plain"}return(t.disabled||t.isProcessing||!t.isAvailable)&&(e+=" disabled"),e})(),style:{width:t.width,height:t.height},onClick:()=>{!t.disabled&&!t.isProcessing&&t.isAvailable&&t.clickHandler&&t.clickHandler()},disabled:t.disabled||t.isProcessing||!t.isAvailable,"aria-label":"Pay with Apple Pay",type:"button"},t),t.isProcessing&&i("div",{class:"processing-overlay"},i("div",{class:"spinner"}),i("span",null,"Processing..."))),i("style",null,"\n .apple-pay-button-container {\n display: block;\n position: relative;\n width: 100%;\n }\n\n /* Apple Pay CSS classes - these are the official Apple Pay button styles */\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: plain; /* default */\n -apple-pay-button-style: black; /* default */\n border-radius: 8px;\n cursor: pointer;\n border: none;\n outline: none;\n transition: opacity 0.2s ease;\n position: relative;\n }\n\n /* Button styles */\n .apple-pay-button.apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n\n .apple-pay-button.apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n\n .apple-pay-button.apple-pay-button-white-outline {\n -apple-pay-button-style: white-outline;\n }\n\n /* Button types */\n .apple-pay-button.apple-pay-button-type-plain {\n -apple-pay-button-type: plain;\n }\n\n .apple-pay-button.apple-pay-button-type-buy {\n -apple-pay-button-type: buy;\n }\n\n .apple-pay-button.apple-pay-button-type-donate {\n -apple-pay-button-type: donate;\n }\n\n /* Hover and disabled states */\n .apple-pay-button:hover:not(.disabled) {\n opacity: 0.9;\n }\n\n .apple-pay-button.disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Processing overlay */\n .processing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: rgba(0, 0, 0, 0.8);\n color: white;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n }\n\n .spinner {\n width: 16px;\n height: 16px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-top: 2px solid #fff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n /* Responsive design */\n @media (max-width: 480px) {\n .apple-pay-button {\n width: 100% !important;\n min-width: 200px;\n }\n }\n ")),$=class{constructor(i){t(this,i),this.applePayStarted=e(this,"applePayStarted",7),this.applePayCompleted=e(this,"applePayCompleted",7),this.applePayCancelled=e(this,"applePayCancelled",7),this.applePayError=e(this,"applePayError",7),this.sdkLoaded=!1,this.countryCode="US",this.merchantIdentifier="merchant.com.staging-justifi.checkout-dev",this.merchantDisplayName="JustiFi Checkout",this.initiativeContext="dev-checkout.justifi-staging.com",this.buttonType=d.PLAIN,this.buttonStyle=c.BLACK,this.disabled=!1,this.width="100%",this.height="48px",this.isLoading=!0,this.isProcessing=!1,this.isAvailable=!1,this.canMakePayments=!1,this.isConfigValid=!0,this.error=null,this.handleApplePayClick=async()=>{var t,e,i;if(!this.isProcessing&&!this.disabled&&this.isAvailable)try{this.isProcessing=!0,this.error=null,this.applePayStarted.emit();const i={countryCode:this.countryCode,currencyCode:w.paymentCurrency,merchantCapabilities:[u.SUPPORTS_3DS,u.SUPPORTS_CREDIT,u.SUPPORTS_DEBIT],supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(w.paymentDescription,w.paymentAmount)},s=await this.applePayService.startPaymentSession(i,w.authToken,w.accountId);s.success?this.applePayCompleted.emit({success:!0,token:s.token,paymentMethodId:s.paymentMethodId}):(this.applePayCompleted.emit({success:!1,error:s.error}),this.applePayError.emit({error:(null===(t=s.error)||void 0===t?void 0:t.message)||"Payment failed",code:(null===(e=s.error)||void 0===e?void 0:e.code)||$.ErrorCode.PAYMENT_FAILED}))}catch(t){if((null===(i=null==t?void 0:t.error)||void 0===i?void 0:i.code)===Z.USER_CANCELLED)this.applePayCancelled.emit();else{const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e,code:$.ErrorCode.PAYMENT_FAILED}),this.applePayCompleted.emit({success:!1,error:e})}}finally{this.isProcessing=!1}}}componentWillLoad(){this.isAvailable=r.isApplePaySupported(),this.isAvailable?w.checkoutLoaded?this.loadApplePaySDK():j("checkoutLoaded",(t=>{t&&this.loadApplePaySDK()})):this.isLoading=!1}loadApplePaySDK(){if(this.sdkLoaded)return;this.sdkLoaded=!0;const t=document.createElement("script");t.src="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",t.async=!0,t.onload=()=>this.initializeApplePay(),document.head.appendChild(t)}async initializeApplePay(){try{if(this.isLoading=!0,this.error=null,this.isConfigValid=!0,!(Boolean(w.paymentAmount)&&Boolean(w.paymentCurrency)&&Boolean(w.authToken)))return this.error="Missing required Apple Pay configuration",this.isConfigValid=!1,this.applePayError.emit({error:this.error,code:$.ErrorCode.CONFIG_ERROR}),void(this.isLoading=!1);if(this.isAvailable=r.isApplePaySupported(),this.canMakePayments=r.canMakePayments(),!this.isAvailable)return this.error="Apple Pay is not supported on this device",this.applePayError.emit({error:this.error,code:$.ErrorCode.NOT_SUPPORTED}),void(this.isLoading=!1);if(!this.canMakePayments)return this.error="Apple Pay is not available",this.applePayError.emit({error:this.error,code:$.ErrorCode.NOT_AVAILABLE}),void(this.isLoading=!1);const t={merchantIdentifier:this.merchantIdentifier,displayName:this.merchantDisplayName,initiative:"web",initiativeContext:this.initiativeContext,buttonType:this.buttonType,buttonStyle:this.buttonStyle};this.applePayService=new q,this.applePayService.initialize(t),await this.applePayService.canMakePaymentsWithActiveCard()||console.warn("No Apple Pay cards available, but continuing...")}catch(t){this.error=t instanceof Error?t.message:"Failed to initialize Apple Pay",this.applePayError.emit({error:this.error,code:$.ErrorCode.INITIALIZATION_ERROR})}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?r.getDefaultSupportedNetworks():[]}async abort(){var t;null===(t=this.applePayService)||void 0===t||t.abortPaymentSession(),this.isProcessing=!1,this.applePayCancelled.emit()}render(){if(!w.applePayEnabled)return null;if(!this.isAvailable)return null;const t=!this.isLoading&&this.isAvailable&&this.canMakePayments&&this.isConfigValid;return i(M,null,i("div",{class:"apple-pay-container"},i(K,{isLoading:this.isLoading}),t&&i(X,{buttonType:this.buttonType,buttonStyle:this.buttonStyle,disabled:this.disabled,isProcessing:this.isProcessing,isAvailable:this.isAvailable,clickHandler:this.handleApplePayClick,width:this.width,height:this.height})),i("style",null,"\n .apple-pay-container {\n width: 100%;\n }\n "))}};$.ErrorCode={CONFIG_ERROR:"CONFIG_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",NOT_AVAILABLE:"NOT_AVAILABLE",INITIALIZATION_ERROR:"INITIALIZATION_ERROR",PAYMENT_FAILED:"PAYMENT_FAILED"};const tt=class{constructor(e){t(this,e),this.variant="primary",this.type="button"}render(){return i(M,{key:"241fe8903788f0442b42bf5a6835d152d1944967"},i("internal-button",{key:"7c13bd1fa53cf9faae26e521af5a40a08659fe92",text:this.text,variant:this.variant,isLoading:this.isLoading,clickHandler:this.clickHandler,type:this.type,disabled:this.disabled,class:this.class,customStyle:this.customStyle,hidden:this.hidden}))}},et=class{constructor(e){t(this,e)}render(){return i(M,{key:"336fa6563952ee7905c2ed4a3330d73bbb33a0eb"},i("section",{key:"48b8798a925d618f5a2c52d743190207b78eb70a"},i("div",{key:"81d91167c10ccc49acb039ea54a9f97f4aa6e305"},i("div",{key:"9744242f2c2c3082e9c1a3af6e716ec4cb28f1fd",part:C},null==w?void 0:w.paymentDescription),i("div",{key:"438062935abd2f00495c432ef6652e3808e5215f"},i("span",{key:"e3f24d9c52ddae0206cbefe61bd08f24697fe28e",part:C},"Total")," ",i("span",{key:"9835cb60de31a2c8946b7ac2dd6d1fa82f223110",part:C},I(+(null==w?void 0:w.totalAmount)))))))}},it=t=>{const{isLoading:e}=t;return e?i("div",{class:"container-fluid p-0"},i("div",{class:"row mb-3"},i("div",{class:"col-12 align-content-center"},i(k,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null};var st;!function(t){t.initialize="justifi.googlePay.initialize",t.ready="justifi.googlePay.ready",t.sdkLoaded="justifi.googlePay.sdkLoaded",t.initializeResult="justifi.googlePay.initializeResult",t.error="justifi.googlePay.error",t.buttonClicked="justifi.googlePay.buttonClicked",t.startPayment="justifi.googlePay.startPayment",t.paymentSuccess="justifi.googlePay.paymentSuccess",t.paymentCanceled="justifi.googlePay.paymentCanceled",t.paymentError="justifi.googlePay.paymentError"}(st||(st={}));const nt=class{constructor(i){t(this,i),this.googlePayStarted=e(this,"googlePayStarted",7),this.googlePayCompleted=e(this,"googlePayCompleted",7),this.googlePayCancelled=e(this,"googlePayCancelled",7),this.merchantDisplayName="JustiFi Checkout",this.iframeReady=!1,this.sdkLoaded=!1,this.isReadyToPay=!1,this.handleMessage=t=>{if(t.origin!==this.iframeOrigin)return;const{eventType:e,data:i}=t.data||{};switch(e){case st.ready:this.iframeReady=!0;break;case st.sdkLoaded:this.sdkLoaded=!0,this.sendInitialize();break;case st.initializeResult:this.isReadyToPay=i.isReadyToPay,i.error&&console.error("Init error:",i.error);break;case st.error:console.error("Google Pay error:",i);break;case st.buttonClicked:this.googlePayStarted.emit(),this.sendStartPayment();break;case st.paymentSuccess:this.googlePayCompleted.emit({success:!0,paymentMethodId:i.paymentMethodId,cardNetwork:i.cardNetwork,cardDetails:i.cardDetails});break;case st.paymentCanceled:this.googlePayCancelled.emit();break;case st.paymentError:this.googlePayCompleted.emit({success:!1,error:{code:i.code,message:i.message}})}}}async componentWillLoad(){await E(),this.iframeOrigin=D.iframeOrigin}componentDidLoad(){window.addEventListener("message",this.handleMessage)}disconnectedCallback(){window.removeEventListener("message",this.handleMessage)}googlePayEnvironment(){return void 0!==this.environment?this.environment:"test"===w.checkoutMode?"TEST":"PRODUCTION"}sendInitialize(){var t;if(!(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow))return;const e={environment:this.googlePayEnvironment(),gatewayMerchantId:w.accountId,merchantName:this.merchantDisplayName,authToken:w.authToken,accountId:w.accountId};this.iframeElement.contentWindow.postMessage({eventType:st.initialize,data:e},this.iframeOrigin)}sendStartPayment(){var t;if(!(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow))return;const e={totalPrice:String(w.paymentAmount/100),totalPriceStatus:"FINAL",currencyCode:w.paymentCurrency||"USD"};this.iframeElement.contentWindow.postMessage({eventType:st.startPayment,data:e},this.iframeOrigin)}render(){return w.checkoutLoaded?w.googlePayEnabled?i(s,null,i(it,{isLoading:!this.isReadyToPay}),i("iframe",{ref:t=>this.iframeElement=t,src:`${this.iframeOrigin}/v2/googlePay`,allow:"payment",style:{border:"none",width:"100%",height:"48px",display:this.isReadyToPay?"block":"none"}})):(console.warn("Google Pay is not enabled for this checkout"),null):null}},at=class{constructor(e){t(this,e),this.levels={h1:O,h2:S,h3:_},this.level="h1"}render(){return i(M,{key:"5a0872ee486bdba3ba1c86145946889bb7d151f2"},i(this.levels[this.level],{key:"89807e249cdf64f7ef80800276cb50966083f28e",text:this.text,class:this.class}))}},ot=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event",7),this.submitEvent=e(this,"submit-event",7),this.checkoutChangedEvent=e(this,"checkout-changed",7),this.plaidService=new V,this.handleApplePayStarted=()=>{w.isWalletProcessing=!0},this.handleGooglePayStarted=()=>{w.isWalletProcessing=!0},this.handleGooglePayCompleted=t=>{const{success:e,paymentMethodId:i,error:s}=t.detail||{};e&&i?(w.isWalletProcessing=!1,w.paymentToken=i,w.selectedPaymentMethod={type:Q.GOOGLE_PAY},this.submitCheckout()):(w.isWalletProcessing=!1,this.errorEvent.emit({message:s&&s.message||"Google Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR}))},this.handleGooglePayCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0},this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:n}=t.detail;e&&i?(w.isWalletProcessing=!1,w.paymentToken=s,w.selectedPaymentMethod={type:Q.APPLE_PAY},this.submitCheckout()):(w.isWalletProcessing=!1,console.error("Apple Pay completed but failed:",n),this.errorEvent.emit({message:(null==n?void 0:n.message)||"Apple Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR}))},this.handleApplePayError=t=>{w.isWalletProcessing=!1;const{error:e,code:i}=t.detail;console.error("Apple Pay error:",e),this.errorEvent.emit({message:e||"Apple Pay error occurred",errorCode:`APPLE_PAY_${i}`,severity:p.ERROR})},this.handleApplePayCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0}}connectedCallback(){this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),w.checkoutId=this.checkoutId;const t={authToken:this.authToken,checkoutId:this.checkoutId,service:new F};this.getCheckout=B(t),this.completeCheckout=Y(t),P((()=>{this.emitCheckoutChanged()}))}componentWillLoad(){this.analytics=new R(this),U(),w.authToken=this.authToken,this.fetchCheckout(),L("set",(t=>{const e=z[t];void 0!==e&&x(t,e)&&this.fetchCheckout()}))}componentDidLoad(){this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners()}disconnectedCallback(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this.removeApplePayListeners(),this.removeGooglePayListeners()}fetchCheckout(){this.authToken&&this.checkoutId?this.getCheckout&&this.getCheckout({onSuccess:({checkout:t})=>{this.updateStore(t),t.status!==v.completed?t.status!==v.expired||this.errorEvent.emit({message:m.CHECKOUT_EXPIRED,errorCode:y.CHECKOUT_EXPIRED,severity:p.ERROR}):this.errorEvent.emit({message:m.CHECKOUT_ALREADY_COMPLETED,errorCode:y.CHECKOUT_ALREADY_COMPLETED,severity:p.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:t.code,severity:t.severity})}}):this.errorEvent.emit({message:m.NOT_AUTHENTICATED,errorCode:y.NOT_AUTHENTICATED,severity:p.ERROR})}updateStore(t){var e,i,s,n,a,o,r,l;w.accountId=t.account_id,w.checkoutLoaded=!0;const h=null!=t.mode?String(t.mode).toLowerCase():"";w.checkoutMode="test"===h?"test":"live"===h?"live":null;const c=t.payment_methods.map((t=>new H(t))),d=Boolean(null===(e=t.payment_settings)||void 0===e?void 0:e.ach_payments);w.paymentMethods=c.filter((t=>t.type!==Q.SAVED_BANK_ACCOUNT||d)),w.paymentMethodGroupId=t.payment_method_group_id,w.paymentDescription=t.payment_description,w.totalAmount=t.total_amount,w.paymentAmount=t.payment_amount,w.bnplEnabled=t.payment_settings.bnpl_payments,w.insuranceEnabled=t.payment_settings.insurance_payments,w.bankAccountVerification=null===(i=t.payment_settings)||void 0===i?void 0:i.bank_account_verification,w.applePayEnabled=null===(s=t.payment_settings)||void 0===s?void 0:s.apple_payments,w.googlePayEnabled=null===(n=t.payment_settings)||void 0===n?void 0:n.google_payments,w.achPaymentsEnabled=d,w.bnplProviderClientId=null===(a=null==t?void 0:t.bnpl)||void 0===a?void 0:a.provider_client_id,w.bnplProviderMode=null===(o=null==t?void 0:t.bnpl)||void 0===o?void 0:o.provider_mode,w.bnplProviderApiVersion=null===(r=null==t?void 0:t.bnpl)||void 0===r?void 0:r.provider_api_version,w.bnplProviderCheckoutUrl=null===(l=null==t?void 0:t.bnpl)||void 0===l?void 0:l.provider_checkout_url}emitCheckoutChanged(){const t={availablePaymentMethodTypes:T(),selectedPaymentMethod:w.selectedPaymentMethod,savedPaymentMethods:w.paymentMethods};this.checkoutChangedEvent.emit(t)}queryFormRefs(){if(this.billingFormRef=this.hostEl.querySelector("justifi-billing-form, justifi-bank-account-billing-form-simple, justifi-card-billing-form-simple, justifi-billing-form-full, justifi-tokenize-payment-method"),this.applePayRef=this.hostEl.querySelector("justifi-apple-pay"),this.googlePayRef=this.hostEl.querySelector("justifi-google-pay"),this.paymentMethodFormRef=this.hostEl.querySelector("justifi-card-form, justifi-bank-account-form, justifi-tokenize-payment-method"),!w.selectedPaymentMethod&&this.paymentMethodFormRef){const t=this.paymentMethodFormRef.tagName.toLowerCase();"justifi-card-form"===t?w.selectedPaymentMethod={type:Q.NEW_CARD}:"justifi-bank-account-form"!==t||w.checkoutLoaded&&!w.achPaymentsEnabled||(w.selectedPaymentMethod={type:Q.NEW_BANK_ACCOUNT})}this.insuranceFormRef=this.hostEl.querySelector("justifi-season-interruption-insurance")}setupApplePayListeners(){this.applePayRef&&(this.applePayRef.addEventListener("applePayStarted",this.handleApplePayStarted),this.applePayRef.addEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.addEventListener("applePayError",this.handleApplePayError),this.applePayRef.addEventListener("applePayCancelled",this.handleApplePayCancelled))}removeApplePayListeners(){this.applePayRef&&(this.applePayRef.removeEventListener("applePayStarted",this.handleApplePayStarted),this.applePayRef.removeEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.removeEventListener("applePayError",this.handleApplePayError),this.applePayRef.removeEventListener("applePayCancelled",this.handleApplePayCancelled))}setupGooglePayListeners(){this.googlePayRef&&(this.googlePayRef.addEventListener("googlePayStarted",this.handleGooglePayStarted),this.googlePayRef.addEventListener("googlePayCompleted",this.handleGooglePayCompleted),this.googlePayRef.addEventListener("googlePayCancelled",this.handleGooglePayCancelled))}removeGooglePayListeners(){this.googlePayRef&&(this.googlePayRef.removeEventListener("googlePayStarted",this.handleGooglePayStarted),this.googlePayRef.removeEventListener("googlePayCompleted",this.handleGooglePayCompleted),this.googlePayRef.removeEventListener("googlePayCancelled",this.handleGooglePayCancelled))}async tokenizePaymentMethod(t){var e,i,s;const n=null!==(i=await(null===(e=this.billingFormRef)||void 0===e?void 0:e.getValues()))&&void 0!==i?i:{},a=Object.assign(Object.assign({},t),n),o=Object.assign({accountId:w.accountId,payment_method_group_id:void 0},a);w.savePaymentMethod&&(o.payment_method_group_id=w.paymentMethodGroupId);const r=await(null===(s=this.paymentMethodFormRef)||void 0===s?void 0:s.tokenize({clientId:this.authToken,paymentMethodMetadata:o,account:w.accountId}));return r.error?r:(w.paymentToken=r.id,r.id)}async fillBillingForm(t){w.billingFormFields=t}async setSelectedPaymentMethod(t){w.selectedPaymentMethod=t,w.paymentToken=t.id||void 0}async validate(){var t,e;const i=[];w.insuranceEnabled&&this.insuranceFormRef&&i.push(this.insuranceFormRef.validate());const s=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===Q.NEW_CARD,n=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===Q.NEW_BANK_ACCOUNT;if((s||n)&&(this.paymentMethodFormRef&&i.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&i.push(this.billingFormRef.validate())),0===i.length)return!0;try{return!!(await Promise.all(i)).every((t=>"boolean"==typeof t?t:!1!==(null==t?void 0:t.isValid)))||(this.errorEvent.emit({message:"Validation error",errorCode:y.VALIDATION_ERROR,severity:p.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){var e,i,s,n,a;if(w.isSubmitting)return;w.isSubmitting=!0;const o=await this.validate();if(!w.selectedPaymentMethod)return w.isSubmitting=!1,void this.errorEvent.emit({message:"No payment method selected.",errorCode:y.VALIDATION_ERROR,severity:p.ERROR});const r=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===Q.NEW_CARD,l=(null===(i=w.selectedPaymentMethod)||void 0===i?void 0:i.type)===Q.NEW_BANK_ACCOUNT,h=(null===(s=w.selectedPaymentMethod)||void 0===s?void 0:s.type)===Q.PLAID;if(r||l){const e=await this.tokenizePaymentMethod(t);if(null==e?void 0:e.error)return w.isSubmitting=!1,void this.errorEvent.emit({message:e.error.message,errorCode:y.TOKENIZE_ERROR,severity:p.ERROR})}if(h&&!w.paymentToken){const t=w.plaidPublicToken,e=w.plaidLinkTokenId;if(!t)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Missing Plaid public token. Please connect your bank.",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR});try{const i=await this.plaidService.tokenizeBankAccount(w.authToken,w.accountId,t,e||void 0,w.savePaymentMethod?w.paymentMethodGroupId:void 0);if(null==i?void 0:i.error)return w.isSubmitting=!1,void this.errorEvent.emit({message:"string"==typeof i.error?i.error:i.error.message||"Failed to tokenize bank account",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR});const s=null==i?void 0:i.data,a=(null===(n=null==s?void 0:s.bank_account)||void 0===n?void 0:n.token)||(null==s?void 0:s.token)||(null==s?void 0:s.id);w.paymentToken=a}catch(t){return w.isSubmitting=!1,void this.errorEvent.emit({message:(null==t?void 0:t.message)||"Plaid exchange error",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR})}}if(!o)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:y.VALIDATION_ERROR,severity:p.ERROR});if(!w.paymentToken)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Payment token not found.",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR});const c={payment_mode:(t=>{switch(t){case Q.NEW_CARD:case Q.SAVED_CARD:case Q.NEW_BANK_ACCOUNT:case Q.SAVED_BANK_ACCOUNT:case Q.PLAID:return G.ECOM;case Q.SEZZLE:return G.BNPL;case Q.APPLE_PAY:return G.APPLE_PAY;case Q.GOOGLE_PAY:return G.GOOGLE_PAY;default:return}})(null===(a=w.selectedPaymentMethod)||void 0===a?void 0:a.type),payment_token:w.paymentToken};if(this.preCompleteHook){const t=A();try{await new Promise(((e,i)=>{this.preCompleteHook(t,(()=>e()),(()=>i()))}))}catch(t){return w.isSubmitting=!1,void console.log("Checkout cancelled by preCompleteHook",t)}}this.completeCheckout({payment:c,onSuccess:({checkout:t})=>{w.isSubmitting=!1,this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{w.isSubmitting=!1,this.errorEvent.emit({message:t.message,errorCode:y.COMPLETE_CHECKOUT_ERROR,severity:p.ERROR})}})}render(){return i(s,{key:"545e1cb07252ba0dc78fa980bd17ee5572559f6c"})}get hostEl(){return n(this)}},rt=class{constructor(i){t(this,i),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.plaidError=e(this,"plaidError",7),this.plaidErrorRecovered=e(this,"plaidErrorRecovered",7),this.isAuthenticating=!1,this.publicToken=null,this.linkToken=null,this.linkTokenId=null,this.error=null,this.plaidLink=null,this.isSelected=!1,this.retryCount=0,this.isRetrying=!1,this.sdkLoaded=!1,this.plaidService=new V,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.hasLoggedAchPaymentsDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{w.authToken&&w.accountId&&w.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:b.PLAID_SDK_LOAD_FAILED,message:f[b.PLAID_SDK_LOAD_FAILED],severity:g[b.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:b.PLAID_LINK_TOKEN_FAILED,message:f[b.PLAID_LINK_TOKEN_FAILED],severity:g[b.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:b.PLAID_LINK_INIT_FAILED,message:f[b.PLAID_LINK_INIT_FAILED],severity:g[b.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,s,n;try{if(!w.authToken||!w.accountId)return void this.handleError({code:b.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:p.ERROR,retryable:!1,userAction:"Refresh the page"});this.abortController=new AbortController,this.timeoutId=setTimeout((()=>{var t;null===(t=this.abortController)||void 0===t||t.abort()}),3e4);const e=await this.plaidService.getLinkToken(w.authToken,w.accountId,w.checkoutId,this.abortController.signal);if(this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),e.error)throw new Error("string"==typeof e.error?e.error:e.error.message||"Failed to get link token");this.linkToken=e.data.link_token,this.linkTokenId=(null==e?void 0:e.id)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||null,this.linkTokenId&&(w.plaidLinkTokenId=this.linkTokenId)}catch(t){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let a=b.PLAID_LINK_TOKEN_FAILED,o=f[a],r=!0;"AbortError"===t.name?(a=b.PLAID_TIMEOUT,o=f[a],r=!0):(null===(e=t.message)||void 0===e?void 0:e.includes("network"))||(null===(i=t.message)||void 0===i?void 0:i.includes("fetch"))?(a=b.PLAID_NETWORK_ERROR,o=f[a],r=!0):((null===(s=t.message)||void 0===s?void 0:s.includes("401"))||(null===(n=t.message)||void 0===n?void 0:n.includes("unauthorized")))&&(a=b.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:a,message:o,severity:g[a],originalError:t,retryable:r,userAction:r?"Click to try again":"Refresh the page"})}},this.mapApiErrorToPlaidError=t=>{if("string"==typeof t){if(t.includes("rate_limit"))return b.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return b.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return b.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return b.PLAID_RATE_LIMITED;case"maintenance":return b.PLAID_MAINTENANCE;case"not_authenticated":return b.PLAID_INVALID_CREDENTIALS;default:return b.PLAID_LINK_TOKEN_FAILED}return b.PLAID_LINK_TOKEN_FAILED},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=t=>{this.publicToken=t,this.isAuthenticating=!1,this.clearError(),this.retryCount=0,this.isSelected||(this.isSelected=!0,w.selectedPaymentMethod={type:Q.PLAID}),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:p.INFO}),w.plaidPublicToken=t},this.handlePlaidExit=t=>{this.isAuthenticating=!1,t&&this.handlePlaidError(t)},this.handlePlaidEvent=(t,e)=>{switch(t){case"OPEN":this.isAuthenticating=!0;break;case"CLOSE":this.isAuthenticating=!1;break;case"ERROR":this.handlePlaidError(e)}},this.handlePlaidLoad=()=>{},this.handlePlaidError=t=>{let e=b.PLAID_AUTHENTICATION_FAILED,i=f[e],s=!0,n="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=b.PLAID_INVALID_CREDENTIALS,i=f[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=b.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=b.PLAID_ACCOUNT_LOCKED,i=f[e],s=!1,n="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=b.PLAID_MAINTENANCE,i=f[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=b.PLAID_RATE_LIMITED,i=f[e],s=!0;break;case"INVALID_REQUEST":e=b.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=b.PLAID_AUTHENTICATION_FAILED,i=t.error_message||"Bank authentication failed. Please try again.",s=!0;break;default:t.error_message&&(i=t.error_message)}if(t.error_message){const a=t.error_message.toLowerCase();a.includes("not supported")||a.includes("unsupported")?(e=b.PLAID_BANK_NOT_SUPPORTED,i=f[e],s=!1,n="Try a different payment method"):(a.includes("expired")||a.includes("timeout"))&&(e=b.PLAID_TOKEN_EXPIRED,i=f[e],s=!0)}this.handleError({code:e,message:i,severity:g[e],originalError:t,retryable:s,userAction:n}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.plaidError.emit({code:t.code,message:t.message,severity:t.severity,data:{originalError:t.originalError,retryable:t.retryable,userAction:t.userAction,retryCount:this.retryCount}}),console.error("Plaid error:",t),t.retryable&&this.retryCount<this.maxRetries&&this.scheduleRetry()},this.scheduleRetry=()=>{this.isRetrying||(this.isRetrying=!0,this.retryCount++,setTimeout((()=>{this.isRetrying=!1,this.clearError(),this.waitForStoreAndInitialize()}),this.retryDelay*this.retryCount))},this.clearError=()=>{this.error&&(this.error=null,this.retryCount=0)},this.syncWithStore=()=>{var t;const e=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===Q.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)!==Q.PLAID&&(w.selectedPaymentMethod={type:Q.PLAID}),!t||!this.plaidLink||this.publicToken||this.isAuthenticating||this.error||this.openPlaidLink()}componentWillLoad(){var t;this.isSelected=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===Q.PLAID,!0===w.bankAccountVerification&&(w.checkoutLoaded?w.achPaymentsEnabled&&this.loadPlaidSDK():j("checkoutLoaded",(t=>{t&&!0===w.bankAccountVerification&&w.achPaymentsEnabled&&this.loadPlaidSDK()})))}loadPlaidSDK(){if(this.sdkLoaded)return;this.sdkLoaded=!0;const t=document.createElement("script");t.src="https://cdn.plaid.com/link/v2/stable/link-initialize.js",t.async=!0,t.onload=()=>this.initializePlaidLink(),t.onerror=()=>{this.handleError({code:b.PLAID_SDK_LOAD_FAILED,message:f[b.PLAID_SDK_LOAD_FAILED],severity:g[b.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})},document.head.appendChild(t)}async resolvePaymentMethod(){return this.publicToken?{token:this.publicToken,data:{type:"bank_account",plaid_public_token:this.publicToken}}:{validationError:!0}}async getPaymentToken(){return w.paymentToken}async handleSelectionClick(){if(this.isSelected=!0,w.selectedPaymentMethod={type:Q.PLAID},this.error)return this.clearError(),void this.waitForStoreAndInitialize();!this.plaidLink||this.publicToken||this.isAuthenticating||this.openPlaidLink()}async setSelected(t){this.isSelected=t,t&&(w.selectedPaymentMethod={type:Q.PLAID})}async isCurrentlySelected(){return this.isSelected}async deselect(){this.isSelected=!1}async reset(){this.publicToken=null,this.clearError(),this.isAuthenticating=!1,this.linkToken=null,this.plaidLink=null,this.retryCount=0,this.isRetrying=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.abortController&&(this.abortController.abort(),this.abortController=null)}async isReadyForAuthentication(){return!(!this.plaidLink||!this.linkToken||this.isAuthenticating)}async retry(){this.error&&this.error.retryable&&(this.clearError(),this.waitForStoreAndInitialize())}async getErrorInfo(){return this.error}componentDidLoad(){const t=j("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(w.checkoutLoaded&&!w.achPaymentsEnabled)return this.hasLoggedAchPaymentsDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] ACH payments are disabled for this checkout. Component will not render."),this.hasLoggedAchPaymentsDisabledWarning=!0),null;if(!0!==w.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const t=i("img",{class:"plaid-logo-img",src:"data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgMjggMjkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgY2xhc3M9ImNzcy0xcmRhajhtIj48ZyBmaWxsPSIjMTExIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yNS43NjI5IDI2LjI2MjhMMjggMTcuNTMwOUwyNC45NjkxIDE0LjUwMDFMMjcuOTk5OSAxMS40NjkxTDI1Ljc2MjggMi43MzcwNkwxNy4wMzA5IDAuNUwxNC4wMDAxIDMuNTMxTDEwLjk2OSAwLjUwMDE0TDIuMjM3MDYgMi43MzczNEwwIDExLjQ2OTFMMy4wMzEyOCAxNC40OTk5TDAuMDAwMTQgMTcuNTMxTDIuMjM3MiAyNi4yNjI5TDEwLjk2OTEgMjguNUwxNC4wMDAxIDI1LjQ2OUwxNy4wMzEgMjguNDk5OUwyNS43NjI5IDI2LjI2MjhaTTE1LjczMjEgMjMuNzM3MUwxOC42MTg2IDIwLjg1MDVMMjIuMjkxMiAyNC41MjMzTDE3LjY5NTYgMjUuNzAwN0wxNS43MzIxIDIzLjczNzFaTTExLjExMzYgOS44ODE1NEwxNC4wMDAzIDYuOTk1MDJMMTYuODg2OCA5Ljg4MTRMMTQuMDAwMSAxMi43Njc5TDExLjExMzYgOS44ODE1NFpNMTIuMjY4MiAxNC41TDkuMzgxNTQgMTcuMzg2NUw2LjQ5NTAyIDE0LjVMOS4zODE1NCAxMS42MTM1TDEyLjI2ODIgMTQuNVpNMTguNjE4NyAxMS42MTMzTDIxLjUwNTMgMTQuNUwxOC42MTg2IDE3LjM4NjVMMTUuNzMyMSAxNC41TDE4LjYxODcgMTEuNjEzM1pNMTYuODg2NyAxOS4xMTg2TDE0LjAwMDEgMjIuMDA1MUwxMS4xMTM1IDE5LjExODVMMTQuMDAwMSAxNi4yMzE5TDE2Ljg4NjcgMTkuMTE4NlpNMTAuMzA0NCAyNS43MDA3TDUuNzA4NjQgMjQuNTIzM0w5LjM4MTU0IDIwLjg1MDRMMTIuMjY4MiAyMy43MzcxTDEwLjMwNDQgMjUuNzAwN1pNNC43NjMwOCAxNi4yMzE5TDcuNjQ5NiAxOS4xMTg1TDMuOTc2NyAyMi43OTE0TDIuNzk5MyAxOC4xOTU3TDQuNzYzMDggMTYuMjMxOVpNMy45NzY3IDYuMjA4MzZMNy42NDk3NCA5Ljg4MTRMNC43NjMwOCAxMi43NjgxTDIuNzk5MyAxMC44MDQxTDMuOTc2NyA2LjIwODM2Wk0xMi4yNjgzIDUuMjYyOTRMOS4zODE2OCA4LjE0OTZMNS43MDg5MiA0LjQ3NjdMMTAuMzA0NyAzLjI5OTNMMTIuMjY4MyA1LjI2Mjk0Wk0xNy42OTU5IDMuMjk5M0wyMi4yOTE1IDQuNDc2N0wxOC42MTg2IDguMTQ5NDZMMTUuNzMyMSA1LjI2Mjk0TDE3LjY5NTkgMy4yOTkzWk0yMy4yMzcyIDEyLjc2ODFMMjAuMzUwNSA5Ljg4MTRMMjQuMDIzMyA2LjIwODc4TDI1LjIwMDcgMTAuODA0NkwyMy4yMzcyIDEyLjc2ODFaTTI0LjAyMzMgMjIuNzkxNEwyMC4zNTA1IDE5LjExODZMMjMuMjM3MiAxNi4yMzIxTDI1LjIwMDcgMTguMTk1N0wyNC4wMjMzIDIyLjc5MTRaIj48L3BhdGg+PC9nPjwvc3ZnPgo=",alt:"Plaid",title:"Plaid",style:{display:"inline",width:"20px",height:"20px",marginLeft:"5px",marginTop:"-2px"}});return i(M,{class:"payment-method"},i("div",{title:"Pay with Plaid"},i("div",{onClick:t=>{t.preventDefault(),this.handleSelectionClick()}},"Pay with Bank Account ",t," "),(()=>this.error?i("div",{class:(this.error.severity===p.ERROR?"text-danger":this.error.severity===p.WARNING?"text-warning":"text-info")+" mt-2"},i("small",null,this.error.message),i("br",null),i("small",{class:"text-muted"},this.error.userAction,this.error.retryable&&this.retryCount<this.maxRetries&&i("span",null," • Auto-retry in progress..."))):null)(),(()=>this.error?null:this.isAuthenticating?i("div",{class:"text-info mt-2"},i("small",null,"Connecting to your bank...")):this.publicToken?i("div",{class:"text-success mt-2"},i("small",null,"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:i("div",{class:"text-muted mt-2"},i("small",null,"Click to connect your bank account")))()))}static get watchers(){return{isSelected:["onSelectionChange"]}}},lt=class{constructor(e){t(this,e),this.onPaymentMethodOptionClick=t=>e=>{e.preventDefault(),w.selectedPaymentMethod={id:t.id,type:t.type},w.paymentToken=t.id},this.isAllowedPaymentMethod=t=>!(t===Q.SAVED_CARD&&w.disableCreditCard||t===Q.SAVED_BANK_ACCOUNT&&w.disableBankAccount)}componentWillLoad(){w.checkoutLoaded&&(w.paymentMethods.length||console.warn("No saved payment methods available."),w.disablePaymentMethodGroup&&console.warn("Payment method group is disabled."))}render(){return w.disablePaymentMethodGroup?null:i(M,null,i("div",{class:"saved-payment-methods"},w.paymentMethods.length?w.paymentMethods.filter((t=>this.isAllowedPaymentMethod(t.type))).map((t=>i("div",{class:"radio-list-item p-3",part:N,onClick:this.onPaymentMethodOptionClick(t)},i("form-control-radio",{name:"paymentMethodType",value:null==t?void 0:t.id,checked:w.paymentToken===(null==t?void 0:t.id),label:`${W[null==t?void 0:t.brand]||""} *${null==t?void 0:t.acct_last_four}`})))):null))}},ht=i("img",{class:"sezzle-smart-button-logo-img",src:"https://media.sezzle.com/branding/2.0/Sezzle_Logo_FullColor.svg",alt:"Sezzle",style:{display:"inline",width:"80px",marginLeft:"5px",marginTop:"-5px"}}),ct=class{constructor(i){t(this,i),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.paymentMethodOptionId=Q.SEZZLE,this.initializeSezzleCheckout=()=>{let t;this.sezzlePromise=new Promise((e=>{t=e}));const e=Number(w.paymentAmount),i=new(0,window.Checkout)({mode:"popup",publicKey:w.bnplProviderClientId,apiMode:w.bnplProviderMode,apiVersion:w.bnplProviderApiVersion});i.sezzleButtonElement=this.sezzleButtonRef,i.init({onClick:function(t){t.preventDefault(),i.startCheckout({checkout_url:w.bnplProviderCheckoutUrl})},onComplete:e=>t({bnpl:e.data}),onCancel:e=>t({bnpl:e.data}),onFailure:e=>t({bnpl:e.data})}),this.sezzleCheckout=i,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(e)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()})}async resolvePaymentMethod(t){return t.isValid?(this.sezzleButtonRef.click(),this.sezzlePromise):{validationError:!0}}async handleSelectionClick(){w.selectedPaymentMethod={type:Q.SEZZLE},this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)}render(){var t,e;return w.bnplEnabled?i(M,{class:"payment-method"},i("script",{src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),i("div",null,i("div",null,"Buy now, pay later with ",ht),this.installmentPlan&&i("small",null,i("span",null,null===(t=this.installmentPlan)||void 0===t?void 0:t.installments.length)," ",i("span",null,this.installmentPlan.schedule," payments of")," ",i("span",{class:"fw-bold"},I(null===(e=this.installmentPlan)||void 0===e?void 0:e.installments[0].amountInCents))))):(console.warn("justifi-sezzle-payment-method: BNPL is not enabled for this account."),null)}},dt={[Q.NEW_BANK_ACCOUNT]:"New bank account",[Q.NEW_CARD]:"New credit or debit card"},ut="Payment form not ready",pt="Validation error",yt=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event",7),this.submitEvent=e(this,"submit-event",7),this.computedHideSubmitButton=!1,this.isLoading=!1,this.submitButtonText="Submit"}paymentMethodsChanged(){this.setDefaultSelectedPaymentMethod()}connectedCallback(){this.setDefaultSelectedPaymentMethod(),this.setComputedHideSubmitButton()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup(),this.unsubscribeFromStore&&this.unsubscribeFromStore()}componentWillLoad(){U(),this.analytics=new R(this)}handleRadioClick(t){this.selectedPaymentMethod=t.detail,w.selectedPaymentMethod={type:t.detail}}async tokenizePaymentMethod(t){null==t||t.preventDefault(),this.validateRequiredProps(),this.isLoading=!0;try{if(!(await this.validate()).isValid)return this.errorEvent.emit({errorCode:y.TOKENIZE_ERROR,message:pt}),void(this.isLoading=!1);const t=await this.resolvePaymentMethod({isValid:!0});return t.error&&this.emitError({errorCode:t.error.code,message:t.error.message}),this.submitEvent.emit({response:t}),t}catch(t){const e=this.createErrorResponse(y.TOKENIZE_ERROR,t.message);return this.emitError({errorCode:y.TOKENIZE_ERROR,message:t.message}),this.submitEvent.emit({response:e}),e}finally{this.isLoading=!1}}async fillBillingForm(t){w.billingFormFields=t}async validate(){if(!this.areFormsReady())return{isValid:!1,errors:{general:ut}};const[t,e]=await Promise.all([this.billingFormRef.validate(),this.paymentMethodFormRef.validate()]);return{isValid:t.isValid&&e.isValid,errors:Object.assign(Object.assign({},t.errors),e.errors)}}async getValues(){return this.billingFormRef.getValues()}async tokenize(){try{const t=await this.billingFormRef.getValues(),e={clientId:this.authToken||w.authToken,account:this.accountId||w.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||w.authToken||this.emitError({errorCode:y.TOKENIZE_ERROR,message:"Auth token is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"}),this.accountId||w.accountId||this.emitError({errorCode:y.TOKENIZE_ERROR,message:"Account ID is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"})}setDefaultSelectedPaymentMethod(){this.selectedPaymentMethod||(this.disableCreditCard?this.disableBankAccount||w.checkoutLoaded&&!w.achPaymentsEnabled||(this.selectedPaymentMethod=Q.NEW_BANK_ACCOUNT,w.selectedPaymentMethod={type:Q.NEW_BANK_ACCOUNT}):(this.selectedPaymentMethod=Q.NEW_CARD,w.selectedPaymentMethod={type:Q.NEW_CARD}))}setComputedHideSubmitButton(){if(void 0!==this.hideSubmitButton)return void(this.computedHideSubmitButton=this.hideSubmitButton);const t=this.isSlottedWithinModularCheckout();this.computedHideSubmitButton=t}isSlottedWithinModularCheckout(){var t;let e=null===(t=this.host)||void 0===t?void 0:t.parentElement;for(;e;){if("JUSTIFI-MODULAR-CHECKOUT"===e.tagName)return!0;e=e.parentElement}return!1}get availablePaymentMethods(){const t=[],e=!w.checkoutLoaded||w.achPaymentsEnabled;return this.disableCreditCard||t.push(Q.NEW_CARD),!this.disableBankAccount&&e&&t.push(Q.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:p.ERROR}))}createErrorResponse(t,e){return{error:{code:t,message:e,decline_code:void 0}}}async resolvePaymentMethod(t){if(!this.areFormsReady())return this.createErrorResponse("form_not_ready",ut);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||pt;return{validationError:!0,error:{code:"validation_error",message:String(t),decline_code:void 0}}}return await this.performTokenization()}catch(t){return{error:t}}}async performTokenization(){var t,e;const i=await this.tokenize();if(i.error)return{error:i.error};const s=i.data;return{token:(null===(t=s.card)||void 0===t?void 0:t.token)||(null===(e=s.bank_account)||void 0===e?void 0:e.token),data:s}}buildPaymentMethodMetadata(t){return this.shouldSavePaymentMethod?Object.assign(Object.assign({},t),{payment_method_group_id:this.paymentMethodGroupID}):Object.assign({},t)}get paymentMethodGroupID(){return this.paymentMethodGroupId||w.paymentMethodGroupId}get shouldSavePaymentMethod(){return!(!this.paymentMethodGroupId&&!w.savePaymentMethod)}get shouldHideRadioInput(){return this.disableCreditCard||this.disableBankAccount}renderPaymentMethodOption(t){const e=this.selectedPaymentMethod===t&&void 0===w.selectedPaymentMethod.id;return i("div",{class:"payment-method"},i("radio-list-item",{name:"paymentMethodType",value:t,checked:e,label:dt[t],hidden:this.shouldHideRadioInput}),e&&this.renderSelectedPaymentMethodForm(t))}renderSelectedPaymentMethodForm(t){return i("div",{class:"mt-4 pb-4"},this.renderPaymentMethodForm(t),i("div",{class:"mt-4"},i("billing-form",{ref:t=>{t&&(this.billingFormRef=t)},hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:t})),i("div",{class:"mt-4"},i("save-new-payment-method",{hidden:!this.paymentMethodGroupID,label:this.savePaymentMethodLabel})))}renderPaymentMethodForm(t){return i(t===Q.NEW_CARD?"card-form":"bank-account-form",{ref:t=>{t&&(this.paymentMethodFormRef=t)}})}render(){return i(M,{key:"bc76697688be332ef84db56e61b6b455a6d1e986"},i("form",{key:"8f64f55f945d4ff4ed0f144c724dbd71278ec771"},i("fieldset",{key:"15b6d388117738391089cf91f999247cddb29714"},i("div",{key:"a4e23f7808b446dff6f7da437dba3cb57d2d62aa",class:"row gy-3"},i("div",{key:"63b0584d217d9bb50036eb7d5837e7287be58760",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),i("div",{key:"c9345be3429cd8ab01a84e8584270938feceba39",class:"col-12"},i("internal-button",{key:"aa56df7b6b1250e9b81fbc281b969d2a37a05428",text:this.submitButtonText,variant:"primary",type:"submit",clickHandler:t=>this.tokenizePaymentMethod(t),isLoading:this.isLoading,"data-testid":"submit-button",hidden:this.computedHideSubmitButton}))))))}get host(){return n(this)}static get watchers(){return{disableCreditCard:["paymentMethodsChanged"],disableBankAccount:["paymentMethodsChanged"]}}};export{$ as justifi_apple_pay,tt as justifi_button,et as justifi_checkout_summary,nt as justifi_google_pay,at as justifi_header,ot as justifi_modular_checkout,rt as justifi_plaid_payment_method,J as justifi_radio_list_item,lt as justifi_saved_payment_methods,ct as justifi_sezzle_payment_method,yt as justifi_tokenize_payment_method}
|
|
1
|
+
import{r as t,c as e,h as i,H as s,g as n}from"./p-CV0Pyo1O.js";import{A as a}from"./p-CP0Y19co.js";import{A as o,r,s as l,t as h,u as c,v as d,w as u,C as p,b as y,c as m,I as v,x as g,y as f,z as b}from"./p-Cl5FLD11.js";import{S as M}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as k}from"./p-uZ5KAseb.js";import{c as w,o as j,a as P,g as T,b as A}from"./p-DyPk4BJt.js";import{t as C,r as N}from"./p-CPKMvyV_.js";import{f as I}from"./p-BM88Upl5.js";import{w as E,c as D}from"./p-DVJaoI_m.js";import{H as S}from"./p-jIDKmNHy.js";import{H as O,b as L,h as x,i as z}from"./p-C-Jgmek8.js";import{H as _}from"./p-DYHjzFnJ.js";import{J as R}from"./p-Bo36V7ni.js";import{c as U}from"./p-CxNdigHC.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{m as B,a as F}from"./p-rhS9V7qg.js";import{C as Y}from"./p-ph646MSj.js";import{P as V}from"./p-BaZTheg9.js";import{P as H,a as Q,b as Z}from"./p-DkoufM1t.js";import{C as G}from"./p-ZpPDShvP.js";import"./p-D8GTwl9v.js";import"./p-BP7jEC_K.js";import"./p-IFhZFB4v.js";const W=class{constructor(i){t(this,i),this.radioClick=e(this,"radio-click",7),this.checked=!1,this.hidden=!1}render(){return i(M,{key:"02955940079320bd9c6bf94e239545385ac36458"},i("radio-list-item",{key:"fc6b98e456e4326b843b2b3248b7327436767cf4",name:this.name,value:this.value,label:this.label,checked:this.checked,hidden:this.hidden,class:this.class,"onRadio-click":t=>this.radioClick.emit(t.detail)}))}};var q;!function(t){t.UNAVAILABLE="UNAVAILABLE",t.SESSION_ERROR="SESSION_ERROR",t.MERCHANT_VALIDATION_ERROR="MERCHANT_VALIDATION_ERROR",t.PAYMENT_PROCESSING_ERROR="PAYMENT_PROCESSING_ERROR",t.USER_CANCELLED="USER_CANCELLED"}(q||(q={}));class J{constructor(){this.api=a()}initialize(t){if(this.applePayConfig=new o(t),!this.applePayConfig.isValid)throw new Error("Invalid Apple Pay configuration provided")}async validateMerchant(t,e){try{return await this.api.post({endpoint:"apple_pay/merchant_session",authToken:t,headers:{"Sub-Account":e},body:{domain:window.location.hostname,display_name:this.applePayConfig.displayName}})}catch(t){throw console.error("Backend validation failed:",t),new Error("Merchant validation failed")}}async processPayment(t,e,i){const s=await this.api.post({endpoint:"apple_pay/process_token",authToken:t,body:i,headers:{"Sub-Account":e}});return{success:s.id&&!!s.data.token,data:s}}isAvailable(){return r.isApplePaySupported()&&r.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await r.canMakePaymentsWithActiveCard(this.applePayConfig.merchantIdentifier)}async startPaymentSession(t,e,i){if(!this.applePayConfig)throw console.error("[ApplePayService] Missing applePayConfig. Did you call initialize()?"),new Error("Apple Pay not initialized. Call initialize() first.");const s=new l(t);if(!s.isValid){const t=[];throw s.countryCode||t.push("countryCode"),s.currencyCode||t.push("currencyCode"),s.merchantCapabilities&&0!==s.merchantCapabilities.length||t.push("merchantCapabilities"),s.supportedNetworks&&0!==s.supportedNetworks.length||t.push("supportedNetworks"),s.total&&s.total.label&&s.total.amount||t.push("total"),console.error("[ApplePayService] Payment request is invalid. Missing/invalid:",t),new Error("Invalid payment request provided")}return this.currentPaymentRequest=s,new Promise(((t,n)=>{try{if("undefined"==typeof window||!("ApplePaySession"in window))return console.error("[ApplePayService] ApplePaySession not available on window"),n({success:!1,error:{code:q.UNAVAILABLE,message:"ApplePaySession API is not available in this environment"}});this.currentSession=new window.ApplePaySession(3,s),this.setupSessionEventHandlers(t,n,e,i),this.currentSession.begin()}catch(t){console.error("[ApplePayService] Exception while starting session:",t),n({success:!1,error:{code:q.SESSION_ERROR,message:t instanceof Error?t.message:"Failed to start Apple Pay session"}})}}))}abortPaymentSession(){this.currentSession&&(this.currentSession.abort(),this.currentSession=void 0,this.currentPaymentRequest=void 0)}setupSessionEventHandlers(t,e,i,s){this.currentSession&&this.applePayConfig&&this.currentPaymentRequest?(this.currentSession.onvalidatemerchant=async()=>{try{if(!i)throw console.error("[ApplePayService] Missing authToken for merchant validation"),new Error("Authentication token not provided.");const t=await this.validateMerchant(i,s);try{this.currentSession.completeMerchantValidation(t)}catch(t){throw console.error("Error calling completeMerchantValidation:",t),t}}catch(t){console.error("=== MERCHANT VALIDATION ERROR ==="),console.error("Error during merchant validation:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.abort(),e({success:!1,error:{code:q.MERCHANT_VALIDATION_ERROR,message:t instanceof Error?t.message:"Merchant validation failed"}})}},this.currentSession.onpaymentauthorized=async n=>{try{const a=n.payment,o=Object.assign(Object.assign({},a.token),{product_details:{name:this.currentPaymentRequest.total.label,price:r.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),l=await this.processPayment(i,s,o);l.success?(this.currentSession.completePayment({status:h.STATUS_SUCCESS}),t({success:!0,token:a.token,paymentMethodId:l.data.id})):(console.error("PSP reported payment failure:",l.data),this.currentSession.completePayment({status:h.STATUS_FAILURE}),e({success:!1,error:{code:q.PAYMENT_PROCESSING_ERROR,message:"Payment processing failed"}}))}catch(t){console.error("=== PAYMENT PROCESSING ERROR ==="),console.error("Error processing payment:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.completePayment({status:h.STATUS_FAILURE}),e({success:!1,error:{code:q.PAYMENT_PROCESSING_ERROR,message:t instanceof Error?t.message:"Payment processing failed"}})}finally{this.currentSession=void 0,this.currentPaymentRequest=void 0}},this.currentSession.onpaymentmethodselected=()=>{const t={newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]};try{this.currentSession.completePaymentMethodSelection(t)}catch(t){console.error("Error completing payment method selection:",t),this.currentSession.abort()}},this.currentSession.onshippingmethodselected=()=>{this.currentSession.completeShippingMethodSelection({status:h.STATUS_SUCCESS,newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]})},this.currentSession.oncancel=t=>{if(t.sessionError)switch(console.error(t.sessionError),t.sessionError.code){case"unknown":console.error("Unknown error - likely merchant validation issue"),console.error("This usually means:"),console.error("1. Merchant certificate is invalid or expired"),console.error("2. Merchant identifier mismatch"),console.error("3. Backend validation endpoint issues");break;case"invalidMerchantSession":console.error("Invalid merchant session provided"),console.error("Check that the merchant session from backend is valid");break;case"userCancel":console.error("User cancelled the payment");break;default:console.error("Other error code:",t.sessionError.code)}this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:q.USER_CANCELLED,message:"User cancelled the Apple Pay session"}})},"onerror"in this.currentSession&&(this.currentSession.onerror=t=>{console.error("=== APPLE PAY SESSION ERROR ==="),console.error("Session error:",t),this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:q.SESSION_ERROR,message:"Apple Pay session error occurred"}})})):console.error("[ApplePayService] setupSessionEventHandlers called without required state",{hasSession:Boolean(this.currentSession),hasConfig:Boolean(this.applePayConfig),hasPaymentRequest:Boolean(this.currentPaymentRequest)})}static createPaymentRequest(t,e,i="US",s="USD"){return{countryCode:i,currencyCode:s,merchantCapabilities:r.getDefaultMerchantCapabilities(),supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const K=t=>{const{isLoading:e}=t;return e?i("div",{class:"container-fluid p-0"},i("div",{class:"row mb-3"},i("div",{class:"col-12 align-content-center"},i(k,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null},X=t=>i("div",{class:"apple-pay-button-container"},i("button",Object.assign({class:(()=>{let e="apple-pay-button";switch(t.buttonStyle){case c.WHITE:e+=" apple-pay-button-white";break;case c.WHITE_OUTLINE:e+=" apple-pay-button-white-outline";break;default:e+=" apple-pay-button-black"}switch(t.buttonType){case d.BUY:e+=" apple-pay-button-type-buy";break;case d.DONATE:e+=" apple-pay-button-type-donate";break;default:e+=" apple-pay-button-type-plain"}return(t.disabled||t.isProcessing||!t.isAvailable)&&(e+=" disabled"),e})(),style:{width:t.width,height:t.height},onClick:()=>{!t.disabled&&!t.isProcessing&&t.isAvailable&&t.clickHandler&&t.clickHandler()},disabled:t.disabled||t.isProcessing||!t.isAvailable,"aria-label":"Pay with Apple Pay",type:"button"},t),t.isProcessing&&i("div",{class:"processing-overlay"},i("div",{class:"spinner"}),i("span",null,"Processing..."))),i("style",null,"\n .apple-pay-button-container {\n display: block;\n position: relative;\n width: 100%;\n }\n\n /* Apple Pay CSS classes - these are the official Apple Pay button styles */\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: plain; /* default */\n -apple-pay-button-style: black; /* default */\n border-radius: 8px;\n cursor: pointer;\n border: none;\n outline: none;\n transition: opacity 0.2s ease;\n position: relative;\n }\n\n /* Button styles */\n .apple-pay-button.apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n\n .apple-pay-button.apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n\n .apple-pay-button.apple-pay-button-white-outline {\n -apple-pay-button-style: white-outline;\n }\n\n /* Button types */\n .apple-pay-button.apple-pay-button-type-plain {\n -apple-pay-button-type: plain;\n }\n\n .apple-pay-button.apple-pay-button-type-buy {\n -apple-pay-button-type: buy;\n }\n\n .apple-pay-button.apple-pay-button-type-donate {\n -apple-pay-button-type: donate;\n }\n\n /* Hover and disabled states */\n .apple-pay-button:hover:not(.disabled) {\n opacity: 0.9;\n }\n\n .apple-pay-button.disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Processing overlay */\n .processing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: rgba(0, 0, 0, 0.8);\n color: white;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n }\n\n .spinner {\n width: 16px;\n height: 16px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-top: 2px solid #fff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n /* Responsive design */\n @media (max-width: 480px) {\n .apple-pay-button {\n width: 100% !important;\n min-width: 200px;\n }\n }\n ")),$=class{constructor(i){t(this,i),this.applePayStarted=e(this,"applePayStarted",7),this.applePayCompleted=e(this,"applePayCompleted",7),this.applePayCancelled=e(this,"applePayCancelled",7),this.applePayError=e(this,"applePayError",7),this.sdkLoaded=!1,this.countryCode="US",this.merchantIdentifier="merchant.com.staging-justifi.checkout-dev",this.merchantDisplayName="JustiFi Checkout",this.initiativeContext="dev-checkout.justifi-staging.com",this.buttonType=d.PLAIN,this.buttonStyle=c.BLACK,this.disabled=!1,this.width="100%",this.height="48px",this.isLoading=!0,this.isProcessing=!1,this.isAvailable=!1,this.canMakePayments=!1,this.isConfigValid=!0,this.error=null,this.handleApplePayClick=async()=>{var t,e,i;if(!this.isProcessing&&!this.disabled&&this.isAvailable)try{this.isProcessing=!0,this.error=null,this.applePayStarted.emit();const i={countryCode:this.countryCode,currencyCode:w.paymentCurrency,merchantCapabilities:[u.SUPPORTS_3DS,u.SUPPORTS_CREDIT,u.SUPPORTS_DEBIT],supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(w.paymentDescription,w.paymentAmount)},s=await this.applePayService.startPaymentSession(i,w.authToken,w.accountId);s.success?this.applePayCompleted.emit({success:!0,token:s.token,paymentMethodId:s.paymentMethodId}):(this.applePayCompleted.emit({success:!1,error:s.error}),this.applePayError.emit({error:(null===(t=s.error)||void 0===t?void 0:t.message)||"Payment failed",code:(null===(e=s.error)||void 0===e?void 0:e.code)||$.ErrorCode.PAYMENT_FAILED}))}catch(t){if((null===(i=null==t?void 0:t.error)||void 0===i?void 0:i.code)===q.USER_CANCELLED)this.applePayCancelled.emit();else{const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e,code:$.ErrorCode.PAYMENT_FAILED}),this.applePayCompleted.emit({success:!1,error:e})}}finally{this.isProcessing=!1}}}componentWillLoad(){this.isAvailable=r.isApplePaySupported(),this.isAvailable?w.checkoutLoaded?this.loadApplePaySDK():j("checkoutLoaded",(t=>{t&&this.loadApplePaySDK()})):this.isLoading=!1}loadApplePaySDK(){if(this.sdkLoaded)return;this.sdkLoaded=!0;const t=document.createElement("script");t.src="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",t.async=!0,t.onload=()=>this.initializeApplePay(),document.head.appendChild(t)}async initializeApplePay(){try{if(this.isLoading=!0,this.error=null,this.isConfigValid=!0,!(Boolean(w.paymentAmount)&&Boolean(w.paymentCurrency)&&Boolean(w.authToken)))return this.error="Missing required Apple Pay configuration",this.isConfigValid=!1,this.applePayError.emit({error:this.error,code:$.ErrorCode.CONFIG_ERROR}),void(this.isLoading=!1);if(this.isAvailable=r.isApplePaySupported(),this.canMakePayments=r.canMakePayments(),!this.isAvailable)return this.error="Apple Pay is not supported on this device",this.applePayError.emit({error:this.error,code:$.ErrorCode.NOT_SUPPORTED}),void(this.isLoading=!1);if(!this.canMakePayments)return this.error="Apple Pay is not available",this.applePayError.emit({error:this.error,code:$.ErrorCode.NOT_AVAILABLE}),void(this.isLoading=!1);const t={merchantIdentifier:this.merchantIdentifier,displayName:this.merchantDisplayName,initiative:"web",initiativeContext:this.initiativeContext,buttonType:this.buttonType,buttonStyle:this.buttonStyle};this.applePayService=new J,this.applePayService.initialize(t),await this.applePayService.canMakePaymentsWithActiveCard()||console.warn("No Apple Pay cards available, but continuing...")}catch(t){this.error=t instanceof Error?t.message:"Failed to initialize Apple Pay",this.applePayError.emit({error:this.error,code:$.ErrorCode.INITIALIZATION_ERROR})}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?r.getDefaultSupportedNetworks():[]}async abort(){var t;null===(t=this.applePayService)||void 0===t||t.abortPaymentSession(),this.isProcessing=!1,this.applePayCancelled.emit()}render(){if(!w.applePayEnabled)return null;if(!this.isAvailable)return null;const t=!this.isLoading&&this.isAvailable&&this.canMakePayments&&this.isConfigValid;return i(M,null,i("div",{class:"apple-pay-container"},i(K,{isLoading:this.isLoading}),t&&i(X,{buttonType:this.buttonType,buttonStyle:this.buttonStyle,disabled:this.disabled,isProcessing:this.isProcessing,isAvailable:this.isAvailable,clickHandler:this.handleApplePayClick,width:this.width,height:this.height})),i("style",null,"\n .apple-pay-container {\n width: 100%;\n }\n "))}};$.ErrorCode={CONFIG_ERROR:"CONFIG_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",NOT_AVAILABLE:"NOT_AVAILABLE",INITIALIZATION_ERROR:"INITIALIZATION_ERROR",PAYMENT_FAILED:"PAYMENT_FAILED"};const tt=class{constructor(e){t(this,e),this.variant="primary",this.type="button"}render(){return i(M,{key:"241fe8903788f0442b42bf5a6835d152d1944967"},i("internal-button",{key:"7c13bd1fa53cf9faae26e521af5a40a08659fe92",text:this.text,variant:this.variant,isLoading:this.isLoading,clickHandler:this.clickHandler,type:this.type,disabled:this.disabled,class:this.class,customStyle:this.customStyle,hidden:this.hidden}))}},et=class{constructor(e){t(this,e)}render(){return i(M,{key:"336fa6563952ee7905c2ed4a3330d73bbb33a0eb"},i("section",{key:"48b8798a925d618f5a2c52d743190207b78eb70a"},i("div",{key:"81d91167c10ccc49acb039ea54a9f97f4aa6e305"},i("div",{key:"9744242f2c2c3082e9c1a3af6e716ec4cb28f1fd",part:C},null==w?void 0:w.paymentDescription),i("div",{key:"438062935abd2f00495c432ef6652e3808e5215f"},i("span",{key:"e3f24d9c52ddae0206cbefe61bd08f24697fe28e",part:C},"Total")," ",i("span",{key:"9835cb60de31a2c8946b7ac2dd6d1fa82f223110",part:C},I(+(null==w?void 0:w.totalAmount)))))))}},it=t=>{const{isLoading:e}=t;return e?i("div",{class:"container-fluid p-0"},i("div",{class:"row mb-3"},i("div",{class:"col-12 align-content-center"},i(k,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null};var st;!function(t){t.initialize="justifi.googlePay.initialize",t.ready="justifi.googlePay.ready",t.sdkLoaded="justifi.googlePay.sdkLoaded",t.initializeResult="justifi.googlePay.initializeResult",t.error="justifi.googlePay.error",t.buttonClicked="justifi.googlePay.buttonClicked",t.startPayment="justifi.googlePay.startPayment",t.paymentSuccess="justifi.googlePay.paymentSuccess",t.paymentCanceled="justifi.googlePay.paymentCanceled",t.paymentError="justifi.googlePay.paymentError"}(st||(st={}));const nt=class{constructor(i){t(this,i),this.googlePayStarted=e(this,"googlePayStarted",7),this.googlePayCompleted=e(this,"googlePayCompleted",7),this.googlePayCancelled=e(this,"googlePayCancelled",7),this.merchantDisplayName="JustiFi Checkout",this.iframeReady=!1,this.sdkLoaded=!1,this.isReadyToPay=!1,this.handleMessage=t=>{if(t.origin!==this.iframeOrigin)return;const{eventType:e,data:i}=t.data||{};switch(e){case st.ready:this.iframeReady=!0;break;case st.sdkLoaded:this.sdkLoaded=!0,this.sendInitialize();break;case st.initializeResult:this.isReadyToPay=i.isReadyToPay,i.error&&console.error("Init error:",i.error);break;case st.error:console.error("Google Pay error:",i);break;case st.buttonClicked:this.googlePayStarted.emit(),this.sendStartPayment();break;case st.paymentSuccess:this.googlePayCompleted.emit({success:!0,paymentMethodId:i.paymentMethodId,cardNetwork:i.cardNetwork,cardDetails:i.cardDetails});break;case st.paymentCanceled:this.googlePayCancelled.emit();break;case st.paymentError:this.googlePayCompleted.emit({success:!1,error:{code:i.code,message:i.message}})}}}async componentWillLoad(){await E(),this.iframeOrigin=D.iframeOrigin}componentDidLoad(){window.addEventListener("message",this.handleMessage)}disconnectedCallback(){window.removeEventListener("message",this.handleMessage)}googlePayEnvironment(){return void 0!==this.environment?this.environment:"test"===w.checkoutMode?"TEST":"PRODUCTION"}sendInitialize(){var t;if(!(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow))return;const e={environment:this.googlePayEnvironment(),gatewayMerchantId:w.accountId,merchantName:this.merchantDisplayName,authToken:w.authToken,accountId:w.accountId};this.iframeElement.contentWindow.postMessage({eventType:st.initialize,data:e},this.iframeOrigin)}sendStartPayment(){var t;if(!(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow))return;const e={totalPrice:String(w.paymentAmount/100),totalPriceStatus:"FINAL",currencyCode:w.paymentCurrency||"USD"};this.iframeElement.contentWindow.postMessage({eventType:st.startPayment,data:e},this.iframeOrigin)}render(){return w.checkoutLoaded?w.googlePayEnabled?i(s,null,i(it,{isLoading:!this.isReadyToPay}),i("iframe",{ref:t=>this.iframeElement=t,src:`${this.iframeOrigin}/v2/googlePay`,allow:"payment",style:{border:"none",width:"100%",height:"48px",display:this.isReadyToPay?"block":"none"}})):(console.warn("Google Pay is not enabled for this checkout"),null):null}},at=class{constructor(e){t(this,e),this.levels={h1:S,h2:O,h3:_},this.level="h1"}render(){return i(M,{key:"5a0872ee486bdba3ba1c86145946889bb7d151f2"},i(this.levels[this.level],{key:"89807e249cdf64f7ef80800276cb50966083f28e",text:this.text,class:this.class}))}},ot=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event",7),this.submitEvent=e(this,"submit-event",7),this.checkoutChangedEvent=e(this,"checkout-changed",7),this.plaidService=new V,this.handleApplePayStarted=()=>{w.isWalletProcessing=!0},this.handleGooglePayStarted=()=>{w.isWalletProcessing=!0},this.handleGooglePayCompleted=t=>{const{success:e,paymentMethodId:i,error:s}=t.detail||{};e&&i?(w.isWalletProcessing=!1,w.paymentToken=i,w.selectedPaymentMethod={type:H.GOOGLE_PAY},this.submitCheckout()):(w.isWalletProcessing=!1,this.errorEvent.emit({message:s&&s.message||"Google Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR}))},this.handleGooglePayCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0},this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:n}=t.detail;e&&i?(w.isWalletProcessing=!1,w.paymentToken=s,w.selectedPaymentMethod={type:H.APPLE_PAY},this.submitCheckout()):(w.isWalletProcessing=!1,console.error("Apple Pay completed but failed:",n),this.errorEvent.emit({message:(null==n?void 0:n.message)||"Apple Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR}))},this.handleApplePayError=t=>{w.isWalletProcessing=!1;const{error:e,code:i}=t.detail;console.error("Apple Pay error:",e),this.errorEvent.emit({message:e||"Apple Pay error occurred",errorCode:`APPLE_PAY_${i}`,severity:p.ERROR})},this.handleApplePayCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0}}connectedCallback(){this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),w.checkoutId=this.checkoutId;const t={authToken:this.authToken,checkoutId:this.checkoutId,service:new Y};this.getCheckout=B(t),this.completeCheckout=F(t),P((()=>{this.emitCheckoutChanged()}))}componentWillLoad(){this.analytics=new R(this),U(),w.authToken=this.authToken,this.fetchCheckout(),L("set",(t=>{const e=z[t];void 0!==e&&x(t,e)&&this.fetchCheckout()}))}componentDidLoad(){this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners()}disconnectedCallback(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this.removeApplePayListeners(),this.removeGooglePayListeners()}fetchCheckout(){this.authToken&&this.checkoutId?this.getCheckout&&this.getCheckout({onSuccess:({checkout:t})=>{this.updateStore(t),t.status!==v.completed?t.status!==v.expired||this.errorEvent.emit({message:m.CHECKOUT_EXPIRED,errorCode:y.CHECKOUT_EXPIRED,severity:p.ERROR}):this.errorEvent.emit({message:m.CHECKOUT_ALREADY_COMPLETED,errorCode:y.CHECKOUT_ALREADY_COMPLETED,severity:p.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:t.code,severity:t.severity})}}):this.errorEvent.emit({message:m.NOT_AUTHENTICATED,errorCode:y.NOT_AUTHENTICATED,severity:p.ERROR})}updateStore(t){var e,i,s,n,a,o,r,l;w.accountId=t.account_id,w.checkoutLoaded=!0;const h=null!=t.mode?String(t.mode).toLowerCase():"";w.checkoutMode="test"===h?"test":"live"===h?"live":null;const c=t.payment_methods.map((t=>new Q(t))),d=Boolean(null===(e=t.payment_settings)||void 0===e?void 0:e.ach_payments);w.paymentMethods=c.filter((t=>t.type!==H.SAVED_BANK_ACCOUNT||d)),w.paymentMethodGroupId=t.payment_method_group_id,w.paymentDescription=t.payment_description,w.totalAmount=t.total_amount,w.paymentAmount=t.payment_amount,w.bnplEnabled=t.payment_settings.bnpl_payments,w.insuranceEnabled=t.payment_settings.insurance_payments,w.bankAccountVerification=null===(i=t.payment_settings)||void 0===i?void 0:i.bank_account_verification,w.applePayEnabled=null===(s=t.payment_settings)||void 0===s?void 0:s.apple_payments,w.googlePayEnabled=null===(n=t.payment_settings)||void 0===n?void 0:n.google_payments,w.achPaymentsEnabled=d,w.bnplProviderClientId=null===(a=null==t?void 0:t.bnpl)||void 0===a?void 0:a.provider_client_id,w.bnplProviderMode=null===(o=null==t?void 0:t.bnpl)||void 0===o?void 0:o.provider_mode,w.bnplProviderApiVersion=null===(r=null==t?void 0:t.bnpl)||void 0===r?void 0:r.provider_api_version,w.bnplProviderCheckoutUrl=null===(l=null==t?void 0:t.bnpl)||void 0===l?void 0:l.provider_checkout_url}emitCheckoutChanged(){const t={availablePaymentMethodTypes:T(),selectedPaymentMethod:w.selectedPaymentMethod,savedPaymentMethods:w.paymentMethods};this.checkoutChangedEvent.emit(t)}queryFormRefs(){if(this.billingFormRef=this.hostEl.querySelector("justifi-billing-form, justifi-bank-account-billing-form-simple, justifi-card-billing-form-simple, justifi-billing-form-full, justifi-tokenize-payment-method"),this.applePayRef=this.hostEl.querySelector("justifi-apple-pay"),this.googlePayRef=this.hostEl.querySelector("justifi-google-pay"),this.paymentMethodFormRef=this.hostEl.querySelector("justifi-card-form, justifi-bank-account-form, justifi-tokenize-payment-method"),!w.selectedPaymentMethod&&this.paymentMethodFormRef){const t=this.paymentMethodFormRef.tagName.toLowerCase();"justifi-card-form"===t?w.selectedPaymentMethod={type:H.NEW_CARD}:"justifi-bank-account-form"!==t||w.checkoutLoaded&&!w.achPaymentsEnabled||(w.selectedPaymentMethod={type:H.NEW_BANK_ACCOUNT})}this.insuranceFormRef=this.hostEl.querySelector("justifi-season-interruption-insurance")}setupApplePayListeners(){this.applePayRef&&(this.applePayRef.addEventListener("applePayStarted",this.handleApplePayStarted),this.applePayRef.addEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.addEventListener("applePayError",this.handleApplePayError),this.applePayRef.addEventListener("applePayCancelled",this.handleApplePayCancelled))}removeApplePayListeners(){this.applePayRef&&(this.applePayRef.removeEventListener("applePayStarted",this.handleApplePayStarted),this.applePayRef.removeEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.removeEventListener("applePayError",this.handleApplePayError),this.applePayRef.removeEventListener("applePayCancelled",this.handleApplePayCancelled))}setupGooglePayListeners(){this.googlePayRef&&(this.googlePayRef.addEventListener("googlePayStarted",this.handleGooglePayStarted),this.googlePayRef.addEventListener("googlePayCompleted",this.handleGooglePayCompleted),this.googlePayRef.addEventListener("googlePayCancelled",this.handleGooglePayCancelled))}removeGooglePayListeners(){this.googlePayRef&&(this.googlePayRef.removeEventListener("googlePayStarted",this.handleGooglePayStarted),this.googlePayRef.removeEventListener("googlePayCompleted",this.handleGooglePayCompleted),this.googlePayRef.removeEventListener("googlePayCancelled",this.handleGooglePayCancelled))}async tokenizePaymentMethod(t){var e,i,s;const n=null!==(i=await(null===(e=this.billingFormRef)||void 0===e?void 0:e.getValues()))&&void 0!==i?i:{},a=Object.assign(Object.assign({},t),n),o=Object.assign({accountId:w.accountId,payment_method_group_id:void 0},a);w.savePaymentMethod&&(o.payment_method_group_id=w.paymentMethodGroupId);const r=await(null===(s=this.paymentMethodFormRef)||void 0===s?void 0:s.tokenize({clientId:this.authToken,paymentMethodMetadata:o,account:w.accountId}));return r.error?r:(w.paymentToken=r.id,r.id)}async fillBillingForm(t){w.billingFormFields=t}async setSelectedPaymentMethod(t){w.selectedPaymentMethod=t,w.paymentToken=t.id||void 0}async validate(){var t,e;const i=[];w.insuranceEnabled&&this.insuranceFormRef&&i.push(this.insuranceFormRef.validate());const s=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===H.NEW_CARD,n=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===H.NEW_BANK_ACCOUNT;if((s||n)&&(this.paymentMethodFormRef&&i.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&i.push(this.billingFormRef.validate())),0===i.length)return!0;try{return!!(await Promise.all(i)).every((t=>"boolean"==typeof t?t:!1!==(null==t?void 0:t.isValid)))||(this.errorEvent.emit({message:"Validation error",errorCode:y.VALIDATION_ERROR,severity:p.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){var e,i,s,n,a;if(w.isSubmitting)return;w.isSubmitting=!0;const o=await this.validate();if(!w.selectedPaymentMethod)return w.isSubmitting=!1,void this.errorEvent.emit({message:"No payment method selected.",errorCode:y.VALIDATION_ERROR,severity:p.ERROR});const r=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===H.NEW_CARD,l=(null===(i=w.selectedPaymentMethod)||void 0===i?void 0:i.type)===H.NEW_BANK_ACCOUNT,h=(null===(s=w.selectedPaymentMethod)||void 0===s?void 0:s.type)===H.PLAID;if(r||l){const e=await this.tokenizePaymentMethod(t);if(null==e?void 0:e.error)return w.isSubmitting=!1,void this.errorEvent.emit({message:e.error.message,errorCode:y.TOKENIZE_ERROR,severity:p.ERROR})}if(h&&!w.paymentToken){const t=w.plaidPublicToken,e=w.plaidLinkTokenId;if(!t)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Missing Plaid public token. Please connect your bank.",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR});try{const i=await this.plaidService.tokenizeBankAccount(w.authToken,w.accountId,t,e||void 0,w.savePaymentMethod?w.paymentMethodGroupId:void 0);if(null==i?void 0:i.error)return w.isSubmitting=!1,void this.errorEvent.emit({message:"string"==typeof i.error?i.error:i.error.message||"Failed to tokenize bank account",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR});const s=null==i?void 0:i.data,a=(null===(n=null==s?void 0:s.bank_account)||void 0===n?void 0:n.token)||(null==s?void 0:s.token)||(null==s?void 0:s.id);w.paymentToken=a}catch(t){return w.isSubmitting=!1,void this.errorEvent.emit({message:(null==t?void 0:t.message)||"Plaid exchange error",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR})}}if(!o)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:y.VALIDATION_ERROR,severity:p.ERROR});if(!w.paymentToken)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Payment token not found.",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR});const c={payment_mode:(t=>{switch(t){case H.NEW_CARD:case H.SAVED_CARD:case H.NEW_BANK_ACCOUNT:case H.SAVED_BANK_ACCOUNT:case H.PLAID:return Z.ECOM;case H.SEZZLE:return Z.BNPL;case H.APPLE_PAY:return Z.APPLE_PAY;case H.GOOGLE_PAY:return Z.GOOGLE_PAY;default:return}})(null===(a=w.selectedPaymentMethod)||void 0===a?void 0:a.type),payment_token:w.paymentToken};if(this.preCompleteHook){const t=A();try{await new Promise(((e,i)=>{this.preCompleteHook(t,(()=>e()),(()=>i()))}))}catch(t){return w.isSubmitting=!1,void console.log("Checkout cancelled by preCompleteHook",t)}}this.completeCheckout({payment:c,onSuccess:({checkout:t})=>{w.isSubmitting=!1,this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{w.isSubmitting=!1,this.errorEvent.emit({message:t.message,errorCode:y.COMPLETE_CHECKOUT_ERROR,severity:p.ERROR})}})}render(){return i(s,{key:"545e1cb07252ba0dc78fa980bd17ee5572559f6c"})}get hostEl(){return n(this)}},rt=class{constructor(i){t(this,i),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.plaidError=e(this,"plaidError",7),this.plaidErrorRecovered=e(this,"plaidErrorRecovered",7),this.isAuthenticating=!1,this.publicToken=null,this.linkToken=null,this.linkTokenId=null,this.error=null,this.plaidLink=null,this.isSelected=!1,this.retryCount=0,this.isRetrying=!1,this.sdkLoaded=!1,this.plaidService=new V,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.hasLoggedAchPaymentsDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{w.authToken&&w.accountId&&w.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:b.PLAID_SDK_LOAD_FAILED,message:f[b.PLAID_SDK_LOAD_FAILED],severity:g[b.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:b.PLAID_LINK_TOKEN_FAILED,message:f[b.PLAID_LINK_TOKEN_FAILED],severity:g[b.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:b.PLAID_LINK_INIT_FAILED,message:f[b.PLAID_LINK_INIT_FAILED],severity:g[b.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,s,n;try{if(!w.authToken||!w.accountId)return void this.handleError({code:b.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:p.ERROR,retryable:!1,userAction:"Refresh the page"});this.abortController=new AbortController,this.timeoutId=setTimeout((()=>{var t;null===(t=this.abortController)||void 0===t||t.abort()}),3e4);const e=await this.plaidService.getLinkToken(w.authToken,w.accountId,w.checkoutId,this.abortController.signal);if(this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),e.error)throw new Error("string"==typeof e.error?e.error:e.error.message||"Failed to get link token");this.linkToken=e.data.link_token,this.linkTokenId=(null==e?void 0:e.id)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||null,this.linkTokenId&&(w.plaidLinkTokenId=this.linkTokenId)}catch(t){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let a=b.PLAID_LINK_TOKEN_FAILED,o=f[a],r=!0;"AbortError"===t.name?(a=b.PLAID_TIMEOUT,o=f[a],r=!0):(null===(e=t.message)||void 0===e?void 0:e.includes("network"))||(null===(i=t.message)||void 0===i?void 0:i.includes("fetch"))?(a=b.PLAID_NETWORK_ERROR,o=f[a],r=!0):((null===(s=t.message)||void 0===s?void 0:s.includes("401"))||(null===(n=t.message)||void 0===n?void 0:n.includes("unauthorized")))&&(a=b.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:a,message:o,severity:g[a],originalError:t,retryable:r,userAction:r?"Click to try again":"Refresh the page"})}},this.mapApiErrorToPlaidError=t=>{if("string"==typeof t){if(t.includes("rate_limit"))return b.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return b.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return b.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return b.PLAID_RATE_LIMITED;case"maintenance":return b.PLAID_MAINTENANCE;case"not_authenticated":return b.PLAID_INVALID_CREDENTIALS;default:return b.PLAID_LINK_TOKEN_FAILED}return b.PLAID_LINK_TOKEN_FAILED},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=t=>{this.publicToken=t,this.isAuthenticating=!1,this.clearError(),this.retryCount=0,this.isSelected||(this.isSelected=!0,w.selectedPaymentMethod={type:H.PLAID}),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:p.INFO}),w.plaidPublicToken=t},this.handlePlaidExit=t=>{this.isAuthenticating=!1,t&&this.handlePlaidError(t)},this.handlePlaidEvent=(t,e)=>{switch(t){case"OPEN":this.isAuthenticating=!0;break;case"CLOSE":this.isAuthenticating=!1;break;case"ERROR":this.handlePlaidError(e)}},this.handlePlaidLoad=()=>{},this.handlePlaidError=t=>{let e=b.PLAID_AUTHENTICATION_FAILED,i=f[e],s=!0,n="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=b.PLAID_INVALID_CREDENTIALS,i=f[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=b.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=b.PLAID_ACCOUNT_LOCKED,i=f[e],s=!1,n="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=b.PLAID_MAINTENANCE,i=f[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=b.PLAID_RATE_LIMITED,i=f[e],s=!0;break;case"INVALID_REQUEST":e=b.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=b.PLAID_AUTHENTICATION_FAILED,i=t.error_message||"Bank authentication failed. Please try again.",s=!0;break;default:t.error_message&&(i=t.error_message)}if(t.error_message){const a=t.error_message.toLowerCase();a.includes("not supported")||a.includes("unsupported")?(e=b.PLAID_BANK_NOT_SUPPORTED,i=f[e],s=!1,n="Try a different payment method"):(a.includes("expired")||a.includes("timeout"))&&(e=b.PLAID_TOKEN_EXPIRED,i=f[e],s=!0)}this.handleError({code:e,message:i,severity:g[e],originalError:t,retryable:s,userAction:n}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.plaidError.emit({code:t.code,message:t.message,severity:t.severity,data:{originalError:t.originalError,retryable:t.retryable,userAction:t.userAction,retryCount:this.retryCount}}),console.error("Plaid error:",t),t.retryable&&this.retryCount<this.maxRetries&&this.scheduleRetry()},this.scheduleRetry=()=>{this.isRetrying||(this.isRetrying=!0,this.retryCount++,setTimeout((()=>{this.isRetrying=!1,this.clearError(),this.waitForStoreAndInitialize()}),this.retryDelay*this.retryCount))},this.clearError=()=>{this.error&&(this.error=null,this.retryCount=0)},this.syncWithStore=()=>{var t;const e=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===H.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)!==H.PLAID&&(w.selectedPaymentMethod={type:H.PLAID}),!t||!this.plaidLink||this.publicToken||this.isAuthenticating||this.error||this.openPlaidLink()}componentWillLoad(){var t;this.isSelected=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===H.PLAID,!0===w.bankAccountVerification&&(w.checkoutLoaded?w.achPaymentsEnabled&&this.loadPlaidSDK():j("checkoutLoaded",(t=>{t&&!0===w.bankAccountVerification&&w.achPaymentsEnabled&&this.loadPlaidSDK()})))}loadPlaidSDK(){if(this.sdkLoaded)return;this.sdkLoaded=!0;const t=document.createElement("script");t.src="https://cdn.plaid.com/link/v2/stable/link-initialize.js",t.async=!0,t.onload=()=>this.initializePlaidLink(),t.onerror=()=>{this.handleError({code:b.PLAID_SDK_LOAD_FAILED,message:f[b.PLAID_SDK_LOAD_FAILED],severity:g[b.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})},document.head.appendChild(t)}async resolvePaymentMethod(){return this.publicToken?{token:this.publicToken,data:{type:"bank_account",plaid_public_token:this.publicToken}}:{validationError:!0}}async getPaymentToken(){return w.paymentToken}async handleSelectionClick(){if(this.isSelected=!0,w.selectedPaymentMethod={type:H.PLAID},this.error)return this.clearError(),void this.waitForStoreAndInitialize();!this.plaidLink||this.publicToken||this.isAuthenticating||this.openPlaidLink()}async setSelected(t){this.isSelected=t,t&&(w.selectedPaymentMethod={type:H.PLAID})}async isCurrentlySelected(){return this.isSelected}async deselect(){this.isSelected=!1}async reset(){this.publicToken=null,this.clearError(),this.isAuthenticating=!1,this.linkToken=null,this.plaidLink=null,this.retryCount=0,this.isRetrying=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.abortController&&(this.abortController.abort(),this.abortController=null)}async isReadyForAuthentication(){return!(!this.plaidLink||!this.linkToken||this.isAuthenticating)}async retry(){this.error&&this.error.retryable&&(this.clearError(),this.waitForStoreAndInitialize())}async getErrorInfo(){return this.error}componentDidLoad(){const t=j("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(w.checkoutLoaded&&!w.achPaymentsEnabled)return this.hasLoggedAchPaymentsDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] ACH payments are disabled for this checkout. Component will not render."),this.hasLoggedAchPaymentsDisabledWarning=!0),null;if(!0!==w.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const t=i("img",{class:"plaid-logo-img",src:"data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgMjggMjkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgY2xhc3M9ImNzcy0xcmRhajhtIj48ZyBmaWxsPSIjMTExIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yNS43NjI5IDI2LjI2MjhMMjggMTcuNTMwOUwyNC45NjkxIDE0LjUwMDFMMjcuOTk5OSAxMS40NjkxTDI1Ljc2MjggMi43MzcwNkwxNy4wMzA5IDAuNUwxNC4wMDAxIDMuNTMxTDEwLjk2OSAwLjUwMDE0TDIuMjM3MDYgMi43MzczNEwwIDExLjQ2OTFMMy4wMzEyOCAxNC40OTk5TDAuMDAwMTQgMTcuNTMxTDIuMjM3MiAyNi4yNjI5TDEwLjk2OTEgMjguNUwxNC4wMDAxIDI1LjQ2OUwxNy4wMzEgMjguNDk5OUwyNS43NjI5IDI2LjI2MjhaTTE1LjczMjEgMjMuNzM3MUwxOC42MTg2IDIwLjg1MDVMMjIuMjkxMiAyNC41MjMzTDE3LjY5NTYgMjUuNzAwN0wxNS43MzIxIDIzLjczNzFaTTExLjExMzYgOS44ODE1NEwxNC4wMDAzIDYuOTk1MDJMMTYuODg2OCA5Ljg4MTRMMTQuMDAwMSAxMi43Njc5TDExLjExMzYgOS44ODE1NFpNMTIuMjY4MiAxNC41TDkuMzgxNTQgMTcuMzg2NUw2LjQ5NTAyIDE0LjVMOS4zODE1NCAxMS42MTM1TDEyLjI2ODIgMTQuNVpNMTguNjE4NyAxMS42MTMzTDIxLjUwNTMgMTQuNUwxOC42MTg2IDE3LjM4NjVMMTUuNzMyMSAxNC41TDE4LjYxODcgMTEuNjEzM1pNMTYuODg2NyAxOS4xMTg2TDE0LjAwMDEgMjIuMDA1MUwxMS4xMTM1IDE5LjExODVMMTQuMDAwMSAxNi4yMzE5TDE2Ljg4NjcgMTkuMTE4NlpNMTAuMzA0NCAyNS43MDA3TDUuNzA4NjQgMjQuNTIzM0w5LjM4MTU0IDIwLjg1MDRMMTIuMjY4MiAyMy43MzcxTDEwLjMwNDQgMjUuNzAwN1pNNC43NjMwOCAxNi4yMzE5TDcuNjQ5NiAxOS4xMTg1TDMuOTc2NyAyMi43OTE0TDIuNzk5MyAxOC4xOTU3TDQuNzYzMDggMTYuMjMxOVpNMy45NzY3IDYuMjA4MzZMNy42NDk3NCA5Ljg4MTRMNC43NjMwOCAxMi43NjgxTDIuNzk5MyAxMC44MDQxTDMuOTc2NyA2LjIwODM2Wk0xMi4yNjgzIDUuMjYyOTRMOS4zODE2OCA4LjE0OTZMNS43MDg5MiA0LjQ3NjdMMTAuMzA0NyAzLjI5OTNMMTIuMjY4MyA1LjI2Mjk0Wk0xNy42OTU5IDMuMjk5M0wyMi4yOTE1IDQuNDc2N0wxOC42MTg2IDguMTQ5NDZMMTUuNzMyMSA1LjI2Mjk0TDE3LjY5NTkgMy4yOTkzWk0yMy4yMzcyIDEyLjc2ODFMMjAuMzUwNSA5Ljg4MTRMMjQuMDIzMyA2LjIwODc4TDI1LjIwMDcgMTAuODA0NkwyMy4yMzcyIDEyLjc2ODFaTTI0LjAyMzMgMjIuNzkxNEwyMC4zNTA1IDE5LjExODZMMjMuMjM3MiAxNi4yMzIxTDI1LjIwMDcgMTguMTk1N0wyNC4wMjMzIDIyLjc5MTRaIj48L3BhdGg+PC9nPjwvc3ZnPgo=",alt:"Plaid",title:"Plaid",style:{display:"inline",width:"20px",height:"20px",marginLeft:"5px",marginTop:"-2px"}});return i(M,{class:"payment-method"},i("div",{title:"Pay with Plaid"},i("div",{onClick:t=>{t.preventDefault(),this.handleSelectionClick()}},"Pay with Bank Account ",t," "),(()=>this.error?i("div",{class:(this.error.severity===p.ERROR?"text-danger":this.error.severity===p.WARNING?"text-warning":"text-info")+" mt-2"},i("small",null,this.error.message),i("br",null),i("small",{class:"text-muted"},this.error.userAction,this.error.retryable&&this.retryCount<this.maxRetries&&i("span",null," • Auto-retry in progress..."))):null)(),(()=>this.error?null:this.isAuthenticating?i("div",{class:"text-info mt-2"},i("small",null,"Connecting to your bank...")):this.publicToken?i("div",{class:"text-success mt-2"},i("small",null,"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:i("div",{class:"text-muted mt-2"},i("small",null,"Click to connect your bank account")))()))}static get watchers(){return{isSelected:["onSelectionChange"]}}},lt=class{constructor(e){t(this,e),this.onPaymentMethodOptionClick=t=>e=>{e.preventDefault(),w.selectedPaymentMethod={id:t.id,type:t.type},w.paymentToken=t.id},this.isAllowedPaymentMethod=t=>!(t===H.SAVED_CARD&&w.disableCreditCard||t===H.SAVED_BANK_ACCOUNT&&w.disableBankAccount)}componentWillLoad(){w.checkoutLoaded&&(w.paymentMethods.length||console.warn("No saved payment methods available."),w.disablePaymentMethodGroup&&console.warn("Payment method group is disabled."))}render(){return w.disablePaymentMethodGroup?null:i(M,null,i("div",{class:"saved-payment-methods"},w.paymentMethods.length?w.paymentMethods.filter((t=>this.isAllowedPaymentMethod(t.type))).map((t=>i("div",{class:"radio-list-item p-3",part:N,onClick:this.onPaymentMethodOptionClick(t)},i("form-control-radio",{name:"paymentMethodType",value:null==t?void 0:t.id,checked:w.paymentToken===(null==t?void 0:t.id),label:`${G[null==t?void 0:t.brand]||""} *${null==t?void 0:t.acct_last_four}`})))):null))}},ht=i("img",{class:"sezzle-smart-button-logo-img",src:"https://media.sezzle.com/branding/2.0/Sezzle_Logo_FullColor.svg",alt:"Sezzle",style:{display:"inline",width:"80px",marginLeft:"5px",marginTop:"-5px"}}),ct=class{constructor(i){t(this,i),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.paymentMethodOptionId=H.SEZZLE,this.initializeSezzleCheckout=()=>{let t;this.sezzlePromise=new Promise((e=>{t=e}));const e=Number(w.paymentAmount),i=new(0,window.Checkout)({mode:"popup",publicKey:w.bnplProviderClientId,apiMode:w.bnplProviderMode,apiVersion:w.bnplProviderApiVersion});i.sezzleButtonElement=this.sezzleButtonRef,i.init({onClick:function(t){t.preventDefault(),i.startCheckout({checkout_url:w.bnplProviderCheckoutUrl})},onComplete:e=>t({bnpl:e.data}),onCancel:e=>t({bnpl:e.data}),onFailure:e=>t({bnpl:e.data})}),this.sezzleCheckout=i,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(e)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()})}async resolvePaymentMethod(t){return t.isValid?(this.sezzleButtonRef.click(),this.sezzlePromise):{validationError:!0}}async handleSelectionClick(){w.selectedPaymentMethod={type:H.SEZZLE},this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)}render(){var t,e;return w.bnplEnabled?i(M,{class:"payment-method"},i("script",{src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),i("div",null,i("div",null,"Buy now, pay later with ",ht),this.installmentPlan&&i("small",null,i("span",null,null===(t=this.installmentPlan)||void 0===t?void 0:t.installments.length)," ",i("span",null,this.installmentPlan.schedule," payments of")," ",i("span",{class:"fw-bold"},I(null===(e=this.installmentPlan)||void 0===e?void 0:e.installments[0].amountInCents))))):(console.warn("justifi-sezzle-payment-method: BNPL is not enabled for this account."),null)}},dt={[H.NEW_BANK_ACCOUNT]:"New bank account",[H.NEW_CARD]:"New credit or debit card"},ut="Payment form not ready",pt="Validation error",yt=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event",7),this.submitEvent=e(this,"submit-event",7),this.computedHideSubmitButton=!1,this.isLoading=!1,this.submitButtonText="Submit"}paymentMethodsChanged(){this.setDefaultSelectedPaymentMethod()}connectedCallback(){this.setDefaultSelectedPaymentMethod(),this.setComputedHideSubmitButton()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup(),this.unsubscribeFromStore&&this.unsubscribeFromStore()}componentWillLoad(){U(),this.analytics=new R(this)}handleRadioClick(t){this.selectedPaymentMethod=t.detail,w.selectedPaymentMethod={type:t.detail}}async tokenizePaymentMethod(t){null==t||t.preventDefault(),this.validateRequiredProps(),this.isLoading=!0;try{if(!(await this.validate()).isValid)return this.errorEvent.emit({errorCode:y.TOKENIZE_ERROR,message:pt}),void(this.isLoading=!1);const t=await this.resolvePaymentMethod({isValid:!0});return t.error&&this.emitError({errorCode:t.error.code,message:t.error.message}),this.submitEvent.emit({response:t}),t}catch(t){const e=this.createErrorResponse(y.TOKENIZE_ERROR,t.message);return this.emitError({errorCode:y.TOKENIZE_ERROR,message:t.message}),this.submitEvent.emit({response:e}),e}finally{this.isLoading=!1}}async fillBillingForm(t){w.billingFormFields=t}async validate(){if(!this.areFormsReady())return{isValid:!1,errors:{general:ut}};const[t,e]=await Promise.all([this.billingFormRef.validate(),this.paymentMethodFormRef.validate()]);return{isValid:t.isValid&&e.isValid,errors:Object.assign(Object.assign({},t.errors),e.errors)}}async getValues(){return this.billingFormRef.getValues()}async tokenize(){try{const t=await this.billingFormRef.getValues(),e={clientId:this.authToken||w.authToken,account:this.accountId||w.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||w.authToken||this.emitError({errorCode:y.TOKENIZE_ERROR,message:"Auth token is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"}),this.accountId||w.accountId||this.emitError({errorCode:y.TOKENIZE_ERROR,message:"Account ID is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"})}setDefaultSelectedPaymentMethod(){this.selectedPaymentMethod||(this.disableCreditCard?this.disableBankAccount||w.checkoutLoaded&&!w.achPaymentsEnabled||(this.selectedPaymentMethod=H.NEW_BANK_ACCOUNT,w.selectedPaymentMethod={type:H.NEW_BANK_ACCOUNT}):(this.selectedPaymentMethod=H.NEW_CARD,w.selectedPaymentMethod={type:H.NEW_CARD}))}setComputedHideSubmitButton(){if(void 0!==this.hideSubmitButton)return void(this.computedHideSubmitButton=this.hideSubmitButton);const t=this.isSlottedWithinModularCheckout();this.computedHideSubmitButton=t}isSlottedWithinModularCheckout(){var t;let e=null===(t=this.host)||void 0===t?void 0:t.parentElement;for(;e;){if("JUSTIFI-MODULAR-CHECKOUT"===e.tagName)return!0;e=e.parentElement}return!1}get availablePaymentMethods(){const t=[],e=!w.checkoutLoaded||w.achPaymentsEnabled;return this.disableCreditCard||t.push(H.NEW_CARD),!this.disableBankAccount&&e&&t.push(H.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:p.ERROR}))}createErrorResponse(t,e){return{error:{code:t,message:e,decline_code:void 0}}}async resolvePaymentMethod(t){if(!this.areFormsReady())return this.createErrorResponse("form_not_ready",ut);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||pt;return{validationError:!0,error:{code:"validation_error",message:String(t),decline_code:void 0}}}return await this.performTokenization()}catch(t){return{error:t}}}async performTokenization(){var t,e;const i=await this.tokenize();if(i.error)return{error:i.error};const s=i.data;return{token:(null===(t=s.card)||void 0===t?void 0:t.token)||(null===(e=s.bank_account)||void 0===e?void 0:e.token),data:s}}buildPaymentMethodMetadata(t){return this.shouldSavePaymentMethod?Object.assign(Object.assign({},t),{payment_method_group_id:this.paymentMethodGroupID}):Object.assign({},t)}get paymentMethodGroupID(){return this.paymentMethodGroupId||w.paymentMethodGroupId}get shouldSavePaymentMethod(){return!(!this.paymentMethodGroupId&&!w.savePaymentMethod)}get shouldHideRadioInput(){return this.disableCreditCard||this.disableBankAccount}renderPaymentMethodOption(t){const e=this.selectedPaymentMethod===t&&void 0===w.selectedPaymentMethod.id;return i("div",{class:"payment-method"},i("radio-list-item",{name:"paymentMethodType",value:t,checked:e,label:dt[t],hidden:this.shouldHideRadioInput}),e&&this.renderSelectedPaymentMethodForm(t))}renderSelectedPaymentMethodForm(t){return i("div",{class:"mt-4 pb-4"},this.renderPaymentMethodForm(t),i("div",{class:"mt-4"},i("billing-form",{ref:t=>{t&&(this.billingFormRef=t)},hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:t})),i("div",{class:"mt-4"},i("save-new-payment-method",{hidden:!this.paymentMethodGroupID,label:this.savePaymentMethodLabel})))}renderPaymentMethodForm(t){return i(t===H.NEW_CARD?"card-form":"bank-account-form",{ref:t=>{t&&(this.paymentMethodFormRef=t)}})}render(){return i(M,{key:"bc76697688be332ef84db56e61b6b455a6d1e986"},i("form",{key:"8f64f55f945d4ff4ed0f144c724dbd71278ec771"},i("fieldset",{key:"15b6d388117738391089cf91f999247cddb29714"},i("div",{key:"a4e23f7808b446dff6f7da437dba3cb57d2d62aa",class:"row gy-3"},i("div",{key:"63b0584d217d9bb50036eb7d5837e7287be58760",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),i("div",{key:"c9345be3429cd8ab01a84e8584270938feceba39",class:"col-12"},i("internal-button",{key:"aa56df7b6b1250e9b81fbc281b969d2a37a05428",text:this.submitButtonText,variant:"primary",type:"submit",clickHandler:t=>this.tokenizePaymentMethod(t),isLoading:this.isLoading,"data-testid":"submit-button",hidden:this.computedHideSubmitButton}))))))}get host(){return n(this)}static get watchers(){return{disableCreditCard:["paymentMethodsChanged"],disableBankAccount:["paymentMethodsChanged"]}}};export{$ as justifi_apple_pay,tt as justifi_button,et as justifi_checkout_summary,nt as justifi_google_pay,at as justifi_header,ot as justifi_modular_checkout,rt as justifi_plaid_payment_method,W as justifi_radio_list_item,lt as justifi_saved_payment_methods,ct as justifi_sezzle_payment_method,yt as justifi_tokenize_payment_method}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as o}from"./p-CV0Pyo1O.js";import{c as a}from"./p-
|
|
1
|
+
import{r as t,h as o}from"./p-CV0Pyo1O.js";import{c as a}from"./p-CxNdigHC.js";import{J as s}from"./p-Bo36V7ni.js";import{w as r}from"./p-DVJaoI_m.js";import{S as i}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import"./p-BP7jEC_K.js";import"./p-CP0Y19co.js";import"./p-BM88Upl5.js";import"./p-HXpYMWUU.js";import"./p-Cl5FLD11.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";const p=class{constructor(o){t(this,o)}async componentWillLoad(){await r(),a(),this.analytics=new s(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return!!this.bankAccountFormElement&&this.bankAccountFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:o,account:a}){return this.bankAccountFormElement?this.bankAccountFormElement.tokenize({clientId:t,paymentMethodMetadata:o,account:a}):{error:{message:"Bank account form is not available."}}}render(){return o(i,{key:"3c8a48f6060f14433ae94399fc48097cb138e301"},o("bank-account-form",{key:"30cd40b60629f5c7f874194dd7641ee3737e8b69",ref:t=>this.bankAccountFormElement=t}))}};export{p as justifi_bank_account_form}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as t,h as s}from"./p-CV0Pyo1O.js";import{f as i}from"./p-BSs-2JKu.js";import{t as a,a8 as r}from"./p-CPKMvyV_.js";import{B as d}from"./p-CHo7TfsM.js";import{S as c}from"./p-uZ5KAseb.js";import"./p-CZfYo5-1.js";import{C as o,b as n}from"./p-DXTa04jn.js";import{g as h,a as p}from"./p-CdwzNfP1.js";import{D as f,a as l}from"./p-C7hX61pS.js";import{c as b}from"./p-CqOzVXGL.js";import{J as u}from"./p-CfIGO7TJ.js";import"./p-HXpYMWUU.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-Bx2_PW91.js";const y=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.submitDisputeResponse(t,e,i);if(d.error){return r({error:p(d.error),code:h(null===(c=d.error)||void 0===c?void 0:c.code),severity:o.ERROR})}a(d)}catch(e){const t=h(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:o.ERROR})}finally{d()}},v=class{constructor(s){e(this,s),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.submitEvent=t(this,"submit-event",7)}acceptDispute(){y({disputeId:this.dispute.id,authToken:this.authToken,service:new l})({payload:{forfeit:!0},onSuccess:e=>{this.submitEvent.emit({response:e})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}})}initiateRespondToDispute(){this.clickEvent.emit({name:f.respondToDispute})}isDueDatePassed(){var e;if(!(null===(e=this.dispute)||void 0===e?void 0:e.due_date))return!1;const t=new Date(this.dispute.due_date.replace(/-/g,"/").replace(/T.+/,"")),s=new Date;return s.setHours(0,0,0,0),t.setHours(0,0,0,0),t<s}render(){var e,t,o,n,h,p,f,l,b;return s("div",{key:"325018c414e82b5c1bc7d9c5aa444b5a9d4e83d6",class:"dispute-notification-root"},this.isLoading&&s("div",{key:"deffb8ef248e32962aca084a564e83aa5f222b0a",style:{marginBottom:"8px"}},s(c,{key:"6f6c630b3122b1b2fd480470f5df7683f19de612",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(c,{key:"11f46711fed1094496c64551f084351c08f598be",height:"18px",styles:{marginBottom:"8px"}}),s(c,{key:"fc7e2eac76e1cbc329147f3da39a8c28c51a7b6a",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&this.isDueDatePassed()&&s("div",{key:"0ef159acf9fe5b12dc0dcddab6b7583e5fc9a799",part:a},s("h1",{key:"db263006990c5b4cf178f7f81650ad7602765532",class:"h4",part:r},"The due date (",null===(t=this.dispute)||void 0===t?void 0:t.due_date,") for this dispute has passed"),s("p",{key:"185c6f952ef46e3aec625cab73c943b3046ef6b4"},"You can no longer submit evidence to counter this dispute.")),(null===(o=this.dispute)||void 0===o?void 0:o.needsResponse)&&!this.isDueDatePassed()&&s("div",{key:"d4536104addc500277fbde990b7b33ba8ff54c7e",part:a},s("h1",{key:"198138cc6541c0aeeae458e2de1e3ae0c695328d",class:"h4",part:r},"This payment is disputed"),s("p",{key:"6902ce5e3e94ab7f71ee6d0c6a7604ef97f0e740"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"f49d1ac855365480edc61e0af117230e2f3dbe1f",class:"h5"},"Dispute details"),s("div",{key:"f3868a098dbc4a613d676b8580c053527f9d5fad",class:"d-table gap-2"},s("div",{key:"7699bc619b652ffe1c77cf6e5e0dac967679b1e6",class:"d-table-row gap-2"},s("span",{key:"9de67b45877120f54f724f1efe7b3f4d4b035d30",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"bfd79f86b5b81daf2a34f5874fcff03a05d1e64d",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(n=this.dispute)||void 0===n?void 0:n.amount))),s("div",{key:"0e57d56172859eb5857a1930cb837569157026d9",class:"d-table-row gap-2"},s("span",{key:"0b615bd8f9a9add7d18d50be4f4f644707576de2",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"46288c67be32fe2d95fea88f5b0148f22552a2c9",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(h=this.dispute)||void 0===h?void 0:h.reason)),s("div",{key:"c68280b0f36280804fb6231236d942174c189456",class:"d-table-row gap-2"},s("span",{key:"ed3f145aa0f2c949b80d7033e4ecb818a4a4fa68",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Due Date"),s("span",{key:"4c4530acbc570fb13b5f53947714bd250ff99cab",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(p=this.dispute)||void 0===p?void 0:p.due_date))),s("div",{key:"3244bb6bdbed2b4e28c479c2d4db2d0ae152f2f0",class:"d-flex gap-2 mt-4 justify-content-end"},s(d,{key:"3716a28cec93e70690ad96bfc0c5f3b7b56f8ecb",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(d,{key:"7f326ed6f298c9f1091b160c63e386864329190e",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(f=this.dispute)||void 0===f?void 0:f.underReview)&&s("div",{key:"d705ae48c1f30b904ac31bbdbab9e955868f51e1",part:a},s("h1",{key:"712cebef3699a8c2a97bcb69ae68e0b491090c88",class:"h4",part:r},"This payment is disputed and under review"),s("p",{key:"ca95b2c8bdc6083a3fbb1dd63c6bdaa4699ae2a7"},"The cardholder is disputing this payment. A counter dispute has been submitted and is under review.")),(null===(l=this.dispute)||void 0===l?void 0:l.won)&&s("div",{key:"c0cb4c8342aa4f022d76e95123a047b7b707f562",part:a},s("h1",{key:"797966d237d4b46eb1b880deb7fa21746f5b3b1e",class:"h4",part:r},"This payment was disputed"),s("p",{key:"2f9eed1a5f34f772206112488af22aa8b35c07b6"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(b=this.dispute)||void 0===b?void 0:b.lost)&&s("div",{key:"9a90af51218ed921e27519363995f12e29713bfd",part:a},s("h1",{key:"736ee5cf8f65d780d4812e24ea9050dcc0d109a4",class:"h4",part:r},"This payment was disputed"),s("p",{key:"9ca83087b028e1078bcc2cd0b552e8f5379932d1"},"The cardholder disputed this payment and the card issuer has settled it in their favor.")))}},m=class{constructor(i){e(this,i),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.submitEvent=t(this,"submit-event",7),this.errorMessage=null,this.disputeResponse={},this.apiOrigin="https://wc-proxy.justifi.ai",this.isLoading=!1,this.documentList=[],this.documentErrors={},this.currentStep=0,this.componentStepMapping=[()=>s("product-or-service",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("customer-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("cancellation-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("refund-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("duplicate-charge",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("electronic-evidence",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("shipping-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("additional-statement",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors})],this.saveData=async(e,t)=>{if(Object.keys(e).length)return this.isLastStep?this.submitDisputeResponse({payload:e,onSuccess:e=>{this.submitEvent.emit({response:e}),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}}):this.updateDisputeResponse({payload:e,onSuccess:e=>{this.disputeResponse=Object.assign({},e.data),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}});this.stepCompleteEvent.emit({response:null,formStep:t})},this.initializeMakePresignedURLs=async()=>{const e=this.documentList.map((e=>this.getPresignedFileUrl(e)));return await Promise.all(e)},this.initializeFileUploads=async()=>{const e=this.documentList.map((e=>this.uploadDocument(e)));return Promise.all(e)},this.getPresignedFileUrl=async e=>this.createDisputeEvidence({payload:{file_name:e.file_name,file_type:e.file_type,dispute_evidence_type:e.dispute_evidence_type},onSuccess:t=>{e.presignedUrl=t.data.presigned_url},onError:({error:t,code:s,severity:i})=>{const a={[e.dispute_evidence_type]:t};this.documentErrors=Object.assign(Object.assign({},this.documentErrors),a),this.errorEvent.emit({errorCode:s,message:t,severity:i})}}),this.uploadDocument=async e=>{const t=await e.getFileString();if(!e.presignedUrl)throw new Error("Presigned URL is not set");return await fetch(e.presignedUrl,{method:"PUT",body:t})},this.handleSubmit=async(e,t,s)=>{if(this.isLoading=!0,t.length){if(this.documentErrors={},this.documentList=t,await this.initializeMakePresignedURLs(),Object.keys(this.documentErrors).length)throw this.isLoading=!1,new Error("Could not presign all documents");await this.initializeFileUploads()}await this.saveData(e,s),this.isLoading=!1},this.onCancel=()=>{this.clickEvent.emit({name:f.cancelDispute})},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:f.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:f.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:f.submit});const i=Object.assign(Object.assign({},e),{forfeit:!1});await this.handleSubmit(i,t,s)}))}}componentWillLoad(){b(),this.analytics=new u(this),this.initializeDisputeServiceMethods()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeDisputeServiceMethods()}initializeDisputeServiceMethods(){this.disputeId&&this.authToken?(this.updateDisputeResponse=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.updateDisputeResponse(t,e,i);if(d.error)return r({error:p(d.error),code:h(null===(c=d.error)||void 0===c?void 0:c.code),severity:o.ERROR});a(d)}catch(e){const t=h(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:o.ERROR})}finally{d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.createDisputeEvidence(t,e,i);if(d.error)return r({error:p(d.error),code:h(null===(c=d.error)||void 0===c?void 0:c.code),severity:o.ERROR});a(d)}catch(e){const t=h(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:o.ERROR})}finally{d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.submitDisputeResponse=y({disputeId:this.disputeId,authToken:this.authToken,service:new l})):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:n.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}get isLastStep(){return this.currentStep===this.componentStepMapping.length-1}get isFirstStep(){return 0===this.currentStep}render(){return s("div",{key:"7f9c8d56cfb86cea73ab2f299b83ff0de28f5c3e",class:"dispute-response-root"},s("div",{key:"a805bf54df79453127557bf651c3d776a381241f",class:"row gy-3"},s("div",{key:"2e6bc9cbe369e0ea5d200bc0934b4cad50f3c76f",class:"col-12"},s("h1",{key:"9876e9c87c6dfb405e7bad46d64fdb40ad048142",class:"h4",part:r},"Counter dispute")),s("div",{key:"045028232da5331c7041ad222c4e98364674ace3",class:"col-12"},this.currentStepComponent),s("div",{key:"0455c4856a44340ce25c1c4c8f776abb197f919f",class:"col-12"},s("div",{key:"5b990cc1d41b3a7152d727c941e9758ed70f75a1",class:"d-flex gap-2 mt-4 justify-content-end"},this.isFirstStep?s(d,{variant:"secondary",onClick:()=>this.onCancel(),disabled:this.isLoading,isLoading:this.isLoading},"Cancel"):s(d,{variant:"secondary",onClick:()=>this.onBack(),disabled:this.isLoading,isLoading:this.isLoading},"Back"),this.isLastStep?s(d,{variant:"primary",onClick:()=>this.onSubmit(),disabled:this.isLoading,isLoading:this.isLoading},"Submit Counter Dispute"):s(d,{variant:"primary",onClick:()=>this.onNext(),disabled:this.isLoading,isLoading:this.isLoading},"Next")))))}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{v as dispute_notification,m as dispute_response}
|
|
1
|
+
import{r as e,c as t,h as s}from"./p-CV0Pyo1O.js";import{f as i}from"./p-BM88Upl5.js";import{t as a,a8 as r}from"./p-CPKMvyV_.js";import{B as d}from"./p-CHo7TfsM.js";import{S as c}from"./p-uZ5KAseb.js";import"./p-CZfYo5-1.js";import{C as o,b as n}from"./p-Cl5FLD11.js";import{g as h,a as p}from"./p-IFhZFB4v.js";import{D as f,a as l}from"./p-B7wfdVBf.js";import{c as b}from"./p-CxNdigHC.js";import{J as u}from"./p-Bo36V7ni.js";import"./p-HXpYMWUU.js";import"./p-CP0Y19co.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BP7jEC_K.js";const y=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.submitDisputeResponse(t,e,i);if(d.error){return r({error:p(d.error),code:h(null===(c=d.error)||void 0===c?void 0:c.code),severity:o.ERROR})}a(d)}catch(e){const t=h(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:o.ERROR})}finally{d()}},v=class{constructor(s){e(this,s),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.submitEvent=t(this,"submit-event",7)}acceptDispute(){y({disputeId:this.dispute.id,authToken:this.authToken,service:new l})({payload:{forfeit:!0},onSuccess:e=>{this.submitEvent.emit({response:e})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}})}initiateRespondToDispute(){this.clickEvent.emit({name:f.respondToDispute})}isDueDatePassed(){var e;if(!(null===(e=this.dispute)||void 0===e?void 0:e.due_date))return!1;const t=new Date(this.dispute.due_date.replace(/-/g,"/").replace(/T.+/,"")),s=new Date;return s.setHours(0,0,0,0),t.setHours(0,0,0,0),t<s}render(){var e,t,o,n,h,p,f,l,b;return s("div",{key:"325018c414e82b5c1bc7d9c5aa444b5a9d4e83d6",class:"dispute-notification-root"},this.isLoading&&s("div",{key:"deffb8ef248e32962aca084a564e83aa5f222b0a",style:{marginBottom:"8px"}},s(c,{key:"6f6c630b3122b1b2fd480470f5df7683f19de612",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(c,{key:"11f46711fed1094496c64551f084351c08f598be",height:"18px",styles:{marginBottom:"8px"}}),s(c,{key:"fc7e2eac76e1cbc329147f3da39a8c28c51a7b6a",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&this.isDueDatePassed()&&s("div",{key:"0ef159acf9fe5b12dc0dcddab6b7583e5fc9a799",part:a},s("h1",{key:"db263006990c5b4cf178f7f81650ad7602765532",class:"h4",part:r},"The due date (",null===(t=this.dispute)||void 0===t?void 0:t.due_date,") for this dispute has passed"),s("p",{key:"185c6f952ef46e3aec625cab73c943b3046ef6b4"},"You can no longer submit evidence to counter this dispute.")),(null===(o=this.dispute)||void 0===o?void 0:o.needsResponse)&&!this.isDueDatePassed()&&s("div",{key:"d4536104addc500277fbde990b7b33ba8ff54c7e",part:a},s("h1",{key:"198138cc6541c0aeeae458e2de1e3ae0c695328d",class:"h4",part:r},"This payment is disputed"),s("p",{key:"6902ce5e3e94ab7f71ee6d0c6a7604ef97f0e740"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"f49d1ac855365480edc61e0af117230e2f3dbe1f",class:"h5"},"Dispute details"),s("div",{key:"f3868a098dbc4a613d676b8580c053527f9d5fad",class:"d-table gap-2"},s("div",{key:"7699bc619b652ffe1c77cf6e5e0dac967679b1e6",class:"d-table-row gap-2"},s("span",{key:"9de67b45877120f54f724f1efe7b3f4d4b035d30",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"bfd79f86b5b81daf2a34f5874fcff03a05d1e64d",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(n=this.dispute)||void 0===n?void 0:n.amount))),s("div",{key:"0e57d56172859eb5857a1930cb837569157026d9",class:"d-table-row gap-2"},s("span",{key:"0b615bd8f9a9add7d18d50be4f4f644707576de2",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"46288c67be32fe2d95fea88f5b0148f22552a2c9",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(h=this.dispute)||void 0===h?void 0:h.reason)),s("div",{key:"c68280b0f36280804fb6231236d942174c189456",class:"d-table-row gap-2"},s("span",{key:"ed3f145aa0f2c949b80d7033e4ecb818a4a4fa68",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Due Date"),s("span",{key:"4c4530acbc570fb13b5f53947714bd250ff99cab",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(p=this.dispute)||void 0===p?void 0:p.due_date))),s("div",{key:"3244bb6bdbed2b4e28c479c2d4db2d0ae152f2f0",class:"d-flex gap-2 mt-4 justify-content-end"},s(d,{key:"3716a28cec93e70690ad96bfc0c5f3b7b56f8ecb",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(d,{key:"7f326ed6f298c9f1091b160c63e386864329190e",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(f=this.dispute)||void 0===f?void 0:f.underReview)&&s("div",{key:"d705ae48c1f30b904ac31bbdbab9e955868f51e1",part:a},s("h1",{key:"712cebef3699a8c2a97bcb69ae68e0b491090c88",class:"h4",part:r},"This payment is disputed and under review"),s("p",{key:"ca95b2c8bdc6083a3fbb1dd63c6bdaa4699ae2a7"},"The cardholder is disputing this payment. A counter dispute has been submitted and is under review.")),(null===(l=this.dispute)||void 0===l?void 0:l.won)&&s("div",{key:"c0cb4c8342aa4f022d76e95123a047b7b707f562",part:a},s("h1",{key:"797966d237d4b46eb1b880deb7fa21746f5b3b1e",class:"h4",part:r},"This payment was disputed"),s("p",{key:"2f9eed1a5f34f772206112488af22aa8b35c07b6"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(b=this.dispute)||void 0===b?void 0:b.lost)&&s("div",{key:"9a90af51218ed921e27519363995f12e29713bfd",part:a},s("h1",{key:"736ee5cf8f65d780d4812e24ea9050dcc0d109a4",class:"h4",part:r},"This payment was disputed"),s("p",{key:"9ca83087b028e1078bcc2cd0b552e8f5379932d1"},"The cardholder disputed this payment and the card issuer has settled it in their favor.")))}},m=class{constructor(i){e(this,i),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.submitEvent=t(this,"submit-event",7),this.errorMessage=null,this.disputeResponse={},this.apiOrigin="https://wc-proxy.justifi.ai",this.isLoading=!1,this.documentList=[],this.documentErrors={},this.currentStep=0,this.componentStepMapping=[()=>s("product-or-service",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("customer-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("cancellation-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("refund-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("duplicate-charge",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("electronic-evidence",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("shipping-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("additional-statement",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors})],this.saveData=async(e,t)=>{if(Object.keys(e).length)return this.isLastStep?this.submitDisputeResponse({payload:e,onSuccess:e=>{this.submitEvent.emit({response:e}),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}}):this.updateDisputeResponse({payload:e,onSuccess:e=>{this.disputeResponse=Object.assign({},e.data),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}});this.stepCompleteEvent.emit({response:null,formStep:t})},this.initializeMakePresignedURLs=async()=>{const e=this.documentList.map((e=>this.getPresignedFileUrl(e)));return await Promise.all(e)},this.initializeFileUploads=async()=>{const e=this.documentList.map((e=>this.uploadDocument(e)));return Promise.all(e)},this.getPresignedFileUrl=async e=>this.createDisputeEvidence({payload:{file_name:e.file_name,file_type:e.file_type,dispute_evidence_type:e.dispute_evidence_type},onSuccess:t=>{e.presignedUrl=t.data.presigned_url},onError:({error:t,code:s,severity:i})=>{const a={[e.dispute_evidence_type]:t};this.documentErrors=Object.assign(Object.assign({},this.documentErrors),a),this.errorEvent.emit({errorCode:s,message:t,severity:i})}}),this.uploadDocument=async e=>{const t=await e.getFileString();if(!e.presignedUrl)throw new Error("Presigned URL is not set");return await fetch(e.presignedUrl,{method:"PUT",body:t})},this.handleSubmit=async(e,t,s)=>{if(this.isLoading=!0,t.length){if(this.documentErrors={},this.documentList=t,await this.initializeMakePresignedURLs(),Object.keys(this.documentErrors).length)throw this.isLoading=!1,new Error("Could not presign all documents");await this.initializeFileUploads()}await this.saveData(e,s),this.isLoading=!1},this.onCancel=()=>{this.clickEvent.emit({name:f.cancelDispute})},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:f.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:f.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:f.submit});const i=Object.assign(Object.assign({},e),{forfeit:!1});await this.handleSubmit(i,t,s)}))}}componentWillLoad(){b(),this.analytics=new u(this),this.initializeDisputeServiceMethods()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeDisputeServiceMethods()}initializeDisputeServiceMethods(){this.disputeId&&this.authToken?(this.updateDisputeResponse=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.updateDisputeResponse(t,e,i);if(d.error)return r({error:p(d.error),code:h(null===(c=d.error)||void 0===c?void 0:c.code),severity:o.ERROR});a(d)}catch(e){const t=h(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:o.ERROR})}finally{d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.createDisputeEvidence(t,e,i);if(d.error)return r({error:p(d.error),code:h(null===(c=d.error)||void 0===c?void 0:c.code),severity:o.ERROR});a(d)}catch(e){const t=h(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:o.ERROR})}finally{d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.submitDisputeResponse=y({disputeId:this.disputeId,authToken:this.authToken,service:new l})):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:n.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}get isLastStep(){return this.currentStep===this.componentStepMapping.length-1}get isFirstStep(){return 0===this.currentStep}render(){return s("div",{key:"7f9c8d56cfb86cea73ab2f299b83ff0de28f5c3e",class:"dispute-response-root"},s("div",{key:"a805bf54df79453127557bf651c3d776a381241f",class:"row gy-3"},s("div",{key:"2e6bc9cbe369e0ea5d200bc0934b4cad50f3c76f",class:"col-12"},s("h1",{key:"9876e9c87c6dfb405e7bad46d64fdb40ad048142",class:"h4",part:r},"Counter dispute")),s("div",{key:"045028232da5331c7041ad222c4e98364674ace3",class:"col-12"},this.currentStepComponent),s("div",{key:"0455c4856a44340ce25c1c4c8f776abb197f919f",class:"col-12"},s("div",{key:"5b990cc1d41b3a7152d727c941e9758ed70f75a1",class:"d-flex gap-2 mt-4 justify-content-end"},this.isFirstStep?s(d,{variant:"secondary",onClick:()=>this.onCancel(),disabled:this.isLoading,isLoading:this.isLoading},"Cancel"):s(d,{variant:"secondary",onClick:()=>this.onBack(),disabled:this.isLoading,isLoading:this.isLoading},"Back"),this.isLastStep?s(d,{variant:"primary",onClick:()=>this.onSubmit(),disabled:this.isLoading,isLoading:this.isLoading},"Submit Counter Dispute"):s(d,{variant:"primary",onClick:()=>this.onNext(),disabled:this.isLoading,isLoading:this.isLoading},"Next")))))}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{v as dispute_notification,m as dispute_response}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-
|
|
1
|
+
import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-DWdj6UhE.js";import{m as i}from"./p-CWook735.js";import{C as d,b as c,i as f,h as l}from"./p-Cl5FLD11.js";import{J as h}from"./p-Bo36V7ni.js";import{c as r}from"./p-CxNdigHC.js";import"./p-DVJaoI_m.js";import{b as o,d as b,s as p}from"./p-BM88Upl5.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{P as n,M as m}from"./p-D1_eip6x.js";import{a as y,b as u,D as v,c as k,C as j,E as C}from"./p-Cu7hgXL1.js";import{S as g}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as w}from"./p-uZ5KAseb.js";import{a as D,B as P}from"./p-CHw7tICr.js";import"./p-CP0Y19co.js";import"./p-HXpYMWUU.js";import"./p-IFhZFB4v.js";import"./p-BP7jEC_K.js";import"./p-D8GTwl9v.js";import"./p-CPKMvyV_.js";const x=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(w,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(w,{width:"70%"})),e("div",{class:"col-12"},e(w,{width:"40%"})),e("div",{class:"col-12"},e(w,{width:"40%"})),e("div",{class:"col-12"},e(w,{width:"100%"})),e("div",{class:"col-12"},e(w,{width:"80%"}))),T=class{constructor(e){t(this,e),this.errorEvent=a(this,"error-event",7),this.recordClickEvent=a(this,"record-click-event",7),this.loading=!0}componentWillLoad(){r(),this.analytics=new h(this),this.initializeGetPaymentDetails()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeGetPaymentDetails()}initializeGetPaymentDetails(){this.paymentId&&this.authToken?(this.getPaymentDetails=i({id:this.paymentId,authToken:this.authToken,service:new s}),this.fetchData()):(this.errorMessage="Payment ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:c.MISSING_PROPS,severity:d.ERROR}))}updateOnPropChange(){this.getPaymentDetails&&this.fetchData()}fetchData(){this.loading=!0,this.getPaymentDetails({onSuccess:({payment:e})=>{this.payment=e,this.errorMessage=null},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({errorCode:t,message:e,severity:a})},final:()=>{this.loading=!1}})}get PaymentStatus(){return this.payment.status===f.disputed&&this.payment.disputes.some((e=>e.status===l.lost))?n.DISPUTE_LOST:this.payment.status}render(){return e(g,{key:"f304cb665f17ce96b6d97a38d94907629f559413"},this.loading&&e(x,{key:"709acde31230bd9e825e4e9669234492aff3cc3a"}),!this.loading&&this.errorMessage&&C(this.errorMessage),!this.loading&&!this.errorMessage&&this.payment&&e("justifi-details",{key:"09a4a2559fb89a5b4b57d81b0fd48952c219d348",errorMessage:this.errorMessage},e(y,{key:"7cbfece91ce9e5fab75d561ad369080ecbe76fa4",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},m(this.PaymentStatus),this.payment.expedited?e(D,{variant:P.WARNING,title:"Expedited",text:"Expedited"}):null),title:this.payment.formattedPaymentAmount(this.payment.amount)},e(u,{key:"4aa014d77def141d2053c3745b8215cc03a53ac7",classes:"border-1 border-end",title:"Updated At",value:`${o(this.payment.updated_at)} ${b(this.payment.updated_at)}`}),e(u,{key:"f344398f4fd4db6e1e7ca1335c3aa55630668475",classes:"border-1 border-end",title:"Created At",value:`${o(this.payment.created_at)} ${b(this.payment.created_at)}`}),e(u,{key:"a01e5a04400b996cfb2a9e563c8f383b8e8d7c66",title:"ID",value:this.payment.id})),e("div",{key:"ef0c63d53031dfa8910dfbdedede1e20ac09e78a",slot:"detail-sections"},e(v,{key:"5053784a7e3bd8932562a816921564aadd6d79c8",sectionTitle:"Details"}),e("div",{key:"43c56ee5a39589ea7a0107f32e274be439adf33a",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"fcee2dd211c9bf951cdd6855ac3fa844632391ce",title:"Amount",value:this.payment.formattedPaymentAmount(this.payment.amount)}),e(k,{key:"44d055f3445f02feaeb4519b5f4777333089a8c6",title:"Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"906b584174bd5c329974274a2f1e1ef7e9e8fde0",title:"Refunded",value:this.payment.formattedPaymentAmount(this.payment.amount_refunded)}),e(k,{key:"809429e88eac8ebe8142bb0028f8b86447977697",title:"Net",value:this.payment.formattedPaymentAmount(this.payment.balance)}),e(k,{key:"e08c02efc64f105ce3180e9773584a331ae19a9b",title:"Status",value:m(this.PaymentStatus)}),e(k,{key:"fbb910b7006f9d4bff9b14ffd4fc2f7da8b68020",title:"Payment ID",value:this.payment.id}),e(k,{key:"09fefc2d1a750ab2f5dfb2043db08d5f16d6d9aa",title:"Processing Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"1d96f4557823f1d82d5c6e0e46a984c13c6f018b",title:"Statement Descriptor",value:this.payment.statement_descriptor}),e(k,{key:"51bfae7ef30f36c99c0fa1b25dc5397720ef88ff",title:"Description",value:this.payment.description}),e(k,{key:"5c44b3d40bfe6b2fbf258fee90f55ff24d0b3c28",title:"Expedited",value:this.payment.expedited?"Yes":"No"})),this.payment.payment_method.card&&[e(v,{key:"3d652ba331824448b7e7af969b2ead216f358e28",sectionTitle:"Payment Method"}),e("div",{key:"49ad00ec9d703d196a025fa17b03f4af7cdc4dc5",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"2b1b3f57e74fd65dc4b82d727a94afbe14803c52",title:"ID",value:this.payment.payment_method.card.id}),e(k,{key:"b23d5263566ff11d469dea9a245d20a7689540f8",title:"Payment Type",value:"Card"}),e(k,{key:"f5f76d6d9ac609884aac18fe2743d4fad2192b86",title:"Last 4 Numbers",value:this.payment.payment_method.lastFourDigits}),e(k,{key:"22f296966b6f1aaf516b1d70144cff4f59b82c05",title:"Brand",value:p(this.payment.payment_method.card.brand)}),e(k,{key:"d7dcd0f7a74ed2cc5ba6406a7d48522ca06a7546",title:"Cardholder",value:this.payment.payment_method.payersName}))],this.payment.payment_method.bank_account&&[e(v,{key:"37a2a20c462cb94baa01ca7763d43ced04b4543c",sectionTitle:"Payment Method"}),e("div",{key:"f6de7746d5ff64d27368edef51b3c4e0ff7c658b",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"34e9b26c6d20e9b5e86e4cc11fb925ff1ef5ce94",title:"ID",value:this.payment.payment_method.bank_account.id}),e(k,{key:"32cd6da4d7234aca403bd699de23e1cf889bf14f",title:"Last 4 Numbers",value:this.payment.last_four_digits}),e(k,{key:"f1313ac7c15d5ae2d9dfa2b6d3ec794d0987252b",title:"Bank Name",value:this.payment.payment_method.bank_account.brand}),e(k,{key:"76d1ac1961e530a7a6e1ba5512b982cd70df9470",title:"Account Owner",value:this.payment.payment_method.payersName}))],this.payment.metadata&&[e(v,{key:"1cff262d07acda5bc742f325a23f4199c22f3a01",sectionTitle:"Metadata"}),e("div",{key:"77379785d2559d39a26a253757fdaf02795c53a1",class:"d-table gap-2 w-100"},e(j,{key:"92cb32f3dd6b45094210194e2e40927d7f9d6bde",metadata:this.payment.metadata}))])))}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"],getPaymentDetails:["updateOnPropChange"]}}};export{T as justifi_payment_details}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as t,h as i}from"./p-CV0Pyo1O.js";import{J as s}from"./p-
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-CV0Pyo1O.js";import{J as s}from"./p-Bo36V7ni.js";import{c as a}from"./p-CxNdigHC.js";import{c}from"./p-DyPk4BJt.js";import{c as d}from"./p-CPKMvyV_.js";import{S as o}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{P as b}from"./p-DkoufM1t.js";import"./p-BP7jEC_K.js";import"./p-CP0Y19co.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BM88Upl5.js";import"./p-HXpYMWUU.js";import"./p-Cl5FLD11.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const h=class{constructor(i){e(this,i),this.errorEvent=t(this,"error-event",7),this.loadedEvent=t(this,"loaded",7),this.submitEvent=t(this,"submit-event",7),this.availablePaymentMethods=[],this.errorMessage="",this.insuranceToggled=!1,this.disableBankAccount=!1,this.disableBnpl=!1,this.disableCreditCard=!1,this.disablePaymentMethodGroup=!1,this.hideBankAccountBillingForm=!1,this.hideCardBillingForm=!1}propChanged(){this.updateStore()}connectedCallback(){this.authToken&&this.checkoutId&&this.updateStore()}componentWillLoad(){a(),this.analytics=new s(this)}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}checkoutComplete(e){c.isSubmitting=!1}checkoutError(e){c.isSubmitting=!1}checkoutChanged(e){this.availablePaymentMethods=this.disableBnpl?e.detail.availablePaymentMethodTypes.filter((e=>e!==b.SEZZLE)):e.detail.availablePaymentMethodTypes}async fillBillingForm(e){c.billingFormFields=e}async validate(){var e;return{isValid:await(null===(e=this.modularCheckoutRef)||void 0===e?void 0:e.validate())}}updateStore(){c.checkoutId=this.checkoutId,c.authToken=this.authToken,c.disableCreditCard=this.disableCreditCard,c.disableBankAccount=this.disableBankAccount,c.disablePaymentMethodGroup=this.disablePaymentMethodGroup}async submit(e){var t;null===(t=this.modularCheckoutRef)||void 0===t||t.submitCheckout(c.billingFormFields)}get showPaymentTypeHeader(){return!this.disableCreditCard&&!this.disableBankAccount}render(){var e,t;return i(o,{key:"bc8428227b2fc0e0753c4ef4e2370cd34bd34e82"},i("justifi-modular-checkout",{key:"9fda18728d6fb5b20716070cefc2fcf8ef097459",ref:e=>{this.modularCheckoutRef=e},authToken:this.authToken,checkoutId:this.checkoutId,preCompleteHook:this.preCompleteHook},i("div",{key:"e39f9871696d44cea2080198c7b91d03b706f2fd",class:"row gy-3 jfi-checkout-core"},i("div",{key:"df6045e9394b10f9b3e4b86e1a2242db30cc9b7b",class:"col-12",part:d},i("justifi-header",{key:"8f4332bd43371106faf4e264fd5b27c97cb589aa",text:"Summary",level:"h2",class:"fs-5 fw-bold pb-3"}),i("section",{key:"a7170276f18b9fa4b085c4d5de35979d55935929"},i("justifi-checkout-summary",{key:"109aceb53ad2500e927230b3f82bbb07ab3f604c"}))),i("div",{key:"902e040bbd591408c9d292a592ca4d31fc838d85",class:"col-12 mt-4"},i("slot",{key:"2677cb4952d88a8ce8f0198b96ed2638d4f4e6eb",name:"insurance"})),i("div",{key:"32c033bba12a7b7bf26159bd1878d6fa4ed913d9",class:"col-12 mt-4"},i("justifi-header",{key:"74543b63c1b94a5200ad36236818fce7345d5d76",text:"Payment",level:"h2",class:"fs-5 fw-bold pb-3"}),this.showPaymentTypeHeader&&i("justifi-header",{key:"8e7c56c75bb779211b72c0b8561df8283b731ca1",text:"Select payment type",level:"h3",class:"fs-6 fw-bold lh-lg"}),i("div",{key:"c2b0a875169b46dcd7d73428e3f1a4825b380ce5",class:"d-flex flex-column"},i("section",{key:"c5f007674c058e88d271c17f0b6b9c959bd0e044"},i("div",{key:"2c4ecdd0f8708f9f80bae50362ba7fab295f788f"},this.availablePaymentMethods.includes(b.APPLE_PAY)&&i("div",{key:"5ac363a3b7c38cb3f10e9c2c7916825f0f5dc2d8",class:"mb-3"},i("justifi-apple-pay",{key:"498c03630e4057b54ebd12a3cd87b6b6bdb00c4b"})),this.availablePaymentMethods.includes(b.GOOGLE_PAY)&&i("div",{key:"8c8114d142927739a3217d3a0a44c34c89e58f83",class:"mb-3"},i("justifi-google-pay",Object.assign({key:"a2fbc5b99a83fbc52698422d2f57a3380f97733f",ref:e=>this.googlePayRef=e},null!=this.googlePayEnv?{environment:this.googlePayEnv}:{}))),i("justifi-saved-payment-methods",{key:"2e5b27eea7ef433e950feadae0b0a07f8b613533"}),this.availablePaymentMethods.includes(b.SEZZLE)&&i("justifi-radio-list-item",{key:"fb1501c51eaf836579547bc50c295ebb67cb09c1",name:"paymentMethodType",value:b.SEZZLE,checked:(null===(e=null==c?void 0:c.selectedPaymentMethod)||void 0===e?void 0:e.type)===b.SEZZLE,label:i("justifi-sezzle-payment-method",{ref:e=>this.sezzlePaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.sezzlePaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),this.availablePaymentMethods.includes(b.PLAID)&&!this.disableBnpl&&i("justifi-radio-list-item",{key:"49e0687b4955fb92935783250540fe38350bbdcc",name:"paymentMethodType",value:b.PLAID,checked:(null===(t=null==c?void 0:c.selectedPaymentMethod)||void 0===t?void 0:t.type)===b.PLAID,label:i("justifi-plaid-payment-method",{ref:e=>this.plaidPaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.plaidPaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),i("justifi-tokenize-payment-method",{key:"ba793274de073c8a60c063e9caedcf32780b4bbf",ref:e=>this.tokenizePaymentMethodRef=e,authToken:this.authToken,accountId:c.accountId,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,hideSubmitButton:!0,paymentMethodGroupId:c.paymentMethodGroupId}))))),i("div",{key:"ed7be422c4e369382fd42e0b0162357df7de2031",class:"mt-4"},i("justifi-button",{key:"849d648feec5ce805d6eb87acacf94d62e7a8f1b",text:"Pay",type:"submit",variant:"primary",clickHandler:e=>this.submit(e),disabled:c.isSubmitting||c.isWalletProcessing,isLoading:c.isSubmitting||c.isWalletProcessing,customStyle:{width:"100%",textAlign:"center"}})))))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"],disableCreditCard:["propChanged"],disableBankAccount:["propChanged"],disablePaymentMethodGroup:["propChanged"]}}};export{h as justifi_checkout}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,h as e}from"./p-CV0Pyo1O.js";import{f as t,p as s,c as d}from"./p-AMVhBsGv.js";import{f as l,a as r}from"./p-CPKMvyV_.js";import{S as i}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{c as o,a as
|
|
1
|
+
import{r as a,h as e}from"./p-CV0Pyo1O.js";import{f as t,p as s,c as d}from"./p-AMVhBsGv.js";import{f as l,a as r}from"./p-CPKMvyV_.js";import{S as i}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{c as o,a as p}from"./p-BM88Upl5.js";import"./p-DVJaoI_m.js";import{P as c}from"./p-Cl5FLD11.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";const f=class{constructor(e){a(this,e),this.setParamsOnChange=(a,e)=>{t[a]=e},this.handleDateInput=(a,e)=>{const t=o(e,{setEndOfDay:!0});this.setParamsOnChange(a,t)}}componentWillLoad(){Object.entries({status:this.status,created_after:this.createdAfter,created_before:this.createdBefore}).forEach((([a,e])=>{e&&(s[a]=e)}))}get statusOptions(){return[{label:"All",value:""},{label:c.paid,value:"paid"},{label:c.failed,value:"failed"},{label:c.forwarded,value:"forwarded"},{label:c.scheduled,value:"scheduled"},{label:c.in_transit,value:"in_transit"},{label:c.canceled,value:"canceled"}]}render(){const a=Object.assign({},t);return e(i,{key:"4047a84518ef07a3e9d22f3d6866452dcdd7bab3"},e("table-filters-menu",{key:"a1db3d5c8c0bdc44ea7d9dc35f0c460b4b5930ab",params:a,clearParams:d,part:l},e("div",{key:"0d8e8244eb9516a97914942e1e0836dd8ab53639",class:"grid-cols-2 gap-3 p-1"},e("div",{key:"47021850703e8ab104b287b4efa93693272c435b",class:"p-2"},e("form-control-select",{key:"f0312f36bc05c4fa6d4e7841624f8d977cdec6c1",name:"status",label:"Status",options:this.statusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.status||t.status||"",disabled:!!this.status,part:r})),e("div",{key:"211ac119c8172aa4e626b7344b25a1df26019aa8",class:"p-2"},e("form-control-date",{key:"168757bdc92bf54e076d4d5aff63f8a04de65464",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:p(this.createdAfter,{showInputDate:!0})||p(t.created_after,{showInputDate:!0}),disabled:!!this.createdAfter,part:r})),e("div",{key:"43aa8054ba063b70eadfff7240908329f47d1c02",class:"p-2"},e("form-control-date",{key:"16a86a41c301dd32a6d46067c32d1316c80ceb5d",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:p(this.createdBefore,{showInputDate:!0})||p(t.created_before,{showInputDate:!0}),disabled:!!this.createdBefore,part:r})))))}};export{f as justifi_payouts_list_filters}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,r as e,c as i}from"./p-CV0Pyo1O.js";import{n as s,C as a,b as r}from"./p-
|
|
1
|
+
import{h as t,r as e,c as i}from"./p-CV0Pyo1O.js";import{n as s,C as a,b as r}from"./p-Cl5FLD11.js";import{J as o}from"./p-Bo36V7ni.js";import{c as n}from"./p-CxNdigHC.js";import{T as c}from"./p-D_MQLfzf.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{p as h}from"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{g as d,a as p}from"./p-IFhZFB4v.js";import{m,S as l}from"./p-UEdJ7AYc.js";import{S as u}from"./p-DzEdYT8R.js";import{T as f,a as b,b as v,c as g,d as y,e as j,f as k,g as C,h as _,i as w,j as T,k as S,l as D}from"./p-BICxxa69.js";import{T as P}from"./p-CZfYo5-1.js";import{B as I,a as O}from"./p-CHw7tICr.js";import{a6 as x,a7 as A}from"./p-CPKMvyV_.js";import{j as E}from"./p-BM88Upl5.js";import{o as B,g as M}from"./p-Dw63wyhO.js";import"./p-BP7jEC_K.js";import"./p-CP0Y19co.js";import"./p-D8GTwl9v.js";import"./p-CqiVXthx.js";const N={nickname:()=>t("th",{part:x,scope:"col",title:"The nickname associated with the terminal"},"Nickname"),model_name:()=>t("th",{part:x,scope:"col",title:"The model name of the terminal"},"Model Name"),id:()=>t("th",{part:x,scope:"col",title:"The ID of the terminal"},"ID"),provider:()=>t("th",{part:x,scope:"col",title:"The provider of the terminal"},"Provider"),provider_serial_number:()=>t("th",{part:x,scope:"col",title:"The serial number of the terminal"},"Serial Number"),device_id:()=>t("th",{part:x,scope:"col",title:"The device/provider ID of the terminal"},"Device ID"),sub_account_name:()=>t("th",{part:x,scope:"col",title:"The sub account associated with the terminal"},"Sub Account"),status:()=>t("th",{part:x,scope:"col",title:"The current status of each terminal"},"Status")},V={nickname:(e,i)=>t("td",{part:A(i)},e.nickname),model_name:(e,i)=>t("td",{part:A(i)},e.model_name),id:(e,i)=>t("td",{part:A(i)},e.id),provider:(e,i)=>t("td",{part:A(i)},E(e.provider)),provider_serial_number:(e,i)=>t("td",{part:A(i)},e.provider_serial_number),device_id:(e,i)=>t("td",{part:A(i)},e.provider_id),sub_account_name:(e,i)=>t("td",{part:A(i)},e.sub_account_name),status:(e,i)=>t("td",{part:A(i)},t(O,Object.assign({},{connected:{variant:I.SUCCESS,title:"This terminal is connected",text:"Connected"},disconnected:{variant:I.DANGER,title:"This terminal is disconnected",text:"Disconnected"},unknown:{variant:I.SECONDARY,title:"The status of this terminal is unknown",text:"Unknown"},pending_configuration:{variant:I.WARNING,title:"This terminal is pending configuration",text:"Pending configuration"},archived:{variant:I.SECONDARY,title:"This terminal is archived",text:"Archived"}}[e.status])))},z=class{constructor(t){e(this,t),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.terminals=[],this.subAccounts=[],this.loading=!0,this.paging=h,this.pagingParams={},this.columns="nickname,provider_serial_number,status",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:P.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:P.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const i=this.terminals.find((t=>t.id===e));this.clickEvent.emit({name:P.row,data:i})}}componentWillLoad(){n(),this.analytics=new o(this),this.terminalsTable=new f(this.terminals,this.columns,N,V),this.initializeGetData(),this.getTerminals&&this.getSubAccounts&&this.fetchData(),B("set",(()=>{this.pagingParams={}})),B("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}updateOnPropChange(){this.fetchData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:t,authToken:e,service:i})=>async({params:r,onSuccess:o,onError:n})=>{var c,h;try{const m=await i.fetchTerminals(t,e,r);if(m.error)return n({error:p(m.error),code:d(null===(h=m.error)||void 0===h?void 0:h.code),severity:a.ERROR});{const t=Object.assign({},m.page_info);o({terminals:(null===(c=m.data)||void 0===c?void 0:c.map((t=>new s(t))))||[],pagingInfo:t})}}catch(t){const e=d(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:a.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new c}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:r.MISSING_PROPS,message:this.errorMessage,severity:a.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=m({primaryAccountId:this.accountId,authToken:this.authToken,service:new l}))}fetchData(){this.loading=!0,this.getTerminals({params:this.terminalParams,onSuccess:async({terminals:t,pagingInfo:e})=>{this.terminals=t,this.paging=e,this.terminalsTable.collectionData=this.terminals,this.terminalsTable.columnKeys.includes("sub_account_name")?await this.fetchSubAccounts():this.loading=!1},onError:({error:t,code:e,severity:i})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:i}),this.loading=!1}})}async fetchSubAccounts(){this.getSubAccounts({params:this.subAccountParams,onSuccess:({subAccounts:t})=>{this.subAccounts=t,this.terminals=this.terminals.map((t=>{var e;return t.sub_account_name=null===(e=this.subAccounts.find((e=>e.id===t.account_id)))||void 0===e?void 0:e.name,t})),this.loading=!1},onError:({error:t,code:e,severity:i})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:i}),this.loading=!1}})}get terminalParams(){const t=M();return Object.assign(Object.assign({},t),this.pagingParams)}get subAccountParams(){const t=this.terminals.map((t=>t.account_id));return{sub_account_id:[...new Set(t)].join(",")}}get entityId(){return this.terminals.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.terminalsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(u,{key:"69c475e7a428c549a05f21bbd9bd80ce6d77836b"},t(b,{key:"a3d916daff63336299366f27959b8e54134f54c5"},t(v,{key:"412538503e7a212bd7b5723dddad82abe95fc3c2"},t(g,{key:"5501e72fd1931b1ffc17e6bf0d09d692b9cfbe17"},t(y,{key:"e0391a60a807cbdba97ef11f04275eb3072dc40c"},this.terminalsTable.columnData.map((t=>t)))),t(j,{key:"56686e423499aff459fa3d6d93fae0fd7621b10b"},t(k,{key:"0b70b5a0132754b1ce14e8baaeb7a9932c73b0ad",columnSpan:this.terminalsTable.columnKeys.length,isLoading:this.loading}),t(C,{key:"1230c30259de7ad89a1ccf1bb709db5bdda9152f",isEmpty:this.showEmptyState,columnSpan:this.terminalsTable.columnKeys.length}),t(_,{key:"fc5dbeae973d56980e077fa861d0bf95f282cbec",columnSpan:this.terminalsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.terminalsTable.rowData.map(((e,i)=>t(w,{"data-test-id":"table-row","data-row-entity-id":this.entityId[i],onClick:this.rowClickHandler},e)))),this.paging&&t(T,{key:"c68e2cb14c8fa6a56243803e440cc13388ffaaf4"},t(S,{key:"bcc17671c48f5a397dff15333a49305a443aef21"},t(D,{key:"92a690d558b001bb346c2e17fb1e02691ec2a029",colSpan:this.terminalsTable.columnData.length},t("pagination-menu",{key:"2a8233397675c7af4fd95df203eb4438f1c4adbd",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"],pagingParams:["updateOnPropChange"],getTerminals:["updateOnPropChange"],getSubAccounts:["updateOnPropChange"],columns:["updateOnPropChange"]}}};export{z as justifi_terminals_list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as t}from"./p-CV0Pyo1O.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{E as
|
|
1
|
+
import{r as e,h as t}from"./p-CV0Pyo1O.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{E as o}from"./p-Cl5FLD11.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";import"./p-BM88Upl5.js";const a=class{constructor(t){e(this,t)}render(){return t("div",{key:"d0dacb95d07d3e4ca9bc2c9f23b6c490871da4e9",class:"row gy-3"},t("div",{key:"02ed406f38558badf9f591e076b120d09c71f83b",class:"col-12"},t("form-control-file",{key:"11ff1dc68264b9e5aa561ffe19b423abc1a00c78",name:"voided_check",label:"Voided Check",documentType:o.voidedCheck,inputHandler:this.inputHandler,onFileSelected:this.storeFiles,errorText:this.errors.voided_check,multiple:!0})),t("div",{key:"71d26407522a75a54489155566c18af1a64c1417",class:"col-12"},t("form-control-file",{key:"7ea42e03a44c223a5fedc273e94e635e70d54f4b",name:"bank_statement",label:"Bank Statement",documentType:o.bankStatement,inputHandler:this.inputHandler,onFileSelected:this.storeFiles,errorText:this.errors.bank_statement,multiple:!0})))}};export{a as bank_account_document_form_inputs}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as s,F as e,r as i,c as t}from"./p-CV0Pyo1O.js";import{E as a}from"./p-Cu7hgXL1.js";import{B as r}from"./p-
|
|
1
|
+
import{h as s,F as e,r as i,c as t}from"./p-CV0Pyo1O.js";import{E as a}from"./p-Cu7hgXL1.js";import{B as r}from"./p-D_ULdupf.js";import{m as o}from"./p-CI-XifDo.js";import{C as l,b as n}from"./p-Cl5FLD11.js";import{J as d}from"./p-Bo36V7ni.js";import{c as h}from"./p-CxNdigHC.js";import{S as p}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as c}from"./p-uZ5KAseb.js";import"./p-CPKMvyV_.js";import"./p-CP0Y19co.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BM88Upl5.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-IFhZFB4v.js";import"./p-BP7jEC_K.js";const u=()=>{const i=()=>s("div",{class:"mt-5"},s(c,{width:"40%",height:"1.5rem"}),s("hr",null),s("div",{class:"row g-3"},s("div",{class:"col-12 col-md-6"},s(c,null),s(c,null),s(c,null)),s("div",{class:"col-12 col-md-6"},s(c,null),s(c,null),s(c,null))));return s(e,null,s(i,null),s(i,null),s(i,null),s(i,null))},m=class{constructor(s){i(this,s),this.errorEvent=t(this,"error-event",7),this.loading=!0}componentWillLoad(){h(),this.analytics=new d(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetBusiness()}initializeGetBusiness(){this.businessId&&this.authToken?(this.getBusiness=o({id:this.businessId,authToken:this.authToken,service:new r}),this.fetchData()):(this.errorMessage="Invalid business id or auth token",this.errorEvent.emit({errorCode:n.MISSING_PROPS,message:this.errorMessage,severity:l.ERROR}))}updateOnPropChange(){this.getBusiness&&this.fetchData()}fetchData(){this.loading=!0,this.getBusiness({onSuccess:({business:s})=>{this.business=s,this.errorMessage=null},onError:({error:s,code:e,severity:i})=>{this.errorMessage=s,this.errorEvent.emit({errorCode:e,message:s,severity:i})},final:()=>{this.loading=!1}})}render(){return s(p,{key:"7ce48e6905cdbbf8f94470913ecfa3ef8dbb76c7"},this.loading&&s(u,{key:"7c3439e0c247436cd7951d3bdc32e7672c9f8447"}),!this.loading&&this.errorMessage&&a(this.errorMessage),!this.loading&&!this.errorMessage&&this.business&&s("justifi-details",{key:"bf57dacf2067f2704014ce3e002958e3306bba73",errorMessage:this.errorMessage},s("div",{key:"46d19a178ba0d33aa21a4f3900128e3e905731a9",slot:"detail-sections"},s("core-info-details",{key:"ac217a4cfe6b45810a85ca320760b7331f76e60b",business:this.business}),s("legal-address-details",{key:"1fc1a196a43bcf5f9eafd09bfe74c8bb7c409797",legalAddress:this.business.legal_address}),s("representative-details",{key:"1e0833606b129f69a05946726172963cbec05189",representative:this.business.representative}),s("owner-details",{key:"c974111dc67a8961ef6435c34843ca927ad8a7e5",owners:this.business.owners}),s("additional-questions-details",{key:"0951d284a373457e98a1dafc80231ec3ee057e0a",additionalQuestions:this.business.additional_questions}))))}static get watchers(){return{businessId:["propChanged"],authToken:["propChanged"],getBusiness:["updateOnPropChange"]}}};export{m as justifi_business_details}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as i,r as e}from"./p-CV0Pyo1O.js";import{S as a}from"./p-uZ5KAseb.js";import{w as t,c as d}from"./p-DVJaoI_m.js";import{e as c}from"./p-
|
|
1
|
+
import{h as i,r as e}from"./p-CV0Pyo1O.js";import{S as a}from"./p-uZ5KAseb.js";import{w as t,c as d}from"./p-DVJaoI_m.js";import{e as c}from"./p-BM88Upl5.js";import{c as s}from"./p-CxNdigHC.js";import"./p-CPKMvyV_.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-BP7jEC_K.js";const n=e=>{const{isReady:t}=e;return t?null:i("div",{class:"container-fluid p-0"},i("div",{class:"mb-3"},i(a,{height:"18px",width:"100px"}),i(a,{height:"36px"})),i("div",{class:"row"},i("div",{class:"col-4 align-content-end"},i(a,{height:"18px",width:"80px"}),i(a,{height:"36px"})),i("div",{class:"col-4 align-content-end"},i(a,{height:"36px"})),i("div",{class:"col-4 align-content-end"},i(a,{height:"18px",width:"30px"}),i(a,{height:"36px"}))))},r=class{constructor(i){e(this,i),this.isReady=!1}async componentWillLoad(){await t(),this.iframeOrigin=d.iframeOrigin,this.tabId=c(),s()}componentDidRender(){Promise.all([this.cardNumberIframeElement,this.expirationMonthIframeElement,this.expirationYearIframeElement,this.cvvIframeElement].map((i=>new Promise((e=>{i.addEventListener("iframeLoaded",(()=>{e()}))}))))).then((()=>{this.isReady=!0}))}async validate(){const i=await this.cardNumberIframeElement.validate(),e=await this.expirationMonthIframeElement.validate(),a=await this.expirationYearIframeElement.validate(),t=await this.cvvIframeElement.validate();return i&&e&&a&&t}async tokenize({clientId:i,paymentMethodMetadata:e,account:a}){return await this.cardNumberIframeElement.tokenize(i,e,a)}render(){return i("div",{key:"d3cb1fca6595f60e5f5f122b73d3d6c11a826423"},i(n,{key:"f83dcbbc214d460bb21c015ec051436ed5cf6670",isReady:this.isReady}),i("hidden-input",{key:"5fad0d06303d0ddb55c30c2cd94014255f2a8cec"}),i("div",{key:"68440756a1aad69b5c95245e7a2a5feb16899dca",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},i("div",{key:"b39eab56c79463935f1a1bb15cc867997f026e7b",class:"mb-3"},i("iframe-input",{key:"25a2390a8c3c92d5e6eceafe6b821202ecb22d76",inputId:"cardNumber",ref:i=>this.cardNumberIframeElement=i,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber?tabId=${this.tabId}`})),i("div",{key:"68766798d954a0b3d093ae13c3c2955f819da4f2",class:"row"},i("div",{key:"05539f1ac8ebb0397574d55b4b76d7acdb7d2dca",class:"col-4 align-content-end"},i("iframe-input",{key:"4c437a4384e6c301e18824d799784c1133e70ee3",inputId:"expirationMonth",ref:i=>this.expirationMonthIframeElement=i,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth?tabId=${this.tabId}`})),i("div",{key:"b9a5b8b5dda1d8ab6305c9dc1ef9b655eb02fb3d",class:"col-4 align-content-end"},i("iframe-input",{key:"c1a412c20e75d21c1084a4b93f22362c367c1907",inputId:"expirationYear",ref:i=>this.expirationYearIframeElement=i,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear?tabId=${this.tabId}`})),i("div",{key:"abdfdbd7eb784871011397a7c5fdf371e3c6baf0",class:"col-4 align-content-end"},i("iframe-input",{key:"08dff072e785846d7543018c194b4df6ce5b343e",inputId:"CVV",ref:i=>this.cvvIframeElement=i,label:"CVV",iframeOrigin:`${this.iframeOrigin}/v2/CVV?tabId=${this.tabId}`})))))}};export{r as card_form}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as a}from"./p-CV0Pyo1O.js";import{l as t}from"./p-OeJ-3w3l.js";import"./p-DVJaoI_m.js";import{c as s,a as l}from"./p-
|
|
1
|
+
import{r as e,h as a}from"./p-CV0Pyo1O.js";import{l as t}from"./p-OeJ-3w3l.js";import"./p-DVJaoI_m.js";import{c as s,a as l}from"./p-BM88Upl5.js";import{I as c,a as d}from"./p-Cl5FLD11.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{f as i,p as o,c as r}from"./p-CpGEMRkH.js";import{f as p,a as f}from"./p-CPKMvyV_.js";import{S as b}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import"./p-BFTU3MAI.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";const m=class{constructor(a){e(this,a),this.setParamsOnChange=(e,a)=>{i[e]=a},this.handleDateInput=(e,a)=>{const t=s(a,{setExactTime:!0});this.setParamsOnChange(e,t)}}componentWillLoad(){this.debouncedSetParamsOnChange=t.debounce(this.setParamsOnChange,300),Object.entries({status:this.checkoutStatus,payment_mode:this.paymentMode,checkout_id:this.checkoutId,successful_payment_id:this.successfulPaymentId,created_after:this.createdAfter,created_before:this.createdBefore}).forEach((([e,a])=>{a&&(o[e]=a)}))}get checkoutStatusOptions(){return[{label:"All",value:""},{label:"Created",value:c.created},{label:"Completed",value:c.completed},{label:"Attempted",value:c.attempted},{label:"Expired",value:c.expired}]}get checkoutPaymentModeOptions(){return[{label:"All",value:""},{label:"E-commerce",value:d.ecom},{label:"BNPL",value:d.bnpl},{label:"Apple Pay",value:d.apple_pay}]}render(){const e=Object.assign({},i);return a(b,{key:"1c4b39ee0103e6905affa774f202dd76f147bc89"},a("table-filters-menu",{key:"9cb0457d0e6ce05925f4e0da04532008020dd46e",params:e,clearParams:r,part:p},a("div",{key:"e5c370717e3cf2571f2017d185c7f3ea08eab1c8",class:"grid-cols-2 gap-3 p-1"},a("div",{key:"2e3c1832bb800fa9065b189a299234fafa7eb4e3",class:"p-2"},a("form-control-text",{key:"33e1e31d842aa0b8c47e3ea1bc12cc860691f5e3",name:"checkout_id",label:"Checkout ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.checkoutId||i.checkout_id,disabled:!!this.checkoutId,part:f})),a("div",{key:"4dcfe2f56d8405f376eb4aa52deaea0fb64e8ff5",class:"p-2"},a("form-control-text",{key:"272ba42827048aa45ada6090eaf9574950ebaca2",name:"successful_payment_id",label:"Successful Payment ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.successfulPaymentId||i.successful_payment_id,disabled:!!this.successfulPaymentId,part:f})),a("div",{key:"7c4e0ad12e0031a70aeaec5a0423d9b0b45c70a4",class:"p-2"},a("form-control-select",{key:"87775c3a0d1de63301dde682f79a7c2c11a4958b",name:"status",label:"Status",options:this.checkoutStatusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.checkoutStatus||i.status||"",disabled:!!this.checkoutStatus,part:f})),a("div",{key:"e751b51d9e2725addd6e9b082bf326fc039b0a7a",class:"p-2"},a("form-control-select",{key:"642fc1af53bc89d1604a864f4088781096cd24a2",name:"payment_mode",label:"Payment Mode",options:this.checkoutPaymentModeOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentMode||i.payment_mode||"",disabled:!!this.paymentMode,part:f})),a("div",{key:"a95638261e002677c51299342d34bafc8a8615b4",class:"p-2"},a("form-control-date",{key:"ca017b89e5ae0ea3f4d55ade8de2acbdc2062c86",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:l(this.createdAfter,{showInputDateTime:!0})||l(i.created_after,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdAfter,part:f})),a("div",{key:"0585dff7f655db9da4f3c2124eac6c90b74dbe3b",class:"p-2"},a("form-control-date",{key:"50fee01232661f33c1996549cf6523c92dc937c4",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:l(this.createdBefore,{showInputDateTime:!0})||l(i.created_before,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdBefore,part:f})))))}};export{m as justifi_checkouts_list_filters}
|