@justifi/webcomponents 6.5.1-rc.4 → 6.5.1-rc.7

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 (119) hide show
  1. package/dist/cjs/{check-pkg-version-Bj0XkWnL.js → check-pkg-version-BHAFLsKe.js} +1 -1
  2. package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
  3. package/dist/cjs/internal-tokenize-payment-method_7.cjs.entry.js +2 -2
  4. package/dist/cjs/justifi-apple-pay_7.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-Dptg-P5y.js → package-CZK-K7yM.js} +1 -1
  25. package/dist/docs.json +1 -1
  26. package/dist/esm/{check-pkg-version-D6a-vvrO.js → check-pkg-version-ClZuo82s.js} +1 -1
  27. package/dist/esm/hidden-input_2.entry.js +1 -1
  28. package/dist/esm/internal-tokenize-payment-method_7.entry.js +2 -2
  29. package/dist/esm/justifi-apple-pay_7.entry.js +2 -2
  30. package/dist/esm/justifi-business-details.entry.js +2 -2
  31. package/dist/esm/justifi-business-form.entry.js +2 -2
  32. package/dist/esm/justifi-checkout.entry.js +2 -2
  33. package/dist/esm/justifi-checkouts-list.entry.js +2 -2
  34. package/dist/esm/justifi-dispute-management.entry.js +2 -2
  35. package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
  36. package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
  37. package/dist/esm/justifi-order-terminals.entry.js +2 -2
  38. package/dist/esm/justifi-payment-details.entry.js +2 -2
  39. package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
  40. package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
  41. package/dist/esm/justifi-payments-list.entry.js +2 -2
  42. package/dist/esm/justifi-payout-details.entry.js +2 -2
  43. package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
  44. package/dist/esm/justifi-payouts-list.entry.js +2 -2
  45. package/dist/esm/justifi-refund-payment.entry.js +2 -2
  46. package/dist/esm/justifi-season-interruption-insurance.entry.js +2 -2
  47. package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
  48. package/dist/esm/justifi-terminals-list.entry.js +2 -2
  49. package/dist/esm/{package-czPIvHxt.js → package-C3_8r8V7.js} +1 -1
  50. package/dist/module/package.js +1 -1
  51. package/dist/webcomponents/{p-2bd821a8.entry.js → p-082efda3.entry.js} +1 -1
  52. package/dist/webcomponents/{p-f6ec50c9.entry.js → p-12499226.entry.js} +1 -1
  53. package/dist/webcomponents/p-1ddddc82.entry.js +1 -0
  54. package/dist/webcomponents/p-215ce79e.entry.js +1 -0
  55. package/dist/webcomponents/{p-aec7a3c8.entry.js → p-239d1d07.entry.js} +1 -1
  56. package/dist/webcomponents/{p-0b760c4f.entry.js → p-23a3e38e.entry.js} +1 -1
  57. package/dist/webcomponents/{p-21c060ce.entry.js → p-27b88afd.entry.js} +1 -1
  58. package/dist/webcomponents/{p-75f3161c.entry.js → p-2a347349.entry.js} +1 -1
  59. package/dist/webcomponents/{p-9d67209d.entry.js → p-3787cf63.entry.js} +1 -1
  60. package/dist/webcomponents/{p-db17bc59.entry.js → p-476ebd43.entry.js} +1 -1
  61. package/dist/webcomponents/p-64ddd8ea.entry.js +1 -0
  62. package/dist/webcomponents/p-7becc3d3.entry.js +1 -0
  63. package/dist/webcomponents/p-8071daf3.entry.js +1 -0
  64. package/dist/webcomponents/{p-26e95adb.entry.js → p-93aa2d31.entry.js} +1 -1
  65. package/dist/webcomponents/{p-e07bf523.entry.js → p-9e346c2e.entry.js} +1 -1
  66. package/dist/webcomponents/p-C3_8r8V7.js +1 -0
  67. package/dist/webcomponents/p-a9ea2c82.entry.js +1 -0
  68. package/dist/webcomponents/{p-306c7c33.entry.js → p-aaef1450.entry.js} +1 -1
  69. package/dist/webcomponents/{p-e00fb7b1.entry.js → p-beb0a3c8.entry.js} +1 -1
  70. package/dist/webcomponents/{p-3aaedf9d.entry.js → p-d3697504.entry.js} +1 -1
  71. package/dist/webcomponents/{p-d7a06b34.entry.js → p-d9c090b6.entry.js} +1 -1
  72. package/dist/webcomponents/{p-38ff97ea.entry.js → p-f11eb1bc.entry.js} +1 -1
  73. package/dist/webcomponents/{p-5981869a.entry.js → p-f358610a.entry.js} +1 -1
  74. package/dist/webcomponents/{p-CApezhx9.js → p-sassRpOu.js} +1 -1
  75. package/dist/webcomponents/webcomponents.esm.js +1 -1
  76. package/docs/entities/businessdetails/index.mdx +55 -72
  77. package/docs/entities/businessform/index.mdx +13 -19
  78. package/docs/entities/payment-provisioning/index.mdx +9 -17
  79. package/docs/helpers/PartsTable.jsx +29 -0
  80. package/docs/helpers/PropsTable.jsx +35 -0
  81. package/docs/helpers/{version.ts → version.js} +2 -2
  82. package/docs/merchant-tools/checkouts-list/index.mdx +50 -64
  83. package/docs/merchant-tools/gross-payments-chart/index.mdx +17 -19
  84. package/docs/merchant-tools/order-terminals/index.mdx +13 -17
  85. package/docs/merchant-tools/payment-details/index.mdx +13 -16
  86. package/docs/merchant-tools/payment-transactions-list/index.mdx +13 -17
  87. package/docs/merchant-tools/payments-list/index.mdx +13 -19
  88. package/docs/merchant-tools/payout-details/index.mdx +47 -57
  89. package/docs/merchant-tools/payout-transactions-list/index.mdx +13 -17
  90. package/docs/merchant-tools/payouts-list/index.mdx +13 -19
  91. package/docs/merchant-tools/terminal-orders-list/index.mdx +13 -17
  92. package/docs/merchant-tools/terminals-list/index.mdx +13 -17
  93. package/docs/modular-checkout/index.mdx +0 -5
  94. package/docs/modular-checkout/introduction/index.mdx +13 -15
  95. package/docs/modular-checkout/sub-components/apple-pay.mdx +27 -22
  96. package/docs/modular-checkout/sub-components/bank-account-form.mdx +51 -51
  97. package/docs/modular-checkout/sub-components/card-form.mdx +50 -54
  98. package/docs/modular-checkout/sub-components/payment-method-options.mdx +13 -15
  99. package/docs/modular-checkout/sub-components/plaid-payment-method.mdx +33 -55
  100. package/docs/modular-checkout/sub-components/saved-payment-methods.mdx +56 -55
  101. package/docs/modular-checkout/sub-components/season-interruption-insurance.mdx +21 -24
  102. package/docs/modular-checkout/sub-components/sezzle-payment-method.mdx +104 -109
  103. package/docs/modular-checkout/sub-components/summary.mdx +13 -14
  104. package/docs/payment-facilitation/dispute-management/index.mdx +13 -17
  105. package/docs/payment-facilitation/refund-payment/index.mdx +22 -15
  106. package/docs/payment-facilitation/tokenize-payment-method/index.mdx +28 -45
  107. package/docs/payment-facilitation/unified-fintech-checkout/342/204/242/index.mdx +104 -123
  108. package/package.json +1 -1
  109. package/dist/webcomponents/p-50a4d4c4.entry.js +0 -1
  110. package/dist/webcomponents/p-7661c41a.entry.js +0 -1
  111. package/dist/webcomponents/p-92a43706.entry.js +0 -1
  112. package/dist/webcomponents/p-9ef4288b.entry.js +0 -1
  113. package/dist/webcomponents/p-c9b50493.entry.js +0 -1
  114. package/dist/webcomponents/p-czPIvHxt.js +0 -1
  115. package/dist/webcomponents/p-deda2e9d.entry.js +0 -1
  116. package/docs/helpers/PartsTable.ts +0 -55
  117. package/docs/helpers/PropsTable.ts +0 -63
  118. package/docs/modular-checkout/docs/index.mdx +0 -32
  119. package/docs/modular-checkout/example/index.mdx +0 -25
