@justifi/webcomponents 6.16.0-rc.2 → 6.16.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Analytics-CDE3KpL6.js → Analytics-C1FDYwxD.js} +2 -2
- package/dist/cjs/{Api-CaEn8pKs.js → Api-DzRWrqRx.js} +1 -1
- package/dist/cjs/additional-questions-form-step_15.cjs.entry.js +5 -5
- package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
- package/dist/cjs/{business.service-DIspRonp.js → business.service-D2D8ABMT.js} +1 -1
- package/dist/cjs/card-form.cjs.entry.js +2 -2
- package/dist/cjs/{checkout.service-CM1Duar4.js → checkout.service-CVpXCi8z.js} +1 -1
- package/dist/cjs/{detect-duplicate-version-DyHHkx4J.js → detect-duplicate-version-Bd2jUlYF.js} +1 -1
- package/dist/cjs/dispute-notification_2.cjs.entry.js +5 -5
- package/dist/cjs/{event-types-DNCxVTir.js → event-types-DptyH3kd.js} +1 -1
- package/dist/cjs/form-alert_3.cjs.entry.js +1 -1
- package/dist/cjs/{get-subaccounts-8LeFCTm6.js → get-subaccounts-CgzPwTgf.js} +1 -1
- package/dist/cjs/justifi-apple-pay_12.cjs.entry.js +36 -18
- package/dist/cjs/justifi-bank-account-billing-form-simple.cjs.entry.js +5 -5
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +5 -5
- package/dist/cjs/justifi-billing-form-full.cjs.entry.js +1 -1
- package/dist/cjs/justifi-billing-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-business-details.cjs.entry.js +6 -6
- package/dist/cjs/justifi-business-form.cjs.entry.js +6 -6
- package/dist/cjs/justifi-card-billing-form-simple.cjs.entry.js +1 -1
- package/dist/cjs/justifi-card-form.cjs.entry.js +5 -5
- package/dist/cjs/justifi-checkout-qr-code.cjs.entry.js +4 -4
- package/dist/cjs/justifi-checkout.cjs.entry.js +5 -5
- package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +7 -7
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +6 -6
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +5 -5
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +7 -7
- package/dist/cjs/justifi-payment-details.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-payments-list.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payout-details.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +7 -7
- package/dist/cjs/justifi-qr-terminal.cjs.entry.js +5 -5
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +6 -6
- package/dist/cjs/justifi-save-new-payment-method.cjs.entry.js +1 -1
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +5 -5
- package/dist/cjs/justifi-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +5 -5
- package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +7 -7
- package/dist/cjs/{package-DGrVUpde.js → package-45W01-Af.js} +1 -1
- package/dist/cjs/payment-method-option.cjs.entry.js +1 -1
- package/dist/cjs/{payment.service-By7aeVkC.js → payment.service-Cbs38oOx.js} +1 -1
- package/dist/cjs/{payout.service-Dn0rXkmg.js → payout.service-DGEinO-8.js} +1 -1
- package/dist/cjs/{plaid.service-CjaugrzX.js → plaid.service-JISYtGYD.js} +1 -1
- package/dist/cjs/styled-host-BxbU-bI7.js +20 -0
- package/dist/cjs/{terminal.service-C0_r_A60.js → terminal.service-9sdCsY2z.js} +1 -1
- package/dist/collection/components/modular-checkout/sub-components/justifi-plaid-payment-method.js +12 -8
- package/dist/collection/components/tokenize-payment-method/justifi-tokenize-payment-method.js +18 -2
- package/dist/collection/ui-components/styled-host/styled-host.js +10 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{Analytics-tBzmPsnT.js → Analytics-C9VVBFjO.js} +2 -2
- package/dist/esm/{Api-BH6Wa9CT.js → Api-BSUerPjV.js} +1 -1
- package/dist/esm/additional-questions-form-step_15.entry.js +5 -5
- package/dist/esm/bank-account-form.entry.js +2 -2
- package/dist/esm/{business.service-XOnczlAa.js → business.service-DRzTONqj.js} +1 -1
- package/dist/esm/card-form.entry.js +2 -2
- package/dist/esm/{checkout.service-DvSxk9EZ.js → checkout.service-8sMLHuiA.js} +1 -1
- package/dist/esm/{detect-duplicate-version-BD3-8NL2.js → detect-duplicate-version-Dtfd-S4Z.js} +1 -1
- package/dist/esm/dispute-notification_2.entry.js +5 -5
- package/dist/esm/{event-types-CM5AGGBD.js → event-types-Dix82sNv.js} +1 -1
- package/dist/esm/form-alert_3.entry.js +1 -1
- package/dist/esm/{get-subaccounts-P-x_RqL5.js → get-subaccounts-DjD2utKp.js} +1 -1
- package/dist/esm/justifi-apple-pay_12.entry.js +37 -19
- package/dist/esm/justifi-bank-account-billing-form-simple.entry.js +5 -5
- package/dist/esm/justifi-bank-account-form.entry.js +5 -5
- package/dist/esm/justifi-billing-form-full.entry.js +1 -1
- package/dist/esm/justifi-billing-form.entry.js +1 -1
- package/dist/esm/justifi-business-details.entry.js +6 -6
- package/dist/esm/justifi-business-form.entry.js +6 -6
- package/dist/esm/justifi-card-billing-form-simple.entry.js +1 -1
- package/dist/esm/justifi-card-form.entry.js +5 -5
- package/dist/esm/justifi-checkout-qr-code.entry.js +4 -4
- package/dist/esm/justifi-checkout.entry.js +5 -5
- package/dist/esm/justifi-checkouts-list-filters.entry.js +1 -1
- package/dist/esm/justifi-checkouts-list.entry.js +7 -7
- package/dist/esm/justifi-dispute-management.entry.js +6 -6
- package/dist/esm/justifi-gross-payment-chart.entry.js +5 -5
- package/dist/esm/justifi-order-terminals.entry.js +7 -7
- package/dist/esm/justifi-payment-details.entry.js +6 -6
- package/dist/esm/justifi-payment-provisioning.entry.js +6 -6
- package/dist/esm/justifi-payment-transactions-list.entry.js +6 -6
- package/dist/esm/justifi-payments-list-filters.entry.js +1 -1
- package/dist/esm/justifi-payments-list.entry.js +6 -6
- package/dist/esm/justifi-payout-details.entry.js +6 -6
- package/dist/esm/justifi-payout-transactions-list.entry.js +6 -6
- package/dist/esm/justifi-payouts-list-filters.entry.js +1 -1
- package/dist/esm/justifi-payouts-list.entry.js +7 -7
- package/dist/esm/justifi-qr-terminal.entry.js +5 -5
- package/dist/esm/justifi-refund-payment.entry.js +6 -6
- package/dist/esm/justifi-save-new-payment-method.entry.js +1 -1
- package/dist/esm/justifi-season-interruption-insurance.entry.js +5 -5
- package/dist/esm/justifi-skeleton.entry.js +1 -1
- package/dist/esm/justifi-terminal-orders-list-filters.entry.js +1 -1
- package/dist/esm/justifi-terminal-orders-list.entry.js +5 -5
- package/dist/esm/justifi-terminals-list-filters.entry.js +1 -1
- package/dist/esm/justifi-terminals-list.entry.js +7 -7
- package/dist/esm/{package-DhrQechy.js → package-C04splpj.js} +1 -1
- package/dist/esm/payment-method-option.entry.js +1 -1
- package/dist/esm/{payment.service-CBUnE4bP.js → payment.service-CLLAQ4ht.js} +1 -1
- package/dist/esm/{payout.service-DUYaYbeJ.js → payout.service-BZgKgDDq.js} +1 -1
- package/dist/esm/{plaid.service-Umm80G4q.js → plaid.service-CUoMQV-m.js} +1 -1
- package/dist/esm/styled-host-CXEpP1m_.js +18 -0
- package/dist/esm/{terminal.service-DeunLqmo.js → terminal.service-De58ZPM6.js} +1 -1
- package/dist/module/badge.js +1 -1
- package/dist/module/justifi-plaid-payment-method2.js +12 -9
- package/dist/module/justifi-tokenize-payment-method2.js +18 -2
- package/dist/module/package.js +1 -1
- package/dist/module/pagination-menu2.js +1 -1
- package/dist/module/parts.js +1 -1
- package/dist/module/spinner.js +1 -1
- package/dist/module/styled-host.js +11 -2
- package/dist/module/terminal-quantity-selector2.js +1 -1
- package/dist/types/components/tokenize-payment-method/justifi-tokenize-payment-method.d.ts +1 -0
- package/dist/webcomponents/p-12ee2546.entry.js +1 -0
- package/dist/webcomponents/{p-e5feca94.entry.js → p-1336c977.entry.js} +1 -1
- package/dist/webcomponents/p-1411a042.entry.js +1 -0
- package/dist/webcomponents/{p-51238f79.entry.js → p-19e638a1.entry.js} +1 -1
- package/dist/webcomponents/{p-e1fbadea.entry.js → p-2603928d.entry.js} +1 -1
- package/dist/webcomponents/p-266b3cf4.entry.js +1 -0
- package/dist/webcomponents/{p-b39c7414.entry.js → p-2a54e5d1.entry.js} +1 -1
- package/dist/webcomponents/{p-abebb03c.entry.js → p-303f8ffd.entry.js} +1 -1
- package/dist/webcomponents/{p-adaa1c98.entry.js → p-3c835c5d.entry.js} +1 -1
- package/dist/webcomponents/{p-511bc0b2.entry.js → p-599816a1.entry.js} +1 -1
- package/dist/webcomponents/p-5b9315b6.entry.js +1 -0
- package/dist/webcomponents/{p-ff67c8f7.entry.js → p-5de3f411.entry.js} +1 -1
- package/dist/webcomponents/{p-06ed3518.entry.js → p-73800780.entry.js} +1 -1
- package/dist/webcomponents/{p-d19d7d41.entry.js → p-8bb301a0.entry.js} +1 -1
- package/dist/webcomponents/{p-bd4d2924.entry.js → p-8de46fd1.entry.js} +1 -1
- package/dist/webcomponents/{p-5f20b0da.entry.js → p-92970d9d.entry.js} +1 -1
- package/dist/webcomponents/{p-5be775e8.entry.js → p-99111cd2.entry.js} +1 -1
- package/dist/webcomponents/p-9Lrj4zm8.js +1 -0
- package/dist/webcomponents/{p-357d14ee.entry.js → p-9a6ce4ed.entry.js} +1 -1
- package/dist/webcomponents/p-B-LmgMK4.js +1 -0
- package/dist/webcomponents/p-B1u-Iegl.js +1 -0
- package/dist/webcomponents/p-B8UcvRjv.js +1 -0
- package/dist/webcomponents/{p-DF7oFWnO.js → p-BJUSJGPP.js} +1 -1
- package/dist/webcomponents/p-C04splpj.js +1 -0
- package/dist/webcomponents/p-CZuwNeL1.js +1 -0
- package/dist/webcomponents/{p-CEHwp4sh.js → p-DON5-wIV.js} +1 -1
- package/dist/webcomponents/p-DTnmhThV.js +1 -0
- package/dist/webcomponents/{p-BKrZL95i.js → p-DWjkuM6f.js} +1 -1
- package/dist/webcomponents/{p-DCpGH4xL.js → p-Da0IToMr.js} +1 -1
- package/dist/webcomponents/{p-Bo7ndXwR.js → p-DgKsNl4p.js} +1 -1
- package/dist/webcomponents/{p-6f7756b7.entry.js → p-a19c4d51.entry.js} +1 -1
- package/dist/webcomponents/{p-12f5fdc0.entry.js → p-a3da15b6.entry.js} +1 -1
- package/dist/webcomponents/{p-2b5533a1.entry.js → p-a65ab079.entry.js} +1 -1
- package/dist/webcomponents/{p-fd1718e0.entry.js → p-a6b98663.entry.js} +1 -1
- package/dist/webcomponents/{p-b2b0303d.entry.js → p-ad842c42.entry.js} +1 -1
- package/dist/webcomponents/{p-a8f1c9b3.entry.js → p-ae41697b.entry.js} +1 -1
- package/dist/webcomponents/{p-deff4422.entry.js → p-aea1e9e4.entry.js} +1 -1
- package/dist/webcomponents/{p-6bfdc443.entry.js → p-b54c0942.entry.js} +1 -1
- package/dist/webcomponents/{p-521c534c.entry.js → p-b699d24b.entry.js} +1 -1
- package/dist/webcomponents/{p-3d02cb78.entry.js → p-b76b8634.entry.js} +1 -1
- package/dist/webcomponents/{p-2272a65b.entry.js → p-bebd8879.entry.js} +1 -1
- package/dist/webcomponents/{p-5331e011.entry.js → p-c96e25f9.entry.js} +1 -1
- package/dist/webcomponents/{p-5e196140.entry.js → p-d0a40e88.entry.js} +1 -1
- package/dist/webcomponents/p-d1361e3c.entry.js +1 -0
- package/dist/webcomponents/{p-d59d6c23.entry.js → p-d46ebc1c.entry.js} +1 -1
- package/dist/webcomponents/{p-a1ef7674.entry.js → p-dad1f6b9.entry.js} +1 -1
- package/dist/webcomponents/{p-91358854.entry.js → p-db854b84.entry.js} +1 -1
- package/dist/webcomponents/{p-28fb6b50.entry.js → p-dec8952b.entry.js} +1 -1
- package/dist/webcomponents/p-e3914845.entry.js +1 -0
- package/dist/webcomponents/{p-aba3b0dc.entry.js → p-e3f57bb1.entry.js} +1 -1
- package/dist/webcomponents/{p-89ed2d99.entry.js → p-e7c13d73.entry.js} +1 -1
- package/dist/webcomponents/{p-9c4ac3c5.entry.js → p-ee605f62.entry.js} +1 -1
- package/dist/webcomponents/{p-B6kC9tX2.js → p-rYB3onzC.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/styled-host-CW1WUnUq.js +0 -11
- package/dist/esm/styled-host-RvPhw8Gu.js +0 -9
- package/dist/webcomponents/p-05AWudQe.js +0 -1
- package/dist/webcomponents/p-4dabcfd6.entry.js +0 -1
- package/dist/webcomponents/p-63e02d42.entry.js +0 -1
- package/dist/webcomponents/p-80177bcb.entry.js +0 -1
- package/dist/webcomponents/p-9b930446.entry.js +0 -1
- package/dist/webcomponents/p-C8J9uVEs.js +0 -1
- package/dist/webcomponents/p-CEGSQXGU.js +0 -1
- package/dist/webcomponents/p-CKL24GQA.js +0 -1
- package/dist/webcomponents/p-CRaiEpKf.js +0 -1
- package/dist/webcomponents/p-DEfLsy2W.js +0 -1
- package/dist/webcomponents/p-DhrQechy.js +0 -1
- package/dist/webcomponents/p-e75d1756.entry.js +0 -1
- package/dist/webcomponents/p-f2c99647.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { C as card,
|
|
2
|
+
import { C as card, N as image, a1 as buttonLink } from './parts.js';
|
|
3
3
|
import { d as defineCustomElement$2 } from './custom-popper2.js';
|
|
4
4
|
import { d as defineCustomElement$1 } from './form-control-tooltip2.js';
|
|
5
5
|
|
|
@@ -41,6 +41,7 @@ export declare class JustifiTokenizePaymentMethod {
|
|
|
41
41
|
submitEvent: EventEmitter<ComponentSubmitEvent>;
|
|
42
42
|
connectedCallback(): void;
|
|
43
43
|
disconnectedCallback(): void;
|
|
44
|
+
componentWillRender(): void;
|
|
44
45
|
componentWillLoad(): void;
|
|
45
46
|
handleRadioClick(event: CustomEvent<string>): void;
|
|
46
47
|
tokenizePaymentMethod(event?: MouseEvent): Promise<PaymentMethodPayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i,H as s,g as a}from"./p-CV0Pyo1O.js";import{A as n}from"./p-Da0IToMr.js";import{A as o,r,s as l,t as h,u as d,v as c,w as p,C as u,b as y,c as m,I as v,x as f,y as b,z as g}from"./p-Dqxyi-uK.js";import{S as k}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import{S as P}from"./p-eBK-iWrz.js";import{c as w,o as C,a as L,g as E,b as A}from"./p-FsWkrvEF.js";import{t as S,B as _,x as M,z as j,r as I}from"./p-Bu7gdOaV.js";import{f as R}from"./p-Ds_P-dB8.js";import{w as T,c as O}from"./p-B4vLfYnZ.js";import{H as N}from"./p-CZk3i5Tu.js";import{H as x,b as z,h as D,i as B}from"./p-x2oNTAWh.js";import{H as F}from"./p-BAB1lPu0.js";import{J as U}from"./p-DON5-wIV.js";import{d as V}from"./p-BJUSJGPP.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{m as Z,a as H}from"./p-D7nyPi2Q.js";import{C as q}from"./p-DWjkuM6f.js";import{P as G}from"./p-B-LmgMK4.js";import{P as W,a as Y,b as J}from"./p-DEx8fQeW.js";import{C as K}from"./p-ZpPDShvP.js";import"./p-C04splpj.js";import"./p-DgTOxu8x.js";import"./p-BhpaUYtS.js";const $=class{constructor(i){t(this,i),this.radioClick=e(this,"radio-click",7),this.checked=!1,this.hidden=!1}render(){return i(k,{key:"02955940079320bd9c6bf94e239545385ac36458"},i("radio-list-item",{key:"fc6b98e456e4326b843b2b3248b7327436767cf4",name:this.name,value:this.value,label:this.label,checked:this.checked,hidden:this.hidden,class:this.class,"onRadio-click":t=>this.radioClick.emit(t.detail)}))}};var Q;!function(t){t.UNAVAILABLE="UNAVAILABLE",t.SESSION_ERROR="SESSION_ERROR",t.MERCHANT_VALIDATION_ERROR="MERCHANT_VALIDATION_ERROR",t.PAYMENT_PROCESSING_ERROR="PAYMENT_PROCESSING_ERROR",t.USER_CANCELLED="USER_CANCELLED"}(Q||(Q={}));class X{constructor(){this.api=n()}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,a)=>{try{if("undefined"==typeof window||!("ApplePaySession"in window))return console.error("[ApplePayService] ApplePaySession not available on window"),a({success:!1,error:{code:Q.UNAVAILABLE,message:"ApplePaySession API is not available in this environment"}});this.currentSession=new window.ApplePaySession(3,s),this.setupSessionEventHandlers(t,a,e,i),this.currentSession.begin()}catch(t){console.error("[ApplePayService] Exception while starting session:",t),a({success:!1,error:{code:Q.SESSION_ERROR,message:t instanceof Error?t.message:"Failed to start Apple Pay session"}})}}))}abortPaymentSession(){this.currentSession&&(this.currentSession.abort(),this.currentSession=void 0,this.currentPaymentRequest=void 0)}setupSessionEventHandlers(t,e,i,s){this.currentSession&&this.applePayConfig&&this.currentPaymentRequest?(this.currentSession.onvalidatemerchant=async()=>{try{if(!i)throw console.error("[ApplePayService] Missing authToken for merchant validation"),new Error("Authentication token not provided.");const t=await this.validateMerchant(i,s);try{this.currentSession.completeMerchantValidation(t)}catch(t){throw console.error("Error calling completeMerchantValidation:",t),t}}catch(t){console.error("=== MERCHANT VALIDATION ERROR ==="),console.error("Error during merchant validation:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.abort(),e({success:!1,error:{code:Q.MERCHANT_VALIDATION_ERROR,message:t instanceof Error?t.message:"Merchant validation failed"}})}},this.currentSession.onpaymentauthorized=async a=>{try{const n=a.payment,o=Object.assign(Object.assign({},n.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:n.token,paymentMethodId:l.data.id})):(console.error("PSP reported payment failure:",l.data),this.currentSession.completePayment({status:h.STATUS_FAILURE}),e({success:!1,error:{code:Q.PAYMENT_PROCESSING_ERROR,message:"Payment processing failed"}}))}catch(t){console.error("=== PAYMENT PROCESSING ERROR ==="),console.error("Error processing payment:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.completePayment({status:h.STATUS_FAILURE}),e({success:!1,error:{code:Q.PAYMENT_PROCESSING_ERROR,message:t instanceof Error?t.message:"Payment processing failed"}})}finally{this.currentSession=void 0,this.currentPaymentRequest=void 0}},this.currentSession.onpaymentmethodselected=()=>{const t={newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]};try{this.currentSession.completePaymentMethodSelection(t)}catch(t){console.error("Error completing payment method selection:",t),this.currentSession.abort()}},this.currentSession.onshippingmethodselected=()=>{this.currentSession.completeShippingMethodSelection({status:h.STATUS_SUCCESS,newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]})},this.currentSession.oncancel=t=>{if(t.sessionError)switch(console.error(t.sessionError),t.sessionError.code){case"unknown":console.error("Unknown error - likely merchant validation issue"),console.error("This usually means:"),console.error("1. Merchant certificate is invalid or expired"),console.error("2. Merchant identifier mismatch"),console.error("3. Backend validation endpoint issues");break;case"invalidMerchantSession":console.error("Invalid merchant session provided"),console.error("Check that the merchant session from backend is valid");break;case"userCancel":console.error("User cancelled the payment");break;default:console.error("Other error code:",t.sessionError.code)}this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:Q.USER_CANCELLED,message:"User cancelled the Apple Pay session"}})},"onerror"in this.currentSession&&(this.currentSession.onerror=t=>{console.error("=== APPLE PAY SESSION ERROR ==="),console.error("Session error:",t),this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:Q.SESSION_ERROR,message:"Apple Pay session error occurred"}})})):console.error("[ApplePayService] setupSessionEventHandlers called without required state",{hasSession:Boolean(this.currentSession),hasConfig:Boolean(this.applePayConfig),hasPaymentRequest:Boolean(this.currentPaymentRequest)})}static createPaymentRequest(t,e,i="US",s="USD"){return{countryCode:i,currencyCode:s,merchantCapabilities:r.getDefaultMerchantCapabilities(),supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const tt=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(P,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null},et=t=>i("div",{class:"apple-pay-button-container"},i("button",Object.assign({class:(()=>{let e="apple-pay-button";switch(t.buttonStyle){case d.WHITE:e+=" apple-pay-button-white";break;case d.WHITE_OUTLINE:e+=" apple-pay-button-white-outline";break;default:e+=" apple-pay-button-black"}switch(t.buttonType){case c.BUY:e+=" apple-pay-button-type-buy";break;case c.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 ")),it=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=c.PLAIN,this.buttonStyle=d.BLACK,this.disabled=!1,this.width="100%",this.height="48px",this.isLoading=!0,this.isProcessing=!1,this.isAvailable=!1,this.canMakePayments=!1,this.isConfigValid=!0,this.error=null,this.handleApplePayClick=async()=>{var t,e,i;if(!this.isProcessing&&!this.disabled&&this.isAvailable)try{this.isProcessing=!0,this.error=null,this.applePayStarted.emit();const i={countryCode:this.countryCodeForCurrency(w.paymentCurrency),currencyCode:w.paymentCurrency,merchantCapabilities:[p.SUPPORTS_3DS,p.SUPPORTS_CREDIT,p.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)||it.ErrorCode.PAYMENT_FAILED}))}catch(t){if((null===(i=null==t?void 0:t.error)||void 0===i?void 0:i.code)===Q.USER_CANCELLED)this.applePayCancelled.emit();else{const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e,code:it.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():C("checkoutLoaded",(t=>{t&&this.loadApplePaySDK()})):this.isLoading=!1}countryCodeForCurrency(t){return"cad"==t.toLowerCase()?"CA":"US"}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:it.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:it.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:it.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 X,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:it.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(k,null,i("div",{class:"apple-pay-container"},i(tt,{isLoading:this.isLoading}),t&&i(et,{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 "))}};it.ErrorCode={CONFIG_ERROR:"CONFIG_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",NOT_AVAILABLE:"NOT_AVAILABLE",INITIALIZATION_ERROR:"INITIALIZATION_ERROR",PAYMENT_FAILED:"PAYMENT_FAILED"};const st=class{constructor(e){t(this,e),this.variant="primary",this.type="button"}render(){return i(k,{key:"1e09a302d064e2e4a860dc4efd9eb9693d4d0055"},i("internal-button",{key:"9ce7819853789c44860de43f26632c62415ebdb5",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}))}},at=class{constructor(e){t(this,e)}render(){return i(k,{key:"13d0570e2bdb79d842f9c0a17c7403963ea167c8"},i("section",{key:"c15f36caa2a9ebb66c7f0a16393926b643f1bc3b"},i("div",{key:"1e4e5d32cebb57ceaeb3786a29a9e08c8e83ac80"},i("div",{key:"42ff5c6ef33654a88858e8ed48e230dd674d1953",part:S},null==w?void 0:w.paymentDescription),i("div",{key:"c21d5eb012664efdd71e82bf24a88d0fefedad8c"},i("span",{key:"a8876afe5d7e993077ed8c4fb140c745d98e9196",part:S},"Total")," ",i("span",{key:"b81156e9f9240656b51f6ed374db9878bb3137c9",part:S},R(+(null==w?void 0:w.totalAmount)))))))}},nt=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(P,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null};var ot;!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"}(ot||(ot={}));const rt=class{constructor(i){t(this,i),this.googlePayStarted=e(this,"googlePayStarted",7),this.googlePayCompleted=e(this,"googlePayCompleted",7),this.googlePayCancelled=e(this,"googlePayCancelled",7),this.merchantDisplayName="JustiFi Checkout",this.useNativePaymentRequest=!1,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 ot.ready:this.iframeReady=!0;break;case ot.sdkLoaded:this.sdkLoaded=!0,this.sendInitialize();break;case ot.initializeResult:this.isReadyToPay=i.isReadyToPay,i.error&&console.error("Init error:",i.error);break;case ot.error:console.error("Google Pay error:",i);break;case ot.buttonClicked:this.googlePayStarted.emit(),this.sendStartPayment();break;case ot.paymentSuccess:this.googlePayCompleted.emit({success:!0,paymentMethodId:i.paymentMethodId,cardNetwork:i.cardNetwork,cardDetails:i.cardDetails});break;case ot.paymentCanceled:this.googlePayCancelled.emit();break;case ot.paymentError:this.googlePayCompleted.emit({success:!1,error:{code:i.code,message:i.message}})}}}async componentWillLoad(){await T(),this.iframeOrigin=O.iframeOrigin}componentDidLoad(){window.addEventListener("message",this.handleMessage)}disconnectedCallback(){window.removeEventListener("message",this.handleMessage)}googlePayEnvironment(){return void 0!==this.environment?this.environment:"test"===w.checkoutMode?"TEST":"PRODUCTION"}sendInitialize(){var t;if(!(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow))return;const e={environment:this.googlePayEnvironment(),gatewayMerchantId:w.accountId,merchantName:this.merchantDisplayName,authToken:w.authToken,accountId:w.accountId,useNativePaymentRequest:this.useNativePaymentRequest};this.iframeElement.contentWindow.postMessage({eventType:ot.initialize,data:e},this.iframeOrigin)}sendStartPayment(){var t;if(!(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow))return;const e={totalPrice:String(w.paymentAmount/100),totalPriceStatus:"FINAL",currencyCode:w.paymentCurrency||"USD"};this.iframeElement.contentWindow.postMessage({eventType:ot.startPayment,data:e},this.iframeOrigin)}render(){return w.checkoutLoaded?w.googlePayEnabled?i(s,null,i(nt,{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}},lt=class{constructor(e){t(this,e),this.levels={h1:N,h2:x,h3:F},this.level="h1"}render(){return i(k,{key:"1843adabddf7d439036f8ce6f55627b7ca3e4a9f"},i(this.levels[this.level],{key:"b16e5624ce7e092cc8c144a7cdfd9cb6afdf7a83",text:this.text,class:this.class}))}},ht=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 G,this.maskCardNumber=!1,this.handlePaypalStarted=()=>{w.isWalletProcessing=!0},this.handlePaypalCompleted=t=>{const{success:e,paymentMethodId:i,fundingSource:s}=t.detail||{};w.isWalletProcessing=!1,e&&i?(w.paymentToken=i,w.selectedPaymentMethod={type:"venmo"===s?W.VENMO:W.PAYPAL},this.submitCheckout()):this.errorEvent.emit({message:"Paypal payment failed",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR})},this.handlePaypalCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0},this.handlePaypalError=t=>{w.isWalletProcessing=!1;const{error:e,code:i}=t.detail||{};this.errorEvent.emit({message:e||"Paypal error occurred",errorCode:`PAYPAL_${i}`,severity:u.ERROR})},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:W.GOOGLE_PAY},this.submitCheckout()):(w.isWalletProcessing=!1,this.errorEvent.emit({message:s&&s.message||"Google Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:u.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:a}=t.detail;e&&i?(w.isWalletProcessing=!1,w.paymentToken=s,w.selectedPaymentMethod={type:W.APPLE_PAY},this.submitCheckout()):(w.isWalletProcessing=!1,console.error("Apple Pay completed but failed:",a),this.errorEvent.emit({message:(null==a?void 0:a.message)||"Apple Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:u.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:u.ERROR})},this.handleApplePayCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0}}maskCardNumberChanged(){w.maskCardNumber=!!this.maskCardNumber}connectedCallback(){var t;this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners(),this.setupPaypalListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),w.checkoutId=this.checkoutId,w.maskCardNumber=!!this.maskCardNumber;const e={authToken:this.authToken,checkoutId:this.checkoutId,service:new q};this.getCheckout=Z(e),this.completeCheckout=H(e),null===(t=this.unsubscribeCheckoutChanges)||void 0===t||t.call(this),this.unsubscribeCheckoutChanges=L((()=>{this.emitCheckoutChanged()}))}componentWillLoad(){this.analytics=new U(this),V(),w.authToken=this.authToken,this.fetchCheckout(),z("set",(t=>{const e=B[t];void 0!==e&&D(t,e)&&this.fetchCheckout()}))}componentDidLoad(){this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners(),this.setupPaypalListeners()}disconnectedCallback(){var t,e;null===(t=this.unsubscribeCheckoutChanges)||void 0===t||t.call(this),this.unsubscribeCheckoutChanges=void 0,null===(e=this.observer)||void 0===e||e.disconnect(),this.removeApplePayListeners(),this.removeGooglePayListeners(),this.removePaypalListeners()}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:u.ERROR}):this.errorEvent.emit({message:m.CHECKOUT_ALREADY_COMPLETED,errorCode:y.CHECKOUT_ALREADY_COMPLETED,severity:u.ERROR})},onError:({error:t,code:e,severity:i})=>{this.errorEvent.emit({message:t,errorCode:e,severity:i})}}):this.errorEvent.emit({message:m.NOT_AUTHENTICATED,errorCode:y.NOT_AUTHENTICATED,severity:u.ERROR})}updateStore(t){var e,i,s,a,n,o,r,l,h,d,c,p,u,y,m;w.accountId=t.account_id;const v=null!=t.mode?String(t.mode).toLowerCase():"";w.checkoutMode="test"===v?"test":"live"===v?"live":null;const f=t.payment_methods.map((t=>new Y(t))),b=Boolean(null===(e=t.payment_settings)||void 0===e?void 0:e.ach_payments);w.paymentMethods=f.filter((t=>t.type!==W.SAVED_BANK_ACCOUNT||b)),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=null!==(i=t.payment_settings.insurance_payments)&&void 0!==i&&i,w.bankAccountVerification=null===(s=t.payment_settings)||void 0===s?void 0:s.bank_account_verification,w.applePayEnabled=null!==(n=null===(a=t.payment_settings)||void 0===a?void 0:a.apple_payments)&&void 0!==n&&n,w.googlePayEnabled=null!==(r=null===(o=t.payment_settings)||void 0===o?void 0:o.google_payments)&&void 0!==r&&r,w.paypalEnabled=null!==(h=null===(l=t.payment_settings)||void 0===l?void 0:l.paypal_payments)&&void 0!==h&&h,w.paypalProviderClientId=null!==(c=null===(d=t.paypal)||void 0===d?void 0:d.provider_client_id)&&void 0!==c?c:"",w.achPaymentsEnabled=b,w.bnplProviderClientId=null===(p=null==t?void 0:t.bnpl)||void 0===p?void 0:p.provider_client_id,w.bnplProviderMode=null===(u=null==t?void 0:t.bnpl)||void 0===u?void 0:u.provider_mode,w.bnplProviderApiVersion=null===(y=null==t?void 0:t.bnpl)||void 0===y?void 0:y.provider_api_version,w.bnplProviderCheckoutUrl=null===(m=null==t?void 0:t.bnpl)||void 0===m?void 0:m.provider_checkout_url,w.paymentCurrency=(t.payment_currency||w.paymentCurrency).toUpperCase(),w.checkoutLoaded=!0}emitCheckoutChanged(){const t={availablePaymentMethodTypes:E(),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.paypalRef=this.hostEl.querySelector("justifi-paypal"),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:W.NEW_CARD}:"justifi-bank-account-form"!==t||w.checkoutLoaded&&!w.achPaymentsEnabled||(w.selectedPaymentMethod={type:W.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))}setupPaypalListeners(){this.paypalRef&&(this.paypalRef.addEventListener("paypalStarted",this.handlePaypalStarted),this.paypalRef.addEventListener("paypalCompleted",this.handlePaypalCompleted),this.paypalRef.addEventListener("paypalCancelled",this.handlePaypalCancelled),this.paypalRef.addEventListener("paypalError",this.handlePaypalError))}removePaypalListeners(){this.paypalRef&&(this.paypalRef.removeEventListener("paypalStarted",this.handlePaypalStarted),this.paypalRef.removeEventListener("paypalCompleted",this.handlePaypalCompleted),this.paypalRef.removeEventListener("paypalCancelled",this.handlePaypalCancelled),this.paypalRef.removeEventListener("paypalError",this.handlePaypalError))}async tokenizePaymentMethod(t){var e,i,s;const a=null!==(i=await(null===(e=this.billingFormRef)||void 0===e?void 0:e.getValues()))&&void 0!==i?i:{},n=Object.assign(Object.assign({},t),a),o=Object.assign({accountId:w.accountId,payment_method_group_id:void 0},n);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)===W.NEW_CARD,a=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===W.NEW_BANK_ACCOUNT;if((s||a)&&(this.paymentMethodFormRef&&i.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&this.billingFormRef!==this.paymentMethodFormRef&&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:u.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){var e,i,s,a,n,o,r,l;if(w.isSubmitting)return;w.isSubmitting=!0;const h=await this.validate();if(!w.selectedPaymentMethod)return w.isSubmitting=!1,void this.errorEvent.emit({message:"No payment method selected.",errorCode:y.VALIDATION_ERROR,severity:u.ERROR});if(!h)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:y.VALIDATION_ERROR,severity:u.ERROR});const d=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===W.NEW_CARD,c=(null===(i=w.selectedPaymentMethod)||void 0===i?void 0:i.type)===W.NEW_BANK_ACCOUNT,p=(null===(s=w.selectedPaymentMethod)||void 0===s?void 0:s.type)===W.PLAID;if(d||c){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:u.ERROR})}if(p&&!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:u.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:u.ERROR});const s=null==i?void 0:i.data,n=(null===(a=null==s?void 0:s.bank_account)||void 0===a?void 0:a.token)||(null==s?void 0:s.token)||(null==s?void 0:s.id);w.paymentToken=n}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:u.ERROR})}}const m=(null===(n=w.selectedPaymentMethod)||void 0===n?void 0:n.type)===W.SEZZLE;if(m){const t=this.hostEl.querySelector("justifi-sezzle-payment-method"),e=await(null==t?void 0:t.resolvePaymentMethod({isValid:h}));if("success"!==(null===(o=null==e?void 0:e.bnpl)||void 0===o?void 0:o.status))return w.isSubmitting=!1,void this.errorEvent.emit({message:(null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.message)||"Sezzle checkout was not completed.",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR})}if(!m&&!w.paymentToken)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Payment token not found.",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR});const v={payment_mode:(t=>{switch(t){case W.NEW_CARD:case W.SAVED_CARD:case W.NEW_BANK_ACCOUNT:case W.SAVED_BANK_ACCOUNT:case W.PLAID:return J.ECOM;case W.SEZZLE:return J.BNPL;case W.APPLE_PAY:return J.APPLE_PAY;case W.GOOGLE_PAY:return J.GOOGLE_PAY;case W.PAYPAL:return J.PAYPAL;case W.VENMO:return J.VENMO;default:return}})(null===(l=w.selectedPaymentMethod)||void 0===l?void 0:l.type),payment_token:m?void 0:w.paymentToken};if(this.preCompleteHook){const t=A();try{await new Promise(((e,i)=>{this.preCompleteHook(t,(()=>e()),(()=>i()))}))}catch(t){return w.isSubmitting=!1,void console.log("Checkout cancelled by preCompleteHook",t)}}this.completeCheckout({payment:v,onSuccess:({checkout:t})=>{w.isSubmitting=!1,this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:({error:t})=>{w.isSubmitting=!1,this.errorEvent.emit({message:t,errorCode:y.COMPLETE_CHECKOUT_ERROR,severity:u.ERROR})}})}render(){return i(s,{key:"d1e1326e66bc9347de573bc8b3aa30e19178ade9"})}get hostEl(){return a(this)}static get watchers(){return{maskCardNumber:["maskCardNumberChanged"]}}},dt=n();class ct{async createPaypalOrder(t,e,i,s){return dt.post({endpoint:`checkouts/${e}/paypal/orders`,body:{funding_source:i},authToken:t,signal:s})}}const pt="paypal-script",ut=["paypal-payments","venmo-payments"],yt="PAYMENT_FAILED",mt="shown",vt=(t,e)=>{t&&(e?t.classList.add(mt):t.classList.remove(mt))},ft=class{constructor(i){t(this,i),this.paypalStarted=e(this,"paypalStarted",7),this.paypalCompleted=e(this,"paypalCompleted",7),this.paypalCancelled=e(this,"paypalCancelled",7),this.paypalError=e(this,"paypalError",7),this.paypalService=new ct,this.paypalEligible=!1,this.venmoEligible=!1,this.startSession=async(t,e)=>{if(!t)return;this.pendingOrderId=void 0,this.paypalStarted.emit({fundingSource:e});let i=!1;const s=this.createOrder(e).then((t=>({orderId:t.provider_order_id}))).catch((t=>{throw i=!0,this.emitError((null==t?void 0:t.message)||"Could not create the Paypal order","ORDER_ERROR"),t}));s.catch((()=>{}));try{await t.start({presentationMode:"auto"},s)}catch(t){if(i)return;this.emitError((null==t?void 0:t.message)||"Paypal payment failed",yt)}}}componentDidLoad(){w.checkoutLoaded?this.initializePaypal():C("checkoutLoaded",(t=>{t&&this.initializePaypal()}))}componentDidRender(){this.applyVisibility()}get currencyCode(){return(w.paymentCurrency||"USD").toUpperCase()}get showPaypal(){return!!w.paypalEnabled&&this.paypalEligible}get showVenmo(){return!!w.paypalEnabled&&this.venmoEligible&&"USD"===this.currencyCode}applyVisibility(){const{showPaypal:t,showVenmo:e}=this;vt(this.buttonsEl,t||e),vt(this.paypalButtonEl,t),vt(this.venmoButtonEl,e)}emitError(t,e){this.paypalError.emit({error:t,code:e})}loadPaypalScript(){const t=window.paypal;return t?Promise.resolve(t):new Promise(((t,e)=>{let i=document.head.querySelector(`script[data-test-id="${pt}"]`);i||(i=document.createElement("script"),i.src="test"===w.checkoutMode?"https://www.sandbox.paypal.com/web-sdk/v6/core":"https://www.paypal.com/web-sdk/v6/core",i.async=!0,i.setAttribute("data-test-id",pt),document.head.appendChild(i)),i.addEventListener("load",(()=>{const i=window.paypal;i?t(i):e(new Error("Paypal script loaded but window.paypal is undefined"))})),i.addEventListener("error",(()=>e(new Error("Error loading Paypal script"))))}))}metadataId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async initializePaypal(){const t=w.paypalProviderClientId;if(!t)return this.paypalEligible=!1,this.venmoEligible=!1,this.applyVisibility(),void this.emitError("Missing Paypal client id","CONFIG_ERROR");try{const e=await this.loadPaypalScript();this.sdkInstance=await e.createInstance({clientId:t,components:ut,pageType:"checkout",metadataId:this.metadataId()});const i=await this.sdkInstance.findEligibleMethods({currencyCode:this.currencyCode});this.paypalEligible=i.isEligible("paypal"),this.venmoEligible=i.isEligible("venmo"),this.paypalEligible&&(this.paypalSession=this.sdkInstance.createPayPalOneTimePaymentSession(this.sessionOptions("paypal"))),this.venmoEligible&&(this.venmoSession=this.sdkInstance.createVenmoOneTimePaymentSession(this.sessionOptions("venmo"))),this.applyVisibility()}catch(t){this.paypalEligible=!1,this.venmoEligible=!1,this.applyVisibility(),this.emitError((null==t?void 0:t.message)||"Error initializing Paypal","INITIALIZATION_ERROR")}}sessionOptions(t){return{onApprove:()=>this.paypalCompleted.emit({success:!0,paymentMethodId:this.pendingOrderId,fundingSource:t}),onCancel:()=>this.paypalCancelled.emit({fundingSource:t}),onError:t=>this.emitError((null==t?void 0:t.message)||"Paypal payment failed",yt)}}async createOrder(t){const e=await this.paypalService.createPaypalOrder(w.authToken,w.checkoutId,t);if(null==e?void 0:e.error)throw new Error(("string"==typeof e.error?e.error:e.error.message)||"Could not create the Paypal order");const i=null==e?void 0:e.data;if(!(null==i?void 0:i.provider_order_id))throw new Error("Paypal order is missing a provider order id");return this.pendingOrderId=i.id,i}render(){return i(k,{key:"39a2b473cfa47da5e079adbaffa93663289cb8ec"},i("div",{key:"9d3e3ff9236d2462157b310d691c43f54b6651dd",class:"paypal-buttons",ref:t=>this.buttonsEl=t},i("paypal-button",{key:"a0049d2bcf4aa295f65563f49c3287b2da2e63b8",type:"pay",ref:t=>this.paypalButtonEl=t,onClick:()=>this.startSession(this.paypalSession,"paypal")}),i("venmo-button",{key:"fd71ba73af2223271160601ec76039d3e0d6cb02",type:"pay",ref:t=>this.venmoButtonEl=t,onClick:()=>this.startSession(this.venmoSession,"venmo")})),i("style",{key:"7c7b62b3bbdf001760e888b4206702d210aeadcb"},"\n .paypal-buttons {\n display: none;\n gap: 8px;\n width: 100%;\n }\n .paypal-buttons.shown {\n display: flex;\n }\n .paypal-buttons > * {\n display: none;\n flex: 1 1 0;\n min-width: 0;\n }\n .paypal-buttons > .shown {\n display: block;\n }\n "))}},bt=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 G,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.hasLoggedAchPaymentsDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{w.authToken&&w.accountId&&w.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:g.PLAID_SDK_LOAD_FAILED,message:b[g.PLAID_SDK_LOAD_FAILED],severity:f[g.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:g.PLAID_LINK_TOKEN_FAILED,message:b[g.PLAID_LINK_TOKEN_FAILED],severity:f[g.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:g.PLAID_LINK_INIT_FAILED,message:b[g.PLAID_LINK_INIT_FAILED],severity:f[g.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,s,a;try{if(!w.authToken||!w.accountId)return void this.handleError({code:g.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:u.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 n=g.PLAID_LINK_TOKEN_FAILED,o=b[n],r=!0;"AbortError"===t.name?(n=g.PLAID_TIMEOUT,o=b[n],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"))?(n=g.PLAID_NETWORK_ERROR,o=b[n],r=!0):((null===(s=t.message)||void 0===s?void 0:s.includes("401"))||(null===(a=t.message)||void 0===a?void 0:a.includes("unauthorized")))&&(n=g.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:n,message:o,severity:f[n],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 g.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return g.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return g.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return g.PLAID_RATE_LIMITED;case"maintenance":return g.PLAID_MAINTENANCE;case"not_authenticated":return g.PLAID_INVALID_CREDENTIALS;default:return g.PLAID_LINK_TOKEN_FAILED}return g.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:W.PLAID}),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:u.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=g.PLAID_AUTHENTICATION_FAILED,i=b[e],s=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=g.PLAID_INVALID_CREDENTIALS,i=b[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=g.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=g.PLAID_ACCOUNT_LOCKED,i=b[e],s=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=g.PLAID_MAINTENANCE,i=b[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=g.PLAID_RATE_LIMITED,i=b[e],s=!0;break;case"INVALID_REQUEST":e=g.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=g.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 n=t.error_message.toLowerCase();n.includes("not supported")||n.includes("unsupported")?(e=g.PLAID_BANK_NOT_SUPPORTED,i=b[e],s=!1,a="Try a different payment method"):(n.includes("expired")||n.includes("timeout"))&&(e=g.PLAID_TOKEN_EXPIRED,i=b[e],s=!0)}this.handleError({code:e,message:i,severity:f[e],originalError:t,retryable:s,userAction:a}),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)===W.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)!==W.PLAID&&(w.selectedPaymentMethod={type:W.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)===W.PLAID,!0===w.bankAccountVerification&&(w.checkoutLoaded?w.achPaymentsEnabled&&this.loadPlaidSDK():C("checkoutLoaded",(t=>{t&&!0===w.bankAccountVerification&&w.achPaymentsEnabled&&this.loadPlaidSDK()})))}loadPlaidSDK(){if(this.sdkLoaded)return;this.sdkLoaded=!0;const t=document.createElement("script");t.src="https://cdn.plaid.com/link/v2/stable/link-initialize.js",t.async=!0,t.onload=()=>this.initializePlaidLink(),t.onerror=()=>{this.handleError({code:g.PLAID_SDK_LOAD_FAILED,message:b[g.PLAID_SDK_LOAD_FAILED],severity:f[g.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:W.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:W.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=C("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(w.checkoutLoaded&&!w.achPaymentsEnabled)return this.hasLoggedAchPaymentsDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] ACH payments are disabled for this checkout. Component will not render."),this.hasLoggedAchPaymentsDisabledWarning=!0),null;if(!0!==w.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const t=i("svg",{class:"plaid-logo-img",part:_,role:"img","aria-label":"Plaid",viewBox:"0 0 28 29",xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",width:"20px",height:"20px",marginLeft:"5px",marginTop:"-2px"}},i("title",null,"Plaid"),i("path",{fill:"currentColor","fill-rule":"evenodd",d:"M25.7629 26.2628L28 17.5309L24.9691 14.5001L27.9999 11.4691L25.7628 2.73706L17.0309 0.5L14.0001 3.531L10.969 0.50014L2.23706 2.73734L0 11.4691L3.03128 14.4999L0.00014 17.531L2.2372 26.2629L10.9691 28.5L14.0001 25.469L17.031 28.4999L25.7629 26.2628ZM15.7321 23.7371L18.6186 20.8505L22.2912 24.5233L17.6956 25.7007L15.7321 23.7371ZM11.1136 9.88154L14.0003 6.99502L16.8868 9.8814L14.0001 12.7679L11.1136 9.88154ZM12.2682 14.5L9.38154 17.3865L6.49502 14.5L9.38154 11.6135L12.2682 14.5ZM18.6187 11.6133L21.5053 14.5L18.6186 17.3865L15.7321 14.5L18.6187 11.6133ZM16.8867 19.1186L14.0001 22.0051L11.1135 19.1185L14.0001 16.2319L16.8867 19.1186ZM10.3044 25.7007L5.70864 24.5233L9.38154 20.8504L12.2682 23.7371L10.3044 25.7007ZM4.76308 16.2319L7.6496 19.1185L3.9767 22.7914L2.7993 18.1957L4.76308 16.2319ZM3.9767 6.20836L7.64974 9.8814L4.76308 12.7681L2.7993 10.8041L3.9767 6.20836ZM12.2683 5.26294L9.38168 8.1496L5.70892 4.4767L10.3047 3.2993L12.2683 5.26294ZM17.6959 3.2993L22.2915 4.4767L18.6186 8.14946L15.7321 5.26294L17.6959 3.2993ZM23.2372 12.7681L20.3505 9.8814L24.0233 6.20878L25.2007 10.8046L23.2372 12.7681ZM24.0233 22.7914L20.3505 19.1186L23.2372 16.2321L25.2007 18.1957L24.0233 22.7914Z"}));return i(k,{class:"payment-method",exportparts:"label,text,color,font-family,text-danger,image"},i("div",{title:"Pay with Plaid"},i("div",{part:M,onClick:t=>{t.preventDefault(),this.handleSelectionClick()}},"Pay with Bank Account ",t," "),(()=>this.error?i("div",{class:"mt-2"},i("div",{class:this.error.severity===u.ERROR?"text-danger":this.error.severity===u.WARNING?"text-warning":"text-info"},i("small",{part:this.error.severity===u.ERROR?j:S},this.error.message)),i("div",{class:"text-muted"},i("small",{part:S},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",{part:S},"Connecting to your bank...")):this.publicToken?i("div",{class:"text-success mt-2"},i("small",{part:S},"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:i("div",{class:"text-muted mt-2"},i("small",{part:S},"Click to connect your bank account")))()))}static get watchers(){return{isSelected:["onSelectionChange"]}}},gt=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===W.SAVED_CARD&&w.disableCreditCard||t===W.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(k,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:`${K[null==t?void 0:t.brand]||""} *${null==t?void 0:t.acct_last_four}`})))):null))}},kt=class{constructor(i){t(this,i),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.paymentMethodOptionId=W.SEZZLE,this.initializeSezzleCheckout=()=>{const t=Number(w.paymentAmount),e=new(0,window.Checkout)({mode:"popup",publicKey:w.bnplProviderClientId,apiMode:w.bnplProviderMode,apiVersion:w.bnplProviderApiVersion});e.sezzleButtonElement=this.sezzleButtonRef,e.init({onClick:function(t){t.preventDefault(),e.startCheckout({checkout_url:w.bnplProviderCheckoutUrl})},onComplete:t=>{var e;return null===(e=this.resolveSezzlePromise)||void 0===e?void 0:e.call(this,{bnpl:t.data})},onCancel:t=>{var e;return null===(e=this.resolveSezzlePromise)||void 0===e?void 0:e.call(this,{bnpl:t.data})},onFailure:t=>{var e;return null===(e=this.resolveSezzlePromise)||void 0===e?void 0:e.call(this,{bnpl:t.data})}}),this.sezzleCheckout=e,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(t)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()})}async resolvePaymentMethod(t){if(!t.isValid)return{validationError:!0};if(!this.sezzleButtonRef)return{error:{code:"sezzle_not_ready",message:"Sezzle is not ready yet. Please try again.",decline_code:""}};const e=new Promise((t=>{this.resolveSezzlePromise=t}));return this.sezzleButtonRef.click(),e}async handleSelectionClick(){w.selectedPaymentMethod={type:W.SEZZLE},this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)}render(){var t,e;return w.bnplEnabled?i(k,{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 ",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"}})),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"},R(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)}},Pt={[W.NEW_BANK_ACCOUNT]:"New bank account",[W.NEW_CARD]:"New credit or debit card"},wt="Payment form not ready",Ct="Validation error",Lt=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()}componentWillRender(){this.selectedPaymentMethod&&!w.selectedPaymentMethod&&(w.selectedPaymentMethod={type:this.selectedPaymentMethod})}componentWillLoad(){V(),this.analytics=new U(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:Ct}),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:wt}};const[t,e]=await Promise.all([this.billingFormRef.validate(),this.paymentMethodFormRef.validate()]);return{isValid:t.isValid&&e.isValid,errors:Object.assign({},t.errors)}}async getValues(){return this.billingFormRef.getValues()}async tokenize(){try{const t=await this.billingFormRef.getValues(),e={clientId:this.authToken||w.authToken,account:this.accountId||w.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||w.authToken||this.emitError({errorCode:y.TOKENIZE_ERROR,message:"Auth token is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"}),this.accountId||w.accountId||this.emitError({errorCode:y.TOKENIZE_ERROR,message:"Account ID is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"})}setDefaultSelectedPaymentMethod(){this.selectedPaymentMethod||(this.disableCreditCard?this.disableBankAccount||w.checkoutLoaded&&!w.achPaymentsEnabled||(this.selectedPaymentMethod=W.NEW_BANK_ACCOUNT,w.selectedPaymentMethod={type:W.NEW_BANK_ACCOUNT}):(this.selectedPaymentMethod=W.NEW_CARD,w.selectedPaymentMethod={type:W.NEW_CARD}))}setComputedHideSubmitButton(){if(void 0!==this.hideSubmitButton)return void(this.computedHideSubmitButton=this.hideSubmitButton);const t=this.isSlottedWithinModularCheckout();this.computedHideSubmitButton=t}isSlottedWithinModularCheckout(){var t;let e=null===(t=this.host)||void 0===t?void 0:t.parentElement;for(;e;){if("JUSTIFI-MODULAR-CHECKOUT"===e.tagName)return!0;e=e.parentElement}return!1}get availablePaymentMethods(){const t=[],e=!w.checkoutLoaded||w.achPaymentsEnabled;return this.disableCreditCard||t.push(W.NEW_CARD),!this.disableBankAccount&&e&&t.push(W.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:u.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",wt);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||Ct;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=w.selectedPaymentMethod,s=this.selectedPaymentMethod===t&&!(e&&(void 0!==e.id||e.type!==t));return i("div",{class:"payment-method"},i("radio-list-item",{name:"paymentMethodType",value:t,checked:s,label:Pt[t],hidden:this.shouldHideRadioInput}),s&&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 t===W.NEW_CARD?i("card-form",{ref:t=>{t&&(this.paymentMethodFormRef=t)},maskCardNumber:this.maskCardNumber}):i("bank-account-form",{ref:t=>{t&&(this.paymentMethodFormRef=t)},showAccountNumberConfirmation:this.showAccountNumberConfirmation})}render(){return i(k,{key:"eff8f53ba9e7935822cb6848422bb0e86d5c762b"},i("form",{key:"a1af6ad70700565a46644a487109cb8be91a2a1e"},i("fieldset",{key:"289038090f6a03feb2467b4da0be0231da4c9d58"},i("div",{key:"fc536a12ac5a2245dc2f458a5cb5eb42a0faa2c9",class:"row gy-3"},i("div",{key:"42f5add1ed97ddca1b7f229f572f94c0f5eb990b",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),i("div",{key:"34c980bab861d09c0bed6666409197a9067610a1",class:"col-12"},i("internal-button",{key:"71800d244d727d42bb50acea662cc1d8ebb37775",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 a(this)}static get watchers(){return{disableCreditCard:["paymentMethodsChanged"],disableBankAccount:["paymentMethodsChanged"]}}};export{it as justifi_apple_pay,st as justifi_button,at as justifi_checkout_summary,rt as justifi_google_pay,lt as justifi_header,ht as justifi_modular_checkout,ft as justifi_paypal,bt as justifi_plaid_payment_method,$ as justifi_radio_list_item,gt as justifi_saved_payment_methods,kt as justifi_sezzle_payment_method,Lt as justifi_tokenize_payment_method}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as n,H as t,c as i,g as o}from"./p-CV0Pyo1O.js";import{al as r,a3 as s,q as a,v as c,w as d,x as u}from"./p-Bu7gdOaV.js";import{c as l}from"./p-DgTOxu8x.js";import{g as f}from"./p-BFTU3MAI.js";import{F as h}from"./p-CLZcevBz.js";import{p as m}from"./p-DhrQechy.js";const w=class{constructor(n){e(this,n)}render(){return this.text?this.hideAlert?null:n("div",{class:"alert alert-danger d-flex align-items-center",role:"alert",part:r},n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",class:"bi bi-exclamation-triangle-fill flex-shrink-0 me-2",viewBox:"0 0 16 16",role:"img","aria-label":"Warning:"},n("path",{d:"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"})),n("div",null,this.text)):null}},g=l({focused:{boxShadow:"",border:""},focusedAndInvalid:{boxShadow:"",border:""},fontStyles:{fontFamily:"",fontSize:"",fontWeight:"",lineHeight:"",margin:"",padding:""}}),{state:b,set:p}=g,v=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();p("fontStyles",e);const n=await this.getFocusedStyles();p("focused",n);const t=await this.getFocusedAndInvalidStyles();p("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();const 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:"09ac1ea8407e3bf2df079f1188a7668e7d7b318e"},n("input",{key:"18b34d0fae7636e7640dd35a73ce9b369007afd5",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 y,k,x={exports:{}},z=f((y||(y=1,k=x,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={},l=null,f=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(){y("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){L(t,e)})).end()}):v("","Unable to bind to jQuery, it is not fully loaded.")),k.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 y(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 z(e){function n(){t("Height"),t("Width"),R((function(){O(W),C(A),f("onResized",W)}),W,"init")}function t(e){var n=Number(u[A]["max"+e]),t=Number(u[A]["min"+e]),i=e.toLowerCase(),o=Number(W[i]);p(A,"Checking "+i+" is in range "+t+"-"+n),o<t&&(o=t,p(A,"Set "+i+" to min value")),o>n&&(o=n,p(A,"Set "+i+" to max value")),W[i]=""+o}function i(e){return L.slice(L.indexOf(":")+7+e)}function o(e,n){var t,i;t=function(){var t,i;N("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=W.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 F(A),{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(W.iframe):{x:0,y:0},t={x:Number(W.width)+n.x,y:Number(W.height)+n.y};p(A,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(a=t,d(),p(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):y(A,"Unable to scroll to requested position, window.parentIFrame not found")}function d(){!1===f("onScroll",a)?T():C(A)}function l(e){var n={};if(0===Number(W.width)&&0===Number(W.height)){var t=i(9).split(":");n={x:t[1],y:t[0]}}else n={x:W.width,y:W.height};f(e,{iframe:W.iframe,screenX:Number(n.x),screenY:Number(n.y),type:W.type})}function f(e,n){return I(A,e,n)}var m,b,k,x,z,S,L=e.data,W={},A=null;"[iFrameResizerChild]Ready"===L?function(){for(var e in u)N("iFrame requested init",E(e),u[e].iframe,e)}():s===(""+L).slice(0,13)&&L.slice(13).split(":")[0]in u?(x=(k=L.slice(13).split(":"))[1]?parseInt(k[1],10):0,z=u[k[0]]&&u[k[0]].iframe,S=getComputedStyle(z),W={iframe:z,id:k[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:k[2],type:k[3]},u[A=W.id]&&(u[A].loaded=!0),(b=W.type in{true:1,false:1,undefined:1})&&p(A,"Ignoring init message from meta parent page"),!b&&function(e){var n=!0;return u[e]||(n=!1,y(W.type+" No settings for "+e+". Message was: "+L)),n}(A)&&(p(A,"Received: "+L),m=!0,null===W.iframe&&(y(A,"IFrame ("+W.id+") not found"),m=!1),m&&function(){var n,t=e.origin,i=u[A]&&u[A].checkOrigin;if(i&&""+t!="null"&&!(i.constructor===Array?function(){var e=0,n=!1;for(p(A,"Checking connection is from allowed list of origins: "+i);e<i.length;e++)if(i[e]===t){n=!0;break}return n}():(p(A,"Checking connection is from: "+(n=u[A]&&u[A].remoteHost)),t===n)))throw new Error("Unexpected message received from: "+t+" for "+W.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[A]&&u[A].firstRun&&u[A]&&(u[A].firstRun=!1),W.type){case"close":M(W.iframe);break;case"message":m=i(6),p(A,"onMessage passed: {iframe: "+W.iframe.id+", message: "+m+"}"),f("onMessage",{iframe:W.iframe,message:JSON.parse(m)}),p(A,"--");break;case"mouseenter":l("onMouseEnter");break;case"mouseleave":l("onMouseLeave");break;case"autoResize":u[A].autoResize=JSON.parse(i(9));break;case"scrollTo":c(!1);break;case"scrollToOffset":c(!0);break;case"pageInfo":o(u[A]&&u[A].iframe,A),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=A;e("Add ",w),u[t]&&(u[t].stopPageInfo=n)}();break;case"pageInfoStop":u[A]&&u[A].stopPageInfo&&(u[A].stopPageInfo(),delete u[A].stopPageInfo);break;case"inPageLink":t=i(9).split("#")[1]||"",s=decodeURIComponent(t),(h=document.getElementById(s)||document.getElementsByName(s)[0])?(e=r(h),p(A,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),a={x:e.x,y:e.y},d(),p(A,"--")):window.top===window.self?p(A,"In page link #"+t+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(t):p(A,"In page link #"+t+" not found and window.parentIFrame not found");break;case"reset":j(W);break;case"init":n(),f("onInit",W.iframe);break;default:0===Number(W.width)&&0===Number(W.height)?y("Unsupported message received ("+W.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(A,"Ignored: "+L)}function I(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 M(e){var t=e.id;if(!1!==I(t,"onClose",t)){p(t,"Removing iFrame: "+t);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){y(e)}I(t,"onClosed",t),p(t,"--"),S(e),n&&(n.disconnect(),n=null)}else p(t,"Close iframe cancelled by onClose event")}function F(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 C(e){null!==a&&(window.scrollTo(a.x,a.y),p(e,"Set page position: "+a.x+","+a.y),T())}function T(){a=null}function j(e){p(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),F(e.id),R((function(){O(e),N("reset","reset",e.iframe,e.id)}),e,"reset")}function O(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"))&&N("Visibility change","resize",u[e].iframe,e)}(e)}))}function n(n){p("window","Mutation observed: "+n[0].target+" "+n[0].type),W(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 R(e,n,t){t!==n.type&&c&&!window.jasmine?(p(n.id,"Requesting animation frame"),c(e)):e()}function N(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)):y(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,y(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 E(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 L(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],y(l,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}var a,c,l=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||f.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);l in u&&"iFrameResizer"in t?y(l,"Ignored iFrame, already setup."):(function(e){var n;e=e||{},u[l]=Object.create(null),u[l].iframe=t,u[l].firstRun=!0,u[l].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 f)Object.prototype.hasOwnProperty.call(f,n)&&(u[l][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:f[n])}(e),u[l]&&(u[l].targetOrigin=!0===u[l].checkOrigin?""===(n=u[l].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*")}(r),function(){switch(p(l,"IFrame scrolling "+(u[l]&&u[l].scrolling?"enabled":"disabled")+" for "+l),t.style.overflow=!1===(u[l]&&u[l].scrolling)?"hidden":"auto",u[l]&&u[l].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=u[l]?u[l].scrolling:"no"}}(),function(){function e(e){var n=u[l][e];1/0!==n&&0!==n&&(t.style[e]="number"==typeof n?n+"px":n,p(l,"Set "+e+" = "+t.style[e]))}function n(e){if(u[l]["min"+e]>u[l]["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[l]&&u[l].bodyMargin)&&"0"!==(u[l]&&u[l].bodyMargin)||(u[l].bodyMarginV1=u[l].bodyMargin,u[l].bodyMargin=u[l].bodyMargin+"px"),a=E(l),(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&&M(t)}))}))}));return n.observe(t.parentNode,{childList:!0}),n}(c)),w(t,"load",(function(){N("iFrame.onload",a,t,e,!0),(!u[l]||!u[l].firstRun)&&u[l]&&u[l].heightCalculationMethod in d&&j({iframe:t,height:0,width:0,type:"init"})})),N("init",a,t,e,!0),u[l]&&(u[l].iframe.iFrameResizer={close:M.bind(null,u[l].iframe),removeListeners:S.bind(null,u[l].iframe),resize:N.bind(null,"Window resize","resize",u[l].iframe),moveToAnchor:function(e){N("Move to anchor","moveToAnchor:"+e,u[l].iframe,l)},sendMessage:function(e){N("Send Message","message:"+(e=JSON.stringify(e)),u[l].iframe,l)}}))}function W(e,n){null===l&&(l=setTimeout((function(){l=null,e()}),n))}function A(){"hidden"!==document.visibilityState&&(p("document","Trigger event: Visibility change"),W((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)&&N(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+">")}(),L(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",z),w(window,"resize",(function(){p("window","Trigger event: resize"),W((function(){P("Window resize","resize")}),16)})),w(document,"visibilitychange",A),w(document,"-webkit-visibilitychange",A),function(i,o){switch(t=[],function(e){e&&e.enablePublicMethods&&y("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}}}()),x.exports));class I{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=>{var o;n.source===this.iframe.contentWindow&&(null===(o=n.data)||void 0===o?void 0:o.eventType)===e&&(window.removeEventListener("message",i),t(n.data.data))};window.addEventListener("message",i),this.postMessage(e,n)}))}}const S=class{constructor(n){e(this,n),this.iframeLoaded=i(this,"iframeLoaded",7),this.isFocused=!1,this.isValid=!0,this.maskCardNumber=!1,this.hasLoaded=!1,this.dispatchMessageEvent=e=>{const{eventType:n,data:t}=e.data;(null==t?void 0:t.id)===this.inputId&&("loaded"===n&&(this.hasLoaded=!0,this.sendMaskCardNumber()),"focused"===n&&(this.isFocused=!0),"blurred"===n&&(this.isFocused=!1))}}maskCardNumberChanged(){this.hasLoaded&&this.sendMaskCardNumber()}componentDidLoad(){const e=document.createElement("iframe");e.setAttribute("name",this.inputId),e.setAttribute("width","100%"),e.style.border="0",e.style.display="block",e.style.width="100%",e.style.boxSizing="border-box",e.addEventListener("load",(()=>{z({log:!1,onResized:()=>{this.iframeLoaded.emit()}},e)})),this.iframeElement=e,this.initializeFrameCommunicationService(),e.setAttribute("src",this.iframeSrc),this.mountIframe()}connectedCallback(){var e;this.iframeElement&&!this.iframeElement.isConnected&&(null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent),this.mountIframe())}mountIframe(){const e=this.el.getRootNode(),n=11===e.nodeType&&e.host?e.host:null,t=this.iframeElement;if(n){if(n.getRootNode()!==document&&console.warn(`[justifi] hosted field "${this.inputId}" is inside a nested shadow tree; window.frames cannot reach it`),!this.wrapperElement.querySelector(`slot[name="${this.inputId}"]`)){const e=document.createElement("slot");e.name=this.inputId,this.wrapperElement.appendChild(e)}t.setAttribute("slot",this.inputId),n.appendChild(t)}else t.removeAttribute("slot"),this.wrapperElement.appendChild(t)}componentDidRender(){this.iframeElement&&this.iframeElement.getAttribute("src")!==this.renderedSrc&&this.iframeElement.setAttribute("src",this.renderedSrc)}disconnectedCallback(){var e,n,t,i,o;this.el.isConnected||(null===(e=this.frameService)||void 0===e||e.removeMessageListener(this.dispatchMessageEvent),null===(i=null===(t=null===(n=this.iframeElement)||void 0===n?void 0:n.iFrameResizer)||void 0===t?void 0:t.removeListeners)||void 0===i||i.call(t),null===(o=this.iframeElement)||void 0===o||o.remove())}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:m.version})}async reload(){this.iframeElement.src=this.iframeSrc}initializeFrameCommunicationService(){var e;this.frameService=new I(this.iframeElement,this.iframeOrigin),null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent)}sendMaskCardNumber(){var e;null===(e=this.frameService)||void 0===e||e.postMessage("setMaskCardNumber",{enabled:!!this.maskCardNumber})}get part(){return this.isFocused&&!this.isValid?s:this.isValid?this.isFocused?c:d:a}get style(){return this.isFocused?this.isValid?b.focused:b.focusedAndInvalid:null}get urlParams(){const e=Object.fromEntries(Object.entries(b.fontStyles).map((([e,n])=>[e,btoa(String(n))])));return new URLSearchParams(e).toString()}get iframeSrc(){const e=this.iframeOrigin.includes("?")?"&":"?";return`${this.iframeOrigin}${e}${this.urlParams}`}render(){return this.renderedSrc=this.iframeSrc,n(t,{key:"4e4844f10dec9ddcb6f3f4ccaa5ffe7f254f1a33",class:"form-group d-flex flex-column"},n("div",{key:"65cf8392e8e5925560a2bfa80fb15209ec14e267",style:{visibility:this.iframeLoaded?"visible":"hidden",height:this.iframeLoaded?"auto":"0"}},n("label",{key:"c33c671e062b2d91a6c7dcdc938faa973a320ac8",class:"form-label",htmlFor:"",part:u},this.label||""),n("div",{key:"dd294ff2efac3747af3ec6baa73fc74aaad8b46b",ref:e=>this.wrapperElement=e,class:"p-0 d-flex form-control "+(this.isValid?"":"is-invalid"),part:this.part,style:Object.assign(Object.assign({},this.style),{overflow:"hidden"})}),n(h,{key:"a6a65814a1ba0fcb2ec4eff7f6b334a134763a8e",errorText:this.errorText,name:this.inputId})))}get el(){return o(this)}static get watchers(){return{maskCardNumber:["maskCardNumberChanged"]}}};export{w as form_alert,v as hidden_input,S 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{al as r,a3 as s,q as a,v as c,w as d,x as u}from"./p-Bu7gdOaV.js";import{c as l}from"./p-DgTOxu8x.js";import{g as f}from"./p-BFTU3MAI.js";import{F as h}from"./p-CLZcevBz.js";import{p as m}from"./p-C04splpj.js";const w=class{constructor(n){e(this,n)}render(){return this.text?this.hideAlert?null:n("div",{class:"alert alert-danger d-flex align-items-center",role:"alert",part:r},n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",class:"bi bi-exclamation-triangle-fill flex-shrink-0 me-2",viewBox:"0 0 16 16",role:"img","aria-label":"Warning:"},n("path",{d:"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"})),n("div",null,this.text)):null}},g=l({focused:{boxShadow:"",border:""},focusedAndInvalid:{boxShadow:"",border:""},fontStyles:{fontFamily:"",fontSize:"",fontWeight:"",lineHeight:"",margin:"",padding:""}}),{state:b,set:p}=g,v=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();p("fontStyles",e);const n=await this.getFocusedStyles();p("focused",n);const t=await this.getFocusedAndInvalidStyles();p("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();const 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:"09ac1ea8407e3bf2df079f1188a7668e7d7b318e"},n("input",{key:"18b34d0fae7636e7640dd35a73ce9b369007afd5",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 y,k,x={exports:{}},z=f((y||(y=1,k=x,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={},l=null,f=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(){y("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){L(t,e)})).end()}):v("","Unable to bind to jQuery, it is not fully loaded.")),k.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 y(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 z(e){function n(){t("Height"),t("Width"),R((function(){O(W),C(A),f("onResized",W)}),W,"init")}function t(e){var n=Number(u[A]["max"+e]),t=Number(u[A]["min"+e]),i=e.toLowerCase(),o=Number(W[i]);p(A,"Checking "+i+" is in range "+t+"-"+n),o<t&&(o=t,p(A,"Set "+i+" to min value")),o>n&&(o=n,p(A,"Set "+i+" to max value")),W[i]=""+o}function i(e){return L.slice(L.indexOf(":")+7+e)}function o(e,n){var t,i;t=function(){var t,i;N("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=W.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 F(A),{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(W.iframe):{x:0,y:0},t={x:Number(W.width)+n.x,y:Number(W.height)+n.y};p(A,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(a=t,d(),p(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):y(A,"Unable to scroll to requested position, window.parentIFrame not found")}function d(){!1===f("onScroll",a)?j():C(A)}function l(e){var n={};if(0===Number(W.width)&&0===Number(W.height)){var t=i(9).split(":");n={x:t[1],y:t[0]}}else n={x:W.width,y:W.height};f(e,{iframe:W.iframe,screenX:Number(n.x),screenY:Number(n.y),type:W.type})}function f(e,n){return I(A,e,n)}var m,b,k,x,z,S,L=e.data,W={},A=null;"[iFrameResizerChild]Ready"===L?function(){for(var e in u)N("iFrame requested init",E(e),u[e].iframe,e)}():s===(""+L).slice(0,13)&&L.slice(13).split(":")[0]in u?(x=(k=L.slice(13).split(":"))[1]?parseInt(k[1],10):0,z=u[k[0]]&&u[k[0]].iframe,S=getComputedStyle(z),W={iframe:z,id:k[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:k[2],type:k[3]},u[A=W.id]&&(u[A].loaded=!0),(b=W.type in{true:1,false:1,undefined:1})&&p(A,"Ignoring init message from meta parent page"),!b&&function(e){var n=!0;return u[e]||(n=!1,y(W.type+" No settings for "+e+". Message was: "+L)),n}(A)&&(p(A,"Received: "+L),m=!0,null===W.iframe&&(y(A,"IFrame ("+W.id+") not found"),m=!1),m&&function(){var n,t=e.origin,i=u[A]&&u[A].checkOrigin;if(i&&""+t!="null"&&!(i.constructor===Array?function(){var e=0,n=!1;for(p(A,"Checking connection is from allowed list of origins: "+i);e<i.length;e++)if(i[e]===t){n=!0;break}return n}():(p(A,"Checking connection is from: "+(n=u[A]&&u[A].remoteHost)),t===n)))throw new Error("Unexpected message received from: "+t+" for "+W.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[A]&&u[A].firstRun&&u[A]&&(u[A].firstRun=!1),W.type){case"close":M(W.iframe);break;case"message":m=i(6),p(A,"onMessage passed: {iframe: "+W.iframe.id+", message: "+m+"}"),f("onMessage",{iframe:W.iframe,message:JSON.parse(m)}),p(A,"--");break;case"mouseenter":l("onMouseEnter");break;case"mouseleave":l("onMouseLeave");break;case"autoResize":u[A].autoResize=JSON.parse(i(9));break;case"scrollTo":c(!1);break;case"scrollToOffset":c(!0);break;case"pageInfo":o(u[A]&&u[A].iframe,A),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=A;e("Add ",w),u[t]&&(u[t].stopPageInfo=n)}();break;case"pageInfoStop":u[A]&&u[A].stopPageInfo&&(u[A].stopPageInfo(),delete u[A].stopPageInfo);break;case"inPageLink":t=i(9).split("#")[1]||"",s=decodeURIComponent(t),(h=document.getElementById(s)||document.getElementsByName(s)[0])?(e=r(h),p(A,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),a={x:e.x,y:e.y},d(),p(A,"--")):window.top===window.self?p(A,"In page link #"+t+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(t):p(A,"In page link #"+t+" not found and window.parentIFrame not found");break;case"reset":T(W);break;case"init":n(),f("onInit",W.iframe);break;default:0===Number(W.width)&&0===Number(W.height)?y("Unsupported message received ("+W.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(A,"Ignored: "+L)}function I(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 M(e){var t=e.id;if(!1!==I(t,"onClose",t)){p(t,"Removing iFrame: "+t);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){y(e)}I(t,"onClosed",t),p(t,"--"),S(e),n&&(n.disconnect(),n=null)}else p(t,"Close iframe cancelled by onClose event")}function F(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 C(e){null!==a&&(window.scrollTo(a.x,a.y),p(e,"Set page position: "+a.x+","+a.y),j())}function j(){a=null}function T(e){p(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),F(e.id),R((function(){O(e),N("reset","reset",e.iframe,e.id)}),e,"reset")}function O(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"))&&N("Visibility change","resize",u[e].iframe,e)}(e)}))}function n(n){p("window","Mutation observed: "+n[0].target+" "+n[0].type),W(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 R(e,n,t){t!==n.type&&c&&!window.jasmine?(p(n.id,"Requesting animation frame"),c(e)):e()}function N(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)):y(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,y(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 E(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 L(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],y(l,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}var a,c,l=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||f.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);l in u&&"iFrameResizer"in t?y(l,"Ignored iFrame, already setup."):(function(e){var n;e=e||{},u[l]=Object.create(null),u[l].iframe=t,u[l].firstRun=!0,u[l].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 f)Object.prototype.hasOwnProperty.call(f,n)&&(u[l][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:f[n])}(e),u[l]&&(u[l].targetOrigin=!0===u[l].checkOrigin?""===(n=u[l].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*")}(r),function(){switch(p(l,"IFrame scrolling "+(u[l]&&u[l].scrolling?"enabled":"disabled")+" for "+l),t.style.overflow=!1===(u[l]&&u[l].scrolling)?"hidden":"auto",u[l]&&u[l].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=u[l]?u[l].scrolling:"no"}}(),function(){function e(e){var n=u[l][e];1/0!==n&&0!==n&&(t.style[e]="number"==typeof n?n+"px":n,p(l,"Set "+e+" = "+t.style[e]))}function n(e){if(u[l]["min"+e]>u[l]["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[l]&&u[l].bodyMargin)&&"0"!==(u[l]&&u[l].bodyMargin)||(u[l].bodyMarginV1=u[l].bodyMargin,u[l].bodyMargin=u[l].bodyMargin+"px"),a=E(l),(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&&M(t)}))}))}));return n.observe(t.parentNode,{childList:!0}),n}(c)),w(t,"load",(function(){N("iFrame.onload",a,t,e,!0),(!u[l]||!u[l].firstRun)&&u[l]&&u[l].heightCalculationMethod in d&&T({iframe:t,height:0,width:0,type:"init"})})),N("init",a,t,e,!0),u[l]&&(u[l].iframe.iFrameResizer={close:M.bind(null,u[l].iframe),removeListeners:S.bind(null,u[l].iframe),resize:N.bind(null,"Window resize","resize",u[l].iframe),moveToAnchor:function(e){N("Move to anchor","moveToAnchor:"+e,u[l].iframe,l)},sendMessage:function(e){N("Send Message","message:"+(e=JSON.stringify(e)),u[l].iframe,l)}}))}function W(e,n){null===l&&(l=setTimeout((function(){l=null,e()}),n))}function A(){"hidden"!==document.visibilityState&&(p("document","Trigger event: Visibility change"),W((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)&&N(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+">")}(),L(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",z),w(window,"resize",(function(){p("window","Trigger event: resize"),W((function(){P("Window resize","resize")}),16)})),w(document,"visibilitychange",A),w(document,"-webkit-visibilitychange",A),function(i,o){switch(t=[],function(e){e&&e.enablePublicMethods&&y("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}}}()),x.exports));class I{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=>{var o;n.source===this.iframe.contentWindow&&(null===(o=n.data)||void 0===o?void 0:o.eventType)===e&&(window.removeEventListener("message",i),t(n.data.data))};window.addEventListener("message",i),this.postMessage(e,n)}))}}const S=class{constructor(n){e(this,n),this.iframeLoaded=i(this,"iframeLoaded",7),this.isFocused=!1,this.isValid=!0,this.maskCardNumber=!1,this.hasLoaded=!1,this.dispatchMessageEvent=e=>{const{eventType:n,data:t}=e.data;(null==t?void 0:t.id)===this.inputId&&("loaded"===n&&(this.hasLoaded=!0,this.sendMaskCardNumber()),"focused"===n&&(this.isFocused=!0),"blurred"===n&&(this.isFocused=!1))}}maskCardNumberChanged(){this.hasLoaded&&this.sendMaskCardNumber()}componentDidLoad(){const e=document.createElement("iframe");e.setAttribute("name",this.inputId),e.setAttribute("width","100%"),e.style.border="0",e.style.display="block",e.style.width="100%",e.style.boxSizing="border-box",e.addEventListener("load",(()=>{z({log:!1,onResized:()=>{this.iframeLoaded.emit()}},e)})),this.iframeElement=e,this.initializeFrameCommunicationService(),e.setAttribute("src",this.iframeSrc),this.mountIframe()}connectedCallback(){var e;this.iframeElement&&!this.iframeElement.isConnected&&(null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent),this.mountIframe())}mountIframe(){const e=this.el.getRootNode(),n=11===e.nodeType&&e.host?e.host:null,t=this.iframeElement;if(n){if(n.getRootNode()!==document&&console.warn(`[justifi] hosted field "${this.inputId}" is inside a nested shadow tree; window.frames cannot reach it`),!this.wrapperElement.querySelector(`slot[name="${this.inputId}"]`)){const e=document.createElement("slot");e.name=this.inputId,this.wrapperElement.appendChild(e)}t.setAttribute("slot",this.inputId),n.appendChild(t)}else t.removeAttribute("slot"),this.wrapperElement.appendChild(t)}componentDidRender(){this.iframeElement&&this.iframeElement.getAttribute("src")!==this.renderedSrc&&this.iframeElement.setAttribute("src",this.renderedSrc)}disconnectedCallback(){var e,n,t,i,o;this.el.isConnected||(null===(e=this.frameService)||void 0===e||e.removeMessageListener(this.dispatchMessageEvent),null===(i=null===(t=null===(n=this.iframeElement)||void 0===n?void 0:n.iFrameResizer)||void 0===t?void 0:t.removeListeners)||void 0===i||i.call(t),null===(o=this.iframeElement)||void 0===o||o.remove())}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:m.version})}async reload(){this.iframeElement.src=this.iframeSrc}initializeFrameCommunicationService(){var e;this.frameService=new I(this.iframeElement,this.iframeOrigin),null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent)}sendMaskCardNumber(){var e;null===(e=this.frameService)||void 0===e||e.postMessage("setMaskCardNumber",{enabled:!!this.maskCardNumber})}get part(){return this.isFocused&&!this.isValid?s:this.isValid?this.isFocused?c:d:a}get style(){return this.isFocused?this.isValid?b.focused:b.focusedAndInvalid:null}get urlParams(){const e=Object.fromEntries(Object.entries(b.fontStyles).map((([e,n])=>[e,btoa(String(n))])));return new URLSearchParams(e).toString()}get iframeSrc(){const e=this.iframeOrigin.includes("?")?"&":"?";return`${this.iframeOrigin}${e}${this.urlParams}`}render(){return this.renderedSrc=this.iframeSrc,n(t,{key:"4e4844f10dec9ddcb6f3f4ccaa5ffe7f254f1a33",class:"form-group d-flex flex-column"},n("div",{key:"65cf8392e8e5925560a2bfa80fb15209ec14e267",style:{visibility:this.iframeLoaded?"visible":"hidden",height:this.iframeLoaded?"auto":"0"}},n("label",{key:"c33c671e062b2d91a6c7dcdc938faa973a320ac8",class:"form-label",htmlFor:"",part:u},this.label||""),n("div",{key:"dd294ff2efac3747af3ec6baa73fc74aaad8b46b",ref:e=>this.wrapperElement=e,class:"p-0 d-flex form-control "+(this.isValid?"":"is-invalid"),part:this.part,style:Object.assign(Object.assign({},this.style),{overflow:"hidden"})}),n(h,{key:"a6a65814a1ba0fcb2ec4eff7f6b334a134763a8e",errorText:this.errorText,name:this.inputId})))}get el(){return o(this)}static get watchers(){return{maskCardNumber:["maskCardNumberChanged"]}}};export{w as form_alert,v as hidden_input,S as iframe_input}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,h as a}from"./p-CV0Pyo1O.js";import{l as t}from"./p-OeJ-3w3l.js";import{f as s,p as d,c as r}from"./p-DUtecvro.js";import{f as l,a as i}from"./p-Bu7gdOaV.js";import{S as o}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import"./p-B4vLfYnZ.js";import{c,a as p}from"./p-Ds_P-dB8.js";import{T as b,f as n}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import"./p-BFTU3MAI.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";const f=class{constructor(a){e(this,a),this.setParamsOnChange=(e,a)=>{s[e]=a},this.handleDateInput=(e,a)=>{const t=c(a,{setExactTime:!0});this.setParamsOnChange(e,t)}}componentWillLoad(){this.debouncedSetParamsOnChange=t.debounce(this.setParamsOnChange,300),Object.entries({order_status:this.orderStatus,order_type:this.orderType,created_after:this.createdAfter,created_before:this.createdBefore,company_name:this.companyName}).forEach((([e,a])=>{a&&(d[e]=a)}))}get terminalOrderStatusOptions(){return[{label:"All",value:""},{label:"Created",value:b.created},{label:"Completed",value:b.completed},{label:"Submitted",value:b.submitted},{label:"In Progress",value:b.in_progress},{label:"On Hold",value:b.on_hold},{label:"Canceled",value:b.canceled}]}get terminalOrderTypeOptions(){return[{label:"All",value:""},{label:"Boarding Only",value:n.boardingOnly},{label:"Boarding Shipping",value:n.boardingShipping}]}render(){const e=Object.assign({},s);return a(o,{key:"2d36ea512a983ddba3ce92c8cc06ccb700d807b6"},a("table-filters-menu",{key:"15f2d1d33656d52ff9cdd8f440c56b2a25373d4f",params:e,clearParams:r,part:l},a("div",{key:"39379df3cde8edf3055427b3673a011acc734fd8",class:"grid-cols-2 gap-3 p-1"},a("div",{key:"c8e83393cb9a5d59099fd287e72bd79716460412",class:"p-2"},a("form-control-select",{key:"7b50b0d9d9acab68a40f0afcd1a42c27763ec30f",name:"order_status",label:"Order Status",options:this.terminalOrderStatusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.orderStatus||s.order_status||"",disabled:!!this.orderStatus,part:i})),a("div",{key:"cd2779df09502b1bc8cdd7dd60beb45110580751",class:"p-2"},a("form-control-select",{key:"17e7ec4668dd921d32deea68b0c9bda28bdb78c8",name:"order_type",label:"Order Type",options:this.terminalOrderTypeOptions,inputHandler:this.setParamsOnChange,defaultValue:this.orderType||s.order_type||"",disabled:!!this.orderType,part:i})),a("div",{key:"73c3471454f58d2e6860ba4dc294da0ca2d3be4b",class:"p-2"},a("form-control-date",{key:"ec16f9cc4de282f0409f41b4670a5efbdb5f1d17",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:p(this.createdAfter,{showInputDateTime:!0})||p(s.created_after,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdAfter,part:i})),a("div",{key:"2487d67a91abed9ed974071c0557b9d4b92d8600",class:"p-2"},a("form-control-date",{key:"f839bc165c4bbaae637237139a8b21c11ab52b31",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:p(this.createdBefore,{showInputDateTime:!0})||p(s.created_before,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdBefore,part:i})),a("div",{key:"081c73c0b1a4f412403ae266c3d8da69775ca4e4",class:"p-2"},a("form-control-text",{key:"927a87c41a09519f85fe95fa1bc202cbe12ecb75",name:"company_name",label:"Company Name",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.companyName||s.company_name,disabled:!!this.companyName,part:i})))))}};export{f as justifi_terminal_orders_list_filters}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,r as e,c as a}from"./p-CV0Pyo1O.js";import{c as s}from"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{l as i,C as r,b as o}from"./p-Dqxyi-uK.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{J as c}from"./p-
|
|
1
|
+
import{h as t,r as e,c as a}from"./p-CV0Pyo1O.js";import{c as s}from"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{l as i,C as r,b as o}from"./p-Dqxyi-uK.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{J as c}from"./p-DON5-wIV.js";import{d}from"./p-BJUSJGPP.js";import{g as p,a as h}from"./p-BhpaUYtS.js";import{P as l}from"./p-B1u-Iegl.js";import{T as f,a as u,b as m,c as b,d as y,e as _,f as w,g,h as T,i as j,j as v,k,l as P}from"./p-DZr0wLGh.js";import{S as D}from"./p-DTnmhThV.js";import{T as C}from"./p-CZfYo5-1.js";import{a as I}from"./p-Ds_P-dB8.js";import{a6 as S,a7 as O}from"./p-Bu7gdOaV.js";import"./p-DgTOxu8x.js";import"./p-C04splpj.js";import"./p-Da0IToMr.js";import"./p-MPer3Rw7.js";const F={id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of each transaction"},"ID"),account_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the account associated with each transaction"},"Account ID"),payout_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the payout associated with each transaction"},"Payout ID"),financial_transaction_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),amount:()=>t("th",{part:S,scope:"col",title:"The dollar amount of each transaction"},"Amount"),fee:()=>t("th",{part:S,scope:"col",title:"The fee associated with each transaction"},"Fee"),net:()=>t("th",{part:S,scope:"col",title:"The net amount of each transaction"},"Net"),currency:()=>t("th",{part:S,scope:"col",title:"The currency of each transaction"},"Currency"),description:()=>t("th",{part:S,scope:"col",title:"The description of each transaction"},"Description"),source_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),txn_type:()=>t("th",{part:S,scope:"col",title:"The type of each transaction"},"Type"),created_at:()=>t("th",{part:S,scope:"col",title:"The date and time each transaction was made"},"Processed On"),available_on:()=>t("th",{part:S,scope:"col",title:"The date and time each transaction will be available"},"Available On"),updated_at:()=>t("th",{part:S,scope:"col",title:"The date and time each transaction was last updated"},"Updated On")},q={fee:"Fee",payment:"Payment",payout:"Payout",seller_payment_refund:"Seller Payment Refund",dispute_amount_collected:"Dispute Amount Collected",dispute_fee_collected:"Dispute Fee Collected",seller_payment:"Seller Payment",transfer:"Transfer",partner_platform_proceeds_credit:"Partner Platform Proceeds Credit",processing_fee:"Processing Fee",refund_processing_fee:"Refund Processing Fee",fee_rounding_adjustment:"Fee Rounding Adjustment",platform_fee:"Platform Fee",processing_fee_return:"Processing Fee Return",platform_fee_return:"Platform Fee Return"},x={id:e=>t("td",{part:O(e.id)},e.id),account_id:e=>t("td",{part:O(e.account_id)},e.account_id),payout_id:e=>t("td",{part:O(e.payout_id)},e.payout_id),financial_transaction_id:e=>t("td",{part:O(e.financial_transaction_id)},e.financial_transaction_id),amount:e=>t("td",{part:O(e.amount)},e.formattedPaymentAmount(e.amount)),fee:e=>t("td",{part:O(e.fee)},e.formattedPaymentAmount(e.fee)),net:e=>t("td",{part:O(e.net)},e.formattedPaymentAmount(e.net)),currency:e=>t("td",{part:O(e.currency)},e.currency),description:e=>t("td",{part:O(e.description)},e.description),source_id:e=>t("td",{part:O(e.source_id)},e.source_id),txn_type:e=>t("td",{part:O(e.txn_type)},q[e.txn_type]),created_at:e=>t("td",{part:O(e.created_at)},t("div",{class:"fw-bold"},I(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},I(e.created_at,{showTime:!0}))),available_on:e=>t("td",{part:O(e.available_on)},t("div",{class:"fw-bold"},I(e.available_on,{showDisplayDate:!0})),t("div",{class:"fw-bold"},I(e.available_on,{showTime:!0}))),updated_at:e=>t("td",{part:O(e.updated_at)},t("div",{class:"fw-bold"},I(e.updated_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},I(e.updated_at,{showTime:!0})))},R=class{constructor(t){e(this,t),this.clickEvent=a(this,"click-event",7),this.errorEvent=a(this,"error-event",7),this.balanceTransactions=[],this.isLoading=!0,this.errorMessage=null,this.paging=n,this.pagingParams={},this.columns="created_at,txn_type,description,amount,fee,net",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:C.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:C.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const a=this.balanceTransactions.find((t=>t.id===e));this.clickEvent.emit({name:C.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,F,x),d(),this.analytics=new c(this),this.initializeApi()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeApi()}handleError(t,e,a){this.isLoading=!1,this.errorEvent.emit({errorCode:t,message:e,severity:a})}initializeApi(){this.payoutId&&this.authToken?(({accountId:t,authToken:e,service:a})=>async({params:s,onSuccess:o,onError:n,final:c})=>{var d;try{const c=await a.fetchPayoutTransactions(t,e,s);c.error?n({error:h(c.error),code:p(null===(d=c.error)||void 0===d?void 0:d.code),severity:r.ERROR}):o({balanceTransactions:c.data.map((t=>new i(t))),pagingInfo:Object.assign({},c.page_info)})}catch(t){const e=p(null==t?void 0:t.code);n({error:h(t),code:e,severity:r.ERROR})}finally{c()}})({accountId:s.accountId,authToken:this.authToken,service:new l})({params:this.requestParams,onSuccess:({balanceTransactions:t,pagingInfo:e})=>{this.balanceTransactions=t,this.paging=e,this.transactionsTable.collectionData=this.balanceTransactions},onError:({error:t,code:e,severity:a})=>{this.errorMessage=t.message,this.handleError(t,e,a)},final:()=>{this.isLoading=!1}}):(this.errorMessage="payout-id and auth-token props are required",this.handleError(o.MISSING_PROPS,this.errorMessage,r.ERROR))}get entityId(){return this.balanceTransactions.map((t=>t.id))}get showEmptyState(){return!this.isLoading&&!this.errorMessage&&this.transactionsTable.rowData.length<1}get showErrorState(){return!this.isLoading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.isLoading}get requestParams(){return Object.assign({payout_id:this.payoutId,limit:"15"},this.pagingParams)}render(){return t(D,{key:"5da092f2d4c07bbe280146ad302a1d475a166246"},t(u,{key:"4700660091131d5360a8c12f9297cee467fc3b64"},t(m,{key:"12019f0f76ced950a053945a9dfc7616a2865bbd"},t(b,{key:"6286a0ecd27b9f2433d0e4dbbe4080ebc4b0088a"},t(y,{key:"625bceb0b96b8cd61af93930d5c02198b2d1ec40"},this.transactionsTable.columnData.map((t=>t)))),t(_,{key:"681a77edec6a9272d83fec9731e7556ea284ee33"},t(w,{key:"54a1981bc9659753716ff0c4541a21bdc4ba2cfa",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(g,{key:"826e1778e976e2ce175786b78f0534ae865104bc",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(T,{key:"8032c6af307b5900bdf60c8a7b14499b476c1dd8",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(j,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(v,{key:"a9ab5fced17a007ae3db7e73217efc8ad754eb7f"},t(k,{key:"b4d7b6644ddd22292071409d75252ce5245c7a27"},t(P,{key:"447d7e0f68f39cc95bba9616eae41f80c62bf806",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"4e20b754e42cd81a334b82bb2435fb5390ce3b87",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],payoutId:["propChanged"],authToken:["propChanged"]}}};export{R as justifi_payout_transactions_list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,r as i,c as r}from"./p-CV0Pyo1O.js";import{S as s}from"./p-eBK-iWrz.js";import{w as e,c as o}from"./p-B4vLfYnZ.js";import{e as a}from"./p-Ds_P-dB8.js";import{d as n}from"./p-
|
|
1
|
+
import{h as t,r as i,c as r}from"./p-CV0Pyo1O.js";import{S as s}from"./p-eBK-iWrz.js";import{w as e,c as o}from"./p-B4vLfYnZ.js";import{e as a}from"./p-Ds_P-dB8.js";import{d as n}from"./p-BJUSJGPP.js";import{c as h}from"./p-FsWkrvEF.js";import{C as l,c,b as d}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{B as m}from"./p-CU2Dwa94.js";import"./p-CZfYo5-1.js";import"./p-Bu7gdOaV.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";import"./p-C04splpj.js";import"./p-DEx8fQeW.js";const u=()=>t("div",{class:"container-fluid p-0"},t("div",{class:"row mb-3"},t("div",{class:"col-12 align-content-end"},t(s,{height:"18px",width:"120px"}),t(s,{height:"36px"}))),t("div",{class:"row"},t("div",{class:"col-12 align-content-end"},t(s,{height:"18px",width:"110px"}),t(s,{height:"36px"})))),p=class{constructor(t){i(this,t),this.errorEvent=r(this,"error-event",7),this.iframeState="loading",this.showAccountNumberConfirmation=!1,this.hasLoggedAchDisabledWarning=!1,this.loadedInputIds=new Set,this.watchedInputIds="",this.reloadIframes=()=>{this.iframeState="loading",this.loadedInputIds.clear(),this.iframeElements.forEach((t=>t.reload())),this.watchIframesLoad()}}async componentWillLoad(){await e(),this.iframeOrigin=o.iframeOrigin,this.tabId=a(),n()}componentDidRender(){if(this.iframeElements.length<this.expectedIframeCount)return;const t=this.iframeElements.map((t=>t.inputId)).join(",");t!==this.watchedInputIds&&(this.watchedInputIds=t,this.watchIframesLoad())}disconnectedCallback(){var t;null===(t=this.loadAbortController)||void 0===t||t.abort()}isAchDisabledForCheckout(){return h.checkoutLoaded&&!h.achPaymentsEnabled}async validate(){if(this.isAchDisabledForCheckout())return{isValid:!1};const t=this.iframeElements;if(t.length<this.expectedIframeCount)return{isValid:!1};const i=[];for(const r of t)i.push(await r.validate());return{isValid:i.every((t=>!0===(null==t?void 0:t.isValid)))}}async tokenize({clientId:t,paymentMethodMetadata:i,account:r}){var s,e;if(this.isAchDisabledForCheckout())return{error:{message:"ACH payments are disabled for this checkout (payment_settings.ach_payments=false)."}};if(this.showAccountNumberConfirmation){const t=await(null===(s=this.accountNumberConfirmationIframeElement)||void 0===s?void 0:s.validate());if(!0!==(null==t?void 0:t.isValid))return{error:{code:"validation_error",message:(null===(e=null==t?void 0:t.error)||void 0===e?void 0:e.message)||"The entered value does not match the account number"}}}return await this.accountNumberIframeElement.tokenize(t,i,r)}get isReady(){return"ready"===this.iframeState}get expectedIframeCount(){return this.showAccountNumberConfirmation?3:2}get iframeElements(){return[this.accountNumberIframeElement,...this.showAccountNumberConfirmation?[this.accountNumberConfirmationIframeElement]:[],this.routingNumberIframeElement].filter(Boolean)}watchIframesLoad(){var t;null===(t=this.loadAbortController)||void 0===t||t.abort();const{signal:i}=this.loadAbortController=new AbortController,r=new Set(this.iframeElements.filter((t=>!this.loadedInputIds.has(t.inputId))).map((t=>t.inputId))),s=Promise.all(this.iframeElements.map((t=>new Promise((s=>{this.loadedInputIds.has(t.inputId)?s():t.addEventListener("iframeLoaded",(()=>{this.loadedInputIds.add(t.inputId),r.delete(t.inputId),s()}),{once:!0,signal:i})}))))),e=new Promise(((t,s)=>{const e=window.setTimeout((()=>s(new Error(`Iframes failed to load: ${Array.from(r).join(", ")}`))),1e4);i.addEventListener("abort",(()=>{window.clearTimeout(e),s(new Error("iframe load watch aborted"))}),{once:!0})}));Promise.race([s,e]).then((()=>{var t;i.aborted||(this.iframeState="ready",null===(t=this.loadAbortController)||void 0===t||t.abort())})).catch((t=>{var s;i.aborted||(this.iframeState="error",null===(s=this.loadAbortController)||void 0===s||s.abort(),r.has("accountNumberConfirmation")&&console.error('[bank-account-form] "Confirm Account Number" field failed to load.'),this.errorEvent.emit({errorCode:d.IFRAME_LOAD_ERROR,message:c.IFRAME_LOAD_ERROR,severity:l.ERROR,data:{errorMessage:t.message}}))}))}renderIframeError(){return t("div",null,t("form-alert",{text:c.IFRAME_LOAD_ERROR,hideAlert:!1}),t(m,{variant:"link",clickHandler:this.reloadIframes,"aria-label":"Reload bank account form",type:"button"},"Try again"))}render(){return this.isAchDisabledForCheckout()?(this.hasLoggedAchDisabledWarning||(console.warn("[bank-account-form] ACH payments are disabled for this checkout (payment_settings.ach_payments=false)."),this.hasLoggedAchDisabledWarning=!0),null):t("div",null,"loading"===this.iframeState&&t(u,null),"error"===this.iframeState&&this.renderIframeError(),t("hidden-input",null),t("div",{class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},t("div",{class:"row mb-3"},t("iframe-input",{inputId:"accountNumber",ref:t=>this.accountNumberIframeElement=t,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber?tabId=${this.tabId}`})),this.showAccountNumberConfirmation&&t("div",{class:"row mb-3"},t("iframe-input",{inputId:"accountNumberConfirmation",ref:t=>this.accountNumberConfirmationIframeElement=t,label:"Confirm Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumberConfirmation?tabId=${this.tabId}`})),t("div",{class:"row"},t("iframe-input",{inputId:"routingNumber",ref:t=>this.routingNumberIframeElement=t,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber?tabId=${this.tabId}`}))))}};export{p as bank_account_form}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as s,F as t,r as e,c as i}from"./p-CV0Pyo1O.js";import{E as r}from"./p-Bh6Q8AqQ.js";import{B as a}from"./p-DgKsNl4p.js";import{m as o}from"./p-BDtSw_d-.js";import{C as n,b as l}from"./p-Dqxyi-uK.js";import{J as h}from"./p-DON5-wIV.js";import{d as p}from"./p-BJUSJGPP.js";import{S as d}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import{S as c}from"./p-eBK-iWrz.js";import"./p-Bu7gdOaV.js";import"./p-Da0IToMr.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-Ds_P-dB8.js";import"./p-HXpYMWUU.js";import"./p-C04splpj.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import"./p-BhpaUYtS.js";const u=()=>{const e=()=>s("div",{class:"mt-5"},s(c,{width:"40%",height:"1.5rem"}),s("hr",null),s("div",{class:"row g-3"},s("div",{class:"col-12 col-md-6"},s(c,null),s(c,null),s(c,null)),s("div",{class:"col-12 col-md-6"},s(c,null),s(c,null),s(c,null))));return s(t,null,s(e,null),s(e,null),s(e,null),s(e,null))},m=class{constructor(s){e(this,s),this.errorEvent=i(this,"error-event",7),this.loading=!0}componentWillLoad(){p(),this.analytics=new h(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetBusiness()}initializeGetBusiness(){this.businessId&&this.authToken?(this.getBusiness=o({id:this.businessId,authToken:this.authToken,service:new a}),this.fetchData()):(this.errorMessage="Invalid business id or auth token",this.errorEvent.emit({errorCode:l.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}updateOnPropChange(){this.getBusiness&&this.fetchData()}fetchData(){this.loading=!0,this.getBusiness({onSuccess:({business:s})=>{this.business=s,this.errorMessage=null},onError:({error:s,code:t,severity:e})=>{this.errorMessage=s,this.errorEvent.emit({errorCode:t,message:s,severity:e})},final:()=>{this.loading=!1}})}render(){return s(d,{key:"5591589ce180d7102dc3403143556c1302af3fe5"},this.loading&&s(u,{key:"c45c978e7b9b1a2e086558be669be4f9c9962965"}),!this.loading&&this.errorMessage&&r(this.errorMessage),!this.loading&&!this.errorMessage&&this.business&&s("justifi-details",{key:"cbb51e9f2f7ab55573349cb2106949a5ca91833d",errorMessage:this.errorMessage},s("div",{key:"c85ae2fd98b56566795383c3a799b9b93853a786",slot:"detail-sections"},s("core-info-details",{key:"2a582bf825f75176e680882f05d287b1791a411b",business:this.business}),s("legal-address-details",{key:"3855cc37f98885547c425e7b21f3f153604ca8ee",legalAddress:this.business.legal_address}),s("representative-details",{key:"16b323711a50310012ce46f8d83d2ab8f64e1461",representative:this.business.representative}),s("owner-details",{key:"fd3609e46477071432a5fa276b84df00d5717f2c",owners:this.business.owners}),s("additional-questions-details",{key:"b42b0499a259c3e73c91278a5515e2dcf00c3f5f",additionalQuestions:this.business.additional_questions}))))}static get watchers(){return{businessId:["propChanged"],authToken:["propChanged"],getBusiness:["updateOnPropChange"]}}};export{m as justifi_business_details}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{m as a,C as i,b as o}from"./p-Dqxyi-uK.js";import{p as c}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{g as r,a as h}from"./p-BhpaUYtS.js";import{d as n}from"./p-
|
|
1
|
+
import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{m as a,C as i,b as o}from"./p-Dqxyi-uK.js";import{p as c}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{g as r,a as h}from"./p-BhpaUYtS.js";import{d as n}from"./p-BJUSJGPP.js";import{J as d}from"./p-DON5-wIV.js";import{C as p}from"./p-DWjkuM6f.js";import{m as u,S as m}from"./p-B8UcvRjv.js";import{S as f}from"./p-DTnmhThV.js";import{T as l,a as b,b as y,c as k,d as g,e as j,f as v,g as C,h as _,i as w,j as T,k as S,l as P}from"./p-DZr0wLGh.js";import{T as D}from"./p-CZfYo5-1.js";import{d as O,b as A}from"./p-Ds_P-dB8.js";import{B as x,a as I}from"./p-Dz8KJn2G.js";import{a6 as B,a7 as E}from"./p-Bu7gdOaV.js";import{o as G,g as M}from"./p-CArdj6i_.js";import"./p-DgTOxu8x.js";import"./p-C04splpj.js";import"./p-Da0IToMr.js";import"./p-MPer3Rw7.js";const L={created_at:()=>t("th",{part:B,scope:"col",title:"The date each checkout occurred"},"Processed On"),payment_amount:()=>t("th",{part:B,scope:"col",title:"The dollar amount of each checkout"},"Payment Amount"),payment_description:()=>t("th",{part:B,scope:"col",title:"The description of each checkout"},"Payment Description"),sub_account_name:()=>t("th",{part:B,scope:"col",title:"The sub account associated with the checkout"},"Sub Account"),payment_mode:()=>t("th",{part:B,scope:"col",title:"The payment mode of each checkout"},"Payment Mode"),status:()=>t("th",{part:B,scope:"col",title:"The current status of each checkout"},"Status")},U={created_at:(e,s)=>t("td",{part:E(s)},t("div",{class:"fw-bold"},A(e.created_at)),t("div",{class:"fw-bold"},O(e.created_at))),payment_amount:(e,s)=>t("td",{part:E(s)},e.formattedPaymentAmount(e.payment_amount)),payment_description:(e,s)=>t("td",{part:E(s)},e.payment_description),sub_account_name:(e,s)=>t("td",{part:E(s)},e.sub_account_name),payment_mode:(e,s)=>t("td",{part:E(s)},e.payment_mode),status:(e,s)=>t("td",{part:E(s)},t(I,Object.assign({},{created:{variant:x.PRIMARY,title:"The checkout has been created",text:"Created"},completed:{variant:x.SUCCESS,title:"The checkout has been completed",text:"Completed"},attempted:{variant:x.SECONDARY,title:"The checkout has been attempted",text:"Attempted"},expired:{variant:x.DANGER,title:"The checkout has expired",text:"Expired"}}[e.status])))},V=class{constructor(t){e(this,t),this.clickEvent=s(this,"click-event",7),this.errorEvent=s(this,"error-event",7),this.columns="created_at,payment_amount,payment_description,payment_mode,status",this.checkouts=[],this.subAccounts=[],this.loading=!0,this.paging=c,this.pagingParams={},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 s=this.checkouts.find((t=>t.id===e));this.clickEvent.emit({name:D.row,data:s})}}componentWillLoad(){n(),this.analytics=new d(this),this.checkoutsTable=new l(this.checkouts,this.columns,L,U),this.initializeGetData(),this.getCheckouts&&this.fetchData(),G("set",(()=>{this.pagingParams={}})),G("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}authPropChanged(){this.initializeGetData(),this.getCheckouts&&this.fetchData()}pagingOrColumnsChanged(){this.getCheckouts&&this.fetchData()}initializeGetData(){this.initializeGetCheckouts(),this.initializeGetSubAccounts()}initializeGetCheckouts(){const t=this.subAccountId||this.accountId;t&&this.authToken?this.getCheckouts=(({accountId:t,authToken:e,service:s})=>async({params:o,onSuccess:c,onError:n})=>{var d,p;try{const u=await s.fetchCheckouts(t,e,o);if(u.error)return n({error:h(u.error),code:r(null===(p=u.error)||void 0===p?void 0:p.code),severity:i.ERROR});{const t=Object.assign({},u.page_info);c({checkouts:(null===(d=u.data)||void 0===d?void 0:d.map((t=>new a(t))))||[],pagingInfo:t})}}catch(t){const e=r(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:i.ERROR})}})({accountId:t,authToken:this.authToken,service:new p}):(this.errorMessage="Account ID/Sub Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=u({primaryAccountId:this.accountId,authToken:this.authToken,service:new m}))}fetchData(){this.getCheckouts&&(this.loading=!0,this.getCheckouts({params:this.checkoutParams,onSuccess:async({checkouts:t,pagingInfo:e})=>{this.checkouts=t,this.paging=e,this.checkoutsTable.collectionData=this.checkouts,this.checkoutsTable.columnKeys.includes("sub_account_name")?await this.fetchSubAccounts():this.loading=!1},onError:({error:t,code:e,severity:s})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:s}),this.loading=!1}}))}async fetchSubAccounts(){this.getSubAccounts?this.getSubAccounts({params:this.subAccountParams,onSuccess:({subAccounts:t})=>{this.subAccounts=t,this.checkouts=this.checkouts.map((t=>{var e;return t.sub_account_name=null===(e=this.subAccounts.find((e=>e.id===t.account_id)))||void 0===e?void 0:e.name,t})),this.loading=!1},onError:({error:t,code:e,severity:s})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:s}),this.loading=!1}}):this.loading=!1}get checkoutParams(){const t=M();return Object.assign(Object.assign({},t),this.pagingParams)}get subAccountParams(){const t=this.checkouts.map((t=>t.account_id));return{sub_account_id:[...new Set(t)].join(",")}}get entityId(){return this.checkouts.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.checkoutsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(f,{key:"5c72630838781f32e31d44510c9793ef71d863cd"},t(b,{key:"01c4456bfc252a55de1351bd54500ab6f9d22d2e"},t(y,{key:"2a69c5b2d27caf1a648efed450e8eadf583e3858"},t(k,{key:"f524af14960a68a035eb75cfa7d2c6255d0e0de3"},t(g,{key:"2cbf9ac9228aa770da72e9d3d618e61094bb65b6"},this.checkoutsTable.columnData.map((t=>t)))),t(j,{key:"2c246fa63dd49ff4bf4a29a25717d4191a904443"},t(v,{key:"83fcebd9b8775ec50b614925ad2c153d6ac1888a",columnSpan:this.checkoutsTable.columnKeys.length,isLoading:this.loading}),t(C,{key:"a37d1f0001e1c5f793eda759f82e58e42be49321",isEmpty:this.showEmptyState,columnSpan:this.checkoutsTable.columnKeys.length}),t(_,{key:"57cb26d7929f007ae9e14faf63b29b06b3097828",columnSpan:this.checkoutsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.checkoutsTable.rowData.map(((e,s)=>t(w,{"data-test-id":"table-row","data-row-entity-id":this.entityId[s],onClick:this.rowClickHandler},e)))),this.paging&&t(T,{key:"edd82eb558b69329970c93f207f840cca8de2884"},t(S,{key:"deed2dee3d311b76888003cbeffd00c5397cc6c8"},t(P,{key:"b9845ccc21e916ccef0c3f3dba37e1187c80769d",colSpan:this.checkoutsTable.columnData.length},t("pagination-menu",{key:"7af1644ff5e5cb8a2ca68705f481f5991c7a09b2",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["authPropChanged"],authToken:["authPropChanged"],subAccountId:["authPropChanged"],pagingParams:["pagingOrColumnsChanged"],columns:["pagingOrColumnsChanged"]}}};export{V as justifi_checkouts_list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t,r as e,c as a}from"./p-CV0Pyo1O.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{j as s,C as i,b as r}from"./p-Dqxyi-uK.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{J as o}from"./p-
|
|
1
|
+
import{h as t,r as e,c as a}from"./p-CV0Pyo1O.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{j as s,C as i,b as r}from"./p-Dqxyi-uK.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{J as o}from"./p-DON5-wIV.js";import{d as c}from"./p-BJUSJGPP.js";import{g as p,a as h}from"./p-BhpaUYtS.js";import{P as d}from"./p-CZuwNeL1.js";import{T as f,a as l,b as u,c as m,d as y,e as b,f as _,g,h as T,i as j,j as w,k,l as v}from"./p-DZr0wLGh.js";import{S as C}from"./p-DTnmhThV.js";import{T as D}from"./p-CZfYo5-1.js";import{a as P}from"./p-Ds_P-dB8.js";import{a6 as S,a7 as F}from"./p-Bu7gdOaV.js";import"./p-DgTOxu8x.js";import"./p-C04splpj.js";import"./p-Da0IToMr.js";import"./p-MPer3Rw7.js";const R={created_at:()=>t("th",{part:S,scope:"col",title:"The date and time each transaction was made"},"Processed On"),type:()=>t("th",{part:S,scope:"col",title:"The type of each transaction"},"Type"),id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of each transaction"},"ID"),amount:()=>t("th",{part:S,scope:"col",title:"The dollar amount of each transaction",class:"text-end"},"Amount"),balance:()=>t("th",{part:S,scope:"col",title:"The running total amount of this payment that belongs to you",class:"text-end"},"Balance"),currency:()=>t("th",{part:S,scope:"col",title:"The currency of each transaction"},"Currency"),financial_transaction_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),payment_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the payment associated with the payment balance transaction"},"Payment ID"),payment_balance_txn_type:()=>t("th",{part:S,scope:"col",title:"The type of the payment balance transaction"},"Transaction Type"),source_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),source_type:()=>t("th",{part:S,scope:"col",title:"The type of the source object associated with the payment balance transaction"},"Source Type")},x={ach_return:"ACH Return",ach_return_fee:"ACH Return Fee",dispute:"Dispute",dispute_fee:"Dispute Fee",dispute_fee_refund:"Dispute Fee Refund",dispute_refund:"Dispute Refund",payment:"Payment",payment_fee:"Fee",platform_fee:"Platform Fee",platform_fee_return:"Platform Fee Return",processing_fee:"Processing Fee",processing_fee_return:"Processing Fee Return",refund:"Refund",fee_refund:"Fee Refund",application_fee_returned:"Application Fee Returned",refund_failure:"Refund Failure",void:"Void"},I={created_at:(e,a)=>t("td",{part:F(a)},t("div",{class:"fw-bold"},P(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(e.created_at,{showTime:!0}))),type:(e,a)=>t("td",{part:F(a)},x[e.payment_balance_txn_type]),id:(e,a)=>t("td",{part:F(a)},e.id),amount:(e,a)=>t("td",{part:F(a),class:"text-end"},e.formattedPaymentAmount(e.amount)),balance:(e,a)=>t("td",{part:F(a),class:"text-end"},e.formattedPaymentAmount(e.balance)),currency:(e,a)=>t("td",{part:F(a)},e.currency),financial_transaction_id:(e,a)=>t("td",{part:F(a)},e.financial_transaction_id),payment_id:(e,a)=>t("td",{part:F(a)},e.payment_id),payment_balance_txn_type:(e,a)=>t("td",{part:F(a)},e.payment_balance_txn_type),source_id:(e,a)=>t("td",{part:F(a)},e.source_id),source_type:(e,a)=>t("td",{part:F(a)},e.source_type)},O=class{constructor(t){e(this,t),this.clickEvent=a(this,"click-event",7),this.errorEvent=a(this,"error-event",7),this.balanceTransactions=[],this.isLoading=!0,this.errorMessage=null,this.paging=n,this.pagingParams={},this.columns="created_at,type,id,amount,balance",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.balanceTransactions.find((t=>t.id===e));this.clickEvent.emit({name:D.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,R,I),c(),this.analytics=new o(this),this.initializeApi()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeApi()}handleError(t,e,a){this.isLoading=!1,this.errorEvent.emit({errorCode:t,message:e,severity:a})}initializeApi(){this.paymentId&&this.authToken?(({id:t,authToken:e,service:a})=>async({params:r,onSuccess:n,onError:o,final:c})=>{var d;try{const c=await a.fetchPaymentTransactions(t,e,r);c.error?o({error:h(c.error),code:p(null===(d=c.error)||void 0===d?void 0:d.code),severity:i.ERROR}):n({balanceTransactions:c.data.map((t=>new s(t))),pagingInfo:Object.assign({},c.page_info)})}catch(t){const e=p(null==t?void 0:t.code);o({error:h(t),code:e,severity:i.ERROR})}finally{c()}})({id:this.paymentId,authToken:this.authToken,service:new d})({params:this.pagingParams,onSuccess:({balanceTransactions:t,pagingInfo:e})=>{this.balanceTransactions=t,this.paging=e,this.transactionsTable.collectionData=this.balanceTransactions},onError:({error:t,code:e,severity:a})=>{this.errorMessage=t.message,this.handleError(t,e,a)},final:()=>{this.isLoading=!1}}):(this.errorMessage="payment-id and auth-token props are required",this.handleError(r.MISSING_PROPS,this.errorMessage,i.ERROR))}get entityId(){return this.balanceTransactions.map((t=>t.id))}get showEmptyState(){return!this.isLoading&&!this.errorMessage&&this.transactionsTable.rowData.length<1}get showErrorState(){return!this.isLoading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.isLoading}render(){return t(C,{key:"5b7246beab86213a69da2f95aa1d25d4bb39c1a2"},t(l,{key:"f0f04475575f66615e8a69b4c3ed436508addfb0"},t(u,{key:"5b358517f6677994141931fbc90fb44503f1aadc"},t(m,{key:"1bcfcf413f0e1eb24da52c31efab1835277396fa"},t(y,{key:"48f3636ebf63e5cf409d297c35038ba83a64c194"},this.transactionsTable.columnData.map((t=>t)))),t(b,{key:"f1d55ead127da95ac35dac0f9a912b6bb2fe7034"},t(_,{key:"1efd7987420496bf74f625f9d12869d86af6290a",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(g,{key:"7c78906045a09c1b013e76039f1190e8e83e7342",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(T,{key:"f5010997153999907df316b16ebf6d21b7a319ae",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(j,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(w,{key:"eef37030a45c507b694a6b700c6a2e6f09205cfd"},t(k,{key:"ee793228ac9748780f55378857a2d60801b4a464"},t(v,{key:"aa8eab64af598e5d7e9d0d775a942451a95d7d52",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"84427ea168495ecfdc6661d384d7172b920346e3",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],paymentId:["propChanged"],authToken:["propChanged"]}}};export{O as justifi_payment_transactions_list}
|