@justifi/webcomponents 6.1.0 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/cjs/{check-pkg-version-C7b-OLb5.js → check-pkg-version-CEZpYUNV.js} +1 -1
  2. package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
  3. package/dist/cjs/justifi-apple-pay_8.cjs.entry.js +5 -79
  4. package/dist/cjs/justifi-bank-account-billing-form-simple_9.cjs.entry.js +2 -2
  5. package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
  6. package/dist/cjs/justifi-business-form.cjs.entry.js +2 -2
  7. package/dist/cjs/justifi-checkout.cjs.entry.js +2 -2
  8. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +2 -2
  9. package/dist/cjs/justifi-dispute-management.cjs.entry.js +2 -2
  10. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +2 -2
  11. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
  12. package/dist/cjs/justifi-order-terminals.cjs.entry.js +2 -2
  13. package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
  14. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
  15. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +2 -2
  16. package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
  17. package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
  18. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +2 -2
  19. package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
  20. package/dist/cjs/justifi-refund-payment.cjs.entry.js +2 -2
  21. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +2 -2
  22. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +2 -2
  23. package/dist/cjs/justifi-terminals-list.cjs.entry.js +2 -2
  24. package/dist/cjs/{package-BHmdO9eK.js → package-D2S7GRvh.js} +1 -1
  25. package/dist/collection/api/services/apple-pay.service.js +3 -43
  26. package/dist/collection/components/modular-checkout/sub-components/apple-pay.js +0 -34
  27. package/dist/docs.json +1 -1
  28. package/dist/esm/{check-pkg-version-xM0uWxbL.js → check-pkg-version-Ba95SWgY.js} +1 -1
  29. package/dist/esm/hidden-input_2.entry.js +1 -1
  30. package/dist/esm/justifi-apple-pay_8.entry.js +5 -79
  31. package/dist/esm/justifi-bank-account-billing-form-simple_9.entry.js +2 -2
  32. package/dist/esm/justifi-business-details.entry.js +2 -2
  33. package/dist/esm/justifi-business-form.entry.js +2 -2
  34. package/dist/esm/justifi-checkout.entry.js +2 -2
  35. package/dist/esm/justifi-checkouts-list.entry.js +2 -2
  36. package/dist/esm/justifi-dispute-management.entry.js +2 -2
  37. package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
  38. package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
  39. package/dist/esm/justifi-order-terminals.entry.js +2 -2
  40. package/dist/esm/justifi-payment-details.entry.js +2 -2
  41. package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
  42. package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
  43. package/dist/esm/justifi-payments-list.entry.js +2 -2
  44. package/dist/esm/justifi-payout-details.entry.js +2 -2
  45. package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
  46. package/dist/esm/justifi-payouts-list.entry.js +2 -2
  47. package/dist/esm/justifi-refund-payment.entry.js +2 -2
  48. package/dist/esm/justifi-season-interruption-insurance.entry.js +2 -2
  49. package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
  50. package/dist/esm/justifi-terminals-list.entry.js +2 -2
  51. package/dist/esm/{package-DL-q4EcN.js → package-Csfiax9X.js} +1 -1
  52. package/dist/module/apple-pay.js +3 -77
  53. package/dist/module/package.js +1 -1
  54. package/dist/webcomponents/{p-f930acaa.entry.js → p-000d6b5d.entry.js} +1 -1
  55. package/dist/webcomponents/p-0f16c00f.entry.js +1 -0
  56. package/dist/webcomponents/{p-a5c70eee.entry.js → p-1872ee94.entry.js} +1 -1
  57. package/dist/webcomponents/{p-85a2eac6.entry.js → p-281ea1f6.entry.js} +1 -1
  58. package/dist/webcomponents/{p-cff5dd60.entry.js → p-2d9b817b.entry.js} +1 -1
  59. package/dist/webcomponents/{p-fe8c2243.entry.js → p-40c3d17c.entry.js} +1 -1
  60. package/dist/webcomponents/p-44ec2d88.entry.js +1 -0
  61. package/dist/webcomponents/p-44f9739e.entry.js +1 -0
  62. package/dist/webcomponents/{p-d7f91c48.entry.js → p-5c0c35ac.entry.js} +1 -1
  63. package/dist/webcomponents/{p-28a3bf32.entry.js → p-7eb4b9b4.entry.js} +1 -1
  64. package/dist/webcomponents/p-8b3245c4.entry.js +1 -0
  65. package/dist/webcomponents/{p-b36adce3.entry.js → p-9365c7c2.entry.js} +1 -1
  66. package/dist/webcomponents/p-Csfiax9X.js +1 -0
  67. package/dist/webcomponents/{p-be05d450.entry.js → p-a10ae013.entry.js} +1 -1
  68. package/dist/webcomponents/{p-8cebc84b.entry.js → p-a8ad5f5c.entry.js} +1 -1
  69. package/dist/webcomponents/{p-ce652ff9.entry.js → p-a8e8d944.entry.js} +1 -1
  70. package/dist/webcomponents/{p-30856338.entry.js → p-b3094b8f.entry.js} +1 -1
  71. package/dist/webcomponents/{p-66db858a.entry.js → p-bdf293f6.entry.js} +1 -1
  72. package/dist/webcomponents/{p-720a2324.entry.js → p-c6dc30e2.entry.js} +1 -1
  73. package/dist/webcomponents/p-da1fb2a3.entry.js +1 -0
  74. package/dist/webcomponents/{p-ae7054bf.entry.js → p-ddc0b742.entry.js} +1 -1
  75. package/dist/webcomponents/{p-89f6ad8f.entry.js → p-e6011271.entry.js} +1 -1
  76. package/dist/webcomponents/{p-b612d870.entry.js → p-eaefb320.entry.js} +1 -1
  77. package/dist/webcomponents/{p-D5Jb9OcR.js → p-l8F_7Ihw.js} +1 -1
  78. package/dist/webcomponents/webcomponents.esm.js +1 -1
  79. package/package.json +1 -1
  80. package/dist/webcomponents/p-5b5d7a8f.entry.js +0 -1
  81. package/dist/webcomponents/p-94237472.entry.js +0 -1
  82. package/dist/webcomponents/p-DL-q4EcN.js +0 -1
  83. package/dist/webcomponents/p-b095c781.entry.js +0 -1
  84. package/dist/webcomponents/p-d84f0122.entry.js +0 -1
  85. package/dist/webcomponents/p-e55a161f.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as e,c as t,h as s}from"./p-DOjVAAtq.js";import{f as i}from"./p-Bgnhf5c9.js";import{D as a,aj as r}from"./p-xDbRW9xn.js";import{B as d}from"./p-C9EQ459H.js";import{S as o}from"./p-BhCH9S0e.js";import{S as c}from"./p-T2yENPvU.js";import"./p-CZfYo5-1.js";import{C as n,a as h}from"./p-Cjcsf8ku.js";import{g as p,a as f}from"./p-D2muobcE.js";import{D as l}from"./p-C8k7a6D-.js";import{D as u}from"./p-Bg2SZArf.js";import{c as b,J as y}from"./p-D5Jb9OcR.js";import"./p-HXpYMWUU.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-DL-q4EcN.js";const m=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.submitDisputeResponse(t,e,i);if(d.error){return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR})}a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}},v=class{constructor(s){e(this,s),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.submitEvent=t(this,"submit-event")}acceptDispute(){m({disputeId:this.dispute.id,authToken:this.authToken,service:new l})({payload:{forfeit:!0},onSuccess:e=>{this.submitEvent.emit({response:e})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}})}initiateRespondToDispute(){this.clickEvent.emit({name:u.respondToDispute})}render(){var e,t,n,h,p,f,l;return s(o,{key:"ab36fe0292ebcc4d2f062898065c135b869be67a"},this.isLoading&&s("div",{key:"8cff4628d911c7119b0f8d1612e99caad526746c",style:{marginBottom:"8px"}},s(c,{key:"ee3bce3019778f5e481ae26ada89e70090671b37",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(c,{key:"242cbb756770f1545d09f5e79c539683158acaa6",height:"18px",styles:{marginBottom:"8px"}}),s(c,{key:"409e7d228cb414ed458959107ba5ba2fe38eed72",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&s("div",{key:"8ba65861b311e2020f52ee38f0303b19c4b8b386",part:a},s("h1",{key:"9f62e7a3144e50a0980d5e3ea2a1e078ec8e9d0b",class:"h4",part:r},"This payment is disputed"),s("p",{key:"533af5d2cc8cba530812d247f60ad7a92e4a36a3"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"cf842a85853e34e3b1a38674d36bd0a4705ff5e0",class:"h5"},"Dispute details"),s("div",{key:"cd3bcc4861a2ba4a576638d9a0e86927ff4d7123",class:"d-table gap-2"},s("div",{key:"1bd4ce368992bf9d6855a301e0b249c68a98471c",class:"d-table-row gap-2"},s("span",{key:"18845a901fcd0bff4480b780bbcf35fc171f4b0b",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"75533ed5fd445f69a4967a6625cab5badc5766a3",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(t=this.dispute)||void 0===t?void 0:t.amount))),s("div",{key:"5c0974a223983b19150230544d4c3b4154747de2",class:"d-table-row gap-2"},s("span",{key:"7d09c4fdbc0b5f38f15d78b3c325e256d29136dc",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"2379e217700a07a388650f7ca82ca5a420175dd9",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(n=this.dispute)||void 0===n?void 0:n.reason)),s("div",{key:"c4b5ad2e540d0ab61ff29b2913344ed055a56618",class:"d-table-row gap-2"},s("span",{key:"2f32326e0067d8d8ac734ba9f16b6aee0e774cc2",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Due Date"),s("span",{key:"823b0d79ad2c77ef68c27300a5b8f539bfa66b30",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(h=this.dispute)||void 0===h?void 0:h.due_date))),s("div",{key:"8a0cca3f006564da1feee39e06b3e322cd2773fc",class:"d-flex gap-2 mt-4 justify-content-end"},s(d,{key:"07d7ba81e9353183148c9892ea8016537095b078",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(d,{key:"05d437f6711fae2398f865fdaeb6908327f8b68b",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(p=this.dispute)||void 0===p?void 0:p.underReview)&&s("div",{key:"4ca58f734515deb7c713c13a2f69f0f42d52f706"},s("h1",{key:"65f92415880cc2fb39b7b2753df960ec10437455",class:"h4"},"This payment is disputed and under review"),s("p",{key:"8129f146f956db43378b672f68a9edeec9374401"},"The cardholder is disputing this payment. A counter dispute has been submitted and is under review.")),(null===(f=this.dispute)||void 0===f?void 0:f.won)&&s("div",{key:"85acb2724f46424856bf4fc885bd1553539ce2be"},s("h1",{key:"7ce9b3ed57a5c3cd904d1c706044091fbda3dc03",class:"h4"},"This payment was disputed"),s("p",{key:"6a92fd3be617562d1ba10192ec508354a9450150"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(l=this.dispute)||void 0===l?void 0:l.lost)&&s("div",{key:"8e45676c7909732bee12f707297987b927b9526c"},s("h1",{key:"f64abd54f60a63e0ff6888beecc74050e2f860db",class:"h4"},"This payment was disputed"),s("p",{key:"bd2e689d5de42468b67259573b8289835c4acc5e"},"The cardholder disputed this payment and the card issuer has settled it in their favor.")))}},k=class{constructor(s){e(this,s),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.apiOrigin="https://wc-proxy.justifi.ai",this.handleErrorEvent=e=>{this.errorMessage=e.detail.message,this.errorEvent.emit(e.detail)}}componentWillLoad(){b(),this.analytics=new y(this),this.initializeDisputeServiceMethods()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeDisputeServiceMethods()}initializeDisputeServiceMethods(){this.disputeId&&this.authToken?(this.updateDisputeResponse=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.updateDisputeResponse(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR});a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.createDisputeEvidence(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR});a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.submitDisputeResponse=m({disputeId:this.disputeId,authToken:this.authToken,service:new l})):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:h.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}render(){return s(o,{key:"62d1cf5247d9049fd5aa66d13c64ef1b16625f46"},s("justifi-dispute-response-core",{key:"b5903023092984d31135dcd037850d66acc860df","onError-event":this.handleErrorEvent,"dispute-id":this.disputeId,disputeResponse:this.disputeResponse,createDisputeEvidence:this.createDisputeEvidence,updateDisputeResponse:this.updateDisputeResponse,submitDisputeResponse:this.submitDisputeResponse}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}},j=class{constructor(i){e(this,i),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.stepCompleteEvent=t(this,"complete-form-step-event"),this.submitEvent=t(this,"submit-event"),this.disputeResponse={},this.isLoading=!1,this.documentList=[],this.documentErrors={},this.currentStep=0,this.componentStepMapping=[()=>s("justifi-product-or-service",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-customer-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-cancellation-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-refund-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-duplicate-charge",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-electronic-evidence",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-shipping-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-additional-statement",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors})],this.saveData=async(e,t)=>{if(Object.keys(e).length)return this.isLastStep?this.submitDisputeResponse({payload:e,onSuccess:e=>{this.submitEvent.emit({response:e}),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}}):this.updateDisputeResponse({payload:e,onSuccess:e=>{this.disputeResponse=Object.assign({},e.data),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}});this.stepCompleteEvent.emit({response:null,formStep:t})},this.initializeMakePresignedURLs=async()=>{const e=this.documentList.map((e=>this.getPresignedFileUrl(e)));return await Promise.all(e)},this.initializeFileUploads=async()=>{const e=this.documentList.map((e=>this.uploadDocument(e)));return Promise.all(e)},this.getPresignedFileUrl=async e=>this.createDisputeEvidence({payload:{file_name:e.file_name,file_type:e.file_type,dispute_evidence_type:e.dispute_evidence_type},onSuccess:t=>{e.presignedUrl=t.data.presigned_url},onError:({error:t,code:s,severity:i})=>{const a={[e.dispute_evidence_type]:t};this.documentErrors=Object.assign(Object.assign({},this.documentErrors),a),this.errorEvent.emit({errorCode:s,message:t,severity:i})}}),this.uploadDocument=async e=>{const t=await e.getFileString();if(!e.presignedUrl)throw new Error("Presigned URL is not set");return await fetch(e.presignedUrl,{method:"PUT",body:t})},this.handleSubmit=async(e,t,s)=>{if(this.isLoading=!0,t.length){if(this.documentErrors={},this.documentList=t,await this.initializeMakePresignedURLs(),Object.keys(this.documentErrors).length)throw this.isLoading=!1,new Error("Could not presign all documents");await this.initializeFileUploads()}await this.saveData(e,s),this.isLoading=!1},this.onCancel=()=>{this.clickEvent.emit({name:u.cancelDispute})},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.submit});const i=Object.assign(Object.assign({},e),{forfeit:!1});await this.handleSubmit(i,t,s)}))}}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}get isLastStep(){return this.currentStep===this.componentStepMapping.length-1}get isFirstStep(){return 0===this.currentStep}render(){return s("div",{key:"b57563a641ae4f1be39f5f64ca88132b92aff3bd",class:"row gy-3"},s("div",{key:"72f86b4907aaa872db039783e06f38b5c9d26658",class:"col-12"},s("h1",{key:"62c570a4c30831bbc805e8cbad8d9e5d1433f5a5",class:"h4",part:r},"Counter dispute")),s("div",{key:"692d6386e5c4874a0c2585fca9ffd6194dc8ef85",class:"col-12"},this.currentStepComponent),s("div",{key:"a7b614f93994721ff45724cbb6ff42877ff55aeb",class:"col-12"},s("div",{key:"e6c66ca06f1eaab7baa10742246e0707d7ebd083",class:"d-flex gap-2 mt-4 justify-content-end"},this.isFirstStep?s(d,{variant:"secondary",onClick:()=>this.onCancel(),disabled:this.isLoading,isLoading:this.isLoading},"Cancel"):s(d,{variant:"secondary",onClick:()=>this.onBack(),disabled:this.isLoading,isLoading:this.isLoading},"Back"),this.isLastStep?s(d,{variant:"primary",onClick:()=>this.onSubmit(),disabled:this.isLoading,isLoading:this.isLoading},"Submit Counter Dispute"):s(d,{variant:"primary",onClick:()=>this.onNext(),disabled:this.isLoading,isLoading:this.isLoading},"Next"))))}};export{v as justifi_dispute_notification,k as justifi_dispute_response,j as justifi_dispute_response_core}
1
+ import{r as e,c as t,h as s}from"./p-DOjVAAtq.js";import{f as i}from"./p-Bgnhf5c9.js";import{D as a,aj as r}from"./p-xDbRW9xn.js";import{B as d}from"./p-C9EQ459H.js";import{S as o}from"./p-BhCH9S0e.js";import{S as c}from"./p-T2yENPvU.js";import"./p-CZfYo5-1.js";import{C as n,a as h}from"./p-Cjcsf8ku.js";import{g as p,a as f}from"./p-D2muobcE.js";import{D as l}from"./p-C8k7a6D-.js";import{D as u}from"./p-Bg2SZArf.js";import{c as b,J as y}from"./p-l8F_7Ihw.js";import"./p-HXpYMWUU.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-Csfiax9X.js";const m=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.submitDisputeResponse(t,e,i);if(d.error){return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR})}a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}},v=class{constructor(s){e(this,s),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.submitEvent=t(this,"submit-event")}acceptDispute(){m({disputeId:this.dispute.id,authToken:this.authToken,service:new l})({payload:{forfeit:!0},onSuccess:e=>{this.submitEvent.emit({response:e})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}})}initiateRespondToDispute(){this.clickEvent.emit({name:u.respondToDispute})}render(){var e,t,n,h,p,f,l;return s(o,{key:"ab36fe0292ebcc4d2f062898065c135b869be67a"},this.isLoading&&s("div",{key:"8cff4628d911c7119b0f8d1612e99caad526746c",style:{marginBottom:"8px"}},s(c,{key:"ee3bce3019778f5e481ae26ada89e70090671b37",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(c,{key:"242cbb756770f1545d09f5e79c539683158acaa6",height:"18px",styles:{marginBottom:"8px"}}),s(c,{key:"409e7d228cb414ed458959107ba5ba2fe38eed72",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&s("div",{key:"8ba65861b311e2020f52ee38f0303b19c4b8b386",part:a},s("h1",{key:"9f62e7a3144e50a0980d5e3ea2a1e078ec8e9d0b",class:"h4",part:r},"This payment is disputed"),s("p",{key:"533af5d2cc8cba530812d247f60ad7a92e4a36a3"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"cf842a85853e34e3b1a38674d36bd0a4705ff5e0",class:"h5"},"Dispute details"),s("div",{key:"cd3bcc4861a2ba4a576638d9a0e86927ff4d7123",class:"d-table gap-2"},s("div",{key:"1bd4ce368992bf9d6855a301e0b249c68a98471c",class:"d-table-row gap-2"},s("span",{key:"18845a901fcd0bff4480b780bbcf35fc171f4b0b",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"75533ed5fd445f69a4967a6625cab5badc5766a3",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(t=this.dispute)||void 0===t?void 0:t.amount))),s("div",{key:"5c0974a223983b19150230544d4c3b4154747de2",class:"d-table-row gap-2"},s("span",{key:"7d09c4fdbc0b5f38f15d78b3c325e256d29136dc",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"2379e217700a07a388650f7ca82ca5a420175dd9",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(n=this.dispute)||void 0===n?void 0:n.reason)),s("div",{key:"c4b5ad2e540d0ab61ff29b2913344ed055a56618",class:"d-table-row gap-2"},s("span",{key:"2f32326e0067d8d8ac734ba9f16b6aee0e774cc2",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Due Date"),s("span",{key:"823b0d79ad2c77ef68c27300a5b8f539bfa66b30",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(h=this.dispute)||void 0===h?void 0:h.due_date))),s("div",{key:"8a0cca3f006564da1feee39e06b3e322cd2773fc",class:"d-flex gap-2 mt-4 justify-content-end"},s(d,{key:"07d7ba81e9353183148c9892ea8016537095b078",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(d,{key:"05d437f6711fae2398f865fdaeb6908327f8b68b",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(p=this.dispute)||void 0===p?void 0:p.underReview)&&s("div",{key:"4ca58f734515deb7c713c13a2f69f0f42d52f706"},s("h1",{key:"65f92415880cc2fb39b7b2753df960ec10437455",class:"h4"},"This payment is disputed and under review"),s("p",{key:"8129f146f956db43378b672f68a9edeec9374401"},"The cardholder is disputing this payment. A counter dispute has been submitted and is under review.")),(null===(f=this.dispute)||void 0===f?void 0:f.won)&&s("div",{key:"85acb2724f46424856bf4fc885bd1553539ce2be"},s("h1",{key:"7ce9b3ed57a5c3cd904d1c706044091fbda3dc03",class:"h4"},"This payment was disputed"),s("p",{key:"6a92fd3be617562d1ba10192ec508354a9450150"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(l=this.dispute)||void 0===l?void 0:l.lost)&&s("div",{key:"8e45676c7909732bee12f707297987b927b9526c"},s("h1",{key:"f64abd54f60a63e0ff6888beecc74050e2f860db",class:"h4"},"This payment was disputed"),s("p",{key:"bd2e689d5de42468b67259573b8289835c4acc5e"},"The cardholder disputed this payment and the card issuer has settled it in their favor.")))}},k=class{constructor(s){e(this,s),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.apiOrigin="https://wc-proxy.justifi.ai",this.handleErrorEvent=e=>{this.errorMessage=e.detail.message,this.errorEvent.emit(e.detail)}}componentWillLoad(){b(),this.analytics=new y(this),this.initializeDisputeServiceMethods()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeDisputeServiceMethods()}initializeDisputeServiceMethods(){this.disputeId&&this.authToken?(this.updateDisputeResponse=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.updateDisputeResponse(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR});a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.createDisputeEvidence(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR});a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.submitDisputeResponse=m({disputeId:this.disputeId,authToken:this.authToken,service:new l})):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:h.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}render(){return s(o,{key:"62d1cf5247d9049fd5aa66d13c64ef1b16625f46"},s("justifi-dispute-response-core",{key:"b5903023092984d31135dcd037850d66acc860df","onError-event":this.handleErrorEvent,"dispute-id":this.disputeId,disputeResponse:this.disputeResponse,createDisputeEvidence:this.createDisputeEvidence,updateDisputeResponse:this.updateDisputeResponse,submitDisputeResponse:this.submitDisputeResponse}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}},j=class{constructor(i){e(this,i),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.stepCompleteEvent=t(this,"complete-form-step-event"),this.submitEvent=t(this,"submit-event"),this.disputeResponse={},this.isLoading=!1,this.documentList=[],this.documentErrors={},this.currentStep=0,this.componentStepMapping=[()=>s("justifi-product-or-service",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-customer-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-cancellation-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-refund-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-duplicate-charge",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-electronic-evidence",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-shipping-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-additional-statement",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors})],this.saveData=async(e,t)=>{if(Object.keys(e).length)return this.isLastStep?this.submitDisputeResponse({payload:e,onSuccess:e=>{this.submitEvent.emit({response:e}),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}}):this.updateDisputeResponse({payload:e,onSuccess:e=>{this.disputeResponse=Object.assign({},e.data),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}});this.stepCompleteEvent.emit({response:null,formStep:t})},this.initializeMakePresignedURLs=async()=>{const e=this.documentList.map((e=>this.getPresignedFileUrl(e)));return await Promise.all(e)},this.initializeFileUploads=async()=>{const e=this.documentList.map((e=>this.uploadDocument(e)));return Promise.all(e)},this.getPresignedFileUrl=async e=>this.createDisputeEvidence({payload:{file_name:e.file_name,file_type:e.file_type,dispute_evidence_type:e.dispute_evidence_type},onSuccess:t=>{e.presignedUrl=t.data.presigned_url},onError:({error:t,code:s,severity:i})=>{const a={[e.dispute_evidence_type]:t};this.documentErrors=Object.assign(Object.assign({},this.documentErrors),a),this.errorEvent.emit({errorCode:s,message:t,severity:i})}}),this.uploadDocument=async e=>{const t=await e.getFileString();if(!e.presignedUrl)throw new Error("Presigned URL is not set");return await fetch(e.presignedUrl,{method:"PUT",body:t})},this.handleSubmit=async(e,t,s)=>{if(this.isLoading=!0,t.length){if(this.documentErrors={},this.documentList=t,await this.initializeMakePresignedURLs(),Object.keys(this.documentErrors).length)throw this.isLoading=!1,new Error("Could not presign all documents");await this.initializeFileUploads()}await this.saveData(e,s),this.isLoading=!1},this.onCancel=()=>{this.clickEvent.emit({name:u.cancelDispute})},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.submit});const i=Object.assign(Object.assign({},e),{forfeit:!1});await this.handleSubmit(i,t,s)}))}}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}get isLastStep(){return this.currentStep===this.componentStepMapping.length-1}get isFirstStep(){return 0===this.currentStep}render(){return s("div",{key:"b57563a641ae4f1be39f5f64ca88132b92aff3bd",class:"row gy-3"},s("div",{key:"72f86b4907aaa872db039783e06f38b5c9d26658",class:"col-12"},s("h1",{key:"62c570a4c30831bbc805e8cbad8d9e5d1433f5a5",class:"h4",part:r},"Counter dispute")),s("div",{key:"692d6386e5c4874a0c2585fca9ffd6194dc8ef85",class:"col-12"},this.currentStepComponent),s("div",{key:"a7b614f93994721ff45724cbb6ff42877ff55aeb",class:"col-12"},s("div",{key:"e6c66ca06f1eaab7baa10742246e0707d7ebd083",class:"d-flex gap-2 mt-4 justify-content-end"},this.isFirstStep?s(d,{variant:"secondary",onClick:()=>this.onCancel(),disabled:this.isLoading,isLoading:this.isLoading},"Cancel"):s(d,{variant:"secondary",onClick:()=>this.onBack(),disabled:this.isLoading,isLoading:this.isLoading},"Back"),this.isLastStep?s(d,{variant:"primary",onClick:()=>this.onSubmit(),disabled:this.isLoading,isLoading:this.isLoading},"Submit Counter Dispute"):s(d,{variant:"primary",onClick:()=>this.onNext(),disabled:this.isLoading,isLoading:this.isLoading},"Next"))))}};export{v as justifi_dispute_notification,k as justifi_dispute_response,j as justifi_dispute_response_core}
@@ -1 +1 @@
1
- import{r as e,c as t,h as i}from"./p-DOjVAAtq.js";import{c as a,J as s}from"./p-D5Jb9OcR.js";import{c as d}from"./p-DGsXKF67.js";import{d as c}from"./p-xDbRW9xn.js";import{S as o}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{P as h}from"./p-DCIW8z1f.js";import"./p-DL-q4EcN.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-Cjcsf8ku.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const f=class{constructor(i){e(this,i),this.errorEvent=t(this,"error-event"),this.loadedEvent=t(this,"loaded"),this.submitEvent=t(this,"submit-event"),this.availablePaymentMethods=[],this.errorMessage="",this.insuranceToggled=!1,this.isSubmitting=!1,this.disableBankAccount=!1,this.disableBnpl=!1,this.disableCreditCard=!1,this.disablePaymentMethodGroup=!1,this.hideBankAccountBillingForm=!1,this.hideCardBillingForm=!1}propChanged(){this.updateStore()}connectedCallback(){this.authToken&&this.checkoutId&&this.updateStore()}componentWillLoad(){a(),this.analytics=new s(this)}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}checkoutComplete(e){this.isSubmitting=!1}checkoutError(e){this.isSubmitting=!1}checkoutChanged(e){this.availablePaymentMethods=this.disableBnpl?e.detail.availablePaymentMethodTypes.filter((e=>e!==h.SEZZLE)):e.detail.availablePaymentMethodTypes}async fillBillingForm(e){var t;d.billingFormFields=e,null===(t=this.tokenizePaymentMethodRef)||void 0===t||t.fillBillingForm(e)}async validate(){var e;return{isValid:await(null===(e=this.modularCheckoutRef)||void 0===e?void 0:e.validate())}}updateStore(){d.checkoutId=this.checkoutId,d.authToken=this.authToken,d.disableCreditCard=this.disableCreditCard,d.disableBankAccount=this.disableBankAccount,d.disablePaymentMethodGroup=this.disablePaymentMethodGroup}async submit(e){var t;this.isSubmitting=!0,null===(t=this.modularCheckoutRef)||void 0===t||t.submitCheckout(d.billingFormFields)}get showPaymentTypeHeader(){return!this.disableCreditCard&&!this.disableBankAccount}render(){var e,t;return i(o,{key:"0d0a0eb14ce4f41683a13da63045c0f9cdadaf9c"},i("justifi-modular-checkout",{key:"c1bdc5df815a0644ed9c2c1f993fbce3317c89ed",ref:e=>{this.modularCheckoutRef=e},authToken:this.authToken,checkoutId:this.checkoutId},i("div",{key:"c2b1585130865059c416950d203e4bc6de14d7bb",class:"row gy-3 jfi-checkout-core"},i("div",{key:"1f7e5140220fa4e47167ad94fc73ec6f097b8c38",class:"col-12",part:c},i("justifi-header",{key:"a9c940a936f3db6425ac8402910163696f57d70a",text:"Summary",level:"h2",class:"fs-5 fw-bold pb-3"}),i("section",{key:"fd46c93c9f17cac96a40b24e2abfdd9d63e5dd3a"},i("justifi-checkout-summary",{key:"4cbdfebd16b6ce411fd2ff8e9b82c141898d9aae"}))),i("div",{key:"43d2188813a694719154b80a7e7a8fcf7a09a672",class:"col-12 mt-4"},i("slot",{key:"29b07bb448b85bb15a38b961afb2c5bb22d4be73",name:"insurance"})),i("div",{key:"46b213c8ebdb4b0d5e64a8fcd84a1d5fe95c7315",class:"col-12 mt-4"},i("justifi-header",{key:"e88f4f3092521158a2f16f4158ec681af39c739f",text:"Payment",level:"h2",class:"fs-5 fw-bold pb-3"}),this.showPaymentTypeHeader&&i("justifi-header",{key:"1b610381d0e4e14811be8d3f6edd979936e6f07f",text:"Select payment type",level:"h3",class:"fs-6 fw-bold lh-lg"}),i("div",{key:"0da7399801ecdebd77f516fc60d68c7c84b8be0c",class:"d-flex flex-column"},i("section",{key:"d2cebab6a6a34cffca18e4720b18e177d4c5930c"},i("div",{key:"be648fcfc8ab083d81054ec291a524f501764eaa"},i("justifi-saved-payment-methods",{key:"b54b3e367e91d6bfb3a46cab928aeb85d059696f"}),this.availablePaymentMethods.includes(h.APPLE_PAY)&&i("div",{key:"96f6ab9bda4f61c053d09c67fbc007ff8ecbaa46",class:"mb-3"},i("justifi-apple-pay",{key:"91699bd30da48629cda982ab933f4c381259a13a"})),this.availablePaymentMethods.includes(h.SEZZLE)&&i("justifi-radio-list-item",{key:"ec38314be2801ada679b55df9e490bf89aa3fce7",name:"paymentMethodType",value:h.SEZZLE,checked:(null===(e=null==d?void 0:d.selectedPaymentMethod)||void 0===e?void 0:e.type)===h.SEZZLE,label:i("justifi-sezzle-payment-method",{ref:e=>this.sezzlePaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.sezzlePaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),this.availablePaymentMethods.includes(h.PLAID)&&!this.disableBnpl&&i("justifi-radio-list-item",{key:"582830c28451e28433d7de007db2541d333ad5f0",name:"paymentMethodType",value:h.PLAID,checked:(null===(t=null==d?void 0:d.selectedPaymentMethod)||void 0===t?void 0:t.type)===h.PLAID,label:i("justifi-plaid-payment-method",{ref:e=>this.plaidPaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.plaidPaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),i("justifi-tokenize-payment-method",{key:"7b065ec87f539d97c2977905c8afc759fd1f4a4e",ref:e=>this.tokenizePaymentMethodRef=e,authToken:this.authToken,accountId:d.accountId,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,hideSubmitButton:!0,paymentMethodGroupId:d.paymentMethodGroupId}))))),i("div",{key:"5370b456cbf1ce93a241f3dfff980cefe668652a",class:"mt-4"},i("justifi-button",{key:"7bbb85faf30a34650fa252d7d1d80d332a803bcd",text:"Pay",type:"submit",variant:"primary",clickHandler:e=>this.submit(e),disabled:this.isSubmitting,isLoading:this.isSubmitting,customStyle:{width:"100%",textAlign:"center"}})))))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"],disableCreditCard:["propChanged"],disableBankAccount:["propChanged"],disablePaymentMethodGroup:["propChanged"]}}};export{f as justifi_checkout}
1
+ import{r as e,c as t,h as i}from"./p-DOjVAAtq.js";import{c as a,J as s}from"./p-l8F_7Ihw.js";import{c as d}from"./p-DGsXKF67.js";import{d as c}from"./p-xDbRW9xn.js";import{S as o}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{P as h}from"./p-DCIW8z1f.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-Cjcsf8ku.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const f=class{constructor(i){e(this,i),this.errorEvent=t(this,"error-event"),this.loadedEvent=t(this,"loaded"),this.submitEvent=t(this,"submit-event"),this.availablePaymentMethods=[],this.errorMessage="",this.insuranceToggled=!1,this.isSubmitting=!1,this.disableBankAccount=!1,this.disableBnpl=!1,this.disableCreditCard=!1,this.disablePaymentMethodGroup=!1,this.hideBankAccountBillingForm=!1,this.hideCardBillingForm=!1}propChanged(){this.updateStore()}connectedCallback(){this.authToken&&this.checkoutId&&this.updateStore()}componentWillLoad(){a(),this.analytics=new s(this)}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}checkoutComplete(e){this.isSubmitting=!1}checkoutError(e){this.isSubmitting=!1}checkoutChanged(e){this.availablePaymentMethods=this.disableBnpl?e.detail.availablePaymentMethodTypes.filter((e=>e!==h.SEZZLE)):e.detail.availablePaymentMethodTypes}async fillBillingForm(e){var t;d.billingFormFields=e,null===(t=this.tokenizePaymentMethodRef)||void 0===t||t.fillBillingForm(e)}async validate(){var e;return{isValid:await(null===(e=this.modularCheckoutRef)||void 0===e?void 0:e.validate())}}updateStore(){d.checkoutId=this.checkoutId,d.authToken=this.authToken,d.disableCreditCard=this.disableCreditCard,d.disableBankAccount=this.disableBankAccount,d.disablePaymentMethodGroup=this.disablePaymentMethodGroup}async submit(e){var t;this.isSubmitting=!0,null===(t=this.modularCheckoutRef)||void 0===t||t.submitCheckout(d.billingFormFields)}get showPaymentTypeHeader(){return!this.disableCreditCard&&!this.disableBankAccount}render(){var e,t;return i(o,{key:"0d0a0eb14ce4f41683a13da63045c0f9cdadaf9c"},i("justifi-modular-checkout",{key:"c1bdc5df815a0644ed9c2c1f993fbce3317c89ed",ref:e=>{this.modularCheckoutRef=e},authToken:this.authToken,checkoutId:this.checkoutId},i("div",{key:"c2b1585130865059c416950d203e4bc6de14d7bb",class:"row gy-3 jfi-checkout-core"},i("div",{key:"1f7e5140220fa4e47167ad94fc73ec6f097b8c38",class:"col-12",part:c},i("justifi-header",{key:"a9c940a936f3db6425ac8402910163696f57d70a",text:"Summary",level:"h2",class:"fs-5 fw-bold pb-3"}),i("section",{key:"fd46c93c9f17cac96a40b24e2abfdd9d63e5dd3a"},i("justifi-checkout-summary",{key:"4cbdfebd16b6ce411fd2ff8e9b82c141898d9aae"}))),i("div",{key:"43d2188813a694719154b80a7e7a8fcf7a09a672",class:"col-12 mt-4"},i("slot",{key:"29b07bb448b85bb15a38b961afb2c5bb22d4be73",name:"insurance"})),i("div",{key:"46b213c8ebdb4b0d5e64a8fcd84a1d5fe95c7315",class:"col-12 mt-4"},i("justifi-header",{key:"e88f4f3092521158a2f16f4158ec681af39c739f",text:"Payment",level:"h2",class:"fs-5 fw-bold pb-3"}),this.showPaymentTypeHeader&&i("justifi-header",{key:"1b610381d0e4e14811be8d3f6edd979936e6f07f",text:"Select payment type",level:"h3",class:"fs-6 fw-bold lh-lg"}),i("div",{key:"0da7399801ecdebd77f516fc60d68c7c84b8be0c",class:"d-flex flex-column"},i("section",{key:"d2cebab6a6a34cffca18e4720b18e177d4c5930c"},i("div",{key:"be648fcfc8ab083d81054ec291a524f501764eaa"},i("justifi-saved-payment-methods",{key:"b54b3e367e91d6bfb3a46cab928aeb85d059696f"}),this.availablePaymentMethods.includes(h.APPLE_PAY)&&i("div",{key:"96f6ab9bda4f61c053d09c67fbc007ff8ecbaa46",class:"mb-3"},i("justifi-apple-pay",{key:"91699bd30da48629cda982ab933f4c381259a13a"})),this.availablePaymentMethods.includes(h.SEZZLE)&&i("justifi-radio-list-item",{key:"ec38314be2801ada679b55df9e490bf89aa3fce7",name:"paymentMethodType",value:h.SEZZLE,checked:(null===(e=null==d?void 0:d.selectedPaymentMethod)||void 0===e?void 0:e.type)===h.SEZZLE,label:i("justifi-sezzle-payment-method",{ref:e=>this.sezzlePaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.sezzlePaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),this.availablePaymentMethods.includes(h.PLAID)&&!this.disableBnpl&&i("justifi-radio-list-item",{key:"582830c28451e28433d7de007db2541d333ad5f0",name:"paymentMethodType",value:h.PLAID,checked:(null===(t=null==d?void 0:d.selectedPaymentMethod)||void 0===t?void 0:t.type)===h.PLAID,label:i("justifi-plaid-payment-method",{ref:e=>this.plaidPaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.plaidPaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),i("justifi-tokenize-payment-method",{key:"7b065ec87f539d97c2977905c8afc759fd1f4a4e",ref:e=>this.tokenizePaymentMethodRef=e,authToken:this.authToken,accountId:d.accountId,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,hideSubmitButton:!0,paymentMethodGroupId:d.paymentMethodGroupId}))))),i("div",{key:"5370b456cbf1ce93a241f3dfff980cefe668652a",class:"mt-4"},i("justifi-button",{key:"7bbb85faf30a34650fa252d7d1d80d332a803bcd",text:"Pay",type:"submit",variant:"primary",clickHandler:e=>this.submit(e),disabled:this.isSubmitting,isLoading:this.isSubmitting,customStyle:{width:"100%",textAlign:"center"}})))))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"],disableCreditCard:["propChanged"],disableBankAccount:["propChanged"],disablePaymentMethodGroup:["propChanged"]}}};export{f as justifi_checkout}
@@ -0,0 +1 @@
1
+ import{h as t,r as e,c as i,H as s,g as n}from"./p-DOjVAAtq.js";import{A as a}from"./p-DdZLLkQ5.js";import{S as o}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{S as r}from"./p-T2yENPvU.js";import{c as l,o as c,g as h,a as d}from"./p-DGsXKF67.js";import{D as u,r as p}from"./p-xDbRW9xn.js";import{f as y}from"./p-Bgnhf5c9.js";import{H as m}from"./p-RQzxYnz_.js";import{H as v,b as M,h as f,i as b}from"./p-wQgEEOq_.js";import{H as g}from"./p-BoQ6_4Ks.js";import{J as k,c as w}from"./p-l8F_7Ihw.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{C as j,a as A,b as T}from"./p-Cjcsf8ku.js";import{I as P}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as N,a as E}from"./p-D2muobcE.js";import{C as I}from"./p-CEk3bv0x.js";import{P as C,a as D,b as S}from"./p-DCIW8z1f.js";import{C as O}from"./p-ZpPDShvP.js";import"./p-DdMxswn1.js";import"./p-Csfiax9X.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";var x,L,z,_,R;!function(t){t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_FAILURE="STATUS_FAILURE"}(x||(x={})),function(t){t.PLAIN="plain",t.BUY="buy",t.SET_UP="set-up",t.DONATE="donate",t.CHECK_OUT="check-out",t.BOOK="book",t.SUBSCRIBE="subscribe"}(L||(L={})),function(t){t.BLACK="black",t.WHITE="white",t.WHITE_OUTLINE="white-outline"}(z||(z={})),function(t){t.SUPPORTS_3DS="supports3DS",t.SUPPORTS_EMV="supportsEMV",t.SUPPORTS_CREDIT="supportsCredit",t.SUPPORTS_DEBIT="supportsDebit"}(_||(_={}));class U{constructor(t){this.merchantIdentifier=t.merchantIdentifier,this.displayName=t.displayName,this.initiative=t.initiative,this.initiativeContext=t.initiativeContext,this.buttonType=t.buttonType||L.PLAIN,this.buttonStyle=t.buttonStyle||z.BLACK,this.buttonLocale=t.buttonLocale||"en-US"}get isValid(){return!!(this.merchantIdentifier&&this.displayName&&this.initiative&&this.initiativeContext)}}class B{constructor(t){this.countryCode=t.countryCode,this.currencyCode=t.currencyCode,this.merchantCapabilities=t.merchantCapabilities,this.supportedNetworks=t.supportedNetworks,this.total=t.total,this.lineItems=t.lineItems,this.shippingMethods=t.shippingMethods,this.applicationData=t.applicationData,this.supportedCountries=t.supportedCountries}get isValid(){var t,e,i,s;return!!(this.countryCode&&this.currencyCode&&(null===(t=this.merchantCapabilities)||void 0===t?void 0:t.length)&&(null===(e=this.supportedNetworks)||void 0===e?void 0:e.length)&&(null===(i=this.total)||void 0===i?void 0:i.label)&&(null===(s=this.total)||void 0===s?void 0:s.amount))}}class Y{static isApplePaySupported(){var t;return"undefined"!=typeof window&&"ApplePaySession"in window&&(null===(t=window.ApplePaySession)||void 0===t?void 0:t.supportsVersion(3))}static canMakePayments(){var t;return this.isApplePaySupported()&&(null===(t=window.ApplePaySession)||void 0===t?void 0:t.canMakePayments())||!1}static async canMakePaymentsWithActiveCard(t){var e;if(!this.isApplePaySupported())return!1;try{return await(null===(e=window.ApplePaySession)||void 0===e?void 0:e.canMakePaymentsWithActiveCard(t))||!1}catch(t){return console.error("Error checking Apple Pay active card:",t),!1}}static formatAmount(t){return(t/100).toFixed(2)}static parseAmount(t){return Math.round(100*parseFloat(t))}static createLineItem(t,e,i="final"){return{label:t,amount:this.formatAmount(e),type:i}}static getDefaultSupportedNetworks(){return["amex","discover","masterCard","visa"]}static getDefaultMerchantCapabilities(){return[_.SUPPORTS_3DS,_.SUPPORTS_EMV,_.SUPPORTS_CREDIT,_.SUPPORTS_DEBIT]}}!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"}(R||(R={}));class F{constructor(){this.api=a()}initialize(t){if(this.applePayConfig=new U(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.host,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 Y.isApplePaySupported()&&Y.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await Y.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 B(t);if(!s.isValid){const t=[];throw s.countryCode||t.push("countryCode"),s.currencyCode||t.push("currencyCode"),s.merchantCapabilities&&0!==s.merchantCapabilities.length||t.push("merchantCapabilities"),s.supportedNetworks&&0!==s.supportedNetworks.length||t.push("supportedNetworks"),s.total&&s.total.label&&s.total.amount||t.push("total"),console.error("[ApplePayService] Payment request is invalid. Missing/invalid:",t),new Error("Invalid payment request provided")}return this.currentPaymentRequest=s,new Promise(((t,n)=>{try{if("undefined"==typeof window||!("ApplePaySession"in window))return console.error("[ApplePayService] ApplePaySession not available on window"),n({success:!1,error:{code:R.UNAVAILABLE,message:"ApplePaySession API is not available in this environment"}});this.currentSession=new window.ApplePaySession(3,s),this.setupSessionEventHandlers(t,n,e,i),this.currentSession.begin()}catch(t){console.error("[ApplePayService] Exception while starting session:",t),n({success:!1,error:{code:R.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:R.MERCHANT_VALIDATION_ERROR,message:t instanceof Error?t.message:"Merchant validation failed"}})}},this.currentSession.onpaymentauthorized=async n=>{try{const a=n.payment,o=Object.assign(Object.assign({},a.token),{product_details:{name:this.currentPaymentRequest.total.label,price:Y.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),r=await this.processPayment(i,s,o);r.success?(this.currentSession.completePayment({status:x.STATUS_SUCCESS}),t({success:!0,token:a.token,paymentMethodId:r.data.id})):(console.error("PSP reported payment failure:",r.data),this.currentSession.completePayment({status:x.STATUS_FAILURE}),e({success:!1,error:{code:R.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:x.STATUS_FAILURE}),e({success:!1,error:{code:R.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:x.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:R.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:R.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:Y.getDefaultMerchantCapabilities(),supportedNetworks:Y.getDefaultSupportedNetworks(),total:Y.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const Q=e=>{const{isLoading:i}=e;return i?t("div",{class:"container-fluid p-0"},t("div",{class:"row mb-3"},t("div",{class:"col-12 align-content-center"},t(r,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null},V=e=>t("div",{class:"apple-pay-button-container"},t("button",Object.assign({class:(()=>{let t="apple-pay-button";switch(e.buttonStyle){case z.WHITE:t+=" apple-pay-button-white";break;case z.WHITE_OUTLINE:t+=" apple-pay-button-white-outline";break;default:t+=" apple-pay-button-black"}switch(e.buttonType){case L.BUY:t+=" apple-pay-button-type-buy";break;case L.DONATE:t+=" apple-pay-button-type-donate";break;default:t+=" apple-pay-button-type-plain"}return(e.disabled||e.isProcessing||!e.isAvailable)&&(t+=" disabled"),t})(),style:{width:e.width,height:e.height},onClick:()=>{!e.disabled&&!e.isProcessing&&e.isAvailable&&e.clickHandler&&e.clickHandler()},disabled:e.disabled||e.isProcessing||!e.isAvailable,"aria-label":"Pay with Apple Pay",type:"button"},e),e.isProcessing&&t("div",{class:"processing-overlay"},t("div",{class:"spinner"}),t("span",null,"Processing..."))),t("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 ")),H=class{constructor(t){e(this,t),this.applePayStarted=i(this,"applePayStarted"),this.applePayCompleted=i(this,"applePayCompleted"),this.applePayCancelled=i(this,"applePayCancelled"),this.applePayError=i(this,"applePayError"),this.countryCode="US",this.merchantIdentifier="merchant.com.staging-justifi.checkout-dev",this.merchantDisplayName="JustiFi Checkout",this.initiativeContext="dev-checkout.justifi-staging.com",this.buttonType=L.PLAIN,this.buttonStyle=z.BLACK,this.disabled=!1,this.showSkeleton=!0,this.width="100%",this.height="48px",this.isLoading=!0,this.isProcessing=!1,this.isAvailable=!1,this.canMakePayments=!1,this.isConfigValid=!0,this.error=null,this.handleApplePayClick=async()=>{var t,e;if(!this.isProcessing&&!this.disabled&&this.isAvailable)try{this.isProcessing=!0,this.error=null,this.applePayStarted.emit();const i={countryCode:this.countryCode,currencyCode:l.paymentCurrency,merchantCapabilities:[_.SUPPORTS_3DS,_.SUPPORTS_CREDIT,_.SUPPORTS_DEBIT],supportedNetworks:Y.getDefaultSupportedNetworks(),total:Y.createLineItem(l.paymentDescription,l.paymentAmount)},s=await this.applePayService.startPaymentSession(i,l.authToken,l.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)||H.ErrorCode.PAYMENT_FAILED}))}catch(t){const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e,code:H.ErrorCode.PAYMENT_FAILED}),this.applePayCompleted.emit({success:!1,error:e})}finally{this.isProcessing=!1}}}async initializeApplePay(){try{if(this.isLoading=!0,this.error=null,this.isConfigValid=!0,!(Boolean(l.paymentAmount)&&Boolean(l.paymentCurrency)&&Boolean(l.authToken)))return this.error="Missing required Apple Pay configuration",this.isConfigValid=!1,console.error("Apple Pay config error: missing required values",{paymentAmount:l.paymentAmount,paymentCurrency:l.paymentCurrency,hasAuthToken:Boolean(l.authToken),accountId:l.accountId}),this.applePayError.emit({error:this.error,code:H.ErrorCode.CONFIG_ERROR}),void(this.isLoading=!1);if(this.isAvailable=Y.isApplePaySupported(),this.canMakePayments=Y.canMakePayments(),!this.isAvailable)return this.error="Apple Pay is not supported on this device",console.error(this.error),this.applePayError.emit({error:this.error,code:H.ErrorCode.NOT_SUPPORTED}),void(this.isLoading=!1);if(!this.canMakePayments)return this.error="Apple Pay is not available",console.error(this.error),this.applePayError.emit({error:this.error,code:H.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 F,this.applePayService.initialize(t),await this.applePayService.canMakePaymentsWithActiveCard()||console.warn("No Apple Pay cards available, but continuing...")}catch(t){console.error("Apple Pay initialization error:",t),this.error=t instanceof Error?t.message:"Failed to initialize Apple Pay",this.applePayError.emit({error:this.error,code:H.ErrorCode.INITIALIZATION_ERROR})}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?Y.getDefaultSupportedNetworks():[]}async abort(){this.applePayService.abortPaymentSession(),this.isProcessing=!1,this.applePayCancelled.emit()}render(){if(!l.applePayEnabled)return null;const e=!this.isLoading&&this.isAvailable&&this.canMakePayments&&this.isConfigValid;return t(o,null,l.checkoutLoaded&&t("script",{async:!0,src:"https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",onLoad:()=>{this.initializeApplePay()}}),t("div",{class:"apple-pay-container"},t(Q,{isLoading:this.isLoading}),e&&t(V,{buttonType:this.buttonType,buttonStyle:this.buttonStyle,disabled:this.disabled,isProcessing:this.isProcessing,isAvailable:this.isAvailable,clickHandler:this.handleApplePayClick,width:this.width,height:this.height})),t("style",null,"\n .apple-pay-container {\n width: 100%;\n }\n "))}};H.ErrorCode={CONFIG_ERROR:"CONFIG_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",NOT_AVAILABLE:"NOT_AVAILABLE",INITIALIZATION_ERROR:"INITIALIZATION_ERROR",PAYMENT_FAILED:"PAYMENT_FAILED"};const W=class{constructor(t){e(this,t)}render(){return t(o,{key:"abd92b499208321582b08a490c78c9167be2ebd4"},t("section",{key:"38e15cef5a19a43249d7ecf3d4eb4ea8e032f248"},t("div",{key:"747f811012ed9707265369e59dbde8cd7ad3bca6"},t("div",{key:"8575f50759664d5c64d235025699c81f055267ca",part:u},null==l?void 0:l.paymentDescription),t("div",{key:"af77776bbe21bce77586447bbf445e4c5d8c1165"},t("span",{key:"5cdaaec454118197b3e37a942d83907e72444342",part:u},"Total")," ",t("span",{key:"ccc35217ac9740d5a00b7abbcec4133848afcc28",part:u},y(+(null==l?void 0:l.totalAmount)))))))}},Z=class{constructor(t){e(this,t),this.levels={h1:m,h2:v,h3:g},this.level="h1"}render(){return t(o,{key:"e1d39365c2ff2c291a42b53d6bcbe1d97d602778"},t(this.levels[this.level],{key:"0b8c8c3a42ff2151e3b293cafeeaeda72e94d767",text:this.text,class:this.class}))}},q=a();class G{async getLinkToken(t,e,i,s){return q.post({endpoint:`plaid/${e}/link`,body:{checkout_id:i},authToken:t,signal:s})}async tokenizeBankAccount(t,e,i,s,n,a){const o=`plaid/${e}/tokenize`,r={public_token:i};return s&&(r.link_token_id=s),n&&(r.payment_method_group_id=n),q.post({endpoint:o,body:r,authToken:t,signal:a})}}const X=class{constructor(t){e(this,t),this.errorEvent=i(this,"error-event"),this.submitEvent=i(this,"submit-event"),this.checkoutChangedEvent=i(this,"checkout-changed"),this.plaidService=new G,this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:n}=t.detail;e&&i?(l.paymentToken=s,l.selectedPaymentMethod={type:C.APPLE_PAY},this.submitCheckout()):(console.error("Apple Pay completed but failed:",n),this.errorEvent.emit({message:(null==n?void 0:n.message)||"Apple Pay payment failed",errorCode:A.TOKENIZE_ERROR,severity:j.ERROR}))},this.handleApplePayError=t=>{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:j.ERROR})},this.handleApplePayCancelled=()=>{l.paymentToken=void 0,l.selectedPaymentMethod=void 0}}connectedCallback(){this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),l.checkoutId=this.checkoutId;const t={authToken:this.authToken,checkoutId:this.checkoutId,service:new I};this.getCheckout=(({authToken:t,checkoutId:e,service:i})=>async({onSuccess:s,onError:n})=>{var a;try{const o=await i.fetchCheckout(t,e);if(o.error)return n({error:E(o.error),code:N(null===(a=o.error)||void 0===a?void 0:a.code),severity:j.ERROR});s({checkout:o.data})}catch(t){const e=N(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:j.ERROR})}})(t),this.completeCheckout=(({authToken:t,checkoutId:e,service:i})=>async({payment:s,onSuccess:n,onError:a})=>{var o;try{const r=await i.complete(t,e,s);if(r.error)return a({error:E(r.error),code:N(null===(o=r.error)||void 0===o?void 0:o.code),severity:j.ERROR});n({checkout:r.data})}catch(t){const e=N(null==t?void 0:t.code);return a({error:t.message||t,code:e,severity:j.ERROR})}})(t),c((()=>{this.emitCheckoutChanged()}))}componentWillLoad(){this.analytics=new k(this),w(),l.authToken=this.authToken,this.fetchCheckout(),M("set",(t=>{const e=b[t];void 0!==e&&f(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})=>{this.updateStore(t),t.status!==P.completed?t.status!==P.expired||this.errorEvent.emit({message:T.CHECKOUT_EXPIRED,errorCode:A.CHECKOUT_EXPIRED,severity:j.ERROR}):this.errorEvent.emit({message:T.CHECKOUT_ALREADY_COMPLETED,errorCode:A.CHECKOUT_ALREADY_COMPLETED,severity:j.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:t.code,severity:t.severity})}}):this.errorEvent.emit({message:T.NOT_AUTHENTICATED,errorCode:A.NOT_AUTHENTICATED,severity:j.ERROR})}updateStore(t){var e,i,s,n,a,o;l.accountId=t.account_id,l.checkoutLoaded=!0,l.paymentMethods=t.payment_methods.map((t=>new D(t))),l.paymentMethodGroupId=t.payment_method_group_id,l.paymentDescription=t.payment_description,l.totalAmount=t.total_amount,l.paymentAmount=t.payment_amount,l.bnplEnabled=t.payment_settings.bnpl_payments,l.insuranceEnabled=t.payment_settings.insurance_payments,l.bankAccountVerification=null===(e=t.payment_settings)||void 0===e?void 0:e.bank_account_verification,l.applePayEnabled=null===(i=t.payment_settings)||void 0===i?void 0:i.apple_payments,l.bnplProviderClientId=null===(s=null==t?void 0:t.bnpl)||void 0===s?void 0:s.provider_client_id,l.bnplProviderMode=null===(n=null==t?void 0:t.bnpl)||void 0===n?void 0:n.provider_mode,l.bnplProviderApiVersion=null===(a=null==t?void 0:t.bnpl)||void 0===a?void 0:a.provider_api_version,l.bnplProviderCheckoutUrl=null===(o=null==t?void 0:t.bnpl)||void 0===o?void 0:o.provider_checkout_url}emitCheckoutChanged(){const t={availablePaymentMethodTypes:h(),selectedPaymentMethod:l.selectedPaymentMethod,savedPaymentMethods:l.paymentMethods};this.checkoutChangedEvent.emit(t)}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 n=null!==(i=await(null===(e=this.billingFormRef)||void 0===e?void 0:e.getValues()))&&void 0!==i?i:{},a=Object.assign(Object.assign({},t),n),o=Object.assign({accountId:l.accountId,payment_method_group_id:void 0},a);l.savePaymentMethod&&(o.payment_method_group_id=l.paymentMethodGroupId);const r=await(null===(s=this.paymentMethodFormRef)||void 0===s?void 0:s.tokenize({clientId:this.authToken,paymentMethodMetadata:o,account:l.accountId}));return r.error?r:(l.paymentToken=r.id,r.id)}async setSelectedPaymentMethod(t){l.selectedPaymentMethod=t,l.paymentToken=t.id||void 0}async validate(){var t,e;const i=[];l.insuranceEnabled&&this.insuranceFormRef&&i.push(this.insuranceFormRef.validate());const s=(null===(t=l.selectedPaymentMethod)||void 0===t?void 0:t.type)===C.NEW_CARD,n=(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)===C.NEW_BANK_ACCOUNT;if((s||n)&&(this.paymentMethodFormRef&&i.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&i.push(this.billingFormRef.validate())),0===i.length)return!0;try{return!!(await Promise.all(i)).every((t=>"boolean"==typeof t?t:!1!==(null==t?void 0:t.isValid)))||(this.errorEvent.emit({message:"Validation error",errorCode:A.VALIDATION_ERROR,severity:j.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){var e,i,s,n,a;const o=await this.validate();if(!l.selectedPaymentMethod)return void this.errorEvent.emit({message:"No payment method selected.",errorCode:A.VALIDATION_ERROR,severity:j.ERROR});const r=(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)===C.NEW_CARD,c=(null===(i=l.selectedPaymentMethod)||void 0===i?void 0:i.type)===C.NEW_BANK_ACCOUNT,h=(null===(s=l.selectedPaymentMethod)||void 0===s?void 0:s.type)===C.PLAID;if(r||c){const e=await this.tokenizePaymentMethod(t);if(null==e?void 0:e.error)return void this.errorEvent.emit({message:e.error.message,errorCode:A.TOKENIZE_ERROR,severity:j.ERROR})}if(h&&!l.paymentToken){const t=l.plaidPublicToken,e=l.plaidLinkTokenId;if(!t)return void this.errorEvent.emit({message:"Missing Plaid public token. Please connect your bank.",errorCode:A.TOKENIZE_ERROR,severity:j.ERROR});try{const i=await this.plaidService.tokenizeBankAccount(l.authToken,l.accountId,t,e||void 0,l.savePaymentMethod?l.paymentMethodGroupId:void 0);if(null==i?void 0:i.error)return void this.errorEvent.emit({message:"string"==typeof i.error?i.error:i.error.message||"Failed to tokenize bank account",errorCode:A.TOKENIZE_ERROR,severity:j.ERROR});const s=null==i?void 0:i.data,a=(null===(n=null==s?void 0:s.bank_account)||void 0===n?void 0:n.token)||(null==s?void 0:s.token)||(null==s?void 0:s.id);l.paymentToken=a}catch(t){return void this.errorEvent.emit({message:(null==t?void 0:t.message)||"Plaid exchange error",errorCode:A.TOKENIZE_ERROR,severity:j.ERROR})}}if(!o)return void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:A.VALIDATION_ERROR,severity:j.ERROR});if(!l.paymentToken)return void this.errorEvent.emit({message:"Payment token not found.",errorCode:A.TOKENIZE_ERROR,severity:j.ERROR});let d;d={payment_mode:(t=>{switch(t){case C.NEW_CARD:case C.SAVED_CARD:case C.NEW_BANK_ACCOUNT:case C.SAVED_BANK_ACCOUNT:case C.PLAID:return S.ECOM;case C.SEZZLE:return S.BNPL;case C.APPLE_PAY:return S.APPLE_PAY;default:return}})(null===(a=l.selectedPaymentMethod)||void 0===a?void 0:a.type),payment_token:l.paymentToken},this.completeCheckout({payment:d,onSuccess:({checkout:t})=>{this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:A.COMPLETE_CHECKOUT_ERROR,severity:j.ERROR})}})}render(){return t(s,{key:"a3619798ffe1de168262d61d7855209b46b01ab5"})}get hostEl(){return n(this)}};var J;!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"}(J||(J={}));const K={[J.PLAID_SDK_LOAD_FAILED]:"Unable to load Plaid. Please refresh the page and try again.",[J.PLAID_LINK_INIT_FAILED]:"Unable to initialize bank connection. Please try again.",[J.PLAID_LINK_TOKEN_FAILED]:"Unable to connect to bank service. Please try again.",[J.PLAID_AUTHENTICATION_FAILED]:"Bank authentication failed. Please try again.",[J.PLAID_BANK_NOT_SUPPORTED]:"Your bank is not currently supported. Please try a different payment method.",[J.PLAID_TOKEN_EXPIRED]:"Your bank session has expired. Please reconnect your account.",[J.PLAID_NETWORK_ERROR]:"Network connection issue. Please check your internet connection and try again.",[J.PLAID_USER_CANCELLED]:"Bank connection was cancelled. Click to try again.",[J.PLAID_TIMEOUT]:"Bank connection timed out. Please try again.",[J.PLAID_INVALID_CREDENTIALS]:"Invalid bank credentials. Please check your username and password.",[J.PLAID_ACCOUNT_LOCKED]:"Your bank account is temporarily locked. Please contact your bank.",[J.PLAID_MAINTENANCE]:"Bank service is temporarily unavailable. Please try again later.",[J.PLAID_RATE_LIMITED]:"Too many connection attempts. Please wait a moment and try again."},$={[J.PLAID_SDK_LOAD_FAILED]:j.ERROR,[J.PLAID_LINK_INIT_FAILED]:j.ERROR,[J.PLAID_LINK_TOKEN_FAILED]:j.ERROR,[J.PLAID_AUTHENTICATION_FAILED]:j.ERROR,[J.PLAID_BANK_NOT_SUPPORTED]:j.WARNING,[J.PLAID_TOKEN_EXPIRED]:j.WARNING,[J.PLAID_NETWORK_ERROR]:j.WARNING,[J.PLAID_USER_CANCELLED]:j.INFO,[J.PLAID_TIMEOUT]:j.WARNING,[J.PLAID_INVALID_CREDENTIALS]:j.ERROR,[J.PLAID_ACCOUNT_LOCKED]:j.ERROR,[J.PLAID_MAINTENANCE]:j.WARNING,[J.PLAID_RATE_LIMITED]:j.WARNING},tt=class{constructor(t){e(this,t),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 G,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{l.authToken&&l.accountId&&l.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:J.PLAID_SDK_LOAD_FAILED,message:K[J.PLAID_SDK_LOAD_FAILED],severity:$[J.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:J.PLAID_LINK_TOKEN_FAILED,message:K[J.PLAID_LINK_TOKEN_FAILED],severity:$[J.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:J.PLAID_LINK_INIT_FAILED,message:K[J.PLAID_LINK_INIT_FAILED],severity:$[J.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,s,n;try{if(!l.authToken||!l.accountId)return void this.handleError({code:J.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:j.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(l.authToken,l.accountId,l.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&&(l.plaidLinkTokenId=this.linkTokenId)}catch(t){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let a=J.PLAID_LINK_TOKEN_FAILED,o=K[a],r=!0;"AbortError"===t.name?(a=J.PLAID_TIMEOUT,o=K[a],r=!0):(null===(e=t.message)||void 0===e?void 0:e.includes("network"))||(null===(i=t.message)||void 0===i?void 0:i.includes("fetch"))?(a=J.PLAID_NETWORK_ERROR,o=K[a],r=!0):((null===(s=t.message)||void 0===s?void 0:s.includes("401"))||(null===(n=t.message)||void 0===n?void 0:n.includes("unauthorized")))&&(a=J.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:a,message:o,severity:$[a],originalError:t,retryable:r,userAction:r?"Click to try again":"Refresh the page"})}},this.mapApiErrorToPlaidError=t=>{if("string"==typeof t){if(t.includes("rate_limit"))return J.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return J.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return J.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return J.PLAID_RATE_LIMITED;case"maintenance":return J.PLAID_MAINTENANCE;case"not_authenticated":return J.PLAID_INVALID_CREDENTIALS;default:return J.PLAID_LINK_TOKEN_FAILED}return J.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,l.selectedPaymentMethod={type:C.PLAID}),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:j.INFO}),l.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=J.PLAID_AUTHENTICATION_FAILED,i=K[e],s=!0,n="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=J.PLAID_INVALID_CREDENTIALS,i=K[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=J.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=J.PLAID_ACCOUNT_LOCKED,i=K[e],s=!1,n="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=J.PLAID_MAINTENANCE,i=K[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=J.PLAID_RATE_LIMITED,i=K[e],s=!0;break;case"INVALID_REQUEST":e=J.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=J.PLAID_AUTHENTICATION_FAILED,i=t.error_message||"Bank authentication failed. Please try again.",s=!0;break;default:t.error_message&&(i=t.error_message)}if(t.error_message){const a=t.error_message.toLowerCase();a.includes("not supported")||a.includes("unsupported")?(e=J.PLAID_BANK_NOT_SUPPORTED,i=K[e],s=!1,n="Try a different payment method"):(a.includes("expired")||a.includes("timeout"))&&(e=J.PLAID_TOKEN_EXPIRED,i=K[e],s=!0)}this.handleError({code:e,message:i,severity:$[e],originalError:t,retryable:s,userAction:n}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.plaidError.emit({code:t.code,message:t.message,severity:t.severity,data:{originalError:t.originalError,retryable:t.retryable,userAction:t.userAction,retryCount:this.retryCount}}),console.error("Plaid error:",t),t.retryable&&this.retryCount<this.maxRetries&&this.scheduleRetry()},this.scheduleRetry=()=>{this.isRetrying||(this.isRetrying=!0,this.retryCount++,setTimeout((()=>{this.isRetrying=!1,this.clearError(),this.waitForStoreAndInitialize()}),this.retryDelay*this.retryCount))},this.clearError=()=>{this.error&&(this.error=null,this.retryCount=0)},this.syncWithStore=()=>{var t;const e=(null===(t=l.selectedPaymentMethod)||void 0===t?void 0:t.type)===C.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)!==C.PLAID&&(l.selectedPaymentMethod={type:C.PLAID}),!t||!this.plaidLink||this.publicToken||this.isAuthenticating||this.error||this.openPlaidLink()}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.waitForStoreAndInitialize()},this.scriptRef.onerror=()=>{this.handleError({code:J.PLAID_SDK_LOAD_FAILED,message:K[J.PLAID_SDK_LOAD_FAILED],severity:$[J.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})})}componentWillLoad(){var t;this.isSelected=(null===(t=l.selectedPaymentMethod)||void 0===t?void 0:t.type)===C.PLAID}async resolvePaymentMethod(){return this.publicToken?{token:this.publicToken,data:{type:"bank_account",plaid_public_token:this.publicToken}}:{validationError:!0}}async getPaymentToken(){return l.paymentToken}async handleSelectionClick(){if(this.isSelected=!0,l.selectedPaymentMethod={type:C.PLAID},this.error)return this.clearError(),void this.waitForStoreAndInitialize();!this.plaidLink||this.publicToken||this.isAuthenticating||this.openPlaidLink()}async setSelected(t){this.isSelected=t,t&&(l.selectedPaymentMethod={type:C.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=d("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(!0!==l.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[PlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const e=t("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 t(o,{class:"payment-method"},t("script",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",async:!0,ref:t=>this.scriptRef=t}),t("div",{title:"Pay with Plaid"},t("div",{onClick:t=>{t.preventDefault(),this.handleSelectionClick()}},"Pay with Bank Account ",e," "),(()=>this.error?t("div",{class:(this.error.severity===j.ERROR?"text-danger":this.error.severity===j.WARNING?"text-warning":"text-info")+" mt-2"},t("small",null,this.error.message),t("br",null),t("small",{class:"text-muted"},this.error.userAction,this.error.retryable&&this.retryCount<this.maxRetries&&t("span",null," • Auto-retry in progress..."))):null)(),(()=>this.error?null:this.isAuthenticating?t("div",{class:"text-info mt-2"},t("small",null,"Connecting to your bank...")):this.publicToken?t("div",{class:"text-success mt-2"},t("small",null,"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:t("div",{class:"text-muted mt-2"},t("small",null,"Click to connect your bank account")))()))}static get watchers(){return{isSelected:["onSelectionChange"]}}},et=class{constructor(t){e(this,t),this.onPaymentMethodOptionClick=t=>e=>{e.preventDefault(),l.selectedPaymentMethod={id:t.id,type:t.type},l.paymentToken=t.id},this.isAllowedPaymentMethod=t=>!(t===C.SAVED_CARD&&l.disableCreditCard||t===C.SAVED_BANK_ACCOUNT&&l.disableBankAccount)}componentWillLoad(){l.paymentMethods.length||console.warn("No saved payment methods available."),l.disablePaymentMethodGroup&&console.warn("Payment method group is disabled.")}render(){return l.disablePaymentMethodGroup?null:t(o,null,t("div",{class:"saved-payment-methods"},l.paymentMethods.length?l.paymentMethods.filter((t=>this.isAllowedPaymentMethod(t.type))).map((e=>t("div",{class:"radio-list-item p-3",part:p,onClick:this.onPaymentMethodOptionClick(e)},t("form-control-radio",{name:"paymentMethodType",value:null==e?void 0:e.id,checked:l.paymentToken===(null==e?void 0:e.id),label:`${O[null==e?void 0:e.brand]||""} *${null==e?void 0:e.acct_last_four}`})))):null))}},it=t("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"}}),st=class{constructor(t){e(this,t),this.paymentMethodOptionSelected=i(this,"paymentMethodOptionSelected"),this.paymentMethodOptionId=C.SEZZLE,this.initializeSezzleCheckout=()=>{let t;this.sezzlePromise=new Promise((e=>{t=e}));const e=Number(l.paymentAmount),i=new(0,window.Checkout)({mode:"popup",publicKey:l.bnplProviderClientId,apiMode:l.bnplProviderMode,apiVersion:l.bnplProviderApiVersion});i.sezzleButtonElement=this.sezzleButtonRef,i.init({onClick:function(t){t.preventDefault(),i.startCheckout({checkout_url:l.bnplProviderCheckoutUrl})},onComplete:e=>t({bnpl:e.data}),onCancel:e=>t({bnpl:e.data}),onFailure:e=>t({bnpl:e.data})}),this.sezzleCheckout=i,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(e)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()})}async resolvePaymentMethod(t){return t.isValid?(this.sezzleButtonRef.click(),this.sezzlePromise):{validationError:!0}}async handleSelectionClick(){l.selectedPaymentMethod={type:C.SEZZLE},this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)}render(){var e,i;return l.bnplEnabled?t(o,{class:"payment-method"},t("script",{src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),t("div",null,t("div",null,"Buy now, pay later with ",it),this.installmentPlan&&t("small",null,t("span",null,null===(e=this.installmentPlan)||void 0===e?void 0:e.installments.length)," ",t("span",null,this.installmentPlan.schedule," payments of")," ",t("span",{class:"fw-bold"},y(null===(i=this.installmentPlan)||void 0===i?void 0:i.installments[0].amountInCents))))):(console.warn("justifi-sezzle-payment-method: BNPL is not enabled for this account."),null)}},nt={[C.NEW_BANK_ACCOUNT]:"New bank account",[C.NEW_CARD]:"New credit or debit card"},at="Payment form not ready",ot="Validation error",rt=class{constructor(t){e(this,t),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(){w(),this.analytics=new k(this)}handleRadioClick(t){this.selectedPaymentMethod=t.detail,l.selectedPaymentMethod={type: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:A.TOKENIZE_ERROR,message:ot}),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(A.TOKENIZE_ERROR,t.message);return this.emitError({errorCode:A.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:at}};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||l.authToken,account:this.accountId||l.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||l.authToken||this.emitError({errorCode:A.TOKENIZE_ERROR,message:"Auth token is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"}),this.accountId||l.accountId||this.emitError({errorCode:A.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=C.NEW_BANK_ACCOUNT,l.selectedPaymentMethod={type:C.NEW_BANK_ACCOUNT}):(this.selectedPaymentMethod=C.NEW_CARD,l.selectedPaymentMethod={type:C.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(C.NEW_CARD),this.disableBankAccount||t.push(C.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:j.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",at);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||ot;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||l.paymentMethodGroupId}get shouldSavePaymentMethod(){return!(!this.paymentMethodGroupId&&!l.savePaymentMethod)}get shouldHideRadioInput(){return this.disableCreditCard||this.disableBankAccount}renderPaymentMethodOption(e){const i=this.selectedPaymentMethod===e&&void 0===l.selectedPaymentMethod.id;return t("div",{class:"payment-method"},t("justifi-radio-list-item",{name:"paymentMethodType",value:e,checked:i,label:nt[e],hidden:this.shouldHideRadioInput}),i&&this.renderSelectedPaymentMethodForm(e))}renderSelectedPaymentMethodForm(e){return t("div",{class:"mt-4 pb-4"},this.renderPaymentMethodForm(e),t("div",{class:"mt-4"},t("justifi-billing-form",{ref:t=>this.billingFormRef=t,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:e})),t("div",{class:"mt-4"},t("justifi-save-new-payment-method",{hidden:!this.paymentMethodGroupID,label:this.savePaymentMethodLabel})))}renderPaymentMethodForm(e){return t(e===C.NEW_CARD?"justifi-card-form":"justifi-bank-account-form",{ref:t=>this.paymentMethodFormRef=t})}render(){return t(o,{key:"bf221d17739bf70c3f581f3b9791a725e76c3f35"},t("form",{key:"df117d42d4160f31df1fca5d6903967cc48ad573"},t("fieldset",{key:"550e670feffb405c669d44c44eb9073f535c6cb6"},t("div",{key:"8eff7d3ab19618da54161220b92641bf19bfa82d",class:"row gy-3"},t("div",{key:"bf9d19e92be74abf48ce65c97efb3f9df52d4c3c",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),t("div",{key:"eef1f4e1e03c2263efb51ae94085c5a3d73a9166",class:"col-12"},t("justifi-button",{key:"f0e5697e658236610da45c34e64a8cbb3f0f9d95",text:this.submitButtonText,variant:"primary",type:"submit",clickHandler:t=>this.tokenizePaymentMethod(t),isLoading:this.isLoading,"data-testid":"submit-button",hidden:this.computedHideSubmitButton}))))))}get host(){return n(this)}static get watchers(){return{disableCreditCard:["paymentMethodsChanged"],disableBankAccount:["paymentMethodsChanged"]}}};export{H as justifi_apple_pay,W as justifi_checkout_summary,Z as justifi_header,X as justifi_modular_checkout,tt as justifi_plaid_payment_method,et as justifi_saved_payment_methods,st as justifi_sezzle_payment_method,rt as justifi_tokenize_payment_method}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-DOjVAAtq.js";import{C as o,a as r}from"./p-Cjcsf8ku.js";import{c as e,J as a}from"./p-D5Jb9OcR.js";import{P as p}from"./p-8S_ROmnq.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{d as n}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as c,a as h}from"./p-D2muobcE.js";import{m}from"./p-DYGIC0QH.js";import{m as u,S as d}from"./p-DfV3dFDB.js";import{S as j}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{d as l}from"./p-D0Peuz-m.js";import"./p-DL-q4EcN.js";import"./p-DdZLLkQ5.js";import"./p-Bgnhf5c9.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-au49QgoI.js";import"./p-hbWSMN3O.js";import"./p-xDbRW9xn.js";const f=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=l,this.handleOnError=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){e(),this.analytics=new a(this),this.initializeGetData()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializePayoutsServices(),this.initializeGetSubAccounts()}initializePayoutsServices(){if(this.accountId&&this.authToken){const t={id:this.accountId,authToken:this.authToken,service:new p};this.getPayouts=(({id:t,authToken:s,service:i})=>async({params:r,onSuccess:e,onError:a})=>{var p,m;try{const u=await i.fetchPayouts(t,s,r);if(u.error)return a({error:h(u.error),code:c(null===(m=u.error)||void 0===m?void 0:m.code),severity:o.ERROR});{const t=Object.assign({},u.page_info);e({payouts:(null===(p=u.data)||void 0===p?void 0:p.map((t=>new n(t))))||[],pagingInfo:t})}}catch(t){const s=c(null==t?void 0:t.code);return a({error:t.message||t,code:s,severity:o.ERROR})}})(t),this.getPayoutCSV=m(t)}else this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:r.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR})}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=u({accountId:this.accountId,authToken:this.authToken,service:new d}))}render(){return i(j,{key:"fb8e3e21a4e5a0aa971a91eed4ef0b603dbd1b23"},i("payouts-list-core",{key:"c9fb97bd0d77d1989f346285cd5124121ad4ac83",getPayouts:this.getPayouts,getPayoutCSV:this.getPayoutCSV,getSubAccounts:this.getSubAccounts,"onError-event":this.handleOnError,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_payouts_list}
1
+ import{r as t,c as s,h as i}from"./p-DOjVAAtq.js";import{C as o,a as r}from"./p-Cjcsf8ku.js";import{c as e,J as a}from"./p-l8F_7Ihw.js";import{P as p}from"./p-8S_ROmnq.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{d as n}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as h,a as c}from"./p-D2muobcE.js";import{m}from"./p-DYGIC0QH.js";import{m as u,S as d}from"./p-DfV3dFDB.js";import{S as j}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{d as l}from"./p-D0Peuz-m.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-Bgnhf5c9.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-au49QgoI.js";import"./p-hbWSMN3O.js";import"./p-xDbRW9xn.js";const f=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=l,this.handleOnError=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){e(),this.analytics=new a(this),this.initializeGetData()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializePayoutsServices(),this.initializeGetSubAccounts()}initializePayoutsServices(){if(this.accountId&&this.authToken){const t={id:this.accountId,authToken:this.authToken,service:new p};this.getPayouts=(({id:t,authToken:s,service:i})=>async({params:r,onSuccess:e,onError:a})=>{var p,m;try{const u=await i.fetchPayouts(t,s,r);if(u.error)return a({error:c(u.error),code:h(null===(m=u.error)||void 0===m?void 0:m.code),severity:o.ERROR});{const t=Object.assign({},u.page_info);e({payouts:(null===(p=u.data)||void 0===p?void 0:p.map((t=>new n(t))))||[],pagingInfo:t})}}catch(t){const s=h(null==t?void 0:t.code);return a({error:t.message||t,code:s,severity:o.ERROR})}})(t),this.getPayoutCSV=m(t)}else this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:r.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR})}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=u({accountId:this.accountId,authToken:this.authToken,service:new d}))}render(){return i(j,{key:"fb8e3e21a4e5a0aa971a91eed4ef0b603dbd1b23"},i("payouts-list-core",{key:"c9fb97bd0d77d1989f346285cd5124121ad4ac83",getPayouts:this.getPayouts,getPayoutCSV:this.getPayoutCSV,getSubAccounts:this.getSubAccounts,"onError-event":this.handleOnError,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_payouts_list}
@@ -0,0 +1 @@
1
+ var e={name:"@justifi/webcomponents",version:"6.1.1"};export{e as p}
@@ -1 +1 @@
1
- import{r as e,c as t,h as a,H as i}from"./p-DOjVAAtq.js";import{c as s,F as d}from"./p-DiJD6Iqx.js";import{k as r,l as c,m as n,n as l,q as o,y as h}from"./p-PSJOKMWp.js";import{r as f,aw as b}from"./p-xDbRW9xn.js";import{S as m}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{S as p}from"./p-T2yENPvU.js";import{c as u,J as y}from"./p-D5Jb9OcR.js";import{w as v,c as k}from"./p-a6tcNl_T.js";import{P as g}from"./p-DCIW8z1f.js";import{H as j}from"./p-BoQ6_4Ks.js";import{n as _}from"./p-BnjCmwMr.js";import{S as w}from"./p-BX8GieXu.js";import{B as x}from"./p-C9EQ459H.js";import{c as V}from"./p-DGsXKF67.js";import"./p-BFTU3MAI.js";import"./p-yH3TC3ZQ.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-DL-q4EcN.js";import"./p-DdZLLkQ5.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-Cjcsf8ku.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-DdMxswn1.js";const H=class{constructor(a){e(this,a),this.radioClick=t(this,"radio-click"),this.checked=!1,this.hidden=!1,this.handleClick=()=>{this.radioClick.emit(this.value)}}render(){return a(m,{key:"1ae40f787970160e38b72f917bda96f480d2a890"},a("div",{key:"2130596c8294cc38365e6126806735da0f93ef4a",class:`radio-list-item p-3 ${this.class||""}`,part:f,onClick:this.handleClick,hidden:this.hidden},a("form-control-radio",{key:"7d5524f518430f2bfd1c9863f354318929353cfb",name:this.name,value:this.value,checked:this.checked,label:this.label,inputHandler:()=>null})))}},O=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new d(s({name:h.required("Enter full name"),address_line1:o.nullable(),address_line2:l.nullable(),address_city:n.nullable(),address_state:c.nullable(),address_postal_code:r.nullable()}))}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return a(m,{key:"fc6e23e6f8b64b5635dbeea93b9d5fe261dc772c"},a("div",{key:"05b37c65fe24ddcb546e204350996976f5a53eea",part:b,class:"mt-4"},a("form",{key:"b02df8adf96ac298b15bfb744177524f0c067254"},a("fieldset",{key:"83d292caaa4322fbf151bf5bdac007ea13ea0b7e"},this.legend&&a("legend",{key:"bf956b7714776d01869e4bf740b5ee75d758a2cc"},this.legend),a("div",{key:"7095362ffbba89a5b6396921e8c5c05d144a9a5b",class:"row gy-3"},a("div",{key:"36dc450d4411e5755cff8b76fceba7e7cff516c8",class:"col-12"},a("form-control-text",{key:"ea52769979280cde0854cbf9fe12fa4abe40b769",name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})))))))}},C=e=>{const{isReady:t}=e;return t?null:a("div",{class:"container-fluid p-0"},a("div",{class:"row mb-3"},a("div",{class:"col-12 align-content-end"},a(p,{height:"18px",width:"120px"}),a(p,{height:"36px"}))),a("div",{class:"row"},a("div",{class:"col-12 align-content-end"},a(p,{height:"18px",width:"110px"}),a(p,{height:"36px"}))))},D=class{constructor(t){e(this,t),this.isReady=!1}async componentWillLoad(){await v(),this.iframeOrigin=k.iframeOrigin,u(),this.analytics=new y(this)}componentDidRender(){Promise.all([this.accountNumberIframeElement,this.routingNumberIframeElement].map((e=>new Promise((t=>{e.addEventListener("iframeLoaded",(()=>{t()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}async validate(){const e=await this.accountNumberIframeElement.validate(),t=await this.routingNumberIframeElement.validate();return e&&t}async tokenize({clientId:e,paymentMethodMetadata:t,account:a}){return this.accountNumberIframeElement.tokenize(e,t,a)}render(){return a(m,{key:"a2fd28c8b8202e0d702d02761cbcf3f568298265"},a(C,{key:"6777d110d3ccf3a688a763687c7087a3520643ac",isReady:this.isReady}),a("hidden-input",{key:"513e1cdaaf464a741d4312a6d359c4af665e0ade"}),a("div",{key:"2b4e473c7bb062a78148537d2cad02caf503330d",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},a("div",{key:"e706151f3e04835efab49fc0fb7a48f4657ab2c4",class:"row mb-3"},a("iframe-input",{key:"a70e0deac68d04f9ffa37790c33d801cfce8dc46",inputId:"accountNumber",ref:e=>this.accountNumberIframeElement=e,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber`})),a("div",{key:"3f488f86388b2fc797c49ddc81c7de3a815ca74f",class:"row"},a("iframe-input",{key:"a09d3cec373c5bab5b38ebc090724178e65d2de2",inputId:"routingNumber",ref:e=>this.routingNumberIframeElement=e,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber`}))))}},L=class{constructor(t){e(this,t)}get showSimpleCardBillingForm(){return this.paymentMethodType===g.NEW_CARD&&this.hideCardBillingForm}get showSimpleBankAccountBillingForm(){return this.paymentMethodType===g.NEW_BANK_ACCOUNT&&this.hideBankAccountBillingForm}async getValues(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.getValues()}async fill(e){var t;null===(t=this.selectedFormRef)||void 0===t||t.fill(e)}async validate(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.validate()}render(){return a(i,null,a(this.showSimpleBankAccountBillingForm?"justifi-bank-account-billing-form-simple":this.showSimpleCardBillingForm?"justifi-card-billing-form-simple":"justifi-billing-form-full",{legend:this.legend,ref:e=>this.selectedFormRef=e}))}},N=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new d(s({name:h.required("Enter full name"),address_line1:o.required("Enter street address"),address_line2:l.nullable(),address_city:n.required("Enter city"),address_state:c.required("Select state"),address_postal_code:r.required("Enter postal code")})),this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){if(!this.formController)return null;const e=this.formController.getInitialValues();return a(m,null,a("div",{part:b,class:"mt-4"},a(j,{text:"Billing address",class:"fs-6 fw-bold lh-lg mb-4"}),a("form",null,a("fieldset",null,this.legend&&a("legend",null,this.legend),a("div",{class:"row gy-3"},a("div",{class:"col-12"},a("form-control-text",{name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_line1",label:"Street Address",defaultValue:e.address_line1,errorText:this.errors.address_line1,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:e.address_line2,errorText:this.errors.address_line2,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_city",label:"City",defaultValue:e.address_city,errorText:this.errors.address_city,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-select",{name:"address_state",label:"State",options:w,defaultValue:e.address_state,errorText:this.errors.address_state,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_postal_code",label:"ZIP",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:_})))))))}},B=class{constructor(t){e(this,t),this.variant="primary",this.type="button"}render(){return a(m,{key:"7c146b9ccaf8c4c37adde6c8af054dc4796d78bd"},a(x,{key:"879d05664b808abcbc32a38bc98fcd673dba0dea",variant:this.variant,isLoading:this.isLoading,clickHandler:this.clickHandler,class:this.class,type:this.type,disabled:this.disabled,style:this.customStyle},this.text))}},M=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new d(s({name:h.nullable(),address_line1:o.nullable(),address_line2:l.nullable(),address_city:n.nullable(),address_state:c.nullable(),address_postal_code:r.required("Enter postal code")}))}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return a(m,{key:"26fd30b96e63f0adac380f70fae5cb4b80d9b36f"},a("div",{key:"79558919d544889647d034bdc415f9b404d4a058",part:b},a("form",{key:"21b722098010050f4a22b1e3cc995090c50a9f74"},a("fieldset",{key:"f371a839f16363d8242a38469c78eba1759e46a7"},this.legend&&a("legend",{key:"45b9d4d5b0dd502f5ebca9c357cdf6b75a16f9e1"},this.legend),a("div",{key:"ae1c10a2bae0061dd2aa0645e7d1f8c8ed899444",class:"row gy-3"},a("div",{key:"cd99d74f2803336bd0b25c7a962ef95fa66079ba",class:"col-12"},a("form-control-text",{key:"6ac34b703ae83a9e6c4c86b3c239795c5a7d0d57",name:"address_postal_code",label:"ZIP",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:_})))))))}},I=e=>{const{isReady:t}=e;return t?null:a("div",{class:"container-fluid p-0"},a("div",{class:"mb-3"},a(p,{height:"18px",width:"100px"}),a(p,{height:"36px"})),a("div",{class:"row"},a("div",{class:"col-4 align-content-end"},a(p,{height:"18px",width:"80px"}),a(p,{height:"36px"})),a("div",{class:"col-4 align-content-end"},a(p,{height:"36px"})),a("div",{class:"col-4 align-content-end"},a(p,{height:"18px",width:"30px"}),a(p,{height:"36px"}))))},S=class{constructor(t){e(this,t),this.isReady=!1}async componentWillLoad(){await v(),this.iframeOrigin=k.iframeOrigin,u(),this.analytics=new y(this)}componentDidRender(){Promise.all([this.cardNumberIframeElement,this.expirationMonthIframeElement,this.expirationYearIframeElement,this.cvvIframeElement].map((e=>new Promise((t=>{e.addEventListener("iframeLoaded",(()=>{t()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}async validate(){const e=await this.cardNumberIframeElement.validate(),t=await this.expirationMonthIframeElement.validate(),a=await this.expirationYearIframeElement.validate(),i=await this.cvvIframeElement.validate();return e&&t&&a&&i}async tokenize({clientId:e,paymentMethodMetadata:t,account:a}){return this.cardNumberIframeElement.tokenize(e,t,a)}render(){return a(m,{key:"64d9bda2ce54aa06788509ae294bcb1eefdb173a"},a(I,{key:"a1f233464393512652fc37a31b769bb9f48f3797",isReady:this.isReady}),a("hidden-input",{key:"4405ec6e9a510f670a137d33c83a5ad38a19a0aa"}),a("div",{key:"e704d33d8b3cbcd55798afb537b2b16d37d0077d",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},a("div",{key:"c519dafa0657af1372836a2a30301849f2e422b3",class:"mb-3"},a("iframe-input",{key:"6c6a0154ed62e0e684784ff0f327e3bc282da10c",inputId:"cardNumber",ref:e=>this.cardNumberIframeElement=e,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber`})),a("div",{key:"7efcb6e9fed504ea8f0470f55b8c48b7d82b537b",class:"row"},a("div",{key:"e216e57f82d04325cedeca9f3945285ab8675c7d",class:"col-4 align-content-end"},a("iframe-input",{key:"c3ffef01705152180c66adaf482e67a1d2f114e9",inputId:"expirationMonth",ref:e=>this.expirationMonthIframeElement=e,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth`})),a("div",{key:"97666cb9d9e4b272c033913527c4b6a60b6067c5",class:"col-4 align-content-end"},a("iframe-input",{key:"4d2f7f56f2a0d5717776c6ef164eef5f7dbc4d8d",inputId:"expirationYear",ref:e=>this.expirationYearIframeElement=e,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear`})),a("div",{key:"ecc6fff75106b265a7cb00febef40a7b14651a0a",class:"col-4 align-content-end"},a("iframe-input",{key:"9a756344f1d47f69c0702b57d15d66a658b57e3d",inputId:"CVV",ref:e=>this.cvvIframeElement=e,label:"CVV",iframeOrigin:`${this.iframeOrigin}/v2/CVV`})))))}},P=class{constructor(a){e(this,a),this.checkboxChanged=t(this,"checkboxChanged"),this.label="Save New Payment Method",this.isChecked=!1,this.handleCheckboxChange=(e,t)=>{this.isChecked=t,V.savePaymentMethod=t,this.checkboxChanged.emit(this.isChecked)}}render(){return a(m,{key:"04ed1491d4f5ca3e03a8a1f7a46dff5a0eb888de"},a("form-control-checkbox",{key:"7901643960e9d5d26c5916fb6e06601a6b59906a",label:this.label||"Save New Payment Method",name:"saveNewPaymentMethod",checked:this.isChecked,inputHandler:this.handleCheckboxChange}))}};export{O as justifi_bank_account_billing_form_simple,D as justifi_bank_account_form,L as justifi_billing_form,N as justifi_billing_form_full,B as justifi_button,M as justifi_card_billing_form_simple,S as justifi_card_form,H as justifi_radio_list_item,P as justifi_save_new_payment_method}
1
+ import{r as e,c as t,h as a,H as i}from"./p-DOjVAAtq.js";import{c as s,F as d}from"./p-DiJD6Iqx.js";import{k as r,l as c,m as n,n as l,q as o,y as h}from"./p-PSJOKMWp.js";import{r as f,aw as b}from"./p-xDbRW9xn.js";import{S as m}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{S as p}from"./p-T2yENPvU.js";import{c as u,J as y}from"./p-l8F_7Ihw.js";import{w as v,c as k}from"./p-a6tcNl_T.js";import{P as g}from"./p-DCIW8z1f.js";import{H as _}from"./p-BoQ6_4Ks.js";import{n as j}from"./p-BnjCmwMr.js";import{S as w}from"./p-BX8GieXu.js";import{B as x}from"./p-C9EQ459H.js";import{c as V}from"./p-DGsXKF67.js";import"./p-BFTU3MAI.js";import"./p-yH3TC3ZQ.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-Cjcsf8ku.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-DdMxswn1.js";const C=class{constructor(a){e(this,a),this.radioClick=t(this,"radio-click"),this.checked=!1,this.hidden=!1,this.handleClick=()=>{this.radioClick.emit(this.value)}}render(){return a(m,{key:"1ae40f787970160e38b72f917bda96f480d2a890"},a("div",{key:"2130596c8294cc38365e6126806735da0f93ef4a",class:`radio-list-item p-3 ${this.class||""}`,part:f,onClick:this.handleClick,hidden:this.hidden},a("form-control-radio",{key:"7d5524f518430f2bfd1c9863f354318929353cfb",name:this.name,value:this.value,checked:this.checked,label:this.label,inputHandler:()=>null})))}},H=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new d(s({name:h.required("Enter full name"),address_line1:o.nullable(),address_line2:l.nullable(),address_city:n.nullable(),address_state:c.nullable(),address_postal_code:r.nullable()}))}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return a(m,{key:"fc6e23e6f8b64b5635dbeea93b9d5fe261dc772c"},a("div",{key:"05b37c65fe24ddcb546e204350996976f5a53eea",part:b,class:"mt-4"},a("form",{key:"b02df8adf96ac298b15bfb744177524f0c067254"},a("fieldset",{key:"83d292caaa4322fbf151bf5bdac007ea13ea0b7e"},this.legend&&a("legend",{key:"bf956b7714776d01869e4bf740b5ee75d758a2cc"},this.legend),a("div",{key:"7095362ffbba89a5b6396921e8c5c05d144a9a5b",class:"row gy-3"},a("div",{key:"36dc450d4411e5755cff8b76fceba7e7cff516c8",class:"col-12"},a("form-control-text",{key:"ea52769979280cde0854cbf9fe12fa4abe40b769",name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})))))))}},O=e=>{const{isReady:t}=e;return t?null:a("div",{class:"container-fluid p-0"},a("div",{class:"row mb-3"},a("div",{class:"col-12 align-content-end"},a(p,{height:"18px",width:"120px"}),a(p,{height:"36px"}))),a("div",{class:"row"},a("div",{class:"col-12 align-content-end"},a(p,{height:"18px",width:"110px"}),a(p,{height:"36px"}))))},L=class{constructor(t){e(this,t),this.isReady=!1}async componentWillLoad(){await v(),this.iframeOrigin=k.iframeOrigin,u(),this.analytics=new y(this)}componentDidRender(){Promise.all([this.accountNumberIframeElement,this.routingNumberIframeElement].map((e=>new Promise((t=>{e.addEventListener("iframeLoaded",(()=>{t()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}async validate(){const e=await this.accountNumberIframeElement.validate(),t=await this.routingNumberIframeElement.validate();return e&&t}async tokenize({clientId:e,paymentMethodMetadata:t,account:a}){return this.accountNumberIframeElement.tokenize(e,t,a)}render(){return a(m,{key:"a2fd28c8b8202e0d702d02761cbcf3f568298265"},a(O,{key:"6777d110d3ccf3a688a763687c7087a3520643ac",isReady:this.isReady}),a("hidden-input",{key:"513e1cdaaf464a741d4312a6d359c4af665e0ade"}),a("div",{key:"2b4e473c7bb062a78148537d2cad02caf503330d",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},a("div",{key:"e706151f3e04835efab49fc0fb7a48f4657ab2c4",class:"row mb-3"},a("iframe-input",{key:"a70e0deac68d04f9ffa37790c33d801cfce8dc46",inputId:"accountNumber",ref:e=>this.accountNumberIframeElement=e,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber`})),a("div",{key:"3f488f86388b2fc797c49ddc81c7de3a815ca74f",class:"row"},a("iframe-input",{key:"a09d3cec373c5bab5b38ebc090724178e65d2de2",inputId:"routingNumber",ref:e=>this.routingNumberIframeElement=e,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber`}))))}},N=class{constructor(t){e(this,t)}get showSimpleCardBillingForm(){return this.paymentMethodType===g.NEW_CARD&&this.hideCardBillingForm}get showSimpleBankAccountBillingForm(){return this.paymentMethodType===g.NEW_BANK_ACCOUNT&&this.hideBankAccountBillingForm}async getValues(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.getValues()}async fill(e){var t;null===(t=this.selectedFormRef)||void 0===t||t.fill(e)}async validate(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.validate()}render(){return a(i,null,a(this.showSimpleBankAccountBillingForm?"justifi-bank-account-billing-form-simple":this.showSimpleCardBillingForm?"justifi-card-billing-form-simple":"justifi-billing-form-full",{legend:this.legend,ref:e=>this.selectedFormRef=e}))}},D=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new d(s({name:h.required("Enter full name"),address_line1:o.required("Enter street address"),address_line2:l.nullable(),address_city:n.required("Enter city"),address_state:c.required("Select state"),address_postal_code:r.required("Enter postal code")})),this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){if(!this.formController)return null;const e=this.formController.getInitialValues();return a(m,null,a("div",{part:b,class:"mt-4"},a(_,{text:"Billing address",class:"fs-6 fw-bold lh-lg mb-4"}),a("form",null,a("fieldset",null,this.legend&&a("legend",null,this.legend),a("div",{class:"row gy-3"},a("div",{class:"col-12"},a("form-control-text",{name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_line1",label:"Street Address",defaultValue:e.address_line1,errorText:this.errors.address_line1,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:e.address_line2,errorText:this.errors.address_line2,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_city",label:"City",defaultValue:e.address_city,errorText:this.errors.address_city,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-select",{name:"address_state",label:"State",options:w,defaultValue:e.address_state,errorText:this.errors.address_state,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_postal_code",label:"ZIP",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:j})))))))}},B=class{constructor(t){e(this,t),this.variant="primary",this.type="button"}render(){return a(m,{key:"7c146b9ccaf8c4c37adde6c8af054dc4796d78bd"},a(x,{key:"879d05664b808abcbc32a38bc98fcd673dba0dea",variant:this.variant,isLoading:this.isLoading,clickHandler:this.clickHandler,class:this.class,type:this.type,disabled:this.disabled,style:this.customStyle},this.text))}},I=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new d(s({name:h.nullable(),address_line1:o.nullable(),address_line2:l.nullable(),address_city:n.nullable(),address_state:c.nullable(),address_postal_code:r.required("Enter postal code")}))}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return a(m,{key:"26fd30b96e63f0adac380f70fae5cb4b80d9b36f"},a("div",{key:"79558919d544889647d034bdc415f9b404d4a058",part:b},a("form",{key:"21b722098010050f4a22b1e3cc995090c50a9f74"},a("fieldset",{key:"f371a839f16363d8242a38469c78eba1759e46a7"},this.legend&&a("legend",{key:"45b9d4d5b0dd502f5ebca9c357cdf6b75a16f9e1"},this.legend),a("div",{key:"ae1c10a2bae0061dd2aa0645e7d1f8c8ed899444",class:"row gy-3"},a("div",{key:"cd99d74f2803336bd0b25c7a962ef95fa66079ba",class:"col-12"},a("form-control-text",{key:"6ac34b703ae83a9e6c4c86b3c239795c5a7d0d57",name:"address_postal_code",label:"ZIP",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:j})))))))}},M=e=>{const{isReady:t}=e;return t?null:a("div",{class:"container-fluid p-0"},a("div",{class:"mb-3"},a(p,{height:"18px",width:"100px"}),a(p,{height:"36px"})),a("div",{class:"row"},a("div",{class:"col-4 align-content-end"},a(p,{height:"18px",width:"80px"}),a(p,{height:"36px"})),a("div",{class:"col-4 align-content-end"},a(p,{height:"36px"})),a("div",{class:"col-4 align-content-end"},a(p,{height:"18px",width:"30px"}),a(p,{height:"36px"}))))},S=class{constructor(t){e(this,t),this.isReady=!1}async componentWillLoad(){await v(),this.iframeOrigin=k.iframeOrigin,u(),this.analytics=new y(this)}componentDidRender(){Promise.all([this.cardNumberIframeElement,this.expirationMonthIframeElement,this.expirationYearIframeElement,this.cvvIframeElement].map((e=>new Promise((t=>{e.addEventListener("iframeLoaded",(()=>{t()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}async validate(){const e=await this.cardNumberIframeElement.validate(),t=await this.expirationMonthIframeElement.validate(),a=await this.expirationYearIframeElement.validate(),i=await this.cvvIframeElement.validate();return e&&t&&a&&i}async tokenize({clientId:e,paymentMethodMetadata:t,account:a}){return this.cardNumberIframeElement.tokenize(e,t,a)}render(){return a(m,{key:"64d9bda2ce54aa06788509ae294bcb1eefdb173a"},a(M,{key:"a1f233464393512652fc37a31b769bb9f48f3797",isReady:this.isReady}),a("hidden-input",{key:"4405ec6e9a510f670a137d33c83a5ad38a19a0aa"}),a("div",{key:"e704d33d8b3cbcd55798afb537b2b16d37d0077d",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},a("div",{key:"c519dafa0657af1372836a2a30301849f2e422b3",class:"mb-3"},a("iframe-input",{key:"6c6a0154ed62e0e684784ff0f327e3bc282da10c",inputId:"cardNumber",ref:e=>this.cardNumberIframeElement=e,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber`})),a("div",{key:"7efcb6e9fed504ea8f0470f55b8c48b7d82b537b",class:"row"},a("div",{key:"e216e57f82d04325cedeca9f3945285ab8675c7d",class:"col-4 align-content-end"},a("iframe-input",{key:"c3ffef01705152180c66adaf482e67a1d2f114e9",inputId:"expirationMonth",ref:e=>this.expirationMonthIframeElement=e,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth`})),a("div",{key:"97666cb9d9e4b272c033913527c4b6a60b6067c5",class:"col-4 align-content-end"},a("iframe-input",{key:"4d2f7f56f2a0d5717776c6ef164eef5f7dbc4d8d",inputId:"expirationYear",ref:e=>this.expirationYearIframeElement=e,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear`})),a("div",{key:"ecc6fff75106b265a7cb00febef40a7b14651a0a",class:"col-4 align-content-end"},a("iframe-input",{key:"9a756344f1d47f69c0702b57d15d66a658b57e3d",inputId:"CVV",ref:e=>this.cvvIframeElement=e,label:"CVV",iframeOrigin:`${this.iframeOrigin}/v2/CVV`})))))}},P=class{constructor(a){e(this,a),this.checkboxChanged=t(this,"checkboxChanged"),this.label="Save New Payment Method",this.isChecked=!1,this.handleCheckboxChange=(e,t)=>{this.isChecked=t,V.savePaymentMethod=t,this.checkboxChanged.emit(this.isChecked)}}render(){return a(m,{key:"04ed1491d4f5ca3e03a8a1f7a46dff5a0eb888de"},a("form-control-checkbox",{key:"7901643960e9d5d26c5916fb6e06601a6b59906a",label:this.label||"Save New Payment Method",name:"saveNewPaymentMethod",checked:this.isChecked,inputHandler:this.handleCheckboxChange}))}};export{H as justifi_bank_account_billing_form_simple,L as justifi_bank_account_form,N as justifi_billing_form,D as justifi_billing_form_full,B as justifi_button,I as justifi_card_billing_form_simple,S as justifi_card_form,C as justifi_radio_list_item,P as justifi_save_new_payment_method}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-DOjVAAtq.js";import{C as e,a as r}from"./p-Cjcsf8ku.js";import{c as o,J as p}from"./p-D5Jb9OcR.js";import{D as n}from"./p-BH0Xfn-F.js";import{g as a,a as c}from"./p-D2muobcE.js";import{D as h}from"./p-C8k7a6D-.js";import"./p-DL-q4EcN.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const d=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){o(),this.analytics=new p(this),this.initializeGetDispute()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:t,authToken:s,service:i})=>async({onSuccess:r,onError:o})=>{var p;try{const h=await i.fetchDispute(t,s);if(h.error)return o({error:c(h.error),code:a(null===(p=h.error)||void 0===p?void 0:p.code),severity:e.ERROR});{const t=Object.assign({},h.page_info);r({dispute:new n(h.data),pagingInfo:t})}}catch(t){const s=a(null==t?void 0:t.code);return o({error:t.message||t,code:s,severity:e.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new h}):(this.errorMessage="Dispute ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:r.MISSING_PROPS,severity:e.ERROR}))}render(){return i("justifi-dispute-management-core",{key:"f1bd67d5ad60de2ad584c8440cc71c3ad6453429",getDispute:this.getDispute,disputeId:this.disputeId,authToken:this.authToken,"onError-event":this.handleErrorEvent})}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{d as justifi_dispute_management}
1
+ import{r as t,c as s,h as i}from"./p-DOjVAAtq.js";import{C as e,a as r}from"./p-Cjcsf8ku.js";import{c as o,J as p}from"./p-l8F_7Ihw.js";import{D as a}from"./p-BH0Xfn-F.js";import{g as n,a as h}from"./p-D2muobcE.js";import{D as c}from"./p-C8k7a6D-.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const d=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){o(),this.analytics=new p(this),this.initializeGetDispute()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:t,authToken:s,service:i})=>async({onSuccess:r,onError:o})=>{var p;try{const c=await i.fetchDispute(t,s);if(c.error)return o({error:h(c.error),code:n(null===(p=c.error)||void 0===p?void 0:p.code),severity:e.ERROR});{const t=Object.assign({},c.page_info);r({dispute:new a(c.data),pagingInfo:t})}}catch(t){const s=n(null==t?void 0:t.code);return o({error:t.message||t,code:s,severity:e.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new c}):(this.errorMessage="Dispute ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:r.MISSING_PROPS,severity:e.ERROR}))}render(){return i("justifi-dispute-management-core",{key:"f1bd67d5ad60de2ad584c8440cc71c3ad6453429",getDispute:this.getDispute,disputeId:this.disputeId,authToken:this.authToken,"onError-event":this.handleErrorEvent})}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{d as justifi_dispute_management}
@@ -1 +1 @@
1
- import{h as t,r as e,c as a}from"./p-DOjVAAtq.js";import{c as i}from"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{C as s,a as o}from"./p-Cjcsf8ku.js";import{h as r}from"./p-C98BC5W5.js";import{p as c}from"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{c as n,J as p}from"./p-D5Jb9OcR.js";import{g as h,a as d}from"./p-D2muobcE.js";import{P as l}from"./p-8S_ROmnq.js";import{T as f,l as u,a as m,b,c as y,d as _,e as w,f as T,g as j,h as v,i as g,j as k,k as D}from"./p-C0wTyoTh.js";import{S as C}from"./p-BhCH9S0e.js";import{T as S}from"./p-CZfYo5-1.js";import{a as P}from"./p-Bgnhf5c9.js";import{S as I,T as q}from"./p-xDbRW9xn.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-DL-q4EcN.js";import"./p-DdZLLkQ5.js";import"./p-h5pyZngT.js";const O={id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of each transaction"},"ID"),account_id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of the account associated with each transaction"},"Account ID"),payout_id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of the payout associated with each transaction"},"Payout ID"),financial_transaction_id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),amount:()=>t("th",{part:I,scope:"col",title:"The dollar amount of each transaction"},"Amount"),fee:()=>t("th",{part:I,scope:"col",title:"The fee associated with each transaction"},"Fee"),net:()=>t("th",{part:I,scope:"col",title:"The net amount of each transaction"},"Net"),currency:()=>t("th",{part:I,scope:"col",title:"The currency of each transaction"},"Currency"),description:()=>t("th",{part:I,scope:"col",title:"The description of each transaction"},"Description"),source_id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),txn_type:()=>t("th",{part:I,scope:"col",title:"The type of each transaction"},"Type"),created_at:()=>t("th",{part:I,scope:"col",title:"The date and time each transaction was made"},"Processed On"),available_on:()=>t("th",{part:I,scope:"col",title:"The date and time each transaction will be available"},"Available On"),updated_at:()=>t("th",{part:I,scope:"col",title:"The date and time each transaction was last updated"},"Updated On")},x={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"},A={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)},x[e.txn_type]),created_at:e=>t("td",{part:q(e.created_at)},t("div",{class:"fw-bold"},P(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(e.created_at,{showTime:!0}))),available_on:e=>t("td",{part:q(e.available_on)},t("div",{class:"fw-bold"},P(e.available_on,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(e.available_on,{showTime:!0}))),updated_at:e=>t("td",{part:q(e.updated_at)},t("div",{class:"fw-bold"},P(e.updated_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(e.updated_at,{showTime:!0})))},E=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=c,this.pagingParams={},this.columns="created_at,txn_type,description,amount,fee,net",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:S.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:S.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:S.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,O,A),n(),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:c,final:n})=>{var p;try{const n=await a.fetchPayoutTransactions(t,e,i);n.error?c({error:d(n.error),code:h(null===(p=n.error)||void 0===p?void 0:p.code),severity:s.ERROR}):o({balanceTransactions:n.data.map((t=>new r(t))),pagingInfo:Object.assign({},n.page_info)})}catch(t){const e=h(null==t?void 0:t.code);c({error:d(t),code:e,severity:s.ERROR})}finally{n()}})({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(C,{key:"a0ff80867bc3c0bf198165229f693d7748ffc7a4"},t(u,{key:"779cc5602f6221e0f704484bf962b72b266d95f8"},t(m,{key:"7b4b56e9712533ba2b50a875d282ef4bd5efdcaf"},t(b,{key:"8ecd93d56bdbdb1417b260dd013315b21958f363"},t(y,{key:"9fa0fea238a9f76c71d5b8fc5443ca2c9e56b13b"},this.transactionsTable.columnData.map((t=>t)))),t(_,{key:"f7d94388eddaf848e4868005e985a1158577c70f"},t(w,{key:"c83742e9e3ecbcdaba29f2aa121ec4c101a55632",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(T,{key:"fa0404328357e11527cff2c3eb15536ee458557b",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(j,{key:"71add0ef95310fd49e403d65c2a23ea8f73c71b6",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(v,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(g,{key:"073af8dce5dabb2db604ae50e6ace6a4ace18e6f"},t(k,{key:"3f3906a106b3c41311a0e1309aea779e865bf0f5"},t(D,{key:"85b46ef2a297aab3a450d49dd086ec6e7e1ab027",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"548131521a5fcf1562b286097635f5f62414a28c",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],payoutId:["propChanged"],authToken:["propChanged"]}}};export{E as justifi_payout_transactions_list}
1
+ import{h as t,r as e,c as a}from"./p-DOjVAAtq.js";import{c as i}from"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{C as s,a as o}from"./p-Cjcsf8ku.js";import{h as r}from"./p-C98BC5W5.js";import{p as c}from"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{c as n,J as h}from"./p-l8F_7Ihw.js";import{g as p,a as d}from"./p-D2muobcE.js";import{P as l}from"./p-8S_ROmnq.js";import{T as f,l as u,a as m,b,c as y,d as _,e as w,f as T,g as j,h as v,i as g,j as k,k as C}from"./p-C0wTyoTh.js";import{S as D}from"./p-BhCH9S0e.js";import{T as S}from"./p-CZfYo5-1.js";import{a as P}from"./p-Bgnhf5c9.js";import{S as I,T as q}from"./p-xDbRW9xn.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-h5pyZngT.js";const x={id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of each transaction"},"ID"),account_id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of the account associated with each transaction"},"Account ID"),payout_id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of the payout associated with each transaction"},"Payout ID"),financial_transaction_id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),amount:()=>t("th",{part:I,scope:"col",title:"The dollar amount of each transaction"},"Amount"),fee:()=>t("th",{part:I,scope:"col",title:"The fee associated with each transaction"},"Fee"),net:()=>t("th",{part:I,scope:"col",title:"The net amount of each transaction"},"Net"),currency:()=>t("th",{part:I,scope:"col",title:"The currency of each transaction"},"Currency"),description:()=>t("th",{part:I,scope:"col",title:"The description of each transaction"},"Description"),source_id:()=>t("th",{part:I,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),txn_type:()=>t("th",{part:I,scope:"col",title:"The type of each transaction"},"Type"),created_at:()=>t("th",{part:I,scope:"col",title:"The date and time each transaction was made"},"Processed On"),available_on:()=>t("th",{part:I,scope:"col",title:"The date and time each transaction will be available"},"Available On"),updated_at:()=>t("th",{part:I,scope:"col",title:"The date and time each transaction was last updated"},"Updated On")},O={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"},A={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)},O[e.txn_type]),created_at:e=>t("td",{part:q(e.created_at)},t("div",{class:"fw-bold"},P(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(e.created_at,{showTime:!0}))),available_on:e=>t("td",{part:q(e.available_on)},t("div",{class:"fw-bold"},P(e.available_on,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(e.available_on,{showTime:!0}))),updated_at:e=>t("td",{part:q(e.updated_at)},t("div",{class:"fw-bold"},P(e.updated_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(e.updated_at,{showTime:!0})))},E=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=c,this.pagingParams={},this.columns="created_at,txn_type,description,amount,fee,net",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:S.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:S.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:S.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,x,A),n(),this.analytics=new h(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:c,final:n})=>{var h;try{const n=await a.fetchPayoutTransactions(t,e,i);n.error?c({error:d(n.error),code:p(null===(h=n.error)||void 0===h?void 0:h.code),severity:s.ERROR}):o({balanceTransactions:n.data.map((t=>new r(t))),pagingInfo:Object.assign({},n.page_info)})}catch(t){const e=p(null==t?void 0:t.code);c({error:d(t),code:e,severity:s.ERROR})}finally{n()}})({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:"a0ff80867bc3c0bf198165229f693d7748ffc7a4"},t(u,{key:"779cc5602f6221e0f704484bf962b72b266d95f8"},t(m,{key:"7b4b56e9712533ba2b50a875d282ef4bd5efdcaf"},t(b,{key:"8ecd93d56bdbdb1417b260dd013315b21958f363"},t(y,{key:"9fa0fea238a9f76c71d5b8fc5443ca2c9e56b13b"},this.transactionsTable.columnData.map((t=>t)))),t(_,{key:"f7d94388eddaf848e4868005e985a1158577c70f"},t(w,{key:"c83742e9e3ecbcdaba29f2aa121ec4c101a55632",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(T,{key:"fa0404328357e11527cff2c3eb15536ee458557b",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(j,{key:"71add0ef95310fd49e403d65c2a23ea8f73c71b6",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(v,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(g,{key:"073af8dce5dabb2db604ae50e6ace6a4ace18e6f"},t(k,{key:"3f3906a106b3c41311a0e1309aea779e865bf0f5"},t(C,{key:"85b46ef2a297aab3a450d49dd086ec6e7e1ab027",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"548131521a5fcf1562b286097635f5f62414a28c",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],payoutId:["propChanged"],authToken:["propChanged"]}}};export{E as justifi_payout_transactions_list}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-DOjVAAtq.js";import{C as r,a as o}from"./p-Cjcsf8ku.js";import{c as e,J as n}from"./p-D5Jb9OcR.js";import{T as a}from"./p-CCLgieAN.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{e as p}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as c,a as h}from"./p-D2muobcE.js";import{m,S as d}from"./p-DfV3dFDB.js";import{S as u}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{d as l}from"./p-ClvhB3WW.js";import"./p-DL-q4EcN.js";import"./p-DdZLLkQ5.js";import"./p-Bgnhf5c9.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-hbWSMN3O.js";import"./p-xDbRW9xn.js";const j=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=l,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){e(),this.analytics=new n(this),this.initializeGetData()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:t,authToken:s,service:i})=>async({params:o,onSuccess:e,onError:n})=>{var a,m;try{const d=await i.fetchTerminals(t,s,o);if(d.error)return n({error:h(d.error),code:c(null===(m=d.error)||void 0===m?void 0:m.code),severity:r.ERROR});{const t=Object.assign({},d.page_info);e({terminals:(null===(a=d.data)||void 0===a?void 0:a.map((t=>new p(t))))||[],pagingInfo:t})}}catch(t){const s=c(null==t?void 0:t.code);return n({error:t.message||t,code:s,severity:r.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new a}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:r.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=m({accountId:this.accountId,authToken:this.authToken,service:new d}))}render(){return i(u,{key:"33ad31c8b8748897664c91d3fc6349d76f276e9e"},i("terminals-list-core",{key:"dd16f1dd45b0c0d1d2f14469e4cc6f418b977ab7",getTerminals:this.getTerminals,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{j as justifi_terminals_list}
1
+ import{r as t,c as s,h as i}from"./p-DOjVAAtq.js";import{C as r,a as o}from"./p-Cjcsf8ku.js";import{c as e,J as n}from"./p-l8F_7Ihw.js";import{T as a}from"./p-CCLgieAN.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{e as p}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as c,a as h}from"./p-D2muobcE.js";import{m,S as d}from"./p-DfV3dFDB.js";import{S as l}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{d as u}from"./p-ClvhB3WW.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-Bgnhf5c9.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-hbWSMN3O.js";import"./p-xDbRW9xn.js";const j=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=u,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){e(),this.analytics=new n(this),this.initializeGetData()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:t,authToken:s,service:i})=>async({params:o,onSuccess:e,onError:n})=>{var a,m;try{const d=await i.fetchTerminals(t,s,o);if(d.error)return n({error:h(d.error),code:c(null===(m=d.error)||void 0===m?void 0:m.code),severity:r.ERROR});{const t=Object.assign({},d.page_info);e({terminals:(null===(a=d.data)||void 0===a?void 0:a.map((t=>new p(t))))||[],pagingInfo:t})}}catch(t){const s=c(null==t?void 0:t.code);return n({error:t.message||t,code:s,severity:r.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new a}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:r.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=m({accountId:this.accountId,authToken:this.authToken,service:new d}))}render(){return i(l,{key:"33ad31c8b8748897664c91d3fc6349d76f276e9e"},i("terminals-list-core",{key:"dd16f1dd45b0c0d1d2f14469e4cc6f418b977ab7",getTerminals:this.getTerminals,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{j as justifi_terminals_list}
@@ -1 +1 @@
1
- import{h as t,r as s,c as e}from"./p-DOjVAAtq.js";import{c as r,a as i,F as o}from"./p-DiJD6Iqx.js";import{f as n}from"./p-Bgnhf5c9.js";import"./p-a6tcNl_T.js";import{C as a,a as u}from"./p-Cjcsf8ku.js";import{R as l,k as m}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{B as h}from"./p-C9EQ459H.js";import{S as c}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{P as p}from"./p-BjNuRWXK.js";import{m as d}from"./p-DWn9BiNn.js";import{c as f,J as j}from"./p-D5Jb9OcR.js";import{g as v,a as y}from"./p-D2muobcE.js";import{A as b}from"./p-DdZLLkQ5.js";import{S as w}from"./p-T2yENPvU.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-xDbRW9xn.js";import"./p-DL-q4EcN.js";const x=t=>{const s=+t;return i().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${n(s)}`,(function(t){return+t<=+s})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},g=t=>{if(t)return r({amount:x(t),description:i().optional(),reason:i().optional().oneOf([l.customerRequest,l.duplicate,l.fraudulent],"Select a reason")})},C=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],A=b();class B{async postRefund(t,s,e,r){return A.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":s},body:r,authToken:e})}}const D=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(w,{width:"100%",height:"40px"}))),R=()=>t(c,null,t("div",{class:"row gap-5"},t(D,null),t(D,null),t(D,null))),T=class{constructor(t){s(this,t),this.errorEvent=e(this,"error-event"),this.submitEvent=e(this,"submit-event"),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,s)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:s}))}}componentWillLoad(){f(),this.analytics=new j(this),this.initializeApi(),this.formController=new o(g())}handleError(t,s,e){this.errorEvent.emit({errorCode:t,message:s,severity:e})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(u.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",a.ERROR)}initializeFormController(){const t=this.refundPayload.amount,s=t?t.toString():"0";this.formController=new o(g(s)),this.formController.setInitialValues({amount:s}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?d({id:this.paymentId,authToken:this.authToken,service:new p})({onSuccess:({payment:t})=>{this.refundPayload=new m({amount:t.amount_refundable})},onError:({error:t,code:s,severity:e})=>{this.handleError(s,t,e)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(u.MISSING_PROPS,"Payment ID and Auth Token are required",a.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const s=(({authToken:t,accountId:s,paymentId:e,service:r})=>async({refundBody:i,onSuccess:o,onError:n,final:u})=>{var l;try{const u=await r.postRefund(e,s,t,i);if(u.error)return n({error:y(u.error),code:v(null===(l=u.error)||void 0===l?void 0:l.code),severity:a.ERROR});o(u)}catch(t){const s=v(null==t?void 0:t.code);return n({error:t.message||t,code:s,severity:a.ERROR})}finally{return u()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new B}),e=this.formController.values.getValue();return this.refundLoading=!0,new Promise((t=>{let r;s({refundBody:e,onSuccess:t=>{r=t},onError:({error:t,code:s,severity:e})=>{r=t,this.handleError(t,s,e)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,t(r.data)}})}))}render(){if(this.paymentLoading)return t(R,null);const s=this.formController.getInitialValues(),e=this.refundPayload.amount;return t(c,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:s.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:s.reason,inputHandler:this.inputHandler,options:C,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:s.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(h,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${n(+e)}`))))))}};export{T as justifi_refund_payment}
1
+ import{h as t,r as s,c as e}from"./p-DOjVAAtq.js";import{c as r,a as i,F as o}from"./p-DiJD6Iqx.js";import{f as n}from"./p-Bgnhf5c9.js";import"./p-a6tcNl_T.js";import{C as a,a as u}from"./p-Cjcsf8ku.js";import{R as l,k as h}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{B as m}from"./p-C9EQ459H.js";import{S as p}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{P as c}from"./p-BjNuRWXK.js";import{m as d}from"./p-DWn9BiNn.js";import{c as f,J as j}from"./p-l8F_7Ihw.js";import{g as v,a as y}from"./p-D2muobcE.js";import{A as b}from"./p-DdZLLkQ5.js";import{S as w}from"./p-T2yENPvU.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-xDbRW9xn.js";import"./p-Csfiax9X.js";const x=t=>{const s=+t;return i().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${n(s)}`,(function(t){return+t<=+s})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},C=t=>{if(t)return r({amount:x(t),description:i().optional(),reason:i().optional().oneOf([l.customerRequest,l.duplicate,l.fraudulent],"Select a reason")})},g=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],A=b();class B{async postRefund(t,s,e,r){return A.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":s},body:r,authToken:e})}}const T=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(w,{width:"100%",height:"40px"}))),k=()=>t(p,null,t("div",{class:"row gap-5"},t(T,null),t(T,null),t(T,null))),D=class{constructor(t){s(this,t),this.errorEvent=e(this,"error-event"),this.submitEvent=e(this,"submit-event"),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,s)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:s}))}}componentWillLoad(){f(),this.analytics=new j(this),this.initializeApi(),this.formController=new o(C())}handleError(t,s,e){this.errorEvent.emit({errorCode:t,message:s,severity:e})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(u.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",a.ERROR)}initializeFormController(){const t=this.refundPayload.amount,s=t?t.toString():"0";this.formController=new o(C(s)),this.formController.setInitialValues({amount:s}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?d({id:this.paymentId,authToken:this.authToken,service:new c})({onSuccess:({payment:t})=>{this.refundPayload=new h({amount:t.amount_refundable})},onError:({error:t,code:s,severity:e})=>{this.handleError(s,t,e)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(u.MISSING_PROPS,"Payment ID and Auth Token are required",a.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const s=(({authToken:t,accountId:s,paymentId:e,service:r})=>async({refundBody:i,onSuccess:o,onError:n,final:u})=>{var l;try{const u=await r.postRefund(e,s,t,i);if(u.error)return n({error:y(u.error),code:v(null===(l=u.error)||void 0===l?void 0:l.code),severity:a.ERROR});o(u)}catch(t){const s=v(null==t?void 0:t.code);return n({error:t.message||t,code:s,severity:a.ERROR})}finally{return u()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new B}),e=this.formController.values.getValue();return this.refundLoading=!0,new Promise((t=>{let r;s({refundBody:e,onSuccess:t=>{r=t},onError:({error:t,code:s,severity:e})=>{r=t,this.handleError(t,s,e)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,t(r.data)}})}))}render(){if(this.paymentLoading)return t(k,null);const s=this.formController.getInitialValues(),e=this.refundPayload.amount;return t(p,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:s.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:s.reason,inputHandler:this.inputHandler,options:g,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:s.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(m,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${n(+e)}`))))))}};export{D as justifi_refund_payment}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-DOjVAAtq.js";import{P as r}from"./p-BjNuRWXK.js";import{m as e}from"./p-DWn9BiNn.js";import{E as p}from"./p-CH8Y3GSr.js";import{C as o,a as n}from"./p-Cjcsf8ku.js";import{c as a,J as h}from"./p-D5Jb9OcR.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D2muobcE.js";import"./p-xDbRW9xn.js";import"./p-DL-q4EcN.js";const m=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.recordClickEvent=s(this,"record-click-event"),this.errorMessage=null,this.paymentService=new r,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.handleRecordClickEvent=t=>{this.recordClickEvent.emit({id:t.detail.id,type:t.detail.type})}}componentWillLoad(){a(),this.analytics=new h(this),this.initializeGetPaymentDetails()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetPaymentDetails()}initializeGetPaymentDetails(){this.paymentId&&this.authToken?this.getPaymentDetails=e({id:this.paymentId,authToken:this.authToken,service:new r}):(this.errorMessage="Payment ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:n.MISSING_PROPS,severity:o.ERROR}))}render(){return this.errorMessage?p(this.errorMessage):i("payment-details-core",{getPaymentDetails:this.getPaymentDetails,"onError-event":this.handleErrorEvent,"onRecord-click-event":this.handleRecordClickEvent,"enable-record-click":"true"})}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"]}}};export{m as justifi_payment_details}
1
+ import{r as t,c as s,h as i}from"./p-DOjVAAtq.js";import{P as r}from"./p-BjNuRWXK.js";import{m as e}from"./p-DWn9BiNn.js";import{E as p}from"./p-CH8Y3GSr.js";import{C as o,a as n}from"./p-Cjcsf8ku.js";import{c as a,J as h}from"./p-l8F_7Ihw.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D2muobcE.js";import"./p-xDbRW9xn.js";import"./p-Csfiax9X.js";const m=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.recordClickEvent=s(this,"record-click-event"),this.errorMessage=null,this.paymentService=new r,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.handleRecordClickEvent=t=>{this.recordClickEvent.emit({id:t.detail.id,type:t.detail.type})}}componentWillLoad(){a(),this.analytics=new h(this),this.initializeGetPaymentDetails()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetPaymentDetails()}initializeGetPaymentDetails(){this.paymentId&&this.authToken?this.getPaymentDetails=e({id:this.paymentId,authToken:this.authToken,service:new r}):(this.errorMessage="Payment ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:n.MISSING_PROPS,severity:o.ERROR}))}render(){return this.errorMessage?p(this.errorMessage):i("payment-details-core",{getPaymentDetails:this.getPaymentDetails,"onError-event":this.handleErrorEvent,"onRecord-click-event":this.handleRecordClickEvent,"enable-record-click":"true"})}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"]}}};export{m as justifi_payment_details}
@@ -0,0 +1 @@
1
+ import{h as s,r as i,c as t}from"./p-DOjVAAtq.js";import{c as r,F as e}from"./p-DiJD6Iqx.js";import{b as o,a}from"./p-C9iide2W.js";import{i as h,a as p}from"./p-tYuXMkCd.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{C as n,a as l}from"./p-Cjcsf8ku.js";import"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import{B as m,b as d}from"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{c,J as j}from"./p-l8F_7Ihw.js";import{B as u}from"./p-C9EQ459H.js";import{S as f}from"./p-BhCH9S0e.js";import{H as v}from"./p-RQzxYnz_.js";import"./p-CZfYo5-1.js";import{S as b}from"./p-T2yENPvU.js";import{B as C}from"./p-XYgDHrVL.js";import{m as w,b as g}from"./p-5aA7gjr5.js";import{B as x}from"./p-DQZ5VHTZ.js";import"./p-BFTU3MAI.js";import"./p-PSJOKMWp.js";import"./p-BX8GieXu.js";import"./p-yH3TC3ZQ.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-Dt-vy9Le.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-xDbRW9xn.js";import"./p-D2muobcE.js";const y=r(Object.assign(Object.assign({},o().fields),{legal_address:p(),additional_questions:a(),representative:h("representative")})),B=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(b,{width:"25%"})),s("div",{class:"col-12"},s(b,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(b,{width:"50%"}),s(b,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(b,{width:"65%"}),s(b,{width:"35%"}))),D=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(b,{width:"40%",height:"40px"})),s(B,null),s(B,null),s(B,null)),k=class{constructor(s){i(this,s),this.submitEvent=t(this,"submit-event"),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.isLoading=!1,this.isSaving=!1,this.hideErrors=!1,this.formTitle="Business Information",this.removeTitle=!1,this.instantiateBusiness=s=>{const i=new m(s);this.formController.setInitialValues(Object.assign({},i))},this.sendData=async()=>{this.isSaving=!0;const s=this.formController.values.getValue(),i=this.formController.getInitialValues(),t=new m(Object.assign(Object.assign({},i),s)).payload;this.patchBusiness({payload:t,onSuccess:s=>{this.handleReponse(s)},onError:({error:s,code:i,severity:t})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:i,message:s.message,severity:t})},final:()=>{this.isSaving=!1}})},this.validateAndSubmit=s=>{s.preventDefault(),this.formController.validateAndSubmit(this.sendData)}}componentWillLoad(){c(),this.analytics=new j(this),this.formController=new e(y),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}get title(){return this.removeTitle?"":this.formTitle}get disabledState(){return this.isSaving}get businessEndpoint(){return`entities/business/${this.businessId}`}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=w({authToken:this.authToken,businessId:this.businessId,service:new x}),this.patchBusiness=g({authToken:this.authToken,businessId:this.businessId,service:new x}),this.getBusiness({onSuccess:s=>{this.instantiateBusiness(s.data)},onError:({error:s,code:i,severity:t})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:i,message:s.message,severity:t})},final:()=>{this.isLoading=!1}})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:l.MISSING_PROPS,severity:n.ERROR})}handleReponse(s){s.error&&(this.errorMessage=d.patchData),this.submitEvent.emit({response:s}),this.instantiateBusiness(s.data)}render(){return s(f,null,this.isLoading?s(D,null):s("form",{onSubmit:this.validateAndSubmit},s("div",{class:"row gap-3"},s(v,{text:this.title}),s("form-alert",{text:this.errorMessage,hideAlert:this.hideErrors}),s("div",{class:"col-12 mb-4"},s("justifi-business-core-info",{formController:this.formController})),s("div",{class:"col-12 mb-4"},s("justifi-legal-address-form",{formController:this.formController})),s("div",{class:"col-12 mb-4"},s("justifi-additional-questions",{formController:this.formController})),s("div",{class:"col-12 mb-4"},s("justifi-business-representative",{formController:this.formController})),s("div",{class:"col-12 d-flex flex-row-reverse"},s(u,{type:"submit",disabled:this.disabledState,variant:"primary",onClick:()=>this.clickEvent.emit({name:C.submit}),isLoading:this.isSaving},"Submit")))))}};export{k as justifi_business_form}
@@ -1 +1 @@
1
- import{h as t,r as e,c as a}from"./p-DOjVAAtq.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{C as s,a as i}from"./p-Cjcsf8ku.js";import{g as n}from"./p-C98BC5W5.js";import{p as r}from"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{c as o,J as c}from"./p-D5Jb9OcR.js";import{g as p,a as h}from"./p-D2muobcE.js";import{P as d}from"./p-BjNuRWXK.js";import{T as f,l,a as u,b as m,c as b,d as y,e as _,f as j,g as T,h as g,i as k,j as w,k as v}from"./p-C0wTyoTh.js";import{S as C}from"./p-BhCH9S0e.js";import{T as D}from"./p-CZfYo5-1.js";import{a as S}from"./p-Bgnhf5c9.js";import{S as R,T as x}from"./p-xDbRW9xn.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-DL-q4EcN.js";import"./p-DdZLLkQ5.js";import"./p-h5pyZngT.js";const F={created_at:()=>t("th",{part:R,scope:"col",title:"The date and time each transaction was made"},"Processed On"),type:()=>t("th",{part:R,scope:"col",title:"The type of each transaction"},"Type"),id:()=>t("th",{part:R,scope:"col",title:"The unique identifier of each transaction"},"ID"),amount:()=>t("th",{part:R,scope:"col",title:"The dollar amount of each transaction",class:"text-end"},"Amount"),balance:()=>t("th",{part:R,scope:"col",title:"The running total amount of this payment that belongs to you",class:"text-end"},"Balance"),currency:()=>t("th",{part:R,scope:"col",title:"The currency of each transaction"},"Currency"),financial_transaction_id:()=>t("th",{part:R,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),payment_id:()=>t("th",{part:R,scope:"col",title:"The unique identifier of the payment associated with the payment balance transaction"},"Payment ID"),payment_balance_txn_type:()=>t("th",{part:R,scope:"col",title:"The type of the payment balance transaction"},"Transaction Type"),source_id:()=>t("th",{part:R,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),source_type:()=>t("th",{part:R,scope:"col",title:"The type of the source object associated with the payment balance transaction"},"Source Type")},A={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",refund:"Refund",fee_refund:"Fee Refund",application_fee_returned:"Application Fee Returned",refund_failure:"Refund Failure",void:"Void"},B={created_at:(e,a)=>t("td",{part:x(a)},t("div",{class:"fw-bold"},S(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},S(e.created_at,{showTime:!0}))),type:(e,a)=>t("td",{part:x(a)},A[e.payment_balance_txn_type]),id:(e,a)=>t("td",{part:x(a)},e.id),amount:(e,a)=>t("td",{part:x(a),class:"text-end"},e.formattedPaymentAmount(e.amount)),balance:(e,a)=>t("td",{part:x(a),class:"text-end"},e.formattedPaymentAmount(e.balance)),currency:(e,a)=>t("td",{part:x(a)},e.currency),financial_transaction_id:(e,a)=>t("td",{part:x(a)},e.financial_transaction_id),payment_id:(e,a)=>t("td",{part:x(a)},e.payment_id),payment_balance_txn_type:(e,a)=>t("td",{part:x(a)},e.payment_balance_txn_type),source_id:(e,a)=>t("td",{part:x(a)},e.source_id),source_type:(e,a)=>t("td",{part:x(a)},e.source_type)},E=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=r,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,F,B),o(),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.paymentId&&this.authToken?(({id:t,authToken:e,service:a})=>async({params:i,onSuccess:r,onError:o,final:c})=>{var d;try{const c=await a.fetchPaymentTransactions(t,e,i);c.error?o({error:h(c.error),code:p(null===(d=c.error)||void 0===d?void 0:d.code),severity:s.ERROR}):r({balanceTransactions:c.data.map((t=>new n(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:s.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(i.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}render(){return t(C,{key:"a00f8b0ba0e96bba423c6933fc9eebd19f5f61cd"},t(l,{key:"b1ad1863482835106c6ec1b5fe7c3f9bb294a316"},t(u,{key:"f20d05de3f0a4d60734bfb366ebaf11a5b9fa4d0"},t(m,{key:"d4aa85002f25923d79670687d80090422e4f09a3"},t(b,{key:"99dba50d00c0ab2ba4f140424ff534936fd15c9e"},this.transactionsTable.columnData.map((t=>t)))),t(y,{key:"5526e3cffc2d43f6f6cbd755afbcffd3d036ebe9"},t(_,{key:"a5cf0dcf867feba1a1a8c4419e5f6c868510eb82",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(j,{key:"62f38aa3ea3758f6a113b2370c17670fa38fd322",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(T,{key:"a86ba5ae455119f12fa01a56c6826cc3a08d7c3b",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(g,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(k,{key:"302041a89f00caa4e440bad8bd5148f9b51b405e"},t(w,{key:"c1071b23b4dc07c94674d0addabc8cdc7bc7ca3c"},t(v,{key:"2144fdc702e20c8c839b5d8c231bf1d3b16df234",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"71589bd15b0af2d1eb6bad533e294e480ba36ca3",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],paymentId:["propChanged"],authToken:["propChanged"]}}};export{E as justifi_payment_transactions_list}
1
+ import{h as t,r as e,c as a}from"./p-DOjVAAtq.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{C as s,a as i}from"./p-Cjcsf8ku.js";import{g as n}from"./p-C98BC5W5.js";import{p as r}from"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{c as o,J as c}from"./p-l8F_7Ihw.js";import{g as p,a as h}from"./p-D2muobcE.js";import{P as d}from"./p-BjNuRWXK.js";import{T as f,l,a as u,b as m,c as b,d as y,e as _,f as j,g as T,h as g,i as k,j as w,k as C}from"./p-C0wTyoTh.js";import{S as v}from"./p-BhCH9S0e.js";import{T as D}from"./p-CZfYo5-1.js";import{a as S}from"./p-Bgnhf5c9.js";import{S as x,T as R}from"./p-xDbRW9xn.js";import"./p-DdMxswn1.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-h5pyZngT.js";const F={created_at:()=>t("th",{part:x,scope:"col",title:"The date and time each transaction was made"},"Processed On"),type:()=>t("th",{part:x,scope:"col",title:"The type of each transaction"},"Type"),id:()=>t("th",{part:x,scope:"col",title:"The unique identifier of each transaction"},"ID"),amount:()=>t("th",{part:x,scope:"col",title:"The dollar amount of each transaction",class:"text-end"},"Amount"),balance:()=>t("th",{part:x,scope:"col",title:"The running total amount of this payment that belongs to you",class:"text-end"},"Balance"),currency:()=>t("th",{part:x,scope:"col",title:"The currency of each transaction"},"Currency"),financial_transaction_id:()=>t("th",{part:x,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),payment_id:()=>t("th",{part:x,scope:"col",title:"The unique identifier of the payment associated with the payment balance transaction"},"Payment ID"),payment_balance_txn_type:()=>t("th",{part:x,scope:"col",title:"The type of the payment balance transaction"},"Transaction Type"),source_id:()=>t("th",{part:x,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),source_type:()=>t("th",{part:x,scope:"col",title:"The type of the source object associated with the payment balance transaction"},"Source Type")},I={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",refund:"Refund",fee_refund:"Fee Refund",application_fee_returned:"Application Fee Returned",refund_failure:"Refund Failure",void:"Void"},A={created_at:(e,a)=>t("td",{part:R(a)},t("div",{class:"fw-bold"},S(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},S(e.created_at,{showTime:!0}))),type:(e,a)=>t("td",{part:R(a)},I[e.payment_balance_txn_type]),id:(e,a)=>t("td",{part:R(a)},e.id),amount:(e,a)=>t("td",{part:R(a),class:"text-end"},e.formattedPaymentAmount(e.amount)),balance:(e,a)=>t("td",{part:R(a),class:"text-end"},e.formattedPaymentAmount(e.balance)),currency:(e,a)=>t("td",{part:R(a)},e.currency),financial_transaction_id:(e,a)=>t("td",{part:R(a)},e.financial_transaction_id),payment_id:(e,a)=>t("td",{part:R(a)},e.payment_id),payment_balance_txn_type:(e,a)=>t("td",{part:R(a)},e.payment_balance_txn_type),source_id:(e,a)=>t("td",{part:R(a)},e.source_id),source_type:(e,a)=>t("td",{part:R(a)},e.source_type)},B=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=r,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,F,A),o(),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.paymentId&&this.authToken?(({id:t,authToken:e,service:a})=>async({params:i,onSuccess:r,onError:o,final:c})=>{var d;try{const c=await a.fetchPaymentTransactions(t,e,i);c.error?o({error:h(c.error),code:p(null===(d=c.error)||void 0===d?void 0:d.code),severity:s.ERROR}):r({balanceTransactions:c.data.map((t=>new n(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:s.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(i.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}render(){return t(v,{key:"a00f8b0ba0e96bba423c6933fc9eebd19f5f61cd"},t(l,{key:"b1ad1863482835106c6ec1b5fe7c3f9bb294a316"},t(u,{key:"f20d05de3f0a4d60734bfb366ebaf11a5b9fa4d0"},t(m,{key:"d4aa85002f25923d79670687d80090422e4f09a3"},t(b,{key:"99dba50d00c0ab2ba4f140424ff534936fd15c9e"},this.transactionsTable.columnData.map((t=>t)))),t(y,{key:"5526e3cffc2d43f6f6cbd755afbcffd3d036ebe9"},t(_,{key:"a5cf0dcf867feba1a1a8c4419e5f6c868510eb82",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(j,{key:"62f38aa3ea3758f6a113b2370c17670fa38fd322",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(T,{key:"a86ba5ae455119f12fa01a56c6826cc3a08d7c3b",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(g,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(k,{key:"302041a89f00caa4e440bad8bd5148f9b51b405e"},t(w,{key:"c1071b23b4dc07c94674d0addabc8cdc7bc7ca3c"},t(C,{key:"2144fdc702e20c8c839b5d8c231bf1d3b16df234",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"71589bd15b0af2d1eb6bad533e294e480ba36ca3",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],paymentId:["propChanged"],authToken:["propChanged"]}}};export{B as justifi_payment_transactions_list}
@@ -1 +1 @@
1
- import{h as i,r as s,c as t}from"./p-DOjVAAtq.js";import{am as e,aj as r,af as o,D as l}from"./p-xDbRW9xn.js";import{S as d}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{c as n,J as a}from"./p-D5Jb9OcR.js";import{C as h,a as c}from"./p-Cjcsf8ku.js";import{B as u}from"./p-DQZ5VHTZ.js";import{B as v}from"./p-BlJnA265.js";import{m as p}from"./p-DH8F0bsw.js";import{S as m}from"./p-T2yENPvU.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{j as f,i as w,b as j}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BH0Xfn-F.js";import{g as x,a as g}from"./p-D2muobcE.js";import{T as y}from"./p-CCLgieAN.js";import{l as b}from"./p-Bgnhf5c9.js";import"./p-DL-q4EcN.js";import"./p-DdZLLkQ5.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-DdMxswn1.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%"}))),S=()=>i("div",{class:"row gap-5"},i("div",{class:"col-12"},i(m,{width:"40%",height:"40px"})),i(C,null)),k=()=>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)))))),D=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?j.boardingShipping:j.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 u})({onSuccess:({business:i})=>{this.business=new v(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:g(a.error),code:x(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=x(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:g(d.error),code:x(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=x(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(S,null),this.loading.terminals&&i("div",{class:"mt-5"},i(k,null),i(k,null),i(k,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,b(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:"5e7da5050d127f6470bc12f9cf547fe421ce1897"},i("div",{key:"6a1f46676ef1f31f6cfeb642001a0dd3f8a60072",part:l},this.renderLoading(),this.renderBusinessDetails(),this.renderTerminals(),this.renderOrderSection()))}};export{D as justifi_order_terminals}
1
+ import{h as i,r as s,c as t}from"./p-DOjVAAtq.js";import{am as e,aj as r,af as o,D as l}from"./p-xDbRW9xn.js";import{S as d}from"./p-BhCH9S0e.js";import"./p-CZfYo5-1.js";import{c as n,J as a}from"./p-l8F_7Ihw.js";import{C as h,a as c}from"./p-Cjcsf8ku.js";import{B as u}from"./p-DQZ5VHTZ.js";import{B as v}from"./p-BlJnA265.js";import{m as p}from"./p-DH8F0bsw.js";import{S as m}from"./p-T2yENPvU.js";import"./p-a6tcNl_T.js";import"./p-HXpYMWUU.js";import{j as f,i as w,b as x}from"./p-C98BC5W5.js";import"./p-CLHwhyvu.js";import"./p-BH0Xfn-F.js";import{g as j,a as g}from"./p-D2muobcE.js";import{T as y}from"./p-CCLgieAN.js";import{l as b}from"./p-Bgnhf5c9.js";import"./p-Csfiax9X.js";import"./p-DdZLLkQ5.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-DdMxswn1.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%"}))),S=()=>i("div",{class:"row gap-5"},i("div",{class:"col-12"},i(m,{width:"40%",height:"40px"})),i(C,null)),k=()=>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)))))),B=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 u})({onSuccess:({business:i})=>{this.business=new v(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:g(a.error),code:j(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=j(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:g(d.error),code:j(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=j(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(S,null),this.loading.terminals&&i("div",{class:"mt-5"},i(k,null),i(k,null),i(k,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,b(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:"5e7da5050d127f6470bc12f9cf547fe421ce1897"},i("div",{key:"6a1f46676ef1f31f6cfeb642001a0dd3f8a60072",part:l},this.renderLoading(),this.renderBusinessDetails(),this.renderTerminals(),this.renderOrderSection()))}};export{B as justifi_order_terminals}
@@ -1 +1 @@
1
- import{r as s,c as i,h as t}from"./p-DOjVAAtq.js";import{E as r}from"./p-CH8Y3GSr.js";import{B as o}from"./p-DQZ5VHTZ.js";import{m as p}from"./p-DH8F0bsw.js";import{C as e,a as m}from"./p-Cjcsf8ku.js";import{c as n,J as h}from"./p-D5Jb9OcR.js";import"./p-xDbRW9xn.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D2muobcE.js";import"./p-DL-q4EcN.js";const a=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){n(),this.analytics=new h(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeGetBusiness(){if(!this.businessId||!this.authToken)return this.errorMessage="Invalid business id or auth token",void this.errorEvent.emit({errorCode:m.MISSING_PROPS,message:this.errorMessage,severity:e.ERROR});this.getBusiness=p({id:this.businessId,authToken:this.authToken,service:new o})}render(){return this.errorMessage?r(this.errorMessage):t("business-details-core",{getBusiness:this.getBusiness,"onError-event":this.handleErrorEvent})}};export{a as justifi_business_details}
1
+ import{r as s,c as i,h as t}from"./p-DOjVAAtq.js";import{E as r}from"./p-CH8Y3GSr.js";import{B as o}from"./p-DQZ5VHTZ.js";import{m as p}from"./p-DH8F0bsw.js";import{C as e,a as m}from"./p-Cjcsf8ku.js";import{c as n,J as h}from"./p-l8F_7Ihw.js";import"./p-xDbRW9xn.js";import"./p-DdZLLkQ5.js";import"./p-a6tcNl_T.js";import"./p-DdMxswn1.js";import"./p-Bgnhf5c9.js";import"./p-HXpYMWUU.js";import"./p-C98BC5W5.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D2muobcE.js";import"./p-Csfiax9X.js";const a=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){n(),this.analytics=new h(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeGetBusiness(){if(!this.businessId||!this.authToken)return this.errorMessage="Invalid business id or auth token",void this.errorEvent.emit({errorCode:m.MISSING_PROPS,message:this.errorMessage,severity:e.ERROR});this.getBusiness=p({id:this.businessId,authToken:this.authToken,service:new o})}render(){return this.errorMessage?r(this.errorMessage):t("business-details-core",{getBusiness:this.getBusiness,"onError-event":this.handleErrorEvent})}};export{a as justifi_business_details}