@justifi/webcomponents 5.0.0-rc-1 → 5.0.0-rc-2

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 (103) hide show
  1. package/dist/cjs/bank-account-form_9.cjs.entry.js +3 -3
  2. package/dist/cjs/{business.service-7faffa0b.js → business.service-285f6f26.js} +1 -1
  3. package/dist/cjs/{check-pkg-version-23c816dd.js → check-pkg-version-18426209.js} +2 -2
  4. package/dist/cjs/{checkout.service-9891a349.js → checkout.service-671fab62.js} +1 -1
  5. package/dist/cjs/{config-05767cba.js → config-b190e93e.js} +1 -1
  6. package/dist/cjs/{dispute.service-2064ae0f.js → dispute.service-c362a953.js} +1 -1
  7. package/dist/cjs/{get-payout-csv-4e60474e.js → get-payout-csv-d2aed52c.js} +1 -1
  8. package/dist/cjs/{get-subaccounts-2ea9676c.js → get-subaccounts-9aa22224.js} +1 -1
  9. package/dist/cjs/iframe-input.cjs.entry.js +1 -1
  10. package/dist/cjs/justifi-additional-questions-form-step_10.cjs.entry.js +2 -2
  11. package/dist/cjs/justifi-business-details.cjs.entry.js +4 -4
  12. package/dist/cjs/justifi-business-form.cjs.entry.js +3 -3
  13. package/dist/cjs/justifi-checkout-core.cjs.entry.js +1 -1
  14. package/dist/cjs/justifi-checkout.cjs.entry.js +4 -4
  15. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +5 -5
  16. package/dist/cjs/justifi-dispute-management.cjs.entry.js +4 -4
  17. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +4 -4
  18. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +3 -3
  19. package/dist/cjs/justifi-owner-form_3.cjs.entry.js +2 -2
  20. package/dist/cjs/justifi-payment-details.cjs.entry.js +4 -4
  21. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +4 -4
  22. package/dist/cjs/justifi-payments-list.cjs.entry.js +4 -4
  23. package/dist/cjs/justifi-payout-details.cjs.entry.js +4 -4
  24. package/dist/cjs/justifi-payouts-list.cjs.entry.js +5 -5
  25. package/dist/cjs/justifi-refund-form.cjs.entry.js +1 -1
  26. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +3 -3
  27. package/dist/cjs/justifi-terminals-list.cjs.entry.js +4 -4
  28. package/dist/cjs/justifi-tokenize-payment-method.cjs.entry.js +3 -3
  29. package/dist/cjs/{package-1a3b3cdf.js → package-d6ef89ed.js} +1 -1
  30. package/dist/cjs/{payment.service-0a8c3a01.js → payment.service-9a5336f1.js} +1 -1
  31. package/dist/docs.json +1 -1
  32. package/dist/esm/bank-account-form_9.entry.js +3 -3
  33. package/dist/esm/{business.service-97a3da69.js → business.service-182aea6f.js} +1 -1
  34. package/dist/esm/{check-pkg-version-c2078b31.js → check-pkg-version-157854b7.js} +2 -2
  35. package/dist/esm/{checkout.service-925ded8e.js → checkout.service-32a6ebe8.js} +1 -1
  36. package/dist/esm/{config-27764a9d.js → config-187b3ae1.js} +1 -1
  37. package/dist/esm/{dispute.service-588dd905.js → dispute.service-4e5059aa.js} +1 -1
  38. package/dist/esm/{get-payout-csv-b95a5d54.js → get-payout-csv-e6058aa7.js} +1 -1
  39. package/dist/esm/{get-subaccounts-b9a00d48.js → get-subaccounts-0b8af245.js} +1 -1
  40. package/dist/esm/iframe-input.entry.js +1 -1
  41. package/dist/esm/justifi-additional-questions-form-step_10.entry.js +2 -2
  42. package/dist/esm/justifi-business-details.entry.js +4 -4
  43. package/dist/esm/justifi-business-form.entry.js +3 -3
  44. package/dist/esm/justifi-checkout-core.entry.js +1 -1
  45. package/dist/esm/justifi-checkout.entry.js +4 -4
  46. package/dist/esm/justifi-checkouts-list.entry.js +5 -5
  47. package/dist/esm/justifi-dispute-management.entry.js +4 -4
  48. package/dist/esm/justifi-dispute-notification_3.entry.js +4 -4
  49. package/dist/esm/justifi-gross-payment-chart.entry.js +3 -3
  50. package/dist/esm/justifi-owner-form_3.entry.js +2 -2
  51. package/dist/esm/justifi-payment-details.entry.js +4 -4
  52. package/dist/esm/justifi-payment-provisioning.entry.js +4 -4
  53. package/dist/esm/justifi-payments-list.entry.js +4 -4
  54. package/dist/esm/justifi-payout-details.entry.js +4 -4
  55. package/dist/esm/justifi-payouts-list.entry.js +5 -5
  56. package/dist/esm/justifi-refund-form.entry.js +1 -1
  57. package/dist/esm/justifi-season-interruption-insurance.entry.js +3 -3
  58. package/dist/esm/justifi-terminals-list.entry.js +4 -4
  59. package/dist/esm/justifi-tokenize-payment-method.entry.js +3 -3
  60. package/dist/esm/{package-84f77b11.js → package-9e3b7f9e.js} +1 -1
  61. package/dist/esm/{payment.service-064fac31.js → payment.service-45f90e06.js} +1 -1
  62. package/dist/module/bank-account-form2.js +1 -1
  63. package/dist/module/card-form2.js +1 -1
  64. package/dist/module/config.js +1 -1
  65. package/dist/module/package.js +1 -1
  66. package/dist/webcomponents/{p-5a62fca2.js → p-0f23ff58.js} +1 -1
  67. package/dist/webcomponents/{p-9e990e7d.entry.js → p-110cae83.entry.js} +1 -1
  68. package/dist/webcomponents/{p-53cf5687.entry.js → p-28029272.entry.js} +1 -1
  69. package/dist/webcomponents/{p-02a0b21e.js → p-441c1cf8.js} +1 -1
  70. package/dist/webcomponents/{p-c740f609.entry.js → p-4972d608.entry.js} +1 -1
  71. package/dist/webcomponents/{p-95e688bd.entry.js → p-4eb3dcfa.entry.js} +1 -1
  72. package/dist/webcomponents/{p-174b151e.js → p-5456a794.js} +1 -1
  73. package/dist/webcomponents/{p-733dc19b.entry.js → p-5bbe1133.entry.js} +1 -1
  74. package/dist/webcomponents/p-5c6d08a6.entry.js +1 -0
  75. package/dist/webcomponents/p-6ab77b89.js +1 -0
  76. package/dist/webcomponents/{p-57281853.entry.js → p-6f4bfdff.entry.js} +1 -1
  77. package/dist/webcomponents/p-7693ed02.entry.js +1 -0
  78. package/dist/webcomponents/{p-8a550a5e.entry.js → p-7f796066.entry.js} +1 -1
  79. package/dist/webcomponents/{p-ecced6e5.entry.js → p-83584c56.entry.js} +1 -1
  80. package/dist/webcomponents/{p-9c652bc3.entry.js → p-88acfa7c.entry.js} +1 -1
  81. package/dist/webcomponents/{p-22034555.entry.js → p-9ef9a625.entry.js} +1 -1
  82. package/dist/webcomponents/{p-af620972.js → p-a07b1816.js} +1 -1
  83. package/dist/webcomponents/{p-96ea95ce.entry.js → p-b867dd5d.entry.js} +1 -1
  84. package/dist/webcomponents/{p-54d36e97.js → p-bb0f8b70.js} +1 -1
  85. package/dist/webcomponents/{p-2ed8e8db.entry.js → p-bbcaa29b.entry.js} +1 -1
  86. package/dist/webcomponents/p-cc977850.js +1 -0
  87. package/dist/webcomponents/{p-a17be58e.entry.js → p-cefd50f8.entry.js} +1 -1
  88. package/dist/webcomponents/p-db8c12ee.js +1 -0
  89. package/dist/webcomponents/{p-f0f3442e.entry.js → p-e1ee92f5.entry.js} +1 -1
  90. package/dist/webcomponents/{p-d67bb568.entry.js → p-e396506c.entry.js} +1 -1
  91. package/dist/webcomponents/{p-a41a1843.entry.js → p-e723bc30.entry.js} +1 -1
  92. package/dist/webcomponents/{p-4f569cbf.entry.js → p-ec60d318.entry.js} +1 -1
  93. package/dist/webcomponents/{p-f6f8dabc.js → p-edb57087.js} +1 -1
  94. package/dist/webcomponents/{p-2a6f8329.entry.js → p-f8a3b942.entry.js} +1 -1
  95. package/dist/webcomponents/p-f99e8150.entry.js +1 -0
  96. package/dist/webcomponents/webcomponents.esm.js +1 -1
  97. package/package.json +1 -1
  98. package/dist/webcomponents/p-66c63ef7.entry.js +0 -1
  99. package/dist/webcomponents/p-99c92f1f.entry.js +0 -1
  100. package/dist/webcomponents/p-a520766d.entry.js +0 -1
  101. package/dist/webcomponents/p-cb00d4f3.js +0 -1
  102. package/dist/webcomponents/p-d1c93dd3.js +0 -1
  103. package/dist/webcomponents/p-e19589a2.js +0 -1
