@justifi/webcomponents 6.12.1 → 6.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/cjs/{Analytics-BhduX1FR.js → Analytics-C1Wd9OW4.js} +2 -2
  2. package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
  3. package/dist/cjs/card-form.cjs.entry.js +2 -2
  4. package/dist/cjs/{check-pkg-version-Bd2yxoh4.js → check-pkg-version-DMXmPDqZ.js} +1 -1
  5. package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
  6. package/dist/cjs/justifi-apple-pay_11.cjs.entry.js +74 -36
  7. package/dist/cjs/justifi-bank-account-billing-form-simple.cjs.entry.js +3 -3
  8. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +3 -3
  9. package/dist/cjs/justifi-business-details.cjs.entry.js +3 -3
  10. package/dist/cjs/justifi-business-form.cjs.entry.js +3 -3
  11. package/dist/cjs/justifi-card-form.cjs.entry.js +3 -3
  12. package/dist/cjs/justifi-checkout.cjs.entry.js +5 -6
  13. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +3 -3
  14. package/dist/cjs/justifi-dispute-management.cjs.entry.js +3 -3
  15. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +3 -3
  16. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +3 -3
  17. package/dist/cjs/justifi-order-terminals.cjs.entry.js +3 -3
  18. package/dist/cjs/justifi-payment-details.cjs.entry.js +3 -3
  19. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +6 -4
  20. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +3 -3
  21. package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -3
  22. package/dist/cjs/justifi-payout-details.cjs.entry.js +3 -3
  23. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +3 -3
  24. package/dist/cjs/justifi-payouts-list.cjs.entry.js +3 -3
  25. package/dist/cjs/justifi-refund-payment.cjs.entry.js +3 -3
  26. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +3 -3
  27. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +3 -3
  28. package/dist/cjs/justifi-terminals-list.cjs.entry.js +3 -3
  29. package/dist/cjs/{package-CjFkmEML.js → package-CRaVpb0w.js} +1 -1
  30. package/dist/collection/api/Analytics.js +1 -1
  31. package/dist/collection/components/business-forms/payment-provisioning/justifi-payment-provisioning.js +3 -1
  32. package/dist/collection/components/checkout/justifi-checkout.js +2 -3
  33. package/dist/collection/components/modular-checkout/sub-components/justifi-apple-pay.js +34 -14
  34. package/dist/collection/components/modular-checkout/sub-components/justifi-google-pay.js +4 -1
  35. package/dist/collection/components/modular-checkout/sub-components/justifi-plaid-payment-method.js +27 -14
  36. package/dist/collection/components/modular-checkout/sub-components/justifi-saved-payment-methods.js +7 -5
  37. package/dist/docs.json +1 -1
  38. package/dist/esm/{Analytics-4PEV3c9V.js → Analytics-qafLCOEU.js} +2 -2
  39. package/dist/esm/bank-account-form.entry.js +2 -2
  40. package/dist/esm/card-form.entry.js +2 -2
  41. package/dist/esm/{check-pkg-version-BmgaID9z.js → check-pkg-version-BJtCbzf9.js} +1 -1
  42. package/dist/esm/hidden-input_2.entry.js +1 -1
  43. package/dist/esm/justifi-apple-pay_11.entry.js +75 -37
  44. package/dist/esm/justifi-bank-account-billing-form-simple.entry.js +3 -3
  45. package/dist/esm/justifi-bank-account-form.entry.js +3 -3
  46. package/dist/esm/justifi-business-details.entry.js +3 -3
  47. package/dist/esm/justifi-business-form.entry.js +3 -3
  48. package/dist/esm/justifi-card-form.entry.js +3 -3
  49. package/dist/esm/justifi-checkout.entry.js +5 -6
  50. package/dist/esm/justifi-checkouts-list.entry.js +3 -3
  51. package/dist/esm/justifi-dispute-management.entry.js +3 -3
  52. package/dist/esm/justifi-dispute-notification_3.entry.js +3 -3
  53. package/dist/esm/justifi-gross-payment-chart.entry.js +3 -3
  54. package/dist/esm/justifi-order-terminals.entry.js +3 -3
  55. package/dist/esm/justifi-payment-details.entry.js +3 -3
  56. package/dist/esm/justifi-payment-provisioning.entry.js +6 -4
  57. package/dist/esm/justifi-payment-transactions-list.entry.js +3 -3
  58. package/dist/esm/justifi-payments-list.entry.js +3 -3
  59. package/dist/esm/justifi-payout-details.entry.js +3 -3
  60. package/dist/esm/justifi-payout-transactions-list.entry.js +3 -3
  61. package/dist/esm/justifi-payouts-list.entry.js +3 -3
  62. package/dist/esm/justifi-refund-payment.entry.js +3 -3
  63. package/dist/esm/justifi-season-interruption-insurance.entry.js +3 -3
  64. package/dist/esm/justifi-terminal-orders-list.entry.js +3 -3
  65. package/dist/esm/justifi-terminals-list.entry.js +3 -3
  66. package/dist/esm/{package-CXKOe1m5.js → package-BCgsLInF.js} +1 -1
  67. package/dist/module/Analytics.js +1 -1
  68. package/dist/module/justifi-apple-pay2.js +34 -14
  69. package/dist/module/justifi-checkout.js +2 -3
  70. package/dist/module/justifi-google-pay2.js +4 -1
  71. package/dist/module/justifi-payment-provisioning.js +3 -1
  72. package/dist/module/justifi-plaid-payment-method2.js +27 -14
  73. package/dist/module/justifi-saved-payment-methods2.js +7 -5
  74. package/dist/module/package.js +1 -1
  75. package/dist/types/components/business-forms/payment-provisioning/justifi-payment-provisioning.d.ts +1 -1
  76. package/dist/types/components/modular-checkout/sub-components/justifi-apple-pay.d.ts +3 -0
  77. package/dist/types/components/modular-checkout/sub-components/justifi-plaid-payment-method.d.ts +2 -2
  78. package/dist/webcomponents/{p-017edf85.entry.js → p-06ecd4cb.entry.js} +1 -1
  79. package/dist/webcomponents/{p-b6d59ff4.entry.js → p-164f95ec.entry.js} +1 -1
  80. package/dist/webcomponents/p-174eb877.entry.js +1 -0
  81. package/dist/webcomponents/{p-9870fff0.entry.js → p-1e0be7b0.entry.js} +1 -1
  82. package/dist/webcomponents/p-39cc6928.entry.js +1 -0
  83. package/dist/webcomponents/p-4226eb4a.entry.js +1 -0
  84. package/dist/webcomponents/{p-b8c59954.entry.js → p-474ee3f8.entry.js} +1 -1
  85. package/dist/webcomponents/p-485b77ba.entry.js +1 -0
  86. package/dist/webcomponents/{p-0e9cb724.entry.js → p-581808f0.entry.js} +1 -1
  87. package/dist/webcomponents/{p-259ea5e0.entry.js → p-79713014.entry.js} +1 -1
  88. package/dist/webcomponents/{p-608a41d2.entry.js → p-798f4708.entry.js} +1 -1
  89. package/dist/webcomponents/{p-4f57368a.entry.js → p-7f0f72c6.entry.js} +1 -1
  90. package/dist/webcomponents/{p-1e080e95.entry.js → p-7f814609.entry.js} +1 -1
  91. package/dist/webcomponents/{p-61ebdd8b.entry.js → p-870fac9e.entry.js} +1 -1
  92. package/dist/webcomponents/{p-cd267d76.entry.js → p-956eca2e.entry.js} +1 -1
  93. package/dist/webcomponents/p-BCgsLInF.js +1 -0
  94. package/dist/webcomponents/{p-GP5gWjhc.js → p-BJ7GFTiW.js} +1 -1
  95. package/dist/webcomponents/{p-cXPhRFs-.js → p-BnaR7f2G.js} +1 -1
  96. package/dist/webcomponents/{p-b76b743e.entry.js → p-a80d958d.entry.js} +1 -1
  97. package/dist/webcomponents/{p-f4b390bc.entry.js → p-b2447726.entry.js} +1 -1
  98. package/dist/webcomponents/{p-f481695c.entry.js → p-c73631f0.entry.js} +1 -1
  99. package/dist/webcomponents/{p-d3829e18.entry.js → p-c8f7ebf6.entry.js} +1 -1
  100. package/dist/webcomponents/{p-1e66d430.entry.js → p-d7633e10.entry.js} +1 -1
  101. package/dist/webcomponents/{p-87a4b33f.entry.js → p-da882bd1.entry.js} +1 -1
  102. package/dist/webcomponents/{p-647668b6.entry.js → p-dd1cfb9e.entry.js} +1 -1
  103. package/dist/webcomponents/{p-06e88d51.entry.js → p-de836ec9.entry.js} +1 -1
  104. package/dist/webcomponents/{p-2b25c768.entry.js → p-f24563ab.entry.js} +1 -1
  105. package/dist/webcomponents/p-f4aeda71.entry.js +1 -0
  106. package/dist/webcomponents/{p-ed580b3c.entry.js → p-faa090a5.entry.js} +1 -1
  107. package/dist/webcomponents/webcomponents.esm.js +1 -1
  108. package/package.json +1 -1
  109. package/dist/webcomponents/p-11faee45.entry.js +0 -1
  110. package/dist/webcomponents/p-238163d8.entry.js +0 -1
  111. package/dist/webcomponents/p-CXKOe1m5.js +0 -1
  112. package/dist/webcomponents/p-cf31ccdd.entry.js +0 -1
  113. package/dist/webcomponents/p-d58a330d.entry.js +0 -1
  114. package/dist/webcomponents/p-f91c49a2.entry.js +0 -1