@@ -1 +1 @@
1
- import{r as e,c as t,h as s}from"./p-DwYM91AU.js";import{f as i}from"./p-BS7OgSQe.js";import{D as a,am as r}from"./p-wtuY7MT2.js";import{B as d}from"./p-Bqlcv3ZV.js";import{S as c}from"./p-BP2sTIQV.js";import{S as o}from"./p-c7MCfTgE.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-D_IJC4HG.js";import{D as u}from"./p-Bg2SZArf.js";import{c as b,J as y}from"./p-CApezhx9.js";import"./p-HXpYMWUU.js";import"./p-C8yN3uBj.js";import"./p-tGDdRx0W.js";import"./p-BYsgavgS.js";import"./p-BpaE8q5f.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-czPIvHxt.js";const v=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.submitDisputeResponse(t,e,i);if(d.error){return r({error:f(d.error),code:p(null===(c=d.error)||void 0===c?void 0:c.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()}},m=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(){v({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})}isDueDatePassed(){var e;if(!(null===(e=this.dispute)||void 0===e?void 0:e.due_date))return!1;const t=new Date(this.dispute.due_date.replace(/-/g,"/").replace(/T.+/,"")),s=new Date;return s.setHours(0,0,0,0),t.setHours(0,0,0,0),t<s}render(){var e,t,n,h,p,f,l,u,b;return s(c,{key:"a494374453528ee6033589ed69dd2a0738ff8aaa"},this.isLoading&&s("div",{key:"436d266650297674d89f1ba2d299bf3ebdf16506",style:{marginBottom:"8px"}},s(o,{key:"952e9df74b83809b3a52d629ed05bc54b02754a5",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(o,{key:"f3dd82b6b941500202404ec1353c2f951f79b642",height:"18px",styles:{marginBottom:"8px"}}),s(o,{key:"608229cd12404e5e6f7014f955c24f9ff856a14f",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&this.isDueDatePassed()&&s("div",{key:"6d18b253eaa245b9f7b817c3baf473d6f6a31845",part:a},s("h1",{key:"7f7e30f8c7a9753970980796790b621a6d373548",class:"h4",part:r},"The due date (",null===(t=this.dispute)||void 0===t?void 0:t.due_date,") for this dispute has passed"),s("p",{key:"1c458aecef8ce286b6c2a46e286c57e1276aff04"},"You can no longer submit evidence to counter this dispute.")),(null===(n=this.dispute)||void 0===n?void 0:n.needsResponse)&&!this.isDueDatePassed()&&s("div",{key:"b3e85abf813bd36da6c952c9ad7c9357504bbc1d",part:a},s("h1",{key:"afcbe8f967170bc4abea0c71749a10e1c09937e0",class:"h4",part:r},"This payment is disputed"),s("p",{key:"30194ebea5f1763286f1a69f8fb2cd8c2c9d2d90"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"991505b018e4ee61b05c9872244163b729ee0cd1",class:"h5"},"Dispute details"),s("div",{key:"b94e62444ce05ac0ef6698a4b67f70088c10a9b4",class:"d-table gap-2"},s("div",{key:"8873c8b0cab9bf5e56add69007e9b281c64dcbf3",class:"d-table-row gap-2"},s("span",{key:"0c9cf9564277ba952c1b36acc7fa8660ec969266",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"0461b3c75b74e03b60dae12d80526b119d1e74d5",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(h=this.dispute)||void 0===h?void 0:h.amount))),s("div",{key:"074f92623a156b5c431719a8c11870c95377dfc1",class:"d-table-row gap-2"},s("span",{key:"04e1498ecb4d64f122c27ef0a83c38d843c72cad",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"fc3c56b35d899c06130b918cf03202cc9f44fa46",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(p=this.dispute)||void 0===p?void 0:p.reason)),s("div",{key:"13eca44a73967f235a18e2f8818a008f14a96ba2",class:"d-table-row gap-2"},s("span",{key:"954a86a2f0b77801a7c69c751a2b398f33bb2fe1",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Due Date"),s("span",{key:"21e305a5cdc269f45439671639e3984e68cb75e0",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(f=this.dispute)||void 0===f?void 0:f.due_date))),s("div",{key:"cad8b592ab80d24b3d4ce187eb534a336bd36581",class:"d-flex gap-2 mt-4 justify-content-end"},s(d,{key:"077df79dae040c41489d1206fffde036aef51954",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(d,{key:"eb26cd7bc9d93c83eefc927c565f321eb3c2bef1",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(l=this.dispute)||void 0===l?void 0:l.underReview)&&s("div",{key:"f74d8e95a2ae74e1b59ac414d0a0d5cc43dd0291"},s("h1",{key:"2404542678c5ad29dd4e3af13edebbace06734d6",class:"h4"},"This payment is disputed and under review"),s("p",{key:"0027bd32af1b0ab4ffdd42fcc0b21cb7ab55835a"},"The cardholder is disputing this payment. A counter dispute has been submitted and is under review.")),(null===(u=this.dispute)||void 0===u?void 0:u.won)&&s("div",{key:"ff335c7dbe7bda7637d1b27a65150785e81361bc"},s("h1",{key:"36ee4c439d8e1346c115ba6f28e59008ce68d4e1",class:"h4"},"This payment was disputed"),s("p",{key:"5e6e6869d956f6ea84e64378e4bfaebeb71109b0"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(b=this.dispute)||void 0===b?void 0:b.lost)&&s("div",{key:"d67894655a47ac5327540c55fdd97db472d34f9d"},s("h1",{key:"dec3b5da213071a75183eab6e1521c5c986d3876",class:"h4"},"This payment was disputed"),s("p",{key:"806eb5f32bddde1c298eba9517c637a7fb69f598"},"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 c;try{const d=await s.updateDisputeResponse(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(c=d.error)||void 0===c?void 0:c.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 c;try{const d=await s.createDisputeEvidence(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(c=d.error)||void 0===c?void 0:c.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=v({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(c,{key:"ed6376969ab6a686999b8a31376b3c1cc8c7b566"},s("justifi-dispute-response-core",{key:"d823732d71613e9e98305d4b7d3c22af0344d209","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"]}}},w=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:"b23c5bc27b1f657b9211d3a3482ae5b99982754e",class:"row gy-3"},s("div",{key:"a630f3c475d6b8026a81724c76340dc4f6088b26",class:"col-12"},s("h1",{key:"f4e848277ee8f1ec05ef1b1dfbac0e8872d9d91f",class:"h4",part:r},"Counter dispute")),s("div",{key:"6f7f21778853a3c1ac173ac79713f5427a226a5b",class:"col-12"},this.currentStepComponent),s("div",{key:"7354846a446f5677a12a3113b3f4226060a8b86a",class:"col-12"},s("div",{key:"4fb9dbccff8b004913656c3a130b46a0216dd6bb",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{m as justifi_dispute_notification,k as justifi_dispute_response,w as justifi_dispute_response_core}
1
+ import{r as e,c as t,h as s}from"./p-DwYM91AU.js";import{f as i}from"./p-BS7OgSQe.js";import{D as a,am as r}from"./p-wtuY7MT2.js";import{B as d}from"./p-Bqlcv3ZV.js";import{S as c}from"./p-BP2sTIQV.js";import{S as o}from"./p-c7MCfTgE.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 u}from"./p-D_IJC4HG.js";import{D as l}from"./p-Bg2SZArf.js";import{c as b,J as y}from"./p-sassRpOu.js";import"./p-HXpYMWUU.js";import"./p-C8yN3uBj.js";import"./p-tGDdRx0W.js";import"./p-BYsgavgS.js";import"./p-BpaE8q5f.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-C3_8r8V7.js";const v=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.submitDisputeResponse(t,e,i);if(d.error){return r({error:f(d.error),code:p(null===(c=d.error)||void 0===c?void 0:c.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()}},m=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(){v({disputeId:this.dispute.id,authToken:this.authToken,service:new u})({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:l.respondToDispute})}isDueDatePassed(){var e;if(!(null===(e=this.dispute)||void 0===e?void 0:e.due_date))return!1;const t=new Date(this.dispute.due_date.replace(/-/g,"/").replace(/T.+/,"")),s=new Date;return s.setHours(0,0,0,0),t.setHours(0,0,0,0),t<s}render(){var e,t,n,h,p,f,u,l,b;return s(c,{key:"a494374453528ee6033589ed69dd2a0738ff8aaa"},this.isLoading&&s("div",{key:"436d266650297674d89f1ba2d299bf3ebdf16506",style:{marginBottom:"8px"}},s(o,{key:"952e9df74b83809b3a52d629ed05bc54b02754a5",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(o,{key:"f3dd82b6b941500202404ec1353c2f951f79b642",height:"18px",styles:{marginBottom:"8px"}}),s(o,{key:"608229cd12404e5e6f7014f955c24f9ff856a14f",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&this.isDueDatePassed()&&s("div",{key:"6d18b253eaa245b9f7b817c3baf473d6f6a31845",part:a},s("h1",{key:"7f7e30f8c7a9753970980796790b621a6d373548",class:"h4",part:r},"The due date (",null===(t=this.dispute)||void 0===t?void 0:t.due_date,") for this dispute has passed"),s("p",{key:"1c458aecef8ce286b6c2a46e286c57e1276aff04"},"You can no longer submit evidence to counter this dispute.")),(null===(n=this.dispute)||void 0===n?void 0:n.needsResponse)&&!this.isDueDatePassed()&&s("div",{key:"b3e85abf813bd36da6c952c9ad7c9357504bbc1d",part:a},s("h1",{key:"afcbe8f967170bc4abea0c71749a10e1c09937e0",class:"h4",part:r},"This payment is disputed"),s("p",{key:"30194ebea5f1763286f1a69f8fb2cd8c2c9d2d90"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"991505b018e4ee61b05c9872244163b729ee0cd1",class:"h5"},"Dispute details"),s("div",{key:"b94e62444ce05ac0ef6698a4b67f70088c10a9b4",class:"d-table gap-2"},s("div",{key:"8873c8b0cab9bf5e56add69007e9b281c64dcbf3",class:"d-table-row gap-2"},s("span",{key:"0c9cf9564277ba952c1b36acc7fa8660ec969266",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"0461b3c75b74e03b60dae12d80526b119d1e74d5",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(h=this.dispute)||void 0===h?void 0:h.amount))),s("div",{key:"074f92623a156b5c431719a8c11870c95377dfc1",class:"d-table-row gap-2"},s("span",{key:"04e1498ecb4d64f122c27ef0a83c38d843c72cad",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"fc3c56b35d899c06130b918cf03202cc9f44fa46",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(p=this.dispute)||void 0===p?void 0:p.reason)),s("div",{key:"13eca44a73967f235a18e2f8818a008f14a96ba2",class:"d-table-row gap-2"},s("span",{key:"954a86a2f0b77801a7c69c751a2b398f33bb2fe1",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Due Date"),s("span",{key:"21e305a5cdc269f45439671639e3984e68cb75e0",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(f=this.dispute)||void 0===f?void 0:f.due_date))),s("div",{key:"cad8b592ab80d24b3d4ce187eb534a336bd36581",class:"d-flex gap-2 mt-4 justify-content-end"},s(d,{key:"077df79dae040c41489d1206fffde036aef51954",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(d,{key:"eb26cd7bc9d93c83eefc927c565f321eb3c2bef1",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(u=this.dispute)||void 0===u?void 0:u.underReview)&&s("div",{key:"f74d8e95a2ae74e1b59ac414d0a0d5cc43dd0291"},s("h1",{key:"2404542678c5ad29dd4e3af13edebbace06734d6",class:"h4"},"This payment is disputed and under review"),s("p",{key:"0027bd32af1b0ab4ffdd42fcc0b21cb7ab55835a"},"The cardholder is disputing this payment. A counter dispute has been submitted and is under review.")),(null===(l=this.dispute)||void 0===l?void 0:l.won)&&s("div",{key:"ff335c7dbe7bda7637d1b27a65150785e81361bc"},s("h1",{key:"36ee4c439d8e1346c115ba6f28e59008ce68d4e1",class:"h4"},"This payment was disputed"),s("p",{key:"5e6e6869d956f6ea84e64378e4bfaebeb71109b0"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(b=this.dispute)||void 0===b?void 0:b.lost)&&s("div",{key:"d67894655a47ac5327540c55fdd97db472d34f9d"},s("h1",{key:"dec3b5da213071a75183eab6e1521c5c986d3876",class:"h4"},"This payment was disputed"),s("p",{key:"806eb5f32bddde1c298eba9517c637a7fb69f598"},"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 c;try{const d=await s.updateDisputeResponse(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(c=d.error)||void 0===c?void 0:c.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 u}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var c;try{const d=await s.createDisputeEvidence(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(c=d.error)||void 0===c?void 0:c.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 u}),this.submitDisputeResponse=v({disputeId:this.disputeId,authToken:this.authToken,service:new u})):(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(c,{key:"ed6376969ab6a686999b8a31376b3c1cc8c7b566"},s("justifi-dispute-response-core",{key:"d823732d71613e9e98305d4b7d3c22af0344d209","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"]}}},w=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:l.cancelDispute})},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:l.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:l.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:l.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:"b23c5bc27b1f657b9211d3a3482ae5b99982754e",class:"row gy-3"},s("div",{key:"a630f3c475d6b8026a81724c76340dc4f6088b26",class:"col-12"},s("h1",{key:"f4e848277ee8f1ec05ef1b1dfbac0e8872d9d91f",class:"h4",part:r},"Counter dispute")),s("div",{key:"6f7f21778853a3c1ac173ac79713f5427a226a5b",class:"col-12"},this.currentStepComponent),s("div",{key:"7354846a446f5677a12a3113b3f4226060a8b86a",class:"col-12"},s("div",{key:"4fb9dbccff8b004913656c3a130b46a0216dd6bb",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{m as justifi_dispute_notification,k as justifi_dispute_response,w as justifi_dispute_response_core}
@@ -0,0 +1 @@
1
+ import{h as s,r as i,c as t}from"./p-DwYM91AU.js";import{ao as e,am as r,af as o,D as l}from"./p-wtuY7MT2.js";import{S as d}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{c as n,J as a}from"./p-sassRpOu.js";import{C as h,a as c}from"./p-Cjcsf8ku.js";import{B as u}from"./p-BCPutgAi.js";import{B as v}from"./p-B5rtFhtR.js";import{m as p}from"./p-sCHf--Vc.js";import{S as m}from"./p-c7MCfTgE.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{j as f,i as w,b as g}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-BH0Xfn-F.js";import{g as x,a as j}from"./p-D2muobcE.js";import{T as y}from"./p-MQxr_LMC.js";import{k as b}from"./p-BS7OgSQe.js";import"./p-C3_8r8V7.js";import"./p-C8yN3uBj.js";import"./p-BYsgavgS.js";const S=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(m,{width:"25%"})),s("div",{class:"col-12"},s(m,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(m,{width:"50%"}),s(m,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(m,{width:"65%"}),s(m,{width:"35%"}))),C=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(m,{width:"40%",height:"40px"})),s(S,null)),k=()=>s("div",{class:"terminal-selector-skeleton mt-4 rounded shadow-sm"},s("div",{class:"d-flex align-items-center gap-3"},s(m,{width:"125px",height:"125px",styles:{borderRadius:"8px"}}),s("div",{class:"flex-grow-1"},s("div",{class:"d-flex row flex-row"},s("div",{class:"col-6 flex-column"},s(m,null),s(m,{width:"60%"})),s("div",{class:"d-flex justify-content-end align-items-center gap-2 col-6"},s(m,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}),s(m,{width:"80px",height:"32px"}),s(m,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}))),s("div",{class:"mt-4"},s("div",{class:"d-flex flex-column gap-2"},s(m,null),s(m,null)))))),B=class{constructor(s){i(this,s),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?g.boardingShipping:g.boardingOnly}),n(),this.analytics=new a(this),this.loadData()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}handleError(s,i,t){this.error={message:s,code:i,severity:t},this.errorEvent.emit({errorCode:i,message:s,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:s})=>{this.business=new v(s),this.loading.business=!1},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t),this.loading.business=!1}})}initializeGetTerminalModels(){(({id:s,authToken:i,service:t})=>async({onSuccess:e,onError:r})=>{var o,l,d,n;try{const a=await t.fetchTerminalModels(s,i);if(a.error)return r({error:j(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((s=>new f(s))))||[],orderLimit:null===(d=a.data)||void 0===d?void 0:d.order_limit})}catch(s){const i=x(null==s?void 0:s.code);return r({error:s.message||s,code:i,severity:h.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new y})({onSuccess:({terminals:s,orderLimit:i})=>{this.terminalModels=s,this.orderLimit=i,this.loading.terminals=!1},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t),this.loading.terminals=!1}})}submitOrder(){const s=(({authToken:s,service:i,apiOrigin:t="https://wc-proxy.justifi.ai"})=>async({terminalOrder:e,onSuccess:r,onError:o})=>{var l;try{const d=await i.orderTerminals(s,e,t);if(d.error)return o({error:j(d.error),code:x(null===(l=d.error)||void 0===l?void 0:l.code),severity:h.ERROR});{const{data:s}=d;r({data:s})}}catch(s){const i=x(null==s?void 0:s.code);return o({error:s.message||s,code:i,severity:h.ERROR})}})({authToken:this.authToken,service:new y});this.submitting=!0,s({terminalOrder:this.order.payload,onSuccess:({data:s})=>{this.submitted.emit(s),this.submitting=!1},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t),this.submitting=!1}})}onSelectedQuantityChange(s){this.order.updateTerminal(s.detail.modelName,s.detail.quantity),this.totalQuantity=this.order.totalQuantity}renderLoading(){return s("div",null,this.loading.business&&s(C,null),this.loading.terminals&&s("div",{class:"mt-5"},s(k,null),s(k,null),s(k,null)))}renderBusinessDetails(){var i,t,o,l,d,n,a,h;if(!this.loading.business&&this.business)return s("div",{class:"d-flex flex-column gap-4 mb-5 pt-5"},s("div",{class:"row"},s("div",{class:"col-12"},s("h2",{part:r},this.business.legal_name))),s("div",{class:"row"},s("div",{class:"col-6"},s("h5",{part:e},"Representative:"),s("div",null,s("div",null,null===(t=null===(i=this.business)||void 0===i?void 0:i.representative)||void 0===t?void 0:t.name),s("div",null,null===(l=null===(o=this.business)||void 0===o?void 0:o.representative)||void 0===l?void 0:l.title),s("div",null,null===(n=null===(d=this.business)||void 0===d?void 0:d.representative)||void 0===n?void 0:n.email),s("div",null,b(null===(h=null===(a=this.business)||void 0===a?void 0:a.representative)||void 0===h?void 0:h.phone)))),s("div",{class:"col-6"},s("h5",{part:e},this.shipping?"Shipping Address:":"Business Address:"),s("div",null,this.business.legal_address.line1,this.business.legal_address.line2?`, ${this.business.legal_address.line2}`:"",s("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 s("div",{class:"d-flex flex-column gap-2 mt-5"},this.terminalModels.map((i=>s("terminal-quantity-selector",{modelName:i.model_name,description:i.description,imageUrl:i.image_url,helpUrl:i.help_url,limit:this.orderLimit-this.order.totalQuantity,onSelectedQuantityChange:this.onSelectedQuantityChange.bind(this)}))))}renderOrderSection(){return s("div",{class:"mt-3"},s("div",{class:"text-end"},"Order limit: ",this.orderLimit),s("div",{class:"d-flex justify-content-end mt-3"},s("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 s(d,{key:"f9c515ea3cf3dd616d894cef2cc64789663608e8"},s("div",{key:"6b3d49555fe21563c251896300d313bed336f9fd",part:l},this.renderLoading(),this.renderBusinessDetails(),this.renderTerminals(),this.renderOrderSection()))}};export{B as justifi_order_terminals}
@@ -0,0 +1 @@
1
+ import{r as s,c as t,h as r}from"./p-DwYM91AU.js";import{A as o}from"./p-C8yN3uBj.js";import{C as i,a as e}from"./p-Cjcsf8ku.js";import"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as a,a as p}from"./p-D2muobcE.js";import{E as n}from"./p-BNqo3kt0.js";import{c as h,J as c}from"./p-sassRpOu.js";import"./p-tGDdRx0W.js";import"./p-BYsgavgS.js";import"./p-BS7OgSQe.js";import"./p-HXpYMWUU.js";import"./p-wtuY7MT2.js";import"./p-C3_8r8V7.js";const m=o();class u{async fetchGrossVolumeChartData(s,t){return m.get({endpoint:`account/${s}/reports/gross_volume`,authToken:t})}}const d=class{constructor(r){s(this,r),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){h(),this.analytics=new c(this),this.initializeGetGrossPayment()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetGrossPayment()}initializeGetGrossPayment(){this.accountId&&this.authToken?this.getGrossPayment=(({id:s,authToken:t,service:r})=>async({onSuccess:o,onError:e})=>{var n;try{const h=await r.fetchGrossVolumeChartData(s,t);h.error?e({error:p(h.error),code:a(null===(n=h.error)||void 0===n?void 0:n.code),severity:i.ERROR}):o(h.data)}catch(s){const t=a(null==s?void 0:s.code);e({error:p(s),code:t,severity:i.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new u}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}render(){return this.errorMessage?n(this.errorMessage):r("gross-payment-chart-core",{getGrossPayment:this.getGrossPayment,"onError-event":this.handleErrorEvent})}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{d as justifi_gross_payment_chart}
@@ -0,0 +1 @@
1
+ import{r as s,c as r,h as t}from"./p-DwYM91AU.js";import{S as i}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{c as e,J as o}from"./p-sassRpOu.js";import{d as a}from"./p-CFevTCAJ.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as n,a as p}from"./p-Cjcsf8ku.js";import{i as c}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as m,a as d}from"./p-D2muobcE.js";import{A as h}from"./p-C8yN3uBj.js";import"./p-C3_8r8V7.js";import"./p-wtuY7MT2.js";import"./p-BS7OgSQe.js";import"./p-DOLBAxYf.js";import"./p-BYsgavgS.js";const l=h();class u{async fetchTerminalOrders(s,r,t){return l.get({endpoint:"terminals/orders",params:t,headers:{account:s},authToken:r})}}const f=class{constructor(t){s(this,t),this.errorEvent=r(this,"error-event"),this.errorMessage=null,this.columns=a,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){e(),this.analytics=new o(this),this.initializeGetData()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeGetData(){this.accountId&&this.authToken?this.getTerminalOrders=(({id:s,authToken:r,service:t})=>async({params:i,onSuccess:e,onError:o,final:a})=>{var p,h;try{const a=await t.fetchTerminalOrders(s,r,i);if(a.error)return o({error:d(a.error),code:m(null===(h=a.error)||void 0===h?void 0:h.code),severity:n.ERROR});{const s=Object.assign({},a.page_info);e({terminalOrders:(null===(p=a.data)||void 0===p?void 0:p.map((s=>new c(s))))||[],pagingInfo:s})}}catch(s){const r=m(null==s?void 0:s.code);return o({error:s.message||s,code:r,severity:n.ERROR})}finally{return a()}})({id:this.accountId,authToken:this.authToken,service:new u}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:p.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}render(){return t(i,{key:"f89cb75d014a5d43c6766f0e0e7a572807c3df9f"},t("terminal-orders-list-core",{key:"c38fd6424ebca672c9577255d81b9e97712f3b9b",getTerminalOrders:this.getTerminalOrders,"onError-event":this.handleErrorEvent,columns:this.columns}))}};export{f as justifi_terminal_orders_list}
@@ -1 +1 @@
1
- import{h as t,r as e,c as i,H as s,g as n}from"./p-DwYM91AU.js";import{A as a}from"./p-C8yN3uBj.js";import{S as o}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{S as r}from"./p-c7MCfTgE.js";import{c as l,o as c,g as h,a as d,b as u}from"./p-DU8dqq9U.js";import{D as p,r as y}from"./p-wtuY7MT2.js";import{f as m}from"./p-BS7OgSQe.js";import{H as v}from"./p-zNSPsvs3.js";import{H as M,b as f,h as g,i as b}from"./p-nrZ9yHcl.js";import{H as k}from"./p-C-2kW6Al.js";import{J as w,c as A}from"./p-CApezhx9.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as j,a as T,b as N}from"./p-Cjcsf8ku.js";import{I as P}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as E,a as I}from"./p-D2muobcE.js";import{C}from"./p-B4ZUYyNh.js";import{P as D,a as S,b as x}from"./p-DCIW8z1f.js";import{C as O}from"./p-ZpPDShvP.js";import"./p-BYsgavgS.js";import"./p-czPIvHxt.js";var L,z,R,_,U;!function(t){t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_FAILURE="STATUS_FAILURE"}(L||(L={})),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"}(z||(z={})),function(t){t.BLACK="black",t.WHITE="white",t.WHITE_OUTLINE="white-outline"}(R||(R={})),function(t){t.SUPPORTS_3DS="supports3DS",t.SUPPORTS_EMV="supportsEMV",t.SUPPORTS_CREDIT="supportsCredit",t.SUPPORTS_DEBIT="supportsDebit"}(_||(_={}));class B{constructor(t){this.merchantIdentifier=t.merchantIdentifier,this.displayName=t.displayName,this.initiative=t.initiative,this.initiativeContext=t.initiativeContext,this.buttonType=t.buttonType||z.PLAIN,this.buttonStyle=t.buttonStyle||R.BLACK,this.buttonLocale=t.buttonLocale||"en-US"}get isValid(){return!!(this.merchantIdentifier&&this.displayName&&this.initiative&&this.initiativeContext)}}class Y{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 Q{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"}(U||(U={}));class F{constructor(){this.api=a()}initialize(t){if(this.applePayConfig=new B(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 Q.isApplePaySupported()&&Q.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await Q.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 Y(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:U.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:U.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:U.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:Q.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),r=await this.processPayment(i,s,o);r.success?(this.currentSession.completePayment({status:L.STATUS_SUCCESS}),t({success:!0,token:a.token,paymentMethodId:r.data.id})):(console.error("PSP reported payment failure:",r.data),this.currentSession.completePayment({status:L.STATUS_FAILURE}),e({success:!1,error:{code:U.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:L.STATUS_FAILURE}),e({success:!1,error:{code:U.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:L.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:U.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:U.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:Q.getDefaultMerchantCapabilities(),supportedNetworks:Q.getDefaultSupportedNetworks(),total:Q.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const V=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},H=e=>t("div",{class:"apple-pay-button-container"},t("button",Object.assign({class:(()=>{let t="apple-pay-button";switch(e.buttonStyle){case R.WHITE:t+=" apple-pay-button-white";break;case R.WHITE_OUTLINE:t+=" apple-pay-button-white-outline";break;default:t+=" apple-pay-button-black"}switch(e.buttonType){case z.BUY:t+=" apple-pay-button-type-buy";break;case z.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 ")),Z=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=z.PLAIN,this.buttonStyle=R.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:Q.getDefaultSupportedNetworks(),total:Q.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)||Z.ErrorCode.PAYMENT_FAILED}))}catch(t){const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e,code:Z.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:Z.ErrorCode.CONFIG_ERROR}),void(this.isLoading=!1);if(this.isAvailable=Q.isApplePaySupported(),this.canMakePayments=Q.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:Z.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:Z.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:Z.ErrorCode.INITIALIZATION_ERROR})}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?Q.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(V,{isLoading:this.isLoading}),e&&t(H,{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 "))}};Z.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:"fd2c61dcafdc800d0064c19d29c6e007aed5adb5"},t("section",{key:"f2abef1233f3ccad3982d10c61ec5765e13e27a5"},t("div",{key:"713d66ef6f7e2fc73135e765069baba6df976f52"},t("div",{key:"b8dd28f257948aa317366fe3ea6d2bc4911ef164",part:p},null==l?void 0:l.paymentDescription),t("div",{key:"675676b40de7dc27d07bfafc0eee77eb855a3d26"},t("span",{key:"cbd47994d9c3f1518741a298de3f5d62a0ad5313",part:p},"Total")," ",t("span",{key:"614748853f666f1b072d4fa9b14ee15ef5717112",part:p},m(+(null==l?void 0:l.totalAmount)))))))}},q=class{constructor(t){e(this,t),this.levels={h1:v,h2:M,h3:k},this.level="h1"}render(){return t(o,{key:"d4871da09451d40b27220a207ee72317ed9b1b9f"},t(this.levels[this.level],{key:"f7de159fa6395ef4024f48b868369f8d10edf64e",text:this.text,class:this.class}))}},G=a();class J{async getLinkToken(t,e,i,s){return G.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),G.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 J,this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:n}=t.detail;e&&i?(l.paymentToken=s,l.selectedPaymentMethod={type:D.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:T.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 C};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:I(o.error),code:E(null===(a=o.error)||void 0===a?void 0:a.code),severity:j.ERROR});s({checkout:o.data})}catch(t){const e=E(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:I(r.error),code:E(null===(o=r.error)||void 0===o?void 0:o.code),severity:j.ERROR});n({checkout:r.data})}catch(t){const e=E(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 w(this),A(),l.authToken=this.authToken,this.fetchCheckout(),f("set",(t=>{const e=b[t];void 0!==e&&g(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:N.CHECKOUT_EXPIRED,errorCode:T.CHECKOUT_EXPIRED,severity:j.ERROR}):this.errorEvent.emit({message:N.CHECKOUT_ALREADY_COMPLETED,errorCode:T.CHECKOUT_ALREADY_COMPLETED,severity:j.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:t.code,severity:t.severity})}}):this.errorEvent.emit({message:N.NOT_AUTHENTICATED,errorCode:T.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 S(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)===D.NEW_CARD,n=(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)===D.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:T.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:T.VALIDATION_ERROR,severity:j.ERROR});const r=(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)===D.NEW_CARD,c=(null===(i=l.selectedPaymentMethod)||void 0===i?void 0:i.type)===D.NEW_BANK_ACCOUNT,h=(null===(s=l.selectedPaymentMethod)||void 0===s?void 0:s.type)===D.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:T.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:T.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:T.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:T.TOKENIZE_ERROR,severity:j.ERROR})}}if(!o)return void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:T.VALIDATION_ERROR,severity:j.ERROR});if(!l.paymentToken)return void this.errorEvent.emit({message:"Payment token not found.",errorCode:T.TOKENIZE_ERROR,severity:j.ERROR});let u;if(u={payment_mode:(t=>{switch(t){case D.NEW_CARD:case D.SAVED_CARD:case D.NEW_BANK_ACCOUNT:case D.SAVED_BANK_ACCOUNT:case D.PLAID:return x.ECOM;case D.SEZZLE:return x.BNPL;case D.APPLE_PAY:return x.APPLE_PAY;default:return}})(null===(a=l.selectedPaymentMethod)||void 0===a?void 0:a.type),payment_token:l.paymentToken},this.preCompleteHook){const t=d();try{await new Promise(((e,i)=>{this.preCompleteHook(t,(()=>e()),(()=>i()))}))}catch(t){return}}this.completeCheckout({payment:u,onSuccess:({checkout:t})=>{this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:T.COMPLETE_CHECKOUT_ERROR,severity:j.ERROR})}})}render(){return t(s,{key:"56a003ca1e1ac4bdc1baa8f862cdb05b2d8af4b1"})}get hostEl(){return n(this)}};var $;!function(t){t.PLAID_SDK_LOAD_FAILED="plaid-sdk-load-failed",t.PLAID_LINK_INIT_FAILED="plaid-link-init-failed",t.PLAID_LINK_TOKEN_FAILED="plaid-link-token-failed",t.PLAID_AUTHENTICATION_FAILED="plaid-authentication-failed",t.PLAID_BANK_NOT_SUPPORTED="plaid-bank-not-supported",t.PLAID_TOKEN_EXPIRED="plaid-token-expired",t.PLAID_NETWORK_ERROR="plaid-network-error",t.PLAID_USER_CANCELLED="plaid-user-cancelled",t.PLAID_TIMEOUT="plaid-timeout",t.PLAID_INVALID_CREDENTIALS="plaid-invalid-credentials",t.PLAID_ACCOUNT_LOCKED="plaid-account-locked",t.PLAID_MAINTENANCE="plaid-maintenance",t.PLAID_RATE_LIMITED="plaid-rate-limited"}($||($={}));const K={[$.PLAID_SDK_LOAD_FAILED]:"Unable to load Plaid. Please refresh the page and try again.",[$.PLAID_LINK_INIT_FAILED]:"Unable to initialize bank connection. Please try again.",[$.PLAID_LINK_TOKEN_FAILED]:"Unable to connect to bank service. Please try again.",[$.PLAID_AUTHENTICATION_FAILED]:"Bank authentication failed. Please try again.",[$.PLAID_BANK_NOT_SUPPORTED]:"Your bank is not currently supported. Please try a different payment method.",[$.PLAID_TOKEN_EXPIRED]:"Your bank session has expired. Please reconnect your account.",[$.PLAID_NETWORK_ERROR]:"Network connection issue. Please check your internet connection and try again.",[$.PLAID_USER_CANCELLED]:"Bank connection was cancelled. Click to try again.",[$.PLAID_TIMEOUT]:"Bank connection timed out. Please try again.",[$.PLAID_INVALID_CREDENTIALS]:"Invalid bank credentials. Please check your username and password.",[$.PLAID_ACCOUNT_LOCKED]:"Your bank account is temporarily locked. Please contact your bank.",[$.PLAID_MAINTENANCE]:"Bank service is temporarily unavailable. Please try again later.",[$.PLAID_RATE_LIMITED]:"Too many connection attempts. Please wait a moment and try again."},tt={[$.PLAID_SDK_LOAD_FAILED]:j.ERROR,[$.PLAID_LINK_INIT_FAILED]:j.ERROR,[$.PLAID_LINK_TOKEN_FAILED]:j.ERROR,[$.PLAID_AUTHENTICATION_FAILED]:j.ERROR,[$.PLAID_BANK_NOT_SUPPORTED]:j.WARNING,[$.PLAID_TOKEN_EXPIRED]:j.WARNING,[$.PLAID_NETWORK_ERROR]:j.WARNING,[$.PLAID_USER_CANCELLED]:j.INFO,[$.PLAID_TIMEOUT]:j.WARNING,[$.PLAID_INVALID_CREDENTIALS]:j.ERROR,[$.PLAID_ACCOUNT_LOCKED]:j.ERROR,[$.PLAID_MAINTENANCE]:j.WARNING,[$.PLAID_RATE_LIMITED]:j.WARNING},et=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 J,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:$.PLAID_SDK_LOAD_FAILED,message:K[$.PLAID_SDK_LOAD_FAILED],severity:tt[$.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:$.PLAID_LINK_TOKEN_FAILED,message:K[$.PLAID_LINK_TOKEN_FAILED],severity:tt[$.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:$.PLAID_LINK_INIT_FAILED,message:K[$.PLAID_LINK_INIT_FAILED],severity:tt[$.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:$.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=$.PLAID_LINK_TOKEN_FAILED,o=K[a],r=!0;"AbortError"===t.name?(a=$.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=$.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=$.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:a,message:o,severity:tt[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 $.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return $.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return $.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return $.PLAID_RATE_LIMITED;case"maintenance":return $.PLAID_MAINTENANCE;case"not_authenticated":return $.PLAID_INVALID_CREDENTIALS;default:return $.PLAID_LINK_TOKEN_FAILED}return $.PLAID_LINK_TOKEN_FAILED},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=t=>{this.publicToken=t,this.isAuthenticating=!1,this.clearError(),this.retryCount=0,this.isSelected||(this.isSelected=!0,l.selectedPaymentMethod={type:D.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=$.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=$.PLAID_INVALID_CREDENTIALS,i=K[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=$.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=$.PLAID_ACCOUNT_LOCKED,i=K[e],s=!1,n="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=$.PLAID_MAINTENANCE,i=K[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=$.PLAID_RATE_LIMITED,i=K[e],s=!0;break;case"INVALID_REQUEST":e=$.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=$.PLAID_AUTHENTICATION_FAILED,i=t.error_message||"Bank authentication failed. Please try again.",s=!0;break;default:t.error_message&&(i=t.error_message)}if(t.error_message){const a=t.error_message.toLowerCase();a.includes("not supported")||a.includes("unsupported")?(e=$.PLAID_BANK_NOT_SUPPORTED,i=K[e],s=!1,n="Try a different payment method"):(a.includes("expired")||a.includes("timeout"))&&(e=$.PLAID_TOKEN_EXPIRED,i=K[e],s=!0)}this.handleError({code:e,message:i,severity:tt[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)===D.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)!==D.PLAID&&(l.selectedPaymentMethod={type:D.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:$.PLAID_SDK_LOAD_FAILED,message:K[$.PLAID_SDK_LOAD_FAILED],severity:tt[$.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)===D.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:D.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:D.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=u("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"]}}},it=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===D.SAVED_CARD&&l.disableCreditCard||t===D.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:y,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))}},st=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"}}),nt=class{constructor(t){e(this,t),this.paymentMethodOptionSelected=i(this,"paymentMethodOptionSelected"),this.paymentMethodOptionId=D.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:D.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 ",st),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"},m(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)}};export{Z as justifi_apple_pay,W as justifi_checkout_summary,q as justifi_header,X as justifi_modular_checkout,et as justifi_plaid_payment_method,it as justifi_saved_payment_methods,nt as justifi_sezzle_payment_method}
1
+ import{h as t,r as e,c as i,H as s,g as n}from"./p-DwYM91AU.js";import{A as a}from"./p-C8yN3uBj.js";import{S as o}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{S as r}from"./p-c7MCfTgE.js";import{c as l,o as c,g as h,a as d,b as u}from"./p-DU8dqq9U.js";import{D as p,r as y}from"./p-wtuY7MT2.js";import{f as m}from"./p-BS7OgSQe.js";import{H as v}from"./p-zNSPsvs3.js";import{H as M,b as f,h as g,i as b}from"./p-nrZ9yHcl.js";import{H as k}from"./p-C-2kW6Al.js";import{J as w,c as A}from"./p-sassRpOu.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as j,a as T,b as N}from"./p-Cjcsf8ku.js";import{I as E}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as P,a as I}from"./p-D2muobcE.js";import{C}from"./p-B4ZUYyNh.js";import{P as D,a as S,b as x}from"./p-DCIW8z1f.js";import{C as O}from"./p-ZpPDShvP.js";import"./p-BYsgavgS.js";import"./p-C3_8r8V7.js";var L,z,R,_,U;!function(t){t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_FAILURE="STATUS_FAILURE"}(L||(L={})),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"}(z||(z={})),function(t){t.BLACK="black",t.WHITE="white",t.WHITE_OUTLINE="white-outline"}(R||(R={})),function(t){t.SUPPORTS_3DS="supports3DS",t.SUPPORTS_EMV="supportsEMV",t.SUPPORTS_CREDIT="supportsCredit",t.SUPPORTS_DEBIT="supportsDebit"}(_||(_={}));class B{constructor(t){this.merchantIdentifier=t.merchantIdentifier,this.displayName=t.displayName,this.initiative=t.initiative,this.initiativeContext=t.initiativeContext,this.buttonType=t.buttonType||z.PLAIN,this.buttonStyle=t.buttonStyle||R.BLACK,this.buttonLocale=t.buttonLocale||"en-US"}get isValid(){return!!(this.merchantIdentifier&&this.displayName&&this.initiative&&this.initiativeContext)}}class Y{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 Q{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"}(U||(U={}));class F{constructor(){this.api=a()}initialize(t){if(this.applePayConfig=new B(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 Q.isApplePaySupported()&&Q.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await Q.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 Y(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:U.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:U.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:U.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:Q.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),r=await this.processPayment(i,s,o);r.success?(this.currentSession.completePayment({status:L.STATUS_SUCCESS}),t({success:!0,token:a.token,paymentMethodId:r.data.id})):(console.error("PSP reported payment failure:",r.data),this.currentSession.completePayment({status:L.STATUS_FAILURE}),e({success:!1,error:{code:U.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:L.STATUS_FAILURE}),e({success:!1,error:{code:U.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:L.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:U.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:U.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:Q.getDefaultMerchantCapabilities(),supportedNetworks:Q.getDefaultSupportedNetworks(),total:Q.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const V=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},H=e=>t("div",{class:"apple-pay-button-container"},t("button",Object.assign({class:(()=>{let t="apple-pay-button";switch(e.buttonStyle){case R.WHITE:t+=" apple-pay-button-white";break;case R.WHITE_OUTLINE:t+=" apple-pay-button-white-outline";break;default:t+=" apple-pay-button-black"}switch(e.buttonType){case z.BUY:t+=" apple-pay-button-type-buy";break;case z.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 ")),Z=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=z.PLAIN,this.buttonStyle=R.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:Q.getDefaultSupportedNetworks(),total:Q.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)||Z.ErrorCode.PAYMENT_FAILED}))}catch(t){const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e,code:Z.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:Z.ErrorCode.CONFIG_ERROR}),void(this.isLoading=!1);if(this.isAvailable=Q.isApplePaySupported(),this.canMakePayments=Q.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:Z.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:Z.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:Z.ErrorCode.INITIALIZATION_ERROR})}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?Q.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(V,{isLoading:this.isLoading}),e&&t(H,{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 "))}};Z.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:"fd2c61dcafdc800d0064c19d29c6e007aed5adb5"},t("section",{key:"f2abef1233f3ccad3982d10c61ec5765e13e27a5"},t("div",{key:"713d66ef6f7e2fc73135e765069baba6df976f52"},t("div",{key:"b8dd28f257948aa317366fe3ea6d2bc4911ef164",part:p},null==l?void 0:l.paymentDescription),t("div",{key:"675676b40de7dc27d07bfafc0eee77eb855a3d26"},t("span",{key:"cbd47994d9c3f1518741a298de3f5d62a0ad5313",part:p},"Total")," ",t("span",{key:"614748853f666f1b072d4fa9b14ee15ef5717112",part:p},m(+(null==l?void 0:l.totalAmount)))))))}},q=class{constructor(t){e(this,t),this.levels={h1:v,h2:M,h3:k},this.level="h1"}render(){return t(o,{key:"d4871da09451d40b27220a207ee72317ed9b1b9f"},t(this.levels[this.level],{key:"f7de159fa6395ef4024f48b868369f8d10edf64e",text:this.text,class:this.class}))}},G=a();class J{async getLinkToken(t,e,i,s){return G.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),G.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 J,this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:n}=t.detail;e&&i?(l.paymentToken=s,l.selectedPaymentMethod={type:D.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:T.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 C};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:I(o.error),code:P(null===(a=o.error)||void 0===a?void 0:a.code),severity:j.ERROR});s({checkout:o.data})}catch(t){const e=P(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:I(r.error),code:P(null===(o=r.error)||void 0===o?void 0:o.code),severity:j.ERROR});n({checkout:r.data})}catch(t){const e=P(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 w(this),A(),l.authToken=this.authToken,this.fetchCheckout(),f("set",(t=>{const e=b[t];void 0!==e&&g(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!==E.completed?t.status!==E.expired||this.errorEvent.emit({message:N.CHECKOUT_EXPIRED,errorCode:T.CHECKOUT_EXPIRED,severity:j.ERROR}):this.errorEvent.emit({message:N.CHECKOUT_ALREADY_COMPLETED,errorCode:T.CHECKOUT_ALREADY_COMPLETED,severity:j.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:t.code,severity:t.severity})}}):this.errorEvent.emit({message:N.NOT_AUTHENTICATED,errorCode:T.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 S(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)===D.NEW_CARD,n=(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)===D.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:T.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:T.VALIDATION_ERROR,severity:j.ERROR});const r=(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)===D.NEW_CARD,c=(null===(i=l.selectedPaymentMethod)||void 0===i?void 0:i.type)===D.NEW_BANK_ACCOUNT,h=(null===(s=l.selectedPaymentMethod)||void 0===s?void 0:s.type)===D.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:T.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:T.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:T.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:T.TOKENIZE_ERROR,severity:j.ERROR})}}if(!o)return void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:T.VALIDATION_ERROR,severity:j.ERROR});if(!l.paymentToken)return void this.errorEvent.emit({message:"Payment token not found.",errorCode:T.TOKENIZE_ERROR,severity:j.ERROR});let u;if(u={payment_mode:(t=>{switch(t){case D.NEW_CARD:case D.SAVED_CARD:case D.NEW_BANK_ACCOUNT:case D.SAVED_BANK_ACCOUNT:case D.PLAID:return x.ECOM;case D.SEZZLE:return x.BNPL;case D.APPLE_PAY:return x.APPLE_PAY;default:return}})(null===(a=l.selectedPaymentMethod)||void 0===a?void 0:a.type),payment_token:l.paymentToken},this.preCompleteHook){const t=d();try{await new Promise(((e,i)=>{this.preCompleteHook(t,(()=>e()),(()=>i()))}))}catch(t){return}}this.completeCheckout({payment:u,onSuccess:({checkout:t})=>{this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:T.COMPLETE_CHECKOUT_ERROR,severity:j.ERROR})}})}render(){return t(s,{key:"56a003ca1e1ac4bdc1baa8f862cdb05b2d8af4b1"})}get hostEl(){return n(this)}};var $;!function(t){t.PLAID_SDK_LOAD_FAILED="plaid-sdk-load-failed",t.PLAID_LINK_INIT_FAILED="plaid-link-init-failed",t.PLAID_LINK_TOKEN_FAILED="plaid-link-token-failed",t.PLAID_AUTHENTICATION_FAILED="plaid-authentication-failed",t.PLAID_BANK_NOT_SUPPORTED="plaid-bank-not-supported",t.PLAID_TOKEN_EXPIRED="plaid-token-expired",t.PLAID_NETWORK_ERROR="plaid-network-error",t.PLAID_USER_CANCELLED="plaid-user-cancelled",t.PLAID_TIMEOUT="plaid-timeout",t.PLAID_INVALID_CREDENTIALS="plaid-invalid-credentials",t.PLAID_ACCOUNT_LOCKED="plaid-account-locked",t.PLAID_MAINTENANCE="plaid-maintenance",t.PLAID_RATE_LIMITED="plaid-rate-limited"}($||($={}));const K={[$.PLAID_SDK_LOAD_FAILED]:"Unable to load Plaid. Please refresh the page and try again.",[$.PLAID_LINK_INIT_FAILED]:"Unable to initialize bank connection. Please try again.",[$.PLAID_LINK_TOKEN_FAILED]:"Unable to connect to bank service. Please try again.",[$.PLAID_AUTHENTICATION_FAILED]:"Bank authentication failed. Please try again.",[$.PLAID_BANK_NOT_SUPPORTED]:"Your bank is not currently supported. Please try a different payment method.",[$.PLAID_TOKEN_EXPIRED]:"Your bank session has expired. Please reconnect your account.",[$.PLAID_NETWORK_ERROR]:"Network connection issue. Please check your internet connection and try again.",[$.PLAID_USER_CANCELLED]:"Bank connection was cancelled. Click to try again.",[$.PLAID_TIMEOUT]:"Bank connection timed out. Please try again.",[$.PLAID_INVALID_CREDENTIALS]:"Invalid bank credentials. Please check your username and password.",[$.PLAID_ACCOUNT_LOCKED]:"Your bank account is temporarily locked. Please contact your bank.",[$.PLAID_MAINTENANCE]:"Bank service is temporarily unavailable. Please try again later.",[$.PLAID_RATE_LIMITED]:"Too many connection attempts. Please wait a moment and try again."},tt={[$.PLAID_SDK_LOAD_FAILED]:j.ERROR,[$.PLAID_LINK_INIT_FAILED]:j.ERROR,[$.PLAID_LINK_TOKEN_FAILED]:j.ERROR,[$.PLAID_AUTHENTICATION_FAILED]:j.ERROR,[$.PLAID_BANK_NOT_SUPPORTED]:j.WARNING,[$.PLAID_TOKEN_EXPIRED]:j.WARNING,[$.PLAID_NETWORK_ERROR]:j.WARNING,[$.PLAID_USER_CANCELLED]:j.INFO,[$.PLAID_TIMEOUT]:j.WARNING,[$.PLAID_INVALID_CREDENTIALS]:j.ERROR,[$.PLAID_ACCOUNT_LOCKED]:j.ERROR,[$.PLAID_MAINTENANCE]:j.WARNING,[$.PLAID_RATE_LIMITED]:j.WARNING},et=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 J,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:$.PLAID_SDK_LOAD_FAILED,message:K[$.PLAID_SDK_LOAD_FAILED],severity:tt[$.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:$.PLAID_LINK_TOKEN_FAILED,message:K[$.PLAID_LINK_TOKEN_FAILED],severity:tt[$.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:$.PLAID_LINK_INIT_FAILED,message:K[$.PLAID_LINK_INIT_FAILED],severity:tt[$.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:$.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=$.PLAID_LINK_TOKEN_FAILED,o=K[a],r=!0;"AbortError"===t.name?(a=$.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=$.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=$.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:a,message:o,severity:tt[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 $.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return $.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return $.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return $.PLAID_RATE_LIMITED;case"maintenance":return $.PLAID_MAINTENANCE;case"not_authenticated":return $.PLAID_INVALID_CREDENTIALS;default:return $.PLAID_LINK_TOKEN_FAILED}return $.PLAID_LINK_TOKEN_FAILED},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=t=>{this.publicToken=t,this.isAuthenticating=!1,this.clearError(),this.retryCount=0,this.isSelected||(this.isSelected=!0,l.selectedPaymentMethod={type:D.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=$.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=$.PLAID_INVALID_CREDENTIALS,i=K[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=$.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=$.PLAID_ACCOUNT_LOCKED,i=K[e],s=!1,n="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=$.PLAID_MAINTENANCE,i=K[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=$.PLAID_RATE_LIMITED,i=K[e],s=!0;break;case"INVALID_REQUEST":e=$.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=$.PLAID_AUTHENTICATION_FAILED,i=t.error_message||"Bank authentication failed. Please try again.",s=!0;break;default:t.error_message&&(i=t.error_message)}if(t.error_message){const a=t.error_message.toLowerCase();a.includes("not supported")||a.includes("unsupported")?(e=$.PLAID_BANK_NOT_SUPPORTED,i=K[e],s=!1,n="Try a different payment method"):(a.includes("expired")||a.includes("timeout"))&&(e=$.PLAID_TOKEN_EXPIRED,i=K[e],s=!0)}this.handleError({code:e,message:i,severity:tt[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)===D.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=l.selectedPaymentMethod)||void 0===e?void 0:e.type)!==D.PLAID&&(l.selectedPaymentMethod={type:D.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:$.PLAID_SDK_LOAD_FAILED,message:K[$.PLAID_SDK_LOAD_FAILED],severity:tt[$.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)===D.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:D.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:D.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=u("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"]}}},it=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===D.SAVED_CARD&&l.disableCreditCard||t===D.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:y,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))}},st=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"}}),nt=class{constructor(t){e(this,t),this.paymentMethodOptionSelected=i(this,"paymentMethodOptionSelected"),this.paymentMethodOptionId=D.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:D.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 ",st),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"},m(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)}};export{Z as justifi_apple_pay,W as justifi_checkout_summary,q as justifi_header,X as justifi_modular_checkout,et as justifi_plaid_payment_method,it as justifi_saved_payment_methods,nt as justifi_sezzle_payment_method}
@@ -1 +1 @@
1
- import{h as s,r as t,c as i}from"./p-DwYM91AU.js";import{c as e,F as r}from"./p-DiJD6Iqx.js";import{b as o,a,c as h}from"./p-dgG_o6wN.js";import{i as p,a as n,b as l,c as m}from"./p-D1WQG4I7.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as c,a as d}from"./p-Cjcsf8ku.js";import"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import{C as u,B as j,b as f}from"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{c as v,J as b}from"./p-CApezhx9.js";import{B as g}from"./p-Bqlcv3ZV.js";import{S as w}from"./p-BP2sTIQV.js";import{H as C}from"./p-zNSPsvs3.js";import"./p-CZfYo5-1.js";import{S as B}from"./p-c7MCfTgE.js";import{B as y}from"./p-XYgDHrVL.js";import{m as x,b as S}from"./p-5aA7gjr5.js";import{B as D}from"./p-BCPutgAi.js";import"./p-BFTU3MAI.js";import"./p-avgjSJ1d.js";import"./p-DfKxeSrC.js";import"./p-CPpUGsw5.js";import"./p-BYsgavgS.js";import"./p-BS7OgSQe.js";import"./p-czPIvHxt.js";import"./p-C8yN3uBj.js";import"./p-wtuY7MT2.js";import"./p-D2muobcE.js";const I=e(Object.assign(Object.assign({},o().fields),{legal_address:n(),additional_questions:a(),representative:p("representative")}));e(Object.assign(Object.assign({},h().fields),{legal_address:m(),additional_questions:a(),representative:l("representative")}));const O=I,k=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(B,{width:"25%"})),s("div",{class:"col-12"},s(B,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(B,{width:"50%"}),s(B,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(B,{width:"65%"}),s(B,{width:"35%"}))),q=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(B,{width:"40%",height:"40px"})),s(k,null),s(k,null),s(k,null)),A=class{constructor(s){t(this,s),this.submitEvent=i(this,"submit-event"),this.clickEvent=i(this,"click-event"),this.errorEvent=i(this,"error-event"),this.isLoading=!1,this.isSaving=!1,this.country=u.USA,this.hideErrors=!1,this.formTitle="Business Information",this.removeTitle=!1,this.instantiateBusiness=s=>{const t=new j(s);this.country=t.country_of_establishment,this.formController.setInitialValues(Object.assign({},t))},this.sendData=async()=>{this.isSaving=!0;const s=this.formController.values.getValue(),t=this.formController.getInitialValues(),i=new j(Object.assign(Object.assign({},t),s)).payload;this.patchBusiness({payload:i,onSuccess:s=>{this.handleReponse(s)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isSaving=!1}})},this.validateAndSubmit=s=>{s.preventDefault(),this.formController.validateAndSubmit(this.sendData)}}componentWillLoad(){v(),this.analytics=new b(this),this.formController=new r(O),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=x({authToken:this.authToken,businessId:this.businessId,service:new D}),this.patchBusiness=S({authToken:this.authToken,businessId:this.businessId,service:new D}),this.getBusiness({onSuccess:s=>{this.instantiateBusiness(s.data)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isLoading=!1}})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:d.MISSING_PROPS,severity:c.ERROR})}handleReponse(s){s.error&&(this.errorMessage=f.patchData),this.submitEvent.emit({response:s}),this.instantiateBusiness(s.data)}render(){return s(w,null,this.isLoading?s(q,null):s("form",{onSubmit:this.validateAndSubmit},s("div",{class:"row gap-3"},s(C,{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,country:this.country})),s("div",{class:"col-12 mb-4"},s("justifi-legal-address-form",{formController:this.formController,country:this.country})),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,country:this.country})),s("div",{class:"col-12 d-flex flex-row-reverse"},s(g,{type:"submit",disabled:this.disabledState,variant:"primary",onClick:()=>this.clickEvent.emit({name:y.submit}),isLoading:this.isSaving},"Submit")))))}};export{A as justifi_business_form}
1
+ import{h as s,r as t,c as i}from"./p-DwYM91AU.js";import{c as r,F as e}from"./p-DiJD6Iqx.js";import{b as o,a,c as h}from"./p-dgG_o6wN.js";import{i as p,a as n,b as l,c as m}from"./p-D1WQG4I7.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as c,a as d}from"./p-Cjcsf8ku.js";import"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import{C as u,B as j,b as f}from"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{c as v,J as b}from"./p-sassRpOu.js";import{B as g}from"./p-Bqlcv3ZV.js";import{S as w}from"./p-BP2sTIQV.js";import{H as C}from"./p-zNSPsvs3.js";import"./p-CZfYo5-1.js";import{S as B}from"./p-c7MCfTgE.js";import{B as y}from"./p-XYgDHrVL.js";import{m as S,b as x}from"./p-5aA7gjr5.js";import{B as O}from"./p-BCPutgAi.js";import"./p-BFTU3MAI.js";import"./p-avgjSJ1d.js";import"./p-DfKxeSrC.js";import"./p-CPpUGsw5.js";import"./p-BYsgavgS.js";import"./p-BS7OgSQe.js";import"./p-C3_8r8V7.js";import"./p-C8yN3uBj.js";import"./p-wtuY7MT2.js";import"./p-D2muobcE.js";const D=r(Object.assign(Object.assign({},o().fields),{legal_address:n(),additional_questions:a(),representative:p("representative")}));r(Object.assign(Object.assign({},h().fields),{legal_address:m(),additional_questions:a(),representative:l("representative")}));const _=D,k=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(B,{width:"25%"})),s("div",{class:"col-12"},s(B,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(B,{width:"50%"}),s(B,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(B,{width:"65%"}),s(B,{width:"35%"}))),q=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(B,{width:"40%",height:"40px"})),s(k,null),s(k,null),s(k,null)),I=class{constructor(s){t(this,s),this.submitEvent=i(this,"submit-event"),this.clickEvent=i(this,"click-event"),this.errorEvent=i(this,"error-event"),this.isLoading=!1,this.isSaving=!1,this.country=u.USA,this.hideErrors=!1,this.formTitle="Business Information",this.removeTitle=!1,this.instantiateBusiness=s=>{const t=new j(s);this.country=t.country_of_establishment,this.formController.setInitialValues(Object.assign({},t))},this.sendData=async()=>{this.isSaving=!0;const s=this.formController.values.getValue(),t=this.formController.getInitialValues(),i=new j(Object.assign(Object.assign({},t),s)).payload;this.patchBusiness({payload:i,onSuccess:s=>{this.handleReponse(s)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isSaving=!1}})},this.validateAndSubmit=s=>{s.preventDefault(),this.formController.validateAndSubmit(this.sendData)}}componentWillLoad(){v(),this.analytics=new b(this),this.formController=new e(_),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=S({authToken:this.authToken,businessId:this.businessId,service:new O}),this.patchBusiness=x({authToken:this.authToken,businessId:this.businessId,service:new O}),this.getBusiness({onSuccess:s=>{this.instantiateBusiness(s.data)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isLoading=!1}})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:d.MISSING_PROPS,severity:c.ERROR})}handleReponse(s){s.error&&(this.errorMessage=f.patchData),this.submitEvent.emit({response:s}),this.instantiateBusiness(s.data)}render(){return s(w,null,this.isLoading?s(q,null):s("form",{onSubmit:this.validateAndSubmit},s("div",{class:"row gap-3"},s(C,{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,country:this.country})),s("div",{class:"col-12 mb-4"},s("justifi-legal-address-form",{formController:this.formController,country:this.country})),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,country:this.country})),s("div",{class:"col-12 d-flex flex-row-reverse"},s(g,{type:"submit",disabled:this.disabledState,variant:"primary",onClick:()=>this.clickEvent.emit({name:y.submit}),isLoading:this.isSaving},"Submit")))))}};export{I as justifi_business_form}
@@ -0,0 +1 @@
1
+ var e={name:"@justifi/webcomponents",version:"6.5.1-rc.7"};export{e as p}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i}from"./p-DwYM91AU.js";import{P as o}from"./p-CPtsjcdm.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as r,a as e}from"./p-Cjcsf8ku.js";import{d as a}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as p,a as h}from"./p-D2muobcE.js";import{E as n}from"./p-BNqo3kt0.js";import{c as m,J as c}from"./p-sassRpOu.js";import{m as d}from"./p-DYGIC0QH.js";import"./p-C8yN3uBj.js";import"./p-BS7OgSQe.js";import"./p-BYsgavgS.js";import"./p-wtuY7MT2.js";import"./p-C3_8r8V7.js";const u=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.enableRecordClick=!1,this.errorMessage=null,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){m(),this.analytics=new c(this),this.initializeServices()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeServices()}initializeServices(){this.payoutId&&this.authToken?(this.getPayout=(({id:t,authToken:s,service:i})=>async({onSuccess:o,onError:e})=>{var n;try{const m=await i.fetchPayout(t,s);m.error?e({error:h(m.error),code:p(null===(n=m.error)||void 0===n?void 0:n.code),severity:r.ERROR}):o(new a(m.data))}catch(t){e({error:h(t),code:p(null==t?void 0:t.code),severity:r.ERROR})}})({id:this.payoutId,authToken:this.authToken,service:new o}),this.getPayoutCSV=d({authToken:this.authToken,service:new o})):(this.errorMessage="Failed to load payout details. payoutId or authToken is not provided.",this.errorEvent.emit({message:this.errorMessage,errorCode:e.MISSING_PROPS,severity:r.ERROR}))}render(){return this.errorMessage?n(this.errorMessage):i("payout-details-core",{getPayout:this.getPayout,getPayoutCSV:this.getPayoutCSV,"onError-event":this.handleErrorEvent,enableRecordClick:this.enableRecordClick})}static get watchers(){return{payoutId:["propChanged"],authToken:["propChanged"]}}};export{u as justifi_payout_details}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-DwYM91AU.js";import{C as r,a as o}from"./p-Cjcsf8ku.js";import{c as e,J as a}from"./p-CApezhx9.js";import{T as n}from"./p-MQxr_LMC.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{e as p}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as c,a as h}from"./p-D2muobcE.js";import{m,S as u}from"./p-BojLBYsY.js";import{S as d}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{d as j}from"./p-DkOiS6Zr.js";import"./p-czPIvHxt.js";import"./p-C8yN3uBj.js";import"./p-BS7OgSQe.js";import"./p-BYsgavgS.js";import"./p-DOLBAxYf.js";import"./p-wtuY7MT2.js";const l=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=j,this.handleErrorEvent=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.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:t,authToken:s,service:i})=>async({params:o,onSuccess:e,onError:a})=>{var n,m;try{const u=await i.fetchTerminals(t,s,o);if(u.error)return a({error:h(u.error),code:c(null===(m=u.error)||void 0===m?void 0:m.code),severity:r.ERROR});{const t=Object.assign({},u.page_info);e({terminals:(null===(n=u.data)||void 0===n?void 0:n.map((t=>new p(t))))||[],pagingInfo:t})}}catch(t){const s=c(null==t?void 0:t.code);return a({error:t.message||t,code:s,severity:r.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new n}):(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 u}))}render(){return i(d,{key:"34cb952a43c4ecfd904c3449a05895e10e673a95"},i("terminals-list-core",{key:"32d981b366889364c4f27a4351aab41ed7d085b5",getTerminals:this.getTerminals,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{l as justifi_terminals_list}
1
+ import{r as s,c as t,h as i}from"./p-DwYM91AU.js";import{C as r,a as o}from"./p-Cjcsf8ku.js";import{c as e,J as a}from"./p-sassRpOu.js";import{T as n}from"./p-MQxr_LMC.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{e as p}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as c,a as h}from"./p-D2muobcE.js";import{m,S as u}from"./p-BojLBYsY.js";import{S as d}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{d as j}from"./p-DkOiS6Zr.js";import"./p-C3_8r8V7.js";import"./p-C8yN3uBj.js";import"./p-BS7OgSQe.js";import"./p-BYsgavgS.js";import"./p-DOLBAxYf.js";import"./p-wtuY7MT2.js";const l=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.columns=j,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){e(),this.analytics=new a(this),this.initializeGetData()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:s,authToken:t,service:i})=>async({params:o,onSuccess:e,onError:a})=>{var n,m;try{const u=await i.fetchTerminals(s,t,o);if(u.error)return a({error:h(u.error),code:c(null===(m=u.error)||void 0===m?void 0:m.code),severity:r.ERROR});{const s=Object.assign({},u.page_info);e({terminals:(null===(n=u.data)||void 0===n?void 0:n.map((s=>new p(s))))||[],pagingInfo:s})}}catch(s){const t=c(null==s?void 0:s.code);return a({error:s.message||s,code:t,severity:r.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new n}):(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 u}))}render(){return i(d,{key:"34cb952a43c4ecfd904c3449a05895e10e673a95"},i("terminals-list-core",{key:"32d981b366889364c4f27a4351aab41ed7d085b5",getTerminals:this.getTerminals,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{l as justifi_terminals_list}
@@ -1 +1 @@
1
- import{h as t,r as e,c as a}from"./p-DwYM91AU.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as s,a as i}from"./p-Cjcsf8ku.js";import{g as n}from"./p-BpaE8q5f.js";import{p as r}from"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{c as o,J as c}from"./p-CApezhx9.js";import{g as p,a as h}from"./p-D2muobcE.js";import{P as d}from"./p-C8QOezo8.js";import{T as f,l,a as u,b as m,c as y,d as b,e as _,f as g,g as j,h as T,i as k,j as w,k as v}from"./p-BTzt8N0l.js";import{S as C}from"./p-BP2sTIQV.js";import{T as S}from"./p-CZfYo5-1.js";import{a as D}from"./p-BS7OgSQe.js";import{S as x,T as R}from"./p-wtuY7MT2.js";import"./p-BYsgavgS.js";import"./p-czPIvHxt.js";import"./p-C8yN3uBj.js";import"./p-B-0a8Xqm.js";const B={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")},F={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"},I={created_at:(e,a)=>t("td",{part:R(a)},t("div",{class:"fw-bold"},D(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},D(e.created_at,{showTime:!0}))),type:(e,a)=>t("td",{part:R(a)},F[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)},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: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,B,I),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:"ce4fd1549223738580d3a4e9195f535619491f5a"},t(l,{key:"0991e7ca748e75fa42e96be1dd1c9e9d2c876db9"},t(u,{key:"1b5d58cbf6f27fdf2faef658ae6148ee642ad3fe"},t(m,{key:"5eaef864fe0072cd4557a0585a409572f6806969"},t(y,{key:"a9c35dd1c0031da4a82207a4313c9a521729db40"},this.transactionsTable.columnData.map((t=>t)))),t(b,{key:"1ed790fcc17bbb6a93f6eaf18b741fc3b2e80855"},t(_,{key:"64570f5736317dfabc97a7967dfa52dbc0dd384c",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(g,{key:"45d4d52687e203de3c5f45e406862b882c03757c",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(j,{key:"b8c941adc6bad5e40edd33b69231b668f587f16b",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(T,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(k,{key:"a76f922158b408ff6a70c35a47531405c012aaae"},t(w,{key:"4cf90633de51f6e9286481300cbbe0f0183f1bfb"},t(v,{key:"c06c168e8ba7c3115eab18c8366362be16582f86",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"f08aa685537d1ba529f5506d74bdc20d0352dd2b",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-DwYM91AU.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as s,a as i}from"./p-Cjcsf8ku.js";import{g as r}from"./p-BpaE8q5f.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{c as o,J as c}from"./p-sassRpOu.js";import{g as p,a as h}from"./p-D2muobcE.js";import{P as d}from"./p-C8QOezo8.js";import{T as f,l,a as u,b as m,c as y,d as b,e as _,f as g,g as j,h as T,i as k,j as w,k as v}from"./p-BTzt8N0l.js";import{S as C}from"./p-BP2sTIQV.js";import{T as S}from"./p-CZfYo5-1.js";import{a as D}from"./p-BS7OgSQe.js";import{S as R,T as B}from"./p-wtuY7MT2.js";import"./p-BYsgavgS.js";import"./p-C3_8r8V7.js";import"./p-C8yN3uBj.js";import"./p-B-0a8Xqm.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")},x={ach_return:"ACH Return",ach_return_fee:"ACH Return Fee",dispute:"Dispute",dispute_fee:"Dispute Fee",dispute_fee_refund:"Dispute Fee Refund",dispute_refund:"Dispute Refund",payment:"Payment",payment_fee:"Fee",refund:"Refund",fee_refund:"Fee Refund",application_fee_returned:"Application Fee Returned",refund_failure:"Refund Failure",void:"Void"},I={created_at:(e,a)=>t("td",{part:B(a)},t("div",{class:"fw-bold"},D(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},D(e.created_at,{showTime:!0}))),type:(e,a)=>t("td",{part:B(a)},x[e.payment_balance_txn_type]),id:(e,a)=>t("td",{part:B(a)},e.id),amount:(e,a)=>t("td",{part:B(a),class:"text-end"},e.formattedPaymentAmount(e.amount)),balance:(e,a)=>t("td",{part:B(a),class:"text-end"},e.formattedPaymentAmount(e.balance)),currency:(e,a)=>t("td",{part:B(a)},e.currency),financial_transaction_id:(e,a)=>t("td",{part:B(a)},e.financial_transaction_id),payment_id:(e,a)=>t("td",{part:B(a)},e.payment_id),payment_balance_txn_type:(e,a)=>t("td",{part:B(a)},e.payment_balance_txn_type),source_id:(e,a)=>t("td",{part:B(a)},e.source_id),source_type:(e,a)=>t("td",{part:B(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=n,this.pagingParams={},this.columns="created_at,type,id,amount,balance",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,F,I),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:n,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}):n({balanceTransactions:c.data.map((t=>new r(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:"ce4fd1549223738580d3a4e9195f535619491f5a"},t(l,{key:"0991e7ca748e75fa42e96be1dd1c9e9d2c876db9"},t(u,{key:"1b5d58cbf6f27fdf2faef658ae6148ee642ad3fe"},t(m,{key:"5eaef864fe0072cd4557a0585a409572f6806969"},t(y,{key:"a9c35dd1c0031da4a82207a4313c9a521729db40"},this.transactionsTable.columnData.map((t=>t)))),t(b,{key:"1ed790fcc17bbb6a93f6eaf18b741fc3b2e80855"},t(_,{key:"64570f5736317dfabc97a7967dfa52dbc0dd384c",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(g,{key:"45d4d52687e203de3c5f45e406862b882c03757c",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(j,{key:"b8c941adc6bad5e40edd33b69231b668f587f16b",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(T,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(k,{key:"a76f922158b408ff6a70c35a47531405c012aaae"},t(w,{key:"4cf90633de51f6e9286481300cbbe0f0183f1bfb"},t(v,{key:"c06c168e8ba7c3115eab18c8366362be16582f86",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"f08aa685537d1ba529f5506d74bdc20d0352dd2b",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 +1 @@
1
- import{r as s,c as i,h as t}from"./p-DwYM91AU.js";import{c as o,J as e}from"./p-CApezhx9.js";import{C as r,a as n}from"./p-Cjcsf8ku.js";import{m as p,a}from"./p-5aA7gjr5.js";import{B as h}from"./p-BCPutgAi.js";import{A as m}from"./p-C8yN3uBj.js";import"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import"./p-czPIvHxt.js";import"./p-D2muobcE.js";import"./p-tGDdRx0W.js";import"./p-BYsgavgS.js";import"./p-BS7OgSQe.js";import"./p-HXpYMWUU.js";const d=m();class u{async postProvisioning(s,i,t){return d.post({endpoint:"entities/provisioning",body:{business_id:i,product_category:t},authToken:s})}}const c=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event"),this.allowOptionalFields=!1,this.formTitle="Business Information"}propChanged(){this.initializeApi()}componentWillLoad(){o(),this.analytics=new e(this),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=p({authToken:this.authToken,businessId:this.businessId,service:new h}),this.postProvisioning=a({authToken:this.authToken,businessId:this.businessId,product:"payment",service:new u})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:n.MISSING_PROPS,severity:r.ERROR})}render(){return t("justifi-payment-provisioning-core",{key:"41e96a931c082212f43bdd84dd5c948fac1eddfc",businessId:this.businessId,authToken:this.authToken,allowOptionalFields:this.allowOptionalFields,formTitle:this.formTitle,getBusiness:this.getBusiness,postProvisioning:this.postProvisioning})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};export{c as justifi_payment_provisioning}
1
+ import{r as s,c as i,h as t}from"./p-DwYM91AU.js";import{c as o,J as r}from"./p-sassRpOu.js";import{C as e,a as n}from"./p-Cjcsf8ku.js";import{m as p,a}from"./p-5aA7gjr5.js";import{B as h}from"./p-BCPutgAi.js";import{A as m}from"./p-C8yN3uBj.js";import"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import"./p-C3_8r8V7.js";import"./p-D2muobcE.js";import"./p-tGDdRx0W.js";import"./p-BYsgavgS.js";import"./p-BS7OgSQe.js";import"./p-HXpYMWUU.js";const u=m();class d{async postProvisioning(s,i,t){return u.post({endpoint:"entities/provisioning",body:{business_id:i,product_category:t},authToken:s})}}const c=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event"),this.allowOptionalFields=!1,this.formTitle="Business Information"}propChanged(){this.initializeApi()}componentWillLoad(){o(),this.analytics=new r(this),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=p({authToken:this.authToken,businessId:this.businessId,service:new h}),this.postProvisioning=a({authToken:this.authToken,businessId:this.businessId,product:"payment",service:new d})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:n.MISSING_PROPS,severity:e.ERROR})}render(){return t("justifi-payment-provisioning-core",{key:"41e96a931c082212f43bdd84dd5c948fac1eddfc",businessId:this.businessId,authToken:this.authToken,allowOptionalFields:this.allowOptionalFields,formTitle:this.formTitle,getBusiness:this.getBusiness,postProvisioning:this.postProvisioning})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};export{c as justifi_payment_provisioning}
@@ -1 +1 @@
1
- import{h as t,r as e,c as a}from"./p-DwYM91AU.js";import{c as s}from"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as i,a as o}from"./p-Cjcsf8ku.js";import{h as r}from"./p-BpaE8q5f.js";import{p as c}from"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{c as n,J as h}from"./p-CApezhx9.js";import{g as p,a as d}from"./p-D2muobcE.js";import{P as l}from"./p-CPtsjcdm.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-BTzt8N0l.js";import{S as D}from"./p-BP2sTIQV.js";import{T as P}from"./p-CZfYo5-1.js";import{a as S}from"./p-BS7OgSQe.js";import{S as I,T as q}from"./p-wtuY7MT2.js";import"./p-BYsgavgS.js";import"./p-czPIvHxt.js";import"./p-C8yN3uBj.js";import"./p-B-0a8Xqm.js";const B={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"},E={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"},S(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},S(e.created_at,{showTime:!0}))),available_on:e=>t("td",{part:q(e.available_on)},t("div",{class:"fw-bold"},S(e.available_on,{showDisplayDate:!0})),t("div",{class:"fw-bold"},S(e.available_on,{showTime:!0}))),updated_at:e=>t("td",{part:q(e.updated_at)},t("div",{class:"fw-bold"},S(e.updated_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},S(e.updated_at,{showTime:!0})))},O=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:P.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:P.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const a=this.balanceTransactions.find((t=>t.id===e));this.clickEvent.emit({name:P.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,B,E),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:s,onSuccess:o,onError:c,final:n})=>{var h;try{const n=await a.fetchPayoutTransactions(t,e,s);n.error?c({error:d(n.error),code:p(null===(h=n.error)||void 0===h?void 0:h.code),severity:i.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:i.ERROR})}finally{n()}})({accountId:s.accountId,authToken:this.authToken,service:new l})({params:this.requestParams,onSuccess:({balanceTransactions:t,pagingInfo:e})=>{this.balanceTransactions=t,this.paging=e,this.transactionsTable.collectionData=this.balanceTransactions},onError:({error:t,code:e,severity:a})=>{this.errorMessage=t.message,this.handleError(t,e,a)},final:()=>{this.isLoading=!1}}):(this.errorMessage="payout-id and auth-token props are required",this.handleError(o.MISSING_PROPS,this.errorMessage,i.ERROR))}get entityId(){return this.balanceTransactions.map((t=>t.id))}get showEmptyState(){return!this.isLoading&&!this.errorMessage&&this.transactionsTable.rowData.length<1}get showErrorState(){return!this.isLoading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.isLoading}get requestParams(){return Object.assign({payout_id:this.payoutId,limit:"15"},this.pagingParams)}render(){return t(D,{key:"ab6de6bc1bd8b389c3853cc8c9ff0a52ac79e139"},t(u,{key:"3946c0161a51c292e53776df23ef0aa297ab8a24"},t(m,{key:"7f7acd0813a8eb710889d540b6c5b7ae6831e47a"},t(b,{key:"eb0b11273c85116093d119bdbc8984f7c71729f0"},t(y,{key:"5485e54cca61a69a48b4a0eb70ff4cfbf409cfab"},this.transactionsTable.columnData.map((t=>t)))),t(_,{key:"778592bd28c2ed42fcb751f695ef97b75c911c17"},t(w,{key:"2123dc933b4e16f2bc4588a6ec4357d3067a919f",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(T,{key:"e13e4ba98217c4c41cc406d7f6bde34831771952",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(j,{key:"c837011abb597d3811cdc5636a457afab49224f6",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:"a189800b2a36f8880bb7fb2ab60b8b2afd24d760"},t(k,{key:"ae78dbea1986d6c0ee493bf26d8bb01ad294a1e2"},t(C,{key:"2146861e294be47a5c63f3354ff6744ad71b4d70",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"2ab6bfa9a7534c063e603eaf25e4e6f44cbda859",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],payoutId:["propChanged"],authToken:["propChanged"]}}};export{O as justifi_payout_transactions_list}
1
+ import{h as t,r as a,c as e}from"./p-DwYM91AU.js";import{c as s}from"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as i,a as o}from"./p-Cjcsf8ku.js";import{h as r}from"./p-BpaE8q5f.js";import{p as c}from"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{c as n,J as p}from"./p-sassRpOu.js";import{g as h,a as d}from"./p-D2muobcE.js";import{P as l}from"./p-CPtsjcdm.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 g,i as v,j as k,k as C}from"./p-BTzt8N0l.js";import{S as D}from"./p-BP2sTIQV.js";import{T as S}from"./p-CZfYo5-1.js";import{a as P}from"./p-BS7OgSQe.js";import{S as I,T as q}from"./p-wtuY7MT2.js";import"./p-BYsgavgS.js";import"./p-C3_8r8V7.js";import"./p-C8yN3uBj.js";import"./p-B-0a8Xqm.js";const B={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"},E={id:a=>t("td",{part:q(a.id)},a.id),account_id:a=>t("td",{part:q(a.account_id)},a.account_id),payout_id:a=>t("td",{part:q(a.payout_id)},a.payout_id),financial_transaction_id:a=>t("td",{part:q(a.financial_transaction_id)},a.financial_transaction_id),amount:a=>t("td",{part:q(a.amount)},a.formattedPaymentAmount(a.amount)),fee:a=>t("td",{part:q(a.fee)},a.formattedPaymentAmount(a.fee)),net:a=>t("td",{part:q(a.net)},a.formattedPaymentAmount(a.net)),currency:a=>t("td",{part:q(a.currency)},a.currency),description:a=>t("td",{part:q(a.description)},a.description),source_id:a=>t("td",{part:q(a.source_id)},a.source_id),txn_type:a=>t("td",{part:q(a.txn_type)},O[a.txn_type]),created_at:a=>t("td",{part:q(a.created_at)},t("div",{class:"fw-bold"},P(a.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(a.created_at,{showTime:!0}))),available_on:a=>t("td",{part:q(a.available_on)},t("div",{class:"fw-bold"},P(a.available_on,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(a.available_on,{showTime:!0}))),updated_at:a=>t("td",{part:q(a.updated_at)},t("div",{class:"fw-bold"},P(a.updated_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(a.updated_at,{showTime:!0})))},x=class{constructor(t){a(this,t),this.clickEvent=e(this,"click-event"),this.errorEvent=e(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 a=t.target.closest("tr").dataset.rowEntityId;if(!a)return;const e=this.balanceTransactions.find((t=>t.id===a));this.clickEvent.emit({name:S.row,data:e})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,B,E),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,a,e){this.isLoading=!1,this.errorEvent.emit({errorCode:t,message:a,severity:e})}initializeApi(){this.payoutId&&this.authToken?(({accountId:t,authToken:a,service:e})=>async({params:s,onSuccess:o,onError:c,final:n})=>{var p;try{const n=await e.fetchPayoutTransactions(t,a,s);n.error?c({error:d(n.error),code:h(null===(p=n.error)||void 0===p?void 0:p.code),severity:i.ERROR}):o({balanceTransactions:n.data.map((t=>new r(t))),pagingInfo:Object.assign({},n.page_info)})}catch(t){const a=h(null==t?void 0:t.code);c({error:d(t),code:a,severity:i.ERROR})}finally{n()}})({accountId:s.accountId,authToken:this.authToken,service:new l})({params:this.requestParams,onSuccess:({balanceTransactions:t,pagingInfo:a})=>{this.balanceTransactions=t,this.paging=a,this.transactionsTable.collectionData=this.balanceTransactions},onError:({error:t,code:a,severity:e})=>{this.errorMessage=t.message,this.handleError(t,a,e)},final:()=>{this.isLoading=!1}}):(this.errorMessage="payout-id and auth-token props are required",this.handleError(o.MISSING_PROPS,this.errorMessage,i.ERROR))}get entityId(){return this.balanceTransactions.map((t=>t.id))}get showEmptyState(){return!this.isLoading&&!this.errorMessage&&this.transactionsTable.rowData.length<1}get showErrorState(){return!this.isLoading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.isLoading}get requestParams(){return Object.assign({payout_id:this.payoutId,limit:"15"},this.pagingParams)}render(){return t(D,{key:"ab6de6bc1bd8b389c3853cc8c9ff0a52ac79e139"},t(u,{key:"3946c0161a51c292e53776df23ef0aa297ab8a24"},t(m,{key:"7f7acd0813a8eb710889d540b6c5b7ae6831e47a"},t(b,{key:"eb0b11273c85116093d119bdbc8984f7c71729f0"},t(y,{key:"5485e54cca61a69a48b4a0eb70ff4cfbf409cfab"},this.transactionsTable.columnData.map((t=>t)))),t(_,{key:"778592bd28c2ed42fcb751f695ef97b75c911c17"},t(w,{key:"2123dc933b4e16f2bc4588a6ec4357d3067a919f",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(T,{key:"e13e4ba98217c4c41cc406d7f6bde34831771952",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(j,{key:"c837011abb597d3811cdc5636a457afab49224f6",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((a,e)=>t(g,{"data-test-id":"table-row","data-row-entity-id":this.entityId[e],onClick:this.rowClickHandler},a)))),this.paging&&t(v,{key:"a189800b2a36f8880bb7fb2ab60b8b2afd24d760"},t(k,{key:"ae78dbea1986d6c0ee493bf26d8bb01ad294a1e2"},t(C,{key:"2146861e294be47a5c63f3354ff6744ad71b4d70",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"2ab6bfa9a7534c063e603eaf25e4e6f44cbda859",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],payoutId:["propChanged"],authToken:["propChanged"]}}};export{x as justifi_payout_transactions_list}
@@ -1 +1 @@
1
- import{r as s,c as t,h as i}from"./p-DwYM91AU.js";import{E as r}from"./p-BNqo3kt0.js";import{B as o}from"./p-BCPutgAi.js";import{m as p}from"./p-sCHf--Vc.js";import{C as e,a as h}from"./p-Cjcsf8ku.js";import{c as m,J as n}from"./p-CApezhx9.js";import"./p-wtuY7MT2.js";import"./p-C8yN3uBj.js";import"./p-tGDdRx0W.js";import"./p-BYsgavgS.js";import"./p-BS7OgSQe.js";import"./p-HXpYMWUU.js";import"./p-BpaE8q5f.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-D2muobcE.js";import"./p-czPIvHxt.js";const a=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){m(),this.analytics=new n(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:h.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):i("business-details-core",{getBusiness:this.getBusiness,"onError-event":this.handleErrorEvent})}};export{a as justifi_business_details}
1
+ import{r as s,c as t,h as i}from"./p-DwYM91AU.js";import{E as r}from"./p-BNqo3kt0.js";import{B as o}from"./p-BCPutgAi.js";import{m as p}from"./p-sCHf--Vc.js";import{C as e,a as m}from"./p-Cjcsf8ku.js";import{c as h,J as a}from"./p-sassRpOu.js";import"./p-wtuY7MT2.js";import"./p-C8yN3uBj.js";import"./p-tGDdRx0W.js";import"./p-BYsgavgS.js";import"./p-BS7OgSQe.js";import"./p-HXpYMWUU.js";import"./p-BpaE8q5f.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-D2muobcE.js";import"./p-C3_8r8V7.js";const n=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){h(),this.analytics=new a(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):i("business-details-core",{getBusiness:this.getBusiness,"onError-event":this.handleErrorEvent})}};export{n as justifi_business_details}
@@ -1 +1 @@
1
- import{r as t,c as s,h as r}from"./p-DwYM91AU.js";import{P as i}from"./p-C8QOezo8.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as o,a as e}from"./p-Cjcsf8ku.js";import{P as p}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as a,a as n}from"./p-D2muobcE.js";import{c,J as m}from"./p-CApezhx9.js";import{S as h}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{d}from"./p-BitGlMSc.js";import"./p-C8yN3uBj.js";import"./p-BS7OgSQe.js";import"./p-BYsgavgS.js";import"./p-czPIvHxt.js";import"./p-BydKIJVC.js";import"./p-DOLBAxYf.js";import"./p-wtuY7MT2.js";const u=class{constructor(r){t(this,r),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=d,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){c(),this.analytics=new m(this),this.initializeGetPayments()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetPayments()}initializeGetPayments(){this.accountId&&this.authToken?this.getPayments=(({id:t,authToken:s,service:r})=>async({params:i,onSuccess:e,onError:c,final:m})=>{var h,d;try{const m=await r.fetchPayments(t,s,i);if(m.error)return c({error:n(m.error),code:a(null===(d=m.error)||void 0===d?void 0:d.code),severity:o.ERROR});{const t=Object.assign({},m.page_info);e({payments:(null===(h=m.data)||void 0===h?void 0:h.map((t=>new p(t))))||[],pagingInfo:t})}}catch(t){const s=a(null==t?void 0:t.code);return c({error:t.message||t,code:s,severity:o.ERROR})}finally{return m()}})({id:this.accountId,authToken:this.authToken,service:new i}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}render(){return r(h,{key:"1e1f5cc087e917c65e7dbabaf21b355dd3261206"},r("payments-list-core",{key:"318b81a8eaacb70cc333efb9159279bc9310dd32",getPayments:this.getPayments,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{u as justifi_payments_list}
1
+ import{r as s,c as t,h as r}from"./p-DwYM91AU.js";import{P as i}from"./p-C8QOezo8.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as o,a as e}from"./p-Cjcsf8ku.js";import{P as p}from"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as a,a as n}from"./p-D2muobcE.js";import{c,J as m}from"./p-sassRpOu.js";import{S as h}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{d}from"./p-BitGlMSc.js";import"./p-C8yN3uBj.js";import"./p-BS7OgSQe.js";import"./p-BYsgavgS.js";import"./p-C3_8r8V7.js";import"./p-BydKIJVC.js";import"./p-DOLBAxYf.js";import"./p-wtuY7MT2.js";const u=class{constructor(r){s(this,r),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.columns=d,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){c(),this.analytics=new m(this),this.initializeGetPayments()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetPayments()}initializeGetPayments(){this.accountId&&this.authToken?this.getPayments=(({id:s,authToken:t,service:r})=>async({params:i,onSuccess:e,onError:c,final:m})=>{var h,d;try{const m=await r.fetchPayments(s,t,i);if(m.error)return c({error:n(m.error),code:a(null===(d=m.error)||void 0===d?void 0:d.code),severity:o.ERROR});{const s=Object.assign({},m.page_info);e({payments:(null===(h=m.data)||void 0===h?void 0:h.map((s=>new p(s))))||[],pagingInfo:s})}}catch(s){const t=a(null==s?void 0:s.code);return c({error:s.message||s,code:t,severity:o.ERROR})}finally{return m()}})({id:this.accountId,authToken:this.authToken,service:new i}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}render(){return r(h,{key:"1e1f5cc087e917c65e7dbabaf21b355dd3261206"},r("payments-list-core",{key:"318b81a8eaacb70cc333efb9159279bc9310dd32",getPayments:this.getPayments,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{u as justifi_payments_list}
@@ -1 +1 @@
1
- import{p as t}from"./p-czPIvHxt.js";import{A as s}from"./p-C8yN3uBj.js";import"./p-Cjcsf8ku.js";import"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";const i=s();class e{async record(t){return i.post({endpoint:"analytics",body:t})}}class o{constructor(t){this.handleCustomEvent=async t=>{await this.service.record(t)},window.location.origin.includes("localhost")||window.location.origin.includes("storybook")||(this.service=new e,this.componentInstance=t,this.setUpBasicData(),this.setupLifecycleTracking(),this.trackCustomEvents())}get resourceId(){return this.componentInstance.accountId||this.componentInstance.businessId||this.componentInstance.paymentId||this.componentInstance.payoutId||this.componentInstance.checkoutId}setUpBasicData(){this.basicData={component_name:this.componentInstance.tagName,component_version:t.version,client_user_agent:navigator.userAgent,client_platform:navigator.userAgent,client_origin:window.location.origin,resource_id:this.resourceId}}trackCustomEvents(){this.eventEmitters=["submit-event","error-event"],this.eventEmitters.forEach((t=>{"function"==typeof this.componentInstance.addEventListener&&this.componentInstance.addEventListener(t,(s=>this.handleCustomEvent({event_type:t,data:Object.assign(Object.assign({},this.basicData),{error:s.detail})})))}))}setupLifecycleTracking(){const t=this.componentInstance.componentDidLoad;this.componentInstance.componentDidLoad=()=>{if(this.service.record({event_type:"init",data:this.basicData}),t)return t.apply(this.componentInstance)}}cleanup(){this.eventEmitters&&this.eventEmitters.forEach((t=>{this.componentInstance.removeEventListener(t,this.handleCustomEvent)}))}}const n=async()=>{var s,i;if("undefined"!=typeof process&&("test"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||(null===(i=process.env)||void 0===i?void 0:i.JEST_WORKER_ID)))return;const e=t.version,o=t.name,n=await(async t=>{const s=await fetch("https://registry.npmjs.org/"+t+"/latest");return(await s.json()).version})(o),r=n.replace(/-rc.*/,""),a=e.split("."),c=n.split(".");a[0]!==c[0]&&console.warn(`The package ${o} is out of date. The latest version is ${r}. Please update.`)};export{o as J,n as c}
1
+ import{p as t}from"./p-C3_8r8V7.js";import{A as s}from"./p-C8yN3uBj.js";import"./p-Cjcsf8ku.js";import"./p-BpaE8q5f.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";const i=s();class e{async record(t){return i.post({endpoint:"analytics",body:t})}}class o{constructor(t){this.handleCustomEvent=async t=>{await this.service.record(t)},window.location.origin.includes("localhost")||window.location.origin.includes("storybook")||(this.service=new e,this.componentInstance=t,this.setUpBasicData(),this.setupLifecycleTracking(),this.trackCustomEvents())}get resourceId(){return this.componentInstance.accountId||this.componentInstance.businessId||this.componentInstance.paymentId||this.componentInstance.payoutId||this.componentInstance.checkoutId}setUpBasicData(){this.basicData={component_name:this.componentInstance.tagName,component_version:t.version,client_user_agent:navigator.userAgent,client_platform:navigator.userAgent,client_origin:window.location.origin,resource_id:this.resourceId}}trackCustomEvents(){this.eventEmitters=["submit-event","error-event"],this.eventEmitters.forEach((t=>{"function"==typeof this.componentInstance.addEventListener&&this.componentInstance.addEventListener(t,(s=>this.handleCustomEvent({event_type:t,data:Object.assign(Object.assign({},this.basicData),{error:s.detail})})))}))}setupLifecycleTracking(){const t=this.componentInstance.componentDidLoad;this.componentInstance.componentDidLoad=()=>{if(this.service.record({event_type:"init",data:this.basicData}),t)return t.apply(this.componentInstance)}}cleanup(){this.eventEmitters&&this.eventEmitters.forEach((t=>{this.componentInstance.removeEventListener(t,this.handleCustomEvent)}))}}const r=async()=>{var s,i;if("undefined"!=typeof process&&("test"===(null===(s=process.env)||void 0===s?void 0:s.NODE_ENV)||(null===(i=process.env)||void 0===i?void 0:i.JEST_WORKER_ID)))return;const e=t.version,o=t.name,r=await(async t=>{const s=await fetch("https://registry.npmjs.org/"+t+"/latest");return(await s.json()).version})(o),n=r.replace(/-rc.*/,""),a=e.split("."),c=r.split(".");a[0]!==c[0]&&console.warn(`The package ${o} is out of date. The latest version is ${n}. Please update.`)};export{o as J,r as c}