@@ -1 +1 @@
1
- import{r as t,h as e,H as i,c as s}from"./p-2783e363.js";import{i as a}from"./p-4cc3c7f9.js";import{i as o,b as n,a as d,c as r,y as c,z as h}from"./p-ef4c49b9.js";import{c as l,F as f}from"./p-5844a0f0.js";import{u as b,l as m,k as u,m as p,n as y,q as v}from"./p-af834eb8.js";import{S as k}from"./p-6078a370.js";import{n as w}from"./p-e3c22aa9.js";import{c as g}from"./p-5a62fca2.js";import{H as j}from"./p-8a94d2c8.js";import{a as _}from"./p-6fbd6abb.js";import{j as x,b as C}from"./p-f4722957.js";import"./p-f20b6ce1.js";import"./p-0ea387a2.js";import"./p-275f2154.js";import"./p-1ff8810b.js";import"./p-abdbcd8e.js";const M=class{constructor(e){t(this,e)}async validate(){const t=await this.accountNumberIframeElement.validate(),e=await this.routingNumberIframeElement.validate();return t&&e}async tokenize(t,e,i){return this.accountNumberIframeElement.tokenize(t,e,i)}render(){return e(i,{key:"d0f0426565fedc6697eb46e6bc8d03d31eee9c37"},e("div",{key:"6e792d5cba9421d7d106805d0e0e070ef5b116f9",class:"container-fluid p-0"},e("div",{key:"89def9b854a7dc9a2e2fbb62d70bc6eaccfa6b0f",class:"row mb-3"},e("iframe-input",{key:"2c0392ed840edb2364922c0d523f509ea84b3cd3",inputId:"accountNumber",ref:t=>this.accountNumberIframeElement=t,label:"Account Number",iframeOrigin:"https://components.justifi.ai/v1/accountNumber"})),e("div",{key:"6dbe7911ab8693a4850a60e2d86f4539382a341c",class:"row"},e("iframe-input",{key:"042153db083d7fa8f4e6d2c5704054fbcf6c1af1",inputId:"routingNumber",ref:t=>this.routingNumberIframeElement=t,label:"Routing Number",iframeOrigin:"https://components.justifi.ai/v1/routingNumber"}))))}},S=class{constructor(e){t(this,e)}async validate(){const t=await this.cardNumberIframeElement.validate(),e=await this.expirationMonthIframeElement.validate(),i=await this.expirationYearIframeElement.validate(),s=await this.cvvIframeElement.validate();return t&&e&&i&&s}async tokenize(t,e,i){return this.cardNumberIframeElement.tokenize(t,e,i)}render(){return e(i,{key:"d667f365a95a2251fadffce158033ca8fcbc5723",class:"container-fluid p-0"},e("div",{key:"43d8e15de893154c96b49ea1917046120daa8b2c",class:"mb-3"},e("iframe-input",{key:"c342a50a3194511edfbe6c1f1033bf47b743ddd6",inputId:"cardNumber",ref:t=>this.cardNumberIframeElement=t,label:"Card Number",iframeOrigin:"https://components.justifi.ai/v1/cardNumber"})),e("div",{key:"2fa70e85071ec6fe4525039de6215026795f71f4",class:"row"},e("div",{key:"e7dba59f040258e556664ccf84549edda8a1dd8d",class:"col-4 align-content-end"},e("iframe-input",{key:"0c2c63ee318b0fc61ff704ffe02160aee252d281",inputId:"expirationMonth",ref:t=>this.expirationMonthIframeElement=t,label:"Expiration",iframeOrigin:"https://components.justifi.ai/v1/expirationMonth"})),e("div",{key:"e211c9bc9cb15ea9571af7d965fcb1d6e4c5669d",class:"col-4 align-content-end"},e("iframe-input",{key:"d783cb0d28f1d08826e773efc14c2aa871905a83",inputId:"expirationYear",ref:t=>this.expirationYearIframeElement=t,label:"",iframeOrigin:"https://components.justifi.ai/v1/expirationYear"})),e("div",{key:"83af611f578e7db1984713047708e725c9c1c7b5",class:"col-4 align-content-end"},e("iframe-input",{key:"1f53fce0b7856b8591f6454a549e123fa408be5f",inputId:"CVV",ref:t=>this.cvvIframeElement=t,label:"CVV",iframeOrigin:"https://components.justifi.ai/v1/CVV"}))))}},z=class{constructor(e){t(this,e),this.isFocused=!1,this.errorText=""}async componentDidLoad(){const t=await this.getBaseFontStyles();a("fontStyles",t);const e=await this.getFocusedStyles();a("focused",e);const i=await this.getFocusedAndInvalidStyles();a("focusedAndInvalid",i)}async getBaseFontStyles(){return new Promise((t=>{setTimeout((()=>{const e=getComputedStyle(this.hiddenInput);t({fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,lineHeight:e.lineHeight,margin:e.margin,padding:e.padding,color:e.color})}),500)}))}async getFocusedStyles(){return new Promise((t=>{this.hiddenInput.focus(),setTimeout((()=>{this.hiddenInput.blur();let e=getComputedStyle(this.hiddenInput);t({boxShadow:e.boxShadow,border:e.border})}),500)}))}async getFocusedAndInvalidStyles(){return new Promise((t=>{this.hiddenInput.focus(),this.errorText="Error",setTimeout((()=>{const e=getComputedStyle(this.hiddenInput),i={boxShadow:e.boxShadow,border:e.border};this.hiddenInput.blur(),t(i)}),500)}))}get part(){return this.isFocused&&this.errorText?o:this.errorText?n:this.isFocused?d:r}render(){return e(i,{key:"61734f69c30d37c98e3896c8407225dbe49fe3a2"},e("input",{key:"eda00a901e028a09ccd793b1fbc4136a048a0aad",ref:t=>this.hiddenInput=t,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"}}))}},O=l({name:b.required("Enter full name"),address_line1:m.required("Enter street address"),address_line2:u.nullable(),address_city:p.required("Enter city"),address_state:y.required("Select state"),address_postal_code:v.required("Enter postal code")}),V=class{constructor(e){t(this,e),this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))},this.legend=void 0,this.formController=void 0,this.billingInfo=void 0,this.errors={}}componentWillLoad(){this.formController=new f(O)}componentDidLoad(){this.formController.values.subscribe((t=>this.billingInfo=Object.assign({},t))),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}async getValues(){return this.formController.values.getValue()}async fill(t){this.formController.setInitialValues(t)}async validate(){return{isValid:await this.formController.validate()}}render(){const t=this.formController.getInitialValues();return e(i,{key:"b3bb548839b39a87ad330b9048426baff317cae0"},e("form",{key:"32e999825e5094e8e5399d46f67b67186f18d7b2"},e("fieldset",{key:"c8f13e2d392c45804bb51907a21ff80cb1148fd3"},this.legend&&e("legend",{key:"c4117087a3391f8c28815069d832d6133459b250"},this.legend),e("div",{key:"61d9de519f93d42bab36670108a6b923e30cff7f",class:"row gy-3"},e("div",{key:"4753e297cbab92db6f073e9679ea9f3e9dacf432",class:"col-12"},e("form-control-text",{key:"1f366def4cd8449cc242eb3bd71952a1548def08",name:"name",label:"Full Name",defaultValue:t.name,errorText:this.errors.name,inputHandler:this.inputHandler})),e("div",{key:"c7efc6968d6f776be84ac16b56a785965a81501b",class:"col-12"},e("form-control-text",{key:"789ca132aabfe42381ce55ec343494b9ac766e73",name:"address_line1",label:"Street Address",defaultValue:t.address_line1,errorText:this.errors.address_line1,inputHandler:this.inputHandler})),e("div",{key:"f750e3800a361e78c58a31091b8d07437fe7fdcf",class:"col-12"},e("form-control-text",{key:"66e06c53dec8b254bf5f7b1d4029c17523f2ceb7",name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:t.address_line2,errorText:this.errors.address_line2,inputHandler:this.inputHandler})),e("div",{key:"9868c2a9bcbed8c65ac8ca8d89ea2102fd0dd1c6",class:"col-12"},e("form-control-text",{key:"a637775b91a89fa32c54c97e6a97ec18b2e69024",name:"address_city",label:"City",defaultValue:t.address_city,errorText:this.errors.address_city,inputHandler:this.inputHandler})),e("div",{key:"274656a1a879790c99a684da3aa6070f473e2d0b",class:"col-12"},e("form-control-select",{key:"5fca9ff62f2e2f26fc936474133dbdf24183e86d",name:"address_state",label:"State",options:k,defaultValue:t.address_state,errorText:this.errors.address_state,inputHandler:this.inputHandler})),e("div",{key:"e24b2e9961e1a464a1d99fa4982814e7d43c5a79",class:"col-12"},e("form-control-text",{key:"1992d68c496b1331a0efbbbeb03153f9155a77d3",name:"address_postal_code",label:"ZIP",defaultValue:t.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:w}))))))}},N={bankAccount:"New bank account",card:"New credit or debit card"},P=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=s(this,"paymentMethodOptionSelected",7),this.onPaymentMethodOptionClick=t=>{t.preventDefault(),this.paymentMethodOptionSelected.emit(this.paymentMethodOption)},this.iframeOrigin=g.iframeOrigin,this.authToken=void 0,this.accountId=void 0,this.paymentMethodOption=void 0,this.paymentMethodGroupId=void 0,this.isSelected=void 0,this.saveNewPaymentMethodChecked=!1}handleCheckboxChanged(t){this.saveNewPaymentMethodChecked=t.detail}async fillBillingForm(t){this.billingFormRef.fill(t)}async resolvePaymentMethod(t){var e,i;if(this.paymentMethodFormRef&&this.billingFormRef)try{if(!await this.validate()||!t.isValid)return{validationError:!0};const s=await this.tokenize();if(s.error)return{error:s.error};{const t=s.data;return{token:(null===(e=t.card)||void 0===e?void 0:e.token)||(null===(i=t.bank_account)||void 0===i?void 0:i.token)}}}catch(t){return{error:t}}}async validate(){const t=await this.billingFormRef.validate(),e=await this.paymentMethodFormRef.validate();return t.isValid&&e.isValid}async tokenize(){try{const t=await this.billingFormRef.getValues();let e;e=this.saveNewPaymentMethodChecked?Object.assign(Object.assign({},t),{payment_method_group_id:this.paymentMethodGroupId}):Object.assign({},t);const i=this.authToken;return await this.paymentMethodFormRef.tokenize(i,e,this.accountId)}catch(t){return t}}showNewPaymentMethodForm(){var t;return e("div",{class:"mt-4 pb-4 border-bottom"},e("hidden-input",null),e("div",{class:"mb-4"},"card"===(null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id)?e("card-form",{ref:t=>this.paymentMethodFormRef=t}):e("bank-account-form",{ref:t=>this.paymentMethodFormRef=t})),e("div",{part:c},e(j,{text:"Billing address",class:"fs-6 fw-bold lh-lg mb-4"}),e("justifi-billing-form",{ref:t=>this.billingFormRef=t})),e("justifi-save-new-payment-method",{hidden:!this.paymentMethodGroupId}))}render(){var t,s;return e(i,{key:"4b6e52ca95845aa1c9163f4d3eafbfc98ca51deb",class:"payment-method"},e("div",{key:"d4aea7115ff71564a4d1e87a468174a29a040406",class:"radio-list-item p-3",part:h,onClick:this.onPaymentMethodOptionClick},e("form-control-radio",{key:"0204f84a72bb89e03772894f208895359370714b",name:"paymentMethodType",value:null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id,checked:this.isSelected,label:N[null===(s=this.paymentMethodOption)||void 0===s?void 0:s.id]})),this.isSelected?this.showNewPaymentMethodForm():null)}};class T{constructor(t){this.id=t.id,this.brand=t.brand,this.acct_last_four=t.acct_last_four,this.type=x(t.type)}}var F;!function(t){t.american_express="American Express",t.diners_club="Diners Club",t.discover="Discover",t.jcb="JCB",t.mastercard="Mastercard",t.china_unionpay="UnionPay",t.visa="Visa",t.unknown="Unknown"}(F||(F={}));const E=class{constructor(e){t(this,e),this.toggleCreatingNewPaymentMethod=s(this,"toggleCreatingNewPaymentMethod",7),this.showCard=void 0,this.showAch=void 0,this.showBnpl=void 0,this.showSavedPaymentMethods=void 0,this.paymentMethodGroupId=void 0,this.bnpl=void 0,this.insuranceToggled=void 0,this.authToken=void 0,this.accountId=void 0,this.iframeOrigin=g.iframeOrigin,this.savedPaymentMethods=[],this.paymentAmount=void 0,this.selectedPaymentMethodId=void 0,this.paymentMethodOptions=[]}async fillBillingForm(t){const e=this.selectedPaymentMethodOptionRef;e.fillBillingForm&&e.fillBillingForm(t)}connectedCallback(){this.paymentMethodsChanged()}paymentMethodsChanged(){var t,e;this.paymentMethodOptions=this.savedPaymentMethods.map((t=>new T(t))).filter((t=>(this.showCard||t.type!==_.card)&&(this.showAch||t.type!==_.bankAccount))),this.showBnpl&&"sezzle"===(null===(t=this.bnpl)||void 0===t?void 0:t.provider)&&!this.insuranceToggled&&this.paymentMethodOptions.push(new T({id:_.sezzle})),this.showCard&&this.paymentMethodOptions.push(new T({id:_.card})),this.showAch&&this.paymentMethodOptions.push(new T({id:_.bankAccount})),this.selectedPaymentMethodId||(this.selectedPaymentMethodId=null===(e=this.paymentMethodOptions[0])||void 0===e?void 0:e.id)}paymentMethodOptionSelected(t){this.selectedPaymentMethodId=t.detail.id}async resolvePaymentMethod(t){var e;return await(null===(e=this.selectedPaymentMethodOptionRef)||void 0===e?void 0:e.resolvePaymentMethod(t))}render(){var t;return e(i,{key:"3ab3caf94332163f031ecebe101d45c35e1416bd"},null===(t=this.paymentMethodOptions)||void 0===t?void 0:t.map((t=>{const i=this.selectedPaymentMethodId===t.id,s=t.id===_.sezzle;return t.id===_.card||t.id===_.bankAccount?e("justifi-new-payment-method",{paymentMethodOption:t,authToken:this.authToken,"account-id":this.accountId,"is-selected":i,paymentMethodGroupId:this.paymentMethodGroupId,ref:t=>{i&&(this.selectedPaymentMethodOptionRef=t)}}):s?e("justifi-sezzle-payment-method",{paymentMethodOption:t,"is-selected":i,paymentAmount:this.paymentAmount,bnpl:this.bnpl,ref:t=>{i&&(this.selectedPaymentMethodOptionRef=t)}}):this.showSavedPaymentMethods?e("justifi-saved-payment-method",{paymentMethodOption:t,"is-selected":i,ref:t=>{i&&(this.selectedPaymentMethodOptionRef=t)}}):void 0})))}static get watchers(){return{savedPaymentMethods:["paymentMethodsChanged"]}}},H=class{constructor(e){t(this,e),this.checkboxChanged=s(this,"checkboxChanged",7),this.isChecked=!1}handleCheckboxChange(t,e){this.isChecked=e,this.checkboxChanged.emit(this.isChecked)}render(){return e("div",{key:"4b0ac5e02aa02214bf8ddd574db56eb9508b0607",class:"mt-4 form-check"},e("form-control-checkbox",{key:"bca05c6b8fa00dd7bbc34ee36ef6086ae1764b82",label:"Save new payment method",name:"saveNewPaymentMethod",checked:this.isChecked,inputHandler:this.handleCheckboxChange.bind(this)}))}},I=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=s(this,"paymentMethodOptionSelected",7),this.onPaymentMethodOptionClick=t=>{t.preventDefault(),this.paymentMethodOptionSelected.emit(this.paymentMethodOption)},this.iframeOrigin=g.iframeOrigin,this.paymentMethodOption=void 0,this.isSelected=void 0}async resolvePaymentMethod(t){var e;return t.isValid?{token:null===(e=this.paymentMethodOption)||void 0===e?void 0:e.id}:{validationError:!0}}render(){var t,s,a;return e(i,{key:"8e5a11a58cf828356df001461b6bb3163521f1ed",class:"payment-method"},e("div",{key:"c20a8a3dcea1f885b94c4829b85be8d6f401ad42",class:"radio-list-item p-3",part:h,onClick:this.onPaymentMethodOptionClick},e("form-control-radio",{key:"72b970f6808e9f938869195fa29217f44b44250e",name:"paymentMethodType",value:null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id,checked:this.isSelected,label:`${F[null===(s=this.paymentMethodOption)||void 0===s?void 0:s.brand]||""} *${null===(a=this.paymentMethodOption)||void 0===a?void 0:a.acct_last_four}`})))}},A=e("img",{class:"sezzle-smart-button-logo-img",src:"https://media.sezzle.com/branding/2.0/Sezzle_Logo_FullColor.svg",alt:"Sezzle",style:{display:"inline",width:"80px",marginLeft:"5px",marginTop:"-5px"}}),B=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=s(this,"paymentMethodOptionSelected",7),this.onPaymentMethodOptionClick=t=>{t.preventDefault(),this.paymentMethodOptionSelected.emit(this.paymentMethodOption)},this.initializeSezzleCheckout=()=>{let t;this.sezzlePromise=new Promise((e=>{t=e}));const e=this.bnpl,i=+this.paymentAmount,s=new(0,window.Checkout)({mode:"popup",publicKey:e.provider_client_id,apiMode:e.provider_mode,apiVersion:e.provider_api_version});s.sezzleButtonElement=this.sezzleButtonRef,s.init({onClick:function(t){t.preventDefault(),s.startCheckout({checkout_url:e.provider_checkout_url})},onComplete:e=>t({bnpl:e.data}),onCancel:e=>t({bnpl:e.data}),onFailure:e=>t({bnpl:e.data})}),this.sezzleCheckout=s,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(i)},this.iframeOrigin=g.iframeOrigin,this.bnpl=void 0,this.clientId=void 0,this.accountId=void 0,this.paymentMethodOption=void 0,this.isSelected=void 0,this.paymentAmount=void 0,this.installmentPlan=void 0,this.sezzleCheckout=void 0,this.sezzlePromise=void 0}componentDidRender(){this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()}}async resolvePaymentMethod(t){return t.isValid?(this.sezzleButtonRef.click(),this.sezzlePromise):{validationError:!0}}render(){var t,s,a;return e(i,{key:"bbe1a2f4a2418d8c9e946e15567f7df89ac06084",class:"payment-method"},e("script",{key:"a254fbb032a531a889d81297053be07001262706",src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),e("div",{key:"691439a9541b69f59fac8ed744d633a7cba69fbd",class:"radio-list-item p-3",part:h,onClick:this.onPaymentMethodOptionClick},e("form-control-radio",{key:"4f03055cf993502ff1999abfbd14aa5e6977b811",name:"paymentMethodType",value:null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id,checked:this.isSelected,label:e("div",null,e("div",null,"Buy now, pay later with ",A),this.installmentPlan&&e("small",null,e("span",null,null===(s=this.installmentPlan)||void 0===s?void 0:s.installments.length)," ",e("span",null,this.installmentPlan.schedule," payments of")," ",e("span",{class:"fw-bold"},C(null===(a=this.installmentPlan)||void 0===a?void 0:a.installments[0].amountInCents))))})))}};export{M as bank_account_form,S as card_form,z as hidden_input,V as justifi_billing_form,P as justifi_new_payment_method,E as justifi_payment_method_options,H as justifi_save_new_payment_method,I as justifi_saved_payment_method,B as justifi_sezzle_payment_method}
1
+ import{r as t,h as e,H as i,c as s}from"./p-2783e363.js";import{i as a}from"./p-4cc3c7f9.js";import{i as o,b as n,a as d,c as r,y as c,z as h}from"./p-ef4c49b9.js";import{c as l,F as f}from"./p-5844a0f0.js";import{u as b,l as m,k as u,m as p,n as y,q as v}from"./p-af834eb8.js";import{S as k}from"./p-6078a370.js";import{n as w}from"./p-e3c22aa9.js";import{c as g}from"./p-0f23ff58.js";import{H as j}from"./p-8a94d2c8.js";import{a as _}from"./p-6fbd6abb.js";import{j as x,b as C}from"./p-f4722957.js";import"./p-f20b6ce1.js";import"./p-0ea387a2.js";import"./p-275f2154.js";import"./p-1ff8810b.js";import"./p-abdbcd8e.js";const M=class{constructor(e){t(this,e)}async validate(){const t=await this.accountNumberIframeElement.validate(),e=await this.routingNumberIframeElement.validate();return t&&e}async tokenize(t,e,i){return this.accountNumberIframeElement.tokenize(t,e,i)}render(){return e(i,{key:"d0f0426565fedc6697eb46e6bc8d03d31eee9c37"},e("div",{key:"6e792d5cba9421d7d106805d0e0e070ef5b116f9",class:"container-fluid p-0"},e("div",{key:"89def9b854a7dc9a2e2fbb62d70bc6eaccfa6b0f",class:"row mb-3"},e("iframe-input",{key:"2c0392ed840edb2364922c0d523f509ea84b3cd3",inputId:"accountNumber",ref:t=>this.accountNumberIframeElement=t,label:"Account Number",iframeOrigin:"https://components.justifi.ai/v2/accountNumber"})),e("div",{key:"6dbe7911ab8693a4850a60e2d86f4539382a341c",class:"row"},e("iframe-input",{key:"042153db083d7fa8f4e6d2c5704054fbcf6c1af1",inputId:"routingNumber",ref:t=>this.routingNumberIframeElement=t,label:"Routing Number",iframeOrigin:"https://components.justifi.ai/v2/routingNumber"}))))}},S=class{constructor(e){t(this,e)}async validate(){const t=await this.cardNumberIframeElement.validate(),e=await this.expirationMonthIframeElement.validate(),i=await this.expirationYearIframeElement.validate(),s=await this.cvvIframeElement.validate();return t&&e&&i&&s}async tokenize(t,e,i){return this.cardNumberIframeElement.tokenize(t,e,i)}render(){return e(i,{key:"d667f365a95a2251fadffce158033ca8fcbc5723",class:"container-fluid p-0"},e("div",{key:"43d8e15de893154c96b49ea1917046120daa8b2c",class:"mb-3"},e("iframe-input",{key:"c342a50a3194511edfbe6c1f1033bf47b743ddd6",inputId:"cardNumber",ref:t=>this.cardNumberIframeElement=t,label:"Card Number",iframeOrigin:"https://components.justifi.ai/v2/cardNumber"})),e("div",{key:"2fa70e85071ec6fe4525039de6215026795f71f4",class:"row"},e("div",{key:"e7dba59f040258e556664ccf84549edda8a1dd8d",class:"col-4 align-content-end"},e("iframe-input",{key:"0c2c63ee318b0fc61ff704ffe02160aee252d281",inputId:"expirationMonth",ref:t=>this.expirationMonthIframeElement=t,label:"Expiration",iframeOrigin:"https://components.justifi.ai/v2/expirationMonth"})),e("div",{key:"e211c9bc9cb15ea9571af7d965fcb1d6e4c5669d",class:"col-4 align-content-end"},e("iframe-input",{key:"d783cb0d28f1d08826e773efc14c2aa871905a83",inputId:"expirationYear",ref:t=>this.expirationYearIframeElement=t,label:"",iframeOrigin:"https://components.justifi.ai/v2/expirationYear"})),e("div",{key:"83af611f578e7db1984713047708e725c9c1c7b5",class:"col-4 align-content-end"},e("iframe-input",{key:"1f53fce0b7856b8591f6454a549e123fa408be5f",inputId:"CVV",ref:t=>this.cvvIframeElement=t,label:"CVV",iframeOrigin:"https://components.justifi.ai/v2/CVV"}))))}},z=class{constructor(e){t(this,e),this.isFocused=!1,this.errorText=""}async componentDidLoad(){const t=await this.getBaseFontStyles();a("fontStyles",t);const e=await this.getFocusedStyles();a("focused",e);const i=await this.getFocusedAndInvalidStyles();a("focusedAndInvalid",i)}async getBaseFontStyles(){return new Promise((t=>{setTimeout((()=>{const e=getComputedStyle(this.hiddenInput);t({fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,lineHeight:e.lineHeight,margin:e.margin,padding:e.padding,color:e.color})}),500)}))}async getFocusedStyles(){return new Promise((t=>{this.hiddenInput.focus(),setTimeout((()=>{this.hiddenInput.blur();let e=getComputedStyle(this.hiddenInput);t({boxShadow:e.boxShadow,border:e.border})}),500)}))}async getFocusedAndInvalidStyles(){return new Promise((t=>{this.hiddenInput.focus(),this.errorText="Error",setTimeout((()=>{const e=getComputedStyle(this.hiddenInput),i={boxShadow:e.boxShadow,border:e.border};this.hiddenInput.blur(),t(i)}),500)}))}get part(){return this.isFocused&&this.errorText?o:this.errorText?n:this.isFocused?d:r}render(){return e(i,{key:"61734f69c30d37c98e3896c8407225dbe49fe3a2"},e("input",{key:"eda00a901e028a09ccd793b1fbc4136a048a0aad",ref:t=>this.hiddenInput=t,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"}}))}},O=l({name:b.required("Enter full name"),address_line1:m.required("Enter street address"),address_line2:u.nullable(),address_city:p.required("Enter city"),address_state:y.required("Select state"),address_postal_code:v.required("Enter postal code")}),V=class{constructor(e){t(this,e),this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))},this.legend=void 0,this.formController=void 0,this.billingInfo=void 0,this.errors={}}componentWillLoad(){this.formController=new f(O)}componentDidLoad(){this.formController.values.subscribe((t=>this.billingInfo=Object.assign({},t))),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}async getValues(){return this.formController.values.getValue()}async fill(t){this.formController.setInitialValues(t)}async validate(){return{isValid:await this.formController.validate()}}render(){const t=this.formController.getInitialValues();return e(i,{key:"b3bb548839b39a87ad330b9048426baff317cae0"},e("form",{key:"32e999825e5094e8e5399d46f67b67186f18d7b2"},e("fieldset",{key:"c8f13e2d392c45804bb51907a21ff80cb1148fd3"},this.legend&&e("legend",{key:"c4117087a3391f8c28815069d832d6133459b250"},this.legend),e("div",{key:"61d9de519f93d42bab36670108a6b923e30cff7f",class:"row gy-3"},e("div",{key:"4753e297cbab92db6f073e9679ea9f3e9dacf432",class:"col-12"},e("form-control-text",{key:"1f366def4cd8449cc242eb3bd71952a1548def08",name:"name",label:"Full Name",defaultValue:t.name,errorText:this.errors.name,inputHandler:this.inputHandler})),e("div",{key:"c7efc6968d6f776be84ac16b56a785965a81501b",class:"col-12"},e("form-control-text",{key:"789ca132aabfe42381ce55ec343494b9ac766e73",name:"address_line1",label:"Street Address",defaultValue:t.address_line1,errorText:this.errors.address_line1,inputHandler:this.inputHandler})),e("div",{key:"f750e3800a361e78c58a31091b8d07437fe7fdcf",class:"col-12"},e("form-control-text",{key:"66e06c53dec8b254bf5f7b1d4029c17523f2ceb7",name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:t.address_line2,errorText:this.errors.address_line2,inputHandler:this.inputHandler})),e("div",{key:"9868c2a9bcbed8c65ac8ca8d89ea2102fd0dd1c6",class:"col-12"},e("form-control-text",{key:"a637775b91a89fa32c54c97e6a97ec18b2e69024",name:"address_city",label:"City",defaultValue:t.address_city,errorText:this.errors.address_city,inputHandler:this.inputHandler})),e("div",{key:"274656a1a879790c99a684da3aa6070f473e2d0b",class:"col-12"},e("form-control-select",{key:"5fca9ff62f2e2f26fc936474133dbdf24183e86d",name:"address_state",label:"State",options:k,defaultValue:t.address_state,errorText:this.errors.address_state,inputHandler:this.inputHandler})),e("div",{key:"e24b2e9961e1a464a1d99fa4982814e7d43c5a79",class:"col-12"},e("form-control-text",{key:"1992d68c496b1331a0efbbbeb03153f9155a77d3",name:"address_postal_code",label:"ZIP",defaultValue:t.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:w}))))))}},N={bankAccount:"New bank account",card:"New credit or debit card"},P=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=s(this,"paymentMethodOptionSelected",7),this.onPaymentMethodOptionClick=t=>{t.preventDefault(),this.paymentMethodOptionSelected.emit(this.paymentMethodOption)},this.iframeOrigin=g.iframeOrigin,this.authToken=void 0,this.accountId=void 0,this.paymentMethodOption=void 0,this.paymentMethodGroupId=void 0,this.isSelected=void 0,this.saveNewPaymentMethodChecked=!1}handleCheckboxChanged(t){this.saveNewPaymentMethodChecked=t.detail}async fillBillingForm(t){this.billingFormRef.fill(t)}async resolvePaymentMethod(t){var e,i;if(this.paymentMethodFormRef&&this.billingFormRef)try{if(!await this.validate()||!t.isValid)return{validationError:!0};const s=await this.tokenize();if(s.error)return{error:s.error};{const t=s.data;return{token:(null===(e=t.card)||void 0===e?void 0:e.token)||(null===(i=t.bank_account)||void 0===i?void 0:i.token)}}}catch(t){return{error:t}}}async validate(){const t=await this.billingFormRef.validate(),e=await this.paymentMethodFormRef.validate();return t.isValid&&e.isValid}async tokenize(){try{const t=await this.billingFormRef.getValues();let e;e=this.saveNewPaymentMethodChecked?Object.assign(Object.assign({},t),{payment_method_group_id:this.paymentMethodGroupId}):Object.assign({},t);const i=this.authToken;return await this.paymentMethodFormRef.tokenize(i,e,this.accountId)}catch(t){return t}}showNewPaymentMethodForm(){var t;return e("div",{class:"mt-4 pb-4 border-bottom"},e("hidden-input",null),e("div",{class:"mb-4"},"card"===(null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id)?e("card-form",{ref:t=>this.paymentMethodFormRef=t}):e("bank-account-form",{ref:t=>this.paymentMethodFormRef=t})),e("div",{part:c},e(j,{text:"Billing address",class:"fs-6 fw-bold lh-lg mb-4"}),e("justifi-billing-form",{ref:t=>this.billingFormRef=t})),e("justifi-save-new-payment-method",{hidden:!this.paymentMethodGroupId}))}render(){var t,s;return e(i,{key:"4b6e52ca95845aa1c9163f4d3eafbfc98ca51deb",class:"payment-method"},e("div",{key:"d4aea7115ff71564a4d1e87a468174a29a040406",class:"radio-list-item p-3",part:h,onClick:this.onPaymentMethodOptionClick},e("form-control-radio",{key:"0204f84a72bb89e03772894f208895359370714b",name:"paymentMethodType",value:null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id,checked:this.isSelected,label:N[null===(s=this.paymentMethodOption)||void 0===s?void 0:s.id]})),this.isSelected?this.showNewPaymentMethodForm():null)}};class T{constructor(t){this.id=t.id,this.brand=t.brand,this.acct_last_four=t.acct_last_four,this.type=x(t.type)}}var F;!function(t){t.american_express="American Express",t.diners_club="Diners Club",t.discover="Discover",t.jcb="JCB",t.mastercard="Mastercard",t.china_unionpay="UnionPay",t.visa="Visa",t.unknown="Unknown"}(F||(F={}));const E=class{constructor(e){t(this,e),this.toggleCreatingNewPaymentMethod=s(this,"toggleCreatingNewPaymentMethod",7),this.showCard=void 0,this.showAch=void 0,this.showBnpl=void 0,this.showSavedPaymentMethods=void 0,this.paymentMethodGroupId=void 0,this.bnpl=void 0,this.insuranceToggled=void 0,this.authToken=void 0,this.accountId=void 0,this.iframeOrigin=g.iframeOrigin,this.savedPaymentMethods=[],this.paymentAmount=void 0,this.selectedPaymentMethodId=void 0,this.paymentMethodOptions=[]}async fillBillingForm(t){const e=this.selectedPaymentMethodOptionRef;e.fillBillingForm&&e.fillBillingForm(t)}connectedCallback(){this.paymentMethodsChanged()}paymentMethodsChanged(){var t,e;this.paymentMethodOptions=this.savedPaymentMethods.map((t=>new T(t))).filter((t=>(this.showCard||t.type!==_.card)&&(this.showAch||t.type!==_.bankAccount))),this.showBnpl&&"sezzle"===(null===(t=this.bnpl)||void 0===t?void 0:t.provider)&&!this.insuranceToggled&&this.paymentMethodOptions.push(new T({id:_.sezzle})),this.showCard&&this.paymentMethodOptions.push(new T({id:_.card})),this.showAch&&this.paymentMethodOptions.push(new T({id:_.bankAccount})),this.selectedPaymentMethodId||(this.selectedPaymentMethodId=null===(e=this.paymentMethodOptions[0])||void 0===e?void 0:e.id)}paymentMethodOptionSelected(t){this.selectedPaymentMethodId=t.detail.id}async resolvePaymentMethod(t){var e;return await(null===(e=this.selectedPaymentMethodOptionRef)||void 0===e?void 0:e.resolvePaymentMethod(t))}render(){var t;return e(i,{key:"3ab3caf94332163f031ecebe101d45c35e1416bd"},null===(t=this.paymentMethodOptions)||void 0===t?void 0:t.map((t=>{const i=this.selectedPaymentMethodId===t.id,s=t.id===_.sezzle;return t.id===_.card||t.id===_.bankAccount?e("justifi-new-payment-method",{paymentMethodOption:t,authToken:this.authToken,"account-id":this.accountId,"is-selected":i,paymentMethodGroupId:this.paymentMethodGroupId,ref:t=>{i&&(this.selectedPaymentMethodOptionRef=t)}}):s?e("justifi-sezzle-payment-method",{paymentMethodOption:t,"is-selected":i,paymentAmount:this.paymentAmount,bnpl:this.bnpl,ref:t=>{i&&(this.selectedPaymentMethodOptionRef=t)}}):this.showSavedPaymentMethods?e("justifi-saved-payment-method",{paymentMethodOption:t,"is-selected":i,ref:t=>{i&&(this.selectedPaymentMethodOptionRef=t)}}):void 0})))}static get watchers(){return{savedPaymentMethods:["paymentMethodsChanged"]}}},H=class{constructor(e){t(this,e),this.checkboxChanged=s(this,"checkboxChanged",7),this.isChecked=!1}handleCheckboxChange(t,e){this.isChecked=e,this.checkboxChanged.emit(this.isChecked)}render(){return e("div",{key:"4b0ac5e02aa02214bf8ddd574db56eb9508b0607",class:"mt-4 form-check"},e("form-control-checkbox",{key:"bca05c6b8fa00dd7bbc34ee36ef6086ae1764b82",label:"Save new payment method",name:"saveNewPaymentMethod",checked:this.isChecked,inputHandler:this.handleCheckboxChange.bind(this)}))}},I=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=s(this,"paymentMethodOptionSelected",7),this.onPaymentMethodOptionClick=t=>{t.preventDefault(),this.paymentMethodOptionSelected.emit(this.paymentMethodOption)},this.iframeOrigin=g.iframeOrigin,this.paymentMethodOption=void 0,this.isSelected=void 0}async resolvePaymentMethod(t){var e;return t.isValid?{token:null===(e=this.paymentMethodOption)||void 0===e?void 0:e.id}:{validationError:!0}}render(){var t,s,a;return e(i,{key:"8e5a11a58cf828356df001461b6bb3163521f1ed",class:"payment-method"},e("div",{key:"c20a8a3dcea1f885b94c4829b85be8d6f401ad42",class:"radio-list-item p-3",part:h,onClick:this.onPaymentMethodOptionClick},e("form-control-radio",{key:"72b970f6808e9f938869195fa29217f44b44250e",name:"paymentMethodType",value:null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id,checked:this.isSelected,label:`${F[null===(s=this.paymentMethodOption)||void 0===s?void 0:s.brand]||""} *${null===(a=this.paymentMethodOption)||void 0===a?void 0:a.acct_last_four}`})))}},A=e("img",{class:"sezzle-smart-button-logo-img",src:"https://media.sezzle.com/branding/2.0/Sezzle_Logo_FullColor.svg",alt:"Sezzle",style:{display:"inline",width:"80px",marginLeft:"5px",marginTop:"-5px"}}),B=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=s(this,"paymentMethodOptionSelected",7),this.onPaymentMethodOptionClick=t=>{t.preventDefault(),this.paymentMethodOptionSelected.emit(this.paymentMethodOption)},this.initializeSezzleCheckout=()=>{let t;this.sezzlePromise=new Promise((e=>{t=e}));const e=this.bnpl,i=+this.paymentAmount,s=new(0,window.Checkout)({mode:"popup",publicKey:e.provider_client_id,apiMode:e.provider_mode,apiVersion:e.provider_api_version});s.sezzleButtonElement=this.sezzleButtonRef,s.init({onClick:function(t){t.preventDefault(),s.startCheckout({checkout_url:e.provider_checkout_url})},onComplete:e=>t({bnpl:e.data}),onCancel:e=>t({bnpl:e.data}),onFailure:e=>t({bnpl:e.data})}),this.sezzleCheckout=s,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(i)},this.iframeOrigin=g.iframeOrigin,this.bnpl=void 0,this.clientId=void 0,this.accountId=void 0,this.paymentMethodOption=void 0,this.isSelected=void 0,this.paymentAmount=void 0,this.installmentPlan=void 0,this.sezzleCheckout=void 0,this.sezzlePromise=void 0}componentDidRender(){this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()}}async resolvePaymentMethod(t){return t.isValid?(this.sezzleButtonRef.click(),this.sezzlePromise):{validationError:!0}}render(){var t,s,a;return e(i,{key:"bbe1a2f4a2418d8c9e946e15567f7df89ac06084",class:"payment-method"},e("script",{key:"a254fbb032a531a889d81297053be07001262706",src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),e("div",{key:"691439a9541b69f59fac8ed744d633a7cba69fbd",class:"radio-list-item p-3",part:h,onClick:this.onPaymentMethodOptionClick},e("form-control-radio",{key:"4f03055cf993502ff1999abfbd14aa5e6977b811",name:"paymentMethodType",value:null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id,checked:this.isSelected,label:e("div",null,e("div",null,"Buy now, pay later with ",A),this.installmentPlan&&e("small",null,e("span",null,null===(s=this.installmentPlan)||void 0===s?void 0:s.installments.length)," ",e("span",null,this.installmentPlan.schedule," payments of")," ",e("span",{class:"fw-bold"},C(null===(a=this.installmentPlan)||void 0===a?void 0:a.installments[0].amountInCents))))})))}};export{M as bank_account_form,S as card_form,z as hidden_input,V as justifi_billing_form,P as justifi_new_payment_method,E as justifi_payment_method_options,H as justifi_save_new_payment_method,I as justifi_saved_payment_method,B as justifi_sezzle_payment_method}
@@ -1 +1 @@
1
- import{r as i,c as t,h as s}from"./p-2783e363.js";import{C as r,a as e}from"./p-14c91ffd.js";import{c as a,J as o}from"./p-174b151e.js";import{c as n}from"./p-5a62fca2.js";import{A as c}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import{T as h}from"./p-3db8b3c7.js";import{g as p,a as m}from"./p-8115b2f4.js";import{m as d,S as l}from"./p-cb00d4f3.js";import{S as u}from"./p-bfe9748b.js";import{d as b}from"./p-4a576796.js";import"./p-af620972.js";import"./p-abdbcd8e.js";import"./p-ef4c49b9.js";class f{async fetchTerminals(i,t,s,r){r||(r=n.proxyApiOrigin);const e={Account:i};return c({authToken:t,apiOrigin:r}).get("terminals",s,null,e)}async fetchTerminal(i,t,s){s||(s=n.proxyApiOrigin);const r=`terminals/${i}`;return c({authToken:t,apiOrigin:s}).get(r)}}const j=class{constructor(s){i(this,s),this.errorEvent=t(this,"error-event",7),this.handleErrorEvent=i=>{this.errorMessage=i.detail.message,this.errorEvent.emit(i.detail)},this.getTerminals=void 0,this.getSubAccounts=void 0,this.errorMessage=null,this.accountId=void 0,this.authToken=void 0,this.apiOrigin=n.proxyApiOrigin,this.columns=b}componentWillLoad(){a(),this.analytics=new o(this),this.initializeGetData()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:i,authToken:t,service:s,apiOrigin:e})=>async({params:a,onSuccess:o,onError:n})=>{var c,d;try{const l=await s.fetchTerminals(i,t,a,e);if(l.error)return n({error:p(l.error),code:m(null===(d=l.error)||void 0===d?void 0:d.code),severity:r.ERROR});{const i=Object.assign({},l.page_info);o({terminals:(null===(c=l.data)||void 0===c?void 0:c.map((i=>new h(i))))||[],pagingInfo:i})}}catch(i){const t=m(null==i?void 0:i.code);return n({error:i.message||i,code:t,severity:r.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new f,apiOrigin:this.apiOrigin}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:r.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=d({accountId:this.accountId,authToken:this.authToken,service:new l,apiOrigin:this.apiOrigin}))}render(){return s(u,{key:"202c9b2b8492e03f999cb8c62aa71871068e46d6"},s("terminals-list-core",{key:"eca0f2a0b076eb92b33bbb3703650506a5e1377b",getTerminals:this.getTerminals,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{j as justifi_terminals_list}
1
+ import{r as i,c as t,h as s}from"./p-2783e363.js";import{C as e,a as r}from"./p-14c91ffd.js";import{c as o,J as a}from"./p-5456a794.js";import{c as n}from"./p-0f23ff58.js";import{A as c}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import{T as h}from"./p-3db8b3c7.js";import{g as p,a as m}from"./p-8115b2f4.js";import{m as d,S as l}from"./p-db8c12ee.js";import{S as u}from"./p-bfe9748b.js";import{d as b}from"./p-4a576796.js";import"./p-a07b1816.js";import"./p-abdbcd8e.js";import"./p-ef4c49b9.js";class f{async fetchTerminals(i,t,s,e){e||(e=n.proxyApiOrigin);const r={Account:i};return c({authToken:t,apiOrigin:e}).get("terminals",s,null,r)}async fetchTerminal(i,t,s){s||(s=n.proxyApiOrigin);const e=`terminals/${i}`;return c({authToken:t,apiOrigin:s}).get(e)}}const j=class{constructor(s){i(this,s),this.errorEvent=t(this,"error-event",7),this.handleErrorEvent=i=>{this.errorMessage=i.detail.message,this.errorEvent.emit(i.detail)},this.getTerminals=void 0,this.getSubAccounts=void 0,this.errorMessage=null,this.accountId=void 0,this.authToken=void 0,this.apiOrigin=n.proxyApiOrigin,this.columns=b}componentWillLoad(){o(),this.analytics=new a(this),this.initializeGetData()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:i,authToken:t,service:s,apiOrigin:r})=>async({params:o,onSuccess:a,onError:n})=>{var c,d;try{const l=await s.fetchTerminals(i,t,o,r);if(l.error)return n({error:p(l.error),code:m(null===(d=l.error)||void 0===d?void 0:d.code),severity:e.ERROR});{const i=Object.assign({},l.page_info);a({terminals:(null===(c=l.data)||void 0===c?void 0:c.map((i=>new h(i))))||[],pagingInfo:i})}}catch(i){const t=m(null==i?void 0:i.code);return n({error:i.message||i,code:t,severity:e.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new f,apiOrigin:this.apiOrigin}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:r.MISSING_PROPS,message:this.errorMessage,severity:e.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=d({accountId:this.accountId,authToken:this.authToken,service:new l,apiOrigin:this.apiOrigin}))}render(){return s(u,{key:"202c9b2b8492e03f999cb8c62aa71871068e46d6"},s("terminals-list-core",{key:"eca0f2a0b076eb92b33bbb3703650506a5e1377b",getTerminals:this.getTerminals,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{j as justifi_terminals_list}
@@ -1 +1 @@
1
- import{p as t}from"./p-af620972.js";import{c as s}from"./p-5a62fca2.js";import{A as i}from"./p-0e180654.js";class e{async record(t){return i({apiOrigin:s.proxyApiOrigin}).post("analytics",t)}}class a{constructor(t){this.handleCustomEvent=async t=>{await this.service.record(t)},this.service=new e,this.componentInstance=t,this.setUpBasicData(),this.setupLifecycleTracking(),this.trackCustomEvents()}get resourceId(){return this.componentInstance.accountId||this.componentInstance.businessId||this.componentInstance.paymentId||this.componentInstance.payoutId||this.componentInstance.checkoutId}setUpBasicData(){this.basicData={component_name:this.componentInstance.tagName,component_version:t.version,client_user_agent:navigator.userAgent,client_platform:navigator.userAgent,client_origin:window.location.origin,resource_id:this.resourceId}}trackCustomEvents(){this.eventEmitters=["submit-event","error-event"],this.eventEmitters.forEach((t=>{"function"==typeof this.componentInstance.addEventListener&&this.componentInstance.addEventListener(t,(s=>this.handleCustomEvent({event_type:t,data:Object.assign(Object.assign({},this.basicData),{error:s.detail})})))}))}setupLifecycleTracking(){const t=this.componentInstance.componentDidLoad;this.componentInstance.componentDidLoad=()=>{if(this.service.record({event_type:"init",data:this.basicData}),t)return t.apply(this.componentInstance)}}cleanup(){this.eventEmitters.forEach((t=>{this.componentInstance.removeEventListener(t,this.handleCustomEvent)}))}}const n=async()=>{const s=t.version,i=t.name,e=await(async t=>{const s=await fetch("https://registry.npmjs.org/"+t+"/latest");return(await s.json()).version})(i),a=e.replace(/-rc.*/,""),n=s.split("."),r=e.split(".");n[0]!==r[0]&&console.warn(`The package ${i} is out of date. The latest version is ${a}. Please update.`)};export{a as J,n as c}
1
+ import{p as t}from"./p-a07b1816.js";import{c as s}from"./p-0f23ff58.js";import{A as i}from"./p-0e180654.js";class e{async record(t){return i({apiOrigin:s.proxyApiOrigin}).post("analytics",t)}}class a{constructor(t){this.handleCustomEvent=async t=>{await this.service.record(t)},this.service=new e,this.componentInstance=t,this.setUpBasicData(),this.setupLifecycleTracking(),this.trackCustomEvents()}get resourceId(){return this.componentInstance.accountId||this.componentInstance.businessId||this.componentInstance.paymentId||this.componentInstance.payoutId||this.componentInstance.checkoutId}setUpBasicData(){this.basicData={component_name:this.componentInstance.tagName,component_version:t.version,client_user_agent:navigator.userAgent,client_platform:navigator.userAgent,client_origin:window.location.origin,resource_id:this.resourceId}}trackCustomEvents(){this.eventEmitters=["submit-event","error-event"],this.eventEmitters.forEach((t=>{"function"==typeof this.componentInstance.addEventListener&&this.componentInstance.addEventListener(t,(s=>this.handleCustomEvent({event_type:t,data:Object.assign(Object.assign({},this.basicData),{error:s.detail})})))}))}setupLifecycleTracking(){const t=this.componentInstance.componentDidLoad;this.componentInstance.componentDidLoad=()=>{if(this.service.record({event_type:"init",data:this.basicData}),t)return t.apply(this.componentInstance)}}cleanup(){this.eventEmitters.forEach((t=>{this.componentInstance.removeEventListener(t,this.handleCustomEvent)}))}}const n=async()=>{const s=t.version,i=t.name,e=await(async t=>{const s=await fetch("https://registry.npmjs.org/"+t+"/latest");return(await s.json()).version})(i),a=e.replace(/-rc.*/,""),n=s.split("."),r=e.split(".");n[0]!==r[0]&&console.warn(`The package ${i} is out of date. The latest version is ${a}. Please update.`)};export{a as J,n as c}
@@ -1 +1 @@
1
- import{r as s,c as t,h as e,H as i}from"./p-2783e363.js";import{a,C as n}from"./p-14c91ffd.js";import{m as o,b as r}from"./p-5968ff8a.js";import{B as h}from"./p-f6f8dabc.js";import{c,F as d,e as u}from"./p-5844a0f0.js";import{z as f,A as l,u as b,B as p,C as m,D as v,E as y,F as g,G as k,H as _,I as w,J as j,K as T,L as C,M as O}from"./p-af834eb8.js";import{A as S}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{c as x}from"./p-5a62fca2.js";import{n as I}from"./p-e3c22aa9.js";import{h as A}from"./p-ef4c49b9.js";import{c as L}from"./p-0ea387a2.js";import{a as F,B}from"./p-73f9be7c.js";import{B as E}from"./p-275f2154.js";import{S as D}from"./p-0cc6c539.js";import{B as H}from"./p-32a5bf4e.js";import"./p-8115b2f4.js";import"./p-6078a370.js";import"./p-abdbcd8e.js";import"./p-1ff8810b.js";const P=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e("justifi-additional-questions-form-step-core",{key:"bef3e4d67c4ccbb25dae52291ba9a399e854fb53",getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};class W{constructor(s){this.id=s.id,this.account_owner_name=s.account_owner_name,this.full_name=s.full_name,this.account_type=s.account_type,this.acct_last_four=s.acct_last_four,this.account_number_last4=s.account_number_last4,this.routing_number=s.routing_number,this.bank_name=s.bank_name,this.country=s.country,this.currency=s.currency,this.nickname=s.nickname,this.metadata=s.metadata,this.business_id=s.business_id,this.platform_account_id=s.platform_account_id,this.created_at=s.created_at,this.updated_at=s.updated_at}}const q=class{constructor(e){s(this,e),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.errorEvent=t(this,"error-event",7),this.formLoading=t(this,"formLoading",7),this.fetchData=async()=>{this.formLoading.emit(!0);try{const s=await this.api.get(this.businessEndpoint);this.bankAccount=Object.assign({},new W(s.data.bank_accounts.length>0?s.data.bank_accounts[0]:{})),this.formController.setInitialValues(Object.assign({},this.bankAccount))}catch(s){this.errorEvent.emit({errorCode:a.FETCH_ERROR,message:s.message,severity:n.ERROR,data:s})}finally{this.formLoading.emit(!1)}},this.sendData=async s=>{this.formLoading.emit(!0);try{const t=this.formController.values.getValue(),e=Object.assign(Object.assign({},t),{business_id:this.businessId}),i=await this.api.post(this.bankAccountEndpoint,e);this.handleResponse(i,s)}catch(s){this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.message,severity:n.ERROR,data:s})}finally{this.formLoading.emit(!1)}},this.inputHandler=(s,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[s]:t}))},this.formController=void 0,this.errors={},this.bankAccount=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}get businessEndpoint(){return`entities/business/${this.businessId}`}get bankAccountEndpoint(){return"entities/bank_accounts"}get formDisabled(){var s;return!!(null===(s=this.bankAccount)||void 0===s?void 0:s.id)}handleResponse(s,t){s.error?this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.error.message,severity:n.ERROR,data:s.error}):t(),this.stepCompleteEvent.emit({response:s,formStep:F.bankAccount})}async validateAndSubmit({onSuccess:s}){this.formDisabled?(this.stepCompleteEvent.emit({response:null,formStep:F.bankAccount,metadata:"no data submitted"}),s()):this.formController.validateAndSubmit((()=>this.sendData(s)))}componentWillLoad(){this.formController=new d((s=>{const t=c({bank_name:f.required("Enter bank name"),nickname:l.required("Enter nickname"),account_owner_name:b.required("Enter account owner name"),account_type:p.required("Select account type"),account_number:m.required("Enter account number"),routing_number:v.required("Enter routing number")}),e=c({bank_name:f.nullable(),nickname:l.nullable(),account_owner_name:b.nullable(),account_type:p.nullable(),account_number:m.nullable(),routing_number:v.nullable()});return s?e:t})(this.allowOptionalFields)),this.api=S({authToken:this.authToken,apiOrigin:x.proxyApiOrigin}),this.businessId&&this.authToken&&this.fetchData()}componentDidLoad(){this.formController.values.subscribe((s=>this.bankAccount=Object.assign({},s))),this.formController.errors.subscribe((s=>{this.errors=Object.assign({},s)}))}render(){const s=this.formController.getInitialValues();return e("form",{key:"d326af8d567422ee342571d35119497cd5983a7f"},e("fieldset",{key:"4ada14e070e9f9b1f12aa3288af50e78c8d7e2f3"},e("div",{key:"e9e104ca5ddd22fbddb2154d026ec0cb6610426a",class:"d-flex align-items-center gap-2"},e("legend",{key:"7800c3648bebce9ca000162e3c85f0cc558f045e",class:"mb-0",part:A},"Bank Account Info"),e("form-control-tooltip",{key:"3dbc31dfc1f7f60b68f10f2666e58ae208bb36cb",helpText:"The Direct Deposit Account is the business bank account where your funds will be deposited. The name of this account must match the registered business name exactly. We are not able to accept personal accounts unless your business is a registered sole proprietorship."})),e("hr",{key:"489cf91c3af1050ee1f0babe8fa6ba7fa9d1912d",class:"mt-2"}),e("div",{key:"cace0eee0e8b9849294b11bad15452b77dcd9ee9",class:"row gy-3"},e("div",{key:"0697524d52d53ccfab7201e1f06c0f8f477c8da7",class:"col-12"},e("form-control-text",{key:"b391b6e7e3f9c1c92f5bb651da2291ca75afc7f3",name:"bank_name",label:"Bank Name",defaultValue:s.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler,disabled:this.formDisabled})),e("div",{key:"84afc5c90399809d228561e348f4a6f5fbeeaa48",class:"col-12"},e("form-control-text",{key:"add80854eae161c51dfc3006e8f03ef01113291c",name:"nickname",label:"Nickname",defaultValue:s.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler,disabled:this.formDisabled})),e("div",{key:"f5d31db2be25a09b6f57b78fcac9b6031077d235",class:"col-12"},e("form-control-text",{key:"5a916bfbad467bd2a55f0159716c29cb78d4d9d0",name:"account_owner_name",label:"Account Owner Name",defaultValue:s.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler,disabled:this.formDisabled})),e("div",{key:"ebce663decaf9bd6b46794b820197c7ba8a450cc",class:"col-12"},e("form-control-select",{key:"dd42e72741934d015a1d405b09e7c14b8f865606",name:"account_type",label:"Account Type",options:L,defaultValue:s.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler,disabled:this.formDisabled})),e("div",{key:"2fa3139ed30465e1e0f9a5075eb13e9c3874aa0a",class:"col-12"},e("form-control-text",{key:"f309563391770bd1074b7c29b47c39c5c7ecec5f",name:"account_number",label:"Account Number",defaultValue:s.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:I,disabled:this.formDisabled,helpText:"Please copy the account number as shown on your statement/check. Do not include spaces or dashes."})),e("div",{key:"80424fa942fe444ba9137e724ecd50fb4839c59f",class:"col-12"},e("form-control-text",{key:"c5e08a9cdbb11c92e3271d6507f6bd3225abdf2f",name:"routing_number",label:"Routing Number",defaultValue:s.routing_number,maxLength:9,errorText:this.errors.routing_number,inputHandler:this.inputHandler,keyDownHandler:I,disabled:this.formDisabled,helpText:"A valid routing number is nine digits. Please include any leading or trailing zeroes."})))))}},V=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e("justifi-business-core-info-form-step-core",{key:"fbaca40250e3cabd3a1ec91f1a10aab53174a23e",businessId:this.businessId,getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},z=class{constructor(e){s(this,e),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.errorEvent=t(this,"error-event",7),this.formLoading=t(this,"formLoading",7),this.inputHandler=(s,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[s]:t}))},this.fetchData=async()=>{this.renderState="loading",this.formLoading.emit(!0);try{const s=await this.api.get(this.businessEndpoint);this.business=Object.assign({},new E(s.data)),this.existingDocuments=s.data.documents,this.paymentVolume=s.data.additional_questions.business_payment_volume}catch(s){this.errorEvent.emit({errorCode:a.FETCH_ERROR,message:s.message,severity:n.ERROR,data:s}),this.renderState="error"}finally{this.initializeFormController(),this.formLoading.emit(!1),this.renderState="success"}},this.initializeFormController=()=>{this.formController=new d(((s,t,e)=>{const i=c({voided_check:y(t,e),government_id:g.nullable(),ss4:k.nullable(),other:_.nullable(),balance_sheet:w(s,t,e),bank_statement:j(s,t,e),profit_and_loss_statement:T(s,t,e)}),a=c({voided_check:y(t,e),government_id:g.nullable(),ss4:k.nullable(),other:_.nullable(),balance_sheet:w(s,t,e),bank_statement:j(s,t,e),profit_and_loss_statement:T(s,t,e)});return e?a:i})(this.paymentVolume,this.existingDocuments,this.allowOptionalFields)),this.formController.errors.subscribe((s=>{this.errors=Object.assign({},s)}))},this.createDocumentRecord=async s=>{this.formLoading.emit(!0);const t=s.record_data;try{const e=await this.api.post(this.documentEndpoint,t);return this.handleDocRecordResponse(s,e)}catch(s){return this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.message,severity:n.ERROR,data:s}),!1}},this.handleDocRecordResponse=(s,t)=>t.error?(this.errorEvent.emit({errorCode:a.POST_ERROR,message:t.error.message,severity:n.ERROR,data:t.error}),!1):(s.setPresignedUrl(t.data.presigned_url),!0),this.uploadDocument=async s=>{if(!s.presigned_url)throw new Error("Presigned URL is not set");const t=await fetch(s.presigned_url,{method:"PUT",body:s.fileString});return this.handleUploadResponse(t)},this.handleUploadResponse=s=>s.error?(this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.error.message,severity:n.ERROR,data:s.error}),!1):(this.stepCompleteEvent.emit({response:s,formStep:F.documentUpload}),!0),this.storeFiles=s=>{const t=Array.from(s.detail.fileList),e=s.detail.document_type,i=t.map((s=>new C({file:s,document_type:e},this.businessId)));this.documentData[e]=i},this.sendData=async s=>{try{const t=Object.values(this.documentData).flat();if(!t.length)return this.stepCompleteEvent.emit({response:null,formStep:F.documentUpload,metadata:"no data submitted"}),s();const e=t.map((s=>this.createDocumentRecord(s)));if(!await Promise.all(e))return;const i=t.map((s=>this.uploadDocument(s)));if(!await Promise.all(i))return;await s()}finally{this.formLoading.emit(!1)}},this.formController=void 0,this.errors={},this.existingDocuments=[],this.paymentVolume=void 0,this.business=void 0,this.documentData=new O,this.renderState="loading",this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}get businessEndpoint(){return`entities/business/${this.businessId}`}get documentEndpoint(){return"entities/document"}componentWillLoad(){this.api=S({authToken:this.authToken,apiOrigin:x.proxyApiOrigin}),this.businessId&&this.authToken&&this.fetchData()}async validateAndSubmit({onSuccess:s}){this.formController.validateAndSubmit((()=>this.sendData(s)))}get isLoading(){return"loading"===this.renderState}get isError(){return"error"===this.renderState}get documentsOnFile(){return this.isError?null:this.isLoading?e(D,{height:"50px"}):e("justifi-business-documents-on-file",{documents:this.existingDocuments})}get formInputs(){return this.isError?null:this.isLoading?e(D,{height:"350px"}):e("justifi-business-document-upload-input-group",{paymentVolume:this.paymentVolume,inputHandler:this.inputHandler,storeFiles:this.storeFiles,errors:this.errors})}render(){return e("form",{key:"0d59a81a25ce1b983e1cc1e076072fc60f277829"},e("fieldset",{key:"806183bf7a2b7bd49f11be8f8e66685360b392d8"},e("div",{key:"22e1914c580e90acbf0cc295ed878c2f4d3cb12f",class:"d-flex align-items-center gap-2"},e("legend",{key:"88369a06ab43a76c477a6af93672364fd101a7d2",class:"mb-0",part:A},"Document Uploads"),e("form-control-tooltip",{key:"ccbff3cea2f17156a358a82de3e5e8afa87e2ab5",helpText:"Various file formats such as PDF, DOC, DOCX, JPEG, and others are accepted. Multiple files can be uploaded for each document category."})),e("hr",{key:"e99c7eba9c7605244bee06ae4c0fa4954cafb99a",class:"mt-2"}),this.documentsOnFile,e("div",{key:"ddbeda2a9740d2a20becde70f5f8113e4a327dc7",class:"d-flex flex-column"},this.formInputs)))}},M=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e(i,{key:"2f5256be2313b3916c1f0d7a69d2b27b305cf66c"},e("justifi-business-owners-form-step-core",{key:"2c8d3c4cb731b3cf58cf1cc71df2a52c72f660cc",authToken:this.authToken,businessId:this.businessId,getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s}))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},N=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e("justifi-business-representative-form-step-core",{key:"24461e0acb80a0161fb796c3ee35f511601f707e",getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},R=class{constructor(e){s(this,e),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.errorEvent=t(this,"error-event",7),this.formLoading=t(this,"formLoading",7),this.formCompleted=t(this,"formCompleted",7),this.fetchData=async()=>{this.formLoading.emit(!0);try{const s=await this.api.get(this.businessEndpoint);this.acceptedTermsBefore=s.data.terms_conditions_accepted}catch(s){this.errorEvent.emit({errorCode:a.FETCH_ERROR,message:s.message,severity:n.ERROR,data:s})}finally{this.formLoading.emit(!1)}},this.sendData=async s=>{this.formLoading.emit(!0);try{const t=this.termsPayload,e=await this.api.post(this.termsConditionsEndpoint,t);this.handleResponse(e,s)}catch(s){this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.message,severity:n.ERROR,data:s})}finally{this.formLoading.emit(!1)}},this.inputHandler=(s,t)=>{this.acceptedTerms=t,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[s]:t}))},this.formController=void 0,this.errors={},this.acceptedTermsBefore=void 0,this.acceptedTerms=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}get businessEndpoint(){return`entities/business/${this.businessId}`}get termsConditionsEndpoint(){return"entities/terms_and_conditions"}get formHelperText(){return this.acceptedTermsBefore?"You have already accepted the terms and conditions.":null}get termsPayload(){return{business_id:this.businessId,accepted:this.formController.values.getValue().accepted,user_agent:window.navigator.userAgent}}async componentWillLoad(){this.api=S({authToken:this.authToken,apiOrigin:x.proxyApiOrigin}),this.formController=new d((s=>{const t=c({accepted:u().oneOf([!0],"You must agree to the terms and conditions to continue").required("You must agree to the terms and conditions to continue")}),e=c({accepted:u().nullable()});return s?e:t})(this.allowOptionalFields)),this.businessId&&this.authToken&&this.fetchData()}handleResponse(s,t){s.error?this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.error.message,severity:n.ERROR,data:s.error}):t(),this.stepCompleteEvent.emit({response:s,formStep:F.termsAndConditions}),this.formCompleted.emit()}async validateAndSubmit({onSuccess:s}){this.acceptedTermsBefore?(this.stepCompleteEvent.emit({response:null,formStep:F.termsAndConditions,metadata:"no data submitted"}),this.formCompleted.emit(),s()):this.formController.validateAndSubmit((()=>this.sendData(s)))}componentDidLoad(){this.formController.errors.subscribe((s=>{this.errors=Object.assign({},s)}))}render(){return e("form",{key:"acbe79a11f280351401eed6722db5f033cf3f889"},e("fieldset",{key:"dceb358d0578dca96ab26433dc056296854359cd"},e("legend",{key:"81c73a6eab1654a1da56031bdd83cdc2a13dfb2d",part:A},"Terms and Conditions"),e("hr",{key:"24c0e396766b7c5c925d50d05154913eeee1fca0"}),e("justifi-business-terms-conditions-text",{key:"dc0634fa35ae5f74105b0c7711d9e53254f5f555"}),e("br",{key:"cd3abfa1415477fad5014a6a28c6a99b9205d2c6"}),e("div",{key:"21d395c38900bf670df836cbf5aff7a9336081c1",class:"row-gy-3"},e("div",{key:"1930a06c942c99121b00b569215b388eb0d3e953",class:"col-12"},e("form-control-checkbox",{key:"ebf7dc7ec3fbabdcebac51e13df0e15aa48dfe25",name:"accepted",label:"I agree to the terms and conditions",inputHandler:this.inputHandler,errorText:this.errors.accepted,disabled:this.acceptedTermsBefore,helpText:this.formHelperText,checked:this.acceptedTerms})))))}},U=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e("justifi-legal-address-form-step-core",{key:"66973db19fe252e82b8e44f875aef6e6de4f519d",getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Y=class{constructor(t){s(this,t),this.currentStep=void 0,this.totalSteps=void 0,this.formLoading=void 0,this.formDisabled=void 0,this.previousStepButtonOnClick=void 0,this.nextStepButtonOnClick=void 0}get showPreviousStepButton(){return this.currentStep>0}get showNextStepButton(){return this.currentStep<this.totalSteps}get showSubmitButton(){return this.currentStep===this.totalSteps}render(){return e("div",{key:"e1ab54d1e838fcf447bc27cb7a24360c683d6ad8",class:"d-flex gap-2"},e(H,{key:"203ce170dcd2c39edbd238cdacbd5a778d6e3a39",variant:"secondary",type:"button",onClick:()=>this.previousStepButtonOnClick(),disabled:this.formDisabled,hidden:!this.showPreviousStepButton},"Previous"),e(H,{key:"820000f2ffc9a3d037b12ca11b724169de0747b8",variant:"primary",type:"button",onClick:s=>this.nextStepButtonOnClick(s,B.nextStep),disabled:this.formDisabled,isLoading:this.formLoading,hidden:!this.showNextStepButton},"Next"),e(H,{key:"5da1da1e44963c1138b4ecf9619b43f7ff0caa06",variant:"primary",type:"submit",onClick:s=>this.nextStepButtonOnClick(s,B.submit),disabled:this.formDisabled,isLoading:this.formLoading,hidden:!this.showSubmitButton},"Submit"))}},$=class{constructor(t){s(this,t),this.componentStepMapping={0:()=>e("justifi-business-core-info-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[0]=s,allowOptionalFields:this.allowOptionalFields}),1:()=>e("justifi-legal-address-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[1]=s,allowOptionalFields:this.allowOptionalFields}),2:()=>e("justifi-additional-questions-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[2]=s,allowOptionalFields:this.allowOptionalFields}),3:()=>e("justifi-business-representative-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[3]=s,allowOptionalFields:this.allowOptionalFields}),4:()=>e("justifi-business-owners-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[4]=s,allowOptionalFields:this.allowOptionalFields}),5:()=>e("justifi-business-bank-account-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[5]=s,onFormLoading:this.handleFormLoading,allowOptionalFields:this.allowOptionalFields}),6:()=>e("justifi-business-document-upload-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[6]=s,onFormLoading:this.handleFormLoading,allowOptionalFields:this.allowOptionalFields}),7:()=>e("justifi-business-terms-conditions-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[7]=s,onFormLoading:this.handleFormLoading,allowOptionalFields:this.allowOptionalFields})},this.businessId=void 0,this.authToken=void 0,this.refs=void 0,this.currentStep=void 0,this.allowOptionalFields=!1,this.handleFormLoading=void 0}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}render(){return e("div",{key:"95db2f73894dc4adff2c17298f5f0791c8db463b",class:"col-12 mb-4"},this.currentStepComponent)}};export{P as justifi_additional_questions_form_step,q as justifi_business_bank_account_form_step,V as justifi_business_core_info_form_step,z as justifi_business_document_upload_form_step,M as justifi_business_owners_form_step,N as justifi_business_representative_form_step,R as justifi_business_terms_conditions_form_step,U as justifi_legal_address_form_step,Y as justifi_payment_provisioning_form_buttons,$ as justifi_payment_provisioning_form_steps}
1
+ import{r as s,c as t,h as e,H as i}from"./p-2783e363.js";import{a,C as n}from"./p-14c91ffd.js";import{m as o,b as r}from"./p-5968ff8a.js";import{B as h}from"./p-edb57087.js";import{c,F as d,e as u}from"./p-5844a0f0.js";import{z as f,A as l,u as b,B as p,C as m,D as v,E as y,F as g,G as k,H as _,I as w,J as j,K as T,L as C,M as O}from"./p-af834eb8.js";import{A as S}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{c as x}from"./p-0f23ff58.js";import{n as I}from"./p-e3c22aa9.js";import{h as A}from"./p-ef4c49b9.js";import{c as L}from"./p-0ea387a2.js";import{a as F,B}from"./p-73f9be7c.js";import{B as E}from"./p-275f2154.js";import{S as D}from"./p-0cc6c539.js";import{B as H}from"./p-32a5bf4e.js";import"./p-8115b2f4.js";import"./p-6078a370.js";import"./p-abdbcd8e.js";import"./p-1ff8810b.js";const P=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e("justifi-additional-questions-form-step-core",{key:"bef3e4d67c4ccbb25dae52291ba9a399e854fb53",getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};class W{constructor(s){this.id=s.id,this.account_owner_name=s.account_owner_name,this.full_name=s.full_name,this.account_type=s.account_type,this.acct_last_four=s.acct_last_four,this.account_number_last4=s.account_number_last4,this.routing_number=s.routing_number,this.bank_name=s.bank_name,this.country=s.country,this.currency=s.currency,this.nickname=s.nickname,this.metadata=s.metadata,this.business_id=s.business_id,this.platform_account_id=s.platform_account_id,this.created_at=s.created_at,this.updated_at=s.updated_at}}const q=class{constructor(e){s(this,e),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.errorEvent=t(this,"error-event",7),this.formLoading=t(this,"formLoading",7),this.fetchData=async()=>{this.formLoading.emit(!0);try{const s=await this.api.get(this.businessEndpoint);this.bankAccount=Object.assign({},new W(s.data.bank_accounts.length>0?s.data.bank_accounts[0]:{})),this.formController.setInitialValues(Object.assign({},this.bankAccount))}catch(s){this.errorEvent.emit({errorCode:a.FETCH_ERROR,message:s.message,severity:n.ERROR,data:s})}finally{this.formLoading.emit(!1)}},this.sendData=async s=>{this.formLoading.emit(!0);try{const t=this.formController.values.getValue(),e=Object.assign(Object.assign({},t),{business_id:this.businessId}),i=await this.api.post(this.bankAccountEndpoint,e);this.handleResponse(i,s)}catch(s){this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.message,severity:n.ERROR,data:s})}finally{this.formLoading.emit(!1)}},this.inputHandler=(s,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[s]:t}))},this.formController=void 0,this.errors={},this.bankAccount=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}get businessEndpoint(){return`entities/business/${this.businessId}`}get bankAccountEndpoint(){return"entities/bank_accounts"}get formDisabled(){var s;return!!(null===(s=this.bankAccount)||void 0===s?void 0:s.id)}handleResponse(s,t){s.error?this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.error.message,severity:n.ERROR,data:s.error}):t(),this.stepCompleteEvent.emit({response:s,formStep:F.bankAccount})}async validateAndSubmit({onSuccess:s}){this.formDisabled?(this.stepCompleteEvent.emit({response:null,formStep:F.bankAccount,metadata:"no data submitted"}),s()):this.formController.validateAndSubmit((()=>this.sendData(s)))}componentWillLoad(){this.formController=new d((s=>{const t=c({bank_name:f.required("Enter bank name"),nickname:l.required("Enter nickname"),account_owner_name:b.required("Enter account owner name"),account_type:p.required("Select account type"),account_number:m.required("Enter account number"),routing_number:v.required("Enter routing number")}),e=c({bank_name:f.nullable(),nickname:l.nullable(),account_owner_name:b.nullable(),account_type:p.nullable(),account_number:m.nullable(),routing_number:v.nullable()});return s?e:t})(this.allowOptionalFields)),this.api=S({authToken:this.authToken,apiOrigin:x.proxyApiOrigin}),this.businessId&&this.authToken&&this.fetchData()}componentDidLoad(){this.formController.values.subscribe((s=>this.bankAccount=Object.assign({},s))),this.formController.errors.subscribe((s=>{this.errors=Object.assign({},s)}))}render(){const s=this.formController.getInitialValues();return e("form",{key:"d326af8d567422ee342571d35119497cd5983a7f"},e("fieldset",{key:"4ada14e070e9f9b1f12aa3288af50e78c8d7e2f3"},e("div",{key:"e9e104ca5ddd22fbddb2154d026ec0cb6610426a",class:"d-flex align-items-center gap-2"},e("legend",{key:"7800c3648bebce9ca000162e3c85f0cc558f045e",class:"mb-0",part:A},"Bank Account Info"),e("form-control-tooltip",{key:"3dbc31dfc1f7f60b68f10f2666e58ae208bb36cb",helpText:"The Direct Deposit Account is the business bank account where your funds will be deposited. The name of this account must match the registered business name exactly. We are not able to accept personal accounts unless your business is a registered sole proprietorship."})),e("hr",{key:"489cf91c3af1050ee1f0babe8fa6ba7fa9d1912d",class:"mt-2"}),e("div",{key:"cace0eee0e8b9849294b11bad15452b77dcd9ee9",class:"row gy-3"},e("div",{key:"0697524d52d53ccfab7201e1f06c0f8f477c8da7",class:"col-12"},e("form-control-text",{key:"b391b6e7e3f9c1c92f5bb651da2291ca75afc7f3",name:"bank_name",label:"Bank Name",defaultValue:s.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler,disabled:this.formDisabled})),e("div",{key:"84afc5c90399809d228561e348f4a6f5fbeeaa48",class:"col-12"},e("form-control-text",{key:"add80854eae161c51dfc3006e8f03ef01113291c",name:"nickname",label:"Nickname",defaultValue:s.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler,disabled:this.formDisabled})),e("div",{key:"f5d31db2be25a09b6f57b78fcac9b6031077d235",class:"col-12"},e("form-control-text",{key:"5a916bfbad467bd2a55f0159716c29cb78d4d9d0",name:"account_owner_name",label:"Account Owner Name",defaultValue:s.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler,disabled:this.formDisabled})),e("div",{key:"ebce663decaf9bd6b46794b820197c7ba8a450cc",class:"col-12"},e("form-control-select",{key:"dd42e72741934d015a1d405b09e7c14b8f865606",name:"account_type",label:"Account Type",options:L,defaultValue:s.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler,disabled:this.formDisabled})),e("div",{key:"2fa3139ed30465e1e0f9a5075eb13e9c3874aa0a",class:"col-12"},e("form-control-text",{key:"f309563391770bd1074b7c29b47c39c5c7ecec5f",name:"account_number",label:"Account Number",defaultValue:s.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:I,disabled:this.formDisabled,helpText:"Please copy the account number as shown on your statement/check. Do not include spaces or dashes."})),e("div",{key:"80424fa942fe444ba9137e724ecd50fb4839c59f",class:"col-12"},e("form-control-text",{key:"c5e08a9cdbb11c92e3271d6507f6bd3225abdf2f",name:"routing_number",label:"Routing Number",defaultValue:s.routing_number,maxLength:9,errorText:this.errors.routing_number,inputHandler:this.inputHandler,keyDownHandler:I,disabled:this.formDisabled,helpText:"A valid routing number is nine digits. Please include any leading or trailing zeroes."})))))}},V=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e("justifi-business-core-info-form-step-core",{key:"fbaca40250e3cabd3a1ec91f1a10aab53174a23e",businessId:this.businessId,getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},z=class{constructor(e){s(this,e),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.errorEvent=t(this,"error-event",7),this.formLoading=t(this,"formLoading",7),this.inputHandler=(s,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[s]:t}))},this.fetchData=async()=>{this.renderState="loading",this.formLoading.emit(!0);try{const s=await this.api.get(this.businessEndpoint);this.business=Object.assign({},new E(s.data)),this.existingDocuments=s.data.documents,this.paymentVolume=s.data.additional_questions.business_payment_volume}catch(s){this.errorEvent.emit({errorCode:a.FETCH_ERROR,message:s.message,severity:n.ERROR,data:s}),this.renderState="error"}finally{this.initializeFormController(),this.formLoading.emit(!1),this.renderState="success"}},this.initializeFormController=()=>{this.formController=new d(((s,t,e)=>{const i=c({voided_check:y(t,e),government_id:g.nullable(),ss4:k.nullable(),other:_.nullable(),balance_sheet:w(s,t,e),bank_statement:j(s,t,e),profit_and_loss_statement:T(s,t,e)}),a=c({voided_check:y(t,e),government_id:g.nullable(),ss4:k.nullable(),other:_.nullable(),balance_sheet:w(s,t,e),bank_statement:j(s,t,e),profit_and_loss_statement:T(s,t,e)});return e?a:i})(this.paymentVolume,this.existingDocuments,this.allowOptionalFields)),this.formController.errors.subscribe((s=>{this.errors=Object.assign({},s)}))},this.createDocumentRecord=async s=>{this.formLoading.emit(!0);const t=s.record_data;try{const e=await this.api.post(this.documentEndpoint,t);return this.handleDocRecordResponse(s,e)}catch(s){return this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.message,severity:n.ERROR,data:s}),!1}},this.handleDocRecordResponse=(s,t)=>t.error?(this.errorEvent.emit({errorCode:a.POST_ERROR,message:t.error.message,severity:n.ERROR,data:t.error}),!1):(s.setPresignedUrl(t.data.presigned_url),!0),this.uploadDocument=async s=>{if(!s.presigned_url)throw new Error("Presigned URL is not set");const t=await fetch(s.presigned_url,{method:"PUT",body:s.fileString});return this.handleUploadResponse(t)},this.handleUploadResponse=s=>s.error?(this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.error.message,severity:n.ERROR,data:s.error}),!1):(this.stepCompleteEvent.emit({response:s,formStep:F.documentUpload}),!0),this.storeFiles=s=>{const t=Array.from(s.detail.fileList),e=s.detail.document_type,i=t.map((s=>new C({file:s,document_type:e},this.businessId)));this.documentData[e]=i},this.sendData=async s=>{try{const t=Object.values(this.documentData).flat();if(!t.length)return this.stepCompleteEvent.emit({response:null,formStep:F.documentUpload,metadata:"no data submitted"}),s();const e=t.map((s=>this.createDocumentRecord(s)));if(!await Promise.all(e))return;const i=t.map((s=>this.uploadDocument(s)));if(!await Promise.all(i))return;await s()}finally{this.formLoading.emit(!1)}},this.formController=void 0,this.errors={},this.existingDocuments=[],this.paymentVolume=void 0,this.business=void 0,this.documentData=new O,this.renderState="loading",this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}get businessEndpoint(){return`entities/business/${this.businessId}`}get documentEndpoint(){return"entities/document"}componentWillLoad(){this.api=S({authToken:this.authToken,apiOrigin:x.proxyApiOrigin}),this.businessId&&this.authToken&&this.fetchData()}async validateAndSubmit({onSuccess:s}){this.formController.validateAndSubmit((()=>this.sendData(s)))}get isLoading(){return"loading"===this.renderState}get isError(){return"error"===this.renderState}get documentsOnFile(){return this.isError?null:this.isLoading?e(D,{height:"50px"}):e("justifi-business-documents-on-file",{documents:this.existingDocuments})}get formInputs(){return this.isError?null:this.isLoading?e(D,{height:"350px"}):e("justifi-business-document-upload-input-group",{paymentVolume:this.paymentVolume,inputHandler:this.inputHandler,storeFiles:this.storeFiles,errors:this.errors})}render(){return e("form",{key:"0d59a81a25ce1b983e1cc1e076072fc60f277829"},e("fieldset",{key:"806183bf7a2b7bd49f11be8f8e66685360b392d8"},e("div",{key:"22e1914c580e90acbf0cc295ed878c2f4d3cb12f",class:"d-flex align-items-center gap-2"},e("legend",{key:"88369a06ab43a76c477a6af93672364fd101a7d2",class:"mb-0",part:A},"Document Uploads"),e("form-control-tooltip",{key:"ccbff3cea2f17156a358a82de3e5e8afa87e2ab5",helpText:"Various file formats such as PDF, DOC, DOCX, JPEG, and others are accepted. Multiple files can be uploaded for each document category."})),e("hr",{key:"e99c7eba9c7605244bee06ae4c0fa4954cafb99a",class:"mt-2"}),this.documentsOnFile,e("div",{key:"ddbeda2a9740d2a20becde70f5f8113e4a327dc7",class:"d-flex flex-column"},this.formInputs)))}},M=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e(i,{key:"2f5256be2313b3916c1f0d7a69d2b27b305cf66c"},e("justifi-business-owners-form-step-core",{key:"2c8d3c4cb731b3cf58cf1cc71df2a52c72f660cc",authToken:this.authToken,businessId:this.businessId,getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s}))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},N=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e("justifi-business-representative-form-step-core",{key:"24461e0acb80a0161fb796c3ee35f511601f707e",getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},R=class{constructor(e){s(this,e),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.errorEvent=t(this,"error-event",7),this.formLoading=t(this,"formLoading",7),this.formCompleted=t(this,"formCompleted",7),this.fetchData=async()=>{this.formLoading.emit(!0);try{const s=await this.api.get(this.businessEndpoint);this.acceptedTermsBefore=s.data.terms_conditions_accepted}catch(s){this.errorEvent.emit({errorCode:a.FETCH_ERROR,message:s.message,severity:n.ERROR,data:s})}finally{this.formLoading.emit(!1)}},this.sendData=async s=>{this.formLoading.emit(!0);try{const t=this.termsPayload,e=await this.api.post(this.termsConditionsEndpoint,t);this.handleResponse(e,s)}catch(s){this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.message,severity:n.ERROR,data:s})}finally{this.formLoading.emit(!1)}},this.inputHandler=(s,t)=>{this.acceptedTerms=t,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[s]:t}))},this.formController=void 0,this.errors={},this.acceptedTermsBefore=void 0,this.acceptedTerms=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}get businessEndpoint(){return`entities/business/${this.businessId}`}get termsConditionsEndpoint(){return"entities/terms_and_conditions"}get formHelperText(){return this.acceptedTermsBefore?"You have already accepted the terms and conditions.":null}get termsPayload(){return{business_id:this.businessId,accepted:this.formController.values.getValue().accepted,user_agent:window.navigator.userAgent}}async componentWillLoad(){this.api=S({authToken:this.authToken,apiOrigin:x.proxyApiOrigin}),this.formController=new d((s=>{const t=c({accepted:u().oneOf([!0],"You must agree to the terms and conditions to continue").required("You must agree to the terms and conditions to continue")}),e=c({accepted:u().nullable()});return s?e:t})(this.allowOptionalFields)),this.businessId&&this.authToken&&this.fetchData()}handleResponse(s,t){s.error?this.errorEvent.emit({errorCode:a.POST_ERROR,message:s.error.message,severity:n.ERROR,data:s.error}):t(),this.stepCompleteEvent.emit({response:s,formStep:F.termsAndConditions}),this.formCompleted.emit()}async validateAndSubmit({onSuccess:s}){this.acceptedTermsBefore?(this.stepCompleteEvent.emit({response:null,formStep:F.termsAndConditions,metadata:"no data submitted"}),this.formCompleted.emit(),s()):this.formController.validateAndSubmit((()=>this.sendData(s)))}componentDidLoad(){this.formController.errors.subscribe((s=>{this.errors=Object.assign({},s)}))}render(){return e("form",{key:"acbe79a11f280351401eed6722db5f033cf3f889"},e("fieldset",{key:"dceb358d0578dca96ab26433dc056296854359cd"},e("legend",{key:"81c73a6eab1654a1da56031bdd83cdc2a13dfb2d",part:A},"Terms and Conditions"),e("hr",{key:"24c0e396766b7c5c925d50d05154913eeee1fca0"}),e("justifi-business-terms-conditions-text",{key:"dc0634fa35ae5f74105b0c7711d9e53254f5f555"}),e("br",{key:"cd3abfa1415477fad5014a6a28c6a99b9205d2c6"}),e("div",{key:"21d395c38900bf670df836cbf5aff7a9336081c1",class:"row-gy-3"},e("div",{key:"1930a06c942c99121b00b569215b388eb0d3e953",class:"col-12"},e("form-control-checkbox",{key:"ebf7dc7ec3fbabdcebac51e13df0e15aa48dfe25",name:"accepted",label:"I agree to the terms and conditions",inputHandler:this.inputHandler,errorText:this.errors.accepted,disabled:this.acceptedTermsBefore,helpText:this.formHelperText,checked:this.acceptedTerms})))))}},U=class{constructor(e){s(this,e),this.errorEvent=t(this,"error-event",7),this.getBusiness=void 0,this.patchBusiness=void 0,this.authToken=void 0,this.businessId=void 0,this.allowOptionalFields=void 0}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:s}){this.coreComponent.validateAndSubmit({onSuccess:s})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=o({authToken:this.authToken,businessId:this.businessId,service:new h}),this.patchBusiness=r({authToken:this.authToken,businessId:this.businessId,service:new h})):this.errorEvent.emit({message:"Missing required props",errorCode:a.MISSING_PROPS,severity:n.ERROR})}render(){return e("justifi-legal-address-form-step-core",{key:"66973db19fe252e82b8e44f875aef6e6de4f519d",getBusiness:this.getBusiness,patchBusiness:this.patchBusiness,allowOptionalFields:this.allowOptionalFields,ref:s=>this.coreComponent=s})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Y=class{constructor(t){s(this,t),this.currentStep=void 0,this.totalSteps=void 0,this.formLoading=void 0,this.formDisabled=void 0,this.previousStepButtonOnClick=void 0,this.nextStepButtonOnClick=void 0}get showPreviousStepButton(){return this.currentStep>0}get showNextStepButton(){return this.currentStep<this.totalSteps}get showSubmitButton(){return this.currentStep===this.totalSteps}render(){return e("div",{key:"e1ab54d1e838fcf447bc27cb7a24360c683d6ad8",class:"d-flex gap-2"},e(H,{key:"203ce170dcd2c39edbd238cdacbd5a778d6e3a39",variant:"secondary",type:"button",onClick:()=>this.previousStepButtonOnClick(),disabled:this.formDisabled,hidden:!this.showPreviousStepButton},"Previous"),e(H,{key:"820000f2ffc9a3d037b12ca11b724169de0747b8",variant:"primary",type:"button",onClick:s=>this.nextStepButtonOnClick(s,B.nextStep),disabled:this.formDisabled,isLoading:this.formLoading,hidden:!this.showNextStepButton},"Next"),e(H,{key:"5da1da1e44963c1138b4ecf9619b43f7ff0caa06",variant:"primary",type:"submit",onClick:s=>this.nextStepButtonOnClick(s,B.submit),disabled:this.formDisabled,isLoading:this.formLoading,hidden:!this.showSubmitButton},"Submit"))}},$=class{constructor(t){s(this,t),this.componentStepMapping={0:()=>e("justifi-business-core-info-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[0]=s,allowOptionalFields:this.allowOptionalFields}),1:()=>e("justifi-legal-address-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[1]=s,allowOptionalFields:this.allowOptionalFields}),2:()=>e("justifi-additional-questions-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[2]=s,allowOptionalFields:this.allowOptionalFields}),3:()=>e("justifi-business-representative-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[3]=s,allowOptionalFields:this.allowOptionalFields}),4:()=>e("justifi-business-owners-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[4]=s,allowOptionalFields:this.allowOptionalFields}),5:()=>e("justifi-business-bank-account-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[5]=s,onFormLoading:this.handleFormLoading,allowOptionalFields:this.allowOptionalFields}),6:()=>e("justifi-business-document-upload-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[6]=s,onFormLoading:this.handleFormLoading,allowOptionalFields:this.allowOptionalFields}),7:()=>e("justifi-business-terms-conditions-form-step",{businessId:this.businessId,authToken:this.authToken,ref:s=>this.refs[7]=s,onFormLoading:this.handleFormLoading,allowOptionalFields:this.allowOptionalFields})},this.businessId=void 0,this.authToken=void 0,this.refs=void 0,this.currentStep=void 0,this.allowOptionalFields=!1,this.handleFormLoading=void 0}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}render(){return e("div",{key:"95db2f73894dc4adff2c17298f5f0791c8db463b",class:"col-12 mb-4"},this.currentStepComponent)}};export{P as justifi_additional_questions_form_step,q as justifi_business_bank_account_form_step,V as justifi_business_core_info_form_step,z as justifi_business_document_upload_form_step,M as justifi_business_owners_form_step,N as justifi_business_representative_form_step,R as justifi_business_terms_conditions_form_step,U as justifi_legal_address_form_step,Y as justifi_payment_provisioning_form_buttons,$ as justifi_payment_provisioning_form_steps}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i}from"./p-2783e363.js";import{C as e}from"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{C as o,a as r}from"./p-14c91ffd.js";import{g as a,a as c}from"./p-8115b2f4.js";import{c as h,J as n}from"./p-5456a794.js";import{c as p}from"./p-0f23ff58.js";import{C as d}from"./p-bb0f8b70.js";import{m as f,S as m}from"./p-db8c12ee.js";import{S as u}from"./p-bfe9748b.js";import{d as b}from"./p-6feeb9f2.js";import"./p-abdbcd8e.js";import"./p-a07b1816.js";import"./p-0e180654.js";import"./p-f4722957.js";import"./p-ef4c49b9.js";const j=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event",7),this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.getCheckouts=void 0,this.getSubAccounts=void 0,this.errorMessage=null,this.accountId=void 0,this.authToken=void 0,this.apiOrigin=p.proxyApiOrigin,this.columns=b}componentWillLoad(){h(),this.analytics=new n(this),this.initializeGetData()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetCheckouts(),this.initializeGetSubAccounts()}initializeGetCheckouts(){this.accountId&&this.authToken?this.getCheckouts=(({accountId:t,authToken:s,service:i,apiOrigin:r})=>async({params:h,onSuccess:n,onError:p})=>{var d,f;try{const m=await i.fetchCheckouts(t,s,h,r);if(m.error)return p({error:a(m.error),code:c(null===(f=m.error)||void 0===f?void 0:f.code),severity:o.ERROR});{const t=Object.assign({},m.page_info);n({checkouts:(null===(d=m.data)||void 0===d?void 0:d.map((t=>new e(t))))||[],pagingInfo:t})}}catch(t){const s=c(null==t?void 0:t.code);return p({error:t.message||t,code:s,severity:o.ERROR})}})({accountId:this.accountId,authToken:this.authToken,service:new d,apiOrigin:this.apiOrigin}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:r.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=f({accountId:this.accountId,authToken:this.authToken,service:new m,apiOrigin:this.apiOrigin}))}render(){return i(u,{key:"f96da05a065d13a24cb4de2cc114a0dc10833ab2"},i("checkouts-list-core",{key:"4e98c537644a3e22fb63d15736f5c22ff26a931f",getCheckouts:this.getCheckouts,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{j as justifi_checkouts_list}
@@ -0,0 +1 @@
1
+ import{A as t}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{c as a}from"./p-0f23ff58.js";import{C as o}from"./p-14c91ffd.js";import{g as r,a as s}from"./p-8115b2f4.js";class p{async fetchPayouts(o,r,s,p){return p||(p=a.proxyApiOrigin),t({authToken:r,apiOrigin:p}).get(`account/${o}/payouts`,s)}async fetchPayout(o,r,s){return s||(s=a.proxyApiOrigin),t({authToken:r,apiOrigin:s}).get(`payouts/${o}`)}async fetchCSV(o,r,s){return s||(s=a.proxyApiOrigin),t({authToken:r,apiOrigin:s}).get(`reports/payouts/${o}`)}}const c=({authToken:t,service:a})=>async({payoutId:p,onError:c})=>{try{const{data:o}=await a.fetchCSV(p,t),r=document.createElement("a");r.href=o.csv_url,r.click()}catch(t){c({error:r(t),code:s(null==t?void 0:t.code),severity:o.ERROR})}};export{p as P,c as m}
@@ -1 +1 @@
1
- import{r as e,c as s,h as t}from"./p-2783e363.js";import{B as i}from"./p-32a5bf4e.js";import{S as a}from"./p-bfe9748b.js";import{C as o}from"./p-14c91ffd.js";import{c as d,J as c}from"./p-174b151e.js";import"./p-ef4c49b9.js";import"./p-af620972.js";import"./p-5a62fca2.js";import"./p-0e180654.js";const h=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.authToken=void 0,this.accountId=void 0,this.paymentMethodGroupId=void 0,this.isLoading=!0,this.submitButtonText=void 0,this.disableCreditCard=void 0,this.disableBankAccount=void 0}componentWillLoad(){d(),this.analytics=new c(this),this.isLoading=!1}async tokenizePaymentMethod(e){e&&e.preventDefault();const s=await this.paymentMethodOptionsRef.resolvePaymentMethod({isValid:!0});s.error?this.errorEvent.emit({errorCode:s.error.code,message:s.error.message,severity:o.ERROR}):s.token&&this.submitEvent.emit({response:s})}async fillBillingForm(e){this.paymentMethodOptionsRef.fillBillingForm(e)}render(){return t(a,{key:"1f0ab23a66f201b93ad60c42a0cd59a9960a5034"},t("form",{key:"b4b6e0b75e99505d53bdeae210a15c11e764a1e0"},t("fieldset",{key:"8094449e89e44f99e4bf3e3517517d5ef5136974"},t("div",{key:"aaf859db2a1d7377b3ab37fd9bfa57ed3246ebd9",class:"row gy-3"},t("div",{key:"3c5b24886edc5d991c5ba760e60741e01818c310",class:"col-12"},t("justifi-payment-method-options",{key:"39ad866846a9c8ae32f9d34c1cecf812ed6d7c45",ref:e=>this.paymentMethodOptionsRef=e,"show-card":!this.disableCreditCard,"show-ach":!this.disableBankAccount,"show-bnpl":!1,paymentMethodGroupId:this.paymentMethodGroupId,"show-saved-payment-methods":!1,authToken:this.authToken,"account-id":this.accountId})),t("div",{key:"1ed6ae634f618a9fafc11961c4db5aea60f368ec",class:"col-12"},t(i,{key:"eed74cc9b5a475b925986b087cd34cc2e912aae6",variant:"primary",type:"submit",onClick:e=>this.tokenizePaymentMethod(e),isLoading:this.isLoading,"data-testid":"submit-button"},this.submitButtonText||"Submit"))))))}};export{h as justifi_tokenize_payment_method}
1
+ import{r as e,c as s,h as t}from"./p-2783e363.js";import{B as i}from"./p-32a5bf4e.js";import{S as a}from"./p-bfe9748b.js";import{C as o}from"./p-14c91ffd.js";import{c as d,J as c}from"./p-5456a794.js";import"./p-ef4c49b9.js";import"./p-a07b1816.js";import"./p-0f23ff58.js";import"./p-0e180654.js";const h=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.authToken=void 0,this.accountId=void 0,this.paymentMethodGroupId=void 0,this.isLoading=!0,this.submitButtonText=void 0,this.disableCreditCard=void 0,this.disableBankAccount=void 0}componentWillLoad(){d(),this.analytics=new c(this),this.isLoading=!1}async tokenizePaymentMethod(e){e&&e.preventDefault();const s=await this.paymentMethodOptionsRef.resolvePaymentMethod({isValid:!0});s.error?this.errorEvent.emit({errorCode:s.error.code,message:s.error.message,severity:o.ERROR}):s.token&&this.submitEvent.emit({response:s})}async fillBillingForm(e){this.paymentMethodOptionsRef.fillBillingForm(e)}render(){return t(a,{key:"1f0ab23a66f201b93ad60c42a0cd59a9960a5034"},t("form",{key:"b4b6e0b75e99505d53bdeae210a15c11e764a1e0"},t("fieldset",{key:"8094449e89e44f99e4bf3e3517517d5ef5136974"},t("div",{key:"aaf859db2a1d7377b3ab37fd9bfa57ed3246ebd9",class:"row gy-3"},t("div",{key:"3c5b24886edc5d991c5ba760e60741e01818c310",class:"col-12"},t("justifi-payment-method-options",{key:"39ad866846a9c8ae32f9d34c1cecf812ed6d7c45",ref:e=>this.paymentMethodOptionsRef=e,"show-card":!this.disableCreditCard,"show-ach":!this.disableBankAccount,"show-bnpl":!1,paymentMethodGroupId:this.paymentMethodGroupId,"show-saved-payment-methods":!1,authToken:this.authToken,"account-id":this.accountId})),t("div",{key:"1ed6ae634f618a9fafc11961c4db5aea60f368ec",class:"col-12"},t(i,{key:"eed74cc9b5a475b925986b087cd34cc2e912aae6",variant:"primary",type:"submit",onClick:e=>this.tokenizePaymentMethod(e),isLoading:this.isLoading,"data-testid":"submit-button"},this.submitButtonText||"Submit"))))))}};export{h as justifi_tokenize_payment_method}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i}from"./p-2783e363.js";import{C as e,a as o}from"./p-14c91ffd.js";import{c as a,J as r}from"./p-5456a794.js";import{c as n}from"./p-0f23ff58.js";import{m as p,P as h}from"./p-6ab77b89.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import{P as d}from"./p-3db8b3c7.js";import{g as c,a as b}from"./p-8115b2f4.js";import{m as l,S as m}from"./p-db8c12ee.js";import{S as u}from"./p-bfe9748b.js";import{d as f}from"./p-a3949f32.js";import"./p-a07b1816.js";import"./p-0e180654.js";import"./p-abdbcd8e.js";import"./p-f4722957.js";import"./p-206fde40.js";import"./p-ef4c49b9.js";const g=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event",7),this.handleOnError=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.getPayouts=void 0,this.getPayoutCSV=void 0,this.getSubAccounts=void 0,this.errorMessage=null,this.accountId=void 0,this.authToken=void 0,this.apiOrigin=n.proxyApiOrigin,this.columns=f}componentWillLoad(){a(),this.analytics=new r(this),this.initializeGetData()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializePayoutsServices(),this.initializeGetSubAccounts()}initializePayoutsServices(){if(this.accountId&&this.authToken){const t={id:this.accountId,authToken:this.authToken,service:new h,apiOrigin:this.apiOrigin};this.getPayouts=(({id:t,authToken:s,service:i,apiOrigin:o})=>async({params:a,onSuccess:r,onError:n})=>{var p,h;try{const l=await i.fetchPayouts(t,s,a,o);if(l.error)return n({error:c(l.error),code:b(null===(h=l.error)||void 0===h?void 0:h.code),severity:e.ERROR});{const t=Object.assign({},l.page_info);r({payouts:(null===(p=l.data)||void 0===p?void 0:p.map((t=>new d(t))))||[],pagingInfo:t})}}catch(t){const s=b(null==t?void 0:t.code);return n({error:t.message||t,code:s,severity:e.ERROR})}})(t),this.getPayoutCSV=p(t)}else this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:e.ERROR})}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=l({accountId:this.accountId,authToken:this.authToken,service:new m,apiOrigin:this.apiOrigin}))}render(){return i(u,{key:"78316ffab976d4674ed157de643d0e579a503050",exportedparts:"\ntable-head,table-head-row,table-head-cell,table-body,table-row,table-row-even,\ntable-row-odd,table-cell,loading-state-cell,loading-state-spinner,error-state,\nempty-state,pagination-bar,page-arrow,page-button,page-button-disabled,page-button-text\n"},i("payouts-list-core",{key:"6d258120f1ab81723505f76db75f4d4289e072b4",getPayouts:this.getPayouts,getPayoutCSV:this.getPayoutCSV,getSubAccounts:this.getSubAccounts,"onError-event":this.handleOnError,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{g as justifi_payouts_list}
@@ -1 +1 @@
1
- import{r as s,c as t,h as r}from"./p-2783e363.js";import{c as e}from"./p-5a62fca2.js";import{A as o}from"./p-0e180654.js";import{C as i,a}from"./p-14c91ffd.js";import{g as c,a as n}from"./p-8115b2f4.js";import{E as h}from"./p-9c2e00cc.js";import{c as p,J as m}from"./p-174b151e.js";import"./p-ef4c49b9.js";import"./p-af620972.js";class d{async fetchGrossVolumeChartData(s,t){return o({authToken:t,apiOrigin:e.proxyApiOrigin}).get(`account/${s}/reports/gross_volume`)}}const u=class{constructor(r){s(this,r),this.errorEvent=t(this,"error-event",7),this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)},this.accountId=void 0,this.authToken=void 0,this.getGrossPayment=void 0,this.errorMessage=null}componentWillLoad(){p(),this.analytics=new m(this),this.initializeGetGrossPayment()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetGrossPayment()}initializeGetGrossPayment(){this.accountId&&this.authToken?this.getGrossPayment=(({id:s,authToken:t,service:r})=>async({onSuccess:e,onError:o})=>{var a;try{const h=await r.fetchGrossVolumeChartData(s,t);h.error?o({error:c(h.error),code:n(null===(a=h.error)||void 0===a?void 0:a.code),severity:i.ERROR}):e(h.data)}catch(s){const t=n(null==s?void 0:s.code);o({error:c(s),code:t,severity:i.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new d}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:a.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}render(){return this.errorMessage?h(this.errorMessage):r("gross-payment-chart-core",{getGrossPayment:this.getGrossPayment,"onError-event":this.handleErrorEvent})}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{u as justifi_gross_payment_chart}
1
+ import{r as s,c as t,h as r}from"./p-2783e363.js";import{c as o}from"./p-0f23ff58.js";import{A as e}from"./p-0e180654.js";import{C as i,a}from"./p-14c91ffd.js";import{g as n,a as c}from"./p-8115b2f4.js";import{E as h}from"./p-9c2e00cc.js";import{c as p,J as m}from"./p-5456a794.js";import"./p-ef4c49b9.js";import"./p-a07b1816.js";class d{async fetchGrossVolumeChartData(s,t){return e({authToken:t,apiOrigin:o.proxyApiOrigin}).get(`account/${s}/reports/gross_volume`)}}const u=class{constructor(r){s(this,r),this.errorEvent=t(this,"error-event",7),this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)},this.accountId=void 0,this.authToken=void 0,this.getGrossPayment=void 0,this.errorMessage=null}componentWillLoad(){p(),this.analytics=new m(this),this.initializeGetGrossPayment()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetGrossPayment()}initializeGetGrossPayment(){this.accountId&&this.authToken?this.getGrossPayment=(({id:s,authToken:t,service:r})=>async({onSuccess:o,onError:e})=>{var a;try{const h=await r.fetchGrossVolumeChartData(s,t);h.error?e({error:n(h.error),code:c(null===(a=h.error)||void 0===a?void 0:a.code),severity:i.ERROR}):o(h.data)}catch(s){const t=c(null==s?void 0:s.code);e({error:n(s),code:t,severity:i.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new d}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:a.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}render(){return this.errorMessage?h(this.errorMessage):r("gross-payment-chart-core",{getGrossPayment:this.getGrossPayment,"onError-event":this.handleErrorEvent})}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{u as justifi_gross_payment_chart}
@@ -1 +1 @@
1
- import{r as s,c as t,h as i}from"./p-2783e363.js";import{P as e}from"./p-e19589a2.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import{P as r}from"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{C as o,a}from"./p-14c91ffd.js";import{g as p,a as c}from"./p-8115b2f4.js";import{c as n,J as h}from"./p-174b151e.js";import{c as m}from"./p-5a62fca2.js";import{S as d}from"./p-bfe9748b.js";import{d as f}from"./p-34c14f59.js";import"./p-0e180654.js";import"./p-abdbcd8e.js";import"./p-af620972.js";import"./p-bb71cef3.js";import"./p-f4722957.js";import"./p-ef4c49b9.js";const j=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event",7),this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)},this.getPayments=void 0,this.errorMessage=null,this.accountId=void 0,this.authToken=void 0,this.apiOrigin=m.proxyApiOrigin,this.columns=f}componentWillLoad(){n(),this.analytics=new h(this),this.initializeGetPayments()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetPayments()}initializeGetPayments(){this.accountId&&this.authToken?this.getPayments=(({id:s,authToken:t,service:i,apiOrigin:e})=>async({params:a,onSuccess:n,onError:h})=>{var m,d;try{const f=await i.fetchPayments(s,t,a,e);if(f.error)return h({error:p(f.error),code:c(null===(d=f.error)||void 0===d?void 0:d.code),severity:o.ERROR});{const s=Object.assign({},f.page_info);n({payments:(null===(m=f.data)||void 0===m?void 0:m.map((s=>new r(s))))||[],pagingInfo:s})}}catch(s){const t=c(null==s?void 0:s.code);return h({error:s.message||s,code:t,severity:o.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new e,apiOrigin:this.apiOrigin}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:a.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}render(){return i(d,{key:"35086c06a347cb7ee577366cd5674a2c50c4ffe5"},i("payments-list-core",{key:"bee1a7cf3e600a0060a62cf8151eea390dfd2cfa",getPayments:this.getPayments,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{j as justifi_payments_list}
1
+ import{r as s,c as t,h as i}from"./p-2783e363.js";import{P as r}from"./p-cc977850.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import{P as e}from"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{C as o,a}from"./p-14c91ffd.js";import{g as p,a as c}from"./p-8115b2f4.js";import{c as n,J as h}from"./p-5456a794.js";import{c as m}from"./p-0f23ff58.js";import{S as d}from"./p-bfe9748b.js";import{d as f}from"./p-34c14f59.js";import"./p-0e180654.js";import"./p-abdbcd8e.js";import"./p-a07b1816.js";import"./p-bb71cef3.js";import"./p-f4722957.js";import"./p-ef4c49b9.js";const j=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event",7),this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)},this.getPayments=void 0,this.errorMessage=null,this.accountId=void 0,this.authToken=void 0,this.apiOrigin=m.proxyApiOrigin,this.columns=f}componentWillLoad(){n(),this.analytics=new h(this),this.initializeGetPayments()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetPayments()}initializeGetPayments(){this.accountId&&this.authToken?this.getPayments=(({id:s,authToken:t,service:i,apiOrigin:r})=>async({params:a,onSuccess:n,onError:h})=>{var m,d;try{const f=await i.fetchPayments(s,t,a,r);if(f.error)return h({error:p(f.error),code:c(null===(d=f.error)||void 0===d?void 0:d.code),severity:o.ERROR});{const s=Object.assign({},f.page_info);n({payments:(null===(m=f.data)||void 0===m?void 0:m.map((s=>new e(s))))||[],pagingInfo:s})}}catch(s){const t=c(null==s?void 0:s.code);return h({error:s.message||s,code:t,severity:o.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new r,apiOrigin:this.apiOrigin}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:a.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}render(){return i(d,{key:"35086c06a347cb7ee577366cd5674a2c50c4ffe5"},i("payments-list-core",{key:"bee1a7cf3e600a0060a62cf8151eea390dfd2cfa",getPayments:this.getPayments,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{j as justifi_payments_list}
@@ -1 +1 @@
1
- import{r as e,c as t,h as s}from"./p-2783e363.js";import{c as i,d as r,e as a}from"./p-5968ff8a.js";import{I as o}from"./p-f6f8dabc.js";import{F as d}from"./p-5844a0f0.js";import{O as h}from"./p-275f2154.js";import{i as c}from"./p-bb61c6e0.js";import{B as n}from"./p-32a5bf4e.js";import{v as l}from"./p-ef4c49b9.js";import{B as f}from"./p-73f9be7c.js";import{S as b,P as m}from"./p-525db3e8.js";import{u,a as p,b as v}from"./p-7d85af5c.js";import"./p-14c91ffd.js";import"./p-8115b2f4.js";import"./p-5a62fca2.js";import"./p-0e180654.js";import"./p-1ff8810b.js";import"./p-6078a370.js";import"./p-af834eb8.js";import"./p-0ea387a2.js";const y=class{constructor(s){e(this,s),this.errorEvent=t(this,"error-event",7),this.getOwner=void 0,this.patchOwner=void 0,this.postOwner=void 0,this.authToken=void 0,this.ownerId=void 0,this.businessId=void 0,this.allowOptionalFields=void 0,this.removeOwner=void 0,this.newFormOpen=void 0,this.ownersLength=void 0}async validate(){return this.coreComponent.validate()}async submit(){return this.coreComponent.submit()}async validateAndSubmit({onSuccess:e}){this.coreComponent.validateAndSubmit({onSuccess:e})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&(this.getOwner=i({authToken:this.authToken,identityId:this.ownerId,service:new o}),this.patchOwner=r({authToken:this.authToken,identityId:this.ownerId,service:new o}),this.postOwner=a({authToken:this.authToken,service:new o}))}render(){return s("owner-form-core",{key:"994ef390ec2423419aa777656a49d9087ef61e72",ownerId:this.ownerId,businessId:this.businessId,getOwner:this.getOwner,patchOwner:this.patchOwner,postOwner:this.postOwner,allowOptionalFields:this.allowOptionalFields,removeOwner:this.removeOwner,newFormOpen:this.newFormOpen,ownersLength:this.ownersLength,ref:e=>this.coreComponent=e})}},k=class{loadingWatcher(){this.formLoading.emit(this.isLoading)}constructor(s){e(this,s),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.formLoading=t(this,"formLoading",7),this.ownerSubmitted=t(this,"ownerSubmitted",7),this.getData=()=>{this.isLoading=!0,this.getOwner({onSuccess:e=>{this.instantiateOwner(e.data)},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({message:e,errorCode:t,severity:s})},final:()=>this.isLoading=!1})},this.sendData=()=>(this.isLoading=!0,new Promise((e=>{this.ownerId?this.patchOwner({payload:this.payload,onSuccess:t=>{this.ownerSubmitted.emit({id:t.data.id}),this.instantiateOwner(t.data),e(!0)},onError:({error:t,code:s,severity:i})=>{this.errorEvent.emit({message:t,errorCode:s,severity:i}),e(!1)},final:()=>this.isLoading=!1}):this.postOwner({payload:this.payload,onSuccess:t=>{this.ownerSubmitted.emit({id:t.data.id}),this.instantiateOwner(t.data),e(!0)},onError:({error:t,code:s,severity:i})=>{this.errorEvent.emit({message:t,errorCode:s,severity:i}),e(!1)},final:()=>this.isLoading=!1})}))),this.instantiateOwner=async e=>{this.owner=Object.assign({},new h(e)),await this.formController.setInitialValues(this.owner)},this.handleAddOwner=()=>{this.clickEvent.emit({name:this.ownerId?f.updateOwner:f.addOwner})},this.handleRemoveOwner=()=>{this.removeOwner(this.ownerId),this.clickEvent.emit({name:f.removeOwner})},this.isLoading=!1,this.formController=void 0,this.errors={},this.owner={},this.ownerId=void 0,this.businessId=void 0,this.getOwner=void 0,this.patchOwner=void 0,this.postOwner=void 0,this.allowOptionalFields=void 0,this.removeOwner=void 0,this.newFormOpen=void 0,this.ownersLength=void 0,this.validate=this.validate.bind(this),this.submit=this.submit.bind(this),this.validateAndSubmit=this.validateAndSubmit.bind(this)}async returnOwnerData(){return this.ownerId}async validate(){return this.formController.validate()}async submit(){if(await this.validate())return this.sendData()}async validateAndSubmit(e){e.preventDefault(),await this.validate()&&this.submit()}get payload(){let e=new h(this.formController.values.getValue()).payload;return this.ownerId?e:Object.assign(Object.assign({},e),{business_id:this.businessId})}get formTitle(){return this.ownerId?"Edit Business Owner":"Add Business Owner"}get submitButtonText(){return this.ownerId?"Update":"Add"}get showRemoveButton(){return!(this.ownersLength<=1)&&(!(this.ownerId||!this.newFormOpen)||!(!this.ownerId||this.newFormOpen)||void 0)}componentWillLoad(){this.formController=new d(c("owner",this.allowOptionalFields)),this.ownerId?this.getData():this.instantiateOwner({})}componentDidLoad(){this.formController.errors.subscribe((e=>this.errors=Object.assign({},e)))}render(){return s("form",{key:"58cbb6a1f804dc14fc3d3c873b733353b01d9365",onSubmit:this.validateAndSubmit},s("fieldset",{key:"23cb93fab96a2d1a3a372057a93f8a5e3b5e886b"},s("legend",{key:"06f0a9595c675d7f2f708741ef292018ad2b98e7",class:"fw-semibold fs-5",part:l},this.formTitle),s("br",{key:"cdde6f04d559cc83bf50282feab27e2917889b74"}),s("div",{key:"25fd59a4755a4344ed0d6c116de79c95db8660df",class:"row gy-3"},s("owner-form-inputs",{key:"f839d830b204439f88594b0a16cce37286fe3e0b",ownerDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController}),s("div",{key:"5dad56a053aa7ad0c04869374769965eba872247",class:"d-flex gap-2 justify-content-start"},s(n,{key:"22342bc0f6a5978a94927aa9edddb9979309e647",variant:"secondary",type:"button",onClick:this.handleRemoveOwner,hidden:!this.showRemoveButton},"Remove"),s(n,{key:"ef3d494677011f095d199e736043e3c02a855f2b",variant:"primary",type:"submit",onClick:this.handleAddOwner,disabled:this.isLoading},this.submitButtonText))),s("hr",{key:"d2d503eabc8b633ec84cabeacfe04c3802689604"})))}static get watchers(){return{isLoading:["loadingWatcher"]}}},w=class{constructor(t){e(this,t),this.inputHandler=(e,t)=>{u(this.formController,{[e]:t})},this.onAddressFormUpdate=e=>{p(this.formController,Object.assign(Object.assign({},this.formController.values.getValue().address),e))},this.ownerDefaultValue=void 0,this.errors=void 0,this.formController=void 0}render(){return s("div",{key:"6604b31d64967fbabb85189c72d7d78d98d2c8c8",class:"row gy-3"},s("div",{key:"7b52874d08593e28ac8e2369534d3697f07128c3",class:"col-12 col-md-8"},s("form-control-text",{key:"080456fae1d1f024d3e82be43939922fb19f6ef9",name:"name",label:"Full Name",defaultValue:this.ownerDefaultValue.name,errorText:this.errors.name,inputHandler:this.inputHandler})),s("div",{key:"e0e431c1d7d6716bc368eb1fa06b80d0576a05ee",class:"col-12 col-md-4"},s("form-control-text",{key:"9134c2a32853cfa00edb42a2db30a85943e0c3f5",name:"title",label:"Title",defaultValue:this.ownerDefaultValue.title,errorText:this.errors.title,inputHandler:this.inputHandler,helpText:"Role at your business, e.g. President, CEO, Treasurer."})),s("div",{key:"b129332c1547d43a2d2e09f19940e3a5a1df988a",class:"col-12 col-md-6"},s("form-control-text",{key:"1e56b33c0c12898bdb0dd121fa832869deca9a2b",name:"email",label:"Email Address",defaultValue:this.ownerDefaultValue.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{key:"0a551a3d5f820e1f0146ee2603b687559756b80b",class:"col-12 col-md-6"},s("form-control-number-masked",{key:"26c8366c9a8c93e69e8396ae1bb8d2478cc9eb81",name:"phone",label:"Phone Number",defaultValue:this.ownerDefaultValue.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:m.US})),s("div",{key:"e9416e635eceb13bee1cd259bad100cb165b9e74",class:"col-12 col-md-4"},s("form-control-date",{key:"9a69bdc97c104169bdc742c341105a208b9a815a",name:"dob_full",label:"Birth Date",defaultValue:this.ownerDefaultValue.dob_full,errorText:this.errors.dob_full,inputHandler:this.inputHandler,onFormControlInput:e=>v(e,this.formController),helpText:"Must be 18 or older."})),s("div",{key:"9dedc8f023a3e6cc47835fc3a749f427c29bbee4",class:"col-12 col-md-8"},s("form-control-number-masked",{key:"f1bedfe4d166ed0453a1814a5f02f7912da1e699",name:"identification_number",label:"SSN",defaultValue:this.ownerDefaultValue.identification_number,errorText:this.errors.identification_number,inputHandler:this.inputHandler,mask:b,helpText:"Enter your full Social Security Number. It is required for Federal OFAC check."})),s("div",{key:"32b1cd3be64345be08b27297478ab654d9201b8b",class:"col-12"},s("justifi-identity-address-form",{key:"e3292e32b13c290081989a562e22454f1bfe4f83",errors:this.errors.address,defaultValues:this.ownerDefaultValue.address,handleFormUpdate:this.onAddressFormUpdate})))}};export{y as justifi_owner_form,k as owner_form_core,w as owner_form_inputs}
1
+ import{r as e,c as t,h as s}from"./p-2783e363.js";import{c as i,d as r,e as a}from"./p-5968ff8a.js";import{I as o}from"./p-edb57087.js";import{F as d}from"./p-5844a0f0.js";import{O as h}from"./p-275f2154.js";import{i as c}from"./p-bb61c6e0.js";import{B as n}from"./p-32a5bf4e.js";import{v as l}from"./p-ef4c49b9.js";import{B as f}from"./p-73f9be7c.js";import{S as b,P as m}from"./p-525db3e8.js";import{u,a as p,b as v}from"./p-7d85af5c.js";import"./p-14c91ffd.js";import"./p-8115b2f4.js";import"./p-0f23ff58.js";import"./p-0e180654.js";import"./p-1ff8810b.js";import"./p-6078a370.js";import"./p-af834eb8.js";import"./p-0ea387a2.js";const y=class{constructor(s){e(this,s),this.errorEvent=t(this,"error-event",7),this.getOwner=void 0,this.patchOwner=void 0,this.postOwner=void 0,this.authToken=void 0,this.ownerId=void 0,this.businessId=void 0,this.allowOptionalFields=void 0,this.removeOwner=void 0,this.newFormOpen=void 0,this.ownersLength=void 0}async validate(){return this.coreComponent.validate()}async submit(){return this.coreComponent.submit()}async validateAndSubmit({onSuccess:e}){this.coreComponent.validateAndSubmit({onSuccess:e})}componentWillLoad(){this.initializeApi()}initializeApi(){this.authToken&&(this.getOwner=i({authToken:this.authToken,identityId:this.ownerId,service:new o}),this.patchOwner=r({authToken:this.authToken,identityId:this.ownerId,service:new o}),this.postOwner=a({authToken:this.authToken,service:new o}))}render(){return s("owner-form-core",{key:"994ef390ec2423419aa777656a49d9087ef61e72",ownerId:this.ownerId,businessId:this.businessId,getOwner:this.getOwner,patchOwner:this.patchOwner,postOwner:this.postOwner,allowOptionalFields:this.allowOptionalFields,removeOwner:this.removeOwner,newFormOpen:this.newFormOpen,ownersLength:this.ownersLength,ref:e=>this.coreComponent=e})}},k=class{loadingWatcher(){this.formLoading.emit(this.isLoading)}constructor(s){e(this,s),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.formLoading=t(this,"formLoading",7),this.ownerSubmitted=t(this,"ownerSubmitted",7),this.getData=()=>{this.isLoading=!0,this.getOwner({onSuccess:e=>{this.instantiateOwner(e.data)},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({message:e,errorCode:t,severity:s})},final:()=>this.isLoading=!1})},this.sendData=()=>(this.isLoading=!0,new Promise((e=>{this.ownerId?this.patchOwner({payload:this.payload,onSuccess:t=>{this.ownerSubmitted.emit({id:t.data.id}),this.instantiateOwner(t.data),e(!0)},onError:({error:t,code:s,severity:i})=>{this.errorEvent.emit({message:t,errorCode:s,severity:i}),e(!1)},final:()=>this.isLoading=!1}):this.postOwner({payload:this.payload,onSuccess:t=>{this.ownerSubmitted.emit({id:t.data.id}),this.instantiateOwner(t.data),e(!0)},onError:({error:t,code:s,severity:i})=>{this.errorEvent.emit({message:t,errorCode:s,severity:i}),e(!1)},final:()=>this.isLoading=!1})}))),this.instantiateOwner=async e=>{this.owner=Object.assign({},new h(e)),await this.formController.setInitialValues(this.owner)},this.handleAddOwner=()=>{this.clickEvent.emit({name:this.ownerId?f.updateOwner:f.addOwner})},this.handleRemoveOwner=()=>{this.removeOwner(this.ownerId),this.clickEvent.emit({name:f.removeOwner})},this.isLoading=!1,this.formController=void 0,this.errors={},this.owner={},this.ownerId=void 0,this.businessId=void 0,this.getOwner=void 0,this.patchOwner=void 0,this.postOwner=void 0,this.allowOptionalFields=void 0,this.removeOwner=void 0,this.newFormOpen=void 0,this.ownersLength=void 0,this.validate=this.validate.bind(this),this.submit=this.submit.bind(this),this.validateAndSubmit=this.validateAndSubmit.bind(this)}async returnOwnerData(){return this.ownerId}async validate(){return this.formController.validate()}async submit(){if(await this.validate())return this.sendData()}async validateAndSubmit(e){e.preventDefault(),await this.validate()&&this.submit()}get payload(){let e=new h(this.formController.values.getValue()).payload;return this.ownerId?e:Object.assign(Object.assign({},e),{business_id:this.businessId})}get formTitle(){return this.ownerId?"Edit Business Owner":"Add Business Owner"}get submitButtonText(){return this.ownerId?"Update":"Add"}get showRemoveButton(){return!(this.ownersLength<=1)&&(!(this.ownerId||!this.newFormOpen)||!(!this.ownerId||this.newFormOpen)||void 0)}componentWillLoad(){this.formController=new d(c("owner",this.allowOptionalFields)),this.ownerId?this.getData():this.instantiateOwner({})}componentDidLoad(){this.formController.errors.subscribe((e=>this.errors=Object.assign({},e)))}render(){return s("form",{key:"58cbb6a1f804dc14fc3d3c873b733353b01d9365",onSubmit:this.validateAndSubmit},s("fieldset",{key:"23cb93fab96a2d1a3a372057a93f8a5e3b5e886b"},s("legend",{key:"06f0a9595c675d7f2f708741ef292018ad2b98e7",class:"fw-semibold fs-5",part:l},this.formTitle),s("br",{key:"cdde6f04d559cc83bf50282feab27e2917889b74"}),s("div",{key:"25fd59a4755a4344ed0d6c116de79c95db8660df",class:"row gy-3"},s("owner-form-inputs",{key:"f839d830b204439f88594b0a16cce37286fe3e0b",ownerDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController}),s("div",{key:"5dad56a053aa7ad0c04869374769965eba872247",class:"d-flex gap-2 justify-content-start"},s(n,{key:"22342bc0f6a5978a94927aa9edddb9979309e647",variant:"secondary",type:"button",onClick:this.handleRemoveOwner,hidden:!this.showRemoveButton},"Remove"),s(n,{key:"ef3d494677011f095d199e736043e3c02a855f2b",variant:"primary",type:"submit",onClick:this.handleAddOwner,disabled:this.isLoading},this.submitButtonText))),s("hr",{key:"d2d503eabc8b633ec84cabeacfe04c3802689604"})))}static get watchers(){return{isLoading:["loadingWatcher"]}}},w=class{constructor(t){e(this,t),this.inputHandler=(e,t)=>{u(this.formController,{[e]:t})},this.onAddressFormUpdate=e=>{p(this.formController,Object.assign(Object.assign({},this.formController.values.getValue().address),e))},this.ownerDefaultValue=void 0,this.errors=void 0,this.formController=void 0}render(){return s("div",{key:"6604b31d64967fbabb85189c72d7d78d98d2c8c8",class:"row gy-3"},s("div",{key:"7b52874d08593e28ac8e2369534d3697f07128c3",class:"col-12 col-md-8"},s("form-control-text",{key:"080456fae1d1f024d3e82be43939922fb19f6ef9",name:"name",label:"Full Name",defaultValue:this.ownerDefaultValue.name,errorText:this.errors.name,inputHandler:this.inputHandler})),s("div",{key:"e0e431c1d7d6716bc368eb1fa06b80d0576a05ee",class:"col-12 col-md-4"},s("form-control-text",{key:"9134c2a32853cfa00edb42a2db30a85943e0c3f5",name:"title",label:"Title",defaultValue:this.ownerDefaultValue.title,errorText:this.errors.title,inputHandler:this.inputHandler,helpText:"Role at your business, e.g. President, CEO, Treasurer."})),s("div",{key:"b129332c1547d43a2d2e09f19940e3a5a1df988a",class:"col-12 col-md-6"},s("form-control-text",{key:"1e56b33c0c12898bdb0dd121fa832869deca9a2b",name:"email",label:"Email Address",defaultValue:this.ownerDefaultValue.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{key:"0a551a3d5f820e1f0146ee2603b687559756b80b",class:"col-12 col-md-6"},s("form-control-number-masked",{key:"26c8366c9a8c93e69e8396ae1bb8d2478cc9eb81",name:"phone",label:"Phone Number",defaultValue:this.ownerDefaultValue.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:m.US})),s("div",{key:"e9416e635eceb13bee1cd259bad100cb165b9e74",class:"col-12 col-md-4"},s("form-control-date",{key:"9a69bdc97c104169bdc742c341105a208b9a815a",name:"dob_full",label:"Birth Date",defaultValue:this.ownerDefaultValue.dob_full,errorText:this.errors.dob_full,inputHandler:this.inputHandler,onFormControlInput:e=>v(e,this.formController),helpText:"Must be 18 or older."})),s("div",{key:"9dedc8f023a3e6cc47835fc3a749f427c29bbee4",class:"col-12 col-md-8"},s("form-control-number-masked",{key:"f1bedfe4d166ed0453a1814a5f02f7912da1e699",name:"identification_number",label:"SSN",defaultValue:this.ownerDefaultValue.identification_number,errorText:this.errors.identification_number,inputHandler:this.inputHandler,mask:b,helpText:"Enter your full Social Security Number. It is required for Federal OFAC check."})),s("div",{key:"32b1cd3be64345be08b27297478ab654d9201b8b",class:"col-12"},s("justifi-identity-address-form",{key:"e3292e32b13c290081989a562e22454f1bfe4f83",errors:this.errors.address,defaultValues:this.ownerDefaultValue.address,handleFormUpdate:this.onAddressFormUpdate})))}};export{y as justifi_owner_form,k as owner_form_core,w as owner_form_inputs}
@@ -1 +1 @@
1
- import{r as t,c as e,h as i}from"./p-2783e363.js";import{C as s,a as o}from"./p-14c91ffd.js";import{g as r,a as c}from"./p-8115b2f4.js";import{C as a}from"./p-54d36e97.js";import{c as h,J as d}from"./p-174b151e.js";import"./p-5a62fca2.js";import"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-abdbcd8e.js";import"./p-3db8b3c7.js";import"./p-af620972.js";const n=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event",7),this.loadedEvent=e(this,"loaded",7),this.iframeOrigin=void 0,this.authToken=void 0,this.checkoutId=void 0,this.disableCreditCard=void 0,this.disableBankAccount=void 0,this.disableBnpl=void 0,this.disablePaymentMethodGroup=void 0,this.getCheckout=void 0,this.complete=void 0,this.errorMessage=""}componentWillLoad(){h(),this.analytics=new d(this),this.initializeGetCheckout()}disconnectedCallback(){this.analytics.cleanup()}initializeGetCheckout(){this.authToken&&this.checkoutId?(this.getCheckout=(({authToken:t,checkoutId:e,service:i})=>async({onSuccess:o,onError:a})=>{var h;try{const d=await i.fetchCheckout(t,e);if(d.error)return a({error:r(d.error),code:c(null===(h=d.error)||void 0===h?void 0:h.code),severity:s.ERROR});o({checkout:d.data})}catch(t){const e=c(null==t?void 0:t.code);return a({error:t.message||t,code:e,severity:s.ERROR})}})({authToken:this.authToken,checkoutId:this.checkoutId,service:new a}),this.complete=(({authToken:t,checkoutId:e,service:i})=>async({payment:o,onSuccess:a,onError:h})=>{var d;try{const n=await i.complete(t,e,o);if(n.error)return h({error:r(n.error),code:c(null===(d=n.error)||void 0===d?void 0:d.code),severity:s.ERROR});a(n)}catch(t){const e=c(null==t?void 0:t.code);return h({error:t.message||t,code:e,severity:s.ERROR})}})({authToken:this.authToken,checkoutId:this.checkoutId,service:new a})):this.errorEvent.emit({message:"auth-token and checkout-id are required",errorCode:o.MISSING_PROPS,severity:s.ERROR})}propChanged(){this.initializeGetCheckout()}async fillBillingForm(t){this.checkoutCoreRef.fillBillingForm(t)}render(){return i("justifi-checkout-core",{key:"1a31304be74cae8c70683b9a26319d59f1462362",getCheckout:this.getCheckout,authToken:this.authToken,complete:this.complete,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,disableBnpl:this.disableBnpl,disablePaymentMethodGroup:this.disablePaymentMethodGroup,ref:t=>{t&&(this.checkoutCoreRef=t)}},i("div",{key:"ad9e6466d374849862f48c25c61a2a511b8465af",slot:"insurance"},i("slot",{key:"eb94e33e0ab10320aede52292f732de5d92e3341",name:"insurance"})))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"]}}};export{n as justifi_checkout}
1
+ import{r as t,c as e,h as i}from"./p-2783e363.js";import{C as s,a as o}from"./p-14c91ffd.js";import{g as r,a as c}from"./p-8115b2f4.js";import{C as a}from"./p-bb0f8b70.js";import{c as h,J as d}from"./p-5456a794.js";import"./p-0f23ff58.js";import"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-abdbcd8e.js";import"./p-3db8b3c7.js";import"./p-a07b1816.js";const n=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event",7),this.loadedEvent=e(this,"loaded",7),this.iframeOrigin=void 0,this.authToken=void 0,this.checkoutId=void 0,this.disableCreditCard=void 0,this.disableBankAccount=void 0,this.disableBnpl=void 0,this.disablePaymentMethodGroup=void 0,this.getCheckout=void 0,this.complete=void 0,this.errorMessage=""}componentWillLoad(){h(),this.analytics=new d(this),this.initializeGetCheckout()}disconnectedCallback(){this.analytics.cleanup()}initializeGetCheckout(){this.authToken&&this.checkoutId?(this.getCheckout=(({authToken:t,checkoutId:e,service:i})=>async({onSuccess:o,onError:a})=>{var h;try{const d=await i.fetchCheckout(t,e);if(d.error)return a({error:r(d.error),code:c(null===(h=d.error)||void 0===h?void 0:h.code),severity:s.ERROR});o({checkout:d.data})}catch(t){const e=c(null==t?void 0:t.code);return a({error:t.message||t,code:e,severity:s.ERROR})}})({authToken:this.authToken,checkoutId:this.checkoutId,service:new a}),this.complete=(({authToken:t,checkoutId:e,service:i})=>async({payment:o,onSuccess:a,onError:h})=>{var d;try{const n=await i.complete(t,e,o);if(n.error)return h({error:r(n.error),code:c(null===(d=n.error)||void 0===d?void 0:d.code),severity:s.ERROR});a(n)}catch(t){const e=c(null==t?void 0:t.code);return h({error:t.message||t,code:e,severity:s.ERROR})}})({authToken:this.authToken,checkoutId:this.checkoutId,service:new a})):this.errorEvent.emit({message:"auth-token and checkout-id are required",errorCode:o.MISSING_PROPS,severity:s.ERROR})}propChanged(){this.initializeGetCheckout()}async fillBillingForm(t){this.checkoutCoreRef.fillBillingForm(t)}render(){return i("justifi-checkout-core",{key:"1a31304be74cae8c70683b9a26319d59f1462362",getCheckout:this.getCheckout,authToken:this.authToken,complete:this.complete,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,disableBnpl:this.disableBnpl,disablePaymentMethodGroup:this.disablePaymentMethodGroup,ref:t=>{t&&(this.checkoutCoreRef=t)}},i("div",{key:"ad9e6466d374849862f48c25c61a2a511b8465af",slot:"insurance"},i("slot",{key:"eb94e33e0ab10320aede52292f732de5d92e3341",name:"insurance"})))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"]}}};export{n as justifi_checkout}
@@ -1 +1 @@
1
- const e={name:"@justifi/webcomponents",version:"5.0.0-rc-1",description:"JustiFi Web Components",collection:"dist/collection/collection-manifest.json",main:"dist/index.cjs.js",module:"dist/module/index.js",types:"dist/module/index.d.ts",repository:{type:"git",url:"git+https://github.com/justifi-tech/web-component-library.git"},homepage:"https://storybook.justifi.ai/?path=/docs/introduction--docs",publishConfig:{registry:"https://registry.npmjs.org"},files:["dist/"],scripts:{build:"stencil build --docs",dev:"stencil build --watch",lint:"eslint . --max-warnings 0",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",generate:"stencil generate",test:"TZ=utc stencil test --spec","test:watch":"TZ=utc stencil test --spec --watchAll","test:file":"stencil test --spec --watch --"},dependencies:{"@popperjs/core":"^2.11.8","@stencil/core":"^4.0.5","@stencil/store":"^2.0.8",bootstrap:"^5.2.3","chart.js":"^4.4.1","date-fns":"^2.30.0","dinero.js":"^1.9.1","iframe-resizer":"^4.3.7",imask:"^7.6.0",lodash:"^4.17.21",rxjs:"^7.8.1","ts-dedent":"^2.2.0",uuid:"^9.0.0",yup:"^1.0.0"},devDependencies:{"@babel/preset-env":"^7.21.5","@babel/preset-react":"^7.18.6","@babel/preset-typescript":"^7.21.5","@rollup/plugin-replace":"^6.0.1","@stencil/sass":"^3.0.1","@types/jest":"27.0.3","@types/react":"^18.0.37","@types/react-dom":"^18.0.11",dotenv:"^16.3.1",jest:"^29.7.0","jest-cli":"^29.7.0","jest-environment-node":"^29.7.0","ts-jest":"^29.1.2"},license:"MIT",gitHead:"507bac1d941eae6e1f56e185ecd9bc9d22637783"};export{e as p}
1
+ const e={name:"@justifi/webcomponents",version:"5.0.0-rc-2",description:"JustiFi Web Components",collection:"dist/collection/collection-manifest.json",main:"dist/index.cjs.js",module:"dist/module/index.js",types:"dist/module/index.d.ts",repository:{type:"git",url:"git+https://github.com/justifi-tech/web-component-library.git"},homepage:"https://storybook.justifi.ai/?path=/docs/introduction--docs",publishConfig:{registry:"https://registry.npmjs.org"},files:["dist/"],scripts:{build:"stencil build --docs",dev:"stencil build --watch",lint:"eslint . --max-warnings 0",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",generate:"stencil generate",test:"TZ=utc stencil test --spec","test:watch":"TZ=utc stencil test --spec --watchAll","test:file":"stencil test --spec --watch --"},dependencies:{"@popperjs/core":"^2.11.8","@stencil/core":"^4.0.5","@stencil/store":"^2.0.8",bootstrap:"^5.2.3","chart.js":"^4.4.1","date-fns":"^2.30.0","dinero.js":"^1.9.1","iframe-resizer":"^4.3.7",imask:"^7.6.0",lodash:"^4.17.21",rxjs:"^7.8.1","ts-dedent":"^2.2.0",uuid:"^9.0.0",yup:"^1.0.0"},devDependencies:{"@babel/preset-env":"^7.21.5","@babel/preset-react":"^7.18.6","@babel/preset-typescript":"^7.21.5","@rollup/plugin-replace":"^6.0.1","@stencil/sass":"^3.0.1","@types/jest":"27.0.3","@types/react":"^18.0.37","@types/react-dom":"^18.0.11",dotenv:"^16.3.1",jest:"^29.7.0","jest-cli":"^29.7.0","jest-environment-node":"^29.7.0","ts-jest":"^29.1.2"},license:"MIT",gitHead:"507bac1d941eae6e1f56e185ecd9bc9d22637783"};export{e as p}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-2783e363.js";import{m as o,P as e}from"./p-d1c93dd3.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import{P as r}from"./p-3db8b3c7.js";import{C as a,a as p}from"./p-14c91ffd.js";import{g as h,a as d}from"./p-8115b2f4.js";import{E as c}from"./p-9c2e00cc.js";import{c as n,J as m}from"./p-174b151e.js";import"./p-0e180654.js";import"./p-5a62fca2.js";import"./p-abdbcd8e.js";import"./p-ef4c49b9.js";import"./p-af620972.js";const u=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event",7),this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.payoutId=void 0,this.authToken=void 0,this.getPayout=void 0,this.getPayoutCSV=void 0,this.errorMessage=null}componentWillLoad(){n(),this.analytics=new m(this),this.initializeServices()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeServices()}initializeServices(){this.payoutId&&this.authToken?(this.getPayout=(({id:t,authToken:s,service:i})=>async({onSuccess:o,onError:e})=>{var p;try{const c=await i.fetchPayout(t,s);c.error?e({error:h(c.error),code:d(null===(p=c.error)||void 0===p?void 0:p.code),severity:a.ERROR}):o(new r(c.data))}catch(t){e({error:h(t),code:d(null==t?void 0:t.code),severity:a.ERROR})}})({id:this.payoutId,authToken:this.authToken,service:new e}),this.getPayoutCSV=o({authToken:this.authToken,service:new e})):(this.errorMessage="Failed to load payout details. payoutId or authToken is not provided.",this.errorEvent.emit({message:this.errorMessage,errorCode:p.MISSING_PROPS,severity:a.ERROR}))}render(){return this.errorMessage?c(this.errorMessage):i("payout-details-core",{getPayout:this.getPayout,getPayoutCSV:this.getPayoutCSV,"onError-event":this.handleErrorEvent})}static get watchers(){return{payoutId:["propChanged"],authToken:["propChanged"]}}};export{u as justifi_payout_details}
1
+ import{r as t,c as s,h as i}from"./p-2783e363.js";import{m as o,P as r}from"./p-6ab77b89.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import{P as e}from"./p-3db8b3c7.js";import{C as a,a as p}from"./p-14c91ffd.js";import{g as h,a as d}from"./p-8115b2f4.js";import{E as c}from"./p-9c2e00cc.js";import{c as n,J as m}from"./p-5456a794.js";import"./p-0e180654.js";import"./p-0f23ff58.js";import"./p-abdbcd8e.js";import"./p-ef4c49b9.js";import"./p-a07b1816.js";const u=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event",7),this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.payoutId=void 0,this.authToken=void 0,this.getPayout=void 0,this.getPayoutCSV=void 0,this.errorMessage=null}componentWillLoad(){n(),this.analytics=new m(this),this.initializeServices()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeServices()}initializeServices(){this.payoutId&&this.authToken?(this.getPayout=(({id:t,authToken:s,service:i})=>async({onSuccess:o,onError:r})=>{var p;try{const c=await i.fetchPayout(t,s);c.error?r({error:h(c.error),code:d(null===(p=c.error)||void 0===p?void 0:p.code),severity:a.ERROR}):o(new e(c.data))}catch(t){r({error:h(t),code:d(null==t?void 0:t.code),severity:a.ERROR})}})({id:this.payoutId,authToken:this.authToken,service:new r}),this.getPayoutCSV=o({authToken:this.authToken,service:new r})):(this.errorMessage="Failed to load payout details. payoutId or authToken is not provided.",this.errorEvent.emit({message:this.errorMessage,errorCode:p.MISSING_PROPS,severity:a.ERROR}))}render(){return this.errorMessage?c(this.errorMessage):i("payout-details-core",{getPayout:this.getPayout,getPayoutCSV:this.getPayoutCSV,"onError-event":this.handleErrorEvent})}static get watchers(){return{payoutId:["propChanged"],authToken:["propChanged"]}}};export{u as justifi_payout_details}
@@ -1 +1 @@
1
- import{c as t}from"./p-5a62fca2.js";import{A as c}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";class o{async fetchCheckout(o,e){const s=`checkouts/${e}`;return c({authToken:o,apiOrigin:t.proxyApiOrigin}).get(s)}async fetchCheckouts(o,e,s,p){p||(p=t.proxyApiOrigin);const n={Account:o};return c({authToken:e,apiOrigin:p}).get("checkouts",s,null,n)}async complete(o,e,s){const p=`checkouts/${e}/complete`,n={payment_mode:s.payment_mode};return s.payment_token&&(n.payment_token=s.payment_token),c({authToken:o,apiOrigin:t.proxyApiOrigin}).post(p,n)}}export{o as C}
1
+ import{c as t}from"./p-0f23ff58.js";import{A as c}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";class o{async fetchCheckout(o,e){const s=`checkouts/${e}`;return c({authToken:o,apiOrigin:t.proxyApiOrigin}).get(s)}async fetchCheckouts(o,e,s,p){p||(p=t.proxyApiOrigin);const n={Account:o};return c({authToken:e,apiOrigin:p}).get("checkouts",s,null,n)}async complete(o,e,s){const p=`checkouts/${e}/complete`,n={payment_mode:s.payment_mode};return s.payment_token&&(n.payment_token=s.payment_token),c({authToken:o,apiOrigin:t.proxyApiOrigin}).post(p,n)}}export{o as C}
@@ -1 +1 @@
1
- import{r as s,c as i,h as t}from"./p-2783e363.js";import{b as e}from"./p-f4722957.js";import{c as a}from"./p-5a62fca2.js";import{C as o}from"./p-16d2932d.js";import{C as c}from"./p-14c91ffd.js";import{i as r,v as d,H as h,a as n}from"./p-7a975a3c.js";import{B as l}from"./p-32a5bf4e.js";import{S as f}from"./p-bfe9748b.js";import{t as v}from"./p-ef4c49b9.js";import{S as m}from"./p-0cc6c539.js";import{H as b}from"./p-8a94d2c8.js";import"./p-f20b6ce1.js";const p=class{constructor(t){s(this,t),this.submitEvent=i(this,"submit-event",7),this.errorEvent=i(this,"error-event",7),this.loaded=i(this,"loaded",7),this.completeCheckout=async s=>{this.complete({payment:s,onSuccess:this.onSubmitted,onError:this.onError})},this.onSubmitted=s=>{this.submitEvent.emit({response:s}),this.renderState="success"},this.onError=({error:s,code:i,severity:t})=>{this.serverError=s,this.errorEvent.emit({errorCode:i,message:s,severity:t}),this.renderState="error"},this.iframeOrigin=a.iframeOrigin,this.authToken=void 0,this.getCheckout=void 0,this.complete=void 0,this.checkoutId=void 0,this.disableCreditCard=void 0,this.disableBankAccount=void 0,this.disableBnpl=void 0,this.disablePaymentMethodGroup=void 0,this.hasLoadedFonts=!1,this.checkout=void 0,this.serverError=void 0,this.renderState="loading",this.creatingNewPaymentMethod=!1,this.insuranceToggled=!1}async fillBillingForm(s){this.paymentMethodOptionsRef.fillBillingForm(s)}componentWillLoad(){this.getCheckout&&(this.fetchData(),r("set",(s=>{const i=n[s];void 0!==i&&(this.insuranceToggled=i,this.fetchData())})))}fetchData(){this.renderState="loading",this.getCheckout({onSuccess:({checkout:s})=>{this.checkout=new o(s);const{status:i}=this.checkout;this.loaded.emit({checkout_status:i}),this.renderState="success"},onError:({error:s,code:i,severity:t})=>{this.serverError=s,this.renderState="error",this.errorEvent.emit({errorCode:i,message:s,severity:t})}})}async submit(s){var i;s.preventDefault(),this.renderState="loading";const t=d(),e=await this.paymentMethodOptionsRef.resolvePaymentMethod(t);e.validationError?this.renderState="error":e.error?(this.renderState="error",this.serverError=e.error.message,this.onError({code:e.error.code,error:e.error.message,severity:c.ERROR})):e.token?this.completeCheckout({payment_mode:"ecom",payment_token:e.token}):"success"===(null===(i=e.bnpl)||void 0===i?void 0:i.status)?this.completeCheckout({payment_mode:"bnpl"}):this.renderState="error"}get isLoading(){return"loading"===this.renderState}get isError(){return"error"===this.renderState}get paymentType(){var s,i,e,a,o;return t("section",null,t("div",{class:!this.isLoading&&"visually-hidden"},t(m,{height:"300px"})),t("div",{class:this.isLoading&&"visually-hidden"},t("justifi-payment-method-options",{ref:s=>this.paymentMethodOptionsRef=s,"show-card":!this.disableCreditCard,"show-ach":!this.disableBankAccount,"show-bnpl":!this.disableBnpl,paymentMethodGroupId:null===(s=this.checkout)||void 0===s?void 0:s.payment_method_group_id,"show-saved-payment-methods":!this.disablePaymentMethodGroup,bnpl:null===(i=this.checkout)||void 0===i?void 0:i.bnpl,authToken:this.authToken,"account-id":null===(e=this.checkout)||void 0===e?void 0:e.account_id,savedPaymentMethods:(null===(a=this.checkout)||void 0===a?void 0:a.payment_methods)||[],paymentAmount:null===(o=this.checkout)||void 0===o?void 0:o.payment_amount,insuranceToggled:this.insuranceToggled})))}get summary(){var s,i;return t("section",null,t("div",{class:!this.isLoading&&"visually-hidden"},t(m,{height:"24px"})),t("div",{class:this.isLoading&&"visually-hidden"},t("div",{part:v},null===(s=this.checkout)||void 0===s?void 0:s.payment_description),t("div",null,t("span",{part:v},"Total")," ",t("span",{part:v},e(+(null===(i=this.checkout)||void 0===i?void 0:i.total_amount))))))}render(){return t(f,{key:"7ea5d909a307d335327b652bc247718a7b2973ff"},t("div",{key:"0f7e9baffebadad78c28c318a770b681cabd7579",class:"row gy-3 jfi-checkout-core"},t("div",{key:"2453b63f1a3cffe56a85b38005a8e3cabd666f47",class:"col-12"},t(h,{key:"ea4bbc494746c1042d8976aa72f66ebc20f257ef",text:"Summary",class:"fs-5 fw-bold pb-3"}),this.summary),t("div",{key:"bee560cf279315e76551513c5135ab1a0b180de4",class:"col-12"},t("slot",{key:"3b2260c580a2a3a4b8bafe46d215cd5821b17815",name:"insurance"})),t("div",{key:"6d0f4b6ea7ea611fe4eacc13e6cf1bf2cddfba64",class:"col-12 mt-4"},t(h,{key:"1eae72a345d5f255573237cf45b4b6359ff5729c",text:"Payment",class:"fs-5 fw-bold pb-3"}),t(b,{key:"89a6fefa7693ef3094128485531cb7c57a314b36",text:"Select payment type",class:"fs-6 fw-bold lh-lg"}),t("div",{key:"ffe09e15c81fbb821fc99031c13b753bfa943596",class:"d-flex flex-column"},this.paymentType)),t("div",{key:"8b635fa70dbaadc8530ccb7105ed9590ce87e2ed",class:"col-12"},t("div",{key:"9caa17a123c1ff08391c48632facfb4fe33809d2",class:"d-flex justify-content-end"},t(l,{key:"53faa444e15b719e9e41d8ce01295f841b9507d2",type:"submit",variant:"primary",onClick:s=>this.submit(s),disabled:this.isLoading,isLoading:this.isLoading,style:{width:"100%"}},"Pay")))))}};export{p as justifi_checkout_core}
1
+ import{r as s,c as i,h as t}from"./p-2783e363.js";import{b as e}from"./p-f4722957.js";import{c as a}from"./p-0f23ff58.js";import{C as o}from"./p-16d2932d.js";import{C as r}from"./p-14c91ffd.js";import{i as c,v as d,H as h,a as n}from"./p-7a975a3c.js";import{B as l}from"./p-32a5bf4e.js";import{S as f}from"./p-bfe9748b.js";import{t as v}from"./p-ef4c49b9.js";import{S as m}from"./p-0cc6c539.js";import{H as b}from"./p-8a94d2c8.js";import"./p-f20b6ce1.js";const p=class{constructor(t){s(this,t),this.submitEvent=i(this,"submit-event",7),this.errorEvent=i(this,"error-event",7),this.loaded=i(this,"loaded",7),this.completeCheckout=async s=>{this.complete({payment:s,onSuccess:this.onSubmitted,onError:this.onError})},this.onSubmitted=s=>{this.submitEvent.emit({response:s}),this.renderState="success"},this.onError=({error:s,code:i,severity:t})=>{this.serverError=s,this.errorEvent.emit({errorCode:i,message:s,severity:t}),this.renderState="error"},this.iframeOrigin=a.iframeOrigin,this.authToken=void 0,this.getCheckout=void 0,this.complete=void 0,this.checkoutId=void 0,this.disableCreditCard=void 0,this.disableBankAccount=void 0,this.disableBnpl=void 0,this.disablePaymentMethodGroup=void 0,this.hasLoadedFonts=!1,this.checkout=void 0,this.serverError=void 0,this.renderState="loading",this.creatingNewPaymentMethod=!1,this.insuranceToggled=!1}async fillBillingForm(s){this.paymentMethodOptionsRef.fillBillingForm(s)}componentWillLoad(){this.getCheckout&&(this.fetchData(),c("set",(s=>{const i=n[s];void 0!==i&&(this.insuranceToggled=i,this.fetchData())})))}fetchData(){this.renderState="loading",this.getCheckout({onSuccess:({checkout:s})=>{this.checkout=new o(s);const{status:i}=this.checkout;this.loaded.emit({checkout_status:i}),this.renderState="success"},onError:({error:s,code:i,severity:t})=>{this.serverError=s,this.renderState="error",this.errorEvent.emit({errorCode:i,message:s,severity:t})}})}async submit(s){var i;s.preventDefault(),this.renderState="loading";const t=d(),e=await this.paymentMethodOptionsRef.resolvePaymentMethod(t);e.validationError?this.renderState="error":e.error?(this.renderState="error",this.serverError=e.error.message,this.onError({code:e.error.code,error:e.error.message,severity:r.ERROR})):e.token?this.completeCheckout({payment_mode:"ecom",payment_token:e.token}):"success"===(null===(i=e.bnpl)||void 0===i?void 0:i.status)?this.completeCheckout({payment_mode:"bnpl"}):this.renderState="error"}get isLoading(){return"loading"===this.renderState}get isError(){return"error"===this.renderState}get paymentType(){var s,i,e,a,o;return t("section",null,t("div",{class:!this.isLoading&&"visually-hidden"},t(m,{height:"300px"})),t("div",{class:this.isLoading&&"visually-hidden"},t("justifi-payment-method-options",{ref:s=>this.paymentMethodOptionsRef=s,"show-card":!this.disableCreditCard,"show-ach":!this.disableBankAccount,"show-bnpl":!this.disableBnpl,paymentMethodGroupId:null===(s=this.checkout)||void 0===s?void 0:s.payment_method_group_id,"show-saved-payment-methods":!this.disablePaymentMethodGroup,bnpl:null===(i=this.checkout)||void 0===i?void 0:i.bnpl,authToken:this.authToken,"account-id":null===(e=this.checkout)||void 0===e?void 0:e.account_id,savedPaymentMethods:(null===(a=this.checkout)||void 0===a?void 0:a.payment_methods)||[],paymentAmount:null===(o=this.checkout)||void 0===o?void 0:o.payment_amount,insuranceToggled:this.insuranceToggled})))}get summary(){var s,i;return t("section",null,t("div",{class:!this.isLoading&&"visually-hidden"},t(m,{height:"24px"})),t("div",{class:this.isLoading&&"visually-hidden"},t("div",{part:v},null===(s=this.checkout)||void 0===s?void 0:s.payment_description),t("div",null,t("span",{part:v},"Total")," ",t("span",{part:v},e(+(null===(i=this.checkout)||void 0===i?void 0:i.total_amount))))))}render(){return t(f,{key:"7ea5d909a307d335327b652bc247718a7b2973ff"},t("div",{key:"0f7e9baffebadad78c28c318a770b681cabd7579",class:"row gy-3 jfi-checkout-core"},t("div",{key:"2453b63f1a3cffe56a85b38005a8e3cabd666f47",class:"col-12"},t(h,{key:"ea4bbc494746c1042d8976aa72f66ebc20f257ef",text:"Summary",class:"fs-5 fw-bold pb-3"}),this.summary),t("div",{key:"bee560cf279315e76551513c5135ab1a0b180de4",class:"col-12"},t("slot",{key:"3b2260c580a2a3a4b8bafe46d215cd5821b17815",name:"insurance"})),t("div",{key:"6d0f4b6ea7ea611fe4eacc13e6cf1bf2cddfba64",class:"col-12 mt-4"},t(h,{key:"1eae72a345d5f255573237cf45b4b6359ff5729c",text:"Payment",class:"fs-5 fw-bold pb-3"}),t(b,{key:"89a6fefa7693ef3094128485531cb7c57a314b36",text:"Select payment type",class:"fs-6 fw-bold lh-lg"}),t("div",{key:"ffe09e15c81fbb821fc99031c13b753bfa943596",class:"d-flex flex-column"},this.paymentType)),t("div",{key:"8b635fa70dbaadc8530ccb7105ed9590ce87e2ed",class:"col-12"},t("div",{key:"9caa17a123c1ff08391c48632facfb4fe33809d2",class:"d-flex justify-content-end"},t(l,{key:"53faa444e15b719e9e41d8ce01295f841b9507d2",type:"submit",variant:"primary",onClick:s=>this.submit(s),disabled:this.isLoading,isLoading:this.isLoading,style:{width:"100%"}},"Pay")))))}};export{p as justifi_checkout_core}
@@ -0,0 +1 @@
1
+ import{A as t}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{c as p}from"./p-0f23ff58.js";class s{async fetchPayments(s,a,r,n){return n||(n=p.proxyApiOrigin),t({authToken:a,apiOrigin:n}).get(`account/${s}/payments`,r)}async fetchPayment(s,a){const r=`payments/${s}`;return t({authToken:a,apiOrigin:p.proxyApiOrigin}).get(r)}}export{s as P}
@@ -1 +1 @@
1
- import{r as t,c as s,h as e}from"./p-2783e363.js";import{P as i}from"./p-e19589a2.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import{P as r}from"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{C as o,a}from"./p-14c91ffd.js";import{g as p,a as n}from"./p-8115b2f4.js";import{E as h}from"./p-9c2e00cc.js";import{c,J as m}from"./p-174b151e.js";import"./p-0e180654.js";import"./p-5a62fca2.js";import"./p-abdbcd8e.js";import"./p-ef4c49b9.js";import"./p-af620972.js";const d=class{constructor(e){t(this,e),this.errorEvent=s(this,"error-event",7),this.paymentService=new i,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.paymentId=void 0,this.authToken=void 0,this.getPaymentDetails=void 0,this.errorMessage=null}componentWillLoad(){c(),this.analytics=new m(this),this.initializeGetPaymentDetails()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetPaymentDetails()}initializeGetPaymentDetails(){this.paymentId&&this.authToken?this.getPaymentDetails=(({id:t,authToken:s,service:e})=>async({onSuccess:i,onError:a})=>{var h;try{const c=await e.fetchPayment(t,s);c.error?a({error:p(c.error),code:n(null===(h=c.error)||void 0===h?void 0:h.code),severity:o.ERROR}):i({payment:new r(c.data)})}catch(t){const s=n(null==t?void 0:t.code);a({error:p(t),code:s,severity:o.ERROR})}})({id:this.paymentId,authToken:this.authToken,service:new i}):(this.errorMessage="Payment ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:a.MISSING_PROPS,severity:o.ERROR}))}render(){return this.errorMessage?h(this.errorMessage):e("payment-details-core",{getPaymentDetails:this.getPaymentDetails,"onError-event":this.handleErrorEvent})}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"]}}};export{d as justifi_payment_details}
1
+ import{r as t,c as s,h as i}from"./p-2783e363.js";import{P as e}from"./p-cc977850.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import{P as r}from"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{C as o,a}from"./p-14c91ffd.js";import{g as p,a as n}from"./p-8115b2f4.js";import{E as h}from"./p-9c2e00cc.js";import{c,J as m}from"./p-5456a794.js";import"./p-0e180654.js";import"./p-0f23ff58.js";import"./p-abdbcd8e.js";import"./p-ef4c49b9.js";import"./p-a07b1816.js";const d=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event",7),this.paymentService=new e,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.paymentId=void 0,this.authToken=void 0,this.getPaymentDetails=void 0,this.errorMessage=null}componentWillLoad(){c(),this.analytics=new m(this),this.initializeGetPaymentDetails()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetPaymentDetails()}initializeGetPaymentDetails(){this.paymentId&&this.authToken?this.getPaymentDetails=(({id:t,authToken:s,service:i})=>async({onSuccess:e,onError:a})=>{var h;try{const c=await i.fetchPayment(t,s);c.error?a({error:p(c.error),code:n(null===(h=c.error)||void 0===h?void 0:h.code),severity:o.ERROR}):e({payment:new r(c.data)})}catch(t){const s=n(null==t?void 0:t.code);a({error:p(t),code:s,severity:o.ERROR})}})({id:this.paymentId,authToken:this.authToken,service:new e}):(this.errorMessage="Payment ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:a.MISSING_PROPS,severity:o.ERROR}))}render(){return this.errorMessage?h(this.errorMessage):i("payment-details-core",{getPaymentDetails:this.getPaymentDetails,"onError-event":this.handleErrorEvent})}static get watchers(){return{paymentId:["propChanged"],authToken:["propChanged"]}}};export{d as justifi_payment_details}
@@ -0,0 +1 @@
1
+ import{A as o}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import{S as r}from"./p-3db8b3c7.js";import{c as s}from"./p-0f23ff58.js";import{C as c}from"./p-14c91ffd.js";import{g as t,a as n}from"./p-8115b2f4.js";class a{async fetchSubAccounts(r,c,t,n){n||(n=s.proxyApiOrigin);const a={Account:r};return o({authToken:c,apiOrigin:n}).get("sub_accounts",t,null,a)}}const i=({accountId:o,authToken:s,service:a,apiOrigin:i})=>async({params:e,onSuccess:p,onError:u})=>{var f,m;try{const d=await a.fetchSubAccounts(o,s,e,i);if(d.error){return u({error:t(d.error),code:n(null===(m=d.error)||void 0===m?void 0:m.code),severity:c.ERROR})}{const o=Object.assign({},d.page_info);p({subAccounts:(null===(f=d.data)||void 0===f?void 0:f.map((o=>new r(o))))||[],pagingInfo:o})}}catch(o){const r=n(null==o?void 0:o.code);return u({error:o.message||o,code:r,severity:c.ERROR})}};export{a as S,i as m}
@@ -1 +1 @@
1
- import{r as t,c as i,h as s}from"./p-2783e363.js";import{C as e,a as r}from"./p-14c91ffd.js";import{c as o,J as a}from"./p-174b151e.js";import{a as p}from"./p-abdbcd8e.js";import{g as n,a as h}from"./p-8115b2f4.js";import{D as d}from"./p-02a0b21e.js";import{c}from"./p-5a62fca2.js";import"./p-af620972.js";import"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";const m=class{constructor(s){t(this,s),this.errorEvent=i(this,"error-event",7),this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.disputeId=void 0,this.authToken=void 0,this.apiOrigin=c.proxyApiOrigin,this.getDispute=void 0,this.errorMessage=null}componentWillLoad(){o(),this.analytics=new a(this),this.initializeGetDispute()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:t,authToken:i,service:s,apiOrigin:r})=>async({onSuccess:o,onError:a})=>{var d;try{const c=await s.fetchDispute(t,i,r);if(c.error)return a({error:n(c.error),code:h(null===(d=c.error)||void 0===d?void 0:d.code),severity:e.ERROR});{const t=Object.assign({},c.page_info);o({dispute:new p(c.data),pagingInfo:t})}}catch(t){const i=h(null==t?void 0:t.code);return a({error:t.message||t,code:i,severity:e.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new d,apiOrigin:this.apiOrigin}):(this.errorMessage="Dispute ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:r.MISSING_PROPS,severity:e.ERROR}))}render(){return s("justifi-dispute-management-core",{key:"3e2a5b24484e8f1e198168910be7880732da3931",getDispute:this.getDispute,disputeId:this.disputeId,authToken:this.authToken,"onError-event":this.handleErrorEvent})}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{m as justifi_dispute_management}
1
+ import{r as t,c as i,h as s}from"./p-2783e363.js";import{C as e,a as r}from"./p-14c91ffd.js";import{c as o,J as a}from"./p-5456a794.js";import{a as p}from"./p-abdbcd8e.js";import{g as n,a as h}from"./p-8115b2f4.js";import{D as d}from"./p-441c1cf8.js";import{c}from"./p-0f23ff58.js";import"./p-a07b1816.js";import"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";const m=class{constructor(s){t(this,s),this.errorEvent=i(this,"error-event",7),this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)},this.disputeId=void 0,this.authToken=void 0,this.apiOrigin=c.proxyApiOrigin,this.getDispute=void 0,this.errorMessage=null}componentWillLoad(){o(),this.analytics=new a(this),this.initializeGetDispute()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeGetDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:t,authToken:i,service:s,apiOrigin:r})=>async({onSuccess:o,onError:a})=>{var d;try{const c=await s.fetchDispute(t,i,r);if(c.error)return a({error:n(c.error),code:h(null===(d=c.error)||void 0===d?void 0:d.code),severity:e.ERROR});{const t=Object.assign({},c.page_info);o({dispute:new p(c.data),pagingInfo:t})}}catch(t){const i=h(null==t?void 0:t.code);return a({error:t.message||t,code:i,severity:e.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new d,apiOrigin:this.apiOrigin}):(this.errorMessage="Dispute ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:r.MISSING_PROPS,severity:e.ERROR}))}render(){return s("justifi-dispute-management-core",{key:"3e2a5b24484e8f1e198168910be7880732da3931",getDispute:this.getDispute,disputeId:this.disputeId,authToken:this.authToken,"onError-event":this.handleErrorEvent})}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{m as justifi_dispute_management}
@@ -1 +1 @@
1
- import{r as t,c as e,h as i}from"./p-2783e363.js";import{c as s,d as a,F as o}from"./p-5844a0f0.js";import{A as r}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{c as n}from"./p-5a62fca2.js";import{C as d}from"./p-525db3e8.js";import{S as b}from"./p-bfe9748b.js";import"./p-abdbcd8e.js";const m=s().shape({amount:a().required("Amount is required").typeError("Amount must be a number").positive("Amount must be positive").test("amount","Refund amount cannot be more than the original payment amount",(function(t){return t<=this.options.context.amount})).nullable()}),c=class{constructor(i){t(this,i),this.submitted=e(this,"submitted",7),this.authToken=void 0,this.paymentId=void 0,this.amount=0,this.submitButtonText="Submit",this.withButton=void 0,this.refundInfoText=void 0,this.errors={},this.isSubmitting=!1}componentWillLoad(){this.formController=new o(m),this.formController.setInitialValues({amount:this.amount,message:""}),this.initializeApi()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}async handleSubmit(t){t.preventDefault(),this.formController.validateAndSubmit(this.submitRefund.bind(this),{amount:this.amount})}async submitRefund(){this.isSubmitting=!0;const t=this.formController.values.getValue();try{await this.api.post(`payments/${this.paymentId}/refunds`,t),this.submitted.emit(t)}catch(t){console.error("Error submitting refund:",t),this.submitted.emit(t)}finally{this.isSubmitting=!1}}handleInput(t,e){this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}initializeApi(){this.authToken||console.warn("Warning: Missing auth-token."),this.api=r({authToken:this.authToken,apiOrigin:n.proxyApiOrigin})}render(){var t;return i(b,{key:"22c804f185486d11df84075a97121bcac4eb98d5"},i("h1",{key:"90bc4a8b5f1753d3e3009a401e5c9894d83e426e"},"Refund"),this.refundInfoText&&i("div",{key:"6899f29d44b254dd4a84e348b9d9ec1013cb1785",class:"d-flex align-items-center flex-row gap-4 border-top border-bottom my-4 p-3",role:"alert"},i("img",{key:"f1860c566f76d09f222a62a71f29d48749504968",src:"/info-icon.svg",alt:"Information",height:"30",width:"30"}),i("p",{key:"73c728b24bf46c9382e75753a9566179d12744fa",class:"m-0",innerHTML:this.refundInfoText})),i("form",{key:"e36904b05ae389cb201e72f69845d1a5b034cb4d",onSubmit:t=>this.handleSubmit(t),class:"d-grid gap-4"},i("div",{key:"deb53d2bde11025bc7b452097456c7cffbe5c16a",class:"form-group"},i("form-control-monetary",{key:"0e5211a2ace4ddf86c2f2452e0596586904b594a",name:"amount",label:"Refund Amount",defaultValue:(null===(t=this.amount)||void 0===t?void 0:t.toString())||"",maskOptions:d.DECIMAL,inputHandler:(t,e)=>this.handleInput(t,e),errorText:this.errors.amount})),i("div",{key:"68826918f7b2051830bd276fa79030a89a5808d1",class:"form-group"},i("form-control-text",{key:"d66b86e6d9d10b6d4853bfebacf758da23362531",name:"notes",label:"Additional Notes",inputHandler:(t,e)=>this.handleInput(t,e),errorText:this.errors.notes})),this.withButton&&i("div",{key:"8ef6f548f2b1a989b04d0a2817ca7a19d1e1dda6",class:"form-group d-flex flex-row-reverse"},i("button",{key:"1a9406e25864fac07c2a97d3b758aec48bffa2be",type:"submit",disabled:!!this.isSubmitting,class:"btn btn-primary ml-auto"},this.submitButtonText))))}};export{c as justifi_refund_form}
1
+ import{r as t,c as e,h as i}from"./p-2783e363.js";import{c as s,d as a,F as o}from"./p-5844a0f0.js";import{A as r}from"./p-0e180654.js";import"./p-16d2932d.js";import"./p-56f6ce4c.js";import"./p-6fbd6abb.js";import"./p-3db8b3c7.js";import{c as n}from"./p-0f23ff58.js";import{C as d}from"./p-525db3e8.js";import{S as b}from"./p-bfe9748b.js";import"./p-abdbcd8e.js";const m=s().shape({amount:a().required("Amount is required").typeError("Amount must be a number").positive("Amount must be positive").test("amount","Refund amount cannot be more than the original payment amount",(function(t){return t<=this.options.context.amount})).nullable()}),f=class{constructor(i){t(this,i),this.submitted=e(this,"submitted",7),this.authToken=void 0,this.paymentId=void 0,this.amount=0,this.submitButtonText="Submit",this.withButton=void 0,this.refundInfoText=void 0,this.errors={},this.isSubmitting=!1}componentWillLoad(){this.formController=new o(m),this.formController.setInitialValues({amount:this.amount,message:""}),this.initializeApi()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}async handleSubmit(t){t.preventDefault(),this.formController.validateAndSubmit(this.submitRefund.bind(this),{amount:this.amount})}async submitRefund(){this.isSubmitting=!0;const t=this.formController.values.getValue();try{await this.api.post(`payments/${this.paymentId}/refunds`,t),this.submitted.emit(t)}catch(t){console.error("Error submitting refund:",t),this.submitted.emit(t)}finally{this.isSubmitting=!1}}handleInput(t,e){this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}initializeApi(){this.authToken||console.warn("Warning: Missing auth-token."),this.api=r({authToken:this.authToken,apiOrigin:n.proxyApiOrigin})}render(){var t;return i(b,{key:"22c804f185486d11df84075a97121bcac4eb98d5"},i("h1",{key:"90bc4a8b5f1753d3e3009a401e5c9894d83e426e"},"Refund"),this.refundInfoText&&i("div",{key:"6899f29d44b254dd4a84e348b9d9ec1013cb1785",class:"d-flex align-items-center flex-row gap-4 border-top border-bottom my-4 p-3",role:"alert"},i("img",{key:"f1860c566f76d09f222a62a71f29d48749504968",src:"/info-icon.svg",alt:"Information",height:"30",width:"30"}),i("p",{key:"73c728b24bf46c9382e75753a9566179d12744fa",class:"m-0",innerHTML:this.refundInfoText})),i("form",{key:"e36904b05ae389cb201e72f69845d1a5b034cb4d",onSubmit:t=>this.handleSubmit(t),class:"d-grid gap-4"},i("div",{key:"deb53d2bde11025bc7b452097456c7cffbe5c16a",class:"form-group"},i("form-control-monetary",{key:"0e5211a2ace4ddf86c2f2452e0596586904b594a",name:"amount",label:"Refund Amount",defaultValue:(null===(t=this.amount)||void 0===t?void 0:t.toString())||"",maskOptions:d.DECIMAL,inputHandler:(t,e)=>this.handleInput(t,e),errorText:this.errors.amount})),i("div",{key:"68826918f7b2051830bd276fa79030a89a5808d1",class:"form-group"},i("form-control-text",{key:"d66b86e6d9d10b6d4853bfebacf758da23362531",name:"notes",label:"Additional Notes",inputHandler:(t,e)=>this.handleInput(t,e),errorText:this.errors.notes})),this.withButton&&i("div",{key:"8ef6f548f2b1a989b04d0a2817ca7a19d1e1dda6",class:"form-group d-flex flex-row-reverse"},i("button",{key:"1a9406e25864fac07c2a97d3b758aec48bffa2be",type:"submit",disabled:!!this.isSubmitting,class:"btn btn-primary ml-auto"},this.submitButtonText))))}};export{f as justifi_refund_form}