@justifi/webcomponents 6.13.2 → 6.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/cjs/{Analytics-F9eGV4SU.js → Analytics-DusgFP9U.js} +1 -1
  2. package/dist/cjs/additional-questions-form-step_15.cjs.entry.js +2 -2
  3. package/dist/cjs/bank-account-billing-form-simple_4.cjs.entry.js +1 -1
  4. package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
  5. package/dist/cjs/{business-identity-schema-BA385xf-.js → business-identity-schema-Da3PJrGG.js} +1 -1
  6. package/dist/cjs/card-form.cjs.entry.js +2 -2
  7. package/dist/cjs/{check-pkg-version--A_rGEJu.js → check-pkg-version-DD7fjCqn.js} +1 -1
  8. package/dist/cjs/dispute-notification_2.cjs.entry.js +3 -3
  9. package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
  10. package/dist/cjs/justifi-apple-pay_11.cjs.entry.js +3 -3
  11. package/dist/cjs/justifi-bank-account-billing-form-simple.cjs.entry.js +3 -3
  12. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +3 -3
  13. package/dist/cjs/justifi-business-details.cjs.entry.js +3 -3
  14. package/dist/cjs/justifi-business-form.cjs.entry.js +5 -5
  15. package/dist/cjs/justifi-card-form.cjs.entry.js +3 -3
  16. package/dist/cjs/justifi-checkout-qr-code.cjs.entry.js +3 -3
  17. package/dist/cjs/justifi-checkout.cjs.entry.js +3 -3
  18. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +3 -3
  19. package/dist/cjs/justifi-dispute-management.cjs.entry.js +3 -3
  20. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +3 -3
  21. package/dist/cjs/justifi-order-terminals.cjs.entry.js +3 -3
  22. package/dist/cjs/justifi-payment-details.cjs.entry.js +3 -3
  23. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +3 -3
  24. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +3 -3
  25. package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -3
  26. package/dist/cjs/justifi-payout-details.cjs.entry.js +3 -3
  27. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +3 -3
  28. package/dist/cjs/justifi-payouts-list.cjs.entry.js +3 -3
  29. package/dist/cjs/justifi-qr-terminal.cjs.entry.js +3 -3
  30. package/dist/cjs/justifi-refund-payment.cjs.entry.js +3 -3
  31. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +3 -3
  32. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +3 -3
  33. package/dist/cjs/justifi-terminals-list.cjs.entry.js +3 -3
  34. package/dist/cjs/{package-Cuwhrp-b.js → package-DeCbZvnG.js} +1 -1
  35. package/dist/cjs/{schema-validations-C2XsZnqK.js → schema-validations-Cs0mSKR7.js} +2 -1
  36. package/dist/collection/components/business-forms/schemas/schema-validations.js +2 -1
  37. package/dist/docs.json +1 -1
  38. package/dist/esm/{Analytics-CQwgYl2v.js → Analytics-CtVZmAya.js} +1 -1
  39. package/dist/esm/additional-questions-form-step_15.entry.js +2 -2
  40. package/dist/esm/bank-account-billing-form-simple_4.entry.js +1 -1
  41. package/dist/esm/bank-account-form.entry.js +2 -2
  42. package/dist/esm/{business-identity-schema-Csou60ZC.js → business-identity-schema-C1ot9Zas.js} +1 -1
  43. package/dist/esm/card-form.entry.js +2 -2
  44. package/dist/esm/{check-pkg-version-2VZtm0yL.js → check-pkg-version-DcFIDA70.js} +1 -1
  45. package/dist/esm/dispute-notification_2.entry.js +3 -3
  46. package/dist/esm/hidden-input_2.entry.js +1 -1
  47. package/dist/esm/justifi-apple-pay_11.entry.js +3 -3
  48. package/dist/esm/justifi-bank-account-billing-form-simple.entry.js +3 -3
  49. package/dist/esm/justifi-bank-account-form.entry.js +3 -3
  50. package/dist/esm/justifi-business-details.entry.js +3 -3
  51. package/dist/esm/justifi-business-form.entry.js +5 -5
  52. package/dist/esm/justifi-card-form.entry.js +3 -3
  53. package/dist/esm/justifi-checkout-qr-code.entry.js +3 -3
  54. package/dist/esm/justifi-checkout.entry.js +3 -3
  55. package/dist/esm/justifi-checkouts-list.entry.js +3 -3
  56. package/dist/esm/justifi-dispute-management.entry.js +3 -3
  57. package/dist/esm/justifi-gross-payment-chart.entry.js +3 -3
  58. package/dist/esm/justifi-order-terminals.entry.js +3 -3
  59. package/dist/esm/justifi-payment-details.entry.js +3 -3
  60. package/dist/esm/justifi-payment-provisioning.entry.js +3 -3
  61. package/dist/esm/justifi-payment-transactions-list.entry.js +3 -3
  62. package/dist/esm/justifi-payments-list.entry.js +3 -3
  63. package/dist/esm/justifi-payout-details.entry.js +3 -3
  64. package/dist/esm/justifi-payout-transactions-list.entry.js +3 -3
  65. package/dist/esm/justifi-payouts-list.entry.js +3 -3
  66. package/dist/esm/justifi-qr-terminal.entry.js +3 -3
  67. package/dist/esm/justifi-refund-payment.entry.js +3 -3
  68. package/dist/esm/justifi-season-interruption-insurance.entry.js +3 -3
  69. package/dist/esm/justifi-terminal-orders-list.entry.js +3 -3
  70. package/dist/esm/justifi-terminals-list.entry.js +3 -3
  71. package/dist/esm/{package-BtzgeLyZ.js → package-Bx2_PW91.js} +1 -1
  72. package/dist/esm/{schema-validations-CySYE883.js → schema-validations-CHxw3FkH.js} +2 -1
  73. package/dist/module/package.js +1 -1
  74. package/dist/module/schema-validations.js +2 -1
  75. package/dist/webcomponents/{p-9c7bce35.entry.js → p-0b9263f3.entry.js} +1 -1
  76. package/dist/webcomponents/{p-e4bc8c7c.entry.js → p-17f8c3e7.entry.js} +1 -1
  77. package/dist/webcomponents/{p-1ac357f9.entry.js → p-1fced37f.entry.js} +1 -1
  78. package/dist/webcomponents/{p-5111a9f5.entry.js → p-291b9a48.entry.js} +1 -1
  79. package/dist/webcomponents/{p-9c1a0efc.entry.js → p-2a0ab07f.entry.js} +1 -1
  80. package/dist/webcomponents/p-2b64659a.entry.js +1 -0
  81. package/dist/webcomponents/{p-d5197891.entry.js → p-2c798125.entry.js} +1 -1
  82. package/dist/webcomponents/{p-d93d9d58.entry.js → p-3918fb44.entry.js} +1 -1
  83. package/dist/webcomponents/{p-d1cbeb65.entry.js → p-4383dfdc.entry.js} +1 -1
  84. package/dist/webcomponents/{p-49d9c0a4.entry.js → p-46a06ce6.entry.js} +1 -1
  85. package/dist/webcomponents/p-5ea486b6.entry.js +1 -0
  86. package/dist/webcomponents/{p-648c6cb1.entry.js → p-6f71bf5f.entry.js} +1 -1
  87. package/dist/webcomponents/{p-d9fd1c50.entry.js → p-708aee06.entry.js} +1 -1
  88. package/dist/webcomponents/{p-fa21fe56.entry.js → p-7495aa96.entry.js} +1 -1
  89. package/dist/webcomponents/{p-b08c76da.entry.js → p-84b643f7.entry.js} +1 -1
  90. package/dist/webcomponents/{p-ee97795a.entry.js → p-8771e52a.entry.js} +1 -1
  91. package/dist/webcomponents/{p-4821c092.entry.js → p-8fce7a9c.entry.js} +1 -1
  92. package/dist/webcomponents/{p-ebf178d2.entry.js → p-98bbdf10.entry.js} +1 -1
  93. package/dist/webcomponents/{p-a404b995.entry.js → p-9d11aaf2.entry.js} +1 -1
  94. package/dist/webcomponents/p-Bx2_PW91.js +1 -0
  95. package/dist/webcomponents/p-BxpXvXn-.js +1 -0
  96. package/dist/webcomponents/{p-DYL3RR2S.js → p-CfIGO7TJ.js} +1 -1
  97. package/dist/webcomponents/{p-C_SQBHCI.js → p-CqOzVXGL.js} +1 -1
  98. package/dist/webcomponents/{p-C1gr32IS.js → p-DK_bjvk1.js} +1 -1
  99. package/dist/webcomponents/{p-c2de24fe.entry.js → p-a62ef857.entry.js} +1 -1
  100. package/dist/webcomponents/{p-10f3b8df.entry.js → p-b89a5053.entry.js} +1 -1
  101. package/dist/webcomponents/{p-f0961751.entry.js → p-c6eea99e.entry.js} +1 -1
  102. package/dist/webcomponents/{p-85b155b0.entry.js → p-db17a828.entry.js} +1 -1
  103. package/dist/webcomponents/{p-54e343d3.entry.js → p-dde22375.entry.js} +4 -4
  104. package/dist/webcomponents/{p-5e59e283.entry.js → p-dfe66300.entry.js} +1 -1
  105. package/dist/webcomponents/{p-7d04803e.entry.js → p-e9494d8f.entry.js} +1 -1
  106. package/dist/webcomponents/{p-bd882260.entry.js → p-ebee139f.entry.js} +1 -1
  107. package/dist/webcomponents/{p-f4de4ac0.entry.js → p-f01fd4ff.entry.js} +1 -1
  108. package/dist/webcomponents/{p-64840a3d.entry.js → p-f4baf684.entry.js} +1 -1
  109. package/dist/webcomponents/{p-87427a4f.entry.js → p-f6d49f21.entry.js} +1 -1
  110. package/dist/webcomponents/webcomponents.esm.js +1 -1
  111. package/package.json +1 -1
  112. package/dist/webcomponents/p-4bb9d772.entry.js +0 -1
  113. package/dist/webcomponents/p-BtzgeLyZ.js +0 -1
  114. package/dist/webcomponents/p-a125318a.entry.js +0 -1
  115. package/dist/webcomponents/p-z3RFjy9B.js +0 -1