@@ -0,0 +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-CYQvLgSs.js";import{A as o,o as r,p as l,q as h,r as c,s as d,t as u,C as p,e as y,u as m,I as v,v as g,w as f,x as M}from"./p-CUI41_5y.js";import{S as b}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{S as k}from"./p-DcBvJu0k.js";import{c as w,o as j,a as P,g as T,b as A}from"./p-BArmtmkq.js";import{t as N,r as I}from"./p-DnrawQn3.js";import{f as C}from"./p-BRnBHsdq.js";import{w as E,c as D}from"./p-DVJaoI_m.js";import{H as S}from"./p-XrKLre8M.js";import{H as O,b as L,h as x,i as z}from"./p-DkdzUTnl.js";import{H as _}from"./p-MDZuGvsl.js";import{J as R}from"./p-BnaR7f2G.js";import{c as U}from"./p-BJ7GFTiW.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{g as B,a as F}from"./p-B5vVjDc_.js";import{C as Y}from"./p-D4OlsyTo.js";import{P as Q}from"./p-B--N37zY.js";import{P as V,a as H,b as G}from"./p-DkoufM1t.js";import{C as q}from"./p-ZpPDShvP.js";import"./p-D8GTwl9v.js";import"./p-BCgsLInF.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(b,{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 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: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.showSkeleton=!0,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 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(b,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(b,{key:"cb0fe35e791df60fcc8198bcda789bf8be205873"},i("internal-button",{key:"26f0f44419d1d72e7ccd1240e88057333d927a36",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(b,{key:"67414e8e4f91020b00b45fa840e957c439fd5e23"},i("section",{key:"893c1b0ec898adf8d40e1e09fd42797094efd6d4"},i("div",{key:"f37c1905522b039f7b0ef65e04325570c6a8cef2"},i("div",{key:"10b96593bd21e27645c6548fcbcd3981e4882082",part:N},null==w?void 0:w.paymentDescription),i("div",{key:"7d6ce75a2fc8c5796992940886a21c547f698909"},i("span",{key:"d40f2f63df16ec751de91d0731d66aa8cc42aa9a",part:N},"Total")," ",i("span",{key:"ebe75dba638d5da9a5aa82e823e2fe4649129cab",part:N},C(+(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.environment="TEST",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)}sendInitialize(){var t;(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow)&&this.iframeElement.contentWindow.postMessage({eventType:st.initialize,data:{environment:this.environment,gatewayMerchantId:w.accountId,merchantName:this.merchantName,authToken:w.authToken,accountId:w.accountId}},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(b,{key:"47b96a1e22395349811c97d4e914fa4d77102591"},i(this.levels[this.level],{key:"2ac2e58d15c9c92d01fae0ffba9ea6511cc1ac53",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 Q,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:V.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:V.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=(({authToken:t,checkoutId:e,service:i})=>async({onSuccess:s,onError:n})=>{var a;try{const o=await i.fetchCheckout(t,e);if(o.error)return n({error:F(o.error),code:B(null===(a=o.error)||void 0===a?void 0:a.code),severity:p.ERROR});s({checkout:o.data})}catch(t){const e=B(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:p.ERROR})}})(t),this.completeCheckout=(({authToken:t,checkoutId:e,service:i})=>async({payment:s,onSuccess:n,onError:a})=>{var o;try{const r=await i.complete(t,e,s);if(r.error)return a({error:F(r.error),code:B(null===(o=r.error)||void 0===o?void 0:o.code),severity:p.ERROR});n({checkout:r.data})}catch(t){const e=B(null==t?void 0:t.code);return a({error:t.message||t,code:e,severity:p.ERROR})}})(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;w.accountId=t.account_id,w.checkoutLoaded=!0,w.paymentMethods=t.payment_methods.map((t=>new H(t))),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===(e=t.payment_settings)||void 0===e?void 0:e.bank_account_verification,w.applePayEnabled=null===(i=t.payment_settings)||void 0===i?void 0:i.apple_payments,w.googlePayEnabled=null===(s=t.payment_settings)||void 0===s?void 0:s.google_payments,w.bnplProviderClientId=null===(n=null==t?void 0:t.bnpl)||void 0===n?void 0:n.provider_client_id,w.bnplProviderMode=null===(a=null==t?void 0:t.bnpl)||void 0===a?void 0:a.provider_mode,w.bnplProviderApiVersion=null===(o=null==t?void 0:t.bnpl)||void 0===o?void 0:o.provider_api_version,w.bnplProviderCheckoutUrl=null===(r=null==t?void 0:t.bnpl)||void 0===r?void 0:r.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:V.NEW_CARD}:"justifi-bank-account-form"===t&&(w.selectedPaymentMethod={type:V.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)===V.NEW_CARD,n=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===V.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)===V.NEW_CARD,l=(null===(i=w.selectedPaymentMethod)||void 0===i?void 0:i.type)===V.NEW_BANK_ACCOUNT,h=(null===(s=w.selectedPaymentMethod)||void 0===s?void 0:s.type)===V.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});let c;if(c={payment_mode:(t=>{switch(t){case V.NEW_CARD:case V.SAVED_CARD:case V.NEW_BANK_ACCOUNT:case V.SAVED_BANK_ACCOUNT:case V.PLAID:return G.ECOM;case V.SEZZLE:return G.BNPL;case V.APPLE_PAY:return G.APPLE_PAY;case V.GOOGLE_PAY:return G.GOOGLE_PAY;default:return}})(null===(a=w.selectedPaymentMethod)||void 0===a?void 0:a.type),payment_token:w.paymentToken},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:"5dbeab6f10177a3ca87ef7bb62f30ed5859b500f"})}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 Q,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!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:M.PLAID_SDK_LOAD_FAILED,message:f[M.PLAID_SDK_LOAD_FAILED],severity:g[M.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:M.PLAID_LINK_TOKEN_FAILED,message:f[M.PLAID_LINK_TOKEN_FAILED],severity:g[M.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:M.PLAID_LINK_INIT_FAILED,message:f[M.PLAID_LINK_INIT_FAILED],severity:g[M.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:M.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=M.PLAID_LINK_TOKEN_FAILED,o=f[a],r=!0;"AbortError"===t.name?(a=M.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=M.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=M.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 M.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return M.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return M.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return M.PLAID_RATE_LIMITED;case"maintenance":return M.PLAID_MAINTENANCE;case"not_authenticated":return M.PLAID_INVALID_CREDENTIALS;default:return M.PLAID_LINK_TOKEN_FAILED}return M.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:V.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=M.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=M.PLAID_INVALID_CREDENTIALS,i=f[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=M.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=M.PLAID_ACCOUNT_LOCKED,i=f[e],s=!1,n="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=M.PLAID_MAINTENANCE,i=f[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=M.PLAID_RATE_LIMITED,i=f[e],s=!0;break;case"INVALID_REQUEST":e=M.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=M.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=M.PLAID_BANK_NOT_SUPPORTED,i=f[e],s=!1,n="Try a different payment method"):(a.includes("expired")||a.includes("timeout"))&&(e=M.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)===V.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)!==V.PLAID&&(w.selectedPaymentMethod={type:V.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)===V.PLAID,!0===w.bankAccountVerification&&(w.checkoutLoaded?this.loadPlaidSDK():j("checkoutLoaded",(t=>{t&&!0===w.bankAccountVerification&&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:M.PLAID_SDK_LOAD_FAILED,message:f[M.PLAID_SDK_LOAD_FAILED],severity:g[M.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:V.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:V.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(!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(b,{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===V.SAVED_CARD&&w.disableCreditCard||t===V.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(b,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:I,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:`${q[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=V.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:V.SEZZLE},this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)}render(){var t,e;return w.bnplEnabled?i(b,{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"},C(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={[V.NEW_BANK_ACCOUNT]:"New bank account",[V.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||(this.selectedPaymentMethod=V.NEW_BANK_ACCOUNT,w.selectedPaymentMethod={type:V.NEW_BANK_ACCOUNT}):(this.selectedPaymentMethod=V.NEW_CARD,w.selectedPaymentMethod={type:V.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=[];return this.disableCreditCard||t.push(V.NEW_CARD),this.disableBankAccount||t.push(V.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===V.NEW_CARD?"card-form":"bank-account-form",{ref:t=>{t&&(this.paymentMethodFormRef=t)}})}render(){return i(b,{key:"e426ad2935cf88bd5af628da9154cdaccc5e6be2"},i("form",{key:"571fcd140680840f5b68ee08b9cb7d9a5c6156ed"},i("fieldset",{key:"b394ce7a04e7d57ce2f4eb787252412409c3703d"},i("div",{key:"1eb916974b71ead6dda1c54c36f0cb8f90433190",class:"row gy-3"},i("div",{key:"8fb01d0e321fd265ede20f712779f66cf4404d78",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),i("div",{key:"40f03fdb6df080a8d55b72a818b3eb42e56fd9f9",class:"col-12"},i("internal-button",{key:"b719a621d8a3592e8b4a193656672ab6dd799006",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 s}from"./p-CV0Pyo1O.js";import{J as o}from"./p-cXPhRFs-.js";import{c as a}from"./p-GP5gWjhc.js";import{w as r}from"./p-DVJaoI_m.js";import{S as p}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import"./p-CXKOe1m5.js";import"./p-CYQvLgSs.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-CUI41_5y.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";const i=class{constructor(s){t(this,s)}async componentWillLoad(){await r(),a(),this.analytics=new o(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return this.cardFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:s,account:o}){return this.cardFormElement.tokenize({clientId:t,paymentMethodMetadata:s,account:o})}render(){return s(p,{key:"d4c6ec37fc92036326c7a20b5a6ff189880ad6f5"},s("card-form",{key:"8411003a749dc97a953874601e676beaf5bc4a6d",ref:t=>this.cardFormElement=t}))}};export{i as justifi_card_form}
1
+ import{r as t,h as s}from"./p-CV0Pyo1O.js";import{J as a}from"./p-BnaR7f2G.js";import{c as o}from"./p-BJ7GFTiW.js";import{w as r}from"./p-DVJaoI_m.js";import{S as p}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import"./p-BCgsLInF.js";import"./p-CYQvLgSs.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-CUI41_5y.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";const i=class{constructor(s){t(this,s)}async componentWillLoad(){await r(),o(),this.analytics=new a(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return this.cardFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:s,account:a}){return this.cardFormElement.tokenize({clientId:t,paymentMethodMetadata:s,account:a})}render(){return s(p,{key:"d4c6ec37fc92036326c7a20b5a6ff189880ad6f5"},s("card-form",{key:"8411003a749dc97a953874601e676beaf5bc4a6d",ref:t=>this.cardFormElement=t}))}};export{i as justifi_card_form}
@@ -0,0 +1 @@
1
+ import{r as e,c as t,h as a}from"./p-CV0Pyo1O.js";import{J as i}from"./p-BnaR7f2G.js";import{c as s}from"./p-BJ7GFTiW.js";import{c as d}from"./p-BArmtmkq.js";import{c}from"./p-DnrawQn3.js";import{S as o}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{P as f}from"./p-DkoufM1t.js";import"./p-BCgsLInF.js";import"./p-CYQvLgSs.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-CUI41_5y.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const h=class{constructor(a){e(this,a),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(){s(),this.analytics=new i(this)}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}checkoutComplete(e){d.isSubmitting=!1}checkoutError(e){d.isSubmitting=!1}checkoutChanged(e){this.availablePaymentMethods=this.disableBnpl?e.detail.availablePaymentMethodTypes.filter((e=>e!==f.SEZZLE)):e.detail.availablePaymentMethodTypes}async fillBillingForm(e){d.billingFormFields=e}async validate(){var e;return{isValid:await(null===(e=this.modularCheckoutRef)||void 0===e?void 0:e.validate())}}updateStore(){d.checkoutId=this.checkoutId,d.authToken=this.authToken,d.disableCreditCard=this.disableCreditCard,d.disableBankAccount=this.disableBankAccount,d.disablePaymentMethodGroup=this.disablePaymentMethodGroup}async submit(e){var t;null===(t=this.modularCheckoutRef)||void 0===t||t.submitCheckout(d.billingFormFields)}get showPaymentTypeHeader(){return!this.disableCreditCard&&!this.disableBankAccount}render(){var e,t;return a(o,{key:"ffd2abaacc7edae588a9abe3a4ff96807b34fcff"},a("justifi-modular-checkout",{key:"9196c278e24353aeb1ac02c85253d629f683522b",ref:e=>{this.modularCheckoutRef=e},authToken:this.authToken,checkoutId:this.checkoutId,preCompleteHook:this.preCompleteHook},a("div",{key:"895298286bc0aa6acbda896a4f148dd4f8d7e7d2",class:"row gy-3 jfi-checkout-core"},a("div",{key:"dd186ed2f0fd479cd60024423b6d55625b962e55",class:"col-12",part:c},a("justifi-header",{key:"920d4eca26846aa1cbc16693fa45a9d8054d95a7",text:"Summary",level:"h2",class:"fs-5 fw-bold pb-3"}),a("section",{key:"560f8c3757a7cf53fd0aa898fd243b16a2f8e8d5"},a("justifi-checkout-summary",{key:"31faa6ca984aa22985927a1f80273c86a67c7025"}))),a("div",{key:"3128ae40a739573da32598213a289d8751503fb0",class:"col-12 mt-4"},a("slot",{key:"4a310881bbc4017734082d5c4f6b41d3d5f2a424",name:"insurance"})),a("div",{key:"8047c4da62e2fd67bd0b3f8654c6a19c0cacc255",class:"col-12 mt-4"},a("justifi-header",{key:"631ff14201f6246906e3e1572515de21a7977773",text:"Payment",level:"h2",class:"fs-5 fw-bold pb-3"}),this.showPaymentTypeHeader&&a("justifi-header",{key:"7fdc560ef42a5c2e8571f332e3c4ce8ff460d235",text:"Select payment type",level:"h3",class:"fs-6 fw-bold lh-lg"}),a("div",{key:"81dcb52c051044adb4dbd92ac73ee3096edc592b",class:"d-flex flex-column"},a("section",{key:"4359903b195009a2e8fb997a1f77880cba40dea4"},a("div",{key:"21728867e6288c3fb7d5e5a6ee3d15974568b866"},this.availablePaymentMethods.includes(f.APPLE_PAY)&&a("div",{key:"bdaa6b6c6d09cba294b2e46b85270241c86d2251",class:"mb-3"},a("justifi-apple-pay",{key:"150d707bff7b79a1d19141f21a9c47e00e54418a"})),this.availablePaymentMethods.includes(f.GOOGLE_PAY)&&a("div",{key:"ce2be06b20a1e7d0159fde68a1c5c349c2d11998",class:"mb-3"},a("justifi-google-pay",{key:"0fc867ce77467eb1f1fd198a62e88bd2795f4914",ref:e=>this.googlePayRef=e})),a("justifi-saved-payment-methods",{key:"0bb1999c093b3837bfdb879134dc54f66c90e164"}),this.availablePaymentMethods.includes(f.SEZZLE)&&a("justifi-radio-list-item",{key:"1599be9bcea7569d822a204c805f08f18a4e00a4",name:"paymentMethodType",value:f.SEZZLE,checked:(null===(e=null==d?void 0:d.selectedPaymentMethod)||void 0===e?void 0:e.type)===f.SEZZLE,label:a("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(f.PLAID)&&!this.disableBnpl&&a("justifi-radio-list-item",{key:"c1de230257d290efa05f7a7166c2f069451c71a3",name:"paymentMethodType",value:f.PLAID,checked:(null===(t=null==d?void 0:d.selectedPaymentMethod)||void 0===t?void 0:t.type)===f.PLAID,label:a("justifi-plaid-payment-method",{ref:e=>this.plaidPaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.plaidPaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),a("justifi-tokenize-payment-method",{key:"44bca4ee57857afd4eee213cef98db2d4bd42490",ref:e=>this.tokenizePaymentMethodRef=e,authToken:this.authToken,accountId:d.accountId,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,hideSubmitButton:!0,paymentMethodGroupId:d.paymentMethodGroupId}))))),a("div",{key:"e5b6b4ac6b0fcec20380082f1b4cc5ba73bb88aa",class:"mt-4"},a("justifi-button",{key:"188a8f46fd37b5f4f2d9b3ba7ff179d44d4a6656",text:"Pay",type:"submit",variant:"primary",clickHandler:e=>this.submit(e),disabled:d.isSubmitting||d.isWalletProcessing,isLoading:d.isSubmitting||d.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}
@@ -0,0 +1 @@
1
+ import{r as s,c as t,h as r}from"./p-CV0Pyo1O.js";import{A as o}from"./p-CYQvLgSs.js";import{C as i,e}from"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{g as a,a as n}from"./p-B5vVjDc_.js";import{E as p}from"./p-x9fFFf7F.js";import{J as h}from"./p-BnaR7f2G.js";import{c}from"./p-BJ7GFTiW.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-DnrawQn3.js";import"./p-BCgsLInF.js";const m=o();class u{async fetchGrossVolumeChartData(s,t){return m.get({endpoint:`account/${s}/reports/gross_volume`,authToken:t})}}const d=class{constructor(r){s(this,r),this.errorEvent=t(this,"error-event",7),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){c(),this.analytics=new h(this),this.initializeGetGrossPayment()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetGrossPayment()}initializeGetGrossPayment(){this.accountId&&this.authToken?this.getGrossPayment=(({id:s,authToken:t,service:r})=>async({onSuccess:o,onError:e})=>{var p;try{const h=await r.fetchGrossVolumeChartData(s,t);h.error?e({error:n(h.error),code:a(null===(p=h.error)||void 0===p?void 0:p.code),severity:i.ERROR}):o(h.data)}catch(s){const t=a(null==s?void 0:s.code);e({error:n(s),code:t,severity:i.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new u}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}render(){return this.errorMessage?p(this.errorMessage):r("gross-payment-chart-core",{getGrossPayment:this.getGrossPayment,"onError-event":this.handleErrorEvent})}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{d as justifi_gross_payment_chart}
@@ -1 +1 @@
1
- import{r as t,h as a}from"./p-CV0Pyo1O.js";import{c as o}from"./p-GP5gWjhc.js";import{J as s}from"./p-cXPhRFs-.js";import{w as r}from"./p-DVJaoI_m.js";import{S as p}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import"./p-CXKOe1m5.js";import"./p-CYQvLgSs.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-CUI41_5y.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";const i=class{constructor(a){t(this,a)}async componentWillLoad(){await r(),o(),this.analytics=new s(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return this.bankAccountFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:a,account:o}){return this.bankAccountFormElement.tokenize({clientId:t,paymentMethodMetadata:a,account:o})}render(){return a(p,{key:"9a81b78573c9519a46902679cbb1a8a4536f69be"},a("bank-account-form",{key:"2bc1dfd52e25989a42f25af7f7a6d353eb5a7e5f",ref:t=>this.bankAccountFormElement=t}))}};export{i as justifi_bank_account_form}
1
+ import{r as t,h as a}from"./p-CV0Pyo1O.js";import{c as o}from"./p-BJ7GFTiW.js";import{J as s}from"./p-BnaR7f2G.js";import{w as r}from"./p-DVJaoI_m.js";import{S as p}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import"./p-BCgsLInF.js";import"./p-CYQvLgSs.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-CUI41_5y.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";const i=class{constructor(a){t(this,a)}async componentWillLoad(){await r(),o(),this.analytics=new s(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return this.bankAccountFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:a,account:o}){return this.bankAccountFormElement.tokenize({clientId:t,paymentMethodMetadata:a,account:o})}render(){return a(p,{key:"9a81b78573c9519a46902679cbb1a8a4536f69be"},a("bank-account-form",{key:"2bc1dfd52e25989a42f25af7f7a6d353eb5a7e5f",ref:t=>this.bankAccountFormElement=t}))}};export{i as justifi_bank_account_form}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as o}from"./p-CV0Pyo1O.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{f as i,C as r,e}from"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{g as c,a as n}from"./p-B5vVjDc_.js";import{c as a}from"./p-BJ7GFTiW.js";import{J as p}from"./p-BnaR7f2G.js";import{C as h}from"./p-D4OlsyTo.js";import{m as u,S as m}from"./p-qcQTYcr3.js";import{S as d}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{d as l}from"./p-Cf6HoQKl.js";import"./p-D8GTwl9v.js";import"./p-BRnBHsdq.js";import"./p-BCgsLInF.js";import"./p-CYQvLgSs.js";import"./p-pL4dNfsl.js";import"./p-DnrawQn3.js";const j=class{constructor(o){t(this,o),this.errorEvent=s(this,"error-event",7),this.errorMessage=null,this.columns=l,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){a(),this.analytics=new p(this),this.initializeGetData()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetCheckouts(),this.initializeGetSubAccounts()}initializeGetCheckouts(){const t=this.subAccountId||this.accountId;t&&this.authToken?this.getCheckouts=(({accountId:t,authToken:s,service:o})=>async({params:e,onSuccess:a,onError:p})=>{var h,u;try{const m=await o.fetchCheckouts(t,s,e);if(m.error)return p({error:n(m.error),code:c(null===(u=m.error)||void 0===u?void 0:u.code),severity:r.ERROR});{const t=Object.assign({},m.page_info);a({checkouts:(null===(h=m.data)||void 0===h?void 0:h.map((t=>new i(t))))||[],pagingInfo:t})}}catch(t){const s=c(null==t?void 0:t.code);return p({error:t.message||t,code:s,severity:r.ERROR})}})({accountId:t,authToken:this.authToken,service:new h}):(this.errorMessage="Account ID/Sub Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:r.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=u({primaryAccountId:this.accountId,authToken:this.authToken,service:new m}))}render(){return o(d,{key:"27491f40eb96742cee1fe81023a9e423ab5b22a5"},o("checkouts-list-core",{key:"2b2526aa7dee3cd216bc481144d3239a5389872c",getCheckouts:this.getCheckouts,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"],subAccountId:["propChanged"]}}};export{j as justifi_checkouts_list}
@@ -1 +1 @@
1
- import{r as e,h as n,H as t,c as i,g as o}from"./p-CV0Pyo1O.js";import{c as r}from"./p-D8GTwl9v.js";import{a7 as s,q as a,v as c,w as d,x as u}from"./p-DnrawQn3.js";import{g as f}from"./p-BFTU3MAI.js";import{F as l}from"./p-BsQy297i.js";import{p as h}from"./p-CXKOe1m5.js";const m=r({focused:{boxShadow:"",border:""},focusedAndInvalid:{boxShadow:"",border:""},fontStyles:{fontFamily:"",fontSize:"",fontWeight:"",lineHeight:"",margin:"",padding:""}}),{state:w,set:g}=m,b=class{constructor(n){e(this,n),this.isFocused=!1,this.errorText=""}focusWithoutPageScroll(e){if(e)try{e.focus({preventScroll:!0})}catch(n){const{scrollX:t,scrollY:i}=window;e.focus(),window.scrollTo(t,i)}}async componentDidLoad(){const e=await this.getBaseFontStyles();g("fontStyles",e);const n=await this.getFocusedStyles();g("focused",n);const t=await this.getFocusedAndInvalidStyles();g("focusedAndInvalid",t)}async getBaseFontStyles(){return new Promise((e=>{setTimeout((()=>{const n=getComputedStyle(this.hiddenInput);e({fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,margin:n.margin,padding:n.padding,color:n.color})}),500)}))}async getFocusedStyles(){return new Promise((e=>{this.focusWithoutPageScroll(this.hiddenInput),setTimeout((()=>{this.hiddenInput.blur();let n=getComputedStyle(this.hiddenInput);e({boxShadow:n.boxShadow,border:n.border})}),500)}))}async getFocusedAndInvalidStyles(){return new Promise((e=>{this.focusWithoutPageScroll(this.hiddenInput),this.errorText="Error",setTimeout((()=>{const n=getComputedStyle(this.hiddenInput),t={boxShadow:n.boxShadow,border:n.border};this.hiddenInput.blur(),e(t)}),500)}))}get part(){return this.isFocused&&this.errorText?s:this.errorText?a:this.isFocused?c:d}render(){return n(t,{key:"5697b5e318914b8866bc6ad2fb2009e5f8c8d80f"},n("input",{key:"3370d11bc6e5a49f28dd2e95bf1d92ee7a0dd892",ref:e=>this.hiddenInput=e,type:"text",class:this.errorText?"form-control is-invalid":"form-control",onFocus:()=>this.isFocused=!0,onBlur:()=>this.isFocused=!1,part:this.part,tabindex:"-1",style:{height:"0",opacity:"0",pointerEvents:"none",animation:"none"}}))}};var p,y,v={exports:{}},k=f((p||(p=1,y=v,console.info("\nIFRAME-RESIZER\n\nIframe-Resizer 5 is now available via the following two packages:\n\n * @iframe-resizer/parent\n * @iframe-resizer/child\n\nAdditionally their are also new versions of iframe-resizer for React, Vue, and jQuery.\n\nVersion 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n"),function(e){if("undefined"!=typeof window){var n,t,i=0,o=!1,r=!1,s="[iFrameSizer]",a=null,c=window.requestAnimationFrame,d=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),u={},f=null,l=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){k("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),h={};window.jQuery!==e&&((t=window.jQuery).fn?t.fn.iFrameResize||(t.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){W(t,e)})).end()}):v("","Unable to bind to jQuery, it is not fully loaded.")),y.exports=L(),window.iFrameResize=window.iFrameResize||L()}function m(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(e,n,t){e.addEventListener(n,t,!1)}function g(e,n,t){e.removeEventListener(n,t,!1)}function b(e){return u[e]?u[e].log:o}function p(e,n){x("log",e,n,b(e))}function v(e,n){x("info",e,n,b(e))}function k(e,n){x("warn",e,n,!0)}function x(e,n,t,i){!0===i&&"object"==typeof window.console&&console[e](function(e){return s+"["+function(e){var n="Host page: "+e;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),n}(e)+"]"}(n),t)}function I(e){function n(){t("Height"),t("Width"),C((function(){R(A),T(P),l("onResized",A)}),A,"init")}function t(e){var n=Number(u[P]["max"+e]),t=Number(u[P]["min"+e]),i=e.toLowerCase(),o=Number(A[i]);p(P,"Checking "+i+" is in range "+t+"-"+n),o<t&&(o=t,p(P,"Set "+i+" to min value")),o>n&&(o=n,p(P,"Set "+i+" to max value")),A[i]=""+o}function i(e){return W.slice(W.indexOf(":")+7+e)}function o(e,n){var t,i;t=function(){var t,i;E("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=A.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},h[i=n]||(h[i]=setTimeout((function(){h[i]=null,t()}),32))}function r(e){var n=e.getBoundingClientRect();return M(P),{x:Math.floor(Number(n.left)+Number(a.x)),y:Math.floor(Number(n.top)+Number(a.y))}}function c(e){var n=e?r(A.iframe):{x:0,y:0},t={x:Number(A.width)+n.x,y:Number(A.height)+n.y};p(P,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(a=t,d(),p(P,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):k(P,"Unable to scroll to requested position, window.parentIFrame not found")}function d(){!1===l("onScroll",a)?j():T(P)}function f(e){var n={};if(0===Number(A.width)&&0===Number(A.height)){var t=i(9).split(":");n={x:t[1],y:t[0]}}else n={x:A.width,y:A.height};l(e,{iframe:A.iframe,screenX:Number(n.x),screenY:Number(n.y),type:A.type})}function l(e,n){return S(P,e,n)}var m,b,y,x,I,z,W=e.data,A={},P=null;"[iFrameResizerChild]Ready"===W?function(){for(var e in u)E("iFrame requested init",N(e),u[e].iframe,e)}():s===(""+W).slice(0,13)&&W.slice(13).split(":")[0]in u?(x=(y=W.slice(13).split(":"))[1]?parseInt(y[1],10):0,I=u[y[0]]&&u[y[0]].iframe,z=getComputedStyle(I),A={iframe:I,id:y[0],height:x+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}(z)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(z),width:y[2],type:y[3]},u[P=A.id]&&(u[P].loaded=!0),(b=A.type in{true:1,false:1,undefined:1})&&p(P,"Ignoring init message from meta parent page"),!b&&function(e){var n=!0;return u[e]||(n=!1,k(A.type+" No settings for "+e+". Message was: "+W)),n}(P)&&(p(P,"Received: "+W),m=!0,null===A.iframe&&(k(P,"IFrame ("+A.id+") not found"),m=!1),m&&function(){var n,t=e.origin,i=u[P]&&u[P].checkOrigin;if(i&&""+t!="null"&&!(i.constructor===Array?function(){var e=0,n=!1;for(p(P,"Checking connection is from allowed list of origins: "+i);e<i.length;e++)if(i[e]===t){n=!0;break}return n}():(p(P,"Checking connection is from: "+(n=u[P]&&u[P].remoteHost)),t===n)))throw new Error("Unexpected message received from: "+t+" for "+A.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(u[P]&&u[P].firstRun&&u[P]&&(u[P].firstRun=!1),A.type){case"close":F(A.iframe);break;case"message":m=i(6),p(P,"onMessage passed: {iframe: "+A.iframe.id+", message: "+m+"}"),l("onMessage",{iframe:A.iframe,message:JSON.parse(m)}),p(P,"--");break;case"mouseenter":f("onMouseEnter");break;case"mouseleave":f("onMouseLeave");break;case"autoResize":u[P].autoResize=JSON.parse(i(9));break;case"scrollTo":c(!1);break;case"scrollToOffset":c(!0);break;case"pageInfo":o(u[P]&&u[P].iframe,P),function(){function e(e,i){function r(){u[t]?o(u[t].iframe,t):n()}["scroll","resize"].forEach((function(n){p(t,e+n+" listener for sendPageInfo"),i(window,n,r)}))}function n(){e("Remove ",g)}var t=P;e("Add ",w),u[t]&&(u[t].stopPageInfo=n)}();break;case"pageInfoStop":u[P]&&u[P].stopPageInfo&&(u[P].stopPageInfo(),delete u[P].stopPageInfo);break;case"inPageLink":t=i(9).split("#")[1]||"",s=decodeURIComponent(t),(h=document.getElementById(s)||document.getElementsByName(s)[0])?(e=r(h),p(P,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),a={x:e.x,y:e.y},d(),p(P,"--")):window.top===window.self?p(P,"In page link #"+t+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(t):p(P,"In page link #"+t+" not found and window.parentIFrame not found");break;case"reset":O(A);break;case"init":n(),l("onInit",A.iframe);break;default:0===Number(A.width)&&0===Number(A.height)?k("Unsupported message received ("+A.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}var e,t,s,h,m}())):v(P,"Ignored: "+W)}function S(e,n,t){var i=null,o=null;if(u[e]){if("function"!=typeof(i=u[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function z(e){delete u[e.id]}function F(e){var t=e.id;if(!1!==S(t,"onClose",t)){p(t,"Removing iFrame: "+t);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){k(e)}S(t,"onClosed",t),p(t,"--"),z(e),n&&(n.disconnect(),n=null)}else p(t,"Close iframe cancelled by onClose event")}function M(n){null===a&&p(n,"Get page position: "+(a={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+a.y)}function T(e){null!==a&&(window.scrollTo(a.x,a.y),p(e,"Set page position: "+a.x+","+a.y),j())}function j(){a=null}function O(e){p(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),M(e.id),C((function(){R(e),E("reset","reset",e.iframe,e.id)}),e,"reset")}function R(e){function n(n){r||"0"!==e[n]||(r=!0,p(i,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(u).forEach((function(e){!function(e){function n(n){return"0px"===(u[e]&&u[e].iframe.style[n])}u[e]&&null!==u[e].iframe.offsetParent&&(n("height")||n("width"))&&E("Visibility change","resize",u[e].iframe,e)}(e)}))}function n(n){p("window","Mutation observed: "+n[0].target+" "+n[0].type),A(e,16)}var t,i=m();i&&(t=document.querySelector("body"),new i(n).observe(t,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}())}function t(t){!function(n){e.id?(e.iframe.style[n]=e[n]+"px",p(e.id,"IFrame ("+i+") "+n+" set to "+e[n]+"px")):p("undefined","messageData id not set")}(t),n(t)}var i=e.iframe.id;u[i]&&(u[i].sizeHeight&&t("height"),u[i].sizeWidth&&t("width"))}function C(e,n,t){t!==n.type&&c&&!window.jasmine?(p(n.id,"Requesting animation frame"),c(e)):e()}function E(e,n,t,i,o){var r,a=!1;u[i=i||t.id]&&(t&&"contentWindow"in t&&null!==t.contentWindow?(p(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+(r=u[i]&&u[i].targetOrigin)),t.contentWindow.postMessage(s+n,r)):k(i,"["+e+"] IFrame("+i+") not found"),o&&u[i]&&u[i].warningTimeout&&(u[i].msgTimeout=setTimeout((function(){!u[i]||u[i].loaded||a||(a=!0,k(i,"IFrame has not responded within "+u[i].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),u[i].warningTimeout)))}function N(e){return e+":"+u[e].bodyMarginV1+":"+u[e].sizeWidth+":"+u[e].log+":"+u[e].interval+":"+u[e].enablePublicMethods+":"+u[e].autoResize+":"+u[e].bodyMargin+":"+u[e].heightCalculationMethod+":"+u[e].bodyBackground+":"+u[e].bodyPadding+":"+u[e].tolerance+":"+u[e].inPageLinks+":"+u[e].resizeFrom+":"+u[e].widthCalculationMethod+":"+u[e].mouseEvents}function W(t,r){function s(e){var n=e.split("Callback");if(2===n.length){var t="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[t]=this[e],delete this[e],k(f,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}var a,c,f=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var n;return""===e&&(t.id=(n=r&&r.id||l.id+i++,null!==document.getElementById(n)&&(n+=i++),e=n),o=(r||{}).log,p(e,"Added missing iframe ID: "+e+" ("+t.src+")")),e}(t.id);f in u&&"iFrameResizer"in t?k(f,"Ignored iFrame, already setup."):(function(e){var n;e=e||{},u[f]=Object.create(null),u[f].iframe=t,u[f].firstRun=!0,u[f].remoteHost=t.src&&t.src.split("/").slice(0,3).join("/"),function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(s,e),function(e){for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(u[f][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:l[n])}(e),u[f]&&(u[f].targetOrigin=!0===u[f].checkOrigin?""===(n=u[f].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*")}(r),function(){switch(p(f,"IFrame scrolling "+(u[f]&&u[f].scrolling?"enabled":"disabled")+" for "+f),t.style.overflow=!1===(u[f]&&u[f].scrolling)?"hidden":"auto",u[f]&&u[f].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=u[f]?u[f].scrolling:"no"}}(),function(){function e(e){var n=u[f][e];1/0!==n&&0!==n&&(t.style[e]="number"==typeof n?n+"px":n,p(f,"Set "+e+" = "+t.style[e]))}function n(e){if(u[f]["min"+e]>u[f]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}n("Height"),n("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!=typeof(u[f]&&u[f].bodyMargin)&&"0"!==(u[f]&&u[f].bodyMargin)||(u[f].bodyMarginV1=u[f].bodyMargin,u[f].bodyMargin=u[f].bodyMargin+"px"),a=N(f),(c=m())&&(n=function(e){if(!t.parentNode)return null;var n=new e((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===t&&F(t)}))}))}));return n.observe(t.parentNode,{childList:!0}),n}(c)),w(t,"load",(function(){E("iFrame.onload",a,t,e,!0),(!u[f]||!u[f].firstRun)&&u[f]&&u[f].heightCalculationMethod in d&&O({iframe:t,height:0,width:0,type:"init"})})),E("init",a,t,e,!0),u[f]&&(u[f].iframe.iFrameResizer={close:F.bind(null,u[f].iframe),removeListeners:z.bind(null,u[f].iframe),resize:E.bind(null,"Window resize","resize",u[f].iframe),moveToAnchor:function(e){E("Move to anchor","moveToAnchor:"+e,u[f].iframe,f)},sendMessage:function(e){E("Send Message","message:"+(e=JSON.stringify(e)),u[f].iframe,f)}}))}function A(e,n){null===f&&(f=setTimeout((function(){f=null,e()}),n))}function P(){"hidden"!==document.visibilityState&&(p("document","Trigger event: Visibility change"),A((function(){H("Tab Visible","resize")}),16))}function H(e,n){Object.keys(u).forEach((function(t){(function(e){return u[e]&&"parent"===u[e].resizeFrom&&u[e].autoResize&&!u[e].firstRun})(t)&&E(e,n,u[t].iframe,t)}))}function L(){function n(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),W(n,e),t.push(n))}var t;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!c;e+=1)c=window[n[e]+"RequestAnimationFrame"];c?c=c.bind(window):p("setup","RequestAnimationFrame not supported")}(),w(window,"message",I),w(window,"resize",(function(){p("window","Trigger event: resize"),A((function(){H("Window resize","resize")}),16)})),w(document,"visibilitychange",P),w(document,"-webkit-visibilitychange",P),function(i,o){switch(t=[],function(e){e&&e.enablePublicMethods&&k("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(i),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,i));break;case"object":n(i,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}}()),v.exports));class x{constructor(e,n){this.iframe=e,this.iframeOrigin=n}postMessage(e,n){const t=Object.assign({eventType:e},n);this.iframe.contentWindow.postMessage(t,this.iframeOrigin)}addMessageListener(e){window.addEventListener("message",e)}removeMessageListener(e){window.removeEventListener("message",e)}postMessageWithResponseListener(e,n){return new Promise((t=>{const i=n=>{n.data.eventType===e&&(window.removeEventListener("message",i),t(n.data.data))};window.addEventListener("message",i),this.postMessage(e,n)}))}}const I=class{constructor(n){e(this,n),this.iframeLoaded=i(this,"iframeLoaded",7),this.isFocused=!1,this.isValid=!0,this.dispatchMessageEvent=e=>{const{eventType:n,data:t}=e.data;(null==t?void 0:t.id)===this.inputId&&("focused"===n&&(this.isFocused=!0),"blurred"===n&&(this.isFocused=!1))}}disconnectedCallback(){this.frameService.removeMessageListener(this.dispatchMessageEvent)}async validate(){const e=await this.frameService.postMessageWithResponseListener("validate");return this.isValid=e.isValid,this.errorText=e.error.message,e}async tokenize(e,n,t){return this.frameService.postMessageWithResponseListener("tokenize",{clientId:e,paymentMethodMetadata:n,account:t,componentVersion:h.version})}initializeFrameCommunicationService(){var e;this.frameService=new x(this.iframeElement,this.iframeOrigin),null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent)}get part(){return this.isFocused&&!this.isValid?s:this.isValid?this.isFocused?c:d:a}get style(){return this.isFocused?this.isValid?w.focused:w.focusedAndInvalid:null}get urlParams(){const e=Object.fromEntries(Object.entries(w.fontStyles).map((([e,n])=>[e,btoa(String(n))])));return new URLSearchParams(e).toString()}render(){return n(t,{key:"e85f5a2417ccc46ac8df23a695c6ef3fcd71577e",class:"form-group d-flex flex-column"},n("div",{key:"02878f7fb1e720aa97a67e72d5f1711e0fbd0668",style:{visibility:this.iframeLoaded?"visible":"hidden",height:this.iframeLoaded?"auto":"0"}},n("label",{key:"57c46b739fb284c4ee618594f04cc5ff128bf16c",class:"form-label",htmlFor:"",part:u},this.label||""),n("div",{key:"4634650c721673a52ea55e331154a624c19266dc",class:"p-0 d-flex form-control "+(this.isValid?"":"is-invalid"),part:this.part,style:Object.assign(Object.assign({},this.style),{overflow:"hidden"})},n("iframe",{key:"facd226e399f41537657603c50c45887c1177c42",id:this.inputId,name:this.inputId,src:`${this.iframeOrigin}?${this.urlParams}`,ref:e=>{this.iframeElement=e,this.initializeFrameCommunicationService()},width:"100%",onLoad:()=>{k({log:!1,onResized:()=>{this.iframeLoaded.emit()}},this.iframeElement)}})),n(l,{key:"73c34b9ab89a21e6b3203904988bf8a542eb01f8",errorText:this.errorText,name:this.inputId})))}get el(){return o(this)}};export{b as hidden_input,I as iframe_input}
1
+ import{r as e,h as n,H as t,c as i,g as o}from"./p-CV0Pyo1O.js";import{c as r}from"./p-D8GTwl9v.js";import{a7 as s,q as a,v as c,w as d,x as u}from"./p-DnrawQn3.js";import{g as f}from"./p-BFTU3MAI.js";import{F as l}from"./p-BsQy297i.js";import{p as h}from"./p-BCgsLInF.js";const m=r({focused:{boxShadow:"",border:""},focusedAndInvalid:{boxShadow:"",border:""},fontStyles:{fontFamily:"",fontSize:"",fontWeight:"",lineHeight:"",margin:"",padding:""}}),{state:w,set:g}=m,b=class{constructor(n){e(this,n),this.isFocused=!1,this.errorText=""}focusWithoutPageScroll(e){if(e)try{e.focus({preventScroll:!0})}catch(n){const{scrollX:t,scrollY:i}=window;e.focus(),window.scrollTo(t,i)}}async componentDidLoad(){const e=await this.getBaseFontStyles();g("fontStyles",e);const n=await this.getFocusedStyles();g("focused",n);const t=await this.getFocusedAndInvalidStyles();g("focusedAndInvalid",t)}async getBaseFontStyles(){return new Promise((e=>{setTimeout((()=>{const n=getComputedStyle(this.hiddenInput);e({fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,margin:n.margin,padding:n.padding,color:n.color})}),500)}))}async getFocusedStyles(){return new Promise((e=>{this.focusWithoutPageScroll(this.hiddenInput),setTimeout((()=>{this.hiddenInput.blur();let n=getComputedStyle(this.hiddenInput);e({boxShadow:n.boxShadow,border:n.border})}),500)}))}async getFocusedAndInvalidStyles(){return new Promise((e=>{this.focusWithoutPageScroll(this.hiddenInput),this.errorText="Error",setTimeout((()=>{const n=getComputedStyle(this.hiddenInput),t={boxShadow:n.boxShadow,border:n.border};this.hiddenInput.blur(),e(t)}),500)}))}get part(){return this.isFocused&&this.errorText?s:this.errorText?a:this.isFocused?c:d}render(){return n(t,{key:"5697b5e318914b8866bc6ad2fb2009e5f8c8d80f"},n("input",{key:"3370d11bc6e5a49f28dd2e95bf1d92ee7a0dd892",ref:e=>this.hiddenInput=e,type:"text",class:this.errorText?"form-control is-invalid":"form-control",onFocus:()=>this.isFocused=!0,onBlur:()=>this.isFocused=!1,part:this.part,tabindex:"-1",style:{height:"0",opacity:"0",pointerEvents:"none",animation:"none"}}))}};var p,y,v={exports:{}},k=f((p||(p=1,y=v,console.info("\nIFRAME-RESIZER\n\nIframe-Resizer 5 is now available via the following two packages:\n\n * @iframe-resizer/parent\n * @iframe-resizer/child\n\nAdditionally their are also new versions of iframe-resizer for React, Vue, and jQuery.\n\nVersion 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n"),function(e){if("undefined"!=typeof window){var n,t,i=0,o=!1,r=!1,s="[iFrameSizer]",a=null,c=window.requestAnimationFrame,d=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),u={},f=null,l=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){k("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),h={};window.jQuery!==e&&((t=window.jQuery).fn?t.fn.iFrameResize||(t.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){W(t,e)})).end()}):v("","Unable to bind to jQuery, it is not fully loaded.")),y.exports=H(),window.iFrameResize=window.iFrameResize||H()}function m(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(e,n,t){e.addEventListener(n,t,!1)}function g(e,n,t){e.removeEventListener(n,t,!1)}function b(e){return u[e]?u[e].log:o}function p(e,n){x("log",e,n,b(e))}function v(e,n){x("info",e,n,b(e))}function k(e,n){x("warn",e,n,!0)}function x(e,n,t,i){!0===i&&"object"==typeof window.console&&console[e](function(e){return s+"["+function(e){var n="Host page: "+e;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),n}(e)+"]"}(n),t)}function I(e){function n(){t("Height"),t("Width"),C((function(){R(A),T(L),l("onResized",A)}),A,"init")}function t(e){var n=Number(u[L]["max"+e]),t=Number(u[L]["min"+e]),i=e.toLowerCase(),o=Number(A[i]);p(L,"Checking "+i+" is in range "+t+"-"+n),o<t&&(o=t,p(L,"Set "+i+" to min value")),o>n&&(o=n,p(L,"Set "+i+" to max value")),A[i]=""+o}function i(e){return W.slice(W.indexOf(":")+7+e)}function o(e,n){var t,i;t=function(){var t,i;E("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=A.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},h[i=n]||(h[i]=setTimeout((function(){h[i]=null,t()}),32))}function r(e){var n=e.getBoundingClientRect();return M(L),{x:Math.floor(Number(n.left)+Number(a.x)),y:Math.floor(Number(n.top)+Number(a.y))}}function c(e){var n=e?r(A.iframe):{x:0,y:0},t={x:Number(A.width)+n.x,y:Number(A.height)+n.y};p(L,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(a=t,d(),p(L,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):k(L,"Unable to scroll to requested position, window.parentIFrame not found")}function d(){!1===l("onScroll",a)?j():T(L)}function f(e){var n={};if(0===Number(A.width)&&0===Number(A.height)){var t=i(9).split(":");n={x:t[1],y:t[0]}}else n={x:A.width,y:A.height};l(e,{iframe:A.iframe,screenX:Number(n.x),screenY:Number(n.y),type:A.type})}function l(e,n){return F(L,e,n)}var m,b,y,x,I,S,W=e.data,A={},L=null;"[iFrameResizerChild]Ready"===W?function(){for(var e in u)E("iFrame requested init",N(e),u[e].iframe,e)}():s===(""+W).slice(0,13)&&W.slice(13).split(":")[0]in u?(x=(y=W.slice(13).split(":"))[1]?parseInt(y[1],10):0,I=u[y[0]]&&u[y[0]].iframe,S=getComputedStyle(I),A={iframe:I,id:y[0],height:x+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}(S)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(S),width:y[2],type:y[3]},u[L=A.id]&&(u[L].loaded=!0),(b=A.type in{true:1,false:1,undefined:1})&&p(L,"Ignoring init message from meta parent page"),!b&&function(e){var n=!0;return u[e]||(n=!1,k(A.type+" No settings for "+e+". Message was: "+W)),n}(L)&&(p(L,"Received: "+W),m=!0,null===A.iframe&&(k(L,"IFrame ("+A.id+") not found"),m=!1),m&&function(){var n,t=e.origin,i=u[L]&&u[L].checkOrigin;if(i&&""+t!="null"&&!(i.constructor===Array?function(){var e=0,n=!1;for(p(L,"Checking connection is from allowed list of origins: "+i);e<i.length;e++)if(i[e]===t){n=!0;break}return n}():(p(L,"Checking connection is from: "+(n=u[L]&&u[L].remoteHost)),t===n)))throw new Error("Unexpected message received from: "+t+" for "+A.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(u[L]&&u[L].firstRun&&u[L]&&(u[L].firstRun=!1),A.type){case"close":z(A.iframe);break;case"message":m=i(6),p(L,"onMessage passed: {iframe: "+A.iframe.id+", message: "+m+"}"),l("onMessage",{iframe:A.iframe,message:JSON.parse(m)}),p(L,"--");break;case"mouseenter":f("onMouseEnter");break;case"mouseleave":f("onMouseLeave");break;case"autoResize":u[L].autoResize=JSON.parse(i(9));break;case"scrollTo":c(!1);break;case"scrollToOffset":c(!0);break;case"pageInfo":o(u[L]&&u[L].iframe,L),function(){function e(e,i){function r(){u[t]?o(u[t].iframe,t):n()}["scroll","resize"].forEach((function(n){p(t,e+n+" listener for sendPageInfo"),i(window,n,r)}))}function n(){e("Remove ",g)}var t=L;e("Add ",w),u[t]&&(u[t].stopPageInfo=n)}();break;case"pageInfoStop":u[L]&&u[L].stopPageInfo&&(u[L].stopPageInfo(),delete u[L].stopPageInfo);break;case"inPageLink":t=i(9).split("#")[1]||"",s=decodeURIComponent(t),(h=document.getElementById(s)||document.getElementsByName(s)[0])?(e=r(h),p(L,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),a={x:e.x,y:e.y},d(),p(L,"--")):window.top===window.self?p(L,"In page link #"+t+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(t):p(L,"In page link #"+t+" not found and window.parentIFrame not found");break;case"reset":O(A);break;case"init":n(),l("onInit",A.iframe);break;default:0===Number(A.width)&&0===Number(A.height)?k("Unsupported message received ("+A.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}var e,t,s,h,m}())):v(L,"Ignored: "+W)}function F(e,n,t){var i=null,o=null;if(u[e]){if("function"!=typeof(i=u[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function S(e){delete u[e.id]}function z(e){var t=e.id;if(!1!==F(t,"onClose",t)){p(t,"Removing iFrame: "+t);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){k(e)}F(t,"onClosed",t),p(t,"--"),S(e),n&&(n.disconnect(),n=null)}else p(t,"Close iframe cancelled by onClose event")}function M(n){null===a&&p(n,"Get page position: "+(a={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+a.y)}function T(e){null!==a&&(window.scrollTo(a.x,a.y),p(e,"Set page position: "+a.x+","+a.y),j())}function j(){a=null}function O(e){p(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),M(e.id),C((function(){R(e),E("reset","reset",e.iframe,e.id)}),e,"reset")}function R(e){function n(n){r||"0"!==e[n]||(r=!0,p(i,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(u).forEach((function(e){!function(e){function n(n){return"0px"===(u[e]&&u[e].iframe.style[n])}u[e]&&null!==u[e].iframe.offsetParent&&(n("height")||n("width"))&&E("Visibility change","resize",u[e].iframe,e)}(e)}))}function n(n){p("window","Mutation observed: "+n[0].target+" "+n[0].type),A(e,16)}var t,i=m();i&&(t=document.querySelector("body"),new i(n).observe(t,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}())}function t(t){!function(n){e.id?(e.iframe.style[n]=e[n]+"px",p(e.id,"IFrame ("+i+") "+n+" set to "+e[n]+"px")):p("undefined","messageData id not set")}(t),n(t)}var i=e.iframe.id;u[i]&&(u[i].sizeHeight&&t("height"),u[i].sizeWidth&&t("width"))}function C(e,n,t){t!==n.type&&c&&!window.jasmine?(p(n.id,"Requesting animation frame"),c(e)):e()}function E(e,n,t,i,o){var r,a=!1;u[i=i||t.id]&&(t&&"contentWindow"in t&&null!==t.contentWindow?(p(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+(r=u[i]&&u[i].targetOrigin)),t.contentWindow.postMessage(s+n,r)):k(i,"["+e+"] IFrame("+i+") not found"),o&&u[i]&&u[i].warningTimeout&&(u[i].msgTimeout=setTimeout((function(){!u[i]||u[i].loaded||a||(a=!0,k(i,"IFrame has not responded within "+u[i].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),u[i].warningTimeout)))}function N(e){return e+":"+u[e].bodyMarginV1+":"+u[e].sizeWidth+":"+u[e].log+":"+u[e].interval+":"+u[e].enablePublicMethods+":"+u[e].autoResize+":"+u[e].bodyMargin+":"+u[e].heightCalculationMethod+":"+u[e].bodyBackground+":"+u[e].bodyPadding+":"+u[e].tolerance+":"+u[e].inPageLinks+":"+u[e].resizeFrom+":"+u[e].widthCalculationMethod+":"+u[e].mouseEvents}function W(t,r){function s(e){var n=e.split("Callback");if(2===n.length){var t="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[t]=this[e],delete this[e],k(f,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}var a,c,f=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var n;return""===e&&(t.id=(n=r&&r.id||l.id+i++,null!==document.getElementById(n)&&(n+=i++),e=n),o=(r||{}).log,p(e,"Added missing iframe ID: "+e+" ("+t.src+")")),e}(t.id);f in u&&"iFrameResizer"in t?k(f,"Ignored iFrame, already setup."):(function(e){var n;e=e||{},u[f]=Object.create(null),u[f].iframe=t,u[f].firstRun=!0,u[f].remoteHost=t.src&&t.src.split("/").slice(0,3).join("/"),function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(s,e),function(e){for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(u[f][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:l[n])}(e),u[f]&&(u[f].targetOrigin=!0===u[f].checkOrigin?""===(n=u[f].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*")}(r),function(){switch(p(f,"IFrame scrolling "+(u[f]&&u[f].scrolling?"enabled":"disabled")+" for "+f),t.style.overflow=!1===(u[f]&&u[f].scrolling)?"hidden":"auto",u[f]&&u[f].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=u[f]?u[f].scrolling:"no"}}(),function(){function e(e){var n=u[f][e];1/0!==n&&0!==n&&(t.style[e]="number"==typeof n?n+"px":n,p(f,"Set "+e+" = "+t.style[e]))}function n(e){if(u[f]["min"+e]>u[f]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}n("Height"),n("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!=typeof(u[f]&&u[f].bodyMargin)&&"0"!==(u[f]&&u[f].bodyMargin)||(u[f].bodyMarginV1=u[f].bodyMargin,u[f].bodyMargin=u[f].bodyMargin+"px"),a=N(f),(c=m())&&(n=function(e){if(!t.parentNode)return null;var n=new e((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===t&&z(t)}))}))}));return n.observe(t.parentNode,{childList:!0}),n}(c)),w(t,"load",(function(){E("iFrame.onload",a,t,e,!0),(!u[f]||!u[f].firstRun)&&u[f]&&u[f].heightCalculationMethod in d&&O({iframe:t,height:0,width:0,type:"init"})})),E("init",a,t,e,!0),u[f]&&(u[f].iframe.iFrameResizer={close:z.bind(null,u[f].iframe),removeListeners:S.bind(null,u[f].iframe),resize:E.bind(null,"Window resize","resize",u[f].iframe),moveToAnchor:function(e){E("Move to anchor","moveToAnchor:"+e,u[f].iframe,f)},sendMessage:function(e){E("Send Message","message:"+(e=JSON.stringify(e)),u[f].iframe,f)}}))}function A(e,n){null===f&&(f=setTimeout((function(){f=null,e()}),n))}function L(){"hidden"!==document.visibilityState&&(p("document","Trigger event: Visibility change"),A((function(){P("Tab Visible","resize")}),16))}function P(e,n){Object.keys(u).forEach((function(t){(function(e){return u[e]&&"parent"===u[e].resizeFrom&&u[e].autoResize&&!u[e].firstRun})(t)&&E(e,n,u[t].iframe,t)}))}function H(){function n(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),W(n,e),t.push(n))}var t;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!c;e+=1)c=window[n[e]+"RequestAnimationFrame"];c?c=c.bind(window):p("setup","RequestAnimationFrame not supported")}(),w(window,"message",I),w(window,"resize",(function(){p("window","Trigger event: resize"),A((function(){P("Window resize","resize")}),16)})),w(document,"visibilitychange",L),w(document,"-webkit-visibilitychange",L),function(i,o){switch(t=[],function(e){e&&e.enablePublicMethods&&k("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(i),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,i));break;case"object":n(i,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}}()),v.exports));class x{constructor(e,n){this.iframe=e,this.iframeOrigin=n}postMessage(e,n){const t=Object.assign({eventType:e},n);this.iframe.contentWindow.postMessage(t,this.iframeOrigin)}addMessageListener(e){window.addEventListener("message",e)}removeMessageListener(e){window.removeEventListener("message",e)}postMessageWithResponseListener(e,n){return new Promise((t=>{const i=n=>{n.data.eventType===e&&(window.removeEventListener("message",i),t(n.data.data))};window.addEventListener("message",i),this.postMessage(e,n)}))}}const I=class{constructor(n){e(this,n),this.iframeLoaded=i(this,"iframeLoaded",7),this.isFocused=!1,this.isValid=!0,this.dispatchMessageEvent=e=>{const{eventType:n,data:t}=e.data;(null==t?void 0:t.id)===this.inputId&&("focused"===n&&(this.isFocused=!0),"blurred"===n&&(this.isFocused=!1))}}disconnectedCallback(){this.frameService.removeMessageListener(this.dispatchMessageEvent)}async validate(){const e=await this.frameService.postMessageWithResponseListener("validate");return this.isValid=e.isValid,this.errorText=e.error.message,e}async tokenize(e,n,t){return this.frameService.postMessageWithResponseListener("tokenize",{clientId:e,paymentMethodMetadata:n,account:t,componentVersion:h.version})}initializeFrameCommunicationService(){var e;this.frameService=new x(this.iframeElement,this.iframeOrigin),null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent)}get part(){return this.isFocused&&!this.isValid?s:this.isValid?this.isFocused?c:d:a}get style(){return this.isFocused?this.isValid?w.focused:w.focusedAndInvalid:null}get urlParams(){const e=Object.fromEntries(Object.entries(w.fontStyles).map((([e,n])=>[e,btoa(String(n))])));return new URLSearchParams(e).toString()}render(){return n(t,{key:"e85f5a2417ccc46ac8df23a695c6ef3fcd71577e",class:"form-group d-flex flex-column"},n("div",{key:"02878f7fb1e720aa97a67e72d5f1711e0fbd0668",style:{visibility:this.iframeLoaded?"visible":"hidden",height:this.iframeLoaded?"auto":"0"}},n("label",{key:"57c46b739fb284c4ee618594f04cc5ff128bf16c",class:"form-label",htmlFor:"",part:u},this.label||""),n("div",{key:"4634650c721673a52ea55e331154a624c19266dc",class:"p-0 d-flex form-control "+(this.isValid?"":"is-invalid"),part:this.part,style:Object.assign(Object.assign({},this.style),{overflow:"hidden"})},n("iframe",{key:"facd226e399f41537657603c50c45887c1177c42",id:this.inputId,name:this.inputId,src:`${this.iframeOrigin}?${this.urlParams}`,ref:e=>{this.iframeElement=e,this.initializeFrameCommunicationService()},width:"100%",onLoad:()=>{k({log:!1,onResized:()=>{this.iframeLoaded.emit()}},this.iframeElement)}})),n(l,{key:"73c34b9ab89a21e6b3203904988bf8a542eb01f8",errorText:this.errorText,name:this.inputId})))}get el(){return o(this)}};export{b as hidden_input,I as iframe_input}
@@ -1 +1 @@
1
- import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-Dbg501Lu.js";import{m as i}from"./p-DWevPe7C.js";import{C as c,e as d,g as b}from"./p-CUI41_5y.js";import{J as f}from"./p-cXPhRFs-.js";import{c as l}from"./p-GP5gWjhc.js";import"./p-DVJaoI_m.js";import{b as r,d as h,s as o}from"./p-BRnBHsdq.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{a as p}from"./p-BH0Xfn-F.js";import{P as n,M as m}from"./p-D1D2eC05.js";import{a as y,b as u,D as v,c as k,C as j,E as g}from"./p-x9fFFf7F.js";import{S as C}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{S as D}from"./p-DcBvJu0k.js";import{a as w,B as P}from"./p-pL4dNfsl.js";import"./p-CYQvLgSs.js";import"./p-HXpYMWUU.js";import"./p-B5vVjDc_.js";import"./p-CXKOe1m5.js";import"./p-D8GTwl9v.js";import"./p-DnrawQn3.js";const x=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(D,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(D,{width:"70%"})),e("div",{class:"col-12"},e(D,{width:"40%"})),e("div",{class:"col-12"},e(D,{width:"40%"})),e("div",{class:"col-12"},e(D,{width:"100%"})),e("div",{class:"col-12"},e(D,{width:"80%"}))),B=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(){l(),this.analytics=new f(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:d.MISSING_PROPS,severity:c.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===b.disputed&&this.payment.disputes.some((e=>e.status===p.lost))?n.DISPUTE_LOST:this.payment.status}render(){return e(C,{key:"6d899226b71c2f8c80bf42ba0bd3de9d069582e8"},this.loading&&e(x,{key:"8e17e3f4c880ace7b87270e768610e9ece6e761a"}),!this.loading&&this.errorMessage&&g(this.errorMessage),!this.loading&&!this.errorMessage&&this.payment&&e("justifi-details",{key:"2f5ea94a1fec18581a06f171c34850fc1423ec1f",errorMessage:this.errorMessage},e(y,{key:"5f011ef4b84acc2c16974293079c2d7b0134f8c6",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},m(this.PaymentStatus),this.payment.expedited?e(w,{variant:P.WARNING,title:"Expedited",text:"Expedited"}):null),title:this.payment.formattedPaymentAmount(this.payment.amount)},e(u,{key:"5c075c53a5c589b7bc65ab60bf2ef7d8a67a7afb",classes:"border-1 border-end",title:"Updated At",value:`${r(this.payment.updated_at)} ${h(this.payment.updated_at)}`}),e(u,{key:"01786dce8a3c582fbd1f471174ecd13f95604e24",classes:"border-1 border-end",title:"Created At",value:`${r(this.payment.created_at)} ${h(this.payment.created_at)}`}),e(u,{key:"b04c5c8dfc64aba71d9cc0cd84c25bd32bdc887f",title:"ID",value:this.payment.id})),e("div",{key:"52bb00c09abe0745a03f264b3667584c10f58eee",slot:"detail-sections"},e(v,{key:"0672c1ed0c4e7f109531e120f61256927eba48eb",sectionTitle:"Details"}),e("div",{key:"d784569e100926eefb120e1a4b2d9a4d6da4238a",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"58192f1824f4b02a206b6c442e63b86fc90ea742",title:"Amount",value:this.payment.formattedPaymentAmount(this.payment.amount)}),e(k,{key:"0b885dc6f6f7a4890666ecdb2a1cc801bbf1df31",title:"Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"e517d5dbd76cf451e89f803f26b0375a6fd0420b",title:"Refunded",value:this.payment.formattedPaymentAmount(this.payment.amount_refunded)}),e(k,{key:"ec3cf850c0217230794e6487861dbab0da5ad463",title:"Net",value:this.payment.formattedPaymentAmount(this.payment.balance)}),e(k,{key:"8f0d1f4b858ff459b9d08c168ff204e87a0c715e",title:"Status",value:m(this.PaymentStatus)}),e(k,{key:"819e1c1dbf090c664430b8e00ede6a88b9ecf5c2",title:"Payment ID",value:this.payment.id}),e(k,{key:"a86688bc8015db6b1034e6dd2a9819e1dbe5bb30",title:"Processing Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"7dbb9825135d66711e65fb1b1bb2be228d65bb57",title:"Statement Descriptor",value:this.payment.statement_descriptor}),e(k,{key:"0455c1b7e853ba4e16197cdca3e2f0b16455362a",title:"Description",value:this.payment.description}),e(k,{key:"b052be4a1a349eb6a439e5c4be4424f966c55e60",title:"Expedited",value:this.payment.expedited?"Yes":"No"})),this.payment.payment_method.card&&[e(v,{key:"dca0ae73fa7f879d6cfb3f3b20331cf48d6081e4",sectionTitle:"Payment Method"}),e("div",{key:"fd3dd48f6ad1f3565459fb3ac10115f0b32051f9",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"8c00d775e7c4ef57689574974ee47b7c87f98b13",title:"ID",value:this.payment.payment_method.card.id}),e(k,{key:"2d3bc94126c2a02cb32fca8d952a238fdc0960c6",title:"Payment Type",value:"Card"}),e(k,{key:"16938c62ba1eafbf79af00c90c66c7250a81fbbb",title:"Last 4 Numbers",value:this.payment.payment_method.lastFourDigits}),e(k,{key:"04d9f9a2a7e3ace45f4b0001cf53b069f470529a",title:"Brand",value:o(this.payment.payment_method.card.brand)}),e(k,{key:"559be48e5ac2083369e7984d53e85ee5fbbab008",title:"Cardholder",value:this.payment.payment_method.payersName}))],this.payment.payment_method.bank_account&&[e(v,{key:"25277f2e5526747de9f45416050c6b72873e382b",sectionTitle:"Payment Method"}),e("div",{key:"e0b69c8397665a33c1f0d14bd9438b19e70b8636",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"ff0365efd2c8ed7a2aa7d3552504a6d9097c28b3",title:"ID",value:this.payment.payment_method.bank_account.id}),e(k,{key:"269d136045549cd12e4519e7f4abf3b6d221da85",title:"Last 4 Numbers",value:this.payment.last_four_digits}),e(k,{key:"31b5aaf03f5bf15267ac16b4b4a2d26f0a01e988",title:"Bank Name",value:this.payment.payment_method.bank_account.brand}),e(k,{key:"15f9c03d3514ebb78d25955497a728c8a2c53f7e",title:"Account Owner",value:this.payment.payment_method.payersName}))],this.payment.metadata&&[e(v,{key:"dac3bf342764c2e10ac6b64eabc5ef0366446a31",sectionTitle:"Metadata"}),e("div",{key:"2fe93fb287b469a5b1f3230b5f657216815d1164",class:"d-table gap-2 w-100"},e(j,{key:"f77b6a4ebeb88b82fe8342789bd16b7b22f24db9",metadata:this.payment.metadata}))])))}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"],getPaymentDetails:["updateOnPropChange"]}}};export{B as justifi_payment_details}
1
+ import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-Dbg501Lu.js";import{m as i}from"./p-DWevPe7C.js";import{C as d,e as c,g as b}from"./p-CUI41_5y.js";import{J as f}from"./p-BnaR7f2G.js";import{c as l}from"./p-BJ7GFTiW.js";import"./p-DVJaoI_m.js";import{b as r,d as h,s as o}from"./p-BRnBHsdq.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{a as p}from"./p-BH0Xfn-F.js";import{P as n,M as m}from"./p-D1D2eC05.js";import{a as y,b as u,D as v,c as k,C as j,E as g}from"./p-x9fFFf7F.js";import{S as C}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{S as D}from"./p-DcBvJu0k.js";import{a as w,B as P}from"./p-pL4dNfsl.js";import"./p-CYQvLgSs.js";import"./p-HXpYMWUU.js";import"./p-B5vVjDc_.js";import"./p-BCgsLInF.js";import"./p-D8GTwl9v.js";import"./p-DnrawQn3.js";const x=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(D,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(D,{width:"70%"})),e("div",{class:"col-12"},e(D,{width:"40%"})),e("div",{class:"col-12"},e(D,{width:"40%"})),e("div",{class:"col-12"},e(D,{width:"100%"})),e("div",{class:"col-12"},e(D,{width:"80%"}))),B=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(){l(),this.analytics=new f(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===b.disputed&&this.payment.disputes.some((e=>e.status===p.lost))?n.DISPUTE_LOST:this.payment.status}render(){return e(C,{key:"6d899226b71c2f8c80bf42ba0bd3de9d069582e8"},this.loading&&e(x,{key:"8e17e3f4c880ace7b87270e768610e9ece6e761a"}),!this.loading&&this.errorMessage&&g(this.errorMessage),!this.loading&&!this.errorMessage&&this.payment&&e("justifi-details",{key:"2f5ea94a1fec18581a06f171c34850fc1423ec1f",errorMessage:this.errorMessage},e(y,{key:"5f011ef4b84acc2c16974293079c2d7b0134f8c6",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},m(this.PaymentStatus),this.payment.expedited?e(w,{variant:P.WARNING,title:"Expedited",text:"Expedited"}):null),title:this.payment.formattedPaymentAmount(this.payment.amount)},e(u,{key:"5c075c53a5c589b7bc65ab60bf2ef7d8a67a7afb",classes:"border-1 border-end",title:"Updated At",value:`${r(this.payment.updated_at)} ${h(this.payment.updated_at)}`}),e(u,{key:"01786dce8a3c582fbd1f471174ecd13f95604e24",classes:"border-1 border-end",title:"Created At",value:`${r(this.payment.created_at)} ${h(this.payment.created_at)}`}),e(u,{key:"b04c5c8dfc64aba71d9cc0cd84c25bd32bdc887f",title:"ID",value:this.payment.id})),e("div",{key:"52bb00c09abe0745a03f264b3667584c10f58eee",slot:"detail-sections"},e(v,{key:"0672c1ed0c4e7f109531e120f61256927eba48eb",sectionTitle:"Details"}),e("div",{key:"d784569e100926eefb120e1a4b2d9a4d6da4238a",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"58192f1824f4b02a206b6c442e63b86fc90ea742",title:"Amount",value:this.payment.formattedPaymentAmount(this.payment.amount)}),e(k,{key:"0b885dc6f6f7a4890666ecdb2a1cc801bbf1df31",title:"Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"e517d5dbd76cf451e89f803f26b0375a6fd0420b",title:"Refunded",value:this.payment.formattedPaymentAmount(this.payment.amount_refunded)}),e(k,{key:"ec3cf850c0217230794e6487861dbab0da5ad463",title:"Net",value:this.payment.formattedPaymentAmount(this.payment.balance)}),e(k,{key:"8f0d1f4b858ff459b9d08c168ff204e87a0c715e",title:"Status",value:m(this.PaymentStatus)}),e(k,{key:"819e1c1dbf090c664430b8e00ede6a88b9ecf5c2",title:"Payment ID",value:this.payment.id}),e(k,{key:"a86688bc8015db6b1034e6dd2a9819e1dbe5bb30",title:"Processing Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"7dbb9825135d66711e65fb1b1bb2be228d65bb57",title:"Statement Descriptor",value:this.payment.statement_descriptor}),e(k,{key:"0455c1b7e853ba4e16197cdca3e2f0b16455362a",title:"Description",value:this.payment.description}),e(k,{key:"b052be4a1a349eb6a439e5c4be4424f966c55e60",title:"Expedited",value:this.payment.expedited?"Yes":"No"})),this.payment.payment_method.card&&[e(v,{key:"dca0ae73fa7f879d6cfb3f3b20331cf48d6081e4",sectionTitle:"Payment Method"}),e("div",{key:"fd3dd48f6ad1f3565459fb3ac10115f0b32051f9",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"8c00d775e7c4ef57689574974ee47b7c87f98b13",title:"ID",value:this.payment.payment_method.card.id}),e(k,{key:"2d3bc94126c2a02cb32fca8d952a238fdc0960c6",title:"Payment Type",value:"Card"}),e(k,{key:"16938c62ba1eafbf79af00c90c66c7250a81fbbb",title:"Last 4 Numbers",value:this.payment.payment_method.lastFourDigits}),e(k,{key:"04d9f9a2a7e3ace45f4b0001cf53b069f470529a",title:"Brand",value:o(this.payment.payment_method.card.brand)}),e(k,{key:"559be48e5ac2083369e7984d53e85ee5fbbab008",title:"Cardholder",value:this.payment.payment_method.payersName}))],this.payment.payment_method.bank_account&&[e(v,{key:"25277f2e5526747de9f45416050c6b72873e382b",sectionTitle:"Payment Method"}),e("div",{key:"e0b69c8397665a33c1f0d14bd9438b19e70b8636",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"ff0365efd2c8ed7a2aa7d3552504a6d9097c28b3",title:"ID",value:this.payment.payment_method.bank_account.id}),e(k,{key:"269d136045549cd12e4519e7f4abf3b6d221da85",title:"Last 4 Numbers",value:this.payment.last_four_digits}),e(k,{key:"31b5aaf03f5bf15267ac16b4b4a2d26f0a01e988",title:"Bank Name",value:this.payment.payment_method.bank_account.brand}),e(k,{key:"15f9c03d3514ebb78d25955497a728c8a2c53f7e",title:"Account Owner",value:this.payment.payment_method.payersName}))],this.payment.metadata&&[e(v,{key:"dac3bf342764c2e10ac6b64eabc5ef0366446a31",sectionTitle:"Metadata"}),e("div",{key:"2fe93fb287b469a5b1f3230b5f657216815d1164",class:"d-table gap-2 w-100"},e(j,{key:"f77b6a4ebeb88b82fe8342789bd16b7b22f24db9",metadata:this.payment.metadata}))])))}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"],getPaymentDetails:["updateOnPropChange"]}}};export{B as justifi_payment_details}
@@ -1 +1 @@
1
- import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-CX36GHQP.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{i,C as d,e as c}from"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{g as o,a as r}from"./p-B5vVjDc_.js";import{h,b as f,d as l}from"./p-BRnBHsdq.js";import{a as p,b,D as n,c as v,C as u,E as m}from"./p-x9fFFf7F.js";import{J as y}from"./p-cXPhRFs-.js";import{m as k,M as j}from"./p-Cej-1bD6.js";import{c as C}from"./p-GP5gWjhc.js";import{B as g}from"./p-2LVpxCS_.js";import{S as w}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{S as x}from"./p-DcBvJu0k.js";import{a as D,B as S}from"./p-pL4dNfsl.js";import"./p-CYQvLgSs.js";import"./p-D8GTwl9v.js";import"./p-DnrawQn3.js";import"./p-CXKOe1m5.js";const T=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(x,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(x,{width:"70%"})),e("div",{class:"col-12"},e(x,{width:"40%"})),e("div",{class:"col-12"},e(x,{width:"40%"})),e("div",{class:"col-12"},e(x,{width:"100%"})),e("div",{class:"col-12"},e(x,{width:"80%"}))),B=class{constructor(e){t(this,e),this.errorEvent=a(this,"error-event",7),this.recordClickEvent=a(this,"record-click-event",7),this.enableRecordClick=!1,this.loading=!0,this.errorMessage=null,this.downloadCSV=()=>{this.getPayoutCSV({payoutId:this.payout.id,onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({message:e,errorCode:t,severity:a})}})},this.handleRecordClick=e=>{this.recordClickEvent.emit({id:e,type:"account"})}}componentWillLoad(){C(),this.analytics=new y(this),this.initializeServices(),this.getPayout&&this.fetchData()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeServices()}getPayoutWatcher(){this.fetchData()}initializeServices(){this.payoutId&&this.authToken?(this.getPayout=(({id:e,authToken:t,service:a})=>async({onSuccess:s,onError:c})=>{var h;try{const f=await a.fetchPayout(e,t);f.error?c({error:r(f.error),code:o(null===(h=f.error)||void 0===h?void 0:h.code),severity:d.ERROR}):s(new i(f.data))}catch(e){c({error:r(e),code:o(null==e?void 0:e.code),severity:d.ERROR})}})({id:this.payoutId,authToken:this.authToken,service:new s}),this.getPayoutCSV=k({authToken:this.authToken,service:new s})):(this.errorMessage="Failed to load payout details. payoutId or authToken is not provided.",this.errorEvent.emit({message:this.errorMessage,errorCode:c.MISSING_PROPS,severity:d.ERROR}))}fetchData(){this.loading=!0,this.getPayout({onSuccess:e=>{this.errorMessage=null,this.payout=e,this.loading=!1},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({message:e,errorCode:t,severity:a}),this.loading=!1}})}formatMethod(e){return"ach"===e?"ACH":h(e)}render(){var t;return e(w,{key:"83a5916c440ac2cc4efe216dd175c8816e23c815"},this.loading&&e(T,{key:"d11ad391a3eaacc5dd6a9a0303d80f496955d369"}),!this.loading&&this.errorMessage&&m(this.errorMessage),!this.loading&&this.payout&&e("justifi-details",{key:"a3be08ef5ad0882ec4a611aa597b0b69914cb560",errorMessage:this.errorMessage},e(p,{key:"4cea018e82c69b391a5dfc326d0ebb2aac43bcee",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},j(null===(t=this.payout)||void 0===t?void 0:t.status),e(D,"expedited"===this.payout.settlement_priority?{variant:S.WARNING,title:"Expedited",text:"Expedited"}:{variant:S.SECONDARY,title:"Standard",text:"Standard"})),title:this.payout.formattedPaymentAmount(this.payout.amount)},e(b,{key:"4f44184dcdf1313048d9a2ee5c9be928c1a2b5ef",classes:"border-1 border-end",title:"Updated At",value:`${f(this.payout.updated_at)} ${l(this.payout.updated_at)}`}),e(b,{key:"d6042bde890fcd4b8ff63856d53debf289ab6d2d",classes:"border-1 border-end",title:"Created At",value:`${f(this.payout.created_at)} ${l(this.payout.created_at)}`}),e(b,{key:"2866ed7c297a0815bad29bfca699893ead3af6ca",title:"ID",value:this.payout.id}),e("div",{key:"1a7a105da3b0297f90c9a33fe76aa650c9c5aaa0",class:"m-4"},e(g,{key:"31d8cb414516d5b4244179e6e905cb0d6f4499fa",variant:"outline-secondary",class:"btn btn-outline-secondary d-flex align-items-center",onClick:this.downloadCSV},"Export CSV"))),e("div",{key:"1c1c4896b3f2a0c463880c082fdb43fdd6996de3",slot:"detail-sections"},e(n,{key:"481c8f87d29ba4583a40370415fd6f144a601462",sectionTitle:"Details"}),e("div",{key:"2f0f38440296dc01dee0fefab2b7f6a1bd04e4bf",class:"d-flex flex-column gap-2 w-100"},e(v,{key:"d8fe26cee63860bc4e02ffad0e64834ea888d8e3",title:"Date paid",value:f(this.payout.deposits_at)}),e(v,{key:"d4a94c5ad5a78c41d314377316ce71db24b79db5",title:"Statement Description",value:this.payout.description}),e(v,{key:"fea138338da1c74d26dacfeaa15642962346658c",title:"Payout Method",value:this.formatMethod(this.payout.delivery_method)}),e(v,{key:"f77701ef18590ed73431614f421b9d76a9b83da6",title:"Amount",value:this.payout.formattedPaymentAmount(this.payout.amount)}),e(v,{key:"af2401b0ad8b35f55283d74eae20fdf7ceea0b82",title:"Fee",value:this.payout.formattedPaymentAmount(this.payout.fees_total)})),e(n,{key:"96801f26f15e665e856262f65c0c6cea6f92bd9a",sectionTitle:"Account"}),e("div",{key:"54578f116a6b23c5c1dce11d450eb18be304ab65",class:"d-flex flex-column gap-2 w-100"},e(v,{key:"fa8ab204001e4be0cf2aa71fa2f955532f1ac81c",title:"ID",value:this.payout.account_id,onClick:this.enableRecordClick?()=>this.handleRecordClick(this.payout.account_id):void 0}),e(v,{key:"a0e1afcd7e7d86afb500cf876b7b61e74183f4c9",title:"Account Type",value:this.payout.bank_account.account_type}),e(v,{key:"6b78025d11ac562f6950f07d3dc8e5c4041a236f",title:"Institution",value:this.payout.bank_account.account_type}),e(v,{key:"93f4f6d947d1b621de0b1d2a24dbcf83e9c909ef",title:"Routing Number",value:this.payout.bank_account.routing_number}),e(v,{key:"cbe9a97153516dd2cbf6af4337179652d0f834ac",title:"Account Number",value:`**** ${this.payout.bank_account.account_number_last4}`})),this.payout.metadata&&[e(n,{key:"706f2d164a736fb80a8c91018f61e7667eb12be6",sectionTitle:"Metadata"}),e("div",{key:"5be03b700c79d747899db7d9bee8a060c5de7894",class:"d-table gap-2 w-100"},e(u,{key:"8dc3aa6522c59f7a5739eda61354bb1ac58ee3ac",metadata:this.payout.metadata}))])))}static get watchers(){return{payoutId:["propChanged"],authToken:["propChanged"],getPayout:["getPayoutWatcher"]}}};export{B as justifi_payout_details}
1
+ import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-CX36GHQP.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{i,C as d,e as c}from"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{g as o,a as r}from"./p-B5vVjDc_.js";import{h,b as f,d as l}from"./p-BRnBHsdq.js";import{a as n,b as p,D as b,c as v,C as u,E as m}from"./p-x9fFFf7F.js";import{J as y}from"./p-BnaR7f2G.js";import{m as k,M as j}from"./p-Cej-1bD6.js";import{c as C}from"./p-BJ7GFTiW.js";import{B as g}from"./p-2LVpxCS_.js";import{S as w}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{S as x}from"./p-DcBvJu0k.js";import{a as D,B}from"./p-pL4dNfsl.js";import"./p-CYQvLgSs.js";import"./p-D8GTwl9v.js";import"./p-DnrawQn3.js";import"./p-BCgsLInF.js";const S=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(x,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(x,{width:"70%"})),e("div",{class:"col-12"},e(x,{width:"40%"})),e("div",{class:"col-12"},e(x,{width:"40%"})),e("div",{class:"col-12"},e(x,{width:"100%"})),e("div",{class:"col-12"},e(x,{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.enableRecordClick=!1,this.loading=!0,this.errorMessage=null,this.downloadCSV=()=>{this.getPayoutCSV({payoutId:this.payout.id,onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({message:e,errorCode:t,severity:a})}})},this.handleRecordClick=e=>{this.recordClickEvent.emit({id:e,type:"account"})}}componentWillLoad(){C(),this.analytics=new y(this),this.initializeServices(),this.getPayout&&this.fetchData()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeServices()}getPayoutWatcher(){this.fetchData()}initializeServices(){this.payoutId&&this.authToken?(this.getPayout=(({id:e,authToken:t,service:a})=>async({onSuccess:s,onError:c})=>{var h;try{const f=await a.fetchPayout(e,t);f.error?c({error:r(f.error),code:o(null===(h=f.error)||void 0===h?void 0:h.code),severity:d.ERROR}):s(new i(f.data))}catch(e){c({error:r(e),code:o(null==e?void 0:e.code),severity:d.ERROR})}})({id:this.payoutId,authToken:this.authToken,service:new s}),this.getPayoutCSV=k({authToken:this.authToken,service:new s})):(this.errorMessage="Failed to load payout details. payoutId or authToken is not provided.",this.errorEvent.emit({message:this.errorMessage,errorCode:c.MISSING_PROPS,severity:d.ERROR}))}fetchData(){this.loading=!0,this.getPayout({onSuccess:e=>{this.errorMessage=null,this.payout=e,this.loading=!1},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({message:e,errorCode:t,severity:a}),this.loading=!1}})}formatMethod(e){return"ach"===e?"ACH":h(e)}render(){var t;return e(w,{key:"83a5916c440ac2cc4efe216dd175c8816e23c815"},this.loading&&e(S,{key:"d11ad391a3eaacc5dd6a9a0303d80f496955d369"}),!this.loading&&this.errorMessage&&m(this.errorMessage),!this.loading&&this.payout&&e("justifi-details",{key:"a3be08ef5ad0882ec4a611aa597b0b69914cb560",errorMessage:this.errorMessage},e(n,{key:"4cea018e82c69b391a5dfc326d0ebb2aac43bcee",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},j(null===(t=this.payout)||void 0===t?void 0:t.status),e(D,"expedited"===this.payout.settlement_priority?{variant:B.WARNING,title:"Expedited",text:"Expedited"}:{variant:B.SECONDARY,title:"Standard",text:"Standard"})),title:this.payout.formattedPaymentAmount(this.payout.amount)},e(p,{key:"4f44184dcdf1313048d9a2ee5c9be928c1a2b5ef",classes:"border-1 border-end",title:"Updated At",value:`${f(this.payout.updated_at)} ${l(this.payout.updated_at)}`}),e(p,{key:"d6042bde890fcd4b8ff63856d53debf289ab6d2d",classes:"border-1 border-end",title:"Created At",value:`${f(this.payout.created_at)} ${l(this.payout.created_at)}`}),e(p,{key:"2866ed7c297a0815bad29bfca699893ead3af6ca",title:"ID",value:this.payout.id}),e("div",{key:"1a7a105da3b0297f90c9a33fe76aa650c9c5aaa0",class:"m-4"},e(g,{key:"31d8cb414516d5b4244179e6e905cb0d6f4499fa",variant:"outline-secondary",class:"btn btn-outline-secondary d-flex align-items-center",onClick:this.downloadCSV},"Export CSV"))),e("div",{key:"1c1c4896b3f2a0c463880c082fdb43fdd6996de3",slot:"detail-sections"},e(b,{key:"481c8f87d29ba4583a40370415fd6f144a601462",sectionTitle:"Details"}),e("div",{key:"2f0f38440296dc01dee0fefab2b7f6a1bd04e4bf",class:"d-flex flex-column gap-2 w-100"},e(v,{key:"d8fe26cee63860bc4e02ffad0e64834ea888d8e3",title:"Date paid",value:f(this.payout.deposits_at)}),e(v,{key:"d4a94c5ad5a78c41d314377316ce71db24b79db5",title:"Statement Description",value:this.payout.description}),e(v,{key:"fea138338da1c74d26dacfeaa15642962346658c",title:"Payout Method",value:this.formatMethod(this.payout.delivery_method)}),e(v,{key:"f77701ef18590ed73431614f421b9d76a9b83da6",title:"Amount",value:this.payout.formattedPaymentAmount(this.payout.amount)}),e(v,{key:"af2401b0ad8b35f55283d74eae20fdf7ceea0b82",title:"Fee",value:this.payout.formattedPaymentAmount(this.payout.fees_total)})),e(b,{key:"96801f26f15e665e856262f65c0c6cea6f92bd9a",sectionTitle:"Account"}),e("div",{key:"54578f116a6b23c5c1dce11d450eb18be304ab65",class:"d-flex flex-column gap-2 w-100"},e(v,{key:"fa8ab204001e4be0cf2aa71fa2f955532f1ac81c",title:"ID",value:this.payout.account_id,onClick:this.enableRecordClick?()=>this.handleRecordClick(this.payout.account_id):void 0}),e(v,{key:"a0e1afcd7e7d86afb500cf876b7b61e74183f4c9",title:"Account Type",value:this.payout.bank_account.account_type}),e(v,{key:"6b78025d11ac562f6950f07d3dc8e5c4041a236f",title:"Institution",value:this.payout.bank_account.account_type}),e(v,{key:"93f4f6d947d1b621de0b1d2a24dbcf83e9c909ef",title:"Routing Number",value:this.payout.bank_account.routing_number}),e(v,{key:"cbe9a97153516dd2cbf6af4337179652d0f834ac",title:"Account Number",value:`**** ${this.payout.bank_account.account_number_last4}`})),this.payout.metadata&&[e(b,{key:"706f2d164a736fb80a8c91018f61e7667eb12be6",sectionTitle:"Metadata"}),e("div",{key:"5be03b700c79d747899db7d9bee8a060c5de7894",class:"d-table gap-2 w-100"},e(u,{key:"8dc3aa6522c59f7a5739eda61354bb1ac58ee3ac",metadata:this.payout.metadata}))])))}static get watchers(){return{payoutId:["propChanged"],authToken:["propChanged"],getPayout:["getPayoutWatcher"]}}};export{T as justifi_payout_details}
@@ -1 +1 @@
1
- import{h as t,r as e,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-Dbg501Lu.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{b as i,C as r,e as o}from"./p-CUI41_5y.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{g as c,a as p}from"./p-B5vVjDc_.js";import{J as h}from"./p-cXPhRFs-.js";import{c as d}from"./p-GP5gWjhc.js";import{S as m}from"./p-BqNNwq6C.js";import{T as f,l,a as u,b,c as y,d as g,e as j,f as v,g as _,h as C,i as k,j as w,k as T}from"./p-bn_huKYG.js";import{T as D}from"./p-CZfYo5-1.js";import{M as P}from"./p-D1D2eC05.js";import{a as O}from"./p-BRnBHsdq.js";import{a3 as S,a4 as B}from"./p-DnrawQn3.js";import{o as I,g as A}from"./p-CpGEMRkH.js";import"./p-CYQvLgSs.js";import"./p-D8GTwl9v.js";import"./p-CXKOe1m5.js";import"./p-CDf5H0TB.js";import"./p-pL4dNfsl.js";const E={created_at:()=>t("th",{part:S,scope:"col",title:"The date and time each payment was made"},"Date"),amount:()=>t("th",{part:S,scope:"col",title:"The dollar amount of each payment"},"Amount"),status:()=>t("th",{part:S,scope:"col",title:"The current status of each payment"},"Status"),payment_type:()=>t("th",{part:S,scope:"col",title:"The type of each payment"},"Type"),description:()=>t("th",{part:S,scope:"col",title:"The payment description, if you provided one"},"Description"),payers_name:()=>t("th",{part:S,scope:"col",title:"The name associated with the payment method"},"Account Holder"),last_four_digits:()=>t("th",{part:S,scope:"col",title:"The brand and last 4 digits of the payment method"},"Payment Method"),card_brand:()=>t("th",{part:S,scope:"col",title:"The brand of the payment method"},"Card Brand")},H={created_at:(e,a)=>t("td",{part:B(a)},t("div",{class:"fw-bold"},O(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},O(e.created_at,{showTime:!0}))),amount:(e,a)=>t("td",{part:B(a)},e.formattedPaymentAmount(e.amount)),status:(e,a)=>t("td",{part:B(a)},P(e.status)),payment_type:(e,a)=>t("td",{part:B(a)},e.payment_type),description:(e,a)=>t("td",{part:B(a)},e.description),payers_name:(e,a)=>t("td",{part:B(a)},e.payers_name),last_four_digits:(e,a)=>t("td",{part:B(a)},e.last_four_digits),card_brand:(e,a)=>{var s,i,r;return t("td",{part:B(a)},(r=(null===(s=e.payment_method.card)||void 0===s?void 0:s.brand)||(null===(i=e.payment_method.bank_account)||void 0===i?void 0:i.brand))?{visa:"VISA",mastercard:"Mastercard",american_express:"American Express",discover:"Discover",diners_club:"Diners Club",jcb:"JCB",china_unionpay:"China UnionPay",unknown:"Unknown"}[r.toLowerCase()]||r:"N/A")}},L=class{constructor(t){e(this,t),this.errorEvent=a(this,"error-event",7),this.clickEvent=a(this,"click-event",7),this.errorMessage=null,this.payments=[],this.loading=!0,this.paging=n,this.pagingParams={},this.columns="created_at,amount,status,payment_type,description,payers_name,last_four_digits,card_brand",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:D.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:D.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const a=this.payments.find((t=>t.id===e));this.clickEvent.emit({name:D.row,data:a})}}componentWillLoad(){d(),this.analytics=new h(this),this.paymentsTable=new f(this.payments,this.columns,E,H),this.initializeGetPayments(),I("set",(()=>{this.pagingParams={},this.errorMessage=""})),I("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetPayments()}updateOnPropChange(){this.fetchData()}initializeGetPayments(){this.accountId&&this.authToken?this.getPayments=(({id:t,authToken:e,service:a})=>async({params:s,onSuccess:o,onError:n,final:h})=>{var d,m;try{const h=await a.fetchPayments(t,e,s);if(h.error)return n({error:p(h.error),code:c(null===(m=h.error)||void 0===m?void 0:m.code),severity:r.ERROR});{const t=Object.assign({},h.page_info);o({payments:(null===(d=h.data)||void 0===d?void 0:d.map((t=>new i(t))))||[],pagingInfo:t})}}catch(t){const e=c(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:r.ERROR})}finally{return h()}})({id:this.accountId,authToken:this.authToken,service:new s}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:r.ERROR}))}fetchData(){this.getPayments&&(this.loading=!0,this.getPayments({params:this.paymentParams,onSuccess:({payments:t,pagingInfo:e})=>{this.payments=t,this.paging=e,this.paymentsTable.collectionData=this.payments},onError:({error:t,code:e,severity:a})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:a})},final:()=>{this.loading=!1}}))}get paymentParams(){const t=A();return Object.assign(Object.assign({},t),this.pagingParams)}get entityId(){return this.payments.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.paymentsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(m,{key:"6e1b9127bd44def13ca0e9360f3ad94e8c99860e"},t(l,{key:"556583538e7dd2cadd84980277da82902eba942f"},t(u,{key:"bc604eb09bcb019786afb272f597da99d6635872"},t(b,{key:"3e030bf889ea09510c26147d807a427d4a772d23"},t(y,{key:"c193117a1db06574c019922536a6982e4c6f09fb"},this.paymentsTable.columnData.map((t=>t)))),t(g,{key:"aa955b2adc05c02fbe7a6c693de4649e90855aba"},t(j,{key:"35930a22ccdcc360e5e3f192c3fb140711508742",columnSpan:this.paymentsTable.columnData.length,isLoading:this.loading}),t(v,{key:"1582993843ac6661d2c5b62e07b1911ab940cb3c",isEmpty:this.showEmptyState,columnSpan:this.paymentsTable.columnData.length}),t(_,{key:"328f38cc95fb2f854865e4e05ace7e9ce8af8b69",columnSpan:this.paymentsTable.columnData.length,errorMessage:this.errorMessage}),this.showRowData&&this.paymentsTable.rowData.map(((e,a)=>t(C,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(k,{key:"0137371c7f1ab00f8ef3d27cebb30525eff6b659"},t(w,{key:"54ed0b9a13338b0bcefba282afe4f2de40e8f539"},t(T,{key:"6b98204f36a989fe9bd2bda65705de88098690c5",colSpan:this.paymentsTable.columnData.length},t("pagination-menu",{key:"e3fce4ab3efcc9a33d0b2617cea88026c8a459f3",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"],pagingParams:["updateOnPropChange"],getPayments:["updateOnPropChange"],columns:["updateOnPropChange"]}}};export{L as justifi_payments_list}
1
+ import{h as t,r as e,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-Dbg501Lu.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{b as i,C as r,e as o}from"./p-CUI41_5y.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{g as p,a as c}from"./p-B5vVjDc_.js";import{J as h}from"./p-BnaR7f2G.js";import{c as d}from"./p-BJ7GFTiW.js";import{S as m}from"./p-BqNNwq6C.js";import{T as f,l,a as u,b,c as y,d as g,e as v,f as j,g as _,h as C,i as k,j as w,k as T}from"./p-bn_huKYG.js";import{T as D}from"./p-CZfYo5-1.js";import{M as P}from"./p-D1D2eC05.js";import{a as B}from"./p-BRnBHsdq.js";import{a3 as S,a4 as O}from"./p-DnrawQn3.js";import{o as I,g as A}from"./p-CpGEMRkH.js";import"./p-CYQvLgSs.js";import"./p-D8GTwl9v.js";import"./p-BCgsLInF.js";import"./p-CDf5H0TB.js";import"./p-pL4dNfsl.js";const E={created_at:()=>t("th",{part:S,scope:"col",title:"The date and time each payment was made"},"Date"),amount:()=>t("th",{part:S,scope:"col",title:"The dollar amount of each payment"},"Amount"),status:()=>t("th",{part:S,scope:"col",title:"The current status of each payment"},"Status"),payment_type:()=>t("th",{part:S,scope:"col",title:"The type of each payment"},"Type"),description:()=>t("th",{part:S,scope:"col",title:"The payment description, if you provided one"},"Description"),payers_name:()=>t("th",{part:S,scope:"col",title:"The name associated with the payment method"},"Account Holder"),last_four_digits:()=>t("th",{part:S,scope:"col",title:"The brand and last 4 digits of the payment method"},"Payment Method"),card_brand:()=>t("th",{part:S,scope:"col",title:"The brand of the payment method"},"Card Brand")},H={created_at:(e,a)=>t("td",{part:O(a)},t("div",{class:"fw-bold"},B(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},B(e.created_at,{showTime:!0}))),amount:(e,a)=>t("td",{part:O(a)},e.formattedPaymentAmount(e.amount)),status:(e,a)=>t("td",{part:O(a)},P(e.status)),payment_type:(e,a)=>t("td",{part:O(a)},e.payment_type),description:(e,a)=>t("td",{part:O(a)},e.description),payers_name:(e,a)=>t("td",{part:O(a)},e.payers_name),last_four_digits:(e,a)=>t("td",{part:O(a)},e.last_four_digits),card_brand:(e,a)=>{var s,i,r;return t("td",{part:O(a)},(r=(null===(s=e.payment_method.card)||void 0===s?void 0:s.brand)||(null===(i=e.payment_method.bank_account)||void 0===i?void 0:i.brand))?{visa:"VISA",mastercard:"Mastercard",american_express:"American Express",discover:"Discover",diners_club:"Diners Club",jcb:"JCB",china_unionpay:"China UnionPay",unknown:"Unknown"}[r.toLowerCase()]||r:"N/A")}},L=class{constructor(t){e(this,t),this.errorEvent=a(this,"error-event",7),this.clickEvent=a(this,"click-event",7),this.errorMessage=null,this.payments=[],this.loading=!0,this.paging=n,this.pagingParams={},this.columns="created_at,amount,status,payment_type,description,payers_name,last_four_digits,card_brand",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:D.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:D.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const a=this.payments.find((t=>t.id===e));this.clickEvent.emit({name:D.row,data:a})}}componentWillLoad(){d(),this.analytics=new h(this),this.paymentsTable=new f(this.payments,this.columns,E,H),this.initializeGetPayments(),I("set",(()=>{this.pagingParams={},this.errorMessage=""})),I("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetPayments()}updateOnPropChange(){this.fetchData()}initializeGetPayments(){this.accountId&&this.authToken?this.getPayments=(({id:t,authToken:e,service:a})=>async({params:s,onSuccess:o,onError:n,final:h})=>{var d,m;try{const h=await a.fetchPayments(t,e,s);if(h.error)return n({error:c(h.error),code:p(null===(m=h.error)||void 0===m?void 0:m.code),severity:r.ERROR});{const t=Object.assign({},h.page_info);o({payments:(null===(d=h.data)||void 0===d?void 0:d.map((t=>new i(t))))||[],pagingInfo:t})}}catch(t){const e=p(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:r.ERROR})}finally{return h()}})({id:this.accountId,authToken:this.authToken,service:new s}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:r.ERROR}))}fetchData(){this.getPayments&&(this.loading=!0,this.getPayments({params:this.paymentParams,onSuccess:({payments:t,pagingInfo:e})=>{this.payments=t,this.paging=e,this.paymentsTable.collectionData=this.payments},onError:({error:t,code:e,severity:a})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:a})},final:()=>{this.loading=!1}}))}get paymentParams(){const t=A();return Object.assign(Object.assign({},t),this.pagingParams)}get entityId(){return this.payments.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.paymentsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(m,{key:"6e1b9127bd44def13ca0e9360f3ad94e8c99860e"},t(l,{key:"556583538e7dd2cadd84980277da82902eba942f"},t(u,{key:"bc604eb09bcb019786afb272f597da99d6635872"},t(b,{key:"3e030bf889ea09510c26147d807a427d4a772d23"},t(y,{key:"c193117a1db06574c019922536a6982e4c6f09fb"},this.paymentsTable.columnData.map((t=>t)))),t(g,{key:"aa955b2adc05c02fbe7a6c693de4649e90855aba"},t(v,{key:"35930a22ccdcc360e5e3f192c3fb140711508742",columnSpan:this.paymentsTable.columnData.length,isLoading:this.loading}),t(j,{key:"1582993843ac6661d2c5b62e07b1911ab940cb3c",isEmpty:this.showEmptyState,columnSpan:this.paymentsTable.columnData.length}),t(_,{key:"328f38cc95fb2f854865e4e05ace7e9ce8af8b69",columnSpan:this.paymentsTable.columnData.length,errorMessage:this.errorMessage}),this.showRowData&&this.paymentsTable.rowData.map(((e,a)=>t(C,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(k,{key:"0137371c7f1ab00f8ef3d27cebb30525eff6b659"},t(w,{key:"54ed0b9a13338b0bcefba282afe4f2de40e8f539"},t(T,{key:"6b98204f36a989fe9bd2bda65705de88098690c5",colSpan:this.paymentsTable.columnData.length},t("pagination-menu",{key:"e3fce4ab3efcc9a33d0b2617cea88026c8a459f3",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"],pagingParams:["updateOnPropChange"],getPayments:["updateOnPropChange"],columns:["updateOnPropChange"]}}};export{L as justifi_payments_list}
@@ -1 +1 @@
1
- import{h as i,r as e}from"./p-CV0Pyo1O.js";import{S as a}from"./p-DcBvJu0k.js";import{w as t,c}from"./p-DVJaoI_m.js";import{e as s}from"./p-BRnBHsdq.js";import{c as d}from"./p-GP5gWjhc.js";import"./p-DnrawQn3.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-CXKOe1m5.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=c.iframeOrigin,this.tabId=s(),d()}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:"cef558344c088e6e0bccb49b99c8a47c76200467"},i(n,{key:"f35bad214bc4d7657b7ab8a097a76602df877bcf",isReady:this.isReady}),i("hidden-input",{key:"d3791651ad279e2e0ad169012f4d066a44bbfa66"}),i("div",{key:"37318e633f9ab08bfbc95750466c054158e5e4ff",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},i("div",{key:"d5eccc9c8a496f3f264a1bd01bb065e823aa01b5",class:"mb-3"},i("iframe-input",{key:"2ec07c9bf1ea18ed354cd036e2c7876f974a30ed",inputId:"cardNumber",ref:i=>this.cardNumberIframeElement=i,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber?tabId=${this.tabId}`})),i("div",{key:"2959894ab0721d9bffccb0c16ecfb71bd3488518",class:"row"},i("div",{key:"dea7afd2515c4faa4927fd6cb32678fc782b9b5a",class:"col-4 align-content-end"},i("iframe-input",{key:"7d95eff6c6765ff996c1c497866ad01216b2cc4f",inputId:"expirationMonth",ref:i=>this.expirationMonthIframeElement=i,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth?tabId=${this.tabId}`})),i("div",{key:"00b02deefe877431409ef584662fc07e4a20cc3c",class:"col-4 align-content-end"},i("iframe-input",{key:"4860f042f29eb1d3db0e5ad4cb7c9471b8536ce6",inputId:"expirationYear",ref:i=>this.expirationYearIframeElement=i,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear?tabId=${this.tabId}`})),i("div",{key:"c69f9be6e581e683b757e89000ef1ba385c5f57b",class:"col-4 align-content-end"},i("iframe-input",{key:"e5fbb8e78af5c8c6ed74db18aeb226bfba5d083f",inputId:"CVV",ref:i=>this.cvvIframeElement=i,label:"CVV",iframeOrigin:`${this.iframeOrigin}/v2/CVV?tabId=${this.tabId}`})))))}};export{r as card_form}
1
+ import{h as i,r as e}from"./p-CV0Pyo1O.js";import{S as a}from"./p-DcBvJu0k.js";import{w as t,c}from"./p-DVJaoI_m.js";import{e as s}from"./p-BRnBHsdq.js";import{c as d}from"./p-BJ7GFTiW.js";import"./p-DnrawQn3.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-BCgsLInF.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=c.iframeOrigin,this.tabId=s(),d()}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:"cef558344c088e6e0bccb49b99c8a47c76200467"},i(n,{key:"f35bad214bc4d7657b7ab8a097a76602df877bcf",isReady:this.isReady}),i("hidden-input",{key:"d3791651ad279e2e0ad169012f4d066a44bbfa66"}),i("div",{key:"37318e633f9ab08bfbc95750466c054158e5e4ff",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},i("div",{key:"d5eccc9c8a496f3f264a1bd01bb065e823aa01b5",class:"mb-3"},i("iframe-input",{key:"2ec07c9bf1ea18ed354cd036e2c7876f974a30ed",inputId:"cardNumber",ref:i=>this.cardNumberIframeElement=i,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber?tabId=${this.tabId}`})),i("div",{key:"2959894ab0721d9bffccb0c16ecfb71bd3488518",class:"row"},i("div",{key:"dea7afd2515c4faa4927fd6cb32678fc782b9b5a",class:"col-4 align-content-end"},i("iframe-input",{key:"7d95eff6c6765ff996c1c497866ad01216b2cc4f",inputId:"expirationMonth",ref:i=>this.expirationMonthIframeElement=i,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth?tabId=${this.tabId}`})),i("div",{key:"00b02deefe877431409ef584662fc07e4a20cc3c",class:"col-4 align-content-end"},i("iframe-input",{key:"4860f042f29eb1d3db0e5ad4cb7c9471b8536ce6",inputId:"expirationYear",ref:i=>this.expirationYearIframeElement=i,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear?tabId=${this.tabId}`})),i("div",{key:"c69f9be6e581e683b757e89000ef1ba385c5f57b",class:"col-4 align-content-end"},i("iframe-input",{key:"e5fbb8e78af5c8c6ed74db18aeb226bfba5d083f",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 t,c as s,h as e}from"./p-CV0Pyo1O.js";import{C as i,e as r}from"./p-CUI41_5y.js";import{J as o}from"./p-cXPhRFs-.js";import{c as p}from"./p-GP5gWjhc.js";import{D as n}from"./p-BH0Xfn-F.js";import{g as a,a as h}from"./p-B5vVjDc_.js";import{D as c}from"./p-hhdRync5.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-CXKOe1m5.js";import"./p-CYQvLgSs.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const m=class{constructor(e){t(this,e),this.errorEvent=s(this,"error-event",7),this.errorMessage=null,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){p(),this.analytics=new o(this),this.initializeGetDispute()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:t,authToken:s,service:e})=>async({onSuccess:r,onError:o})=>{var p;try{const c=await e.fetchDispute(t,s);if(c.error)return o({error:h(c.error),code:a(null===(p=c.error)||void 0===p?void 0:p.code),severity:i.ERROR});{const t=Object.assign({},c.page_info);r({dispute:new n(c.data),pagingInfo:t})}}catch(t){const s=a(null==t?void 0:t.code);return o({error:t.message||t,code:s,severity:i.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new c}):(this.errorMessage="Dispute ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:r.MISSING_PROPS,severity:i.ERROR}))}render(){return e("justifi-dispute-management-core",{key:"934ece663ee7323be1157e67c566424081245b0c",getDispute:this.getDispute,disputeId:this.disputeId,authToken:this.authToken,"onError-event":this.handleErrorEvent})}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{m as justifi_dispute_management}
1
+ import{r as t,c as s,h as e}from"./p-CV0Pyo1O.js";import{C as i,e as r}from"./p-CUI41_5y.js";import{J as o}from"./p-BnaR7f2G.js";import{c as n}from"./p-BJ7GFTiW.js";import{D as p}from"./p-BH0Xfn-F.js";import{g as a,a as h}from"./p-B5vVjDc_.js";import{D as c}from"./p-hhdRync5.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-BCgsLInF.js";import"./p-CYQvLgSs.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const m=class{constructor(e){t(this,e),this.errorEvent=s(this,"error-event",7),this.errorMessage=null,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){n(),this.analytics=new o(this),this.initializeGetDispute()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:t,authToken:s,service:e})=>async({onSuccess:r,onError:o})=>{var n;try{const c=await e.fetchDispute(t,s);if(c.error)return o({error:h(c.error),code:a(null===(n=c.error)||void 0===n?void 0:n.code),severity:i.ERROR});{const t=Object.assign({},c.page_info);r({dispute:new p(c.data),pagingInfo:t})}}catch(t){const s=a(null==t?void 0:t.code);return o({error:t.message||t,code:s,severity:i.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new c}):(this.errorMessage="Dispute ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:r.MISSING_PROPS,severity:i.ERROR}))}render(){return e("justifi-dispute-management-core",{key:"934ece663ee7323be1157e67c566424081245b0c",getDispute:this.getDispute,disputeId:this.disputeId,authToken:this.authToken,"onError-event":this.handleErrorEvent})}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{m as justifi_dispute_management}
@@ -1 +1 @@
1
- import{h as s,r as t,c as i}from"./p-CV0Pyo1O.js";import{c as r,F as e}from"./p-CKiAlBsU.js";import{b as o,a,c as h}from"./p-BovgIz83.js";import{i as n,a as p,b as l,c as m}from"./p-D8EGHc_m.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{C as c,e as d}from"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import{C as j,B as u,b as v}from"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{J as f}from"./p-cXPhRFs-.js";import{B as b}from"./p-2LVpxCS_.js";import{S as C}from"./p-BqNNwq6C.js";import{H as w}from"./p-XrKLre8M.js";import"./p-CZfYo5-1.js";import{c as g}from"./p-GP5gWjhc.js";import{S as B}from"./p-DcBvJu0k.js";import{B as y}from"./p-XYgDHrVL.js";import{m as _,a as O}from"./p-CR_-qIuN.js";import{B as x}from"./p-CsdYMTrc.js";import"./p-BFTU3MAI.js";import"./p-HT_4DkD0.js";import"./p-_-2E_vYf.js";import"./p-Bt4GjEWL.js";import"./p-D8GTwl9v.js";import"./p-BRnBHsdq.js";import"./p-CXKOe1m5.js";import"./p-CYQvLgSs.js";import"./p-DnrawQn3.js";import"./p-B5vVjDc_.js";const D=r(Object.assign(Object.assign({},o().fields),{legal_address:p(),additional_questions:a(),representative:n("representative")}));r(Object.assign(Object.assign({},h().fields),{legal_address:m(),additional_questions:a(),representative:l("representative")}));const S=D,k=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(B,{width:"25%"})),s("div",{class:"col-12"},s(B,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(B,{width:"50%"}),s(B,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(B,{width:"65%"}),s(B,{width:"35%"}))),q=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(B,{width:"40%",height:"40px"})),s(k,null),s(k,null),s(k,null)),H=class{constructor(s){t(this,s),this.submitEvent=i(this,"submit-event",7),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.isLoading=!1,this.isSaving=!1,this.country=j.USA,this.hideErrors=!1,this.formTitle="Business Information",this.removeTitle=!1,this.instantiateBusiness=s=>{const t=new u(s);this.country=t.country_of_establishment,this.formController.setInitialValues(Object.assign({},t))},this.sendData=async()=>{this.isSaving=!0;const s=this.formController.values.getValue(),t=this.formController.getInitialValues(),i=new u(Object.assign(Object.assign({},t),s)).payload;this.patchBusiness({payload:i,onSuccess:s=>{this.handleReponse(s)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isSaving=!1}})},this.validateAndSubmit=s=>{s.preventDefault(),this.formController.validateAndSubmit(this.sendData)}}componentWillLoad(){g(),this.analytics=new f(this),this.formController=new e(S),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}get title(){return this.removeTitle?"":this.formTitle}get disabledState(){return this.isSaving}get businessEndpoint(){return`entities/business/${this.businessId}`}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=_({authToken:this.authToken,businessId:this.businessId,service:new x}),this.patchBusiness=O({authToken:this.authToken,businessId:this.businessId,service:new x}),this.getBusiness({onSuccess:s=>{this.instantiateBusiness(s.data)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isLoading=!1}})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:d.MISSING_PROPS,severity:c.ERROR})}handleReponse(s){s.error&&(this.errorMessage=v.patchData),this.submitEvent.emit({response:s}),this.instantiateBusiness(s.data)}render(){return s(C,null,this.isLoading?s(q,null):s("form",{onSubmit:this.validateAndSubmit},s("div",{class:"row gap-3"},s(w,{text:this.title}),s("form-alert",{text:this.errorMessage,hideAlert:this.hideErrors}),s("div",{class:"col-12 mb-4"},s("business-core-info",{formController:this.formController,country:this.country})),s("div",{class:"col-12 mb-4"},s("legal-address-form",{formController:this.formController,country:this.country})),s("div",{class:"col-12 mb-4"},s("additional-questions",{formController:this.formController})),s("div",{class:"col-12 mb-4"},s("business-representative",{formController:this.formController,country:this.country})),s("div",{class:"col-12 d-flex flex-row-reverse"},s(b,{type:"submit",disabled:this.disabledState,variant:"primary",onClick:()=>this.clickEvent.emit({name:y.submit}),isLoading:this.isSaving},"Submit")))))}};export{H as justifi_business_form}
1
+ import{h as s,r as t,c as i}from"./p-CV0Pyo1O.js";import{c as r,F as e}from"./p-CKiAlBsU.js";import{b as o,a,c as n}from"./p-BovgIz83.js";import{i as h,a as p,b as l,c as m}from"./p-D8EGHc_m.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{C as c,e as d}from"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import{C as j,B as u,b as v}from"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{J as f}from"./p-BnaR7f2G.js";import{B as b}from"./p-2LVpxCS_.js";import{S as C}from"./p-BqNNwq6C.js";import{H as w}from"./p-XrKLre8M.js";import"./p-CZfYo5-1.js";import{c as g}from"./p-BJ7GFTiW.js";import{S as B}from"./p-DcBvJu0k.js";import{B as y}from"./p-XYgDHrVL.js";import{m as _,a as x}from"./p-CR_-qIuN.js";import{B as D}from"./p-CsdYMTrc.js";import"./p-BFTU3MAI.js";import"./p-HT_4DkD0.js";import"./p-_-2E_vYf.js";import"./p-Bt4GjEWL.js";import"./p-D8GTwl9v.js";import"./p-BRnBHsdq.js";import"./p-BCgsLInF.js";import"./p-CYQvLgSs.js";import"./p-DnrawQn3.js";import"./p-B5vVjDc_.js";const I=r(Object.assign(Object.assign({},o().fields),{legal_address:p(),additional_questions:a(),representative:h("representative")}));r(Object.assign(Object.assign({},n().fields),{legal_address:m(),additional_questions:a(),representative:l("representative")}));const L=I,O=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(B,{width:"25%"})),s("div",{class:"col-12"},s(B,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(B,{width:"50%"}),s(B,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(B,{width:"65%"}),s(B,{width:"35%"}))),S=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(B,{width:"40%",height:"40px"})),s(O,null),s(O,null),s(O,null)),k=class{constructor(s){t(this,s),this.submitEvent=i(this,"submit-event",7),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.isLoading=!1,this.isSaving=!1,this.country=j.USA,this.hideErrors=!1,this.formTitle="Business Information",this.removeTitle=!1,this.instantiateBusiness=s=>{const t=new u(s);this.country=t.country_of_establishment,this.formController.setInitialValues(Object.assign({},t))},this.sendData=async()=>{this.isSaving=!0;const s=this.formController.values.getValue(),t=this.formController.getInitialValues(),i=new u(Object.assign(Object.assign({},t),s)).payload;this.patchBusiness({payload:i,onSuccess:s=>{this.handleReponse(s)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isSaving=!1}})},this.validateAndSubmit=s=>{s.preventDefault(),this.formController.validateAndSubmit(this.sendData)}}componentWillLoad(){g(),this.analytics=new f(this),this.formController=new e(L),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}get title(){return this.removeTitle?"":this.formTitle}get disabledState(){return this.isSaving}get businessEndpoint(){return`entities/business/${this.businessId}`}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=_({authToken:this.authToken,businessId:this.businessId,service:new D}),this.patchBusiness=x({authToken:this.authToken,businessId:this.businessId,service:new D}),this.getBusiness({onSuccess:s=>{this.instantiateBusiness(s.data)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isLoading=!1}})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:d.MISSING_PROPS,severity:c.ERROR})}handleReponse(s){s.error&&(this.errorMessage=v.patchData),this.submitEvent.emit({response:s}),this.instantiateBusiness(s.data)}render(){return s(C,null,this.isLoading?s(S,null):s("form",{onSubmit:this.validateAndSubmit},s("div",{class:"row gap-3"},s(w,{text:this.title}),s("form-alert",{text:this.errorMessage,hideAlert:this.hideErrors}),s("div",{class:"col-12 mb-4"},s("business-core-info",{formController:this.formController,country:this.country})),s("div",{class:"col-12 mb-4"},s("legal-address-form",{formController:this.formController,country:this.country})),s("div",{class:"col-12 mb-4"},s("additional-questions",{formController:this.formController})),s("div",{class:"col-12 mb-4"},s("business-representative",{formController:this.formController,country:this.country})),s("div",{class:"col-12 d-flex flex-row-reverse"},s(b,{type:"submit",disabled:this.disabledState,variant:"primary",onClick:()=>this.clickEvent.emit({name:y.submit}),isLoading:this.isSaving},"Submit")))))}};export{k as justifi_business_form}
@@ -0,0 +1 @@
1
+ var e={name:"@justifi/webcomponents",version:"6.12.2"};export{e as p}
@@ -1 +1 @@
1
- import{p as e}from"./p-CXKOe1m5.js";const s="__JUSTIFI_WC_VERSION__",o=async()=>{var o,t;if((()=>{if("undefined"==typeof globalThis)return;const o=e.version,t=globalThis[s];t&&t!==o?console.error(`@justifi/webcomponents: Multiple versions detected. Version ${t} was loaded first and registered all components. Version ${o} is also present but its components will NOT be used. To fix this, add to your package.json:\n"pnpm": { "overrides": { "@justifi/webcomponents": "${o}" } }`):globalThis[s]=o})(),"undefined"!=typeof process&&("test"===(null===(o=process.env)||void 0===o?void 0:o.NODE_ENV)||(null===(t=process.env)||void 0===t?void 0:t.JEST_WORKER_ID)))return;const i=e.version,n=e.name,a=await(async e=>{const s=await fetch("https://registry.npmjs.org/"+e+"/latest");return(await s.json()).version})(n),r=a.replace(/-rc.*/,""),l=i.split("."),p=a.split(".");l[0]!==p[0]&&console.warn(`The package ${n} is out of date. The latest version is ${r}. Please update.`)};export{o as c}
1
+ import{p as e}from"./p-BCgsLInF.js";const s="__JUSTIFI_WC_VERSION__",o=async()=>{var o,t;if((()=>{if("undefined"==typeof globalThis)return;const o=e.version,t=globalThis[s];t&&t!==o?console.error(`@justifi/webcomponents: Multiple versions detected. Version ${t} was loaded first and registered all components. Version ${o} is also present but its components will NOT be used. To fix this, add to your package.json:\n"pnpm": { "overrides": { "@justifi/webcomponents": "${o}" } }`):globalThis[s]=o})(),"undefined"!=typeof process&&("test"===(null===(o=process.env)||void 0===o?void 0:o.NODE_ENV)||(null===(t=process.env)||void 0===t?void 0:t.JEST_WORKER_ID)))return;const n=e.version,i=e.name,a=await(async e=>{const s=await fetch("https://registry.npmjs.org/"+e+"/latest");return(await s.json()).version})(i),r=a.replace(/-rc.*/,""),l=n.split("."),p=a.split(".");l[0]!==p[0]&&console.warn(`The package ${i} is out of date. The latest version is ${r}. Please update.`)};export{o as c}
@@ -1 +1 @@
1
- import{p as t}from"./p-CXKOe1m5.js";import{A as s}from"./p-CYQvLgSs.js";import"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";const i=s();class e{async record(t){return i.post({endpoint:"analytics",body:t})}}class n{constructor(t){this.eventListeners=new Map,this.handleCustomEvent=async t=>{await this.service.record(t)},window.location.origin.includes("localhost")||window.location.origin.includes("storybook")||(this.service=new e,this.componentInstance=t,this.setUpBasicData(),this.setupLifecycleTracking(),this.trackCustomEvents())}get resourceId(){return this.componentInstance.accountId||this.componentInstance.businessId||this.componentInstance.paymentId||this.componentInstance.payoutId||this.componentInstance.checkoutId}setUpBasicData(){this.basicData={component_name:this.componentInstance.tagName,component_version:t.version,client_user_agent:navigator.userAgent,client_platform:navigator.userAgent,client_origin:window.location.origin,resource_id:this.resourceId}}trackCustomEvents(){this.eventEmitters=["submit-event","error-event"],this.eventEmitters.forEach((t=>{if("function"==typeof this.componentInstance.addEventListener){const s=s=>this.handleCustomEvent({event_type:t,data:Object.assign(Object.assign({},this.basicData),{error:s.detail})});this.eventListeners.set(t,s),this.componentInstance.addEventListener(t,s)}}))}setupLifecycleTracking(){const t=this.componentInstance.componentDidLoad;this.componentInstance.componentDidLoad=()=>{if(this.service.record({event_type:"init",data:this.basicData}),t)return t.apply(this.componentInstance)}}cleanup(){this.eventListeners.forEach(((t,s)=>{this.componentInstance.removeEventListener(s,t)})),this.eventListeners.clear()}}export{n as J}
1
+ import{p as t}from"./p-BCgsLInF.js";import{A as s}from"./p-CYQvLgSs.js";import"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";const i=s();class e{async record(t){return i.post({endpoint:"analytics",body:t})}}class n{constructor(t){this.eventListeners=new Map,this.handleCustomEvent=async t=>{await this.service.record(t)},window.location.origin.includes("localhost")||window.location.origin.includes("storybook")||(this.service=new e,this.componentInstance=t,this.setUpBasicData(),this.setupLifecycleTracking(),this.trackCustomEvents())}get resourceId(){return this.componentInstance.accountId||this.componentInstance.businessId||this.componentInstance.paymentId||this.componentInstance.payoutId||this.componentInstance.checkoutId}setUpBasicData(){this.basicData={component_name:this.componentInstance.tagName,component_version:t.version,client_user_agent:navigator.userAgent,client_platform:navigator.userAgent,client_origin:window.location.origin,resource_id:this.resourceId}}trackCustomEvents(){this.eventEmitters=["submit-event","error-event"],this.eventEmitters.forEach((t=>{if("function"==typeof this.componentInstance.addEventListener){const s=s=>this.handleCustomEvent({event_type:t,data:Object.assign(Object.assign({},this.basicData),"error-event"===t&&{error:s.detail})});this.eventListeners.set(t,s),this.componentInstance.addEventListener(t,s)}}))}setupLifecycleTracking(){const t=this.componentInstance.componentDidLoad;this.componentInstance.componentDidLoad=()=>{if(this.service.record({event_type:"init",data:this.basicData}),t)return t.apply(this.componentInstance)}}cleanup(){this.eventListeners.forEach(((t,s)=>{this.componentInstance.removeEventListener(s,t)})),this.eventListeners.clear()}}export{n as J}
@@ -1 +1 @@
1
- import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import{c as r,a as n,F as i}from"./p-CKiAlBsU.js";import{f as o}from"./p-BRnBHsdq.js";import"./p-DVJaoI_m.js";import{R as a,C as u,e as h,n as c}from"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{B as l}from"./p-2LVpxCS_.js";import{S as m}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{P as d}from"./p-Dbg501Lu.js";import{m as p}from"./p-DWevPe7C.js";import{J as f}from"./p-cXPhRFs-.js";import{c as v}from"./p-GP5gWjhc.js";import{g as y,a as j}from"./p-B5vVjDc_.js";import{A as w}from"./p-CYQvLgSs.js";import{S as b}from"./p-DcBvJu0k.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-D8GTwl9v.js";import"./p-DnrawQn3.js";import"./p-CXKOe1m5.js";const C=t=>{const e=+t;return n().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${o(e)}`,(function(t){return+t<=+e})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},g=t=>{if(t)return r({amount:C(t),description:n().optional(),reason:n().optional().oneOf([a.customerRequest,a.duplicate,a.fraudulent],"Select a reason")})},I=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],S=w();class T{async postRefund(t,e,s,r){return S.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":e},body:r,authToken:s})}}const B=w();class P{async postVoid(t,e,s){return B.post({endpoint:`payments/${t}/void`,headers:{"Sub-Account":e},authToken:s})}}const k=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(b,{width:"100%",height:"40px"}))),x=()=>t(m,null,t("div",{class:"row gap-5"},t(k,null),t(k,null),t(k,null))),A=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}componentWillLoad(){v(),this.analytics=new f(this),this.initializeApi(),this.formController=new i(g())}handleError(t,e,s){this.errorEvent.emit({errorCode:t,message:e,severity:s})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(h.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",u.ERROR)}isPaymentCreatedWithin25Minutes(){var t;if(!this.payment||!(null===(t=this.payment)||void 0===t?void 0:t.created_at))return!1;const e=new Date(this.payment.created_at);return((new Date).getTime()-e.getTime())/6e4<=25}initializeFormController(){const t=this.refundPayload.amount,e=t?t.toString():"0";this.formController=new i(g(e)),this.formController.setInitialValues({amount:e}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?p({id:this.paymentId,authToken:this.authToken,service:new d})({onSuccess:({payment:t})=>{this.payment=t,this.refundPayload=new c({amount:t.amount_refundable})},onError:({error:t,code:e,severity:s})=>{this.handleError(e,t,s)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(h.MISSING_PROPS,"Payment ID and Auth Token are required",u.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const e=this.formController.values.getValue();return this.refundLoading=!0,this.isPaymentCreatedWithin25Minutes()?this.tryVoidPayment():this.processRefund(e)}async tryVoidPayment(){const t=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({onSuccess:n,onError:i,final:o})=>{var a;try{const o=await r.postVoid(s,e,t);if(o.error)return i({error:j(o.error),code:y(null===(a=o.error)||void 0===a?void 0:a.code),severity:u.ERROR});n(o)}catch(t){const e=y(null==t?void 0:t.code);return i({error:t.message||t,code:e,severity:u.ERROR})}finally{return o()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new P});return new Promise((e=>{let s,r=!1;const n=this.formController.values.getValue();t({onSuccess:t=>{s=t,r=!0},onError:({error:t,code:s,severity:i})=>{r=!0,this.handleError(t,s,i),this.processRefund(n).then(e)},final:()=>{s&&!s.error&&r&&(this.submitEvent.emit({response:s}),this.submitDisabled=!0,this.refundLoading=!1,e(s.data))}})}))}async processRefund(t){const e=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({refundBody:n,onSuccess:i,onError:o,final:a})=>{var h;try{const a=await r.postRefund(s,e,t,n);if(a.error)return o({error:j(a.error),code:y(null===(h=a.error)||void 0===h?void 0:h.code),severity:u.ERROR});i(a)}catch(t){const e=y(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:u.ERROR})}finally{return a()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new T});return new Promise((s=>{let r;e({refundBody:t,onSuccess:t=>{r=t},onError:({error:t,code:e,severity:s})=>{r=t,this.handleError(t,e,s)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,s(r.data)}})}))}render(){if(this.paymentLoading)return t(x,null);const e=this.formController.getInitialValues(),s=this.refundPayload.amount;return t(m,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:e.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:e.reason,inputHandler:this.inputHandler,options:I,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:e.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(l,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${o(+s)}`))))))}};export{A as justifi_refund_payment}
1
+ import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import{c as r,a as n,F as i}from"./p-CKiAlBsU.js";import{f as o}from"./p-BRnBHsdq.js";import"./p-DVJaoI_m.js";import{R as a,C as u,e as h,n as c}from"./p-CUI41_5y.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BH0Xfn-F.js";import{B as l}from"./p-2LVpxCS_.js";import{S as m}from"./p-BqNNwq6C.js";import"./p-CZfYo5-1.js";import{P as d}from"./p-Dbg501Lu.js";import{m as p}from"./p-DWevPe7C.js";import{J as f}from"./p-BnaR7f2G.js";import{c as v}from"./p-BJ7GFTiW.js";import{g as y,a as j}from"./p-B5vVjDc_.js";import{A as w}from"./p-CYQvLgSs.js";import{S as b}from"./p-DcBvJu0k.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-D8GTwl9v.js";import"./p-DnrawQn3.js";import"./p-BCgsLInF.js";const C=t=>{const e=+t;return n().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${o(e)}`,(function(t){return+t<=+e})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},g=t=>{if(t)return r({amount:C(t),description:n().optional(),reason:n().optional().oneOf([a.customerRequest,a.duplicate,a.fraudulent],"Select a reason")})},B=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],I=w();class T{async postRefund(t,e,s,r){return I.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":e},body:r,authToken:s})}}const S=w();class k{async postVoid(t,e,s){return S.post({endpoint:`payments/${t}/void`,headers:{"Sub-Account":e},authToken:s})}}const x=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(b,{width:"100%",height:"40px"}))),A=()=>t(m,null,t("div",{class:"row gap-5"},t(x,null),t(x,null),t(x,null))),R=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}componentWillLoad(){v(),this.analytics=new f(this),this.initializeApi(),this.formController=new i(g())}handleError(t,e,s){this.errorEvent.emit({errorCode:t,message:e,severity:s})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(h.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",u.ERROR)}isPaymentCreatedWithin25Minutes(){var t;if(!this.payment||!(null===(t=this.payment)||void 0===t?void 0:t.created_at))return!1;const e=new Date(this.payment.created_at);return((new Date).getTime()-e.getTime())/6e4<=25}initializeFormController(){const t=this.refundPayload.amount,e=t?t.toString():"0";this.formController=new i(g(e)),this.formController.setInitialValues({amount:e}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?p({id:this.paymentId,authToken:this.authToken,service:new d})({onSuccess:({payment:t})=>{this.payment=t,this.refundPayload=new c({amount:t.amount_refundable})},onError:({error:t,code:e,severity:s})=>{this.handleError(e,t,s)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(h.MISSING_PROPS,"Payment ID and Auth Token are required",u.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const e=this.formController.values.getValue();return this.refundLoading=!0,this.isPaymentCreatedWithin25Minutes()?this.tryVoidPayment():this.processRefund(e)}async tryVoidPayment(){const t=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({onSuccess:n,onError:i,final:o})=>{var a;try{const o=await r.postVoid(s,e,t);if(o.error)return i({error:j(o.error),code:y(null===(a=o.error)||void 0===a?void 0:a.code),severity:u.ERROR});n(o)}catch(t){const e=y(null==t?void 0:t.code);return i({error:t.message||t,code:e,severity:u.ERROR})}finally{return o()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new k});return new Promise((e=>{let s,r=!1;const n=this.formController.values.getValue();t({onSuccess:t=>{s=t,r=!0},onError:({error:t,code:s,severity:i})=>{r=!0,this.handleError(t,s,i),this.processRefund(n).then(e)},final:()=>{s&&!s.error&&r&&(this.submitEvent.emit({response:s}),this.submitDisabled=!0,this.refundLoading=!1,e(s.data))}})}))}async processRefund(t){const e=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({refundBody:n,onSuccess:i,onError:o,final:a})=>{var h;try{const a=await r.postRefund(s,e,t,n);if(a.error)return o({error:j(a.error),code:y(null===(h=a.error)||void 0===h?void 0:h.code),severity:u.ERROR});i(a)}catch(t){const e=y(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:u.ERROR})}finally{return a()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new T});return new Promise((s=>{let r;e({refundBody:t,onSuccess:t=>{r=t},onError:({error:t,code:e,severity:s})=>{r=t,this.handleError(t,e,s)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,s(r.data)}})}))}render(){if(this.paymentLoading)return t(A,null);const e=this.formController.getInitialValues(),s=this.refundPayload.amount;return t(m,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:e.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:e.reason,inputHandler:this.inputHandler,options:B,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:e.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(l,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${o(+s)}`))))))}};export{R as justifi_refund_payment}
@@ -1 +1 @@
1
- import{h as e,r as i}from"./p-CV0Pyo1O.js";import{S as t}from"./p-DcBvJu0k.js";import{w as a,c as s}from"./p-DVJaoI_m.js";import{e as c}from"./p-BRnBHsdq.js";import{c as r}from"./p-GP5gWjhc.js";import"./p-DnrawQn3.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-CXKOe1m5.js";const d=i=>{const{isReady:a}=i;return a?null:e("div",{class:"container-fluid p-0"},e("div",{class:"row mb-3"},e("div",{class:"col-12 align-content-end"},e(t,{height:"18px",width:"120px"}),e(t,{height:"36px"}))),e("div",{class:"row"},e("div",{class:"col-12 align-content-end"},e(t,{height:"18px",width:"110px"}),e(t,{height:"36px"}))))},n=class{constructor(e){i(this,e),this.isReady=!1}async componentWillLoad(){await a(),this.iframeOrigin=s.iframeOrigin,this.tabId=c(),r()}componentDidRender(){Promise.all([this.accountNumberIframeElement,this.routingNumberIframeElement].map((e=>new Promise((i=>{e.addEventListener("iframeLoaded",(()=>{i()}))}))))).then((()=>{this.isReady=!0}))}async validate(){const e=await this.accountNumberIframeElement.validate(),i=await this.routingNumberIframeElement.validate();return e&&i}async tokenize({clientId:e,paymentMethodMetadata:i,account:t}){return await this.accountNumberIframeElement.tokenize(e,i,t)}render(){return e("div",{key:"85e116539bb4721484d9877706ff93de1a68ec59"},e(d,{key:"b12a13d02b004e2957a55eb00fb38178dc283a92",isReady:this.isReady}),e("hidden-input",{key:"657ed7946158788e9291906ec0966eb3bd3c544c"}),e("div",{key:"321fddef9af616686d525af94dc4a65b5a4c18e6",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},e("div",{key:"cee2dcc5bf8032ca95dc6b46e6a2bb47b371986b",class:"row mb-3"},e("iframe-input",{key:"50dfad1fc1eb41a87f2964e80d39036da1fc89ce",inputId:"accountNumber",ref:e=>this.accountNumberIframeElement=e,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber?tabId=${this.tabId}`})),e("div",{key:"bd47ac6ff7c687ce9eb7e6ea2a66628392f73cdc",class:"row"},e("iframe-input",{key:"bbe98adda61bc72925e77714139b604d2959e156",inputId:"routingNumber",ref:e=>this.routingNumberIframeElement=e,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber?tabId=${this.tabId}`}))))}};export{n as bank_account_form}
1
+ import{h as e,r as i}from"./p-CV0Pyo1O.js";import{S as t}from"./p-DcBvJu0k.js";import{w as a,c as s}from"./p-DVJaoI_m.js";import{e as c}from"./p-BRnBHsdq.js";import{c as r}from"./p-BJ7GFTiW.js";import"./p-DnrawQn3.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-BCgsLInF.js";const d=i=>{const{isReady:a}=i;return a?null:e("div",{class:"container-fluid p-0"},e("div",{class:"row mb-3"},e("div",{class:"col-12 align-content-end"},e(t,{height:"18px",width:"120px"}),e(t,{height:"36px"}))),e("div",{class:"row"},e("div",{class:"col-12 align-content-end"},e(t,{height:"18px",width:"110px"}),e(t,{height:"36px"}))))},n=class{constructor(e){i(this,e),this.isReady=!1}async componentWillLoad(){await a(),this.iframeOrigin=s.iframeOrigin,this.tabId=c(),r()}componentDidRender(){Promise.all([this.accountNumberIframeElement,this.routingNumberIframeElement].map((e=>new Promise((i=>{e.addEventListener("iframeLoaded",(()=>{i()}))}))))).then((()=>{this.isReady=!0}))}async validate(){const e=await this.accountNumberIframeElement.validate(),i=await this.routingNumberIframeElement.validate();return e&&i}async tokenize({clientId:e,paymentMethodMetadata:i,account:t}){return await this.accountNumberIframeElement.tokenize(e,i,t)}render(){return e("div",{key:"85e116539bb4721484d9877706ff93de1a68ec59"},e(d,{key:"b12a13d02b004e2957a55eb00fb38178dc283a92",isReady:this.isReady}),e("hidden-input",{key:"657ed7946158788e9291906ec0966eb3bd3c544c"}),e("div",{key:"321fddef9af616686d525af94dc4a65b5a4c18e6",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},e("div",{key:"cee2dcc5bf8032ca95dc6b46e6a2bb47b371986b",class:"row mb-3"},e("iframe-input",{key:"50dfad1fc1eb41a87f2964e80d39036da1fc89ce",inputId:"accountNumber",ref:e=>this.accountNumberIframeElement=e,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber?tabId=${this.tabId}`})),e("div",{key:"bd47ac6ff7c687ce9eb7e6ea2a66628392f73cdc",class:"row"},e("iframe-input",{key:"bbe98adda61bc72925e77714139b604d2959e156",inputId:"routingNumber",ref:e=>this.routingNumberIframeElement=e,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber?tabId=${this.tabId}`}))))}};export{n as bank_account_form}