@justifi/webcomponents 5.0.0-rc-1 → 5.0.0

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-05db7d8e.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-48c58886.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-95b9be89.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-223933b4.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-4f569cbf.entry.js → p-01f32098.entry.js} +1 -1
  67. package/dist/webcomponents/{p-f0f3442e.entry.js → p-050a6855.entry.js} +1 -1
  68. package/dist/webcomponents/{p-5a62fca2.js → p-0f23ff58.js} +1 -1
  69. package/dist/webcomponents/p-1e6077f4.js +1 -0
  70. package/dist/webcomponents/{p-53cf5687.entry.js → p-20a24f3a.entry.js} +1 -1
  71. package/dist/webcomponents/p-238f1ff8.entry.js +1 -0
  72. package/dist/webcomponents/{p-ecced6e5.entry.js → p-2462bf86.entry.js} +1 -1
  73. package/dist/webcomponents/p-3eabbdd4.entry.js +1 -0
  74. package/dist/webcomponents/{p-02a0b21e.js → p-441c1cf8.js} +1 -1
  75. package/dist/webcomponents/{p-a17be58e.entry.js → p-47e7f876.entry.js} +1 -1
  76. package/dist/webcomponents/{p-c740f609.entry.js → p-4972d608.entry.js} +1 -1
  77. package/dist/webcomponents/{p-733dc19b.entry.js → p-5bbe1133.entry.js} +1 -1
  78. package/dist/webcomponents/p-6ab77b89.js +1 -0
  79. package/dist/webcomponents/{p-a41a1843.entry.js → p-70eea098.entry.js} +1 -1
  80. package/dist/webcomponents/{p-57281853.entry.js → p-80b1bcc2.entry.js} +1 -1
  81. package/dist/webcomponents/{p-9c652bc3.entry.js → p-88acfa7c.entry.js} +1 -1
  82. package/dist/webcomponents/{p-9e990e7d.entry.js → p-8fe80110.entry.js} +1 -1
  83. package/dist/webcomponents/{p-95e688bd.entry.js → p-9c2d5229.entry.js} +1 -1
  84. package/dist/webcomponents/{p-a520766d.entry.js → p-a47971d8.entry.js} +1 -1
  85. package/dist/webcomponents/{p-22034555.entry.js → p-b6d76082.entry.js} +1 -1
  86. package/dist/webcomponents/{p-54d36e97.js → p-bb0f8b70.js} +1 -1
  87. package/dist/webcomponents/{p-2ed8e8db.entry.js → p-bbcaa29b.entry.js} +1 -1
  88. package/dist/webcomponents/{p-2a6f8329.entry.js → p-c212414b.entry.js} +1 -1
  89. package/dist/webcomponents/p-cc977850.js +1 -0
  90. package/dist/webcomponents/{p-8a550a5e.entry.js → p-d8fdf2b5.entry.js} +1 -1
  91. package/dist/webcomponents/p-db8c12ee.js +1 -0
  92. package/dist/webcomponents/{p-d67bb568.entry.js → p-e396506c.entry.js} +1 -1
  93. package/dist/webcomponents/{p-96ea95ce.entry.js → p-e4421e98.entry.js} +1 -1
  94. package/dist/webcomponents/{p-174b151e.js → p-e7bb6520.js} +1 -1
  95. package/dist/webcomponents/{p-f6f8dabc.js → p-edb57087.js} +1 -1
  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-af620972.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,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 e}from"./p-2783e363.js";import{P as i}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-e7bb6520.js";import"./p-0e180654.js";import"./p-0f23ff58.js";import"./p-abdbcd8e.js";import"./p-ef4c49b9.js";import"./p-1e6077f4.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 +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 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{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,h as n,H as i,g as t}from"./p-2783e363.js";import{F as o}from"./p-4d916b2d.js";import{p as r}from"./p-af620972.js";import{a}from"./p-4cc3c7f9.js";import{i as s,b as c,a as u,c as d,l as f}from"./p-ef4c49b9.js";import"./p-f20b6ce1.js";var l,m={exports:{}};l=m,console.info("\nIFRAME-RESIZER\n\nIframe-Resizer 5 is now available via the following two packages:\n\n * @iframe-resizer/parent\n * @iframe-resizer/child\n\nAdditionally their are also new versions of iframe-resizer for React, Vue, and jQuery.\n\nVersion 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n"),function(e){if("undefined"!=typeof window){var n,i,t=0,o=!1,r=!1,a=7,s="[iFrameSizer]",c=s.length,u=null,d=window.requestAnimationFrame,f=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),m={},h=null,w=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){z("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),b={};window.jQuery!==e&&((i=window.jQuery).fn?i.fn.iFrameResize||(i.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,i){H(i,e)})).end()}):x("","Unable to bind to jQuery, it is not fully loaded.")),"function"==typeof e&&e.amd?e([],q):l.exports=q(),window.iFrameResize=window.iFrameResize||q()}function g(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function p(e,n,i){e.addEventListener(n,i,!1)}function v(e,n,i){e.removeEventListener(n,i,!1)}function y(e){return m[e]?m[e].log:o}function k(e,n){I("log",e,n,y(e))}function x(e,n){I("info",e,n,y(e))}function z(e,n){I("warn",e,n,!0)}function I(e,n,i,t){!0===t&&"object"==typeof window.console&&console[e](function(e){return s+"["+function(e){var n="Host page: "+e;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),n}(e)+"]"}(n),i)}function M(e){function n(){i("Height"),i("Width"),C((function(){E(L),T(P),h("onResized",L)}),L,"init")}function i(e){var n=Number(m[P]["max"+e]),i=Number(m[P]["min"+e]),t=e.toLowerCase(),o=Number(L[t]);k(P,"Checking "+t+" is in range "+i+"-"+n),o<i&&(o=i,k(P,"Set "+t+" to min value")),o>n&&(o=n,k(P,"Set "+t+" to max value")),L[t]=""+o}function t(e){return H.slice(H.indexOf(":")+a+e)}function o(e,n){var i,t;i=function(){var i,t;W("Send Page Info","pageInfo:"+(i=document.body.getBoundingClientRect(),t=L.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(t.top-i.top,10),offsetLeft:parseInt(t.left-i.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},b[t=n]||(b[t]=setTimeout((function(){b[t]=null,i()}),32))}function r(e){var n=e.getBoundingClientRect();return R(P),{x:Math.floor(Number(n.left)+Number(u.x)),y:Math.floor(Number(n.top)+Number(u.y))}}function d(e){var n=e?r(L.iframe):{x:0,y:0},i={x:Number(L.width)+n.x,y:Number(L.height)+n.y};k(P,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(u=i,f(),k(P,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](i.x,i.y):z(P,"Unable to scroll to requested position, window.parentIFrame not found")}function f(){!1===h("onScroll",u)?S():T(P)}function l(e){var n={};if(0===Number(L.width)&&0===Number(L.height)){var i=t(9).split(":");n={x:i[1],y:i[0]}}else n={x:L.width,y:L.height};h(e,{iframe:L.iframe,screenX:Number(n.x),screenY:Number(n.y),type:L.type})}function h(e,n){return F(P,e,n)}var w,g,y,I,M,j,H=e.data,L={},P=null;"[iFrameResizerChild]Ready"===H?function(){for(var e in m)W("iFrame requested init",A(e),m[e].iframe,e)}():s===(""+H).slice(0,c)&&H.slice(c).split(":")[0]in m?(I=(y=H.slice(c).split(":"))[1]?parseInt(y[1],10):0,M=m[y[0]]&&m[y[0]].iframe,j=getComputedStyle(M),L={iframe:M,id:y[0],height:I+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}(j)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(j),width:y[2],type:y[3]},m[P=L.id]&&(m[P].loaded=!0),(g=L.type in{true:1,false:1,undefined:1})&&k(P,"Ignoring init message from meta parent page"),!g&&function(e){var n=!0;return m[e]||(n=!1,z(L.type+" No settings for "+e+". Message was: "+H)),n}(P)&&(k(P,"Received: "+H),w=!0,null===L.iframe&&(z(P,"IFrame ("+L.id+") not found"),w=!1),w&&function(){var n,i=e.origin,t=m[P]&&m[P].checkOrigin;if(t&&""+i!="null"&&!(t.constructor===Array?function(){var e=0,n=!1;for(k(P,"Checking connection is from allowed list of origins: "+t);e<t.length;e++)if(t[e]===i){n=!0;break}return n}():(k(P,"Checking connection is from: "+(n=m[P]&&m[P].remoteHost)),i===n)))throw new Error("Unexpected message received from: "+i+" for "+L.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(m[P]&&m[P].firstRun&&m[P]&&(m[P].firstRun=!1),L.type){case"close":O(L.iframe);break;case"message":c=t(6),k(P,"onMessage passed: {iframe: "+L.iframe.id+", message: "+c+"}"),h("onMessage",{iframe:L.iframe,message:JSON.parse(c)}),k(P,"--");break;case"mouseenter":l("onMouseEnter");break;case"mouseleave":l("onMouseLeave");break;case"autoResize":m[P].autoResize=JSON.parse(t(9));break;case"scrollTo":d(!1);break;case"scrollToOffset":d(!0);break;case"pageInfo":o(m[P]&&m[P].iframe,P),function(){function e(e,t){function r(){m[i]?o(m[i].iframe,i):n()}["scroll","resize"].forEach((function(n){k(i,e+n+" listener for sendPageInfo"),t(window,n,r)}))}function n(){e("Remove ",v)}var i=P;e("Add ",p),m[i]&&(m[i].stopPageInfo=n)}();break;case"pageInfoStop":m[P]&&m[P].stopPageInfo&&(m[P].stopPageInfo(),delete m[P].stopPageInfo);break;case"inPageLink":i=t(9).split("#")[1]||"",a=decodeURIComponent(i),(s=document.getElementById(a)||document.getElementsByName(a)[0])?(e=r(s),k(P,"Moving to in page link (#"+i+") at x: "+e.x+" y: "+e.y),u={x:e.x,y:e.y},f(),k(P,"--")):window.top===window.self?k(P,"In page link #"+i+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(i):k(P,"In page link #"+i+" not found and window.parentIFrame not found");break;case"reset":N(L);break;case"init":n(),h("onInit",L.iframe);break;default:0===Number(L.width)&&0===Number(L.height)?z("Unsupported message received ("+L.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}var e,i,a,s,c}())):x(P,"Ignored: "+H)}function F(e,n,i){var t=null,o=null;if(m[e]){if("function"!=typeof(t=m[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=t(i)}return o}function j(e){delete m[e.id]}function O(e){var i=e.id;if(!1!==F(i,"onClose",i)){k(i,"Removing iFrame: "+i);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){z(e)}F(i,"onClosed",i),k(i,"--"),j(e),n&&(n.disconnect(),n=null)}else k(i,"Close iframe cancelled by onClose event")}function R(n){null===u&&k(n,"Get page position: "+(u={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+u.y)}function T(e){null!==u&&(window.scrollTo(u.x,u.y),k(e,"Set page position: "+u.x+","+u.y),S())}function S(){u=null}function N(e){k(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),R(e.id),C((function(){E(e),W("reset","reset",e.iframe,e.id)}),e,"reset")}function E(e){function n(n){r||"0"!==e[n]||(r=!0,k(t,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(m).forEach((function(e){!function(e){function n(n){return"0px"===(m[e]&&m[e].iframe.style[n])}m[e]&&null!==m[e].iframe.offsetParent&&(n("height")||n("width"))&&W("Visibility change","resize",m[e].iframe,e)}(e)}))}function n(n){k("window","Mutation observed: "+n[0].target+" "+n[0].type),L(e,16)}var i,t=g();t&&(i=document.querySelector("body"),new t(n).observe(i,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}())}function i(i){!function(n){e.id?(e.iframe.style[n]=e[n]+"px",k(e.id,"IFrame ("+t+") "+n+" set to "+e[n]+"px")):k("undefined","messageData id not set")}(i),n(i)}var t=e.iframe.id;m[t]&&(m[t].sizeHeight&&i("height"),m[t].sizeWidth&&i("width"))}function C(e,n,i){i!==n.type&&d&&!window.jasmine?(k(n.id,"Requesting animation frame"),d(e)):e()}function W(e,n,i,t,o){var r,a=!1;m[t=t||i.id]&&(i&&"contentWindow"in i&&null!==i.contentWindow?(k(t,"["+e+"] Sending msg to iframe["+t+"] ("+n+") targetOrigin: "+(r=m[t]&&m[t].targetOrigin)),i.contentWindow.postMessage(s+n,r)):z(t,"["+e+"] IFrame("+t+") not found"),o&&m[t]&&m[t].warningTimeout&&(m[t].msgTimeout=setTimeout((function(){!m[t]||m[t].loaded||a||(a=!0,z(t,"IFrame has not responded within "+m[t].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),m[t].warningTimeout)))}function A(e){return e+":"+m[e].bodyMarginV1+":"+m[e].sizeWidth+":"+m[e].log+":"+m[e].interval+":"+m[e].enablePublicMethods+":"+m[e].autoResize+":"+m[e].bodyMargin+":"+m[e].heightCalculationMethod+":"+m[e].bodyBackground+":"+m[e].bodyPadding+":"+m[e].tolerance+":"+m[e].inPageLinks+":"+m[e].resizeFrom+":"+m[e].widthCalculationMethod+":"+m[e].mouseEvents}function H(i,r){function a(e){var n=e.split("Callback");if(2===n.length){var i="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[i]=this[e],delete this[e],z(u,"Deprecated: '"+e+"' has been renamed '"+i+"'. The old method will be removed in the next major version.")}}var s,c,u=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var n;return""===e&&(i.id=(n=r&&r.id||w.id+t++,null!==document.getElementById(n)&&(n+=t++),e=n),o=(r||{}).log,k(e,"Added missing iframe ID: "+e+" ("+i.src+")")),e}(i.id);u in m&&"iFrameResizer"in i?z(u,"Ignored iFrame, already setup."):(function(e){var n;e=e||{},m[u]=Object.create(null),m[u].iframe=i,m[u].firstRun=!0,m[u].remoteHost=i.src&&i.src.split("/").slice(0,3).join("/"),function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(a,e),function(e){for(var n in w)Object.prototype.hasOwnProperty.call(w,n)&&(m[u][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:w[n])}(e),m[u]&&(m[u].targetOrigin=!0===m[u].checkOrigin?""===(n=m[u].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*")}(r),function(){switch(k(u,"IFrame scrolling "+(m[u]&&m[u].scrolling?"enabled":"disabled")+" for "+u),i.style.overflow=!1===(m[u]&&m[u].scrolling)?"hidden":"auto",m[u]&&m[u].scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=m[u]?m[u].scrolling:"no"}}(),function(){function e(e){var n=m[u][e];1/0!==n&&0!==n&&(i.style[e]="number"==typeof n?n+"px":n,k(u,"Set "+e+" = "+i.style[e]))}function n(e){if(m[u]["min"+e]>m[u]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}n("Height"),n("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!=typeof(m[u]&&m[u].bodyMargin)&&"0"!==(m[u]&&m[u].bodyMargin)||(m[u].bodyMarginV1=m[u].bodyMargin,m[u].bodyMargin=m[u].bodyMargin+"px"),s=A(u),(c=g())&&(n=function(e){if(!i.parentNode)return null;var n=new e((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===i&&O(i)}))}))}));return n.observe(i.parentNode,{childList:!0}),n}(c)),p(i,"load",(function(){W("iFrame.onload",s,i,e,!0),(!m[u]||!m[u].firstRun)&&m[u]&&m[u].heightCalculationMethod in f&&N({iframe:i,height:0,width:0,type:"init"})})),W("init",s,i,e,!0),m[u]&&(m[u].iframe.iFrameResizer={close:O.bind(null,m[u].iframe),removeListeners:j.bind(null,m[u].iframe),resize:W.bind(null,"Window resize","resize",m[u].iframe),moveToAnchor:function(e){W("Move to anchor","moveToAnchor:"+e,m[u].iframe,u)},sendMessage:function(e){W("Send Message","message:"+(e=JSON.stringify(e)),m[u].iframe,u)}}))}function L(e,n){null===h&&(h=setTimeout((function(){h=null,e()}),n))}function P(){"hidden"!==document.visibilityState&&(k("document","Trigger event: Visibility change"),L((function(){V("Tab Visible","resize")}),16))}function V(e,n){Object.keys(m).forEach((function(i){(function(e){return m[e]&&"parent"===m[e].resizeFrom&&m[e].autoResize&&!m[e].firstRun})(i)&&W(e,n,m[i].iframe,i)}))}function q(){function n(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),H(n,e),i.push(n))}var i;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!d;e+=1)d=window[n[e]+"RequestAnimationFrame"];d?d=d.bind(window):k("setup","RequestAnimationFrame not supported")}(),p(window,"message",M),p(window,"resize",(function(){k("window","Trigger event: resize"),L((function(){V("Window resize","resize")}),16)})),p(document,"visibilitychange",P),p(document,"-webkit-visibilitychange",P),function(t,o){switch(i=[],function(e){e&&e.enablePublicMethods&&z("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(t),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,t));break;case"object":n(t,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return i}}}();const h=m.exports;class w{constructor(e,n){this.iframe=e,this.iframeOrigin=n}postMessage(e,n){const i=Object.assign({eventType:e},n);this.iframe.contentWindow.postMessage(i,this.iframeOrigin)}addMessageListener(e){window.addEventListener("message",e)}removeMessageListener(e){window.removeEventListener("message",e)}postMessageWithResponseListener(e,n){return new Promise((i=>{const t=n=>{n.data.eventType===e&&(window.removeEventListener("message",t),i(n.data.data))};window.addEventListener("message",t),this.postMessage(e,n)}))}}const b=class{constructor(n){e(this,n),this.dispatchMessageEvent=e=>{const{eventType:n,data:i}=e.data;(null==i?void 0:i.id)===this.inputId&&("focused"===n&&(this.isFocused=!0),"blurred"===n&&(this.isFocused=!1))},this.isFocused=!1,this.isValid=!0,this.errorText=void 0,this.iframeLoaded=!1,this.inputId=void 0,this.label=void 0,this.iframeOrigin=void 0}disconnectedCallback(){this.frameService.removeMessageListener(this.dispatchMessageEvent)}async validate(){const e=await this.frameService.postMessageWithResponseListener("validate");return this.isValid=e.isValid,this.errorText=e.error.message,e}async tokenize(e,n,i){return this.frameService.postMessageWithResponseListener("tokenize",{clientId:e,paymentMethodMetadata:n,account:i,componentVersion:r.version})}initializeFrameCommunicationService(){var e;this.frameService=new w(this.iframeElement,this.iframeOrigin),null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent)}get part(){return this.isFocused&&!this.isValid?s:this.isValid?this.isFocused?u:d:c}get style(){return this.isFocused?this.isValid?a.focused:a.focusedAndInvalid:null}get urlParams(){const e=Object.fromEntries(Object.entries(a.fontStyles).map((([e,n])=>[e,btoa(String(n))])));return new URLSearchParams(e).toString()}render(){return n(i,{key:"c0eca45af47958837580cc400e923135db070e75",class:"form-group d-flex flex-column"},n("div",{key:"374d757e67e81deec4d7e20255710d5256983cb6",style:{visibility:this.iframeLoaded?"visible":"hidden",height:this.iframeLoaded?"auto":"0"}},n("label",{key:"6054db3876710458e93dd8a11f7354d737e737d2",class:"form-label",htmlFor:"",part:f},this.label||""),n("div",{key:"2ccc97c83798026666fc0abc4d23e6d83b19b2fa",class:"p-0 d-flex form-control "+(this.isValid?"":"is-invalid"),part:this.part,style:Object.assign(Object.assign({},this.style),{overflow:"hidden"})},n("iframe",{key:"c71d778eaf2008ee4a2b237842e1dbec7abf5d43",id:this.inputId,name:this.inputId,src:`${this.iframeOrigin}?${this.urlParams}`,ref:e=>{this.iframeElement=e,this.initializeFrameCommunicationService()},width:"100%",onLoad:()=>{h({log:!1,onResized:()=>{this.iframeLoaded=!0}},this.iframeElement)}})),n(o,{key:"6f756711fccec14a52fa55e9faf0638546e80f77",errorText:this.errorText,name:this.inputId})))}get el(){return t(this)}};export{b as iframe_input}
1
+ import{r as e,h as n,H as i,g as t}from"./p-2783e363.js";import{F as o}from"./p-4d916b2d.js";import{p as r}from"./p-1e6077f4.js";import{a}from"./p-4cc3c7f9.js";import{i as s,b as c,a as u,c as d,l as f}from"./p-ef4c49b9.js";import"./p-f20b6ce1.js";var l,m={exports:{}};l=m,console.info("\nIFRAME-RESIZER\n\nIframe-Resizer 5 is now available via the following two packages:\n\n * @iframe-resizer/parent\n * @iframe-resizer/child\n\nAdditionally their are also new versions of iframe-resizer for React, Vue, and jQuery.\n\nVersion 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n"),function(e){if("undefined"!=typeof window){var n,i,t=0,o=!1,r=!1,a=7,s="[iFrameSizer]",c=s.length,u=null,d=window.requestAnimationFrame,f=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),m={},h=null,w=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,license:"1jqr0si6pnt",log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){z("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}}),b={};window.jQuery!==e&&((i=window.jQuery).fn?i.fn.iFrameResize||(i.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,i){H(i,e)})).end()}):x("","Unable to bind to jQuery, it is not fully loaded.")),"function"==typeof e&&e.amd?e([],q):l.exports=q(),window.iFrameResize=window.iFrameResize||q()}function g(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function p(e,n,i){e.addEventListener(n,i,!1)}function v(e,n,i){e.removeEventListener(n,i,!1)}function y(e){return m[e]?m[e].log:o}function k(e,n){I("log",e,n,y(e))}function x(e,n){I("info",e,n,y(e))}function z(e,n){I("warn",e,n,!0)}function I(e,n,i,t){!0===t&&"object"==typeof window.console&&console[e](function(e){return s+"["+function(e){var n="Host page: "+e;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),n}(e)+"]"}(n),i)}function M(e){function n(){i("Height"),i("Width"),C((function(){E(L),T(P),h("onResized",L)}),L,"init")}function i(e){var n=Number(m[P]["max"+e]),i=Number(m[P]["min"+e]),t=e.toLowerCase(),o=Number(L[t]);k(P,"Checking "+t+" is in range "+i+"-"+n),o<i&&(o=i,k(P,"Set "+t+" to min value")),o>n&&(o=n,k(P,"Set "+t+" to max value")),L[t]=""+o}function t(e){return H.slice(H.indexOf(":")+a+e)}function o(e,n){var i,t;i=function(){var i,t;W("Send Page Info","pageInfo:"+(i=document.body.getBoundingClientRect(),t=L.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(t.top-i.top,10),offsetLeft:parseInt(t.left-i.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},b[t=n]||(b[t]=setTimeout((function(){b[t]=null,i()}),32))}function r(e){var n=e.getBoundingClientRect();return R(P),{x:Math.floor(Number(n.left)+Number(u.x)),y:Math.floor(Number(n.top)+Number(u.y))}}function d(e){var n=e?r(L.iframe):{x:0,y:0},i={x:Number(L.width)+n.x,y:Number(L.height)+n.y};k(P,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top===window.self?(u=i,f(),k(P,"--")):window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](i.x,i.y):z(P,"Unable to scroll to requested position, window.parentIFrame not found")}function f(){!1===h("onScroll",u)?S():T(P)}function l(e){var n={};if(0===Number(L.width)&&0===Number(L.height)){var i=t(9).split(":");n={x:i[1],y:i[0]}}else n={x:L.width,y:L.height};h(e,{iframe:L.iframe,screenX:Number(n.x),screenY:Number(n.y),type:L.type})}function h(e,n){return F(P,e,n)}var w,g,y,I,M,j,H=e.data,L={},P=null;"[iFrameResizerChild]Ready"===H?function(){for(var e in m)W("iFrame requested init",A(e),m[e].iframe,e)}():s===(""+H).slice(0,c)&&H.slice(c).split(":")[0]in m?(I=(y=H.slice(c).split(":"))[1]?parseInt(y[1],10):0,M=m[y[0]]&&m[y[0]].iframe,j=getComputedStyle(M),L={iframe:M,id:y[0],height:I+function(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}(j)+function(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}(j),width:y[2],type:y[3]},m[P=L.id]&&(m[P].loaded=!0),(g=L.type in{true:1,false:1,undefined:1})&&k(P,"Ignoring init message from meta parent page"),!g&&function(e){var n=!0;return m[e]||(n=!1,z(L.type+" No settings for "+e+". Message was: "+H)),n}(P)&&(k(P,"Received: "+H),w=!0,null===L.iframe&&(z(P,"IFrame ("+L.id+") not found"),w=!1),w&&function(){var n,i=e.origin,t=m[P]&&m[P].checkOrigin;if(t&&""+i!="null"&&!(t.constructor===Array?function(){var e=0,n=!1;for(k(P,"Checking connection is from allowed list of origins: "+t);e<t.length;e++)if(t[e]===i){n=!0;break}return n}():(k(P,"Checking connection is from: "+(n=m[P]&&m[P].remoteHost)),i===n)))throw new Error("Unexpected message received from: "+i+" for "+L.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(m[P]&&m[P].firstRun&&m[P]&&(m[P].firstRun=!1),L.type){case"close":O(L.iframe);break;case"message":c=t(6),k(P,"onMessage passed: {iframe: "+L.iframe.id+", message: "+c+"}"),h("onMessage",{iframe:L.iframe,message:JSON.parse(c)}),k(P,"--");break;case"mouseenter":l("onMouseEnter");break;case"mouseleave":l("onMouseLeave");break;case"autoResize":m[P].autoResize=JSON.parse(t(9));break;case"scrollTo":d(!1);break;case"scrollToOffset":d(!0);break;case"pageInfo":o(m[P]&&m[P].iframe,P),function(){function e(e,t){function r(){m[i]?o(m[i].iframe,i):n()}["scroll","resize"].forEach((function(n){k(i,e+n+" listener for sendPageInfo"),t(window,n,r)}))}function n(){e("Remove ",v)}var i=P;e("Add ",p),m[i]&&(m[i].stopPageInfo=n)}();break;case"pageInfoStop":m[P]&&m[P].stopPageInfo&&(m[P].stopPageInfo(),delete m[P].stopPageInfo);break;case"inPageLink":i=t(9).split("#")[1]||"",a=decodeURIComponent(i),(s=document.getElementById(a)||document.getElementsByName(a)[0])?(e=r(s),k(P,"Moving to in page link (#"+i+") at x: "+e.x+" y: "+e.y),u={x:e.x,y:e.y},f(),k(P,"--")):window.top===window.self?k(P,"In page link #"+i+" not found"):window.parentIFrame?window.parentIFrame.moveToAnchor(i):k(P,"In page link #"+i+" not found and window.parentIFrame not found");break;case"reset":N(L);break;case"init":n(),h("onInit",L.iframe);break;default:0===Number(L.width)&&0===Number(L.height)?z("Unsupported message received ("+L.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}var e,i,a,s,c}())):x(P,"Ignored: "+H)}function F(e,n,i){var t=null,o=null;if(m[e]){if("function"!=typeof(t=m[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");o=t(i)}return o}function j(e){delete m[e.id]}function O(e){var i=e.id;if(!1!==F(i,"onClose",i)){k(i,"Removing iFrame: "+i);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){z(e)}F(i,"onClosed",i),k(i,"--"),j(e),n&&(n.disconnect(),n=null)}else k(i,"Close iframe cancelled by onClose event")}function R(n){null===u&&k(n,"Get page position: "+(u={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset}).x+","+u.y)}function T(e){null!==u&&(window.scrollTo(u.x,u.y),k(e,"Set page position: "+u.x+","+u.y),S())}function S(){u=null}function N(e){k(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),R(e.id),C((function(){E(e),W("reset","reset",e.iframe,e.id)}),e,"reset")}function E(e){function n(n){r||"0"!==e[n]||(r=!0,k(t,"Hidden iFrame detected, creating visibility listener"),function(){function e(){Object.keys(m).forEach((function(e){!function(e){function n(n){return"0px"===(m[e]&&m[e].iframe.style[n])}m[e]&&null!==m[e].iframe.offsetParent&&(n("height")||n("width"))&&W("Visibility change","resize",m[e].iframe,e)}(e)}))}function n(n){k("window","Mutation observed: "+n[0].target+" "+n[0].type),L(e,16)}var i,t=g();t&&(i=document.querySelector("body"),new t(n).observe(i,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}))}())}function i(i){!function(n){e.id?(e.iframe.style[n]=e[n]+"px",k(e.id,"IFrame ("+t+") "+n+" set to "+e[n]+"px")):k("undefined","messageData id not set")}(i),n(i)}var t=e.iframe.id;m[t]&&(m[t].sizeHeight&&i("height"),m[t].sizeWidth&&i("width"))}function C(e,n,i){i!==n.type&&d&&!window.jasmine?(k(n.id,"Requesting animation frame"),d(e)):e()}function W(e,n,i,t,o){var r,a=!1;m[t=t||i.id]&&(i&&"contentWindow"in i&&null!==i.contentWindow?(k(t,"["+e+"] Sending msg to iframe["+t+"] ("+n+") targetOrigin: "+(r=m[t]&&m[t].targetOrigin)),i.contentWindow.postMessage(s+n,r)):z(t,"["+e+"] IFrame("+t+") not found"),o&&m[t]&&m[t].warningTimeout&&(m[t].msgTimeout=setTimeout((function(){!m[t]||m[t].loaded||a||(a=!0,z(t,"IFrame has not responded within "+m[t].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),m[t].warningTimeout)))}function A(e){return e+":"+m[e].bodyMarginV1+":"+m[e].sizeWidth+":"+m[e].log+":"+m[e].interval+":"+m[e].enablePublicMethods+":"+m[e].autoResize+":"+m[e].bodyMargin+":"+m[e].heightCalculationMethod+":"+m[e].bodyBackground+":"+m[e].bodyPadding+":"+m[e].tolerance+":"+m[e].inPageLinks+":"+m[e].resizeFrom+":"+m[e].widthCalculationMethod+":"+m[e].mouseEvents}function H(i,r){function a(e){var n=e.split("Callback");if(2===n.length){var i="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[i]=this[e],delete this[e],z(u,"Deprecated: '"+e+"' has been renamed '"+i+"'. The old method will be removed in the next major version.")}}var s,c,u=function(e){if("string"!=typeof e)throw new TypeError("Invaild id for iFrame. Expected String");var n;return""===e&&(i.id=(n=r&&r.id||w.id+t++,null!==document.getElementById(n)&&(n+=t++),e=n),o=(r||{}).log,k(e,"Added missing iframe ID: "+e+" ("+i.src+")")),e}(i.id);u in m&&"iFrameResizer"in i?z(u,"Ignored iFrame, already setup."):(function(e){var n;e=e||{},m[u]=Object.create(null),m[u].iframe=i,m[u].firstRun=!0,m[u].remoteHost=i.src&&i.src.split("/").slice(0,3).join("/"),function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(a,e),function(e){for(var n in w)Object.prototype.hasOwnProperty.call(w,n)&&(m[u][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:w[n])}(e),m[u]&&(m[u].targetOrigin=!0===m[u].checkOrigin?""===(n=m[u].remoteHost)||null!==n.match(/^(about:blank|javascript:|file:\/\/)/)?"*":n:"*")}(r),function(){switch(k(u,"IFrame scrolling "+(m[u]&&m[u].scrolling?"enabled":"disabled")+" for "+u),i.style.overflow=!1===(m[u]&&m[u].scrolling)?"hidden":"auto",m[u]&&m[u].scrolling){case"omit":break;case!0:i.scrolling="yes";break;case!1:i.scrolling="no";break;default:i.scrolling=m[u]?m[u].scrolling:"no"}}(),function(){function e(e){var n=m[u][e];1/0!==n&&0!==n&&(i.style[e]="number"==typeof n?n+"px":n,k(u,"Set "+e+" = "+i.style[e]))}function n(e){if(m[u]["min"+e]>m[u]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}n("Height"),n("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!=typeof(m[u]&&m[u].bodyMargin)&&"0"!==(m[u]&&m[u].bodyMargin)||(m[u].bodyMarginV1=m[u].bodyMargin,m[u].bodyMargin=m[u].bodyMargin+"px"),s=A(u),(c=g())&&(n=function(e){if(!i.parentNode)return null;var n=new e((function(e){e.forEach((function(e){Array.prototype.slice.call(e.removedNodes).forEach((function(e){e===i&&O(i)}))}))}));return n.observe(i.parentNode,{childList:!0}),n}(c)),p(i,"load",(function(){W("iFrame.onload",s,i,e,!0),(!m[u]||!m[u].firstRun)&&m[u]&&m[u].heightCalculationMethod in f&&N({iframe:i,height:0,width:0,type:"init"})})),W("init",s,i,e,!0),m[u]&&(m[u].iframe.iFrameResizer={close:O.bind(null,m[u].iframe),removeListeners:j.bind(null,m[u].iframe),resize:W.bind(null,"Window resize","resize",m[u].iframe),moveToAnchor:function(e){W("Move to anchor","moveToAnchor:"+e,m[u].iframe,u)},sendMessage:function(e){W("Send Message","message:"+(e=JSON.stringify(e)),m[u].iframe,u)}}))}function L(e,n){null===h&&(h=setTimeout((function(){h=null,e()}),n))}function P(){"hidden"!==document.visibilityState&&(k("document","Trigger event: Visibility change"),L((function(){V("Tab Visible","resize")}),16))}function V(e,n){Object.keys(m).forEach((function(i){(function(e){return m[e]&&"parent"===m[e].resizeFrom&&m[e].autoResize&&!m[e].firstRun})(i)&&W(e,n,m[i].iframe,i)}))}function q(){function n(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+n.tagName+">")}(),H(n,e),i.push(n))}var i;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!d;e+=1)d=window[n[e]+"RequestAnimationFrame"];d?d=d.bind(window):k("setup","RequestAnimationFrame not supported")}(),p(window,"message",M),p(window,"resize",(function(){k("window","Trigger event: resize"),L((function(){V("Window resize","resize")}),16)})),p(document,"visibilitychange",P),p(document,"-webkit-visibilitychange",P),function(t,o){switch(i=[],function(e){e&&e.enablePublicMethods&&z("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(t),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),n.bind(e,t));break;case"object":n(t,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return i}}}();const h=m.exports;class w{constructor(e,n){this.iframe=e,this.iframeOrigin=n}postMessage(e,n){const i=Object.assign({eventType:e},n);this.iframe.contentWindow.postMessage(i,this.iframeOrigin)}addMessageListener(e){window.addEventListener("message",e)}removeMessageListener(e){window.removeEventListener("message",e)}postMessageWithResponseListener(e,n){return new Promise((i=>{const t=n=>{n.data.eventType===e&&(window.removeEventListener("message",t),i(n.data.data))};window.addEventListener("message",t),this.postMessage(e,n)}))}}const b=class{constructor(n){e(this,n),this.dispatchMessageEvent=e=>{const{eventType:n,data:i}=e.data;(null==i?void 0:i.id)===this.inputId&&("focused"===n&&(this.isFocused=!0),"blurred"===n&&(this.isFocused=!1))},this.isFocused=!1,this.isValid=!0,this.errorText=void 0,this.iframeLoaded=!1,this.inputId=void 0,this.label=void 0,this.iframeOrigin=void 0}disconnectedCallback(){this.frameService.removeMessageListener(this.dispatchMessageEvent)}async validate(){const e=await this.frameService.postMessageWithResponseListener("validate");return this.isValid=e.isValid,this.errorText=e.error.message,e}async tokenize(e,n,i){return this.frameService.postMessageWithResponseListener("tokenize",{clientId:e,paymentMethodMetadata:n,account:i,componentVersion:r.version})}initializeFrameCommunicationService(){var e;this.frameService=new w(this.iframeElement,this.iframeOrigin),null===(e=this.frameService)||void 0===e||e.addMessageListener(this.dispatchMessageEvent)}get part(){return this.isFocused&&!this.isValid?s:this.isValid?this.isFocused?u:d:c}get style(){return this.isFocused?this.isValid?a.focused:a.focusedAndInvalid:null}get urlParams(){const e=Object.fromEntries(Object.entries(a.fontStyles).map((([e,n])=>[e,btoa(String(n))])));return new URLSearchParams(e).toString()}render(){return n(i,{key:"c0eca45af47958837580cc400e923135db070e75",class:"form-group d-flex flex-column"},n("div",{key:"374d757e67e81deec4d7e20255710d5256983cb6",style:{visibility:this.iframeLoaded?"visible":"hidden",height:this.iframeLoaded?"auto":"0"}},n("label",{key:"6054db3876710458e93dd8a11f7354d737e737d2",class:"form-label",htmlFor:"",part:f},this.label||""),n("div",{key:"2ccc97c83798026666fc0abc4d23e6d83b19b2fa",class:"p-0 d-flex form-control "+(this.isValid?"":"is-invalid"),part:this.part,style:Object.assign(Object.assign({},this.style),{overflow:"hidden"})},n("iframe",{key:"c71d778eaf2008ee4a2b237842e1dbec7abf5d43",id:this.inputId,name:this.inputId,src:`${this.iframeOrigin}?${this.urlParams}`,ref:e=>{this.iframeElement=e,this.initializeFrameCommunicationService()},width:"100%",onLoad:()=>{h({log:!1,onResized:()=>{this.iframeLoaded=!0}},this.iframeElement)}})),n(o,{key:"6f756711fccec14a52fa55e9faf0638546e80f77",errorText:this.errorText,name:this.inputId})))}get el(){return t(this)}};export{b as iframe_input}
@@ -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-e7bb6520.js";import"./p-ef4c49b9.js";import"./p-1e6077f4.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}
@@ -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 e,c as t,h as s}from"./p-2783e363.js";import{b as i}from"./p-f4722957.js";import{t as a,x as d}from"./p-ef4c49b9.js";import{B as r}from"./p-32a5bf4e.js";import{S as c}from"./p-bfe9748b.js";import{S as o}from"./p-0cc6c539.js";import{C as n,a as h}from"./p-14c91ffd.js";import{g as p,a as f}from"./p-8115b2f4.js";import{D as l}from"./p-02a0b21e.js";import{D as u}from"./p-667ebd79.js";import{c as b,J as y}from"./p-174b151e.js";import{c as v}from"./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 m=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:d,final:r=(()=>{})})=>{var c;try{const r=await s.submitDisputeResponse(t,e,i);if(r.error){return d({error:p(r.error),code:f(null===(c=r.error)||void 0===c?void 0:c.code),severity:n.ERROR})}a(r)}catch(e){const t=f(null==e?void 0:e.code);return d({error:e.message||e,code:t,severity:n.ERROR})}finally{return r()}},k=class{constructor(s){e(this,s),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.submitEvent=t(this,"submit-event",7),this.dispute=void 0,this.authToken=void 0,this.isLoading=void 0}acceptDispute(){m({disputeId:this.dispute.id,authToken:this.authToken,service:new l})({payload:{forfeit:!0},onSuccess:e=>{this.submitEvent.emit({response:e})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}})}initiateRespondToDispute(){this.clickEvent.emit({name:u.respondToDispute})}render(){var e,t,n,h,p,f,l;return s(c,{key:"df45596c8b40c5665589e976405c38f05271812f"},this.isLoading&&s("div",{key:"9c1f507799665e4297a9e76d24cf1656079bb146",style:{marginBottom:"8px"}},s(o,{key:"6a6e2314fb16348e59d4ff9b4739d895b376303c",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(o,{key:"286352f2b7da7f3b494add74fc332a3d2a6f4d42",height:"18px",styles:{marginBottom:"8px"}}),s(o,{key:"bc3985914e7dbeecbe4ea9efea1fcdd592d2600e",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&s("div",{key:"e0371f22a67d7ebef374e2ad4ed0e0d151b2105b",part:a},s("h1",{key:"a85046d309d92aee9c6a01e0311fe23d0cc48b98",class:"h4",part:d},"This payment is disputed"),s("p",{key:"886223ea616ea99c76b7f0e719f2bec606e6796a"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"3f12d0ded622ad0c844dee081b8eb3d444e2b4e3",class:"h5"},"Dispute details"),s("div",{key:"add2e0e67fcebcb484a2a30ea66a303693a95be8",class:"d-table gap-2"},s("div",{key:"30b35751ab437971b2c0ef6ab003d7c348d3cc3f",class:"d-table-row gap-2"},s("span",{key:"7b5ea6fdf2d644a2c31e0276185fb2a95b0ee85f",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"f91e37855056374a345a8a534c9343ed71180a1e",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(t=this.dispute)||void 0===t?void 0:t.amount))),s("div",{key:"6d2ef3c07ee006eba74caae39e1c355c4f1d0e80",class:"d-table-row gap-2"},s("span",{key:"cb60ccb1855a7bc15b8e411986790c33419659c3",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"a2c21645bbba4529576062baacbdd1166e1b4f72",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(n=this.dispute)||void 0===n?void 0:n.reason)),s("div",{key:"4f9bfc9fa68efc18032a9367938c82fef27f6dbe",class:"d-table-row gap-2"},s("span",{key:"c78b105e6e1bbe3332005c71e230609c9f2a65d9",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Dispute ID"),s("span",{key:"0d75f20d0c665cf18eb6a91eb4a890df0e0a09be",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(h=this.dispute)||void 0===h?void 0:h.id))),s("div",{key:"97801ea1983a7591d0c5aa933842fcce2eb12394",class:"d-flex gap-2 mt-4 justify-content-end"},s(r,{key:"8155accf40a4512506b18de08423da53cd3c2ff7",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(r,{key:"b23bd82c73ae7c8c020b7ad5c60223f9a1eae8d2",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(p=this.dispute)||void 0===p?void 0:p.underReview)&&s("div",{key:"2b3ee4c8f1b9b0100416c7804897530e001826d3"},s("h1",{key:"abdeb425738b1f0cd8b27836a885f9d9e31b1774",class:"h4"},"This payment is disputed and under review"),s("p",{key:"aa42c034af8bef20370aac9607065e6f15a87534"},"The cardholder is disputing this payment. A counter dispute has been submitEvent and is under review.")),(null===(f=this.dispute)||void 0===f?void 0:f.won)&&s("div",{key:"2a75a70a3a45a0d42dc182b0782983220444c42b"},s("h1",{key:"3e6c8aad4507bab77c6f0bf06c2ee26af382b8e8",class:"h4"},"This payment was disputed"),s("p",{key:"b1d2626f6c6529005676ead7776b988693334971"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(l=this.dispute)||void 0===l?void 0:l.lost)&&s("div",{key:"1b9da576c01bd69842cd3d0b65e96997842461e8"},s("h1",{key:"c5521ef13d0f9437b90fd34b96e43f980ab7ceb8",class:"h4"},"This payment was disputed"),s("p",{key:"d5724f0fd2194621a908d803752dc1965d2f0043"},"The cardholder disputed this payment and the card issuer has settled it their favor.")))}},w=class{constructor(s){e(this,s),this.errorEvent=t(this,"error-event",7),this.handleErrorEvent=e=>{this.errorMessage=e.detail.message,this.errorEvent.emit(e.detail)},this.updateDisputeResponse=void 0,this.submitDisputeResponse=void 0,this.createDisputeEvidence=void 0,this.errorMessage=null,this.authToken=void 0,this.disputeId=void 0,this.disputeResponse=void 0,this.apiOrigin=v.proxyApiOrigin}componentWillLoad(){b(),this.analytics=new y(this),this.initializeDisputeServiceMethods()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeDisputeServiceMethods()}initializeDisputeServiceMethods(){this.disputeId&&this.authToken?(this.updateDisputeResponse=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:d,final:r=(()=>{})})=>{var c;try{const r=await s.updateDisputeResponse(t,e,i);if(r.error)return d({error:p(r.error),code:f(null===(c=r.error)||void 0===c?void 0:c.code),severity:n.ERROR});a(r)}catch(e){const t=f(null==e?void 0:e.code);return d({error:e.message||e,code:t,severity:n.ERROR})}finally{return r()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:d,final:r=(()=>{})})=>{var c;try{const r=await s.createDisputeEvidence(t,e,i);if(r.error)return d({error:p(r.error),code:f(null===(c=r.error)||void 0===c?void 0:c.code),severity:n.ERROR});a(r)}catch(e){const t=f(null==e?void 0:e.code);return d({error:e.message||e,code:t,severity:n.ERROR})}finally{return r()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.submitDisputeResponse=m({disputeId:this.disputeId,authToken:this.authToken,service:new l})):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:h.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}render(){return s(c,{key:"359300bac34b3e344e045750f354ce974f6a02ed"},s("justifi-dispute-response-core",{key:"121c8c358b1a8a6e9084a9de00c977ff806be974","onError-event":this.handleErrorEvent,"dispute-id":this.disputeId,disputeResponse:this.disputeResponse,createDisputeEvidence:this.createDisputeEvidence,updateDisputeResponse:this.updateDisputeResponse,submitDisputeResponse:this.submitDisputeResponse}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}},j=class{constructor(i){e(this,i),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.submitEvent=t(this,"submit-event",7),this.componentStepMapping=[()=>s("justifi-product-or-service",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-customer-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-cancellation-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-refund-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-duplicate-charge",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-electronic-evidence",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-shipping-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-additional-statement",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse})],this.saveData=async(e,t)=>{if(Object.keys(e).length)return this.isLastStep?this.submitDisputeResponse({payload:e,onSuccess:e=>{this.submitEvent.emit({response:e}),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}}):this.updateDisputeResponse({payload:e,onSuccess:e=>{this.disputeResponse=Object.assign({},e.data),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}});this.stepCompleteEvent.emit({response:null,formStep:t})},this.initializeMakePresignedURLs=async()=>{const e=this.documentList.map((e=>this.getPresignedFileUrl(e)));return await Promise.all(e)},this.initializeFileUploads=async()=>{const e=this.documentList.map((e=>this.uploadDocument(e)));return Promise.all(e)},this.getPresignedFileUrl=async e=>this.createDisputeEvidence({payload:{file_name:e.file_name,file_type:e.file_type,dispute_evidence_type:e.dispute_evidence_type},onSuccess:t=>{e.presignedUrl=t.data.presigned_url,this.isLoading=!1},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s}),this.isLoading=!1}}),this.uploadDocument=async e=>{const t=await e.getFileString();if(!e.presignedUrl)throw new Error("Presigned URL is not set");return await fetch(e.presignedUrl,{method:"PUT",body:t})},this.onCancel=()=>{this.clickEvent.emit({name:u.cancelDispute})},this.handleSubmit=async(e,t,s)=>{this.isLoading=!0,t.length&&(this.documentList=t,await this.initializeMakePresignedURLs(),await this.initializeFileUploads()),await this.saveData(e,s),this.isLoading=!1},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.submit});const i=Object.assign(Object.assign({},e),{forfeit:!1});await this.handleSubmit(i,t,s)}))},this.updateDisputeResponse=void 0,this.submitDisputeResponse=void 0,this.createDisputeEvidence=void 0,this.disputeResponse={},this.isLoading=!1,this.documentList=[],this.currentStep=0,this.currentStepComponentRef=void 0}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}get isLastStep(){return this.currentStep===this.componentStepMapping.length-1}get isFirstStep(){return 0===this.currentStep}render(){return s("div",{key:"4c1c801c82506c50ee304934ec0c42efc986f07c",class:"row gy-3"},s("div",{key:"27c27411ac45d0a20f5fd99e4a11eb0efe6b0007",class:"col-12"},s("h1",{key:"48aa1635accfafe2ed76e733296bade6fdeeddf5",class:"h4",part:d},"Counter dispute")),s("div",{key:"79ca608ae5ba5a4249556754972216a82104c004",class:"col-12"},this.currentStepComponent),s("div",{key:"39ecb37977d852c3528f09afced344d40e2022ac",class:"col-12"},s("div",{key:"23d7523bffc81324b8e99b5f2354c75f52af9d52",class:"d-flex gap-2 mt-4 justify-content-end"},this.isFirstStep?s(r,{variant:"secondary",onClick:()=>this.onCancel(),disabled:this.isLoading,isLoading:this.isLoading},"Cancel"):s(r,{variant:"secondary",onClick:()=>this.onBack(),disabled:this.isLoading,isLoading:this.isLoading},"Back"),this.isLastStep?s(r,{variant:"primary",onClick:()=>this.onSubmit(),disabled:this.isLoading,isLoading:this.isLoading},"Submit Counter Dispute"):s(r,{variant:"primary",onClick:()=>this.onNext(),disabled:this.isLoading,isLoading:this.isLoading},"Next"))))}};export{k as justifi_dispute_notification,w as justifi_dispute_response,j as justifi_dispute_response_core}
1
+ import{r as e,c as t,h as s}from"./p-2783e363.js";import{b as i}from"./p-f4722957.js";import{t as a,x as d}from"./p-ef4c49b9.js";import{B as r}from"./p-32a5bf4e.js";import{S as c}from"./p-bfe9748b.js";import{S as o}from"./p-0cc6c539.js";import{C as n,a as h}from"./p-14c91ffd.js";import{g as p,a as f}from"./p-8115b2f4.js";import{D as l}from"./p-441c1cf8.js";import{D as u}from"./p-667ebd79.js";import{c as b,J as y}from"./p-e7bb6520.js";import{c as v}from"./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-1e6077f4.js";const m=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:d,final:r=(()=>{})})=>{var c;try{const r=await s.submitDisputeResponse(t,e,i);if(r.error){return d({error:p(r.error),code:f(null===(c=r.error)||void 0===c?void 0:c.code),severity:n.ERROR})}a(r)}catch(e){const t=f(null==e?void 0:e.code);return d({error:e.message||e,code:t,severity:n.ERROR})}finally{return r()}},k=class{constructor(s){e(this,s),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.submitEvent=t(this,"submit-event",7),this.dispute=void 0,this.authToken=void 0,this.isLoading=void 0}acceptDispute(){m({disputeId:this.dispute.id,authToken:this.authToken,service:new l})({payload:{forfeit:!0},onSuccess:e=>{this.submitEvent.emit({response:e})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}})}initiateRespondToDispute(){this.clickEvent.emit({name:u.respondToDispute})}render(){var e,t,n,h,p,f,l;return s(c,{key:"df45596c8b40c5665589e976405c38f05271812f"},this.isLoading&&s("div",{key:"9c1f507799665e4297a9e76d24cf1656079bb146",style:{marginBottom:"8px"}},s(o,{key:"6a6e2314fb16348e59d4ff9b4739d895b376303c",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(o,{key:"286352f2b7da7f3b494add74fc332a3d2a6f4d42",height:"18px",styles:{marginBottom:"8px"}}),s(o,{key:"bc3985914e7dbeecbe4ea9efea1fcdd592d2600e",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&s("div",{key:"e0371f22a67d7ebef374e2ad4ed0e0d151b2105b",part:a},s("h1",{key:"a85046d309d92aee9c6a01e0311fe23d0cc48b98",class:"h4",part:d},"This payment is disputed"),s("p",{key:"886223ea616ea99c76b7f0e719f2bec606e6796a"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"3f12d0ded622ad0c844dee081b8eb3d444e2b4e3",class:"h5"},"Dispute details"),s("div",{key:"add2e0e67fcebcb484a2a30ea66a303693a95be8",class:"d-table gap-2"},s("div",{key:"30b35751ab437971b2c0ef6ab003d7c348d3cc3f",class:"d-table-row gap-2"},s("span",{key:"7b5ea6fdf2d644a2c31e0276185fb2a95b0ee85f",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"f91e37855056374a345a8a534c9343ed71180a1e",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(t=this.dispute)||void 0===t?void 0:t.amount))),s("div",{key:"6d2ef3c07ee006eba74caae39e1c355c4f1d0e80",class:"d-table-row gap-2"},s("span",{key:"cb60ccb1855a7bc15b8e411986790c33419659c3",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"a2c21645bbba4529576062baacbdd1166e1b4f72",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(n=this.dispute)||void 0===n?void 0:n.reason)),s("div",{key:"4f9bfc9fa68efc18032a9367938c82fef27f6dbe",class:"d-table-row gap-2"},s("span",{key:"c78b105e6e1bbe3332005c71e230609c9f2a65d9",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Dispute ID"),s("span",{key:"0d75f20d0c665cf18eb6a91eb4a890df0e0a09be",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(h=this.dispute)||void 0===h?void 0:h.id))),s("div",{key:"97801ea1983a7591d0c5aa933842fcce2eb12394",class:"d-flex gap-2 mt-4 justify-content-end"},s(r,{key:"8155accf40a4512506b18de08423da53cd3c2ff7",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(r,{key:"b23bd82c73ae7c8c020b7ad5c60223f9a1eae8d2",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(p=this.dispute)||void 0===p?void 0:p.underReview)&&s("div",{key:"2b3ee4c8f1b9b0100416c7804897530e001826d3"},s("h1",{key:"abdeb425738b1f0cd8b27836a885f9d9e31b1774",class:"h4"},"This payment is disputed and under review"),s("p",{key:"aa42c034af8bef20370aac9607065e6f15a87534"},"The cardholder is disputing this payment. A counter dispute has been submitEvent and is under review.")),(null===(f=this.dispute)||void 0===f?void 0:f.won)&&s("div",{key:"2a75a70a3a45a0d42dc182b0782983220444c42b"},s("h1",{key:"3e6c8aad4507bab77c6f0bf06c2ee26af382b8e8",class:"h4"},"This payment was disputed"),s("p",{key:"b1d2626f6c6529005676ead7776b988693334971"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(l=this.dispute)||void 0===l?void 0:l.lost)&&s("div",{key:"1b9da576c01bd69842cd3d0b65e96997842461e8"},s("h1",{key:"c5521ef13d0f9437b90fd34b96e43f980ab7ceb8",class:"h4"},"This payment was disputed"),s("p",{key:"d5724f0fd2194621a908d803752dc1965d2f0043"},"The cardholder disputed this payment and the card issuer has settled it their favor.")))}},w=class{constructor(s){e(this,s),this.errorEvent=t(this,"error-event",7),this.handleErrorEvent=e=>{this.errorMessage=e.detail.message,this.errorEvent.emit(e.detail)},this.updateDisputeResponse=void 0,this.submitDisputeResponse=void 0,this.createDisputeEvidence=void 0,this.errorMessage=null,this.authToken=void 0,this.disputeId=void 0,this.disputeResponse=void 0,this.apiOrigin=v.proxyApiOrigin}componentWillLoad(){b(),this.analytics=new y(this),this.initializeDisputeServiceMethods()}disconnectedCallback(){this.analytics.cleanup()}propChanged(){this.initializeDisputeServiceMethods()}initializeDisputeServiceMethods(){this.disputeId&&this.authToken?(this.updateDisputeResponse=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:d,final:r=(()=>{})})=>{var c;try{const r=await s.updateDisputeResponse(t,e,i);if(r.error)return d({error:p(r.error),code:f(null===(c=r.error)||void 0===c?void 0:c.code),severity:n.ERROR});a(r)}catch(e){const t=f(null==e?void 0:e.code);return d({error:e.message||e,code:t,severity:n.ERROR})}finally{return r()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:d,final:r=(()=>{})})=>{var c;try{const r=await s.createDisputeEvidence(t,e,i);if(r.error)return d({error:p(r.error),code:f(null===(c=r.error)||void 0===c?void 0:c.code),severity:n.ERROR});a(r)}catch(e){const t=f(null==e?void 0:e.code);return d({error:e.message||e,code:t,severity:n.ERROR})}finally{return r()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.submitDisputeResponse=m({disputeId:this.disputeId,authToken:this.authToken,service:new l})):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:h.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}render(){return s(c,{key:"359300bac34b3e344e045750f354ce974f6a02ed"},s("justifi-dispute-response-core",{key:"121c8c358b1a8a6e9084a9de00c977ff806be974","onError-event":this.handleErrorEvent,"dispute-id":this.disputeId,disputeResponse:this.disputeResponse,createDisputeEvidence:this.createDisputeEvidence,updateDisputeResponse:this.updateDisputeResponse,submitDisputeResponse:this.submitDisputeResponse}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}},j=class{constructor(i){e(this,i),this.clickEvent=t(this,"click-event",7),this.errorEvent=t(this,"error-event",7),this.stepCompleteEvent=t(this,"complete-form-step-event",7),this.submitEvent=t(this,"submit-event",7),this.componentStepMapping=[()=>s("justifi-product-or-service",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-customer-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-cancellation-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-refund-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-duplicate-charge",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-electronic-evidence",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-shipping-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse}),()=>s("justifi-additional-statement",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse})],this.saveData=async(e,t)=>{if(Object.keys(e).length)return this.isLastStep?this.submitDisputeResponse({payload:e,onSuccess:e=>{this.submitEvent.emit({response:e}),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}}):this.updateDisputeResponse({payload:e,onSuccess:e=>{this.disputeResponse=Object.assign({},e.data),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}});this.stepCompleteEvent.emit({response:null,formStep:t})},this.initializeMakePresignedURLs=async()=>{const e=this.documentList.map((e=>this.getPresignedFileUrl(e)));return await Promise.all(e)},this.initializeFileUploads=async()=>{const e=this.documentList.map((e=>this.uploadDocument(e)));return Promise.all(e)},this.getPresignedFileUrl=async e=>this.createDisputeEvidence({payload:{file_name:e.file_name,file_type:e.file_type,dispute_evidence_type:e.dispute_evidence_type},onSuccess:t=>{e.presignedUrl=t.data.presigned_url,this.isLoading=!1},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s}),this.isLoading=!1}}),this.uploadDocument=async e=>{const t=await e.getFileString();if(!e.presignedUrl)throw new Error("Presigned URL is not set");return await fetch(e.presignedUrl,{method:"PUT",body:t})},this.onCancel=()=>{this.clickEvent.emit({name:u.cancelDispute})},this.handleSubmit=async(e,t,s)=>{this.isLoading=!0,t.length&&(this.documentList=t,await this.initializeMakePresignedURLs(),await this.initializeFileUploads()),await this.saveData(e,s),this.isLoading=!1},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.submit});const i=Object.assign(Object.assign({},e),{forfeit:!1});await this.handleSubmit(i,t,s)}))},this.updateDisputeResponse=void 0,this.submitDisputeResponse=void 0,this.createDisputeEvidence=void 0,this.disputeResponse={},this.isLoading=!1,this.documentList=[],this.currentStep=0,this.currentStepComponentRef=void 0}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}get isLastStep(){return this.currentStep===this.componentStepMapping.length-1}get isFirstStep(){return 0===this.currentStep}render(){return s("div",{key:"4c1c801c82506c50ee304934ec0c42efc986f07c",class:"row gy-3"},s("div",{key:"27c27411ac45d0a20f5fd99e4a11eb0efe6b0007",class:"col-12"},s("h1",{key:"48aa1635accfafe2ed76e733296bade6fdeeddf5",class:"h4",part:d},"Counter dispute")),s("div",{key:"79ca608ae5ba5a4249556754972216a82104c004",class:"col-12"},this.currentStepComponent),s("div",{key:"39ecb37977d852c3528f09afced344d40e2022ac",class:"col-12"},s("div",{key:"23d7523bffc81324b8e99b5f2354c75f52af9d52",class:"d-flex gap-2 mt-4 justify-content-end"},this.isFirstStep?s(r,{variant:"secondary",onClick:()=>this.onCancel(),disabled:this.isLoading,isLoading:this.isLoading},"Cancel"):s(r,{variant:"secondary",onClick:()=>this.onBack(),disabled:this.isLoading,isLoading:this.isLoading},"Back"),this.isLastStep?s(r,{variant:"primary",onClick:()=>this.onSubmit(),disabled:this.isLoading,isLoading:this.isLoading},"Submit Counter Dispute"):s(r,{variant:"primary",onClick:()=>this.onNext(),disabled:this.isLoading,isLoading:this.isLoading},"Next"))))}};export{k as justifi_dispute_notification,w as justifi_dispute_response,j as justifi_dispute_response_core}
@@ -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-e7bb6520.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-1e6077f4.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{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-174b151e.js";import{c as p}from"./p-5a62fca2.js";import{C as d}from"./p-54d36e97.js";import{m,S as f}from"./p-cb00d4f3.js";import{S as u}from"./p-bfe9748b.js";import{d as b}from"./p-6feeb9f2.js";import"./p-abdbcd8e.js";import"./p-af620972.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,m;try{const f=await i.fetchCheckouts(t,s,h,r);if(f.error)return p({error:a(f.error),code:c(null===(m=f.error)||void 0===m?void 0:m.code),severity:o.ERROR});{const t=Object.assign({},f.page_info);n({checkouts:(null===(d=f.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=m({accountId:this.accountId,authToken:this.authToken,service:new f,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}
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 c,a}from"./p-8115b2f4.js";import{c as h,J as n}from"./p-e7bb6520.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-1e6077f4.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:c(m.error),code:a(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=a(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}
@@ -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-e7bb6520.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-1e6077f4.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
- 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}
@@ -1 +1 @@
1
- import{r as s,c as i,h as t,H as r}from"./p-2783e363.js";import{E as e}from"./p-9c2e00cc.js";import{B as o}from"./p-f6f8dabc.js";import{B as a}from"./p-275f2154.js";import{C as n,a as c}from"./p-14c91ffd.js";import{g as p,a as h}from"./p-8115b2f4.js";import{c as d,J as m}from"./p-174b151e.js";import"./p-ef4c49b9.js";import"./p-5a62fca2.js";import"./p-0e180654.js";import"./p-1ff8810b.js";import"./p-6078a370.js";import"./p-af620972.js";const f=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event",7),this.businessId=void 0,this.authToken=void 0,this.errorMessage=void 0,this.getBusiness=void 0}componentWillLoad(){d(),this.analytics=new m(this),this.initializeGetBusiness()}disconnectedCallback(){this.analytics.cleanup()}initializeGetBusiness(){if(!this.businessId||!this.authToken)return this.errorMessage="Invalid business id or auth token",void this.errorEvent.emit({errorCode:c.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR});this.getBusiness=(({id:s,authToken:i,service:t})=>async({onSuccess:r,onError:e})=>{var o;try{const c=await t.fetchBusiness(s,i);if(c.error)return e({error:p(c.error),code:h(null===(o=c.error)||void 0===o?void 0:o.code),severity:n.ERROR});r({business:new a(c.data)})}catch(s){const i=h(null==s?void 0:s.code);return e({error:s.message||s,code:i,severity:n.ERROR})}})({id:this.businessId,authToken:this.authToken,service:new o})}render(){return t(r,null,this.errorMessage?e(this.errorMessage):t("business-details-core",{getBusiness:this.getBusiness}))}};export{f as justifi_business_details}
1
+ import{r as s,c as i,h as t,H as r}from"./p-2783e363.js";import{E as e}from"./p-9c2e00cc.js";import{B as o}from"./p-edb57087.js";import{B as n}from"./p-275f2154.js";import{C as a,a as p}from"./p-14c91ffd.js";import{g as c,a as h}from"./p-8115b2f4.js";import{c as d,J as m}from"./p-e7bb6520.js";import"./p-ef4c49b9.js";import"./p-0f23ff58.js";import"./p-0e180654.js";import"./p-1ff8810b.js";import"./p-6078a370.js";import"./p-1e6077f4.js";const f=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event",7),this.businessId=void 0,this.authToken=void 0,this.errorMessage=void 0,this.getBusiness=void 0}componentWillLoad(){d(),this.analytics=new m(this),this.initializeGetBusiness()}disconnectedCallback(){this.analytics.cleanup()}initializeGetBusiness(){if(!this.businessId||!this.authToken)return this.errorMessage="Invalid business id or auth token",void this.errorEvent.emit({errorCode:p.MISSING_PROPS,message:this.errorMessage,severity:a.ERROR});this.getBusiness=(({id:s,authToken:i,service:t})=>async({onSuccess:r,onError:e})=>{var o;try{const p=await t.fetchBusiness(s,i);if(p.error)return e({error:c(p.error),code:h(null===(o=p.error)||void 0===o?void 0:o.code),severity:a.ERROR});r({business:new n(p.data)})}catch(s){const i=h(null==s?void 0:s.code);return e({error:s.message||s,code:i,severity:a.ERROR})}})({id:this.businessId,authToken:this.authToken,service:new o})}render(){return t(r,null,this.errorMessage?e(this.errorMessage):t("business-details-core",{getBusiness:this.getBusiness}))}};export{f as justifi_business_details}
@@ -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}