@@ -1 +1 @@
1
- import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-CO8ZGkfN.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{k as i,C as d,b as o}from"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{g as c,a as r}from"./p-CdwzNfP1.js";import{h,b as l,d as b}from"./p-BSs-2JKu.js";import{a as f,b as n,D as p,c as v,C as u,E as y}from"./p-Cu7hgXL1.js";import{J as m}from"./p-DYL3RR2S.js";import{m as k,M as j}from"./p-zZn1OXja.js";import{c as C}from"./p-C_SQBHCI.js";import{B as g}from"./p-CHo7TfsM.js";import{S as w}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as x}from"./p-uZ5KAseb.js";import{a as D,B as T}from"./p-CHw7tICr.js";import"./p-De4Pig-y.js";import"./p-D8GTwl9v.js";import"./p-CPKMvyV_.js";import"./p-BtzgeLyZ.js";const S=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(x,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(x,{width:"70%"})),e("div",{class:"col-12"},e(x,{width:"40%"})),e("div",{class:"col-12"},e(x,{width:"40%"})),e("div",{class:"col-12"},e(x,{width:"100%"})),e("div",{class:"col-12"},e(x,{width:"80%"}))),I=class{constructor(e){t(this,e),this.errorEvent=a(this,"error-event",7),this.recordClickEvent=a(this,"record-click-event",7),this.enableRecordClick=!1,this.loading=!0,this.errorMessage=null,this.downloadCSV=()=>{this.getPayoutCSV({payoutId:this.payout.id,onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({message:e,errorCode:t,severity:a})}})},this.handleRecordClick=e=>{this.recordClickEvent.emit({id:e,type:"account"})}}componentWillLoad(){C(),this.analytics=new m(this),this.initializeServices(),this.getPayout&&this.fetchData()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeServices()}getPayoutWatcher(){this.fetchData()}initializeServices(){this.payoutId&&this.authToken?(this.getPayout=(({id:e,authToken:t,service:a})=>async({onSuccess:s,onError:o})=>{var h;try{const l=await a.fetchPayout(e,t);l.error?o({error:r(l.error),code:c(null===(h=l.error)||void 0===h?void 0:h.code),severity:d.ERROR}):s(new i(l.data))}catch(e){o({error:r(e),code:c(null==e?void 0:e.code),severity:d.ERROR})}})({id:this.payoutId,authToken:this.authToken,service:new s}),this.getPayoutCSV=k({authToken:this.authToken,service:new s})):(this.errorMessage="Failed to load payout details. payoutId or authToken is not provided.",this.errorEvent.emit({message:this.errorMessage,errorCode:o.MISSING_PROPS,severity:d.ERROR}))}fetchData(){this.loading=!0,this.getPayout({onSuccess:e=>{this.errorMessage=null,this.payout=e,this.loading=!1},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({message:e,errorCode:t,severity:a}),this.loading=!1}})}formatMethod(e){return"ach"===e?"ACH":h(e)}render(){var t,a,s,i;return e(w,{key:"da86ceeb41265056f9bc64c07b3bd7db4a91471c"},this.loading&&e(S,{key:"49ae2848db4a5b59770c2b84bfba745861573a6d"}),!this.loading&&this.errorMessage&&y(this.errorMessage),!this.loading&&this.payout&&e("justifi-details",{key:"b4e6740d49ae1099f28ea3d6f21fe0da48149c71",errorMessage:this.errorMessage},e(f,{key:"e9efbeeb7894996f318d90fb38826a6a9e4cc4b3",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},j(null===(t=this.payout)||void 0===t?void 0:t.status),e(D,"expedited"===this.payout.settlement_priority?{variant:T.WARNING,title:"Expedited",text:"Expedited"}:{variant:T.SECONDARY,title:"Standard",text:"Standard"})),title:this.payout.formattedPaymentAmount(this.payout.amount)},e(n,{key:"feb913d2b90e86fb4f5575379e9b9a47adfa723f",classes:"border-1 border-end",title:"Updated At",value:`${l(this.payout.updated_at)} ${b(this.payout.updated_at)}`}),e(n,{key:"9fe6da08323735948f145a72a02db26a6eb31f02",classes:"border-1 border-end",title:"Created At",value:`${l(this.payout.created_at)} ${b(this.payout.created_at)}`}),e(n,{key:"d01c4b7ea7c966b524026a6e97c0575466de3f74",title:"ID",value:this.payout.id}),e("div",{key:"4c4f73e5898caedbb1b7aba326dbfb0dcfbb59e6",class:"m-4"},e(g,{key:"622a6e8384da37f4bb3896bcafea46ef697b140e",variant:"outline-secondary",class:"btn btn-outline-secondary d-flex align-items-center",onClick:this.downloadCSV},"Export CSV"))),e("div",{key:"9b9271663673dc2e78e89bec5c7c9c47daa6761e",slot:"detail-sections"},e(p,{key:"ac5c6e1c09e63cd0616794b7df367a73889e37b2",sectionTitle:"Details"}),e("div",{key:"95f9d5a0097499fdb24f44ea87313c3b34a96068",class:"d-flex flex-column gap-2 w-100"},e(v,{key:"ecf60d4a4783c8fb52e10222dd4f6e9935cd0910",title:"Date paid",value:l(this.payout.deposits_at)}),e(v,{key:"289971a08641bc2dc725d603ef611291025cd6b4",title:"Statement Description",value:this.payout.description}),e(v,{key:"d237aacbeb9b23ac0d45aa978350aad4824b0695",title:"Payout Method",value:this.formatMethod(this.payout.delivery_method)}),e(v,{key:"744ef2b8878b742483750fb921ca9790f6aa9ec1",title:"Amount",value:this.payout.formattedPaymentAmount(this.payout.amount)}),e(v,{key:"dbf3327510523afc6edd78ea2926f99593da9748",title:"Fee",value:this.payout.formattedPaymentAmount(this.payout.fees_total)})),e(p,{key:"15983342dbe916770291f33226b744e8c4c1129e",sectionTitle:"Account"}),e("div",{key:"b3fb4353794dc490633a14abcc829ff0835d989f",class:"d-flex flex-column gap-2 w-100"},e(v,{key:"665fbe47e3b35c0b7ffb3e6c17e15c3703c90250",title:"ID",value:this.payout.account_id,onClick:this.enableRecordClick?()=>this.handleRecordClick(this.payout.account_id):void 0}),e(v,{key:"5b15d5bc8a63541ac8d77eddccb47c89659fd05a",title:"Account Type",value:null===(a=this.payout.bank_account)||void 0===a?void 0:a.account_type}),e(v,{key:"947043e3571f27a672060f2101296daba0073727",title:"Institution",value:null===(s=this.payout.bank_account)||void 0===s?void 0:s.account_type}),e(v,{key:"74ac687b37c7ca91a88863730560333c41b9413c",title:"Routing Number",value:null===(i=this.payout.bank_account)||void 0===i?void 0:i.routing_number}),e(v,{key:"43cd9aa5ac45f6efba97901e3e1386446065c28a",title:"Account Number",value:this.payout.bank_account?`**** ${this.payout.bank_account.account_number_last4}`:void 0})),this.payout.metadata&&[e(p,{key:"8bf04ae43a08d8ef624357f64df900a11b8f2dad",sectionTitle:"Metadata"}),e("div",{key:"1bf737734f34f626cbfb9dd878afbb91b6f01913",class:"d-table gap-2 w-100"},e(u,{key:"0d1481e1823e9b2f28328ebfb3cd1c92c6342cc6",metadata:this.payout.metadata}))])))}static get watchers(){return{payoutId:["propChanged"],authToken:["propChanged"],getPayout:["getPayoutWatcher"]}}};export{I as justifi_payout_details}
1
+ import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-CO8ZGkfN.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{k as i,C as d,b as o}from"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{g as c,a as r}from"./p-CdwzNfP1.js";import{h,b as l,d as b}from"./p-BSs-2JKu.js";import{a as f,b as n,D as p,c as v,C as u,E as y}from"./p-Cu7hgXL1.js";import{J as m}from"./p-CfIGO7TJ.js";import{m as k,M as j}from"./p-zZn1OXja.js";import{c as C}from"./p-CqOzVXGL.js";import{B as g}from"./p-CHo7TfsM.js";import{S as w}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as x}from"./p-uZ5KAseb.js";import{a as T,B as D}from"./p-CHw7tICr.js";import"./p-De4Pig-y.js";import"./p-D8GTwl9v.js";import"./p-CPKMvyV_.js";import"./p-Bx2_PW91.js";const P=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(x,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(x,{width:"70%"})),e("div",{class:"col-12"},e(x,{width:"40%"})),e("div",{class:"col-12"},e(x,{width:"40%"})),e("div",{class:"col-12"},e(x,{width:"100%"})),e("div",{class:"col-12"},e(x,{width:"80%"}))),S=class{constructor(e){t(this,e),this.errorEvent=a(this,"error-event",7),this.recordClickEvent=a(this,"record-click-event",7),this.enableRecordClick=!1,this.loading=!0,this.errorMessage=null,this.downloadCSV=()=>{this.getPayoutCSV({payoutId:this.payout.id,onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({message:e,errorCode:t,severity:a})}})},this.handleRecordClick=e=>{this.recordClickEvent.emit({id:e,type:"account"})}}componentWillLoad(){C(),this.analytics=new m(this),this.initializeServices(),this.getPayout&&this.fetchData()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeServices()}getPayoutWatcher(){this.fetchData()}initializeServices(){this.payoutId&&this.authToken?(this.getPayout=(({id:e,authToken:t,service:a})=>async({onSuccess:s,onError:o})=>{var h;try{const l=await a.fetchPayout(e,t);l.error?o({error:r(l.error),code:c(null===(h=l.error)||void 0===h?void 0:h.code),severity:d.ERROR}):s(new i(l.data))}catch(e){o({error:r(e),code:c(null==e?void 0:e.code),severity:d.ERROR})}})({id:this.payoutId,authToken:this.authToken,service:new s}),this.getPayoutCSV=k({authToken:this.authToken,service:new s})):(this.errorMessage="Failed to load payout details. payoutId or authToken is not provided.",this.errorEvent.emit({message:this.errorMessage,errorCode:o.MISSING_PROPS,severity:d.ERROR}))}fetchData(){this.loading=!0,this.getPayout({onSuccess:e=>{this.errorMessage=null,this.payout=e,this.loading=!1},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({message:e,errorCode:t,severity:a}),this.loading=!1}})}formatMethod(e){return"ach"===e?"ACH":h(e)}render(){var t,a,s,i;return e(w,{key:"da86ceeb41265056f9bc64c07b3bd7db4a91471c"},this.loading&&e(P,{key:"49ae2848db4a5b59770c2b84bfba745861573a6d"}),!this.loading&&this.errorMessage&&y(this.errorMessage),!this.loading&&this.payout&&e("justifi-details",{key:"b4e6740d49ae1099f28ea3d6f21fe0da48149c71",errorMessage:this.errorMessage},e(f,{key:"e9efbeeb7894996f318d90fb38826a6a9e4cc4b3",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},j(null===(t=this.payout)||void 0===t?void 0:t.status),e(T,"expedited"===this.payout.settlement_priority?{variant:D.WARNING,title:"Expedited",text:"Expedited"}:{variant:D.SECONDARY,title:"Standard",text:"Standard"})),title:this.payout.formattedPaymentAmount(this.payout.amount)},e(n,{key:"feb913d2b90e86fb4f5575379e9b9a47adfa723f",classes:"border-1 border-end",title:"Updated At",value:`${l(this.payout.updated_at)} ${b(this.payout.updated_at)}`}),e(n,{key:"9fe6da08323735948f145a72a02db26a6eb31f02",classes:"border-1 border-end",title:"Created At",value:`${l(this.payout.created_at)} ${b(this.payout.created_at)}`}),e(n,{key:"d01c4b7ea7c966b524026a6e97c0575466de3f74",title:"ID",value:this.payout.id}),e("div",{key:"4c4f73e5898caedbb1b7aba326dbfb0dcfbb59e6",class:"m-4"},e(g,{key:"622a6e8384da37f4bb3896bcafea46ef697b140e",variant:"outline-secondary",class:"btn btn-outline-secondary d-flex align-items-center",onClick:this.downloadCSV},"Export CSV"))),e("div",{key:"9b9271663673dc2e78e89bec5c7c9c47daa6761e",slot:"detail-sections"},e(p,{key:"ac5c6e1c09e63cd0616794b7df367a73889e37b2",sectionTitle:"Details"}),e("div",{key:"95f9d5a0097499fdb24f44ea87313c3b34a96068",class:"d-flex flex-column gap-2 w-100"},e(v,{key:"ecf60d4a4783c8fb52e10222dd4f6e9935cd0910",title:"Date paid",value:l(this.payout.deposits_at)}),e(v,{key:"289971a08641bc2dc725d603ef611291025cd6b4",title:"Statement Description",value:this.payout.description}),e(v,{key:"d237aacbeb9b23ac0d45aa978350aad4824b0695",title:"Payout Method",value:this.formatMethod(this.payout.delivery_method)}),e(v,{key:"744ef2b8878b742483750fb921ca9790f6aa9ec1",title:"Amount",value:this.payout.formattedPaymentAmount(this.payout.amount)}),e(v,{key:"dbf3327510523afc6edd78ea2926f99593da9748",title:"Fee",value:this.payout.formattedPaymentAmount(this.payout.fees_total)})),e(p,{key:"15983342dbe916770291f33226b744e8c4c1129e",sectionTitle:"Account"}),e("div",{key:"b3fb4353794dc490633a14abcc829ff0835d989f",class:"d-flex flex-column gap-2 w-100"},e(v,{key:"665fbe47e3b35c0b7ffb3e6c17e15c3703c90250",title:"ID",value:this.payout.account_id,onClick:this.enableRecordClick?()=>this.handleRecordClick(this.payout.account_id):void 0}),e(v,{key:"5b15d5bc8a63541ac8d77eddccb47c89659fd05a",title:"Account Type",value:null===(a=this.payout.bank_account)||void 0===a?void 0:a.account_type}),e(v,{key:"947043e3571f27a672060f2101296daba0073727",title:"Institution",value:null===(s=this.payout.bank_account)||void 0===s?void 0:s.account_type}),e(v,{key:"74ac687b37c7ca91a88863730560333c41b9413c",title:"Routing Number",value:null===(i=this.payout.bank_account)||void 0===i?void 0:i.routing_number}),e(v,{key:"43cd9aa5ac45f6efba97901e3e1386446065c28a",title:"Account Number",value:this.payout.bank_account?`**** ${this.payout.bank_account.account_number_last4}`:void 0})),this.payout.metadata&&[e(p,{key:"8bf04ae43a08d8ef624357f64df900a11b8f2dad",sectionTitle:"Metadata"}),e("div",{key:"1bf737734f34f626cbfb9dd878afbb91b6f01913",class:"d-table gap-2 w-100"},e(u,{key:"0d1481e1823e9b2f28328ebfb3cd1c92c6342cc6",metadata:this.payout.metadata}))])))}static get watchers(){return{payoutId:["propChanged"],authToken:["propChanged"],getPayout:["getPayoutWatcher"]}}};export{S as justifi_payout_details}
@@ -1 +1 @@
1
- import{r as e,h as t,H as s}from"./p-CV0Pyo1O.js";import{c as a,F as i}from"./p-D9sqTVmd.js";import{y as l,z as r,h as d,l as o,j as n,v as c,A as h}from"./p-z3RFjy9B.js";import{al as f}from"./p-CPKMvyV_.js";import{c as m,o as b}from"./p-DyPk4BJt.js";import{P as u}from"./p-DkoufM1t.js";import{H as p}from"./p-DYHjzFnJ.js";import"./p-CZfYo5-1.js";import"./p-BFTU3MAI.js";import"./p-DPA5TKvQ.js";import"./p-BcNb9bVO.js";import"./p-BBSnDYJw.js";import"./p-D8GTwl9v.js";const _=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new i(a({name:c.required("Enter full name"),address_line1:n.nullable(),address_line2:o.nullable(),address_city:d.nullable(),address_state:r.nullable(),address_postal_code:l.nullable()}));const e=m.billingFormFields;e&&Object.keys(e).some((t=>e[t]))&&this.formController.setInitialValues(e)}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)})),this.unsubscribeFromStore=b("billingFormFields",(e=>{this.formController.setInitialValues(e)}))}disconnectedCallback(){var e;null===(e=this.unsubscribeFromStore)||void 0===e||e.call(this)}async getValues(){return this.formController.values.getValue()}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return t("div",{key:"e8c53c98793d0296d69799c8449d762084d9859b",part:f,class:"mt-4"},t("form",{key:"83e59bb7bdcf4a3e0b4ed4320358796eae91726f"},t("fieldset",{key:"d92a4a02c531a08a270562701bc71440add5b545"},this.legend&&t("legend",{key:"74ac1eb2c6fc629323f31be515e3aa204ae302a2"},this.legend),t("div",{key:"161888eb0680a4c9d6280440961f2926b08ac1ed",class:"row gy-3"},t("div",{key:"9f6c899b7a4ff25a5eba5278bffe7d4e86eb00df",class:"col-12"},t("form-control-text",{key:"74a9958fb74de730067fe4d87dfac33c12522169",name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler}))))))}},v=class{constructor(t){e(this,t)}get showSimpleCardBillingForm(){return this.paymentMethodType===u.NEW_CARD&&this.hideCardBillingForm}get showSimpleBankAccountBillingForm(){return this.paymentMethodType===u.NEW_BANK_ACCOUNT&&this.hideBankAccountBillingForm}async getValues(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.getValues()}async validate(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.validate()}render(){return t(s,null,t(this.showSimpleBankAccountBillingForm?"bank-account-billing-form-simple":this.showSimpleCardBillingForm?"card-billing-form-simple":"billing-form-full",{legend:this.legend,ref:e=>this.selectedFormRef=e}))}},y=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new i(a({name:c.required("Enter full name"),address_line1:n.required("Enter street address"),address_line2:o.nullable(),address_city:d.required("Enter city"),address_state:r.required("Select state or province"),address_postal_code:l.required("Enter postal code")}));const e=m.billingFormFields;e&&Object.keys(e).some((t=>e[t]))&&this.formController.setInitialValues(e),this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}componentDidLoad(){this.unsubscribeFromStore=b("billingFormFields",(e=>{this.formController.setInitialValues(e)}))}disconnectedCallback(){var e;null===(e=this.unsubscribeFromStore)||void 0===e||e.call(this)}async getValues(){return this.formController.values.getValue()}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){if(!this.formController)return null;const e=this.formController.getInitialValues();return t("div",{part:f,class:"mt-4"},t(p,{text:"Billing address",class:"fs-6 fw-bold lh-lg mb-4"}),t("form",null,t("fieldset",null,this.legend&&t("legend",null,this.legend),t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-text",{name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-text",{name:"address_line1",label:"Street Address",defaultValue:e.address_line1,errorText:this.errors.address_line1,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-text",{name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:e.address_line2,errorText:this.errors.address_line2,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-text",{name:"address_city",label:"City",defaultValue:e.address_city,errorText:this.errors.address_city,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-select",{name:"address_state",label:"State / Province",options:h,defaultValue:e.address_state,errorText:this.errors.address_state,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-text",{name:"address_postal_code",label:"Postal Code",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:7}))))))}},j=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new i(a({name:c.nullable(),address_line1:n.nullable(),address_line2:o.nullable(),address_city:d.nullable(),address_state:r.nullable(),address_postal_code:l.required("Enter postal code")}));const e=m.billingFormFields;e&&Object.keys(e).some((t=>e[t]))&&this.formController.setInitialValues(e)}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)})),this.unsubscribeFromStore=b("billingFormFields",(e=>{this.formController.setInitialValues(e)}))}disconnectedCallback(){var e;null===(e=this.unsubscribeFromStore)||void 0===e||e.call(this)}async getValues(){return this.formController.values.getValue()}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return t("div",{key:"41a7f26e12bfa3da4e7926d8a535218a0580be14",part:f},t("form",{key:"b48cf148ec6d16fd8e5859dfe96a3b9fd6d3036d"},t("fieldset",{key:"88094544642af8fadb270dfafd838d450ad88cdd"},this.legend&&t("legend",{key:"13c19557aa4c0c127305cc54f6346eeb74d4f750"},this.legend),t("div",{key:"bbcf1a622720df2d21db718eaf823e4e33155070",class:"row gy-3"},t("div",{key:"96b9d590fd68fd4f2a54760e58c0f2bc166a832b",class:"col-12"},t("form-control-text",{key:"57050d0274782cb2ff5f1a9b13726a8319438a36",name:"address_postal_code",label:"Postal Code",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:7}))))))}};export{_ as bank_account_billing_form_simple,v as billing_form,y as billing_form_full,j as card_billing_form_simple}
1
+ import{r as e,h as t,H as s}from"./p-CV0Pyo1O.js";import{c as a,F as i}from"./p-D9sqTVmd.js";import{y as l,z as r,h as d,l as o,j as n,v as c,A as h}from"./p-BxpXvXn-.js";import{al as f}from"./p-CPKMvyV_.js";import{c as m,o as b}from"./p-DyPk4BJt.js";import{P as u}from"./p-DkoufM1t.js";import{H as p}from"./p-DYHjzFnJ.js";import"./p-CZfYo5-1.js";import"./p-BFTU3MAI.js";import"./p-DPA5TKvQ.js";import"./p-BcNb9bVO.js";import"./p-BBSnDYJw.js";import"./p-D8GTwl9v.js";const v=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new i(a({name:c.required("Enter full name"),address_line1:n.nullable(),address_line2:o.nullable(),address_city:d.nullable(),address_state:r.nullable(),address_postal_code:l.nullable()}));const e=m.billingFormFields;e&&Object.keys(e).some((t=>e[t]))&&this.formController.setInitialValues(e)}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)})),this.unsubscribeFromStore=b("billingFormFields",(e=>{this.formController.setInitialValues(e)}))}disconnectedCallback(){var e;null===(e=this.unsubscribeFromStore)||void 0===e||e.call(this)}async getValues(){return this.formController.values.getValue()}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return t("div",{key:"e8c53c98793d0296d69799c8449d762084d9859b",part:f,class:"mt-4"},t("form",{key:"83e59bb7bdcf4a3e0b4ed4320358796eae91726f"},t("fieldset",{key:"d92a4a02c531a08a270562701bc71440add5b545"},this.legend&&t("legend",{key:"74ac1eb2c6fc629323f31be515e3aa204ae302a2"},this.legend),t("div",{key:"161888eb0680a4c9d6280440961f2926b08ac1ed",class:"row gy-3"},t("div",{key:"9f6c899b7a4ff25a5eba5278bffe7d4e86eb00df",class:"col-12"},t("form-control-text",{key:"74a9958fb74de730067fe4d87dfac33c12522169",name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler}))))))}},_=class{constructor(t){e(this,t)}get showSimpleCardBillingForm(){return this.paymentMethodType===u.NEW_CARD&&this.hideCardBillingForm}get showSimpleBankAccountBillingForm(){return this.paymentMethodType===u.NEW_BANK_ACCOUNT&&this.hideBankAccountBillingForm}async getValues(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.getValues()}async validate(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.validate()}render(){return t(s,null,t(this.showSimpleBankAccountBillingForm?"bank-account-billing-form-simple":this.showSimpleCardBillingForm?"card-billing-form-simple":"billing-form-full",{legend:this.legend,ref:e=>this.selectedFormRef=e}))}},y=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new i(a({name:c.required("Enter full name"),address_line1:n.required("Enter street address"),address_line2:o.nullable(),address_city:d.required("Enter city"),address_state:r.required("Select state or province"),address_postal_code:l.required("Enter postal code")}));const e=m.billingFormFields;e&&Object.keys(e).some((t=>e[t]))&&this.formController.setInitialValues(e),this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}componentDidLoad(){this.unsubscribeFromStore=b("billingFormFields",(e=>{this.formController.setInitialValues(e)}))}disconnectedCallback(){var e;null===(e=this.unsubscribeFromStore)||void 0===e||e.call(this)}async getValues(){return this.formController.values.getValue()}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){if(!this.formController)return null;const e=this.formController.getInitialValues();return t("div",{part:f,class:"mt-4"},t(p,{text:"Billing address",class:"fs-6 fw-bold lh-lg mb-4"}),t("form",null,t("fieldset",null,this.legend&&t("legend",null,this.legend),t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-text",{name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-text",{name:"address_line1",label:"Street Address",defaultValue:e.address_line1,errorText:this.errors.address_line1,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-text",{name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:e.address_line2,errorText:this.errors.address_line2,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-text",{name:"address_city",label:"City",defaultValue:e.address_city,errorText:this.errors.address_city,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-select",{name:"address_state",label:"State / Province",options:h,defaultValue:e.address_state,errorText:this.errors.address_state,inputHandler:this.inputHandler})),t("div",{class:"col-12"},t("form-control-text",{name:"address_postal_code",label:"Postal Code",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:7}))))))}},j=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new i(a({name:c.nullable(),address_line1:n.nullable(),address_line2:o.nullable(),address_city:d.nullable(),address_state:r.nullable(),address_postal_code:l.required("Enter postal code")}));const e=m.billingFormFields;e&&Object.keys(e).some((t=>e[t]))&&this.formController.setInitialValues(e)}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)})),this.unsubscribeFromStore=b("billingFormFields",(e=>{this.formController.setInitialValues(e)}))}disconnectedCallback(){var e;null===(e=this.unsubscribeFromStore)||void 0===e||e.call(this)}async getValues(){return this.formController.values.getValue()}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return t("div",{key:"41a7f26e12bfa3da4e7926d8a535218a0580be14",part:f},t("form",{key:"b48cf148ec6d16fd8e5859dfe96a3b9fd6d3036d"},t("fieldset",{key:"88094544642af8fadb270dfafd838d450ad88cdd"},this.legend&&t("legend",{key:"13c19557aa4c0c127305cc54f6346eeb74d4f750"},this.legend),t("div",{key:"bbcf1a622720df2d21db718eaf823e4e33155070",class:"row gy-3"},t("div",{key:"96b9d590fd68fd4f2a54760e58c0f2bc166a832b",class:"col-12"},t("form-control-text",{key:"57050d0274782cb2ff5f1a9b13726a8319438a36",name:"address_postal_code",label:"Postal Code",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:7}))))))}};export{v as bank_account_billing_form_simple,_ as billing_form,y as billing_form_full,j as card_billing_form_simple}
@@ -0,0 +1 @@
1
+ import{h as s,r as t,c as i}from"./p-CV0Pyo1O.js";import{c as e,F as r}from"./p-D9sqTVmd.js";import{b as o,i as a,a as n,c as h,d as p,e as l,f as m}from"./p-DK_bjvk1.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{C as d,b as c}from"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import{C as u,B as j,b as v}from"./p-BcNb9bVO.js";import{J as f}from"./p-CfIGO7TJ.js";import{B as b}from"./p-CHo7TfsM.js";import{S as w}from"./p-DzEdYT8R.js";import{H as C}from"./p-jIDKmNHy.js";import"./p-CZfYo5-1.js";import{c as g}from"./p-CqOzVXGL.js";import{S as y}from"./p-uZ5KAseb.js";import{B as D}from"./p-XYgDHrVL.js";import{m as B,a as x}from"./p-Da3fPDxu.js";import{B as O}from"./p-R_0S69Pr.js";import"./p-BFTU3MAI.js";import"./p-BxpXvXn-.js";import"./p-DPA5TKvQ.js";import"./p-BBSnDYJw.js";import"./p-D8GTwl9v.js";import"./p-BSs-2JKu.js";import"./p-Bx2_PW91.js";import"./p-De4Pig-y.js";import"./p-CPKMvyV_.js";import"./p-CdwzNfP1.js";const _=e(Object.assign(Object.assign({},o().fields),{legal_address:h(),additional_questions:n(),representative:a("representative")}));e(Object.assign(Object.assign({},p().fields),{legal_address:m(),additional_questions:n(),representative:l("representative")}));const S=_,T=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(y,{width:"25%"})),s("div",{class:"col-12"},s(y,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(y,{width:"50%"}),s(y,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(y,{width:"65%"}),s(y,{width:"35%"}))),P=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(y,{width:"40%",height:"40px"})),s(T,null),s(T,null),s(T,null)),k=class{constructor(s){t(this,s),this.submitEvent=i(this,"submit-event",7),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.isLoading=!1,this.isSaving=!1,this.country=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(){g(),this.analytics=new f(this),this.formController=new r(S),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}get title(){return this.removeTitle?"":this.formTitle}get disabledState(){return this.isSaving}get businessEndpoint(){return`entities/business/${this.businessId}`}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=B({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:c.MISSING_PROPS,severity:d.ERROR})}handleReponse(s){s.error&&(this.errorMessage=v.patchData),this.submitEvent.emit({response:s}),this.instantiateBusiness(s.data)}render(){return s(w,null,this.isLoading?s(P,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("business-core-info",{formController:this.formController,country:this.country})),s("div",{class:"col-12 mb-4"},s("legal-address-form",{formController:this.formController,country:this.country})),s("div",{class:"col-12 mb-4"},s("additional-questions",{formController:this.formController})),s("div",{class:"col-12 mb-4"},s("business-representative",{formController:this.formController,country:this.country})),s("div",{class:"col-12 d-flex flex-row-reverse"},s(b,{type:"submit",disabled:this.disabledState,variant:"primary",onClick:()=>this.clickEvent.emit({name:D.submit}),isLoading:this.isSaving},"Submit")))))}};export{k as justifi_business_form}
@@ -1 +1 @@
1
- import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{j as s,C as i,b as r}from"./p-DXTa04jn.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{J as o}from"./p-DYL3RR2S.js";import{c}from"./p-C_SQBHCI.js";import{g as p,a as h}from"./p-CdwzNfP1.js";import{P as d}from"./p-NzPaWKbY.js";import{T as f,a as l,b as u,c as m,d as y,e as b,f as _,g,h as j,i as T,j as w,k,l as C}from"./p-BICxxa69.js";import{S as v}from"./p-DzEdYT8R.js";import{T as D}from"./p-CZfYo5-1.js";import{a as P}from"./p-BSs-2JKu.js";import{a6 as R,a7 as S}from"./p-CPKMvyV_.js";import"./p-D8GTwl9v.js";import"./p-BtzgeLyZ.js";import"./p-De4Pig-y.js";import"./p-CqiVXthx.js";const F={created_at:()=>e("th",{part:R,scope:"col",title:"The date and time each transaction was made"},"Processed On"),type:()=>e("th",{part:R,scope:"col",title:"The type of each transaction"},"Type"),id:()=>e("th",{part:R,scope:"col",title:"The unique identifier of each transaction"},"ID"),amount:()=>e("th",{part:R,scope:"col",title:"The dollar amount of each transaction",class:"text-end"},"Amount"),balance:()=>e("th",{part:R,scope:"col",title:"The running total amount of this payment that belongs to you",class:"text-end"},"Balance"),currency:()=>e("th",{part:R,scope:"col",title:"The currency of each transaction"},"Currency"),financial_transaction_id:()=>e("th",{part:R,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),payment_id:()=>e("th",{part:R,scope:"col",title:"The unique identifier of the payment associated with the payment balance transaction"},"Payment ID"),payment_balance_txn_type:()=>e("th",{part:R,scope:"col",title:"The type of the payment balance transaction"},"Transaction Type"),source_id:()=>e("th",{part:R,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),source_type:()=>e("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",platform_fee:"Platform Fee",platform_fee_return:"Platform Fee Return",processing_fee:"Processing Fee",processing_fee_return:"Processing Fee Return",refund:"Refund",fee_refund:"Fee Refund",application_fee_returned:"Application Fee Returned",refund_failure:"Refund Failure",void:"Void"},I={created_at:(t,a)=>e("td",{part:S(a)},e("div",{class:"fw-bold"},P(t.created_at,{showDisplayDate:!0})),e("div",{class:"fw-bold"},P(t.created_at,{showTime:!0}))),type:(t,a)=>e("td",{part:S(a)},x[t.payment_balance_txn_type]),id:(t,a)=>e("td",{part:S(a)},t.id),amount:(t,a)=>e("td",{part:S(a),class:"text-end"},t.formattedPaymentAmount(t.amount)),balance:(t,a)=>e("td",{part:S(a),class:"text-end"},t.formattedPaymentAmount(t.balance)),currency:(t,a)=>e("td",{part:S(a)},t.currency),financial_transaction_id:(t,a)=>e("td",{part:S(a)},t.financial_transaction_id),payment_id:(t,a)=>e("td",{part:S(a)},t.payment_id),payment_balance_txn_type:(t,a)=>e("td",{part:S(a)},t.payment_balance_txn_type),source_id:(t,a)=>e("td",{part:S(a)},t.source_id),source_type:(t,a)=>e("td",{part:S(a)},t.source_type)},E=class{constructor(e){t(this,e),this.clickEvent=a(this,"click-event",7),this.errorEvent=a(this,"error-event",7),this.balanceTransactions=[],this.isLoading=!0,this.errorMessage=null,this.paging=n,this.pagingParams={},this.columns="created_at,type,id,amount,balance",this.handleClickPrevious=e=>{this.pagingParams={before_cursor:e},this.clickEvent.emit({name:D.previous})},this.handleClickNext=e=>{this.pagingParams={after_cursor:e},this.clickEvent.emit({name:D.next})},this.rowClickHandler=e=>{const t=e.target.closest("tr").dataset.rowEntityId;if(!t)return;const a=this.balanceTransactions.find((e=>e.id===t));this.clickEvent.emit({name:D.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,F,I),c(),this.analytics=new o(this),this.initializeApi()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeApi()}handleError(e,t,a){this.isLoading=!1,this.errorEvent.emit({errorCode:e,message:t,severity:a})}initializeApi(){this.paymentId&&this.authToken?(({id:e,authToken:t,service:a})=>async({params:r,onSuccess:n,onError:o,final:c})=>{var d;try{const c=await a.fetchPaymentTransactions(e,t,r);c.error?o({error:h(c.error),code:p(null===(d=c.error)||void 0===d?void 0:d.code),severity:i.ERROR}):n({balanceTransactions:c.data.map((e=>new s(e))),pagingInfo:Object.assign({},c.page_info)})}catch(e){const t=p(null==e?void 0:e.code);o({error:h(e),code:t,severity:i.ERROR})}finally{c()}})({id:this.paymentId,authToken:this.authToken,service:new d})({params:this.pagingParams,onSuccess:({balanceTransactions:e,pagingInfo:t})=>{this.balanceTransactions=e,this.paging=t,this.transactionsTable.collectionData=this.balanceTransactions},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e.message,this.handleError(e,t,a)},final:()=>{this.isLoading=!1}}):(this.errorMessage="payment-id and auth-token props are required",this.handleError(r.MISSING_PROPS,this.errorMessage,i.ERROR))}get entityId(){return this.balanceTransactions.map((e=>e.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 e(v,{key:"24e7a4313ab91f179fd27b6596f012487de06815"},e(l,{key:"1f9a7a56a940e41dd865bc6f3a8681ce86d60d58"},e(u,{key:"a26ce09ae4df84698be1ea37cb735e38c0a0402e"},e(m,{key:"07f8655efd483e1d9240e65b17dc13583028f376"},e(y,{key:"0b62a7700715dbaffbedc0538432d075a3158499"},this.transactionsTable.columnData.map((e=>e)))),e(b,{key:"adf75fa50ddfb5257875b2779fc6c157812d4c19"},e(_,{key:"bc77de512b3e5fd1e6c4b8cf908b46027a3bc33f",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),e(g,{key:"413d46e184399cba3993f37efd64cb0d0a10d905",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),e(j,{key:"9deaa794dc848ed7c85cbadc3b4cfe7c9fb1176f",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((t,a)=>e(T,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},t)))),this.paging&&e(w,{key:"16ca0811bf42dc9419f8b77086e8e7e2cf6d0085"},e(k,{key:"e11be42549832c35078acf47b7c165fe1e50ea98"},e(C,{key:"205d649068b84200b88adc1be9cfe192abfe13be",colSpan:this.transactionsTable.columnData.length},e("pagination-menu",{key:"2a28645220d4f18b7037e461bd93eefc3aed49a0",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 e,r as t,c as a}from"./p-CV0Pyo1O.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{j as s,C as i,b as r}from"./p-DXTa04jn.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{J as o}from"./p-CfIGO7TJ.js";import{c}from"./p-CqOzVXGL.js";import{g as p,a as h}from"./p-CdwzNfP1.js";import{P as d}from"./p-NzPaWKbY.js";import{T as f,a as l,b as u,c as m,d as y,e as b,f as _,g,h as j,i as T,j as w,k,l as C}from"./p-BICxxa69.js";import{S as v}from"./p-DzEdYT8R.js";import{T as D}from"./p-CZfYo5-1.js";import{a as P}from"./p-BSs-2JKu.js";import{a6 as x,a7 as F}from"./p-CPKMvyV_.js";import"./p-D8GTwl9v.js";import"./p-Bx2_PW91.js";import"./p-De4Pig-y.js";import"./p-CqiVXthx.js";const R={created_at:()=>e("th",{part:x,scope:"col",title:"The date and time each transaction was made"},"Processed On"),type:()=>e("th",{part:x,scope:"col",title:"The type of each transaction"},"Type"),id:()=>e("th",{part:x,scope:"col",title:"The unique identifier of each transaction"},"ID"),amount:()=>e("th",{part:x,scope:"col",title:"The dollar amount of each transaction",class:"text-end"},"Amount"),balance:()=>e("th",{part:x,scope:"col",title:"The running total amount of this payment that belongs to you",class:"text-end"},"Balance"),currency:()=>e("th",{part:x,scope:"col",title:"The currency of each transaction"},"Currency"),financial_transaction_id:()=>e("th",{part:x,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),payment_id:()=>e("th",{part:x,scope:"col",title:"The unique identifier of the payment associated with the payment balance transaction"},"Payment ID"),payment_balance_txn_type:()=>e("th",{part:x,scope:"col",title:"The type of the payment balance transaction"},"Transaction Type"),source_id:()=>e("th",{part:x,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),source_type:()=>e("th",{part:x,scope:"col",title:"The type of the source object associated with the payment balance transaction"},"Source Type")},S={ach_return:"ACH Return",ach_return_fee:"ACH Return Fee",dispute:"Dispute",dispute_fee:"Dispute Fee",dispute_fee_refund:"Dispute Fee Refund",dispute_refund:"Dispute Refund",payment:"Payment",payment_fee:"Fee",platform_fee:"Platform Fee",platform_fee_return:"Platform Fee Return",processing_fee:"Processing Fee",processing_fee_return:"Processing Fee Return",refund:"Refund",fee_refund:"Fee Refund",application_fee_returned:"Application Fee Returned",refund_failure:"Refund Failure",void:"Void"},I={created_at:(t,a)=>e("td",{part:F(a)},e("div",{class:"fw-bold"},P(t.created_at,{showDisplayDate:!0})),e("div",{class:"fw-bold"},P(t.created_at,{showTime:!0}))),type:(t,a)=>e("td",{part:F(a)},S[t.payment_balance_txn_type]),id:(t,a)=>e("td",{part:F(a)},t.id),amount:(t,a)=>e("td",{part:F(a),class:"text-end"},t.formattedPaymentAmount(t.amount)),balance:(t,a)=>e("td",{part:F(a),class:"text-end"},t.formattedPaymentAmount(t.balance)),currency:(t,a)=>e("td",{part:F(a)},t.currency),financial_transaction_id:(t,a)=>e("td",{part:F(a)},t.financial_transaction_id),payment_id:(t,a)=>e("td",{part:F(a)},t.payment_id),payment_balance_txn_type:(t,a)=>e("td",{part:F(a)},t.payment_balance_txn_type),source_id:(t,a)=>e("td",{part:F(a)},t.source_id),source_type:(t,a)=>e("td",{part:F(a)},t.source_type)},O=class{constructor(e){t(this,e),this.clickEvent=a(this,"click-event",7),this.errorEvent=a(this,"error-event",7),this.balanceTransactions=[],this.isLoading=!0,this.errorMessage=null,this.paging=n,this.pagingParams={},this.columns="created_at,type,id,amount,balance",this.handleClickPrevious=e=>{this.pagingParams={before_cursor:e},this.clickEvent.emit({name:D.previous})},this.handleClickNext=e=>{this.pagingParams={after_cursor:e},this.clickEvent.emit({name:D.next})},this.rowClickHandler=e=>{const t=e.target.closest("tr").dataset.rowEntityId;if(!t)return;const a=this.balanceTransactions.find((e=>e.id===t));this.clickEvent.emit({name:D.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,R,I),c(),this.analytics=new o(this),this.initializeApi()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeApi()}handleError(e,t,a){this.isLoading=!1,this.errorEvent.emit({errorCode:e,message:t,severity:a})}initializeApi(){this.paymentId&&this.authToken?(({id:e,authToken:t,service:a})=>async({params:r,onSuccess:n,onError:o,final:c})=>{var d;try{const c=await a.fetchPaymentTransactions(e,t,r);c.error?o({error:h(c.error),code:p(null===(d=c.error)||void 0===d?void 0:d.code),severity:i.ERROR}):n({balanceTransactions:c.data.map((e=>new s(e))),pagingInfo:Object.assign({},c.page_info)})}catch(e){const t=p(null==e?void 0:e.code);o({error:h(e),code:t,severity:i.ERROR})}finally{c()}})({id:this.paymentId,authToken:this.authToken,service:new d})({params:this.pagingParams,onSuccess:({balanceTransactions:e,pagingInfo:t})=>{this.balanceTransactions=e,this.paging=t,this.transactionsTable.collectionData=this.balanceTransactions},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e.message,this.handleError(e,t,a)},final:()=>{this.isLoading=!1}}):(this.errorMessage="payment-id and auth-token props are required",this.handleError(r.MISSING_PROPS,this.errorMessage,i.ERROR))}get entityId(){return this.balanceTransactions.map((e=>e.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 e(v,{key:"24e7a4313ab91f179fd27b6596f012487de06815"},e(l,{key:"1f9a7a56a940e41dd865bc6f3a8681ce86d60d58"},e(u,{key:"a26ce09ae4df84698be1ea37cb735e38c0a0402e"},e(m,{key:"07f8655efd483e1d9240e65b17dc13583028f376"},e(y,{key:"0b62a7700715dbaffbedc0538432d075a3158499"},this.transactionsTable.columnData.map((e=>e)))),e(b,{key:"adf75fa50ddfb5257875b2779fc6c157812d4c19"},e(_,{key:"bc77de512b3e5fd1e6c4b8cf908b46027a3bc33f",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),e(g,{key:"413d46e184399cba3993f37efd64cb0d0a10d905",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),e(j,{key:"9deaa794dc848ed7c85cbadc3b4cfe7c9fb1176f",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((t,a)=>e(T,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},t)))),this.paging&&e(w,{key:"16ca0811bf42dc9419f8b77086e8e7e2cf6d0085"},e(k,{key:"e11be42549832c35078acf47b7c165fe1e50ea98"},e(C,{key:"205d649068b84200b88adc1be9cfe192abfe13be",colSpan:this.transactionsTable.columnData.length},e("pagination-menu",{key:"2a28645220d4f18b7037e461bd93eefc3aed49a0",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],paymentId:["propChanged"],authToken:["propChanged"]}}};export{O as justifi_payment_transactions_list}
@@ -1 +1 @@
1
- import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-NzPaWKbY.js";import{m as i}from"./p-BB8Ce9rp.js";import{C as d,b as c,i as f,h as l}from"./p-DXTa04jn.js";import{J as r}from"./p-DYL3RR2S.js";import{c as h}from"./p-C_SQBHCI.js";import"./p-DVJaoI_m.js";import{b as o,d as b,s as p}from"./p-BSs-2JKu.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{P as n,M as m}from"./p-D1_eip6x.js";import{a as y,b as u,D as v,c as k,C as j,E as C}from"./p-Cu7hgXL1.js";import{S as g}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as w}from"./p-uZ5KAseb.js";import{a as D,B as P}from"./p-CHw7tICr.js";import"./p-De4Pig-y.js";import"./p-HXpYMWUU.js";import"./p-CdwzNfP1.js";import"./p-BtzgeLyZ.js";import"./p-D8GTwl9v.js";import"./p-CPKMvyV_.js";const x=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(w,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(w,{width:"70%"})),e("div",{class:"col-12"},e(w,{width:"40%"})),e("div",{class:"col-12"},e(w,{width:"40%"})),e("div",{class:"col-12"},e(w,{width:"100%"})),e("div",{class:"col-12"},e(w,{width:"80%"}))),T=class{constructor(e){t(this,e),this.errorEvent=a(this,"error-event",7),this.recordClickEvent=a(this,"record-click-event",7),this.loading=!0}componentWillLoad(){h(),this.analytics=new r(this),this.initializeGetPaymentDetails()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeGetPaymentDetails()}initializeGetPaymentDetails(){this.paymentId&&this.authToken?(this.getPaymentDetails=i({id:this.paymentId,authToken:this.authToken,service:new s}),this.fetchData()):(this.errorMessage="Payment ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:c.MISSING_PROPS,severity:d.ERROR}))}updateOnPropChange(){this.getPaymentDetails&&this.fetchData()}fetchData(){this.loading=!0,this.getPaymentDetails({onSuccess:({payment:e})=>{this.payment=e,this.errorMessage=null},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({errorCode:t,message:e,severity:a})},final:()=>{this.loading=!1}})}get PaymentStatus(){return this.payment.status===f.disputed&&this.payment.disputes.some((e=>e.status===l.lost))?n.DISPUTE_LOST:this.payment.status}render(){return e(g,{key:"f304cb665f17ce96b6d97a38d94907629f559413"},this.loading&&e(x,{key:"709acde31230bd9e825e4e9669234492aff3cc3a"}),!this.loading&&this.errorMessage&&C(this.errorMessage),!this.loading&&!this.errorMessage&&this.payment&&e("justifi-details",{key:"09a4a2559fb89a5b4b57d81b0fd48952c219d348",errorMessage:this.errorMessage},e(y,{key:"7cbfece91ce9e5fab75d561ad369080ecbe76fa4",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},m(this.PaymentStatus),this.payment.expedited?e(D,{variant:P.WARNING,title:"Expedited",text:"Expedited"}):null),title:this.payment.formattedPaymentAmount(this.payment.amount)},e(u,{key:"4aa014d77def141d2053c3745b8215cc03a53ac7",classes:"border-1 border-end",title:"Updated At",value:`${o(this.payment.updated_at)} ${b(this.payment.updated_at)}`}),e(u,{key:"f344398f4fd4db6e1e7ca1335c3aa55630668475",classes:"border-1 border-end",title:"Created At",value:`${o(this.payment.created_at)} ${b(this.payment.created_at)}`}),e(u,{key:"a01e5a04400b996cfb2a9e563c8f383b8e8d7c66",title:"ID",value:this.payment.id})),e("div",{key:"ef0c63d53031dfa8910dfbdedede1e20ac09e78a",slot:"detail-sections"},e(v,{key:"5053784a7e3bd8932562a816921564aadd6d79c8",sectionTitle:"Details"}),e("div",{key:"43c56ee5a39589ea7a0107f32e274be439adf33a",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"fcee2dd211c9bf951cdd6855ac3fa844632391ce",title:"Amount",value:this.payment.formattedPaymentAmount(this.payment.amount)}),e(k,{key:"44d055f3445f02feaeb4519b5f4777333089a8c6",title:"Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"906b584174bd5c329974274a2f1e1ef7e9e8fde0",title:"Refunded",value:this.payment.formattedPaymentAmount(this.payment.amount_refunded)}),e(k,{key:"809429e88eac8ebe8142bb0028f8b86447977697",title:"Net",value:this.payment.formattedPaymentAmount(this.payment.balance)}),e(k,{key:"e08c02efc64f105ce3180e9773584a331ae19a9b",title:"Status",value:m(this.PaymentStatus)}),e(k,{key:"fbb910b7006f9d4bff9b14ffd4fc2f7da8b68020",title:"Payment ID",value:this.payment.id}),e(k,{key:"09fefc2d1a750ab2f5dfb2043db08d5f16d6d9aa",title:"Processing Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"1d96f4557823f1d82d5c6e0e46a984c13c6f018b",title:"Statement Descriptor",value:this.payment.statement_descriptor}),e(k,{key:"51bfae7ef30f36c99c0fa1b25dc5397720ef88ff",title:"Description",value:this.payment.description}),e(k,{key:"5c44b3d40bfe6b2fbf258fee90f55ff24d0b3c28",title:"Expedited",value:this.payment.expedited?"Yes":"No"})),this.payment.payment_method.card&&[e(v,{key:"3d652ba331824448b7e7af969b2ead216f358e28",sectionTitle:"Payment Method"}),e("div",{key:"49ad00ec9d703d196a025fa17b03f4af7cdc4dc5",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"2b1b3f57e74fd65dc4b82d727a94afbe14803c52",title:"ID",value:this.payment.payment_method.card.id}),e(k,{key:"b23d5263566ff11d469dea9a245d20a7689540f8",title:"Payment Type",value:"Card"}),e(k,{key:"f5f76d6d9ac609884aac18fe2743d4fad2192b86",title:"Last 4 Numbers",value:this.payment.payment_method.lastFourDigits}),e(k,{key:"22f296966b6f1aaf516b1d70144cff4f59b82c05",title:"Brand",value:p(this.payment.payment_method.card.brand)}),e(k,{key:"d7dcd0f7a74ed2cc5ba6406a7d48522ca06a7546",title:"Cardholder",value:this.payment.payment_method.payersName}))],this.payment.payment_method.bank_account&&[e(v,{key:"37a2a20c462cb94baa01ca7763d43ced04b4543c",sectionTitle:"Payment Method"}),e("div",{key:"f6de7746d5ff64d27368edef51b3c4e0ff7c658b",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"34e9b26c6d20e9b5e86e4cc11fb925ff1ef5ce94",title:"ID",value:this.payment.payment_method.bank_account.id}),e(k,{key:"32cd6da4d7234aca403bd699de23e1cf889bf14f",title:"Last 4 Numbers",value:this.payment.last_four_digits}),e(k,{key:"f1313ac7c15d5ae2d9dfa2b6d3ec794d0987252b",title:"Bank Name",value:this.payment.payment_method.bank_account.brand}),e(k,{key:"76d1ac1961e530a7a6e1ba5512b982cd70df9470",title:"Account Owner",value:this.payment.payment_method.payersName}))],this.payment.metadata&&[e(v,{key:"1cff262d07acda5bc742f325a23f4199c22f3a01",sectionTitle:"Metadata"}),e("div",{key:"77379785d2559d39a26a253757fdaf02795c53a1",class:"d-table gap-2 w-100"},e(j,{key:"92cb32f3dd6b45094210194e2e40927d7f9d6bde",metadata:this.payment.metadata}))])))}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"],getPaymentDetails:["updateOnPropChange"]}}};export{T as justifi_payment_details}
1
+ import{h as e,r as t,c as a}from"./p-CV0Pyo1O.js";import{P as s}from"./p-NzPaWKbY.js";import{m as i}from"./p-BB8Ce9rp.js";import{C as d,b as f,i as c,h as l}from"./p-DXTa04jn.js";import{J as r}from"./p-CfIGO7TJ.js";import{c as h}from"./p-CqOzVXGL.js";import"./p-DVJaoI_m.js";import{b as o,d as b,s as p}from"./p-BSs-2JKu.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{P as n,M as m}from"./p-D1_eip6x.js";import{a as y,b as u,D as v,c as k,C as j,E as C}from"./p-Cu7hgXL1.js";import{S as g}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as w}from"./p-uZ5KAseb.js";import{a as P,B as D}from"./p-CHw7tICr.js";import"./p-De4Pig-y.js";import"./p-HXpYMWUU.js";import"./p-CdwzNfP1.js";import"./p-Bx2_PW91.js";import"./p-D8GTwl9v.js";import"./p-CPKMvyV_.js";const x=()=>e("div",{class:"row gap-3"},e("div",{class:"col-12"},e(w,{width:"35%",height:"30px"})),e("div",{class:"col-12"},e(w,{width:"70%"})),e("div",{class:"col-12"},e(w,{width:"40%"})),e("div",{class:"col-12"},e(w,{width:"40%"})),e("div",{class:"col-12"},e(w,{width:"100%"})),e("div",{class:"col-12"},e(w,{width:"80%"}))),T=class{constructor(e){t(this,e),this.errorEvent=a(this,"error-event",7),this.recordClickEvent=a(this,"record-click-event",7),this.loading=!0}componentWillLoad(){h(),this.analytics=new r(this),this.initializeGetPaymentDetails()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeGetPaymentDetails()}initializeGetPaymentDetails(){this.paymentId&&this.authToken?(this.getPaymentDetails=i({id:this.paymentId,authToken:this.authToken,service:new s}),this.fetchData()):(this.errorMessage="Payment ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:f.MISSING_PROPS,severity:d.ERROR}))}updateOnPropChange(){this.getPaymentDetails&&this.fetchData()}fetchData(){this.loading=!0,this.getPaymentDetails({onSuccess:({payment:e})=>{this.payment=e,this.errorMessage=null},onError:({error:e,code:t,severity:a})=>{this.errorMessage=e,this.errorEvent.emit({errorCode:t,message:e,severity:a})},final:()=>{this.loading=!1}})}get PaymentStatus(){return this.payment.status===c.disputed&&this.payment.disputes.some((e=>e.status===l.lost))?n.DISPUTE_LOST:this.payment.status}render(){return e(g,{key:"f304cb665f17ce96b6d97a38d94907629f559413"},this.loading&&e(x,{key:"709acde31230bd9e825e4e9669234492aff3cc3a"}),!this.loading&&this.errorMessage&&C(this.errorMessage),!this.loading&&!this.errorMessage&&this.payment&&e("justifi-details",{key:"09a4a2559fb89a5b4b57d81b0fd48952c219d348",errorMessage:this.errorMessage},e(y,{key:"7cbfece91ce9e5fab75d561ad369080ecbe76fa4",slot:"head-info",badge:e("div",{class:"d-flex gap-1"},m(this.PaymentStatus),this.payment.expedited?e(P,{variant:D.WARNING,title:"Expedited",text:"Expedited"}):null),title:this.payment.formattedPaymentAmount(this.payment.amount)},e(u,{key:"4aa014d77def141d2053c3745b8215cc03a53ac7",classes:"border-1 border-end",title:"Updated At",value:`${o(this.payment.updated_at)} ${b(this.payment.updated_at)}`}),e(u,{key:"f344398f4fd4db6e1e7ca1335c3aa55630668475",classes:"border-1 border-end",title:"Created At",value:`${o(this.payment.created_at)} ${b(this.payment.created_at)}`}),e(u,{key:"a01e5a04400b996cfb2a9e563c8f383b8e8d7c66",title:"ID",value:this.payment.id})),e("div",{key:"ef0c63d53031dfa8910dfbdedede1e20ac09e78a",slot:"detail-sections"},e(v,{key:"5053784a7e3bd8932562a816921564aadd6d79c8",sectionTitle:"Details"}),e("div",{key:"43c56ee5a39589ea7a0107f32e274be439adf33a",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"fcee2dd211c9bf951cdd6855ac3fa844632391ce",title:"Amount",value:this.payment.formattedPaymentAmount(this.payment.amount)}),e(k,{key:"44d055f3445f02feaeb4519b5f4777333089a8c6",title:"Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"906b584174bd5c329974274a2f1e1ef7e9e8fde0",title:"Refunded",value:this.payment.formattedPaymentAmount(this.payment.amount_refunded)}),e(k,{key:"809429e88eac8ebe8142bb0028f8b86447977697",title:"Net",value:this.payment.formattedPaymentAmount(this.payment.balance)}),e(k,{key:"e08c02efc64f105ce3180e9773584a331ae19a9b",title:"Status",value:m(this.PaymentStatus)}),e(k,{key:"fbb910b7006f9d4bff9b14ffd4fc2f7da8b68020",title:"Payment ID",value:this.payment.id}),e(k,{key:"09fefc2d1a750ab2f5dfb2043db08d5f16d6d9aa",title:"Processing Fees",value:this.payment.formattedPaymentAmount(this.payment.fee_amount)}),e(k,{key:"1d96f4557823f1d82d5c6e0e46a984c13c6f018b",title:"Statement Descriptor",value:this.payment.statement_descriptor}),e(k,{key:"51bfae7ef30f36c99c0fa1b25dc5397720ef88ff",title:"Description",value:this.payment.description}),e(k,{key:"5c44b3d40bfe6b2fbf258fee90f55ff24d0b3c28",title:"Expedited",value:this.payment.expedited?"Yes":"No"})),this.payment.payment_method.card&&[e(v,{key:"3d652ba331824448b7e7af969b2ead216f358e28",sectionTitle:"Payment Method"}),e("div",{key:"49ad00ec9d703d196a025fa17b03f4af7cdc4dc5",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"2b1b3f57e74fd65dc4b82d727a94afbe14803c52",title:"ID",value:this.payment.payment_method.card.id}),e(k,{key:"b23d5263566ff11d469dea9a245d20a7689540f8",title:"Payment Type",value:"Card"}),e(k,{key:"f5f76d6d9ac609884aac18fe2743d4fad2192b86",title:"Last 4 Numbers",value:this.payment.payment_method.lastFourDigits}),e(k,{key:"22f296966b6f1aaf516b1d70144cff4f59b82c05",title:"Brand",value:p(this.payment.payment_method.card.brand)}),e(k,{key:"d7dcd0f7a74ed2cc5ba6406a7d48522ca06a7546",title:"Cardholder",value:this.payment.payment_method.payersName}))],this.payment.payment_method.bank_account&&[e(v,{key:"37a2a20c462cb94baa01ca7763d43ced04b4543c",sectionTitle:"Payment Method"}),e("div",{key:"f6de7746d5ff64d27368edef51b3c4e0ff7c658b",class:"d-flex flex-column gap-2 w-100"},e(k,{key:"34e9b26c6d20e9b5e86e4cc11fb925ff1ef5ce94",title:"ID",value:this.payment.payment_method.bank_account.id}),e(k,{key:"32cd6da4d7234aca403bd699de23e1cf889bf14f",title:"Last 4 Numbers",value:this.payment.last_four_digits}),e(k,{key:"f1313ac7c15d5ae2d9dfa2b6d3ec794d0987252b",title:"Bank Name",value:this.payment.payment_method.bank_account.brand}),e(k,{key:"76d1ac1961e530a7a6e1ba5512b982cd70df9470",title:"Account Owner",value:this.payment.payment_method.payersName}))],this.payment.metadata&&[e(v,{key:"1cff262d07acda5bc742f325a23f4199c22f3a01",sectionTitle:"Metadata"}),e("div",{key:"77379785d2559d39a26a253757fdaf02795c53a1",class:"d-table gap-2 w-100"},e(j,{key:"92cb32f3dd6b45094210194e2e40927d7f9d6bde",metadata:this.payment.metadata}))])))}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"],getPaymentDetails:["updateOnPropChange"]}}};export{T as justifi_payment_details}
@@ -1 +1 @@
1
- import{r as e,h as n,H as t,c as i,g as o}from"./p-CV0Pyo1O.js";import{c as r}from"./p-D8GTwl9v.js";import{a3 as s,q as a,v as c,w as d,x as u}from"./p-CPKMvyV_.js";import{g as f}from"./p-BFTU3MAI.js";import{F as l}from"./p-Ce_W43gc.js";import{p as h}from"./p-BtzgeLyZ.js";const m=r({focused:{boxShadow:"",border:""},focusedAndInvalid:{boxShadow:"",border:""},fontStyles:{fontFamily:"",fontSize:"",fontWeight:"",lineHeight:"",margin:"",padding:""}}),{state:w,set:g}=m,b=class{constructor(n){e(this,n),this.isFocused=!1,this.errorText=""}focusWithoutPageScroll(e){if(e)try{e.focus({preventScroll:!0})}catch(n){const{scrollX:t,scrollY:i}=window;e.focus(),window.scrollTo(t,i)}}async componentDidLoad(){const e=await this.getBaseFontStyles();g("fontStyles",e);const n=await this.getFocusedStyles();g("focused",n);const t=await this.getFocusedAndInvalidStyles();g("focusedAndInvalid",t)}async getBaseFontStyles(){return new Promise((e=>{setTimeout((()=>{const n=getComputedStyle(this.hiddenInput);e({fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,margin:n.margin,padding:n.padding,color:n.color})}),500)}))}async getFocusedStyles(){return new Promise((e=>{this.focusWithoutPageScroll(this.hiddenInput),setTimeout((()=>{this.hiddenInput.blur();const n=getComputedStyle(this.hiddenInput);e({boxShadow:n.boxShadow,border:n.border})}),500)}))}async getFocusedAndInvalidStyles(){return new Promise((e=>{this.focusWithoutPageScroll(this.hiddenInput),this.errorText="Error",setTimeout((()=>{const n=getComputedStyle(this.hiddenInput),t={boxShadow:n.boxShadow,border:n.border};this.hiddenInput.blur(),e(t)}),500)}))}get part(){return this.isFocused&&this.errorText?s:this.errorText?a:this.isFocused?c:d}render(){return n(t,{key:"c3b2f0cb5160d888b3ecbaca95285749c0b71002"},n("input",{key:"f6d0ad00733d086dfa09b646f7599d60f91e5f50",ref:e=>this.hiddenInput=e,type:"text",class:this.errorText?"form-control is-invalid":"form-control",onFocus:()=>this.isFocused=!0,onBlur:()=>this.isFocused=!1,part:this.part,tabindex:"-1",style:{height:"0",opacity:"0",pointerEvents:"none",animation:"none"}}))}};var p,y,v={exports:{}},k=f((p||(p=1,y=v,console.info("\nIFRAME-RESIZER\n\nIframe-Resizer 5 is now available via the following two packages:\n\n * @iframe-resizer/parent\n * @iframe-resizer/child\n\nAdditionally their are also new versions of iframe-resizer for React, Vue, and jQuery.\n\nVersion 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n"),function(e){if("undefined"!=typeof window){var n,t,i=0,o=!1,r=!1,s="[iFrameSizer]",a=null,c=window.requestAnimationFrame,d=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),u={},f=null,l=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){k("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),h={};window.jQuery!==e&&((t=window.jQuery).fn?t.fn.iFrameResize||(t.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){W(t,e)})).end()}):v("","Unable to bind to jQuery, it is not fully loaded.")),y.exports=H(),window.iFrameResize=window.iFrameResize||H()}function m(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(e,n,t){e.addEventListener(n,t,!1)}function g(e,n,t){e.removeEventListener(n,t,!1)}function b(e){return u[e]?u[e].log:o}function p(e,n){x("log",e,n,b(e))}function v(e,n){x("info",e,n,b(e))}function k(e,n){x("warn",e,n,!0)}function x(e,n,t,i){!0===i&&"object"==typeof window.console&&console[e](function(e){return s+"["+function(e){var n="Host page: "+e;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),n}(e)+"]"}(n),t)}function z(e){function n(){t("Height"),t("Width"),C((function(){R(A),T(P),l("onResized",A)}),A,"init")}function t(e){var n=Number(u[P]["max"+e]),t=Number(u[P]["min"+e]),i=e.toLowerCase(),o=Number(A[i]);p(P,"Checking "+i+" is in range "+t+"-"+n),o<t&&(o=t,p(P,"Set "+i+" to min value")),o>n&&(o=n,p(P,"Set "+i+" to max value")),A[i]=""+o}function i(e){return W.slice(W.indexOf(":")+7+e)}function o(e,n){var t,i;t=function(){var t,i;E("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=A.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},h[i=n]||(h[i]=setTimeout((function(){h[i]=null,t()}),32))}function r(e){var n=e.getBoundingClientRect();return M(P),{x:Math.floor(Number(n.left)+Number(a.x)),y:Math.floor(Number(n.top)+Number(a.y))}}function c(e){var n=e?r(A.iframe):{x:0,y:0},t={x:Number(A.width)+n.x,y:Number(A.height)+n.y};p(P,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(a=t,d(),p(P,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):k(P,"Unable to scroll to requested position, window.parentIFrame not found")}function d(){!1===l("onScroll",a)?j():T(P)}function f(e){var n={};if(0===Number(A.width)&&0===Number(A.height)){var t=i(9).split(":");n={x:t[1],y:t[0]}}else n={x:A.width,y:A.height};l(e,{iframe:A.iframe,screenX:Number(n.x),screenY:Number(n.y),type:A.type})}function l(e,n){return I(P,e,n)}var m,b,y,x,z,S,W=e.data,A={},P=null;"[iFrameResizerChild]Ready"===W?function(){for(var e in u)E("iFrame requested init",N(e),u[e].iframe,e)}():s===(""+W).slice(0,13)&&W.slice(13).split(":")[0]in u?(x=(y=W.slice(13).split(":"))[1]?parseInt(y[1],10):0,z=u[y[0]]&&u[y[0]].iframe,S=getComputedStyle(z),A={iframe:z,id:y[0],height:x+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}(S)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(S),width:y[2],type:y[3]},u[P=A.id]&&(u[P].loaded=!0),(b=A.type in{true:1,false:1,undefined:1})&&p(P,"Ignoring init message from meta parent page"),!b&&function(e){var n=!0;return u[e]||(n=!1,k(A.type+" No settings for "+e+". Message was: "+W)),n}(P)&&(p(P,"Received: "+W),m=!0,null===A.iframe&&(k(P,"IFrame ("+A.id+") not found"),m=!1),m&&function(){var n,t=e.origin,i=u[P]&&u[P].checkOrigin;if(i&&""+t!="null"&&!(i.constructor===Array?function(){var e=0,n=!1;for(p(P,"Checking connection is from allowed list of origins: "+i);e<i.length;e++)if(i[e]===t){n=!0;break}return n}():(p(P,"Checking connection is from: "+(n=u[P]&&u[P].remoteHost)),t===n)))throw new Error("Unexpected message received from: "+t+" for "+A.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(u[P]&&u[P].firstRun&&u[P]&&(u[P].firstRun=!1),A.type){case"close":F(A.iframe);break;case"message":m=i(6),p(P,"onMessage passed: {iframe: "+A.iframe.id+", message: "+m+"}"),l("onMessage",{iframe:A.iframe,message:JSON.parse(m)}),p(P,"--");break;case"mouseenter":f("onMouseEnter");break;case"mouseleave":f("onMouseLeave");break;case"autoResize":u[P].autoResize=JSON.parse(i(9));break;case"scrollTo":c(!1);break;case"scrollToOffset":c(!0);break;case"pageInfo":o(u[P]&&u[P].iframe,P),function(){function e(e,i){function r(){u[t]?o(u[t].iframe,t):n()}["scroll","resize"].forEach((function(n){p(t,e+n+" listener for sendPageInfo"),i(window,n,r)}))}function n(){e("Remove ",g)}var t=P;e("Add ",w),u[t]&&(u[t].stopPageInfo=n)}();break;case"pageInfoStop":u[P]&&u[P].stopPageInfo&&(u[P].stopPageInfo(),delete u[P].stopPageInfo);break;case"inPageLink":t=i(9).split("#")[1]||"",s=decodeURIComponent(t),(h=document.getElementById(s)||document.getElementsByName(s)[0])?(e=r(h),p(P,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),a={x:e.x,y:e.y},d(),p(P,"--")):window.top===window.self?p(P,"In page link #"+t+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(t):p(P,"In page link #"+t+" not found and window.parentIFrame not found");break;case"reset":O(A);break;case"init":n(),l("onInit",A.iframe);break;default:0===Number(A.width)&&0===Number(A.height)?k("Unsupported message received ("+A.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}var e,t,s,h,m}())):v(P,"Ignored: "+W)}function I(e,n,t){var i=null,o=null;if(u[e]){if("function"!=typeof(i=u[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function S(e){delete u[e.id]}function F(e){var t=e.id;if(!1!==I(t,"onClose",t)){p(t,"Removing iFrame: "+t);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){k(e)}I(t,"onClosed",t),p(t,"--"),S(e),n&&(n.disconnect(),n=null)}else p(t,"Close iframe cancelled by onClose event")}function M(n){null===a&&p(n,"Get page position: "+(a={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+a.y)}function T(e){null!==a&&(window.scrollTo(a.x,a.y),p(e,"Set page position: "+a.x+","+a.y),j())}function j(){a=null}function O(e){p(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),M(e.id),C((function(){R(e),E("reset","reset",e.iframe,e.id)}),e,"reset")}function R(e){function n(n){r||"0"!==e[n]||(r=!0,p(i,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(u).forEach((function(e){!function(e){function n(n){return"0px"===(u[e]&&u[e].iframe.style[n])}u[e]&&null!==u[e].iframe.offsetParent&&(n("height")||n("width"))&&E("Visibility change","resize",u[e].iframe,e)}(e)}))}function n(n){p("window","Mutation observed: "+n[0].target+" "+n[0].type),A(e,16)}var t,i=m();i&&(t=document.querySelector("body"),new i(n).observe(t,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}())}function t(t){!function(n){e.id?(e.iframe.style[n]=e[n]+"px",p(e.id,"IFrame ("+i+") "+n+" set to "+e[n]+"px")):p("undefined","messageData id not set")}(t),n(t)}var i=e.iframe.id;u[i]&&(u[i].sizeHeight&&t("height"),u[i].sizeWidth&&t("width"))}function C(e,n,t){t!==n.type&&c&&!window.jasmine?(p(n.id,"Requesting animation frame"),c(e)):e()}function E(e,n,t,i,o){var r,a=!1;u[i=i||t.id]&&(t&&"contentWindow"in t&&null!==t.contentWindow?(p(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+(r=u[i]&&u[i].targetOrigin)),t.contentWindow.postMessage(s+n,r)):k(i,"["+e+"] IFrame("+i+") not found"),o&&u[i]&&u[i].warningTimeout&&(u[i].msgTimeout=setTimeout((function(){!u[i]||u[i].loaded||a||(a=!0,k(i,"IFrame has not responded within "+u[i].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),u[i].warningTimeout)))}function N(e){return e+":"+u[e].bodyMarginV1+":"+u[e].sizeWidth+":"+u[e].log+":"+u[e].interval+":"+u[e].enablePublicMethods+":"+u[e].autoResize+":"+u[e].bodyMargin+":"+u[e].heightCalculationMethod+":"+u[e].bodyBackground+":"+u[e].bodyPadding+":"+u[e].tolerance+":"+u[e].inPageLinks+":"+u[e].resizeFrom+":"+u[e].widthCalculationMethod+":"+u[e].mouseEvents}function W(t,r){function s(e){var n=e.split("Callback");if(2===n.length){var t="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[t]=this[e],delete this[e],k(f,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}var a,c,f=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var n;return""===e&&(t.id=(n=r&&r.id||l.id+i++,null!==document.getElementById(n)&&(n+=i++),e=n),o=(r||{}).log,p(e,"Added missing iframe ID: "+e+" ("+t.src+")")),e}(t.id);f in u&&"iFrameResizer"in t?k(f,"Ignored iFrame, already setup."):(function(e){var n;e=e||{},u[f]=Object.create(null),u[f].iframe=t,u[f].firstRun=!0,u[f].remoteHost=t.src&&t.src.split("/").slice(0,3).join("/"),function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(s,e),function(e){for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(u[f][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:l[n])}(e),u[f]&&(u[f].targetOrigin=!0===u[f].checkOrigin?""===(n=u[f].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*")}(r),function(){switch(p(f,"IFrame scrolling "+(u[f]&&u[f].scrolling?"enabled":"disabled")+" for "+f),t.style.overflow=!1===(u[f]&&u[f].scrolling)?"hidden":"auto",u[f]&&u[f].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=u[f]?u[f].scrolling:"no"}}(),function(){function e(e){var n=u[f][e];1/0!==n&&0!==n&&(t.style[e]="number"==typeof n?n+"px":n,p(f,"Set "+e+" = "+t.style[e]))}function n(e){if(u[f]["min"+e]>u[f]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}n("Height"),n("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!=typeof(u[f]&&u[f].bodyMargin)&&"0"!==(u[f]&&u[f].bodyMargin)||(u[f].bodyMarginV1=u[f].bodyMargin,u[f].bodyMargin=u[f].bodyMargin+"px"),a=N(f),(c=m())&&(n=function(e){if(!t.parentNode)return null;var n=new e((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===t&&F(t)}))}))}));return n.observe(t.parentNode,{childList:!0}),n}(c)),w(t,"load",(function(){E("iFrame.onload",a,t,e,!0),(!u[f]||!u[f].firstRun)&&u[f]&&u[f].heightCalculationMethod in d&&O({iframe:t,height:0,width:0,type:"init"})})),E("init",a,t,e,!0),u[f]&&(u[f].iframe.iFrameResizer={close:F.bind(null,u[f].iframe),removeListeners:S.bind(null,u[f].iframe),resize:E.bind(null,"Window resize","resize",u[f].iframe),moveToAnchor:function(e){E("Move to anchor","moveToAnchor:"+e,u[f].iframe,f)},sendMessage:function(e){E("Send Message","message:"+(e=JSON.stringify(e)),u[f].iframe,f)}}))}function A(e,n){null===f&&(f=setTimeout((function(){f=null,e()}),n))}function P(){"hidden"!==document.visibilityState&&(p("document","Trigger event: Visibility change"),A((function(){L("Tab Visible","resize")}),16))}function L(e,n){Object.keys(u).forEach((function(t){(function(e){return u[e]&&"parent"===u[e].resizeFrom&&u[e].autoResize&&!u[e].firstRun})(t)&&E(e,n,u[t].iframe,t)}))}function H(){function n(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),W(n,e),t.push(n))}var t;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!c;e+=1)c=window[n[e]+"RequestAnimationFrame"];c?c=c.bind(window):p("setup","RequestAnimationFrame not supported")}(),w(window,"message",z),w(window,"resize",(function(){p("window","Trigger event: resize"),A((function(){L("Window resize","resize")}),16)})),w(document,"visibilitychange",P),w(document,"-webkit-visibilitychange",P),function(i,o){switch(t=[],function(e){e&&e.enablePublicMethods&&k("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(i),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,i));break;case"object":n(i,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}}()),v.exports));class x{constructor(e,n){this.iframe=e,this.iframeOrigin=n}postMessage(e,n){const t=Object.assign({eventType:e},n);this.iframe.contentWindow.postMessage(t,this.iframeOrigin)}addMessageListener(e){window.addEventListener("message",e)}removeMessageListener(e){window.removeEventListener("message",e)}postMessageWithResponseListener(e,n){return new Promise((t=>{const i=n=>{n.data.eventType===e&&(window.removeEventListener("message",i),t(n.data.data))};window.addEventListener("message",i),this.postMessage(e,n)}))}}const z=class{constructor(n){e(this,n),this.iframeLoaded=i(this,"iframeLoaded",7),this.isFocused=!1,this.isValid=!0,this.dispatchMessageEvent=e=>{const{eventType:n,data:t}=e.data;(null==t?void 0:t.id)===this.inputId&&("focused"===n&&(this.isFocused=!0),"blurred"===n&&(this.isFocused=!1))}}disconnectedCallback(){this.frameService.removeMessageListener(this.dispatchMessageEvent)}async validate(){const e=await this.frameService.postMessageWithResponseListener("validate");return this.isValid=e.isValid,this.errorText=e.error.message,e}async tokenize(e,n,t){return this.frameService.postMessageWithResponseListener("tokenize",{clientId:e,paymentMethodMetadata:n,account:t,componentVersion:h.version})}initializeFrameCommunicationService(){var e;this.frameService=new x(this.iframeElement,this.iframeOrigin),null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent)}get part(){return this.isFocused&&!this.isValid?s:this.isValid?this.isFocused?c:d:a}get style(){return this.isFocused?this.isValid?w.focused:w.focusedAndInvalid:null}get urlParams(){const e=Object.fromEntries(Object.entries(w.fontStyles).map((([e,n])=>[e,btoa(String(n))])));return new URLSearchParams(e).toString()}render(){return n(t,{key:"60e76f1a33ddd4ea5b89cd31a1b6906ff53c5ddb",class:"form-group d-flex flex-column"},n("div",{key:"5fdef33ae8deb616929478d06fddc01b97233f0a",style:{visibility:this.iframeLoaded?"visible":"hidden",height:this.iframeLoaded?"auto":"0"}},n("label",{key:"e37adecf5024d4c77561d3ca269f49c398fc8fd7",class:"form-label",htmlFor:"",part:u},this.label||""),n("div",{key:"206a703cd84d713155aa754576410f495b4329fe",class:"p-0 d-flex form-control "+(this.isValid?"":"is-invalid"),part:this.part,style:Object.assign(Object.assign({},this.style),{overflow:"hidden"})},n("iframe",{key:"214ecd5b4fa9d075b91ea73b9edd09fdfa0cdf12",id:this.inputId,name:this.inputId,src:`${this.iframeOrigin}?${this.urlParams}`,ref:e=>{this.iframeElement=e,this.initializeFrameCommunicationService()},width:"100%",onLoad:()=>{k({log:!1,onResized:()=>{this.iframeLoaded.emit()}},this.iframeElement)}})),n(l,{key:"bec41e86a063eacb8f1f741b446c64db540d9e4d",errorText:this.errorText,name:this.inputId})))}get el(){return o(this)}};export{b as hidden_input,z as iframe_input}
1
+ import{r as e,h as n,H as t,c as i,g as o}from"./p-CV0Pyo1O.js";import{c as r}from"./p-D8GTwl9v.js";import{a3 as s,q as a,v as c,w as d,x as u}from"./p-CPKMvyV_.js";import{g as f}from"./p-BFTU3MAI.js";import{F as l}from"./p-Ce_W43gc.js";import{p as h}from"./p-Bx2_PW91.js";const m=r({focused:{boxShadow:"",border:""},focusedAndInvalid:{boxShadow:"",border:""},fontStyles:{fontFamily:"",fontSize:"",fontWeight:"",lineHeight:"",margin:"",padding:""}}),{state:w,set:g}=m,b=class{constructor(n){e(this,n),this.isFocused=!1,this.errorText=""}focusWithoutPageScroll(e){if(e)try{e.focus({preventScroll:!0})}catch(n){const{scrollX:t,scrollY:i}=window;e.focus(),window.scrollTo(t,i)}}async componentDidLoad(){const e=await this.getBaseFontStyles();g("fontStyles",e);const n=await this.getFocusedStyles();g("focused",n);const t=await this.getFocusedAndInvalidStyles();g("focusedAndInvalid",t)}async getBaseFontStyles(){return new Promise((e=>{setTimeout((()=>{const n=getComputedStyle(this.hiddenInput);e({fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,margin:n.margin,padding:n.padding,color:n.color})}),500)}))}async getFocusedStyles(){return new Promise((e=>{this.focusWithoutPageScroll(this.hiddenInput),setTimeout((()=>{this.hiddenInput.blur();const n=getComputedStyle(this.hiddenInput);e({boxShadow:n.boxShadow,border:n.border})}),500)}))}async getFocusedAndInvalidStyles(){return new Promise((e=>{this.focusWithoutPageScroll(this.hiddenInput),this.errorText="Error",setTimeout((()=>{const n=getComputedStyle(this.hiddenInput),t={boxShadow:n.boxShadow,border:n.border};this.hiddenInput.blur(),e(t)}),500)}))}get part(){return this.isFocused&&this.errorText?s:this.errorText?a:this.isFocused?c:d}render(){return n(t,{key:"c3b2f0cb5160d888b3ecbaca95285749c0b71002"},n("input",{key:"f6d0ad00733d086dfa09b646f7599d60f91e5f50",ref:e=>this.hiddenInput=e,type:"text",class:this.errorText?"form-control is-invalid":"form-control",onFocus:()=>this.isFocused=!0,onBlur:()=>this.isFocused=!1,part:this.part,tabindex:"-1",style:{height:"0",opacity:"0",pointerEvents:"none",animation:"none"}}))}};var p,y,v={exports:{}},k=f((p||(p=1,y=v,console.info("\nIFRAME-RESIZER\n\nIframe-Resizer 5 is now available via the following two packages:\n\n * @iframe-resizer/parent\n * @iframe-resizer/child\n\nAdditionally their are also new versions of iframe-resizer for React, Vue, and jQuery.\n\nVersion 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n"),function(e){if("undefined"!=typeof window){var n,t,i=0,o=!1,r=!1,s="[iFrameSizer]",a=null,c=window.requestAnimationFrame,d=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),u={},f=null,l=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){k("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),h={};window.jQuery!==e&&((t=window.jQuery).fn?t.fn.iFrameResize||(t.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){W(t,e)})).end()}):v("","Unable to bind to jQuery, it is not fully loaded.")),y.exports=L(),window.iFrameResize=window.iFrameResize||L()}function m(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(e,n,t){e.addEventListener(n,t,!1)}function g(e,n,t){e.removeEventListener(n,t,!1)}function b(e){return u[e]?u[e].log:o}function p(e,n){x("log",e,n,b(e))}function v(e,n){x("info",e,n,b(e))}function k(e,n){x("warn",e,n,!0)}function x(e,n,t,i){!0===i&&"object"==typeof window.console&&console[e](function(e){return s+"["+function(e){var n="Host page: "+e;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),n}(e)+"]"}(n),t)}function I(e){function n(){t("Height"),t("Width"),C((function(){R(P),T(A),l("onResized",P)}),P,"init")}function t(e){var n=Number(u[A]["max"+e]),t=Number(u[A]["min"+e]),i=e.toLowerCase(),o=Number(P[i]);p(A,"Checking "+i+" is in range "+t+"-"+n),o<t&&(o=t,p(A,"Set "+i+" to min value")),o>n&&(o=n,p(A,"Set "+i+" to max value")),P[i]=""+o}function i(e){return W.slice(W.indexOf(":")+7+e)}function o(e,n){var t,i;t=function(){var t,i;E("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),i=P.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:i.height,iframeWidth:i.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(i.top-t.top,10),offsetLeft:parseInt(i.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},h[i=n]||(h[i]=setTimeout((function(){h[i]=null,t()}),32))}function r(e){var n=e.getBoundingClientRect();return M(A),{x:Math.floor(Number(n.left)+Number(a.x)),y:Math.floor(Number(n.top)+Number(a.y))}}function c(e){var n=e?r(P.iframe):{x:0,y:0},t={x:Number(P.width)+n.x,y:Number(P.height)+n.y};p(A,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(a=t,d(),p(A,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):k(A,"Unable to scroll to requested position, window.parentIFrame not found")}function d(){!1===l("onScroll",a)?j():T(A)}function f(e){var n={};if(0===Number(P.width)&&0===Number(P.height)){var t=i(9).split(":");n={x:t[1],y:t[0]}}else n={x:P.width,y:P.height};l(e,{iframe:P.iframe,screenX:Number(n.x),screenY:Number(n.y),type:P.type})}function l(e,n){return S(A,e,n)}var m,b,y,x,I,z,W=e.data,P={},A=null;"[iFrameResizerChild]Ready"===W?function(){for(var e in u)E("iFrame requested init",N(e),u[e].iframe,e)}():s===(""+W).slice(0,13)&&W.slice(13).split(":")[0]in u?(x=(y=W.slice(13).split(":"))[1]?parseInt(y[1],10):0,I=u[y[0]]&&u[y[0]].iframe,z=getComputedStyle(I),P={iframe:I,id:y[0],height:x+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}(z)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(z),width:y[2],type:y[3]},u[A=P.id]&&(u[A].loaded=!0),(b=P.type in{true:1,false:1,undefined:1})&&p(A,"Ignoring init message from meta parent page"),!b&&function(e){var n=!0;return u[e]||(n=!1,k(P.type+" No settings for "+e+". Message was: "+W)),n}(A)&&(p(A,"Received: "+W),m=!0,null===P.iframe&&(k(A,"IFrame ("+P.id+") not found"),m=!1),m&&function(){var n,t=e.origin,i=u[A]&&u[A].checkOrigin;if(i&&""+t!="null"&&!(i.constructor===Array?function(){var e=0,n=!1;for(p(A,"Checking connection is from allowed list of origins: "+i);e<i.length;e++)if(i[e]===t){n=!0;break}return n}():(p(A,"Checking connection is from: "+(n=u[A]&&u[A].remoteHost)),t===n)))throw new Error("Unexpected message received from: "+t+" for "+P.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(u[A]&&u[A].firstRun&&u[A]&&(u[A].firstRun=!1),P.type){case"close":F(P.iframe);break;case"message":m=i(6),p(A,"onMessage passed: {iframe: "+P.iframe.id+", message: "+m+"}"),l("onMessage",{iframe:P.iframe,message:JSON.parse(m)}),p(A,"--");break;case"mouseenter":f("onMouseEnter");break;case"mouseleave":f("onMouseLeave");break;case"autoResize":u[A].autoResize=JSON.parse(i(9));break;case"scrollTo":c(!1);break;case"scrollToOffset":c(!0);break;case"pageInfo":o(u[A]&&u[A].iframe,A),function(){function e(e,i){function r(){u[t]?o(u[t].iframe,t):n()}["scroll","resize"].forEach((function(n){p(t,e+n+" listener for sendPageInfo"),i(window,n,r)}))}function n(){e("Remove ",g)}var t=A;e("Add ",w),u[t]&&(u[t].stopPageInfo=n)}();break;case"pageInfoStop":u[A]&&u[A].stopPageInfo&&(u[A].stopPageInfo(),delete u[A].stopPageInfo);break;case"inPageLink":t=i(9).split("#")[1]||"",s=decodeURIComponent(t),(h=document.getElementById(s)||document.getElementsByName(s)[0])?(e=r(h),p(A,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),a={x:e.x,y:e.y},d(),p(A,"--")):window.top===window.self?p(A,"In page link #"+t+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(t):p(A,"In page link #"+t+" not found and window.parentIFrame not found");break;case"reset":O(P);break;case"init":n(),l("onInit",P.iframe);break;default:0===Number(P.width)&&0===Number(P.height)?k("Unsupported message received ("+P.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}var e,t,s,h,m}())):v(A,"Ignored: "+W)}function S(e,n,t){var i=null,o=null;if(u[e]){if("function"!=typeof(i=u[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=i(t)}return o}function z(e){delete u[e.id]}function F(e){var t=e.id;if(!1!==S(t,"onClose",t)){p(t,"Removing iFrame: "+t);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){k(e)}S(t,"onClosed",t),p(t,"--"),z(e),n&&(n.disconnect(),n=null)}else p(t,"Close iframe cancelled by onClose event")}function M(n){null===a&&p(n,"Get page position: "+(a={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+a.y)}function T(e){null!==a&&(window.scrollTo(a.x,a.y),p(e,"Set page position: "+a.x+","+a.y),j())}function j(){a=null}function O(e){p(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),M(e.id),C((function(){R(e),E("reset","reset",e.iframe,e.id)}),e,"reset")}function R(e){function n(n){r||"0"!==e[n]||(r=!0,p(i,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(u).forEach((function(e){!function(e){function n(n){return"0px"===(u[e]&&u[e].iframe.style[n])}u[e]&&null!==u[e].iframe.offsetParent&&(n("height")||n("width"))&&E("Visibility change","resize",u[e].iframe,e)}(e)}))}function n(n){p("window","Mutation observed: "+n[0].target+" "+n[0].type),P(e,16)}var t,i=m();i&&(t=document.querySelector("body"),new i(n).observe(t,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}())}function t(t){!function(n){e.id?(e.iframe.style[n]=e[n]+"px",p(e.id,"IFrame ("+i+") "+n+" set to "+e[n]+"px")):p("undefined","messageData id not set")}(t),n(t)}var i=e.iframe.id;u[i]&&(u[i].sizeHeight&&t("height"),u[i].sizeWidth&&t("width"))}function C(e,n,t){t!==n.type&&c&&!window.jasmine?(p(n.id,"Requesting animation frame"),c(e)):e()}function E(e,n,t,i,o){var r,a=!1;u[i=i||t.id]&&(t&&"contentWindow"in t&&null!==t.contentWindow?(p(i,"["+e+"] Sending msg to iframe["+i+"] ("+n+") targetOrigin: "+(r=u[i]&&u[i].targetOrigin)),t.contentWindow.postMessage(s+n,r)):k(i,"["+e+"] IFrame("+i+") not found"),o&&u[i]&&u[i].warningTimeout&&(u[i].msgTimeout=setTimeout((function(){!u[i]||u[i].loaded||a||(a=!0,k(i,"IFrame has not responded within "+u[i].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),u[i].warningTimeout)))}function N(e){return e+":"+u[e].bodyMarginV1+":"+u[e].sizeWidth+":"+u[e].log+":"+u[e].interval+":"+u[e].enablePublicMethods+":"+u[e].autoResize+":"+u[e].bodyMargin+":"+u[e].heightCalculationMethod+":"+u[e].bodyBackground+":"+u[e].bodyPadding+":"+u[e].tolerance+":"+u[e].inPageLinks+":"+u[e].resizeFrom+":"+u[e].widthCalculationMethod+":"+u[e].mouseEvents}function W(t,r){function s(e){var n=e.split("Callback");if(2===n.length){var t="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[t]=this[e],delete this[e],k(f,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}var a,c,f=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var n;return""===e&&(t.id=(n=r&&r.id||l.id+i++,null!==document.getElementById(n)&&(n+=i++),e=n),o=(r||{}).log,p(e,"Added missing iframe ID: "+e+" ("+t.src+")")),e}(t.id);f in u&&"iFrameResizer"in t?k(f,"Ignored iFrame, already setup."):(function(e){var n;e=e||{},u[f]=Object.create(null),u[f].iframe=t,u[f].firstRun=!0,u[f].remoteHost=t.src&&t.src.split("/").slice(0,3).join("/"),function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(s,e),function(e){for(var n in l)Object.prototype.hasOwnProperty.call(l,n)&&(u[f][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:l[n])}(e),u[f]&&(u[f].targetOrigin=!0===u[f].checkOrigin?""===(n=u[f].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*")}(r),function(){switch(p(f,"IFrame scrolling "+(u[f]&&u[f].scrolling?"enabled":"disabled")+" for "+f),t.style.overflow=!1===(u[f]&&u[f].scrolling)?"hidden":"auto",u[f]&&u[f].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=u[f]?u[f].scrolling:"no"}}(),function(){function e(e){var n=u[f][e];1/0!==n&&0!==n&&(t.style[e]="number"==typeof n?n+"px":n,p(f,"Set "+e+" = "+t.style[e]))}function n(e){if(u[f]["min"+e]>u[f]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}n("Height"),n("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!=typeof(u[f]&&u[f].bodyMargin)&&"0"!==(u[f]&&u[f].bodyMargin)||(u[f].bodyMarginV1=u[f].bodyMargin,u[f].bodyMargin=u[f].bodyMargin+"px"),a=N(f),(c=m())&&(n=function(e){if(!t.parentNode)return null;var n=new e((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===t&&F(t)}))}))}));return n.observe(t.parentNode,{childList:!0}),n}(c)),w(t,"load",(function(){E("iFrame.onload",a,t,e,!0),(!u[f]||!u[f].firstRun)&&u[f]&&u[f].heightCalculationMethod in d&&O({iframe:t,height:0,width:0,type:"init"})})),E("init",a,t,e,!0),u[f]&&(u[f].iframe.iFrameResizer={close:F.bind(null,u[f].iframe),removeListeners:z.bind(null,u[f].iframe),resize:E.bind(null,"Window resize","resize",u[f].iframe),moveToAnchor:function(e){E("Move to anchor","moveToAnchor:"+e,u[f].iframe,f)},sendMessage:function(e){E("Send Message","message:"+(e=JSON.stringify(e)),u[f].iframe,f)}}))}function P(e,n){null===f&&(f=setTimeout((function(){f=null,e()}),n))}function A(){"hidden"!==document.visibilityState&&(p("document","Trigger event: Visibility change"),P((function(){H("Tab Visible","resize")}),16))}function H(e,n){Object.keys(u).forEach((function(t){(function(e){return u[e]&&"parent"===u[e].resizeFrom&&u[e].autoResize&&!u[e].firstRun})(t)&&E(e,n,u[t].iframe,t)}))}function L(){function n(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),W(n,e),t.push(n))}var t;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!c;e+=1)c=window[n[e]+"RequestAnimationFrame"];c?c=c.bind(window):p("setup","RequestAnimationFrame not supported")}(),w(window,"message",I),w(window,"resize",(function(){p("window","Trigger event: resize"),P((function(){H("Window resize","resize")}),16)})),w(document,"visibilitychange",A),w(document,"-webkit-visibilitychange",A),function(i,o){switch(t=[],function(e){e&&e.enablePublicMethods&&k("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(i),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,i));break;case"object":n(i,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return t}}}()),v.exports));class x{constructor(e,n){this.iframe=e,this.iframeOrigin=n}postMessage(e,n){const t=Object.assign({eventType:e},n);this.iframe.contentWindow.postMessage(t,this.iframeOrigin)}addMessageListener(e){window.addEventListener("message",e)}removeMessageListener(e){window.removeEventListener("message",e)}postMessageWithResponseListener(e,n){return new Promise((t=>{const i=n=>{n.data.eventType===e&&(window.removeEventListener("message",i),t(n.data.data))};window.addEventListener("message",i),this.postMessage(e,n)}))}}const I=class{constructor(n){e(this,n),this.iframeLoaded=i(this,"iframeLoaded",7),this.isFocused=!1,this.isValid=!0,this.dispatchMessageEvent=e=>{const{eventType:n,data:t}=e.data;(null==t?void 0:t.id)===this.inputId&&("focused"===n&&(this.isFocused=!0),"blurred"===n&&(this.isFocused=!1))}}disconnectedCallback(){this.frameService.removeMessageListener(this.dispatchMessageEvent)}async validate(){const e=await this.frameService.postMessageWithResponseListener("validate");return this.isValid=e.isValid,this.errorText=e.error.message,e}async tokenize(e,n,t){return this.frameService.postMessageWithResponseListener("tokenize",{clientId:e,paymentMethodMetadata:n,account:t,componentVersion:h.version})}initializeFrameCommunicationService(){var e;this.frameService=new x(this.iframeElement,this.iframeOrigin),null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent)}get part(){return this.isFocused&&!this.isValid?s:this.isValid?this.isFocused?c:d:a}get style(){return this.isFocused?this.isValid?w.focused:w.focusedAndInvalid:null}get urlParams(){const e=Object.fromEntries(Object.entries(w.fontStyles).map((([e,n])=>[e,btoa(String(n))])));return new URLSearchParams(e).toString()}render(){return n(t,{key:"60e76f1a33ddd4ea5b89cd31a1b6906ff53c5ddb",class:"form-group d-flex flex-column"},n("div",{key:"5fdef33ae8deb616929478d06fddc01b97233f0a",style:{visibility:this.iframeLoaded?"visible":"hidden",height:this.iframeLoaded?"auto":"0"}},n("label",{key:"e37adecf5024d4c77561d3ca269f49c398fc8fd7",class:"form-label",htmlFor:"",part:u},this.label||""),n("div",{key:"206a703cd84d713155aa754576410f495b4329fe",class:"p-0 d-flex form-control "+(this.isValid?"":"is-invalid"),part:this.part,style:Object.assign(Object.assign({},this.style),{overflow:"hidden"})},n("iframe",{key:"214ecd5b4fa9d075b91ea73b9edd09fdfa0cdf12",id:this.inputId,name:this.inputId,src:`${this.iframeOrigin}?${this.urlParams}`,ref:e=>{this.iframeElement=e,this.initializeFrameCommunicationService()},width:"100%",onLoad:()=>{k({log:!1,onResized:()=>{this.iframeLoaded.emit()}},this.iframeElement)}})),n(l,{key:"bec41e86a063eacb8f1f741b446c64db540d9e4d",errorText:this.errorText,name:this.inputId})))}get el(){return o(this)}};export{b as hidden_input,I as iframe_input}
@@ -1 +1 @@
1
- import{h as t,r as i}from"./p-CV0Pyo1O.js";import{S as s}from"./p-uZ5KAseb.js";import{w as e,c as a}from"./p-DVJaoI_m.js";import{e as r}from"./p-BSs-2JKu.js";import{c as o}from"./p-C_SQBHCI.js";import{c as n}from"./p-DyPk4BJt.js";import"./p-CPKMvyV_.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-BtzgeLyZ.js";import"./p-DkoufM1t.js";const c=i=>{const{isReady:e}=i;return e?null:t("div",{class:"container-fluid p-0"},t("div",{class:"row mb-3"},t("div",{class:"col-12 align-content-end"},t(s,{height:"18px",width:"120px"}),t(s,{height:"36px"}))),t("div",{class:"row"},t("div",{class:"col-12 align-content-end"},t(s,{height:"18px",width:"110px"}),t(s,{height:"36px"}))))},h=class{constructor(t){i(this,t),this.isReady=!1,this.hasLoggedAchDisabledWarning=!1}async componentWillLoad(){await e(),this.iframeOrigin=a.iframeOrigin,this.tabId=r(),o()}componentDidRender(){if(this.isAchDisabledForCheckout())return;const t=[this.accountNumberIframeElement,this.routingNumberIframeElement];t.every(Boolean)&&Promise.all(t.map((t=>new Promise((i=>{t.addEventListener("iframeLoaded",(()=>{i()}))}))))).then((()=>{this.isReady=!0}))}isAchDisabledForCheckout(){return n.checkoutLoaded&&!n.achPaymentsEnabled}async validate(){if(this.isAchDisabledForCheckout())return!1;const t=await this.accountNumberIframeElement.validate(),i=await this.routingNumberIframeElement.validate();return t&&i}async tokenize({clientId:t,paymentMethodMetadata:i,account:s}){return this.isAchDisabledForCheckout()?{error:{message:"ACH payments are disabled for this checkout (payment_settings.ach_payments=false)."}}:await this.accountNumberIframeElement.tokenize(t,i,s)}render(){return this.isAchDisabledForCheckout()?(this.hasLoggedAchDisabledWarning||(console.warn("[bank-account-form] ACH payments are disabled for this checkout (payment_settings.ach_payments=false)."),this.hasLoggedAchDisabledWarning=!0),null):t("div",null,t(c,{isReady:this.isReady}),t("hidden-input",null),t("div",{class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},t("div",{class:"row mb-3"},t("iframe-input",{inputId:"accountNumber",ref:t=>this.accountNumberIframeElement=t,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber?tabId=${this.tabId}`})),t("div",{class:"row"},t("iframe-input",{inputId:"routingNumber",ref:t=>this.routingNumberIframeElement=t,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber?tabId=${this.tabId}`}))))}};export{h as bank_account_form}
1
+ import{h as t,r as i}from"./p-CV0Pyo1O.js";import{S as s}from"./p-uZ5KAseb.js";import{w as e,c as a}from"./p-DVJaoI_m.js";import{e as r}from"./p-BSs-2JKu.js";import{c as o}from"./p-CqOzVXGL.js";import{c as n}from"./p-DyPk4BJt.js";import"./p-CPKMvyV_.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-Bx2_PW91.js";import"./p-DkoufM1t.js";const c=i=>{const{isReady:e}=i;return e?null:t("div",{class:"container-fluid p-0"},t("div",{class:"row mb-3"},t("div",{class:"col-12 align-content-end"},t(s,{height:"18px",width:"120px"}),t(s,{height:"36px"}))),t("div",{class:"row"},t("div",{class:"col-12 align-content-end"},t(s,{height:"18px",width:"110px"}),t(s,{height:"36px"}))))},h=class{constructor(t){i(this,t),this.isReady=!1,this.hasLoggedAchDisabledWarning=!1}async componentWillLoad(){await e(),this.iframeOrigin=a.iframeOrigin,this.tabId=r(),o()}componentDidRender(){if(this.isAchDisabledForCheckout())return;const t=[this.accountNumberIframeElement,this.routingNumberIframeElement];t.every(Boolean)&&Promise.all(t.map((t=>new Promise((i=>{t.addEventListener("iframeLoaded",(()=>{i()}))}))))).then((()=>{this.isReady=!0}))}isAchDisabledForCheckout(){return n.checkoutLoaded&&!n.achPaymentsEnabled}async validate(){if(this.isAchDisabledForCheckout())return!1;const t=await this.accountNumberIframeElement.validate(),i=await this.routingNumberIframeElement.validate();return t&&i}async tokenize({clientId:t,paymentMethodMetadata:i,account:s}){return this.isAchDisabledForCheckout()?{error:{message:"ACH payments are disabled for this checkout (payment_settings.ach_payments=false)."}}:await this.accountNumberIframeElement.tokenize(t,i,s)}render(){return this.isAchDisabledForCheckout()?(this.hasLoggedAchDisabledWarning||(console.warn("[bank-account-form] ACH payments are disabled for this checkout (payment_settings.ach_payments=false)."),this.hasLoggedAchDisabledWarning=!0),null):t("div",null,t(c,{isReady:this.isReady}),t("hidden-input",null),t("div",{class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},t("div",{class:"row mb-3"},t("iframe-input",{inputId:"accountNumber",ref:t=>this.accountNumberIframeElement=t,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber?tabId=${this.tabId}`})),t("div",{class:"row"},t("iframe-input",{inputId:"routingNumber",ref:t=>this.routingNumberIframeElement=t,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber?tabId=${this.tabId}`}))))}};export{h as bank_account_form}
@@ -1 +1 @@
1
- import{r as e,c as t,h as i}from"./p-CV0Pyo1O.js";import{J as s}from"./p-DYL3RR2S.js";import{c as a}from"./p-C_SQBHCI.js";import{c}from"./p-DyPk4BJt.js";import{c as d}from"./p-CPKMvyV_.js";import{S as o}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{P as b}from"./p-DkoufM1t.js";import"./p-BtzgeLyZ.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const h=class{constructor(i){e(this,i),this.errorEvent=t(this,"error-event",7),this.loadedEvent=t(this,"loaded",7),this.submitEvent=t(this,"submit-event",7),this.availablePaymentMethods=[],this.errorMessage="",this.insuranceToggled=!1,this.disableBankAccount=!1,this.disableBnpl=!1,this.disableCreditCard=!1,this.disablePaymentMethodGroup=!1,this.hideBankAccountBillingForm=!1,this.hideCardBillingForm=!1}propChanged(){this.updateStore()}connectedCallback(){this.authToken&&this.checkoutId&&this.updateStore()}componentWillLoad(){a(),this.analytics=new s(this)}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}checkoutComplete(e){c.isSubmitting=!1}checkoutError(e){c.isSubmitting=!1}checkoutChanged(e){this.availablePaymentMethods=this.disableBnpl?e.detail.availablePaymentMethodTypes.filter((e=>e!==b.SEZZLE)):e.detail.availablePaymentMethodTypes}async fillBillingForm(e){c.billingFormFields=e}async validate(){var e;return{isValid:await(null===(e=this.modularCheckoutRef)||void 0===e?void 0:e.validate())}}updateStore(){c.checkoutId=this.checkoutId,c.authToken=this.authToken,c.disableCreditCard=this.disableCreditCard,c.disableBankAccount=this.disableBankAccount,c.disablePaymentMethodGroup=this.disablePaymentMethodGroup}async submit(e){var t;null===(t=this.modularCheckoutRef)||void 0===t||t.submitCheckout(c.billingFormFields)}get showPaymentTypeHeader(){return!this.disableCreditCard&&!this.disableBankAccount}render(){var e,t;return i(o,{key:"bc8428227b2fc0e0753c4ef4e2370cd34bd34e82"},i("justifi-modular-checkout",{key:"9fda18728d6fb5b20716070cefc2fcf8ef097459",ref:e=>{this.modularCheckoutRef=e},authToken:this.authToken,checkoutId:this.checkoutId,preCompleteHook:this.preCompleteHook},i("div",{key:"e39f9871696d44cea2080198c7b91d03b706f2fd",class:"row gy-3 jfi-checkout-core"},i("div",{key:"df6045e9394b10f9b3e4b86e1a2242db30cc9b7b",class:"col-12",part:d},i("justifi-header",{key:"8f4332bd43371106faf4e264fd5b27c97cb589aa",text:"Summary",level:"h2",class:"fs-5 fw-bold pb-3"}),i("section",{key:"a7170276f18b9fa4b085c4d5de35979d55935929"},i("justifi-checkout-summary",{key:"109aceb53ad2500e927230b3f82bbb07ab3f604c"}))),i("div",{key:"902e040bbd591408c9d292a592ca4d31fc838d85",class:"col-12 mt-4"},i("slot",{key:"2677cb4952d88a8ce8f0198b96ed2638d4f4e6eb",name:"insurance"})),i("div",{key:"32c033bba12a7b7bf26159bd1878d6fa4ed913d9",class:"col-12 mt-4"},i("justifi-header",{key:"74543b63c1b94a5200ad36236818fce7345d5d76",text:"Payment",level:"h2",class:"fs-5 fw-bold pb-3"}),this.showPaymentTypeHeader&&i("justifi-header",{key:"8e7c56c75bb779211b72c0b8561df8283b731ca1",text:"Select payment type",level:"h3",class:"fs-6 fw-bold lh-lg"}),i("div",{key:"c2b0a875169b46dcd7d73428e3f1a4825b380ce5",class:"d-flex flex-column"},i("section",{key:"c5f007674c058e88d271c17f0b6b9c959bd0e044"},i("div",{key:"2c4ecdd0f8708f9f80bae50362ba7fab295f788f"},this.availablePaymentMethods.includes(b.APPLE_PAY)&&i("div",{key:"5ac363a3b7c38cb3f10e9c2c7916825f0f5dc2d8",class:"mb-3"},i("justifi-apple-pay",{key:"498c03630e4057b54ebd12a3cd87b6b6bdb00c4b"})),this.availablePaymentMethods.includes(b.GOOGLE_PAY)&&i("div",{key:"8c8114d142927739a3217d3a0a44c34c89e58f83",class:"mb-3"},i("justifi-google-pay",Object.assign({key:"a2fbc5b99a83fbc52698422d2f57a3380f97733f",ref:e=>this.googlePayRef=e},null!=this.googlePayEnv?{environment:this.googlePayEnv}:{}))),i("justifi-saved-payment-methods",{key:"2e5b27eea7ef433e950feadae0b0a07f8b613533"}),this.availablePaymentMethods.includes(b.SEZZLE)&&i("justifi-radio-list-item",{key:"fb1501c51eaf836579547bc50c295ebb67cb09c1",name:"paymentMethodType",value:b.SEZZLE,checked:(null===(e=null==c?void 0:c.selectedPaymentMethod)||void 0===e?void 0:e.type)===b.SEZZLE,label:i("justifi-sezzle-payment-method",{ref:e=>this.sezzlePaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.sezzlePaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),this.availablePaymentMethods.includes(b.PLAID)&&!this.disableBnpl&&i("justifi-radio-list-item",{key:"49e0687b4955fb92935783250540fe38350bbdcc",name:"paymentMethodType",value:b.PLAID,checked:(null===(t=null==c?void 0:c.selectedPaymentMethod)||void 0===t?void 0:t.type)===b.PLAID,label:i("justifi-plaid-payment-method",{ref:e=>this.plaidPaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.plaidPaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),i("justifi-tokenize-payment-method",{key:"ba793274de073c8a60c063e9caedcf32780b4bbf",ref:e=>this.tokenizePaymentMethodRef=e,authToken:this.authToken,accountId:c.accountId,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,hideSubmitButton:!0,paymentMethodGroupId:c.paymentMethodGroupId}))))),i("div",{key:"ed7be422c4e369382fd42e0b0162357df7de2031",class:"mt-4"},i("justifi-button",{key:"849d648feec5ce805d6eb87acacf94d62e7a8f1b",text:"Pay",type:"submit",variant:"primary",clickHandler:e=>this.submit(e),disabled:c.isSubmitting||c.isWalletProcessing,isLoading:c.isSubmitting||c.isWalletProcessing,customStyle:{width:"100%",textAlign:"center"}})))))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"],disableCreditCard:["propChanged"],disableBankAccount:["propChanged"],disablePaymentMethodGroup:["propChanged"]}}};export{h as justifi_checkout}
1
+ import{r as e,c as t,h as i}from"./p-CV0Pyo1O.js";import{J as s}from"./p-CfIGO7TJ.js";import{c as a}from"./p-CqOzVXGL.js";import{c}from"./p-DyPk4BJt.js";import{c as d}from"./p-CPKMvyV_.js";import{S as o}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{P as b}from"./p-DkoufM1t.js";import"./p-Bx2_PW91.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const h=class{constructor(i){e(this,i),this.errorEvent=t(this,"error-event",7),this.loadedEvent=t(this,"loaded",7),this.submitEvent=t(this,"submit-event",7),this.availablePaymentMethods=[],this.errorMessage="",this.insuranceToggled=!1,this.disableBankAccount=!1,this.disableBnpl=!1,this.disableCreditCard=!1,this.disablePaymentMethodGroup=!1,this.hideBankAccountBillingForm=!1,this.hideCardBillingForm=!1}propChanged(){this.updateStore()}connectedCallback(){this.authToken&&this.checkoutId&&this.updateStore()}componentWillLoad(){a(),this.analytics=new s(this)}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}checkoutComplete(e){c.isSubmitting=!1}checkoutError(e){c.isSubmitting=!1}checkoutChanged(e){this.availablePaymentMethods=this.disableBnpl?e.detail.availablePaymentMethodTypes.filter((e=>e!==b.SEZZLE)):e.detail.availablePaymentMethodTypes}async fillBillingForm(e){c.billingFormFields=e}async validate(){var e;return{isValid:await(null===(e=this.modularCheckoutRef)||void 0===e?void 0:e.validate())}}updateStore(){c.checkoutId=this.checkoutId,c.authToken=this.authToken,c.disableCreditCard=this.disableCreditCard,c.disableBankAccount=this.disableBankAccount,c.disablePaymentMethodGroup=this.disablePaymentMethodGroup}async submit(e){var t;null===(t=this.modularCheckoutRef)||void 0===t||t.submitCheckout(c.billingFormFields)}get showPaymentTypeHeader(){return!this.disableCreditCard&&!this.disableBankAccount}render(){var e,t;return i(o,{key:"bc8428227b2fc0e0753c4ef4e2370cd34bd34e82"},i("justifi-modular-checkout",{key:"9fda18728d6fb5b20716070cefc2fcf8ef097459",ref:e=>{this.modularCheckoutRef=e},authToken:this.authToken,checkoutId:this.checkoutId,preCompleteHook:this.preCompleteHook},i("div",{key:"e39f9871696d44cea2080198c7b91d03b706f2fd",class:"row gy-3 jfi-checkout-core"},i("div",{key:"df6045e9394b10f9b3e4b86e1a2242db30cc9b7b",class:"col-12",part:d},i("justifi-header",{key:"8f4332bd43371106faf4e264fd5b27c97cb589aa",text:"Summary",level:"h2",class:"fs-5 fw-bold pb-3"}),i("section",{key:"a7170276f18b9fa4b085c4d5de35979d55935929"},i("justifi-checkout-summary",{key:"109aceb53ad2500e927230b3f82bbb07ab3f604c"}))),i("div",{key:"902e040bbd591408c9d292a592ca4d31fc838d85",class:"col-12 mt-4"},i("slot",{key:"2677cb4952d88a8ce8f0198b96ed2638d4f4e6eb",name:"insurance"})),i("div",{key:"32c033bba12a7b7bf26159bd1878d6fa4ed913d9",class:"col-12 mt-4"},i("justifi-header",{key:"74543b63c1b94a5200ad36236818fce7345d5d76",text:"Payment",level:"h2",class:"fs-5 fw-bold pb-3"}),this.showPaymentTypeHeader&&i("justifi-header",{key:"8e7c56c75bb779211b72c0b8561df8283b731ca1",text:"Select payment type",level:"h3",class:"fs-6 fw-bold lh-lg"}),i("div",{key:"c2b0a875169b46dcd7d73428e3f1a4825b380ce5",class:"d-flex flex-column"},i("section",{key:"c5f007674c058e88d271c17f0b6b9c959bd0e044"},i("div",{key:"2c4ecdd0f8708f9f80bae50362ba7fab295f788f"},this.availablePaymentMethods.includes(b.APPLE_PAY)&&i("div",{key:"5ac363a3b7c38cb3f10e9c2c7916825f0f5dc2d8",class:"mb-3"},i("justifi-apple-pay",{key:"498c03630e4057b54ebd12a3cd87b6b6bdb00c4b"})),this.availablePaymentMethods.includes(b.GOOGLE_PAY)&&i("div",{key:"8c8114d142927739a3217d3a0a44c34c89e58f83",class:"mb-3"},i("justifi-google-pay",Object.assign({key:"a2fbc5b99a83fbc52698422d2f57a3380f97733f",ref:e=>this.googlePayRef=e},null!=this.googlePayEnv?{environment:this.googlePayEnv}:{}))),i("justifi-saved-payment-methods",{key:"2e5b27eea7ef433e950feadae0b0a07f8b613533"}),this.availablePaymentMethods.includes(b.SEZZLE)&&i("justifi-radio-list-item",{key:"fb1501c51eaf836579547bc50c295ebb67cb09c1",name:"paymentMethodType",value:b.SEZZLE,checked:(null===(e=null==c?void 0:c.selectedPaymentMethod)||void 0===e?void 0:e.type)===b.SEZZLE,label:i("justifi-sezzle-payment-method",{ref:e=>this.sezzlePaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.sezzlePaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),this.availablePaymentMethods.includes(b.PLAID)&&!this.disableBnpl&&i("justifi-radio-list-item",{key:"49e0687b4955fb92935783250540fe38350bbdcc",name:"paymentMethodType",value:b.PLAID,checked:(null===(t=null==c?void 0:c.selectedPaymentMethod)||void 0===t?void 0:t.type)===b.PLAID,label:i("justifi-plaid-payment-method",{ref:e=>this.plaidPaymentMethodRef=e}),"onRadio-click":()=>{var e;null===(e=this.plaidPaymentMethodRef)||void 0===e||e.handleSelectionClick()}}),i("justifi-tokenize-payment-method",{key:"ba793274de073c8a60c063e9caedcf32780b4bbf",ref:e=>this.tokenizePaymentMethodRef=e,authToken:this.authToken,accountId:c.accountId,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,hideSubmitButton:!0,paymentMethodGroupId:c.paymentMethodGroupId}))))),i("div",{key:"ed7be422c4e369382fd42e0b0162357df7de2031",class:"mt-4"},i("justifi-button",{key:"849d648feec5ce805d6eb87acacf94d62e7a8f1b",text:"Pay",type:"submit",variant:"primary",clickHandler:e=>this.submit(e),disabled:c.isSubmitting||c.isWalletProcessing,isLoading:c.isSubmitting||c.isWalletProcessing,customStyle:{width:"100%",textAlign:"center"}})))))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"],disableCreditCard:["propChanged"],disableBankAccount:["propChanged"],disablePaymentMethodGroup:["propChanged"]}}};export{h as justifi_checkout}
@@ -1 +1 @@
1
- import{h as i,r as s,c as t}from"./p-CV0Pyo1O.js";import{a9 as e,a8 as r,a1 as o,t as l}from"./p-CPKMvyV_.js";import{S as d}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{c as a}from"./p-C_SQBHCI.js";import{J as n}from"./p-DYL3RR2S.js";import{o as h,C as c,p as v,f as u,b as p}from"./p-DXTa04jn.js";import{B as m}from"./p-R_0S69Pr.js";import{B as f}from"./p-BcNb9bVO.js";import{m as w}from"./p-CPJC6tlj.js";import{S as y}from"./p-uZ5KAseb.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import{g as b,a as g}from"./p-CdwzNfP1.js";import{T as x}from"./p-CxBrydeX.js";import{l as j}from"./p-BSs-2JKu.js";import"./p-BtzgeLyZ.js";import"./p-De4Pig-y.js";import"./p-D8GTwl9v.js";const S=()=>i("div",{class:"row gap-3"},i("div",{class:"col-12"},i(y,{width:"25%"})),i("div",{class:"col-12"},i(y,{width:"100%"})),i("div",{class:"col-12 d-flex gap-3"},i(y,{width:"50%"}),i(y,{width:"50%"})),i("div",{class:"col-12 d-flex gap-3"},i(y,{width:"65%"}),i(y,{width:"35%"}))),C=()=>i("div",{class:"row gap-5"},i("div",{class:"col-12"},i(y,{width:"40%",height:"40px"})),i(S,null)),k=()=>i("div",{class:"terminal-selector-skeleton mt-4 rounded shadow-sm"},i("div",{class:"d-flex align-items-center gap-3"},i(y,{width:"125px",height:"125px",styles:{borderRadius:"8px"}}),i("div",{class:"flex-grow-1"},i("div",{class:"d-flex row flex-row"},i("div",{class:"col-6 flex-column"},i(y,null),i(y,{width:"60%"})),i("div",{class:"d-flex justify-content-end align-items-center gap-2 col-6"},i(y,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}),i(y,{width:"80px",height:"32px"}),i(y,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}))),i("div",{class:"mt-4"},i("div",{class:"d-flex flex-column gap-2"},i(y,null),i(y,null)))))),T=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event",7),this.submitted=t(this,"submit-event",7),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 v({business_id:this.businessId,sub_account_id:this.accountId,order_type:this.shipping?u.boardingShipping:u.boardingOnly}),a(),this.analytics=new n(this),this.loadData()}disconnectedCallback(){var i;null===(i=this.analytics)||void 0===i||i.cleanup()}handleError(i,s,t){this.error={message:i,code:s,severity:t},this.errorEvent.emit({errorCode:s,message:i,severity:t})}loadData(){this.businessId&&this.authToken?(this.initializeGetBusiness(),this.initializeGetTerminalModels()):this.handleError("Invalid business id or auth token",p.MISSING_PROPS,c.ERROR)}initializeGetBusiness(){w({id:this.businessId,authToken:this.authToken,service:new m})({onSuccess:({business:i})=>{this.business=new f(i)},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t)},final:()=>{this.loading.business=!1}})}initializeGetTerminalModels(){(({id:i,authToken:s,service:t})=>async({onSuccess:e,onError:r})=>{var o,l,d,a;try{const n=await t.fetchTerminalModels(i,s);if(n.error)return r({error:g(n.error),code:b(null===(a=n.error)||void 0===a?void 0:a.code),severity:c.ERROR});e({terminals:(null===(l=null===(o=n.data)||void 0===o?void 0:o.terminal_order_models)||void 0===l?void 0:l.map((i=>new h(i))))||[],orderLimit:null===(d=n.data)||void 0===d?void 0:d.order_limit})}catch(i){const s=b(null==i?void 0:i.code);return r({error:i.message||i,code:s,severity:c.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new x})({onSuccess:({terminals:i,orderLimit:s})=>{this.terminalModels=i,this.orderLimit=s,this.loading.terminals=!1},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t),this.loading.terminals=!1}})}submitOrder(){const i=(({authToken:i,service:s,apiOrigin:t="https://wc-proxy.justifi.ai"})=>async({terminalOrder:e,onSuccess:r,onError:o})=>{var l;try{const d=await s.orderTerminals(i,e,t);if(d.error)return o({error:g(d.error),code:b(null===(l=d.error)||void 0===l?void 0:l.code),severity:c.ERROR});{const{data:i}=d;r({data:i})}}catch(i){const s=b(null==i?void 0:i.code);return o({error:i.message||i,code:s,severity:c.ERROR})}})({authToken:this.authToken,service:new x});this.submitting=!0,i({terminalOrder:this.order.payload,onSuccess:({data:i})=>{this.submitted.emit(i),this.submitting=!1},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t),this.submitting=!1}})}onSelectedQuantityChange(i){this.order.updateTerminal(i.detail.modelName,i.detail.quantity),this.totalQuantity=this.order.totalQuantity}renderLoading(){return i("div",null,this.loading.business&&i(C,null),this.loading.terminals&&i("div",{class:"mt-5"},i(k,null),i(k,null),i(k,null)))}renderBusinessDetails(){var s,t,o,l,d,a,n,h;if(!this.loading.business&&this.business)return i("div",{class:"d-flex flex-column gap-4 mb-5 pt-5"},i("div",{class:"row"},i("div",{class:"col-12"},i("h2",{part:r},this.business.legal_name))),i("div",{class:"row"},i("div",{class:"col-6"},i("h5",{part:e},"Representative:"),i("div",null,i("div",null,null===(t=null===(s=this.business)||void 0===s?void 0:s.representative)||void 0===t?void 0:t.name),i("div",null,null===(l=null===(o=this.business)||void 0===o?void 0:o.representative)||void 0===l?void 0:l.title),i("div",null,null===(a=null===(d=this.business)||void 0===d?void 0:d.representative)||void 0===a?void 0:a.email),i("div",null,j(null===(h=null===(n=this.business)||void 0===n?void 0:n.representative)||void 0===h?void 0:h.phone)))),i("div",{class:"col-6"},i("h5",{part:e},this.shipping?"Shipping Address:":"Business Address:"),i("div",null,this.business.legal_address.line1,this.business.legal_address.line2?`, ${this.business.legal_address.line2}`:"",i("br",null),this.business.legal_address.city,", ",this.business.legal_address.state," ",this.business.legal_address.postal_code))))}renderTerminals(){if(!this.loading.terminals&&this.terminalModels)return i("div",{class:"d-flex flex-column gap-2 mt-5"},this.terminalModels.map((s=>i("terminal-quantity-selector",{modelName:s.model_name,description:s.description,imageUrl:s.image_url,helpUrl:s.help_url,limit:this.orderLimit-this.order.totalQuantity,onSelectedQuantityChange:this.onSelectedQuantityChange.bind(this)}))))}renderOrderSection(){return i("div",{class:"mt-3"},i("div",{class:"text-end"},"Order limit: ",this.orderLimit),i("div",{class:"d-flex justify-content-end mt-3"},i("button",{class:"btn btn-primary submit-btn",onClick:this.submitOrder.bind(this),disabled:0===this.order.totalQuantity||this.submitting,part:o},this.submitting?"Submitting...":this.submitButtonText)))}render(){return i(d,{key:"1fd8c50ac4e22bb2aac46ed0379f4740737e9760"},i("div",{key:"caed839c05af25c7bcd6599c45cd5058491a1ba9",part:l},this.renderLoading(),this.renderBusinessDetails(),this.renderTerminals(),this.renderOrderSection()))}};export{T as justifi_order_terminals}
1
+ import{h as i,r as s,c as t}from"./p-CV0Pyo1O.js";import{a9 as e,a8 as r,a1 as o,t as l}from"./p-CPKMvyV_.js";import{S as d}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{c as a}from"./p-CqOzVXGL.js";import{J as n}from"./p-CfIGO7TJ.js";import{o as h,C as c,p as v,f as u,b as p}from"./p-DXTa04jn.js";import{B as m}from"./p-R_0S69Pr.js";import{B as f}from"./p-BcNb9bVO.js";import{m as w}from"./p-CPJC6tlj.js";import{S as y}from"./p-uZ5KAseb.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import{g as x,a as b}from"./p-CdwzNfP1.js";import{T as g}from"./p-CxBrydeX.js";import{l as j}from"./p-BSs-2JKu.js";import"./p-Bx2_PW91.js";import"./p-De4Pig-y.js";import"./p-D8GTwl9v.js";const C=()=>i("div",{class:"row gap-3"},i("div",{class:"col-12"},i(y,{width:"25%"})),i("div",{class:"col-12"},i(y,{width:"100%"})),i("div",{class:"col-12 d-flex gap-3"},i(y,{width:"50%"}),i(y,{width:"50%"})),i("div",{class:"col-12 d-flex gap-3"},i(y,{width:"65%"}),i(y,{width:"35%"}))),S=()=>i("div",{class:"row gap-5"},i("div",{class:"col-12"},i(y,{width:"40%",height:"40px"})),i(C,null)),T=()=>i("div",{class:"terminal-selector-skeleton mt-4 rounded shadow-sm"},i("div",{class:"d-flex align-items-center gap-3"},i(y,{width:"125px",height:"125px",styles:{borderRadius:"8px"}}),i("div",{class:"flex-grow-1"},i("div",{class:"d-flex row flex-row"},i("div",{class:"col-6 flex-column"},i(y,null),i(y,{width:"60%"})),i("div",{class:"d-flex justify-content-end align-items-center gap-2 col-6"},i(y,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}),i(y,{width:"80px",height:"32px"}),i(y,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}))),i("div",{class:"mt-4"},i("div",{class:"d-flex flex-column gap-2"},i(y,null),i(y,null)))))),k=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event",7),this.submitted=t(this,"submit-event",7),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 v({business_id:this.businessId,sub_account_id:this.accountId,order_type:this.shipping?u.boardingShipping:u.boardingOnly}),a(),this.analytics=new n(this),this.loadData()}disconnectedCallback(){var i;null===(i=this.analytics)||void 0===i||i.cleanup()}handleError(i,s,t){this.error={message:i,code:s,severity:t},this.errorEvent.emit({errorCode:s,message:i,severity:t})}loadData(){this.businessId&&this.authToken?(this.initializeGetBusiness(),this.initializeGetTerminalModels()):this.handleError("Invalid business id or auth token",p.MISSING_PROPS,c.ERROR)}initializeGetBusiness(){w({id:this.businessId,authToken:this.authToken,service:new m})({onSuccess:({business:i})=>{this.business=new f(i)},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t)},final:()=>{this.loading.business=!1}})}initializeGetTerminalModels(){(({id:i,authToken:s,service:t})=>async({onSuccess:e,onError:r})=>{var o,l,d,a;try{const n=await t.fetchTerminalModels(i,s);if(n.error)return r({error:b(n.error),code:x(null===(a=n.error)||void 0===a?void 0:a.code),severity:c.ERROR});e({terminals:(null===(l=null===(o=n.data)||void 0===o?void 0:o.terminal_order_models)||void 0===l?void 0:l.map((i=>new h(i))))||[],orderLimit:null===(d=n.data)||void 0===d?void 0:d.order_limit})}catch(i){const s=x(null==i?void 0:i.code);return r({error:i.message||i,code:s,severity:c.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new g})({onSuccess:({terminals:i,orderLimit:s})=>{this.terminalModels=i,this.orderLimit=s,this.loading.terminals=!1},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t),this.loading.terminals=!1}})}submitOrder(){const i=(({authToken:i,service:s,apiOrigin:t="https://wc-proxy.justifi.ai"})=>async({terminalOrder:e,onSuccess:r,onError:o})=>{var l;try{const d=await s.orderTerminals(i,e,t);if(d.error)return o({error:b(d.error),code:x(null===(l=d.error)||void 0===l?void 0:l.code),severity:c.ERROR});{const{data:i}=d;r({data:i})}}catch(i){const s=x(null==i?void 0:i.code);return o({error:i.message||i,code:s,severity:c.ERROR})}})({authToken:this.authToken,service:new g});this.submitting=!0,i({terminalOrder:this.order.payload,onSuccess:({data:i})=>{this.submitted.emit(i),this.submitting=!1},onError:({error:i,code:s,severity:t})=>{this.handleError(i,s,t),this.submitting=!1}})}onSelectedQuantityChange(i){this.order.updateTerminal(i.detail.modelName,i.detail.quantity),this.totalQuantity=this.order.totalQuantity}renderLoading(){return i("div",null,this.loading.business&&i(S,null),this.loading.terminals&&i("div",{class:"mt-5"},i(T,null),i(T,null),i(T,null)))}renderBusinessDetails(){var s,t,o,l,d,a,n,h;if(!this.loading.business&&this.business)return i("div",{class:"d-flex flex-column gap-4 mb-5 pt-5"},i("div",{class:"row"},i("div",{class:"col-12"},i("h2",{part:r},this.business.legal_name))),i("div",{class:"row"},i("div",{class:"col-6"},i("h5",{part:e},"Representative:"),i("div",null,i("div",null,null===(t=null===(s=this.business)||void 0===s?void 0:s.representative)||void 0===t?void 0:t.name),i("div",null,null===(l=null===(o=this.business)||void 0===o?void 0:o.representative)||void 0===l?void 0:l.title),i("div",null,null===(a=null===(d=this.business)||void 0===d?void 0:d.representative)||void 0===a?void 0:a.email),i("div",null,j(null===(h=null===(n=this.business)||void 0===n?void 0:n.representative)||void 0===h?void 0:h.phone)))),i("div",{class:"col-6"},i("h5",{part:e},this.shipping?"Shipping Address:":"Business Address:"),i("div",null,this.business.legal_address.line1,this.business.legal_address.line2?`, ${this.business.legal_address.line2}`:"",i("br",null),this.business.legal_address.city,", ",this.business.legal_address.state," ",this.business.legal_address.postal_code))))}renderTerminals(){if(!this.loading.terminals&&this.terminalModels)return i("div",{class:"d-flex flex-column gap-2 mt-5"},this.terminalModels.map((s=>i("terminal-quantity-selector",{modelName:s.model_name,description:s.description,imageUrl:s.image_url,helpUrl:s.help_url,limit:this.orderLimit-this.order.totalQuantity,onSelectedQuantityChange:this.onSelectedQuantityChange.bind(this)}))))}renderOrderSection(){return i("div",{class:"mt-3"},i("div",{class:"text-end"},"Order limit: ",this.orderLimit),i("div",{class:"d-flex justify-content-end mt-3"},i("button",{class:"btn btn-primary submit-btn",onClick:this.submitOrder.bind(this),disabled:0===this.order.totalQuantity||this.submitting,part:o},this.submitting?"Submitting...":this.submitButtonText)))}render(){return i(d,{key:"1fd8c50ac4e22bb2aac46ed0379f4740737e9760"},i("div",{key:"caed839c05af25c7bcd6599c45cd5058491a1ba9",part:l},this.renderLoading(),this.renderBusinessDetails(),this.renderTerminals(),this.renderOrderSection()))}};export{k as justifi_order_terminals}
@@ -1 +1 @@
1
- import{r as t,c as e,h as s}from"./p-CV0Pyo1O.js";import{m as i}from"./p-B62JX_Dh.js";import{C as h}from"./p-Cn7z5L7J.js";import{C as r,b as o,I as a,c as l,d as n}from"./p-DXTa04jn.js";import{J as c}from"./p-DYL3RR2S.js";import{c as d}from"./p-C_SQBHCI.js";import"./p-CdwzNfP1.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-BtzgeLyZ.js";const u=class{constructor(s){t(this,s),this.checkoutCompleted=e(this,"checkout-completed",7),this.checkoutExpired=e(this,"checkout-expired",7),this.errorEvent=e(this,"error-event",7),this.pollIntervalMs=3e3,this.pollTimeoutMs=6e5,this.terminalState="loading",this.paymentStatus="",this.errorMessage="",this.pollIntervalHandle=null,this.pollTimeoutHandle=null,this.failedDismissHandle=null,this.seenCompletionCreatedAts=new Set,this.inFlight=!1}componentWillLoad(){d(),this.analytics=new c(this),this.initialize()}disconnectedCallback(){var t;this.stopAll(),null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.stopAll(),this.initialize()}suppressInnerErrors(t){t.stopPropagation()}get effectivePollInterval(){return Math.max(1e3,this.pollIntervalMs)}initialize(){this.authToken&&this.checkoutId?(this.terminalState="loading",this.getCheckout=i({authToken:this.authToken,checkoutId:this.checkoutId,service:new h}),this.getCheckout({onSuccess:({checkout:t})=>this.handleInitialLoad(t),onError:({error:t,code:e,severity:s})=>{this.terminalState="error",this.errorMessage=t,this.errorEvent.emit({message:t,errorCode:e,severity:s})}})):this.errorEvent.emit({message:"authToken and checkoutId are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}handleInitialLoad(t){var e;switch(t.status){case a.expired:this.terminalState="expired",this.checkoutExpired.emit({checkoutId:this.checkoutId}),this.errorEvent.emit({message:l.CHECKOUT_EXPIRED,errorCode:o.CHECKOUT_EXPIRED,severity:r.ERROR});break;case a.completed:this.terminalState="completed",this.paymentStatus=this.resolvePaymentStatus(t),this.checkoutCompleted.emit({checkoutId:this.checkoutId,paymentStatus:this.paymentStatus});break;default:(null!==(e=t.completions)&&void 0!==e?e:[]).forEach((t=>this.seenCompletionCreatedAts.add(t.created_at))),this.terminalState="ready",this.startPolling()}}startPolling(){this.pollTimeoutHandle=setTimeout((()=>{this.stopAll(),this.terminalState="error",this.errorMessage="Checkout polling timed out",this.errorEvent.emit({message:"Checkout polling timed out",errorCode:o.FETCH_ERROR,severity:r.ERROR})}),this.pollTimeoutMs),this.pollIntervalHandle=setInterval((()=>this.tick()),this.effectivePollInterval)}tick(){this.inFlight||(this.inFlight=!0,this.getCheckout({onSuccess:({checkout:t})=>{this.inFlight=!1,this.handlePollResult(t)},onError:({error:t,code:e,severity:s})=>{this.inFlight=!1,this.stopAll(),this.terminalState="error",this.errorMessage=t,this.errorEvent.emit({message:t,errorCode:e,severity:s})}}))}handlePollResult(t){var e;const s=(null!==(e=t.completions)&&void 0!==e?e:[]).filter((t=>!this.seenCompletionCreatedAts.has(t.created_at)&&"failed"===t.payment_status));if(s.forEach((t=>this.seenCompletionCreatedAts.add(t.created_at))),s.length>0&&(this.terminalState="payment-failed",this.failedDismissHandle&&clearTimeout(this.failedDismissHandle),this.failedDismissHandle=setTimeout((()=>{"payment-failed"===this.terminalState&&(this.terminalState="ready")}),3e3)),t.status===a.completed)return this.stopAll(),this.terminalState="completed",this.paymentStatus=this.resolvePaymentStatus(t),void this.checkoutCompleted.emit({checkoutId:this.checkoutId,paymentStatus:this.paymentStatus});t.status===a.expired&&(this.stopAll(),this.terminalState="expired",this.checkoutExpired.emit({checkoutId:this.checkoutId}),this.errorEvent.emit({message:l.CHECKOUT_EXPIRED,errorCode:o.CHECKOUT_EXPIRED,severity:r.ERROR}))}resolvePaymentStatus(t){var e,s;const i=null===(s=[...null!==(e=t.completions)&&void 0!==e?e:[]].sort(((t,e)=>new Date(e.updated_at).getTime()-new Date(t.updated_at).getTime()))[0])||void 0===s?void 0:s.payment_status;return i===n.succeeded||null==i&&t.successful_payment_id?"succeeded":"pending"}stopAll(){this.pollIntervalHandle&&(clearInterval(this.pollIntervalHandle),this.pollIntervalHandle=null),this.pollTimeoutHandle&&(clearTimeout(this.pollTimeoutHandle),this.pollTimeoutHandle=null),this.failedDismissHandle&&(clearTimeout(this.failedDismissHandle),this.failedDismissHandle=null),this.inFlight=!1}render(){return this.authToken&&this.checkoutId?s("div",null,"loading"===this.terminalState&&null,("ready"===this.terminalState||"payment-failed"===this.terminalState)&&s("div",null,s("justifi-checkout-qr-code",{checkoutId:this.checkoutId}),"payment-failed"===this.terminalState&&s("p",null,"Payment failed. Please try again."),"ready"===this.terminalState&&s("p",null,"Scan to pay")),"completed"===this.terminalState&&s("div",null,s("p",null,"succeeded"===this.paymentStatus?"Payment received":"Payment pending")),"expired"===this.terminalState&&s("p",null,"Checkout expired. Please create a new checkout."),"error"===this.terminalState&&s("p",null,this.errorMessage)):null}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"]}}};export{u as justifi_qr_terminal}
1
+ import{r as t,c as e,h as s}from"./p-CV0Pyo1O.js";import{m as i}from"./p-B62JX_Dh.js";import{C as h}from"./p-Cn7z5L7J.js";import{C as r,b as o,I as a,c as l,d as n}from"./p-DXTa04jn.js";import{J as c}from"./p-CfIGO7TJ.js";import{c as d}from"./p-CqOzVXGL.js";import"./p-CdwzNfP1.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-Bx2_PW91.js";const u=class{constructor(s){t(this,s),this.checkoutCompleted=e(this,"checkout-completed",7),this.checkoutExpired=e(this,"checkout-expired",7),this.errorEvent=e(this,"error-event",7),this.pollIntervalMs=3e3,this.pollTimeoutMs=6e5,this.terminalState="loading",this.paymentStatus="",this.errorMessage="",this.pollIntervalHandle=null,this.pollTimeoutHandle=null,this.failedDismissHandle=null,this.seenCompletionCreatedAts=new Set,this.inFlight=!1}componentWillLoad(){d(),this.analytics=new c(this),this.initialize()}disconnectedCallback(){var t;this.stopAll(),null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.stopAll(),this.initialize()}suppressInnerErrors(t){t.stopPropagation()}get effectivePollInterval(){return Math.max(1e3,this.pollIntervalMs)}initialize(){this.authToken&&this.checkoutId?(this.terminalState="loading",this.getCheckout=i({authToken:this.authToken,checkoutId:this.checkoutId,service:new h}),this.getCheckout({onSuccess:({checkout:t})=>this.handleInitialLoad(t),onError:({error:t,code:e,severity:s})=>{this.terminalState="error",this.errorMessage=t,this.errorEvent.emit({message:t,errorCode:e,severity:s})}})):this.errorEvent.emit({message:"authToken and checkoutId are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}handleInitialLoad(t){var e;switch(t.status){case a.expired:this.terminalState="expired",this.checkoutExpired.emit({checkoutId:this.checkoutId}),this.errorEvent.emit({message:l.CHECKOUT_EXPIRED,errorCode:o.CHECKOUT_EXPIRED,severity:r.ERROR});break;case a.completed:this.terminalState="completed",this.paymentStatus=this.resolvePaymentStatus(t),this.checkoutCompleted.emit({checkoutId:this.checkoutId,paymentStatus:this.paymentStatus});break;default:(null!==(e=t.completions)&&void 0!==e?e:[]).forEach((t=>this.seenCompletionCreatedAts.add(t.created_at))),this.terminalState="ready",this.startPolling()}}startPolling(){this.pollTimeoutHandle=setTimeout((()=>{this.stopAll(),this.terminalState="error",this.errorMessage="Checkout polling timed out",this.errorEvent.emit({message:"Checkout polling timed out",errorCode:o.FETCH_ERROR,severity:r.ERROR})}),this.pollTimeoutMs),this.pollIntervalHandle=setInterval((()=>this.tick()),this.effectivePollInterval)}tick(){this.inFlight||(this.inFlight=!0,this.getCheckout({onSuccess:({checkout:t})=>{this.inFlight=!1,this.handlePollResult(t)},onError:({error:t,code:e,severity:s})=>{this.inFlight=!1,this.stopAll(),this.terminalState="error",this.errorMessage=t,this.errorEvent.emit({message:t,errorCode:e,severity:s})}}))}handlePollResult(t){var e;const s=(null!==(e=t.completions)&&void 0!==e?e:[]).filter((t=>!this.seenCompletionCreatedAts.has(t.created_at)&&"failed"===t.payment_status));if(s.forEach((t=>this.seenCompletionCreatedAts.add(t.created_at))),s.length>0&&(this.terminalState="payment-failed",this.failedDismissHandle&&clearTimeout(this.failedDismissHandle),this.failedDismissHandle=setTimeout((()=>{"payment-failed"===this.terminalState&&(this.terminalState="ready")}),3e3)),t.status===a.completed)return this.stopAll(),this.terminalState="completed",this.paymentStatus=this.resolvePaymentStatus(t),void this.checkoutCompleted.emit({checkoutId:this.checkoutId,paymentStatus:this.paymentStatus});t.status===a.expired&&(this.stopAll(),this.terminalState="expired",this.checkoutExpired.emit({checkoutId:this.checkoutId}),this.errorEvent.emit({message:l.CHECKOUT_EXPIRED,errorCode:o.CHECKOUT_EXPIRED,severity:r.ERROR}))}resolvePaymentStatus(t){var e,s;const i=null===(s=[...null!==(e=t.completions)&&void 0!==e?e:[]].sort(((t,e)=>new Date(e.updated_at).getTime()-new Date(t.updated_at).getTime()))[0])||void 0===s?void 0:s.payment_status;return i===n.succeeded||null==i&&t.successful_payment_id?"succeeded":"pending"}stopAll(){this.pollIntervalHandle&&(clearInterval(this.pollIntervalHandle),this.pollIntervalHandle=null),this.pollTimeoutHandle&&(clearTimeout(this.pollTimeoutHandle),this.pollTimeoutHandle=null),this.failedDismissHandle&&(clearTimeout(this.failedDismissHandle),this.failedDismissHandle=null),this.inFlight=!1}render(){return this.authToken&&this.checkoutId?s("div",null,"loading"===this.terminalState&&null,("ready"===this.terminalState||"payment-failed"===this.terminalState)&&s("div",null,s("justifi-checkout-qr-code",{checkoutId:this.checkoutId}),"payment-failed"===this.terminalState&&s("p",null,"Payment failed. Please try again."),"ready"===this.terminalState&&s("p",null,"Scan to pay")),"completed"===this.terminalState&&s("div",null,s("p",null,"succeeded"===this.paymentStatus?"Payment received":"Payment pending")),"expired"===this.terminalState&&s("p",null,"Checkout expired. Please create a new checkout."),"error"===this.terminalState&&s("p",null,this.errorMessage)):null}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"]}}};export{u as justifi_qr_terminal}
@@ -1 +1 @@
1
- import{r as t,h as o}from"./p-CV0Pyo1O.js";import{c as a}from"./p-C_SQBHCI.js";import{J as s}from"./p-DYL3RR2S.js";import{w as r}from"./p-DVJaoI_m.js";import{S as i}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import"./p-BtzgeLyZ.js";import"./p-De4Pig-y.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";const e=class{constructor(o){t(this,o)}async componentWillLoad(){await r(),a(),this.analytics=new s(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return!!this.bankAccountFormElement&&this.bankAccountFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:o,account:a}){return this.bankAccountFormElement?this.bankAccountFormElement.tokenize({clientId:t,paymentMethodMetadata:o,account:a}):{error:{message:"Bank account form is not available."}}}render(){return o(i,{key:"3c8a48f6060f14433ae94399fc48097cb138e301"},o("bank-account-form",{key:"30cd40b60629f5c7f874194dd7641ee3737e8b69",ref:t=>this.bankAccountFormElement=t}))}};export{e as justifi_bank_account_form}
1
+ import{r as t,h as o}from"./p-CV0Pyo1O.js";import{c as a}from"./p-CqOzVXGL.js";import{J as s}from"./p-CfIGO7TJ.js";import{w as r}from"./p-DVJaoI_m.js";import{S as i}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import"./p-Bx2_PW91.js";import"./p-De4Pig-y.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";const e=class{constructor(o){t(this,o)}async componentWillLoad(){await r(),a(),this.analytics=new s(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return!!this.bankAccountFormElement&&this.bankAccountFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:o,account:a}){return this.bankAccountFormElement?this.bankAccountFormElement.tokenize({clientId:t,paymentMethodMetadata:o,account:a}):{error:{message:"Bank account form is not available."}}}render(){return o(i,{key:"3c8a48f6060f14433ae94399fc48097cb138e301"},o("bank-account-form",{key:"30cd40b60629f5c7f874194dd7641ee3737e8b69",ref:t=>this.bankAccountFormElement=t}))}};export{e as justifi_bank_account_form}
@@ -0,0 +1 @@
1
+ var e={name:"@justifi/webcomponents",version:"6.13.3"};export{e as p}
@@ -0,0 +1 @@
1
+ import{a as e}from"./p-D9sqTVmd.js";import{P as a,a as t}from"./p-DPA5TKvQ.js";import{S as s,C as r}from"./p-BcNb9bVO.js";import{a as n,c as i}from"./p-BBSnDYJw.js";const d=[{label:"Choose state / province",value:""},...s.filter((e=>""!==e.value)),...a.filter((e=>""!==e.value))],l=e=>""===e?null:e,c=/^\d+$/,m=/P\.?\s?O\.?\s?Box|Postal\sBox/i,o=e().email("Enter valid email").transform(l),u=e().matches(/^\d{10}$/,"Enter valid phone number").transform(l),b=e().min(2,"Name must be at least 2 characters").max(100,"Name must be less than 100 characters").transform(l),v=e().min(2,"Name must be at least 2 characters").max(100,"Name must be less than 100 characters").transform(l),h=e().matches(/^(?:http(s)?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/,"Enter valid website url").transform(l),N=e().transform(l),E=e().min(2,"Industry must be at least 2 characters").max(50,"Industry must be less than 50 characters").transform(l),p=e().matches(c,"Enter valid tax id, SSN, or EIN").test("not-repeat","Enter valid tax id, SSN, or EIN",(e=>!/^(\d)\1+$/.test(e))).test("not-seq","Enter valid tax id, SSN, or EIN",(e=>"123456789"!==e)).transform(l),S=a=>e().matches(t[a].postalRegex,"Enter valid postal code").transform(l),B=a=>a===r.CAN?e().matches(c,"Enter valid SIN").length(t[a].identityDigits,"Enter valid SIN").test("not-repeat","Enter valid SIN",(e=>!/^(\d)\1+$/.test(e))).test("not-seq","Enter valid SIN",(e=>"123456789"!==e)).transform(l):y,A=a=>a===r.CAN?e().matches(c,"Enter valid Business Number (BN)").length(t[a].taxIdDigits,"Enter valid Business Number (BN)").test("not-repeat","Enter valid Business Number (BN)",(e=>!e||!/^(\d)\1+$/.test(e))).test("not-seq","Enter valid Business Number (BN)",(e=>!e||"123456789"!==e)).transform(l):p,g=e().test("past-date","Date of registration must be in the past",(e=>{const a=new Date(e);return a.setDate(a.getDate()+1),a<=new Date})).transform(l),w=e().min(2,"Name must be at least 2 characters").max(100,"Name must be less than 100 characters").transform(l),x=e().min(2,"Title must be at least 2 characters").max(50,"Title must be less than 50 characters").transform(l),$=a=>e().test("min","Enter a valid date",(e=>new Date(e)>=new Date("1902-01-01"))).test("age",`${a} must be at least 18 years old`,(e=>{const a=new Date(e),t=new Date;return t.setFullYear(t.getFullYear()-18),a<=t})).transform(l),y=e().matches(/^(?!000|666|9\d{2})\d{3}(?!00)\d{2}(?!0000)\d{4}$/,"Enter valid SSN").when("ssn_last4",{is:e=>!e||0===e.length,then:e=>e.required("Enter SSN"),otherwise:e=>e.nullable()}).test("not-repeat","Enter valid SSN",(e=>!/^(\d)\1+$/.test(e))).test("not-seq","Enter valid SSN",(e=>"123456789"!==e)).transform(l),D=e().matches(c,"Enter valid percentage").test("min","Percentage must be at least 0",(e=>!e||parseFloat(e)>=0)).test("max","Percentage must be at most 100",(e=>!e||parseFloat(e)<=100)).transform(l),I=e().min(5,"Address must be at least 5 characters").max(100,"Address must be less than 100 characters").test("not-po-box","A PO Box is not a valid address entry",(e=>!m.test(e))).transform(l),P=e().max(100,"Address must be less than 100 characters").test("not-po-box","A PO Box is not a valid address entry",(e=>!m.test(e))).transform(l),f=e().min(2,"City must be at least 2 characters").max(50,"City must be less than 50 characters").transform(l),q=e().oneOf(d.map((e=>e.value)),"Select a valid state or province").transform(l),j=e().matches(/^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\s\d[A-Z]\d))$/,"Enter valid postal code").transform(l),C=e().matches(c,"Enter valid revenue").transform(l),Z=e().matches(c,"Enter valid payment volume").transform(l),z=e().oneOf(n.map((e=>e.value)),"Select when service is received").transform(l),O=e().transform(l),T=e().min(2,"Name must be at least 2 characters").max(50,"Name must be less than 50 characters").transform(l),F=e().min(2,"Name must be at least 2 characters").max(50,"Name must be less than 50 characters").transform(l),_=e().oneOf(i.map((e=>e.value)),"Select account type").transform(l),V=e().min(4,"Account number must be at least 4 digits").max(17,"Account number must be less than 17 digits").matches(c,"Enter valid account number").test("not-repeat","Enter valid account number",(e=>!/^(\d)\1+$/.test(e))).transform(l),k=e().length(9,"Routing number must be 9 digits").matches(c,"Enter valid routing number").test("not-repeat","Enter valid routing number",(e=>!e||!/^(\d)\1+$/.test(e))).test("valid","Enter valid routing number",(e=>!e||(e=>{if(!e)return!1;const a=Array.from(String(e),Number);return 9===a.length&&0==(3*(a[0]+a[3]+a[6])+7*(a[1]+a[4]+a[7])+(a[2]+a[5]+a[8]))%10})(e))).transform(l);export{d as A,V as B,_ as C,F as D,T as E,c as F,k as G,v as a,N as b,b as c,g as d,o as e,z as f,Z as g,f as h,E as i,I as j,S as k,P as l,A as m,D as n,O as o,u as p,$ as q,C as r,y as s,p as t,x as u,w as v,h as w,B as x,j as y,q as z}
@@ -1 +1 @@
1
- import{p as t}from"./p-BtzgeLyZ.js";import{A as i}from"./p-De4Pig-y.js";import"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const s=i();class e{async record(t){return s.post({endpoint:"analytics",body:t})}}class n{constructor(t){this.eventListeners=new Map,this.handleCustomEvent=async t=>{await this.service.record(t)},window.location.origin.includes("localhost")||window.location.origin.includes("docs.justifi.tech")||(this.service=new e,this.componentInstance=t,this.setUpBasicData(),this.setupLifecycleTracking(),this.trackCustomEvents())}get resourceId(){return this.componentInstance.accountId||this.componentInstance.businessId||this.componentInstance.paymentId||this.componentInstance.payoutId||this.componentInstance.checkoutId}setUpBasicData(){this.basicData={component_name:this.componentInstance.tagName,component_version:t.version,client_user_agent:navigator.userAgent,client_platform:navigator.userAgent,client_origin:window.location.origin,resource_id:this.resourceId}}trackCustomEvents(){this.eventEmitters=["submit-event","error-event"],this.eventEmitters.forEach((t=>{if("function"==typeof this.componentInstance.addEventListener){const i=i=>this.handleCustomEvent({event_type:t,data:Object.assign(Object.assign({},this.basicData),"error-event"===t&&{error:i.detail})});this.eventListeners.set(t,i),this.componentInstance.addEventListener(t,i)}}))}setupLifecycleTracking(){const t=this.componentInstance.componentDidLoad;this.componentInstance.componentDidLoad=()=>{if(this.service.record({event_type:"init",data:this.basicData}),t)return t.apply(this.componentInstance)}}cleanup(){this.eventListeners.forEach(((t,i)=>{this.componentInstance.removeEventListener(i,t)})),this.eventListeners.clear()}}export{n as J}
1
+ import{p as t}from"./p-Bx2_PW91.js";import{A as i}from"./p-De4Pig-y.js";import"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const s=i();class e{async record(t){return s.post({endpoint:"analytics",body:t})}}class n{constructor(t){this.eventListeners=new Map,this.handleCustomEvent=async t=>{await this.service.record(t)},window.location.origin.includes("localhost")||window.location.origin.includes("docs.justifi.tech")||(this.service=new e,this.componentInstance=t,this.setUpBasicData(),this.setupLifecycleTracking(),this.trackCustomEvents())}get resourceId(){return this.componentInstance.accountId||this.componentInstance.businessId||this.componentInstance.paymentId||this.componentInstance.payoutId||this.componentInstance.checkoutId}setUpBasicData(){this.basicData={component_name:this.componentInstance.tagName,component_version:t.version,client_user_agent:navigator.userAgent,client_platform:navigator.userAgent,client_origin:window.location.origin,resource_id:this.resourceId}}trackCustomEvents(){this.eventEmitters=["submit-event","error-event"],this.eventEmitters.forEach((t=>{if("function"==typeof this.componentInstance.addEventListener){const i=i=>this.handleCustomEvent({event_type:t,data:Object.assign(Object.assign({},this.basicData),"error-event"===t&&{error:i.detail})});this.eventListeners.set(t,i),this.componentInstance.addEventListener(t,i)}}))}setupLifecycleTracking(){const t=this.componentInstance.componentDidLoad;this.componentInstance.componentDidLoad=()=>{if(this.service.record({event_type:"init",data:this.basicData}),t)return t.apply(this.componentInstance)}}cleanup(){this.eventListeners.forEach(((t,i)=>{this.componentInstance.removeEventListener(i,t)})),this.eventListeners.clear()}}export{n as J}
@@ -1 +1 @@
1
- import{p as e}from"./p-BtzgeLyZ.js";const s="__JUSTIFI_WC_VERSION__",o=async()=>{var o,t;if((()=>{if("undefined"==typeof globalThis)return;const o=e.version,t=globalThis[s];t&&t!==o?console.error(`@justifi/webcomponents: Multiple versions detected. Version ${t} was loaded first and registered all components. Version ${o} is also present but its components will NOT be used. To fix this, add to your package.json:\n"pnpm": { "overrides": { "@justifi/webcomponents": "${o}" } }`):globalThis[s]=o})(),"undefined"!=typeof process&&("test"===(null===(o=process.env)||void 0===o?void 0:o.NODE_ENV)||(null===(t=process.env)||void 0===t?void 0:t.JEST_WORKER_ID)))return;const i=e.version,n=e.name,a=await(async e=>{const s=await fetch("https://registry.npmjs.org/"+e+"/latest");return(await s.json()).version})(n),r=a.replace(/-rc.*/,""),l=i.split("."),p=a.split(".");l[0]!==p[0]&&console.warn(`The package ${n} is out of date. The latest version is ${r}. Please update.`)};export{o as c}
1
+ import{p as e}from"./p-Bx2_PW91.js";const s="__JUSTIFI_WC_VERSION__",o=async()=>{var o,t;if((()=>{if("undefined"==typeof globalThis)return;const o=e.version,t=globalThis[s];t&&t!==o?console.error(`@justifi/webcomponents: Multiple versions detected. Version ${t} was loaded first and registered all components. Version ${o} is also present but its components will NOT be used. To fix this, add to your package.json:\n"pnpm": { "overrides": { "@justifi/webcomponents": "${o}" } }`):globalThis[s]=o})(),"undefined"!=typeof process&&("test"===(null===(o=process.env)||void 0===o?void 0:o.NODE_ENV)||(null===(t=process.env)||void 0===t?void 0:t.JEST_WORKER_ID)))return;const i=e.version,n=e.name,a=await(async e=>{const s=await fetch("https://registry.npmjs.org/"+e+"/latest");return(await s.json()).version})(n),r=a.replace(/-rc.*/,""),l=i.split("."),p=a.split(".");l[0]!==p[0]&&console.warn(`The package ${n} is out of date. The latest version is ${r}. Please update.`)};export{o as c}
@@ -1 +1 @@
1
- import{c as e,a as s}from"./p-D9sqTVmd.js";import{m as t,d as n,i as a,b as i,a as r,p as o,e as l,w as _,c,t as d,o as u,f as m,r as p,g as b,h as E,l as h,j as f,k as v,n as g,s as w,q as y,u as $,v as x,x as j}from"./p-z3RFjy9B.js";import{C as S}from"./p-BcNb9bVO.js";import{c as q}from"./p-DPA5TKvQ.js";const B=s=>{const t=e({legal_name:c.required("Enter legal name"),website_url:_.required("Enter business website url"),email:l.required("Enter business email"),phone:o.required("Enter phone number"),doing_business_as:r.nullable(),classification:i.required("Select business classification"),industry:a.required("Enter a business industry"),date_of_incorporation:n.required("Enter date of registration")}),u=e({legal_name:c.required("Enter legal name"),website_url:_.nullable(),email:l.nullable(),phone:o.nullable(),doing_business_as:r.nullable(),classification:i.nullable(),industry:a.nullable(),tax_id:d.nullable(),date_of_incorporation:n.nullable()});return s?u:t},D=n=>B(n).concat(e({classification:s().required("Select business classification"),tax_id:t(S.USA).when("tax_id_last4",{is:e=>!e,then:e=>e.required(`Enter valid ${q.USA.taxIdLabel} without dashes`),otherwise:e=>e.nullable()})})),T=n=>B(n).concat(e({classification:s().required("Select business classification"),tax_id:t(S.CAN).when("tax_id_last4",{is:e=>!e,then:e=>e.notRequired().nullable(),otherwise:e=>e.nullable()})})),V=s=>{const t=e({business_revenue:p.required("Enter business revenue"),business_payment_volume:b.required("Enter business payment volume"),business_average_transaction_amount:p.required("Enter average transaction amount"),business_when_service_received:m.required("Select when service is received"),business_other_payment_details:u.nullable()}),n=e({business_revenue:p.nullable(),business_payment_volume:b.nullable(),business_average_transaction_amount:p.nullable(),business_when_service_received:m.nullable(),business_other_payment_details:u.nullable()});return s?n:t},k=t=>e(t?{line1:f.nullable(),line2:h.nullable(),city:E.nullable(),state:s().nullable(),postal_code:s().nullable()}:{line1:f.required("Enter street address"),line2:h.nullable(),city:E.required("Enter city"),state:s().required("Select state"),postal_code:v(S.USA).required("Enter postal code")}),z=t=>e(t?{line1:f.nullable(),line2:h.nullable(),city:E.nullable(),state:s().nullable(),postal_code:s().nullable()}:{line1:f.required("Enter street address"),line2:h.nullable(),city:E.required("Enter city"),state:s().required("Select province or state"),postal_code:v(S.CAN).required("Enter postal code")}),A={[S.USA]:k,[S.CAN]:z},C=(t,n)=>n?(t=>e({name:x.required(`Enter ${t} name`),title:$.nullable(),email:l.nullable(),phone:o.nullable(),dob_full:y(t).nullable(),ssn_last4:s().nullable(),identification_number:w.nullable(),ownership_percentage:g.nullable(),address:k(!0)}))(t):(t=>e({name:x.required(`Enter ${t} name`),title:$.required(`Enter ${t} title`),email:l.required(`Enter ${t} email`),phone:o.required("Enter phone number"),dob_full:y(t).required("Enter date of birth"),ssn_last4:s().nullable(),identification_number:w,ownership_percentage:"owner"===t?g.required("Enter ownership percentage"):g.nullable(),address:k(!1)}))(t),F=(t,n)=>n?(t=>e({name:x.required(`Enter ${t} name`),title:$.nullable(),email:l.nullable(),phone:o.nullable(),dob_full:y(t).nullable(),ssn_last4:s().nullable(),identification_number:j(S.CAN).nullable(),ownership_percentage:g.nullable(),address:z(!0)}))(t):(t=>e({name:x.required(`Enter ${t} name`),title:$.required(`Enter ${t} title`),email:l.required(`Enter ${t} email`),phone:o.required("Enter phone number"),dob_full:y(t).required("Enter date of birth"),ssn_last4:s().nullable(),identification_number:j(S.CAN).nullable(),ownership_percentage:"owner"===t?g.required("Enter ownership percentage"):g.nullable(),address:z(!1)}))(t),K={[S.USA]:C,[S.CAN]:F};export{V as a,D as b,k as c,T as d,F as e,z as f,K as g,A as h,C as i}
1
+ import{c as e,a as s}from"./p-D9sqTVmd.js";import{m as t,d as n,i as a,b as i,a as r,p as o,e as l,w as _,c,t as d,o as u,f as m,r as p,g as b,h as E,l as h,j as f,k as v,n as g,s as w,q as y,u as $,v as x,x as S}from"./p-BxpXvXn-.js";import{C as j}from"./p-BcNb9bVO.js";import{c as q}from"./p-DPA5TKvQ.js";const B=s=>{const t=e({legal_name:c.required("Enter legal name"),website_url:_.required("Enter business website url"),email:l.required("Enter business email"),phone:o.required("Enter phone number"),doing_business_as:r.nullable(),classification:i.required("Select business classification"),industry:a.required("Enter a business industry"),date_of_incorporation:n.required("Enter date of registration")}),u=e({legal_name:c.required("Enter legal name"),website_url:_.nullable(),email:l.nullable(),phone:o.nullable(),doing_business_as:r.nullable(),classification:i.nullable(),industry:a.nullable(),tax_id:d.nullable(),date_of_incorporation:n.nullable()});return s?u:t},D=n=>B(n).concat(e({classification:s().required("Select business classification"),tax_id:t(j.USA).when("tax_id_last4",{is:e=>!e,then:e=>e.required(`Enter valid ${q.USA.taxIdLabel} without dashes`),otherwise:e=>e.nullable()})})),T=n=>B(n).concat(e({classification:s().required("Select business classification"),tax_id:t(j.CAN).when("tax_id_last4",{is:e=>!e,then:e=>e.notRequired().nullable(),otherwise:e=>e.nullable()})})),V=s=>{const t=e({business_revenue:p.required("Enter business revenue"),business_payment_volume:b.required("Enter business payment volume"),business_average_transaction_amount:p.required("Enter average transaction amount"),business_when_service_received:m.required("Select when service is received"),business_other_payment_details:u.nullable()}),n=e({business_revenue:p.nullable(),business_payment_volume:b.nullable(),business_average_transaction_amount:p.nullable(),business_when_service_received:m.nullable(),business_other_payment_details:u.nullable()});return s?n:t},X=t=>e(t?{line1:f.nullable(),line2:h.nullable(),city:E.nullable(),state:s().nullable(),postal_code:s().nullable()}:{line1:f.required("Enter street address"),line2:h.nullable(),city:E.required("Enter city"),state:s().required("Select state"),postal_code:v(j.USA).required("Enter postal code")}),k=t=>e(t?{line1:f.nullable(),line2:h.nullable(),city:E.nullable(),state:s().nullable(),postal_code:s().nullable()}:{line1:f.required("Enter street address"),line2:h.nullable(),city:E.required("Enter city"),state:s().required("Select province or state"),postal_code:v(j.CAN).required("Enter postal code")}),A={[j.USA]:X,[j.CAN]:k},C=(t,n)=>n?(t=>e({name:x.required(`Enter ${t} name`),title:$.nullable(),email:l.nullable(),phone:o.nullable(),dob_full:y(t).nullable(),ssn_last4:s().nullable(),identification_number:w.nullable(),ownership_percentage:g.nullable(),address:X(!0)}))(t):(t=>e({name:x.required(`Enter ${t} name`),title:$.required(`Enter ${t} title`),email:l.required(`Enter ${t} email`),phone:o.required("Enter phone number"),dob_full:y(t).required("Enter date of birth"),ssn_last4:s().nullable(),identification_number:w,ownership_percentage:"owner"===t?g.required("Enter ownership percentage"):g.nullable(),address:X(!1)}))(t),K=(t,n)=>n?(t=>e({name:x.required(`Enter ${t} name`),title:$.nullable(),email:l.nullable(),phone:o.nullable(),dob_full:y(t).nullable(),ssn_last4:s().nullable(),identification_number:S(j.CAN).nullable(),ownership_percentage:g.nullable(),address:k(!0)}))(t):(t=>e({name:x.required(`Enter ${t} name`),title:$.required(`Enter ${t} title`),email:l.required(`Enter ${t} email`),phone:o.required("Enter phone number"),dob_full:y(t).required("Enter date of birth"),ssn_last4:s().nullable(),identification_number:S(j.CAN).nullable(),ownership_percentage:"owner"===t?g.required("Enter ownership percentage"):g.nullable(),address:k(!1)}))(t),N={[j.USA]:C,[j.CAN]:K};export{V as a,D as b,X as c,T as d,K as e,k as f,N as g,A as h,C as i}
@@ -1 +1 @@
1
- import{r as s,c as t,h as i}from"./p-CV0Pyo1O.js";import{D as e,C as r,b as o,h}from"./p-DXTa04jn.js";import{J as p}from"./p-DYL3RR2S.js";import{c as a}from"./p-C_SQBHCI.js";import{g as n,a as d}from"./p-CdwzNfP1.js";import{D as c,a as u}from"./p-C7hX61pS.js";import{S as m}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-BtzgeLyZ.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const f=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event",7),this.isLoading=!0,this.showDisputeResponseForm=!1,this.fetchDisputePending=!1}scheduleFetchDispute(){this.getDispute&&!this.fetchDisputePending&&(this.fetchDisputePending=!0,queueMicrotask((()=>{this.fetchDisputePending=!1,this.getDispute&&this.fetchData()})))}disputeResponseHandler(s){s.detail.name===c.respondToDispute&&(this.showDisputeResponseForm=!0),s.detail.name===c.cancelDispute&&(this.showDisputeResponseForm=!1)}disputeSubmittedHandler(){this.fetchData()}componentWillLoad(){a(),this.analytics=new p(this),this.initializeGetDispute()}componentDidLoad(){this.scheduleFetchDispute()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetDispute(),this.scheduleFetchDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:s,authToken:t,service:i})=>async({onSuccess:o,onError:h})=>{var p;try{const a=await i.fetchDispute(s,t);if(a.error)return h({error:d(a.error),code:n(null===(p=a.error)||void 0===p?void 0:p.code),severity:r.ERROR});{const s=Object.assign({},a.page_info);o({dispute:new e(a.data),pagingInfo:s})}}catch(s){const t=n(null==s?void 0:s.code);return h({error:s.message||s,code:t,severity:r.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new u}):this.errorEvent.emit({message:"Dispute ID and Auth Token are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}fetchData(){this.getDispute&&(this.isLoading=!0,this.getDispute({onSuccess:({dispute:s})=>{this.dispute=new e(s),this.isLoading=!1,this.dispute.status!==h.needsResponse&&(this.showDisputeResponseForm=!1)},onError:({error:s,code:t,severity:i})=>{this.errorEvent.emit({errorCode:t,message:s,severity:i}),this.isLoading=!1}}))}render(){return i(m,{key:"e95c2e42f6e966681986089eccd9c0c6099d7214"},i("div",{key:"18e936c7fd6992cfc18f8e98a2eda2f333c862f2"},this.showDisputeResponseForm?i("dispute-response",{disputeId:this.disputeId,disputeResponse:this.dispute.dispute_response,authToken:this.authToken}):i("dispute-notification",{dispute:this.dispute,authToken:this.authToken,isLoading:this.isLoading})))}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_dispute_management}
1
+ import{r as s,c as t,h as i}from"./p-CV0Pyo1O.js";import{D as e,C as r,b as o,h}from"./p-DXTa04jn.js";import{J as p}from"./p-CfIGO7TJ.js";import{c as a}from"./p-CqOzVXGL.js";import{g as n,a as d}from"./p-CdwzNfP1.js";import{D as c,a as u}from"./p-C7hX61pS.js";import{S as m}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-Bx2_PW91.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";const f=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event",7),this.isLoading=!0,this.showDisputeResponseForm=!1,this.fetchDisputePending=!1}scheduleFetchDispute(){this.getDispute&&!this.fetchDisputePending&&(this.fetchDisputePending=!0,queueMicrotask((()=>{this.fetchDisputePending=!1,this.getDispute&&this.fetchData()})))}disputeResponseHandler(s){s.detail.name===c.respondToDispute&&(this.showDisputeResponseForm=!0),s.detail.name===c.cancelDispute&&(this.showDisputeResponseForm=!1)}disputeSubmittedHandler(){this.fetchData()}componentWillLoad(){a(),this.analytics=new p(this),this.initializeGetDispute()}componentDidLoad(){this.scheduleFetchDispute()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetDispute(),this.scheduleFetchDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:s,authToken:t,service:i})=>async({onSuccess:o,onError:h})=>{var p;try{const a=await i.fetchDispute(s,t);if(a.error)return h({error:d(a.error),code:n(null===(p=a.error)||void 0===p?void 0:p.code),severity:r.ERROR});{const s=Object.assign({},a.page_info);o({dispute:new e(a.data),pagingInfo:s})}}catch(s){const t=n(null==s?void 0:s.code);return h({error:s.message||s,code:t,severity:r.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new u}):this.errorEvent.emit({message:"Dispute ID and Auth Token are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}fetchData(){this.getDispute&&(this.isLoading=!0,this.getDispute({onSuccess:({dispute:s})=>{this.dispute=new e(s),this.isLoading=!1,this.dispute.status!==h.needsResponse&&(this.showDisputeResponseForm=!1)},onError:({error:s,code:t,severity:i})=>{this.errorEvent.emit({errorCode:t,message:s,severity:i}),this.isLoading=!1}}))}render(){return i(m,{key:"e95c2e42f6e966681986089eccd9c0c6099d7214"},i("div",{key:"18e936c7fd6992cfc18f8e98a2eda2f333c862f2"},this.showDisputeResponseForm?i("dispute-response",{disputeId:this.disputeId,disputeResponse:this.dispute.dispute_response,authToken:this.authToken}):i("dispute-notification",{dispute:this.dispute,authToken:this.authToken,isLoading:this.isLoading})))}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_dispute_management}
@@ -1 +1 @@
1
- import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import{c as r,a as i,F as n}from"./p-D9sqTVmd.js";import{f as o}from"./p-BSs-2JKu.js";import"./p-DVJaoI_m.js";import{R as a,C as u,b as h,q as l}from"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{B as c}from"./p-CHo7TfsM.js";import{S as d}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{P as m}from"./p-NzPaWKbY.js";import{m as p}from"./p-BB8Ce9rp.js";import{J as f}from"./p-DYL3RR2S.js";import{c as y}from"./p-C_SQBHCI.js";import{g as v,a as j}from"./p-CdwzNfP1.js";import{A as b}from"./p-De4Pig-y.js";import{S as w}from"./p-uZ5KAseb.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-D8GTwl9v.js";import"./p-CPKMvyV_.js";import"./p-BtzgeLyZ.js";const T=t=>{const e=+t;return i().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${o(e)}`,(function(t){return+t<=+e})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},C=t=>{if(t)return r({amount:T(t),description:i().optional(),reason:i().optional().oneOf([a.customerRequest,a.duplicate,a.fraudulent],"Select a reason")})},g=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],S=b();class I{async postRefund(t,e,s,r){return S.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":e},body:r,authToken:s})}}const P=b();class R{async postVoid(t,e,s){return P.post({endpoint:`payments/${t}/void`,headers:{"Sub-Account":e},authToken:s})}}const A=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(w,{width:"100%",height:"40px"}))),k=()=>t(d,null,t("div",{class:"row gap-5"},t(A,null),t(A,null),t(A,null))),x=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}componentWillLoad(){y(),this.analytics=new f(this),this.initializeApi(),this.formController=new n(C())}handleError(t,e,s){this.errorEvent.emit({errorCode:t,message:e,severity:s})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(h.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",u.ERROR)}isPaymentCreatedWithin25Minutes(){var t;if(!this.payment||!(null===(t=this.payment)||void 0===t?void 0:t.created_at))return!1;const e=new Date(this.payment.created_at);return((new Date).getTime()-e.getTime())/6e4<=25}initializeFormController(){const t=this.refundPayload.amount,e=t?t.toString():"0";this.formController=new n(C(e)),this.formController.setInitialValues({amount:e}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?p({id:this.paymentId,authToken:this.authToken,service:new m})({onSuccess:({payment:t})=>{this.payment=t,this.refundPayload=new l({amount:t.amount_refundable})},onError:({error:t,code:e,severity:s})=>{this.handleError(e,t,s)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(h.MISSING_PROPS,"Payment ID and Auth Token are required",u.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const e=this.formController.values.getValue();return this.refundLoading=!0,this.isPaymentCreatedWithin25Minutes()?this.tryVoidPayment():this.processRefund(e)}async tryVoidPayment(){const t=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({onSuccess:i,onError:n,final:o})=>{var a;try{const o=await r.postVoid(s,e,t);if(o.error)return n({error:j(o.error),code:v(null===(a=o.error)||void 0===a?void 0:a.code),severity:u.ERROR});i(o)}catch(t){const e=v(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:u.ERROR})}finally{o()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new R});return new Promise((e=>{let s,r=!1;const i=this.formController.values.getValue();t({onSuccess:t=>{s=t,r=!0},onError:({error:t,code:s,severity:n})=>{r=!0,this.handleError(t,s,n),this.processRefund(i).then(e)},final:()=>{s&&!s.error&&r&&(this.submitEvent.emit({response:s}),this.submitDisabled=!0,this.refundLoading=!1,e(s.data))}})}))}async processRefund(t){const e=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({refundBody:i,onSuccess:n,onError:o,final:a})=>{var h;try{const a=await r.postRefund(s,e,t,i);if(a.error)return o({error:j(a.error),code:v(null===(h=a.error)||void 0===h?void 0:h.code),severity:u.ERROR});n(a)}catch(t){const e=v(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:u.ERROR})}finally{a()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new I});return new Promise((s=>{let r;e({refundBody:t,onSuccess:t=>{r=t},onError:({error:t,code:e,severity:s})=>{r=t,this.handleError(t,e,s)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,s(r.data)}})}))}render(){if(this.paymentLoading)return t(k,null);const e=this.formController.getInitialValues(),s=this.refundPayload.amount;return t(d,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:e.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:e.reason,inputHandler:this.inputHandler,options:g,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:e.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(c,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${o(+s)}`))))))}};export{x as justifi_refund_payment}
1
+ import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import{c as r,a as i,F as n}from"./p-D9sqTVmd.js";import{f as o}from"./p-BSs-2JKu.js";import"./p-DVJaoI_m.js";import{R as a,C as u,b as h,q as l}from"./p-DXTa04jn.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{B as c}from"./p-CHo7TfsM.js";import{S as d}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{P as m}from"./p-NzPaWKbY.js";import{m as p}from"./p-BB8Ce9rp.js";import{J as f}from"./p-CfIGO7TJ.js";import{c as v}from"./p-CqOzVXGL.js";import{g as y,a as j}from"./p-CdwzNfP1.js";import{A as b}from"./p-De4Pig-y.js";import{S as w}from"./p-uZ5KAseb.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-D8GTwl9v.js";import"./p-CPKMvyV_.js";import"./p-Bx2_PW91.js";const T=t=>{const e=+t;return i().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${o(e)}`,(function(t){return+t<=+e})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},C=t=>{if(t)return r({amount:T(t),description:i().optional(),reason:i().optional().oneOf([a.customerRequest,a.duplicate,a.fraudulent],"Select a reason")})},P=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],g=b();class I{async postRefund(t,e,s,r){return g.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":e},body:r,authToken:s})}}const S=b();class x{async postVoid(t,e,s){return S.post({endpoint:`payments/${t}/void`,headers:{"Sub-Account":e},authToken:s})}}const A=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(w,{width:"100%",height:"40px"}))),V=()=>t(d,null,t("div",{class:"row gap-5"},t(A,null),t(A,null),t(A,null))),k=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}componentWillLoad(){v(),this.analytics=new f(this),this.initializeApi(),this.formController=new n(C())}handleError(t,e,s){this.errorEvent.emit({errorCode:t,message:e,severity:s})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(h.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",u.ERROR)}isPaymentCreatedWithin25Minutes(){var t;if(!this.payment||!(null===(t=this.payment)||void 0===t?void 0:t.created_at))return!1;const e=new Date(this.payment.created_at);return((new Date).getTime()-e.getTime())/6e4<=25}initializeFormController(){const t=this.refundPayload.amount,e=t?t.toString():"0";this.formController=new n(C(e)),this.formController.setInitialValues({amount:e}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?p({id:this.paymentId,authToken:this.authToken,service:new m})({onSuccess:({payment:t})=>{this.payment=t,this.refundPayload=new l({amount:t.amount_refundable})},onError:({error:t,code:e,severity:s})=>{this.handleError(e,t,s)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(h.MISSING_PROPS,"Payment ID and Auth Token are required",u.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const e=this.formController.values.getValue();return this.refundLoading=!0,this.isPaymentCreatedWithin25Minutes()?this.tryVoidPayment():this.processRefund(e)}async tryVoidPayment(){const t=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({onSuccess:i,onError:n,final:o})=>{var a;try{const o=await r.postVoid(s,e,t);if(o.error)return n({error:j(o.error),code:y(null===(a=o.error)||void 0===a?void 0:a.code),severity:u.ERROR});i(o)}catch(t){const e=y(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:u.ERROR})}finally{o()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new x});return new Promise((e=>{let s,r=!1;const i=this.formController.values.getValue();t({onSuccess:t=>{s=t,r=!0},onError:({error:t,code:s,severity:n})=>{r=!0,this.handleError(t,s,n),this.processRefund(i).then(e)},final:()=>{s&&!s.error&&r&&(this.submitEvent.emit({response:s}),this.submitDisabled=!0,this.refundLoading=!1,e(s.data))}})}))}async processRefund(t){const e=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({refundBody:i,onSuccess:n,onError:o,final:a})=>{var h;try{const a=await r.postRefund(s,e,t,i);if(a.error)return o({error:j(a.error),code:y(null===(h=a.error)||void 0===h?void 0:h.code),severity:u.ERROR});n(a)}catch(t){const e=y(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:u.ERROR})}finally{a()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new I});return new Promise((s=>{let r;e({refundBody:t,onSuccess:t=>{r=t},onError:({error:t,code:e,severity:s})=>{r=t,this.handleError(t,e,s)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,s(r.data)}})}))}render(){if(this.paymentLoading)return t(V,null);const e=this.formController.getInitialValues(),s=this.refundPayload.amount;return t(d,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:e.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:e.reason,inputHandler:this.inputHandler,options:P,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:e.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(c,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${o(+s)}`))))))}};export{k as justifi_refund_payment}