@justifi/webcomponents 6.0.0-rc.7 → 6.0.0-rc.8
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/{check-pkg-version-CO2TpemN.js → check-pkg-version-BJaFyEGj.js} +1 -1
- package/dist/cjs/checkout.store-MSwLBCby.js +71 -0
- package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
- package/dist/cjs/justifi-apple-pay.cjs.entry.js +1 -1
- package/dist/cjs/justifi-bank-account-billing-form-simple_9.cjs.entry.js +3 -3
- package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-form.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkout-summary_7.cjs.entry.js +39 -66
- package/dist/cjs/justifi-checkout.cjs.entry.js +3 -3
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +2 -2
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +2 -2
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +3 -3
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{package-k4ZKuvRG.js → package-DqvfEWsE.js} +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/tokenize-payment-method/tokenize-payment-method.js +3 -1
- package/dist/collection/store/checkout.store.js +2 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{check-pkg-version-ggwQhM0h.js → check-pkg-version-ucd96eu6.js} +1 -1
- package/dist/{module/ModularCheckout.js → esm/checkout.store-UMe84fjY.js} +39 -1
- package/dist/esm/hidden-input_2.entry.js +1 -1
- package/dist/esm/justifi-apple-pay.entry.js +1 -1
- package/dist/esm/justifi-bank-account-billing-form-simple_9.entry.js +3 -3
- package/dist/esm/justifi-business-details.entry.js +2 -2
- package/dist/esm/justifi-business-form.entry.js +2 -2
- package/dist/esm/justifi-checkout-summary_7.entry.js +6 -33
- package/dist/esm/justifi-checkout.entry.js +3 -3
- package/dist/esm/justifi-checkouts-list.entry.js +2 -2
- package/dist/esm/justifi-dispute-management.entry.js +2 -2
- package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
- package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
- package/dist/esm/justifi-order-terminals.entry.js +2 -2
- package/dist/esm/justifi-payment-details.entry.js +2 -2
- package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
- package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payments-list.entry.js +2 -2
- package/dist/esm/justifi-payout-details.entry.js +2 -2
- package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payouts-list.entry.js +2 -2
- package/dist/esm/justifi-refund-payment.entry.js +2 -2
- package/dist/esm/justifi-season-interruption-insurance.entry.js +3 -3
- package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
- package/dist/esm/justifi-terminals-list.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{package-VsM6ERNV.js → package-D51QuD44.js} +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/module/checkout.store.js +31 -2
- package/dist/module/modular-checkout.js +1 -2
- package/dist/module/package.js +1 -1
- package/dist/module/plaid-payment-method.js +1 -2
- package/dist/module/saved-payment-methods.js +1 -2
- package/dist/module/sezzle-payment-method.js +1 -2
- package/dist/module/tokenize-payment-method.js +4 -3
- package/dist/types/store/checkout.store.d.ts +1 -1
- package/dist/webcomponents/{p-b4e5470a.entry.js → p-00a845e5.entry.js} +1 -1
- package/dist/webcomponents/{p-c7f61bcb.entry.js → p-053c183b.entry.js} +1 -1
- package/dist/webcomponents/p-0f42c89d.entry.js +1 -0
- package/dist/webcomponents/{p-4723f35b.entry.js → p-1288fda5.entry.js} +1 -1
- package/dist/webcomponents/{p-3c6fa232.entry.js → p-17896a6d.entry.js} +1 -1
- package/dist/webcomponents/{p-0eba50d0.entry.js → p-2a3c59d4.entry.js} +1 -1
- package/dist/webcomponents/{p-eae6bfe7.entry.js → p-2b5da0dc.entry.js} +1 -1
- package/dist/webcomponents/p-724e57e1.entry.js +1 -0
- package/dist/webcomponents/{p-22ac6133.entry.js → p-72f3bbfc.entry.js} +1 -1
- package/dist/webcomponents/{p-3caa786e.entry.js → p-84d2025d.entry.js} +1 -1
- package/dist/webcomponents/{p-4d9fe160.entry.js → p-851a418e.entry.js} +1 -1
- package/dist/webcomponents/{p-d53004c8.entry.js → p-8d891445.entry.js} +1 -1
- package/dist/webcomponents/{p-0ea1e5e6.entry.js → p-9b0f0f53.entry.js} +1 -1
- package/dist/webcomponents/p-C6c6Q0E7.js +1 -0
- package/dist/webcomponents/p-D51QuD44.js +1 -0
- package/dist/webcomponents/{p-884fce8b.entry.js → p-a0cc3d92.entry.js} +1 -1
- package/dist/webcomponents/{p-6d610c1e.entry.js → p-bcb1d661.entry.js} +1 -1
- package/dist/webcomponents/{p-0490c0f4.entry.js → p-c65bcc0c.entry.js} +1 -1
- package/dist/webcomponents/{p-b2bbf609.entry.js → p-d17e2531.entry.js} +1 -1
- package/dist/webcomponents/{p-dd81b598.entry.js → p-d277cc68.entry.js} +1 -1
- package/dist/webcomponents/p-ed7dfcf3.entry.js +1 -0
- package/dist/webcomponents/{p-08270def.entry.js → p-ef353e3d.entry.js} +1 -1
- package/dist/webcomponents/{p-82a15155.entry.js → p-f04c79f2.entry.js} +1 -1
- package/dist/webcomponents/p-fa1aba4e.entry.js +1 -0
- package/dist/webcomponents/{p-7890f311.entry.js → p-fb16d889.entry.js} +1 -1
- package/dist/webcomponents/{p-CxqAv6yr.js → p-tkZEz3MG.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/checkout.store-Ctwy9ahZ.js +0 -42
- package/dist/esm/checkout.store-sQSQqMAD.js +0 -39
- package/dist/webcomponents/p-071208e4.entry.js +0 -1
- package/dist/webcomponents/p-1f55a465.entry.js +0 -1
- package/dist/webcomponents/p-4150309d.entry.js +0 -1
- package/dist/webcomponents/p-728c60b4.entry.js +0 -1
- package/dist/webcomponents/p-DAED83Ew.js +0 -1
- package/dist/webcomponents/p-VsM6ERNV.js +0 -1
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-B32W0A3m.js');
|
|
4
|
-
|
|
5
|
-
const initialState = {
|
|
6
|
-
accountId: '',
|
|
7
|
-
authToken: '',
|
|
8
|
-
billingFormFields: {
|
|
9
|
-
address_postal_code: '',
|
|
10
|
-
},
|
|
11
|
-
bnplEnabled: false,
|
|
12
|
-
insuranceEnabled: false,
|
|
13
|
-
bnplProviderApiVersion: '',
|
|
14
|
-
bnplProviderCheckoutUrl: '',
|
|
15
|
-
bnplProviderClientId: '',
|
|
16
|
-
bnplProviderMode: '',
|
|
17
|
-
checkoutId: '',
|
|
18
|
-
bankAccountVerification: undefined,
|
|
19
|
-
disableBankAccount: false,
|
|
20
|
-
disableBnpl: false,
|
|
21
|
-
disableCreditCard: false,
|
|
22
|
-
disablePaymentMethodGroup: false,
|
|
23
|
-
paymentAmount: 0,
|
|
24
|
-
paymentCurrency: 'USD',
|
|
25
|
-
paymentDescription: '',
|
|
26
|
-
paymentMethodGroupId: undefined,
|
|
27
|
-
paymentMethods: [],
|
|
28
|
-
paymentToken: undefined,
|
|
29
|
-
savePaymentMethod: false,
|
|
30
|
-
selectedPaymentMethod: undefined,
|
|
31
|
-
totalAmount: 0,
|
|
32
|
-
};
|
|
33
|
-
const { state: checkoutStore, onChange } = index.createStore(initialState);
|
|
34
|
-
Object.keys(initialState).forEach((key) => {
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
onChange(key, (newValue) => {
|
|
37
|
-
checkoutStore[key] = newValue;
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
exports.checkoutStore = checkoutStore;
|
|
42
|
-
exports.onChange = onChange;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { c as createStore } from './index-B_KxSZIF.js';
|
|
2
|
-
|
|
3
|
-
const initialState = {
|
|
4
|
-
accountId: '',
|
|
5
|
-
authToken: '',
|
|
6
|
-
billingFormFields: {
|
|
7
|
-
address_postal_code: '',
|
|
8
|
-
},
|
|
9
|
-
bnplEnabled: false,
|
|
10
|
-
insuranceEnabled: false,
|
|
11
|
-
bnplProviderApiVersion: '',
|
|
12
|
-
bnplProviderCheckoutUrl: '',
|
|
13
|
-
bnplProviderClientId: '',
|
|
14
|
-
bnplProviderMode: '',
|
|
15
|
-
checkoutId: '',
|
|
16
|
-
bankAccountVerification: undefined,
|
|
17
|
-
disableBankAccount: false,
|
|
18
|
-
disableBnpl: false,
|
|
19
|
-
disableCreditCard: false,
|
|
20
|
-
disablePaymentMethodGroup: false,
|
|
21
|
-
paymentAmount: 0,
|
|
22
|
-
paymentCurrency: 'USD',
|
|
23
|
-
paymentDescription: '',
|
|
24
|
-
paymentMethodGroupId: undefined,
|
|
25
|
-
paymentMethods: [],
|
|
26
|
-
paymentToken: undefined,
|
|
27
|
-
savePaymentMethod: false,
|
|
28
|
-
selectedPaymentMethod: undefined,
|
|
29
|
-
totalAmount: 0,
|
|
30
|
-
};
|
|
31
|
-
const { state: checkoutStore, onChange } = createStore(initialState);
|
|
32
|
-
Object.keys(initialState).forEach((key) => {
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
onChange(key, (newValue) => {
|
|
35
|
-
checkoutStore[key] = newValue;
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export { checkoutStore as c, onChange as o };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as i,r as s,c as t}from"./p-Bn7inNWG.js";import{al as e,ai as r,ae as o,z as l}from"./p-RvUQ__Pq.js";import{S as d}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{c as n,J as a}from"./p-CxqAv6yr.js";import{C as h,a as c}from"./p-Cjcsf8ku.js";import{B as v}from"./p-0mMX1Zv4.js";import{B as u}from"./p-BlJnA265.js";import{m as p}from"./p-DH8F0bsw.js";import{S as m}from"./p-CaAVuW6B.js";import"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{i as f,h as w,b as x}from"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BH0Xfn-F.js";import{g as b,a as j}from"./p-D2muobcE.js";import{T as y}from"./p-Bu1jU017.js";import{j as g}from"./p-zdIeCUeh.js";import"./p-VsM6ERNV.js";import"./p-BPtcGAzB.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-CpaS1Lex.js";const C=()=>i("div",{class:"row gap-3"},i("div",{class:"col-12"},i(m,{width:"25%"})),i("div",{class:"col-12"},i(m,{width:"100%"})),i("div",{class:"col-12 d-flex gap-3"},i(m,{width:"50%"}),i(m,{width:"50%"})),i("div",{class:"col-12 d-flex gap-3"},i(m,{width:"65%"}),i(m,{width:"35%"}))),B=()=>i("div",{class:"row gap-5"},i("div",{class:"col-12"},i(m,{width:"40%",height:"40px"})),i(C,null)),S=()=>i("div",{class:"terminal-selector-skeleton mt-4 rounded shadow-sm"},i("div",{class:"d-flex align-items-center gap-3"},i(m,{width:"125px",height:"125px",styles:{borderRadius:"8px"}}),i("div",{class:"flex-grow-1"},i("div",{class:"d-flex row flex-row"},i("div",{class:"col-6 flex-column"},i(m,null),i(m,{width:"60%"})),i("div",{class:"d-flex justify-content-end align-items-center gap-2 col-6"},i(m,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}),i(m,{width:"80px",height:"32px"}),i(m,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}))),i("div",{class:"mt-4"},i("div",{class:"d-flex flex-column gap-2"},i(m,null),i(m,null)))))),k=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event"),this.submitted=t(this,"submit-event"),this.shipping=!1,this.submitButtonText="Submit Order",this.loading={business:!0,terminals:!0},this.submitting=!1,this.error=null,this.totalQuantity=0}componentWillLoad(){this.order=new w({business_id:this.businessId,sub_account_id:this.accountId,order_type:this.shipping?x.boardingShipping:x.boardingOnly}),n(),this.analytics=new a(this),this.loadData()}disconnectedCallback(){var i;null===(i=this.analytics)||void 0===i||i.cleanup()}handleError(i,s,t){this.error={message:i,code:s,severity:t},this.errorEvent.emit({errorCode:s,message:i,severity:t})}loadData(){this.businessId&&this.authToken?(this.initializeGetBusiness(),this.initializeGetTerminalModels()):this.handleError("Invalid business id or auth token",c.MISSING_PROPS,h.ERROR)}initializeGetBusiness(){p({id:this.businessId,authToken:this.authToken,service:new v})({onSuccess:({business:i})=>{this.business=new u(i),this.loading.business=!1},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t),this.loading.business=!1}})}initializeGetTerminalModels(){(({id:i,authToken:s,service:t})=>async({onSuccess:e,onError:r})=>{var o,l,d,n;try{const a=await t.fetchTerminalModels(i,s);if(a.error)return r({error:j(a.error),code:b(null===(n=a.error)||void 0===n?void 0:n.code),severity:h.ERROR});e({terminals:(null===(l=null===(o=a.data)||void 0===o?void 0:o.terminal_order_models)||void 0===l?void 0:l.map((i=>new f(i))))||[],orderLimit:null===(d=a.data)||void 0===d?void 0:d.order_limit})}catch(i){const s=b(null==i?void 0:i.code);return r({error:i.message||i,code:s,severity:h.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new y})({onSuccess:({terminals:i,orderLimit:s})=>{this.terminalModels=i,this.orderLimit=s,this.loading.terminals=!1},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t),this.loading.terminals=!1}})}submitOrder(){const i=(({authToken:i,service:s,apiOrigin:t="https://wc-proxy.justifi.ai"})=>async({terminalOrder:e,onSuccess:r,onError:o})=>{var l;try{const d=await s.orderTerminals(i,e,t);if(d.error)return o({error:j(d.error),code:b(null===(l=d.error)||void 0===l?void 0:l.code),severity:h.ERROR});{const{data:i}=d;r({data:i})}}catch(i){const s=b(null==i?void 0:i.code);return o({error:i.message||i,code:s,severity:h.ERROR})}})({authToken:this.authToken,service:new y});this.submitting=!0,i({terminalOrder:this.order.payload,onSuccess:({data:i})=>{this.submitted.emit(i),this.submitting=!1},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t),this.submitting=!1}})}onSelectedQuantityChange(i){this.order.updateTerminal(i.detail.modelName,i.detail.quantity),this.totalQuantity=this.order.totalQuantity}renderLoading(){return i("div",null,this.loading.business&&i(B,null),this.loading.terminals&&i("div",{class:"mt-5"},i(S,null),i(S,null),i(S,null)))}renderBusinessDetails(){var s,t,o,l,d,n,a,h;if(!this.loading.business&&this.business)return i("div",{class:"d-flex flex-column gap-4 mb-5 pt-5"},i("div",{class:"row"},i("div",{class:"col-12"},i("h2",{part:r},this.business.legal_name))),i("div",{class:"row"},i("div",{class:"col-6"},i("h5",{part:e},"Representative:"),i("div",null,i("div",null,null===(t=null===(s=this.business)||void 0===s?void 0:s.representative)||void 0===t?void 0:t.name),i("div",null,null===(l=null===(o=this.business)||void 0===o?void 0:o.representative)||void 0===l?void 0:l.title),i("div",null,null===(n=null===(d=this.business)||void 0===d?void 0:d.representative)||void 0===n?void 0:n.email),i("div",null,g(null===(h=null===(a=this.business)||void 0===a?void 0:a.representative)||void 0===h?void 0:h.phone)))),i("div",{class:"col-6"},i("h5",{part:e},this.shipping?"Shipping Address:":"Business Address:"),i("div",null,this.business.legal_address.line1,this.business.legal_address.line2?`, ${this.business.legal_address.line2}`:"",i("br",null),this.business.legal_address.city,", ",this.business.legal_address.state," ",this.business.legal_address.postal_code))))}renderTerminals(){if(!this.loading.terminals&&this.terminalModels)return i("div",{class:"d-flex flex-column gap-2 mt-5"},this.terminalModels.map((s=>i("terminal-quantity-selector",{modelName:s.model_name,description:s.description,imageUrl:s.image_url,helpUrl:s.help_url,limit:this.orderLimit-this.order.totalQuantity,onSelectedQuantityChange:this.onSelectedQuantityChange.bind(this)}))))}renderOrderSection(){return i("div",{class:"mt-3"},i("div",{class:"text-end"},"Order limit: ",this.orderLimit),i("div",{class:"d-flex justify-content-end mt-3"},i("button",{class:"btn btn-primary submit-btn",onClick:this.submitOrder.bind(this),disabled:0===this.order.totalQuantity||this.submitting,part:o},this.submitting?"Submitting...":this.submitButtonText)))}render(){return i(d,{key:"e4db746dd7e5e4fcd2836957a91bf1a4d85b875c"},i("div",{key:"08e8950e36bf787a2747b33da377be1f60c6d40a",part:l},this.renderLoading(),this.renderBusinessDetails(),this.renderTerminals(),this.renderOrderSection()))}};export{k as justifi_order_terminals}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as t,r as e,c as a}from"./p-Bn7inNWG.js";import{c as i}from"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{C as s,a as o}from"./p-Cjcsf8ku.js";import{g as r}from"./p-BP7op0vq.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{c,J as p}from"./p-CxqAv6yr.js";import{g as d,a as h}from"./p-D2muobcE.js";import{P as l}from"./p-BEPUC3Po.js";import{T as f,l as u,a as m,b,c as y,d as _,e as w,f as j,g as v,h as T,i as g,j as C,k}from"./p-CB0mCq1M.js";import{S as D}from"./p-DxqCFDtF.js";import{T as P}from"./p-CZfYo5-1.js";import{a as I}from"./p-zdIeCUeh.js";import{N as S,O as q}from"./p-RvUQ__Pq.js";import"./p-CpaS1Lex.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-VsM6ERNV.js";import"./p-BPtcGAzB.js";import"./p-BbZwa5UI.js";const B={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")},E={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"},x={id:e=>t("td",{part:q(e.id)},e.id),account_id:e=>t("td",{part:q(e.account_id)},e.account_id),payout_id:e=>t("td",{part:q(e.payout_id)},e.payout_id),financial_transaction_id:e=>t("td",{part:q(e.financial_transaction_id)},e.financial_transaction_id),amount:e=>t("td",{part:q(e.amount)},e.formattedPaymentAmount(e.amount)),fee:e=>t("td",{part:q(e.fee)},e.formattedPaymentAmount(e.fee)),net:e=>t("td",{part:q(e.net)},e.formattedPaymentAmount(e.net)),currency:e=>t("td",{part:q(e.currency)},e.currency),description:e=>t("td",{part:q(e.description)},e.description),source_id:e=>t("td",{part:q(e.source_id)},e.source_id),txn_type:e=>t("td",{part:q(e.txn_type)},E[e.txn_type]),created_at:e=>t("td",{part:q(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:q(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:q(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})))},A=class{constructor(t){e(this,t),this.clickEvent=a(this,"click-event"),this.errorEvent=a(this,"error-event"),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:P.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:P.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const a=this.balanceTransactions.find((t=>t.id===e));this.clickEvent.emit({name:P.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,B,x),c(),this.analytics=new p(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:i,onSuccess:o,onError:n,final:c})=>{var p;try{const c=await a.fetchPayoutTransactions(t,e,i);c.error?n({error:h(c.error),code:d(null===(p=c.error)||void 0===p?void 0:p.code),severity:s.ERROR}):o({balanceTransactions:c.data.map((t=>new r(t))),pagingInfo:Object.assign({},c.page_info)})}catch(t){const e=d(null==t?void 0:t.code);n({error:h(t),code:e,severity:s.ERROR})}finally{c()}})({accountId:i.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,s.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:"0627b879f2139685ebdbb879d6e13ef99a466654"},t(u,{key:"33fa60d6acc25540e81465500c454f69a2e132ad"},t(m,{key:"5bce0713f04022cbfad1c7e053e60a6a340a37e2"},t(b,{key:"226dda187d5002c9bd48c64d9396ae3736dbbeb2"},t(y,{key:"d7726ab935ce064696fb017b10829120f2e8717f"},this.transactionsTable.columnData.map((t=>t)))),t(_,{key:"a6d46402bd1ba1f4bd820b0badd74d038b82e9ba"},t(w,{key:"5958446a6844c2134d8ae8608b1222a5ade9dc88",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(j,{key:"f64911e09fa1d587dbbdf755ae7b9aabc4b31448",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(v,{key:"8c1422f9ab251ad648396bf42e6751a50a8a9810",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(T,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(g,{key:"4538b7850a81a7c17cf4a7b39248d1c29552c9ee"},t(C,{key:"bf332e1eef41f832aff8fb3d84de891c6fc44cb4"},t(k,{key:"823e4ce33a986a57aa29f41ec3f09987d8a03a22",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"37aa4a533e9ebdf8df92660b6ebbb1f8dba96eea",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],payoutId:["propChanged"],authToken:["propChanged"]}}};export{A as justifi_payout_transactions_list}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as s,r as t,c as i}from"./p-Bn7inNWG.js";import{A as e}from"./p-BPtcGAzB.js";import{C as r,a as o}from"./p-Cjcsf8ku.js";import"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as a,a as n}from"./p-D2muobcE.js";import{c,J as l}from"./p-CxqAv6yr.js";import{c as h}from"./p-DAED83Ew.js";import{p as d,f as p,r as u,h as v}from"./p-zdIeCUeh.js";import{v as m,i as y,a as f,H as j}from"./p-B71k50jz.js";import{z as _,A as g}from"./p-RvUQ__Pq.js";import{S as C}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{S as k}from"./p-CaAVuW6B.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-VsM6ERNV.js";import"./p-HXpYMWUU.js";const w=e();class b{async fetchQuote(s,t){return w.post({endpoint:"insurance/quotes",body:t,authToken:s})}async toggleCoverage(s,t,i){return w.post({endpoint:`insurance/quotes/${t}/toggle`,body:i,authToken:s})}}const q=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(k,{width:"35%",height:"30px"})),s("div",{class:"col-12"},s(k,{width:"70%"})),s("div",{class:"col-12"},s(k,{width:"40%"})),s("div",{class:"col-12"},s(k,{width:"40%"})),s("div",{class:"col-12"},s(k,{width:"100%"})),s("div",{class:"col-12"},s(k,{width:"80%"}))),T=class{constructor(s){t(this,s),this.insuranceUpdated=i(this,"insurance-updated"),this.errorEvent=i(this,"error-event"),this.isLoading=!0}async validate(){return m()}processHTMLContent(s){return d(s,[s=>u(s,"style"),s=>v(s,"a","part",_),s=>v(s,"p","part",_)])}componentWillLoad(){c(),this.analytics=new l(this),this.initializeServiceMethods(),this.getQuote&&this.fetchData()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeServiceMethods(){const s=this.authToken||h.authToken;if(!s)return void this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:"Missing authToken",severity:r.ERROR});const t={authToken:s,service:new b};this.getQuote=(({authToken:s,service:t})=>async({payload:i,onSuccess:e,onError:o})=>{var c;try{const l=await t.fetchQuote(s,i);if(l.error)return o({error:n(l.error),code:a(null===(c=l.error)||void 0===c?void 0:c.code),severity:r.ERROR});e({quote:l.data})}catch(s){const t=a(null==s?void 0:s.code);return o({error:s.message||s,code:t,severity:r.ERROR})}})(t),this.toggleCoverage=(({authToken:s,service:t})=>async({quoteId:i,payload:e,onSuccess:o,onError:c})=>{var l;try{const h=await t.toggleCoverage(s,i,e);if(h.error)return c({error:n(h.error),code:a(null===(l=h.error)||void 0===l?void 0:l.code),severity:r.ERROR});o({quote:h.data})}catch(s){const t=a(null==s?void 0:s.code);return c({error:s.message||s,code:t,severity:r.ERROR})}})(t)}fetchData(){this.isLoading=!0,this.getQuote({payload:{checkout_id:this.checkoutId||h.checkoutId,policy_type:"season_interruption",primary_identity:{state:this.primaryIdentityState,email:this.primaryIdentityEmailAddress,first_name:this.primaryIdentityFirstName,last_name:this.primaryIdentityLastName,postal_code:this.primaryIdentityPostalCode,country:this.primaryIdentityCountry},policy_attributes:{insurable_amount:this.policyAttributesInsurableAmount,start_date:this.policyAttributesStartDate,end_date:this.policyAttributesEndDate,covered_identity:{first_name:this.coveredIdentityFirstName,last_name:this.coveredIdentityLastName}}},onSuccess:({quote:s})=>{this.quote=s,this.quote.product.description=this.processHTMLContent(this.quote.product.description),this.quote.product.legal_disclaimer=this.processHTMLContent(this.quote.product.legal_disclaimer),y[s.policy_type]=s.accepted,this.isLoading=!1},onError:({error:s,code:t,severity:i})=>{this.isLoading=!1,this.errorEvent.emit({errorCode:t,message:s,severity:i})}})}onChangeHandler(s,t){this.accepted=t,f[this.quote.policy_type]=!1,this.toggleCoverage({quoteId:this.quote.id,payload:{accepted:this.accepted},onSuccess:()=>{this.insuranceUpdated.emit(),y[this.quote.policy_type]=this.accepted},onError:({error:s,code:t,severity:i})=>{this.errorEvent.emit({errorCode:t,message:s,severity:i})}})}get error(){var s;return f[null===(s=this.quote)||void 0===s?void 0:s.policy_type]}render(){var t,i,e,r;return h&&!1===h.insuranceEnabled?(console.warn("[justifi-season-interruption-insurance] Insurance is disabled for this checkout (payment_settings.insurance_payments=false)."),null):s(C,null,this.isLoading?s(q,null):s("div",null,s(j,{text:null===(t=this.quote)||void 0===t?void 0:t.product.title,class:"fs-5 fw-bold pb-3"}),s("small",{part:_,innerHTML:null===(i=this.quote)||void 0===i?void 0:i.product.description}),s("form-control-radio",{label:`Accept coverage for ${p(null===(e=this.quote)||void 0===e?void 0:e.total_cents)}`,name:"opt-in",value:"true",checked:"true"===this.accepted,inputHandler:this.onChangeHandler.bind(this),errorText:this.error?" ":void 0}),s("form-control-radio",{label:"Decline coverage",name:"opt-in",value:"false",checked:"false"===this.accepted,inputHandler:this.onChangeHandler.bind(this),errorText:this.error?" ":void 0}),s("div",{class:"invalid-feedback",style:{display:this.error?"block":"none"},part:g},"Please select an option"),s("small",{part:_,innerHTML:null===(r=this.quote)||void 0===r?void 0:r.product.legal_disclaimer})))}};export{T as justifi_season_interruption_insurance}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,c as i,H as s,g as a}from"./p-Bn7inNWG.js";import{z as n,r as o}from"./p-RvUQ__Pq.js";import{f as r}from"./p-zdIeCUeh.js";import{c as h,o as l}from"./p-DAED83Ew.js";import{S as c}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{H as d}from"./p-DIDloHpm.js";import{H as u,b as y,h as m,i as p}from"./p-B71k50jz.js";import{H as M}from"./p-BSt6p1oq.js";import{J as v,c as g}from"./p-CxqAv6yr.js";import"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{C as f,a as k,b as j}from"./p-Cjcsf8ku.js";import{I as b}from"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as T,a as N}from"./p-D2muobcE.js";import{C as w}from"./p-B8iBcmNu.js";import{A as D}from"./p-BPtcGAzB.js";import{C as I}from"./p-ZpPDShvP.js";import"./p-CpaS1Lex.js";import"./p-VsM6ERNV.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const C=class{constructor(e){t(this,e)}render(){return e(c,{key:"db0b903a05629cd6197bb14336fd91881373cbf1"},e("section",{key:"2e1213c4be75677a98fdf98de077201ebff1d3a6"},e("div",{key:"26c3bfc8672511dd5af823426e69b6c0d28dd274"},e("div",{key:"8c9a282d63903b66cf3f93e316bd56f245b9bc1f",part:n},null==h?void 0:h.paymentDescription),e("div",{key:"0729b8adef6ae7bb7a536ad4b5443ed24608ce56"},e("span",{key:"863ee5dc8a0c662a8074a69d388081ec9fc3fb89",part:n},"Total")," ",e("span",{key:"05bf10634b2a166c6b5720beaf0ab76accb8befe",part:n},r(+(null==h?void 0:h.totalAmount)))))))}},A=class{constructor(e){t(this,e),this.levels={h1:d,h2:u,h3:M},this.level="h1"}render(){return e(c,{key:"002dfd5dd8fa47304d9e468e28bdbeb56723913b"},e(this.levels[this.level],{key:"63110d45f87268510cc309d8081f191ef8d4cd8b",text:this.text,class:this.class}))}};var E,x,P;!function(t){t.ECOM="ecom",t.BNPL="bnpl",t.APPLE_PAY="apple_pay"}(E||(E={})),function(t){t.CARD="card",t.BANK_ACCOUNT="bank_account",t.APPLE_PAY="apple_pay",t.GOOGLE_PAY="google_pay",t.SEZZLE="sezzle",t.PLAID="plaid"}(x||(x={})),function(t){t.SAVED_CARD="saved_card",t.NEW_CARD="new_card",t.SAVED_BANK_ACCOUNT="saved_bank_account",t.NEW_BANK_ACCOUNT="new_bank_account",t.APPLE_PAY="apple_pay",t.GOOGLE_PAY="google_pay",t.SEZZLE="sezzle",t.PLAID="plaid"}(P||(P={}));const z=class{constructor(e){t(this,e),this.errorEvent=i(this,"error-event"),this.submitEvent=i(this,"submit-event"),this.paymentMethodChangedEvent=i(this,"payment-method-changed"),this.savePaymentMethod=!1,this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:a}=t.detail;e&&i?(h.paymentToken=s,h.selectedPaymentMethod=P.APPLE_PAY,this.submitCheckout()):(console.error("Apple Pay completed but failed:",a),this.errorEvent.emit({message:(null==a?void 0:a.message)||"Apple Pay payment failed",errorCode:k.TOKENIZE_ERROR,severity:f.ERROR}))},this.handleApplePayError=t=>{const{error:e}=t.detail;console.error("Apple Pay error:",e),this.errorEvent.emit({message:e||"Apple Pay error occurred",errorCode:k.TOKENIZE_ERROR,severity:f.ERROR})},this.handleApplePayCancelled=()=>{h.paymentToken=void 0,h.selectedPaymentMethod=void 0}}savePaymentMethodChanged(t){h.savePaymentMethod=t}connectedCallback(){this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),h.checkoutId=this.checkoutId;const t={authToken:this.authToken,checkoutId:this.checkoutId,service:new w};this.getCheckout=(({authToken:t,checkoutId:e,service:i})=>async({onSuccess:s,onError:a})=>{var n;try{const o=await i.fetchCheckout(t,e);if(o.error)return a({error:N(o.error),code:T(null===(n=o.error)||void 0===n?void 0:n.code),severity:f.ERROR});s({checkout:o.data})}catch(t){const e=T(null==t?void 0:t.code);return a({error:t.message||t,code:e,severity:f.ERROR})}})(t),this.completeCheckout=(({authToken:t,checkoutId:e,service:i})=>async({payment:s,onSuccess:a,onError:n})=>{var o;try{const r=await i.complete(t,e,s);if(r.error)return n({error:N(r.error),code:T(null===(o=r.error)||void 0===o?void 0:o.code),severity:f.ERROR});a({checkout:r.data})}catch(t){const e=T(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:f.ERROR})}})(t),l("selectedPaymentMethod",(t=>{this.paymentMethodChangedEvent.emit(t)}))}componentWillLoad(){this.analytics=new v(this),g(),h.authToken=this.authToken,h.savePaymentMethod=this.savePaymentMethod,this.fetchCheckout(),y("set",(t=>{const e=p[t];void 0!==e&&m(t,e)&&this.fetchCheckout()}))}componentDidLoad(){this.queryFormRefs(),this.setupApplePayListeners()}disconnectedCallback(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this.removeApplePayListeners()}fetchCheckout(){this.authToken&&this.checkoutId?this.getCheckout&&this.getCheckout({onSuccess:({checkout:t})=>{t.status!==b.completed?t.status!==b.expired?this.updateStore(t):this.errorEvent.emit({message:j.CHECKOUT_EXPIRED,errorCode:k.CHECKOUT_EXPIRED,severity:f.ERROR}):this.errorEvent.emit({message:j.CHECKOUT_ALREADY_COMPLETED,errorCode:k.CHECKOUT_ALREADY_COMPLETED,severity:f.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:k.FETCH_ERROR,severity:f.ERROR})}}):this.errorEvent.emit({message:j.NOT_AUTHENTICATED,errorCode:k.NOT_AUTHENTICATED,severity:f.ERROR})}updateStore(t){var e,i,s,a,n;h.accountId=t.account_id,h.paymentMethods=t.payment_methods,h.paymentMethodGroupId=t.payment_method_group_id,h.paymentDescription=t.payment_description,h.totalAmount=t.total_amount,h.paymentAmount=t.payment_amount,h.bnplEnabled=t.payment_settings.bnpl_payments,h.insuranceEnabled=t.payment_settings.insurance_payments,h.bankAccountVerification=null===(e=t.payment_settings)||void 0===e?void 0:e.bank_account_verification,h.bnplProviderClientId=null===(i=null==t?void 0:t.bnpl)||void 0===i?void 0:i.provider_client_id,h.bnplProviderMode=null===(s=null==t?void 0:t.bnpl)||void 0===s?void 0:s.provider_mode,h.bnplProviderApiVersion=null===(a=null==t?void 0:t.bnpl)||void 0===a?void 0:a.provider_api_version,h.bnplProviderCheckoutUrl=null===(n=null==t?void 0:t.bnpl)||void 0===n?void 0:n.provider_checkout_url}queryFormRefs(){this.billingFormRef=this.hostEl.querySelector("justifi-billing-form, justifi-bank-account-billing-form-simple, justifi-card-billing-form-simple, justifi-billing-form-full"),this.applePayRef=this.hostEl.querySelector("justifi-apple-pay"),this.paymentMethodFormRef=this.hostEl.querySelector("justifi-card-form, justifi-bank-account-form, justifi-tokenize-payment-method"),this.insuranceFormRef=this.hostEl.querySelector("justifi-season-interruption-insurance")}setupApplePayListeners(){this.applePayRef&&(this.applePayRef.addEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.addEventListener("applePayError",this.handleApplePayError),this.applePayRef.addEventListener("applePayCancelled",this.handleApplePayCancelled))}removeApplePayListeners(){this.applePayRef&&(this.applePayRef.removeEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.removeEventListener("applePayError",this.handleApplePayError),this.applePayRef.removeEventListener("applePayCancelled",this.handleApplePayCancelled))}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:h.accountId,payment_method_group_id:void 0},n);h.savePaymentMethod&&(o.payment_method_group_id=h.paymentMethodGroupId);const r=await(null===(s=this.paymentMethodFormRef)||void 0===s?void 0:s.tokenize({clientId:this.authToken,paymentMethodMetadata:o,account:h.accountId}));return r.error?r:(h.paymentToken=r.id,r.id)}async validate(){const t=[];if(h.insuranceEnabled&&this.insuranceFormRef&&t.push(this.insuranceFormRef.validate()),h.selectedPaymentMethod!==P.NEW_CARD&&h.selectedPaymentMethod!==P.NEW_BANK_ACCOUNT||(this.paymentMethodFormRef&&t.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&t.push(this.billingFormRef.validate())),0===t.length)return!0;try{return!!(await Promise.all(t)).every((t=>"boolean"==typeof t?t:!1!==(null==t?void 0:t.isValid)))||(this.errorEvent.emit({message:"Validation error",errorCode:k.VALIDATION_ERROR,severity:f.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){const e=await this.validate();if(h.selectedPaymentMethod===P.NEW_CARD||h.selectedPaymentMethod===P.NEW_BANK_ACCOUNT){const e=await this.tokenizePaymentMethod(t);if(e.error)return void this.errorEvent.emit({message:e.error.message,errorCode:k.TOKENIZE_ERROR,severity:f.ERROR})}if(!e)return void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:k.VALIDATION_ERROR,severity:f.ERROR});let i;h.paymentToken||this.errorEvent.emit({message:"Payment token not found.",errorCode:k.TOKENIZE_ERROR,severity:f.ERROR}),i={payment_mode:{[P.NEW_CARD]:E.ECOM,[P.NEW_BANK_ACCOUNT]:E.ECOM,[P.SAVED_BANK_ACCOUNT]:E.ECOM,[P.SAVED_CARD]:E.ECOM,[P.SEZZLE]:E.BNPL,[P.PLAID]:E.ECOM,[P.APPLE_PAY]:E.APPLE_PAY}[h.selectedPaymentMethod],payment_token:h.paymentToken},this.completeCheckout({payment:i,onSuccess:({checkout:t})=>{this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:k.COMPLETE_CHECKOUT_ERROR,severity:f.ERROR})}})}render(){return e(s,{key:"7c698fd98c705a66564b649d3488239ca51c6165"})}get hostEl(){return a(this)}static get watchers(){return{savePaymentMethod:["savePaymentMethodChanged"]}}},L=D();class O{async getLinkToken(t,e,i,s){return L.post({endpoint:`plaid/${e}/link`,body:{checkout_id:i},authToken:t,signal:s})}async tokenizeBankAccount(t,e,i,s,a,n){const o=`plaid/${e}/tokenize`,r={public_token:i};return s&&(r.link_token_id=s),a&&(r.payment_method_group_id=a),L.post({endpoint:o,body:r,authToken:t,signal:n})}}var _;!function(t){t.PLAID_SDK_LOAD_FAILED="plaid-sdk-load-failed",t.PLAID_LINK_INIT_FAILED="plaid-link-init-failed",t.PLAID_LINK_TOKEN_FAILED="plaid-link-token-failed",t.PLAID_AUTHENTICATION_FAILED="plaid-authentication-failed",t.PLAID_BANK_NOT_SUPPORTED="plaid-bank-not-supported",t.PLAID_TOKEN_EXPIRED="plaid-token-expired",t.PLAID_NETWORK_ERROR="plaid-network-error",t.PLAID_USER_CANCELLED="plaid-user-cancelled",t.PLAID_TIMEOUT="plaid-timeout",t.PLAID_INVALID_CREDENTIALS="plaid-invalid-credentials",t.PLAID_ACCOUNT_LOCKED="plaid-account-locked",t.PLAID_MAINTENANCE="plaid-maintenance",t.PLAID_RATE_LIMITED="plaid-rate-limited"}(_||(_={}));const S={[_.PLAID_SDK_LOAD_FAILED]:"Unable to load Plaid. Please refresh the page and try again.",[_.PLAID_LINK_INIT_FAILED]:"Unable to initialize bank connection. Please try again.",[_.PLAID_LINK_TOKEN_FAILED]:"Unable to connect to bank service. Please try again.",[_.PLAID_AUTHENTICATION_FAILED]:"Bank authentication failed. Please try again.",[_.PLAID_BANK_NOT_SUPPORTED]:"Your bank is not currently supported. Please try a different payment method.",[_.PLAID_TOKEN_EXPIRED]:"Your bank session has expired. Please reconnect your account.",[_.PLAID_NETWORK_ERROR]:"Network connection issue. Please check your internet connection and try again.",[_.PLAID_USER_CANCELLED]:"Bank connection was cancelled. Click to try again.",[_.PLAID_TIMEOUT]:"Bank connection timed out. Please try again.",[_.PLAID_INVALID_CREDENTIALS]:"Invalid bank credentials. Please check your username and password.",[_.PLAID_ACCOUNT_LOCKED]:"Your bank account is temporarily locked. Please contact your bank.",[_.PLAID_MAINTENANCE]:"Bank service is temporarily unavailable. Please try again later.",[_.PLAID_RATE_LIMITED]:"Too many connection attempts. Please wait a moment and try again."},R={[_.PLAID_SDK_LOAD_FAILED]:f.ERROR,[_.PLAID_LINK_INIT_FAILED]:f.ERROR,[_.PLAID_LINK_TOKEN_FAILED]:f.ERROR,[_.PLAID_AUTHENTICATION_FAILED]:f.ERROR,[_.PLAID_BANK_NOT_SUPPORTED]:f.WARNING,[_.PLAID_TOKEN_EXPIRED]:f.WARNING,[_.PLAID_NETWORK_ERROR]:f.WARNING,[_.PLAID_USER_CANCELLED]:f.INFO,[_.PLAID_TIMEOUT]:f.WARNING,[_.PLAID_INVALID_CREDENTIALS]:f.ERROR,[_.PLAID_ACCOUNT_LOCKED]:f.ERROR,[_.PLAID_MAINTENANCE]:f.WARNING,[_.PLAID_RATE_LIMITED]:f.WARNING},U=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=i(this,"paymentMethodOptionSelected"),this.plaidError=i(this,"plaidError"),this.plaidErrorRecovered=i(this,"plaidErrorRecovered"),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.plaidService=new O,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{h.authToken&&h.accountId&&h.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.onPaymentMethodOptionClick=t=>{if(t.preventDefault(),this.isSelected=!0,h.selectedPaymentMethod=P.PLAID,this.paymentMethodOptionSelected.emit(P.PLAID),this.error)return this.clearError(),void this.waitForStoreAndInitialize();!this.plaidLink||this.publicToken||this.isAuthenticating||this.openPlaidLink()},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:_.PLAID_SDK_LOAD_FAILED,message:S[_.PLAID_SDK_LOAD_FAILED],severity:R[_.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:_.PLAID_LINK_TOKEN_FAILED,message:S[_.PLAID_LINK_TOKEN_FAILED],severity:R[_.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:_.PLAID_LINK_INIT_FAILED,message:S[_.PLAID_LINK_INIT_FAILED],severity:R[_.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,s,a;try{if(!h.authToken||!h.accountId)return void this.handleError({code:_.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:f.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(h.authToken,h.accountId,h.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}catch(t){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let n=_.PLAID_LINK_TOKEN_FAILED,o=S[n],r=!0;"AbortError"===t.name?(n=_.PLAID_TIMEOUT,o=S[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=_.PLAID_NETWORK_ERROR,o=S[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=_.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:n,message:o,severity:R[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 _.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return _.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return _.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return _.PLAID_RATE_LIMITED;case"maintenance":return _.PLAID_MAINTENANCE;case"not_authenticated":return _.PLAID_INVALID_CREDENTIALS;default:return _.PLAID_LINK_TOKEN_FAILED}return _.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,h.selectedPaymentMethod=P.PLAID),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:f.INFO}),this.exchangePublicTokenForPaymentMethod()},this.exchangePublicTokenForPaymentMethod=async()=>{var t;if(this.publicToken)if(h.authToken&&h.accountId)try{const e=await this.plaidService.tokenizeBankAccount(h.authToken,h.accountId,this.publicToken,this.linkTokenId||void 0,h.savePaymentMethod?h.paymentMethodGroupId:void 0);if(null==e?void 0:e.error)return void console.error("[PlaidPaymentMethod] exchange: backend error",e.error);const i=null==e?void 0:e.data,s=(null===(t=null==i?void 0:i.bank_account)||void 0===t?void 0:t.token)||(null==i?void 0:i.token)||(null==i?void 0:i.id);if(!s)return void console.error("[PlaidPaymentMethod] exchange: no token in response");h.paymentToken=s}catch(t){console.error("[PlaidPaymentMethod] exchange: exception",{message:(null==t?void 0:t.message)||String(t)})}else console.error("[PlaidPaymentMethod] exchange: missing auth/account context");else console.error("[PlaidPaymentMethod] exchange: missing publicToken")},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=_.PLAID_AUTHENTICATION_FAILED,i=S[e],s=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=_.PLAID_INVALID_CREDENTIALS,i=S[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=_.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=_.PLAID_ACCOUNT_LOCKED,i=S[e],s=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=_.PLAID_MAINTENANCE,i=S[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=_.PLAID_RATE_LIMITED,i=S[e],s=!0;break;case"INVALID_REQUEST":e=_.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=_.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=_.PLAID_BANK_NOT_SUPPORTED,i=S[e],s=!1,a="Try a different payment method"):(n.includes("expired")||n.includes("timeout"))&&(e=_.PLAID_TOKEN_EXPIRED,i=S[e],s=!0)}this.handleError({code:e,message:i,severity:R[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=()=>{const t=h.selectedPaymentMethod===P.PLAID;this.isSelected!==t&&(this.isSelected=t)}}onSelectionChange(t){t&&h.selectedPaymentMethod!==P.PLAID&&(h.selectedPaymentMethod=P.PLAID)}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.waitForStoreAndInitialize()},this.scriptRef.onerror=()=>{this.handleError({code:_.PLAID_SDK_LOAD_FAILED,message:S[_.PLAID_SDK_LOAD_FAILED],severity:R[_.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})})}componentWillLoad(){this.isSelected=h.selectedPaymentMethod===P.PLAID}async resolvePaymentMethod(){return this.publicToken?{token:this.publicToken,data:{type:"bank_account",plaid_public_token:this.publicToken}}:{validationError:!0}}async getPaymentToken(){return h.paymentToken||await this.exchangePublicTokenForPaymentMethod(),h.paymentToken}async setSelected(t){this.isSelected=t,t&&(h.selectedPaymentMethod=P.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=l("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(!0!==h.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[PlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const t=e("img",{class:"plaid-logo-img",src:"data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgMjggMjkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgY2xhc3M9ImNzcy0xcmRhajhtIj48ZyBmaWxsPSIjMTExIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yNS43NjI5IDI2LjI2MjhMMjggMTcuNTMwOUwyNC45NjkxIDE0LjUwMDFMMjcuOTk5OSAxMS40NjkxTDI1Ljc2MjggMi43MzcwNkwxNy4wMzA5IDAuNUwxNC4wMDAxIDMuNTMxTDEwLjk2OSAwLjUwMDE0TDIuMjM3MDYgMi43MzczNEwwIDExLjQ2OTFMMy4wMzEyOCAxNC40OTk5TDAuMDAwMTQgMTcuNTMxTDIuMjM3MiAyNi4yNjI5TDEwLjk2OTEgMjguNUwxNC4wMDAxIDI1LjQ2OUwxNy4wMzEgMjguNDk5OUwyNS43NjI5IDI2LjI2MjhaTTE1LjczMjEgMjMuNzM3MUwxOC42MTg2IDIwLjg1MDVMMjIuMjkxMiAyNC41MjMzTDE3LjY5NTYgMjUuNzAwN0wxNS43MzIxIDIzLjczNzFaTTExLjExMzYgOS44ODE1NEwxNC4wMDAzIDYuOTk1MDJMMTYuODg2OCA5Ljg4MTRMMTQuMDAwMSAxMi43Njc5TDExLjExMzYgOS44ODE1NFpNMTIuMjY4MiAxNC41TDkuMzgxNTQgMTcuMzg2NUw2LjQ5NTAyIDE0LjVMOS4zODE1NCAxMS42MTM1TDEyLjI2ODIgMTQuNVpNMTguNjE4NyAxMS42MTMzTDIxLjUwNTMgMTQuNUwxOC42MTg2IDE3LjM4NjVMMTUuNzMyMSAxNC41TDE4LjYxODcgMTEuNjEzM1pNMTYuODg2NyAxOS4xMTg2TDE0LjAwMDEgMjIuMDA1MUwxMS4xMTM1IDE5LjExODVMMTQuMDAwMSAxNi4yMzE5TDE2Ljg4NjcgMTkuMTE4NlpNMTAuMzA0NCAyNS43MDA3TDUuNzA4NjQgMjQuNTIzM0w5LjM4MTU0IDIwLjg1MDRMMTIuMjY4MiAyMy43MzcxTDEwLjMwNDQgMjUuNzAwN1pNNC43NjMwOCAxNi4yMzE5TDcuNjQ5NiAxOS4xMTg1TDMuOTc2NyAyMi43OTE0TDIuNzk5MyAxOC4xOTU3TDQuNzYzMDggMTYuMjMxOVpNMy45NzY3IDYuMjA4MzZMNy42NDk3NCA5Ljg4MTRMNC43NjMwOCAxMi43NjgxTDIuNzk5MyAxMC44MDQxTDMuOTc2NyA2LjIwODM2Wk0xMi4yNjgzIDUuMjYyOTRMOS4zODE2OCA4LjE0OTZMNS43MDg5MiA0LjQ3NjdMMTAuMzA0NyAzLjI5OTNMMTIuMjY4MyA1LjI2Mjk0Wk0xNy42OTU5IDMuMjk5M0wyMi4yOTE1IDQuNDc2N0wxOC42MTg2IDguMTQ5NDZMMTUuNzMyMSA1LjI2Mjk0TDE3LjY5NTkgMy4yOTkzWk0yMy4yMzcyIDEyLjc2ODFMMjAuMzUwNSA5Ljg4MTRMMjQuMDIzMyA2LjIwODc4TDI1LjIwMDcgMTAuODA0NkwyMy4yMzcyIDEyLjc2ODFaTTI0LjAyMzMgMjIuNzkxNEwyMC4zNTA1IDE5LjExODZMMjMuMjM3MiAxNi4yMzIxTDI1LjIwMDcgMTguMTk1N0wyNC4wMjMzIDIyLjc5MTRaIj48L3BhdGg+PC9nPjwvc3ZnPgo=",alt:"Plaid",title:"Plaid",style:{display:"inline",width:"20px",height:"20px",marginLeft:"5px",marginTop:"-2px"}});return e(c,{class:"payment-method"},e("script",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",async:!0,ref:t=>this.scriptRef=t}),e("div",{class:"radio-list-item p-3",part:o,onClick:this.onPaymentMethodOptionClick,title:"Pay with Plaid"},e("form-control-radio",{name:"paymentMethodType",value:P.PLAID,checked:this.isSelected,label:e("div",null,e("div",null,"Pay with Bank Account ",t," "),(()=>this.error?e("div",{class:(this.error.severity===f.ERROR?"text-danger":this.error.severity===f.WARNING?"text-warning":"text-info")+" mt-2"},e("small",null,this.error.message),e("br",null),e("small",{class:"text-muted"},this.error.userAction,this.error.retryable&&this.retryCount<this.maxRetries&&e("span",null," • Auto-retry in progress..."))):null)(),(()=>this.error?null:this.isAuthenticating?e("div",{class:"text-info mt-2"},e("small",null,"Connecting to your bank...")):this.publicToken?e("div",{class:"text-success mt-2"},e("small",null,"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:e("div",{class:"text-muted mt-2"},e("small",null,"Click to connect your bank account")))())})))}static get watchers(){return{isSelected:["onSelectionChange"]}}},B=class{constructor(e){t(this,e),this.onPaymentMethodOptionClick=t=>e=>{e.preventDefault(),h.selectedPaymentMethod={[x.CARD]:P.SAVED_CARD,[x.BANK_ACCOUNT]:P.SAVED_BANK_ACCOUNT}[t.type],h.paymentToken=t.id},this.isAllowedPaymentMethod=t=>!(t.type===x.CARD&&h.disableCreditCard||t.type===x.BANK_ACCOUNT&&h.disableBankAccount)}componentWillLoad(){h.paymentMethods.length||console.warn("No saved payment methods available."),h.disablePaymentMethodGroup&&console.warn("Payment method group is disabled.")}render(){return h.disablePaymentMethodGroup?null:e(c,null,e("div",{class:"saved-payment-methods"},h.paymentMethods.length?h.paymentMethods.filter(this.isAllowedPaymentMethod).map((t=>e("div",{class:"radio-list-item p-3",part:o,onClick:this.onPaymentMethodOptionClick(t)},e("form-control-radio",{name:"paymentMethodType",value:null==t?void 0:t.id,checked:h.paymentToken===(null==t?void 0:t.id),label:`${I[null==t?void 0:t.brand]||""} *${null==t?void 0:t.acct_last_four}`})))):null))}},Q=e("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"}}),Y=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=i(this,"paymentMethodOptionSelected"),this.paymentMethodOptionId=P.SEZZLE,this.onPaymentMethodOptionClick=t=>{t.preventDefault(),h.selectedPaymentMethod=this.paymentMethodOptionId,this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)},this.initializeSezzleCheckout=()=>{let t;this.sezzlePromise=new Promise((e=>{t=e}));const e=Number(h.paymentAmount),i=new(0,window.Checkout)({mode:"popup",publicKey:h.bnplProviderClientId,apiMode:h.bnplProviderMode,apiVersion:h.bnplProviderApiVersion});i.sezzleButtonElement=this.sezzleButtonRef,i.init({onClick:function(t){t.preventDefault(),i.startCheckout({checkout_url:h.bnplProviderCheckoutUrl})},onComplete:e=>t({bnpl:e.data}),onCancel:e=>t({bnpl:e.data}),onFailure:e=>t({bnpl:e.data})}),this.sezzleCheckout=i,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(e)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()})}async resolvePaymentMethod(t){return t.isValid?(this.sezzleButtonRef.click(),this.sezzlePromise):{validationError:!0}}render(){var t,i;return!h.bnplEnabled||h.disableBnpl?(console.warn("justifi-sezzle-payment-method: BNPL is not enabled for this account."),null):e(c,{class:"payment-method"},e("script",{src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),e("div",{class:"radio-list-item p-3",part:o,onClick:this.onPaymentMethodOptionClick},e("form-control-radio",{name:"paymentMethodType",value:this.paymentMethodOptionId,checked:h.selectedPaymentMethod===P.SEZZLE,label:e("div",null,e("div",null,"Buy now, pay later with ",Q),this.installmentPlan&&e("small",null,e("span",null,null===(t=this.installmentPlan)||void 0===t?void 0:t.installments.length)," ",e("span",null,this.installmentPlan.schedule," payments of")," ",e("span",{class:"fw-bold"},r(null===(i=this.installmentPlan)||void 0===i?void 0:i.installments[0].amountInCents))))})))}},F={[P.NEW_BANK_ACCOUNT]:"New bank account",[P.NEW_CARD]:"New credit or debit card"},V="Payment form not ready",H="Validation error",W=class{constructor(e){t(this,e),this.errorEvent=i(this,"error-event"),this.submitEvent=i(this,"submit-event"),this.computedHideSubmitButton=!1,this.isLoading=!1,this.submitButtonText="Submit"}paymentMethodsChanged(){this.setDefaultSelectedPaymentMethod()}connectedCallback(){this.setDefaultSelectedPaymentMethod(),this.setComputedHideSubmitButton()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup(),this.unsubscribeFromStore&&this.unsubscribeFromStore()}componentWillLoad(){g(),this.analytics=new v(this)}handleRadioClick(t){this.selectedPaymentMethod=t.detail,h.selectedPaymentMethod=t.detail}async fillBillingForm(t){var e;null===(e=this.billingFormRef)||void 0===e||e.fill(t)}async tokenizePaymentMethod(t){null==t||t.preventDefault(),this.validateRequiredProps(),this.isLoading=!0;try{if(!(await this.validate()).isValid)return this.errorEvent.emit({errorCode:k.TOKENIZE_ERROR,message:H}),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(k.TOKENIZE_ERROR,t.message);return this.emitError({errorCode:k.TOKENIZE_ERROR,message:t.message}),this.submitEvent.emit({response:e}),e}finally{this.isLoading=!1}}async validate(){if(!this.areFormsReady())return{isValid:!1,errors:{general:V}};const[t,e]=await Promise.all([this.billingFormRef.validate(),this.paymentMethodFormRef.validate()]);return{isValid:t.isValid&&e.isValid,errors:Object.assign(Object.assign({},t.errors),e.errors)}}async tokenize(){try{const t=await this.billingFormRef.getValues(),e={clientId:this.authToken||h.authToken,account:this.accountId||h.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||h.authToken||this.emitError({errorCode:k.TOKENIZE_ERROR,message:"Auth token is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"}),this.accountId||h.accountId||this.emitError({errorCode:k.TOKENIZE_ERROR,message:"Account ID is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"})}setDefaultSelectedPaymentMethod(){this.selectedPaymentMethod||(this.disableCreditCard?this.disableBankAccount||(this.selectedPaymentMethod=P.NEW_BANK_ACCOUNT):this.selectedPaymentMethod=P.NEW_CARD)}setComputedHideSubmitButton(){if(void 0!==this.hideSubmitButton)return void(this.computedHideSubmitButton=this.hideSubmitButton);const t=this.isSlottedWithinModularCheckout();this.computedHideSubmitButton=t}isSlottedWithinModularCheckout(){var t;let e=null===(t=this.host)||void 0===t?void 0:t.parentElement;for(;e;){if("JUSTIFI-MODULAR-CHECKOUT"===e.tagName)return!0;e=e.parentElement}return!1}get availablePaymentMethods(){const t=[];return this.disableCreditCard||t.push(P.NEW_CARD),this.disableBankAccount||t.push(P.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:f.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",V);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||H;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||h.paymentMethodGroupId}get shouldSavePaymentMethod(){return!(!this.paymentMethodGroupId&&!h.savePaymentMethod)}get shouldHideRadioInput(){return this.disableCreditCard||this.disableBankAccount}renderPaymentMethodOption(t){const i=this.selectedPaymentMethod===t;return e("div",{class:"payment-method"},e("justifi-radio-list-item",{name:"paymentMethodType",value:t,checked:i,label:F[t],hidden:this.shouldHideRadioInput}),i&&this.renderSelectedPaymentMethodForm(t))}renderSelectedPaymentMethodForm(t){return e("div",{class:"mt-4 pb-4"},this.renderPaymentMethodForm(t),e("div",{class:"mt-4"},e("justifi-billing-form",{ref:t=>this.billingFormRef=t,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:t})),e("div",{class:"mt-4"},e("justifi-save-new-payment-method",{hidden:!this.paymentMethodGroupID})))}renderPaymentMethodForm(t){return e(t===P.NEW_CARD?"justifi-card-form":"justifi-bank-account-form",{ref:t=>this.paymentMethodFormRef=t})}render(){return e(c,{key:"a11012d80460057b0dc16dc6a470ad57bad12ca2"},e("form",{key:"76c8f50a5394f80b171295337a4382a4713d5ec1"},e("fieldset",{key:"955f99016cb495628afe016037a154fcc39f5ac3"},e("div",{key:"a80324943093aa2df3804f5358fb904b5540d92c",class:"row gy-3"},e("div",{key:"b5fc2d063e2a859f52c4914ea669b35134d7d256",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),e("div",{key:"f2a759d16742c346bd7833c72916b2a058a1be34",class:"col-12"},e("justifi-button",{key:"ab6238aa25cc9dae2851b4156b7c2ac88802b4fd",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{C as justifi_checkout_summary,A as justifi_header,z as justifi_modular_checkout,U as justifi_plaid_payment_method,B as justifi_saved_payment_methods,Y as justifi_sezzle_payment_method,W as justifi_tokenize_payment_method}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e}from"./p-CpaS1Lex.js";const o={accountId:"",authToken:"",billingFormFields:{address_postal_code:""},bnplEnabled:!1,insuranceEnabled:!1,bnplProviderApiVersion:"",bnplProviderCheckoutUrl:"",bnplProviderClientId:"",bnplProviderMode:"",checkoutId:"",bankAccountVerification:void 0,disableBankAccount:!1,disableBnpl:!1,disableCreditCard:!1,disablePaymentMethodGroup:!1,paymentAmount:0,paymentCurrency:"USD",paymentDescription:"",paymentMethodGroupId:void 0,paymentMethods:[],paymentToken:void 0,savePaymentMethod:!1,selectedPaymentMethod:void 0,totalAmount:0},{state:n,onChange:t}=e(o);Object.keys(o).forEach((e=>{t(e,(o=>{n[e]=o}))}));export{n as c,t as o}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={name:"@justifi/webcomponents",version:"6.0.0-rc.7"};export{e as p}
|