@justifi/webcomponents 6.13.2 → 6.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/cjs/{Analytics-F9eGV4SU.js → Analytics-DusgFP9U.js} +1 -1
  2. package/dist/cjs/additional-questions-form-step_15.cjs.entry.js +2 -2
  3. package/dist/cjs/bank-account-billing-form-simple_4.cjs.entry.js +1 -1
  4. package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
  5. package/dist/cjs/{business-identity-schema-BA385xf-.js → business-identity-schema-Da3PJrGG.js} +1 -1
  6. package/dist/cjs/card-form.cjs.entry.js +2 -2
  7. package/dist/cjs/{check-pkg-version--A_rGEJu.js → check-pkg-version-DD7fjCqn.js} +1 -1
  8. package/dist/cjs/dispute-notification_2.cjs.entry.js +3 -3
  9. package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
  10. package/dist/cjs/justifi-apple-pay_11.cjs.entry.js +3 -3
  11. package/dist/cjs/justifi-bank-account-billing-form-simple.cjs.entry.js +3 -3
  12. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +3 -3
  13. package/dist/cjs/justifi-business-details.cjs.entry.js +3 -3
  14. package/dist/cjs/justifi-business-form.cjs.entry.js +5 -5
  15. package/dist/cjs/justifi-card-form.cjs.entry.js +3 -3
  16. package/dist/cjs/justifi-checkout-qr-code.cjs.entry.js +3 -3
  17. package/dist/cjs/justifi-checkout.cjs.entry.js +3 -3
  18. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +3 -3
  19. package/dist/cjs/justifi-dispute-management.cjs.entry.js +3 -3
  20. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +3 -3
  21. package/dist/cjs/justifi-order-terminals.cjs.entry.js +3 -3
  22. package/dist/cjs/justifi-payment-details.cjs.entry.js +3 -3
  23. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +3 -3
  24. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +3 -3
  25. package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -3
  26. package/dist/cjs/justifi-payout-details.cjs.entry.js +3 -3
  27. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +3 -3
  28. package/dist/cjs/justifi-payouts-list.cjs.entry.js +3 -3
  29. package/dist/cjs/justifi-qr-terminal.cjs.entry.js +3 -3
  30. package/dist/cjs/justifi-refund-payment.cjs.entry.js +3 -3
  31. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +3 -3
  32. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +3 -3
  33. package/dist/cjs/justifi-terminals-list.cjs.entry.js +3 -3
  34. package/dist/cjs/{package-Cuwhrp-b.js → package-DeCbZvnG.js} +1 -1
  35. package/dist/cjs/{schema-validations-C2XsZnqK.js → schema-validations-Cs0mSKR7.js} +2 -1
  36. package/dist/collection/components/business-forms/schemas/schema-validations.js +2 -1
  37. package/dist/docs.json +1 -1
  38. package/dist/esm/{Analytics-CQwgYl2v.js → Analytics-CtVZmAya.js} +1 -1
  39. package/dist/esm/additional-questions-form-step_15.entry.js +2 -2
  40. package/dist/esm/bank-account-billing-form-simple_4.entry.js +1 -1
  41. package/dist/esm/bank-account-form.entry.js +2 -2
  42. package/dist/esm/{business-identity-schema-Csou60ZC.js → business-identity-schema-C1ot9Zas.js} +1 -1
  43. package/dist/esm/card-form.entry.js +2 -2
  44. package/dist/esm/{check-pkg-version-2VZtm0yL.js → check-pkg-version-DcFIDA70.js} +1 -1
  45. package/dist/esm/dispute-notification_2.entry.js +3 -3
  46. package/dist/esm/hidden-input_2.entry.js +1 -1
  47. package/dist/esm/justifi-apple-pay_11.entry.js +3 -3
  48. package/dist/esm/justifi-bank-account-billing-form-simple.entry.js +3 -3
  49. package/dist/esm/justifi-bank-account-form.entry.js +3 -3
  50. package/dist/esm/justifi-business-details.entry.js +3 -3
  51. package/dist/esm/justifi-business-form.entry.js +5 -5
  52. package/dist/esm/justifi-card-form.entry.js +3 -3
  53. package/dist/esm/justifi-checkout-qr-code.entry.js +3 -3
  54. package/dist/esm/justifi-checkout.entry.js +3 -3
  55. package/dist/esm/justifi-checkouts-list.entry.js +3 -3
  56. package/dist/esm/justifi-dispute-management.entry.js +3 -3
  57. package/dist/esm/justifi-gross-payment-chart.entry.js +3 -3
  58. package/dist/esm/justifi-order-terminals.entry.js +3 -3
  59. package/dist/esm/justifi-payment-details.entry.js +3 -3
  60. package/dist/esm/justifi-payment-provisioning.entry.js +3 -3
  61. package/dist/esm/justifi-payment-transactions-list.entry.js +3 -3
  62. package/dist/esm/justifi-payments-list.entry.js +3 -3
  63. package/dist/esm/justifi-payout-details.entry.js +3 -3
  64. package/dist/esm/justifi-payout-transactions-list.entry.js +3 -3
  65. package/dist/esm/justifi-payouts-list.entry.js +3 -3
  66. package/dist/esm/justifi-qr-terminal.entry.js +3 -3
  67. package/dist/esm/justifi-refund-payment.entry.js +3 -3
  68. package/dist/esm/justifi-season-interruption-insurance.entry.js +3 -3
  69. package/dist/esm/justifi-terminal-orders-list.entry.js +3 -3
  70. package/dist/esm/justifi-terminals-list.entry.js +3 -3
  71. package/dist/esm/{package-BtzgeLyZ.js → package-Bx2_PW91.js} +1 -1
  72. package/dist/esm/{schema-validations-CySYE883.js → schema-validations-CHxw3FkH.js} +2 -1
  73. package/dist/module/package.js +1 -1
  74. package/dist/module/schema-validations.js +2 -1
  75. package/dist/webcomponents/{p-9c7bce35.entry.js → p-0b9263f3.entry.js} +1 -1
  76. package/dist/webcomponents/{p-e4bc8c7c.entry.js → p-17f8c3e7.entry.js} +1 -1
  77. package/dist/webcomponents/{p-1ac357f9.entry.js → p-1fced37f.entry.js} +1 -1
  78. package/dist/webcomponents/{p-5111a9f5.entry.js → p-291b9a48.entry.js} +1 -1
  79. package/dist/webcomponents/{p-9c1a0efc.entry.js → p-2a0ab07f.entry.js} +1 -1
  80. package/dist/webcomponents/p-2b64659a.entry.js +1 -0
  81. package/dist/webcomponents/{p-d5197891.entry.js → p-2c798125.entry.js} +1 -1
  82. package/dist/webcomponents/{p-d93d9d58.entry.js → p-3918fb44.entry.js} +1 -1
  83. package/dist/webcomponents/{p-d1cbeb65.entry.js → p-4383dfdc.entry.js} +1 -1
  84. package/dist/webcomponents/{p-49d9c0a4.entry.js → p-46a06ce6.entry.js} +1 -1
  85. package/dist/webcomponents/p-5ea486b6.entry.js +1 -0
  86. package/dist/webcomponents/{p-648c6cb1.entry.js → p-6f71bf5f.entry.js} +1 -1
  87. package/dist/webcomponents/{p-d9fd1c50.entry.js → p-708aee06.entry.js} +1 -1
  88. package/dist/webcomponents/{p-fa21fe56.entry.js → p-7495aa96.entry.js} +1 -1
  89. package/dist/webcomponents/{p-b08c76da.entry.js → p-84b643f7.entry.js} +1 -1
  90. package/dist/webcomponents/{p-ee97795a.entry.js → p-8771e52a.entry.js} +1 -1
  91. package/dist/webcomponents/{p-4821c092.entry.js → p-8fce7a9c.entry.js} +1 -1
  92. package/dist/webcomponents/{p-ebf178d2.entry.js → p-98bbdf10.entry.js} +1 -1
  93. package/dist/webcomponents/{p-a404b995.entry.js → p-9d11aaf2.entry.js} +1 -1
  94. package/dist/webcomponents/p-Bx2_PW91.js +1 -0
  95. package/dist/webcomponents/p-BxpXvXn-.js +1 -0
  96. package/dist/webcomponents/{p-DYL3RR2S.js → p-CfIGO7TJ.js} +1 -1
  97. package/dist/webcomponents/{p-C_SQBHCI.js → p-CqOzVXGL.js} +1 -1
  98. package/dist/webcomponents/{p-C1gr32IS.js → p-DK_bjvk1.js} +1 -1
  99. package/dist/webcomponents/{p-c2de24fe.entry.js → p-a62ef857.entry.js} +1 -1
  100. package/dist/webcomponents/{p-10f3b8df.entry.js → p-b89a5053.entry.js} +1 -1
  101. package/dist/webcomponents/{p-f0961751.entry.js → p-c6eea99e.entry.js} +1 -1
  102. package/dist/webcomponents/{p-85b155b0.entry.js → p-db17a828.entry.js} +1 -1
  103. package/dist/webcomponents/{p-54e343d3.entry.js → p-dde22375.entry.js} +4 -4
  104. package/dist/webcomponents/{p-5e59e283.entry.js → p-dfe66300.entry.js} +1 -1
  105. package/dist/webcomponents/{p-7d04803e.entry.js → p-e9494d8f.entry.js} +1 -1
  106. package/dist/webcomponents/{p-bd882260.entry.js → p-ebee139f.entry.js} +1 -1
  107. package/dist/webcomponents/{p-f4de4ac0.entry.js → p-f01fd4ff.entry.js} +1 -1
  108. package/dist/webcomponents/{p-64840a3d.entry.js → p-f4baf684.entry.js} +1 -1
  109. package/dist/webcomponents/{p-87427a4f.entry.js → p-f6d49f21.entry.js} +1 -1
  110. package/dist/webcomponents/webcomponents.esm.js +1 -1
  111. package/package.json +1 -1
  112. package/dist/webcomponents/p-4bb9d772.entry.js +0 -1
  113. package/dist/webcomponents/p-BtzgeLyZ.js +0 -1
  114. package/dist/webcomponents/p-a125318a.entry.js +0 -1
  115. package/dist/webcomponents/p-z3RFjy9B.js +0 -1
@@ -1 +1 @@
1
- import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{m as a,C as i,b as o}from"./p-DXTa04jn.js";import{p as c}from"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{g as r,a as h}from"./p-CdwzNfP1.js";import{c as n}from"./p-C_SQBHCI.js";import{J as d}from"./p-DYL3RR2S.js";import{C as p}from"./p-Cn7z5L7J.js";import{m as u,S as m}from"./p-BUHsyQpA.js";import{S as f}from"./p-DzEdYT8R.js";import{T as b,a as l,b as y,c as k,d as g,e as C,f as v,g as j,h as _,i as w,j as S,k as T,l as P}from"./p-BICxxa69.js";import{T as I}from"./p-CZfYo5-1.js";import{d as A,b as x}from"./p-BSs-2JKu.js";import{B as D,a as O}from"./p-CHw7tICr.js";import{a6 as E,a7 as z}from"./p-CPKMvyV_.js";import{o as B,g as H}from"./p-CpGEMRkH.js";import"./p-D8GTwl9v.js";import"./p-BtzgeLyZ.js";import"./p-De4Pig-y.js";import"./p-CqiVXthx.js";const L={created_at:()=>t("th",{part:E,scope:"col",title:"The date each checkout occurred"},"Processed On"),payment_amount:()=>t("th",{part:E,scope:"col",title:"The dollar amount of each checkout"},"Payment Amount"),payment_description:()=>t("th",{part:E,scope:"col",title:"The description of each checkout"},"Payment Description"),sub_account_name:()=>t("th",{part:E,scope:"col",title:"The sub account associated with the checkout"},"Sub Account"),payment_mode:()=>t("th",{part:E,scope:"col",title:"The payment mode of each checkout"},"Payment Mode"),status:()=>t("th",{part:E,scope:"col",title:"The current status of each checkout"},"Status")},G={created_at:(e,s)=>t("td",{part:z(s)},t("div",{class:"fw-bold"},x(e.created_at)),t("div",{class:"fw-bold"},A(e.created_at))),payment_amount:(e,s)=>t("td",{part:z(s)},e.formattedPaymentAmount(e.payment_amount)),payment_description:(e,s)=>t("td",{part:z(s)},e.payment_description),sub_account_name:(e,s)=>t("td",{part:z(s)},e.sub_account_name),payment_mode:(e,s)=>t("td",{part:z(s)},e.payment_mode),status:(e,s)=>t("td",{part:z(s)},t(O,Object.assign({},{created:{variant:D.PRIMARY,title:"The checkout has been created",text:"Created"},completed:{variant:D.SUCCESS,title:"The checkout has been completed",text:"Completed"},attempted:{variant:D.SECONDARY,title:"The checkout has been attempted",text:"Attempted"},expired:{variant:D.DANGER,title:"The checkout has expired",text:"Expired"}}[e.status])))},M=class{constructor(t){e(this,t),this.clickEvent=s(this,"click-event",7),this.errorEvent=s(this,"error-event",7),this.columns="created_at,payment_amount,payment_description,payment_mode,status",this.checkouts=[],this.subAccounts=[],this.loading=!0,this.paging=c,this.pagingParams={},this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:I.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:I.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const s=this.checkouts.find((t=>t.id===e));this.clickEvent.emit({name:I.row,data:s})}}componentWillLoad(){n(),this.analytics=new d(this),this.checkoutsTable=new b(this.checkouts,this.columns,L,G),this.initializeGetData(),this.getCheckouts&&this.fetchData(),B("set",(()=>{this.pagingParams={}})),B("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}authPropChanged(){this.initializeGetData(),this.getCheckouts&&this.fetchData()}pagingOrColumnsChanged(){this.getCheckouts&&this.fetchData()}initializeGetData(){this.initializeGetCheckouts(),this.initializeGetSubAccounts()}initializeGetCheckouts(){const t=this.subAccountId||this.accountId;t&&this.authToken?this.getCheckouts=(({accountId:t,authToken:e,service:s})=>async({params:o,onSuccess:c,onError:n})=>{var d,p;try{const u=await s.fetchCheckouts(t,e,o);if(u.error)return n({error:h(u.error),code:r(null===(p=u.error)||void 0===p?void 0:p.code),severity:i.ERROR});{const t=Object.assign({},u.page_info);c({checkouts:(null===(d=u.data)||void 0===d?void 0:d.map((t=>new a(t))))||[],pagingInfo:t})}}catch(t){const e=r(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:i.ERROR})}})({accountId:t,authToken:this.authToken,service:new p}):(this.errorMessage="Account ID/Sub Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=u({primaryAccountId:this.accountId,authToken:this.authToken,service:new m}))}fetchData(){this.getCheckouts&&(this.loading=!0,this.getCheckouts({params:this.checkoutParams,onSuccess:async({checkouts:t,pagingInfo:e})=>{this.checkouts=t,this.paging=e,this.checkoutsTable.collectionData=this.checkouts,this.checkoutsTable.columnKeys.includes("sub_account_name")?await this.fetchSubAccounts():this.loading=!1},onError:({error:t,code:e,severity:s})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:s}),this.loading=!1}}))}async fetchSubAccounts(){this.getSubAccounts?this.getSubAccounts({params:this.subAccountParams,onSuccess:({subAccounts:t})=>{this.subAccounts=t,this.checkouts=this.checkouts.map((t=>{var e;return t.sub_account_name=null===(e=this.subAccounts.find((e=>e.id===t.account_id)))||void 0===e?void 0:e.name,t})),this.loading=!1},onError:({error:t,code:e,severity:s})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:s}),this.loading=!1}}):this.loading=!1}get checkoutParams(){const t=H();return Object.assign(Object.assign({},t),this.pagingParams)}get subAccountParams(){const t=this.checkouts.map((t=>t.account_id));return{sub_account_id:[...new Set(t)].join(",")}}get entityId(){return this.checkouts.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.checkoutsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(f,{key:"d384dda32587dfc469e998b2b8f209ef17aef775"},t(l,{key:"98f2472188e64a236fd5cc581efe2895a6de58a3"},t(y,{key:"f02db4d024b9d2250a637fb28dca06eaff1d894c"},t(k,{key:"8c96bfa14e4e2154c1f575595f9597d3adc640df"},t(g,{key:"08cddf6a31fbe99c8b46f61ceca996acb9b87f0b"},this.checkoutsTable.columnData.map((t=>t)))),t(C,{key:"99b88bfdb3871f82d653b00536f22c5c17cf38ac"},t(v,{key:"e05e1d543481df360b42e5563d5963277d10110e",columnSpan:this.checkoutsTable.columnKeys.length,isLoading:this.loading}),t(j,{key:"3c4e19d3e8c9c779249efa63be592fbf5948b6ae",isEmpty:this.showEmptyState,columnSpan:this.checkoutsTable.columnKeys.length}),t(_,{key:"7660b4991974dc46d8fb9dfd28ef7ea79d8e22e0",columnSpan:this.checkoutsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.checkoutsTable.rowData.map(((e,s)=>t(w,{"data-test-id":"table-row","data-row-entity-id":this.entityId[s],onClick:this.rowClickHandler},e)))),this.paging&&t(S,{key:"d56c6cb6a529dabf00c5260a39a2e2ab8e3749be"},t(T,{key:"d28363ad8d8823f3da097edb263aa10308cbdb04"},t(P,{key:"d6fcce3cf39e43718e8b15d42445c053d0feaa21",colSpan:this.checkoutsTable.columnData.length},t("pagination-menu",{key:"6b956571ed6ae297df5430cad4be92eee2bdb9cc",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["authPropChanged"],authToken:["authPropChanged"],subAccountId:["authPropChanged"],pagingParams:["pagingOrColumnsChanged"],columns:["pagingOrColumnsChanged"]}}};export{M as justifi_checkouts_list}
1
+ import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import{m as a,C as i,b as o}from"./p-DXTa04jn.js";import{p as c}from"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import{g as r,a as h}from"./p-CdwzNfP1.js";import{c as n}from"./p-CqOzVXGL.js";import{J as d}from"./p-CfIGO7TJ.js";import{C as p}from"./p-Cn7z5L7J.js";import{m as u,S as m}from"./p-BUHsyQpA.js";import{S as f}from"./p-DzEdYT8R.js";import{T as b,a as l,b as y,c as k,d as g,e as C,f as v,g as j,h as _,i as w,j as T,k as S,l as P}from"./p-BICxxa69.js";import{T as I}from"./p-CZfYo5-1.js";import{d as O,b as x}from"./p-BSs-2JKu.js";import{B as A,a as D}from"./p-CHw7tICr.js";import{a6 as E,a7 as z}from"./p-CPKMvyV_.js";import{o as G,g as B}from"./p-CpGEMRkH.js";import"./p-D8GTwl9v.js";import"./p-Bx2_PW91.js";import"./p-De4Pig-y.js";import"./p-CqiVXthx.js";const V={created_at:()=>t("th",{part:E,scope:"col",title:"The date each checkout occurred"},"Processed On"),payment_amount:()=>t("th",{part:E,scope:"col",title:"The dollar amount of each checkout"},"Payment Amount"),payment_description:()=>t("th",{part:E,scope:"col",title:"The description of each checkout"},"Payment Description"),sub_account_name:()=>t("th",{part:E,scope:"col",title:"The sub account associated with the checkout"},"Sub Account"),payment_mode:()=>t("th",{part:E,scope:"col",title:"The payment mode of each checkout"},"Payment Mode"),status:()=>t("th",{part:E,scope:"col",title:"The current status of each checkout"},"Status")},H={created_at:(e,s)=>t("td",{part:z(s)},t("div",{class:"fw-bold"},x(e.created_at)),t("div",{class:"fw-bold"},O(e.created_at))),payment_amount:(e,s)=>t("td",{part:z(s)},e.formattedPaymentAmount(e.payment_amount)),payment_description:(e,s)=>t("td",{part:z(s)},e.payment_description),sub_account_name:(e,s)=>t("td",{part:z(s)},e.sub_account_name),payment_mode:(e,s)=>t("td",{part:z(s)},e.payment_mode),status:(e,s)=>t("td",{part:z(s)},t(D,Object.assign({},{created:{variant:A.PRIMARY,title:"The checkout has been created",text:"Created"},completed:{variant:A.SUCCESS,title:"The checkout has been completed",text:"Completed"},attempted:{variant:A.SECONDARY,title:"The checkout has been attempted",text:"Attempted"},expired:{variant:A.DANGER,title:"The checkout has expired",text:"Expired"}}[e.status])))},J=class{constructor(t){e(this,t),this.clickEvent=s(this,"click-event",7),this.errorEvent=s(this,"error-event",7),this.columns="created_at,payment_amount,payment_description,payment_mode,status",this.checkouts=[],this.subAccounts=[],this.loading=!0,this.paging=c,this.pagingParams={},this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:I.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:I.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const s=this.checkouts.find((t=>t.id===e));this.clickEvent.emit({name:I.row,data:s})}}componentWillLoad(){n(),this.analytics=new d(this),this.checkoutsTable=new b(this.checkouts,this.columns,V,H),this.initializeGetData(),this.getCheckouts&&this.fetchData(),G("set",(()=>{this.pagingParams={}})),G("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}authPropChanged(){this.initializeGetData(),this.getCheckouts&&this.fetchData()}pagingOrColumnsChanged(){this.getCheckouts&&this.fetchData()}initializeGetData(){this.initializeGetCheckouts(),this.initializeGetSubAccounts()}initializeGetCheckouts(){const t=this.subAccountId||this.accountId;t&&this.authToken?this.getCheckouts=(({accountId:t,authToken:e,service:s})=>async({params:o,onSuccess:c,onError:n})=>{var d,p;try{const u=await s.fetchCheckouts(t,e,o);if(u.error)return n({error:h(u.error),code:r(null===(p=u.error)||void 0===p?void 0:p.code),severity:i.ERROR});{const t=Object.assign({},u.page_info);c({checkouts:(null===(d=u.data)||void 0===d?void 0:d.map((t=>new a(t))))||[],pagingInfo:t})}}catch(t){const e=r(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:i.ERROR})}})({accountId:t,authToken:this.authToken,service:new p}):(this.errorMessage="Account ID/Sub Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=u({primaryAccountId:this.accountId,authToken:this.authToken,service:new m}))}fetchData(){this.getCheckouts&&(this.loading=!0,this.getCheckouts({params:this.checkoutParams,onSuccess:async({checkouts:t,pagingInfo:e})=>{this.checkouts=t,this.paging=e,this.checkoutsTable.collectionData=this.checkouts,this.checkoutsTable.columnKeys.includes("sub_account_name")?await this.fetchSubAccounts():this.loading=!1},onError:({error:t,code:e,severity:s})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:s}),this.loading=!1}}))}async fetchSubAccounts(){this.getSubAccounts?this.getSubAccounts({params:this.subAccountParams,onSuccess:({subAccounts:t})=>{this.subAccounts=t,this.checkouts=this.checkouts.map((t=>{var e;return t.sub_account_name=null===(e=this.subAccounts.find((e=>e.id===t.account_id)))||void 0===e?void 0:e.name,t})),this.loading=!1},onError:({error:t,code:e,severity:s})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:s}),this.loading=!1}}):this.loading=!1}get checkoutParams(){const t=B();return Object.assign(Object.assign({},t),this.pagingParams)}get subAccountParams(){const t=this.checkouts.map((t=>t.account_id));return{sub_account_id:[...new Set(t)].join(",")}}get entityId(){return this.checkouts.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.checkoutsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(f,{key:"d384dda32587dfc469e998b2b8f209ef17aef775"},t(l,{key:"98f2472188e64a236fd5cc581efe2895a6de58a3"},t(y,{key:"f02db4d024b9d2250a637fb28dca06eaff1d894c"},t(k,{key:"8c96bfa14e4e2154c1f575595f9597d3adc640df"},t(g,{key:"08cddf6a31fbe99c8b46f61ceca996acb9b87f0b"},this.checkoutsTable.columnData.map((t=>t)))),t(C,{key:"99b88bfdb3871f82d653b00536f22c5c17cf38ac"},t(v,{key:"e05e1d543481df360b42e5563d5963277d10110e",columnSpan:this.checkoutsTable.columnKeys.length,isLoading:this.loading}),t(j,{key:"3c4e19d3e8c9c779249efa63be592fbf5948b6ae",isEmpty:this.showEmptyState,columnSpan:this.checkoutsTable.columnKeys.length}),t(_,{key:"7660b4991974dc46d8fb9dfd28ef7ea79d8e22e0",columnSpan:this.checkoutsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.checkoutsTable.rowData.map(((e,s)=>t(w,{"data-test-id":"table-row","data-row-entity-id":this.entityId[s],onClick:this.rowClickHandler},e)))),this.paging&&t(T,{key:"d56c6cb6a529dabf00c5260a39a2e2ab8e3749be"},t(S,{key:"d28363ad8d8823f3da097edb263aa10308cbdb04"},t(P,{key:"d6fcce3cf39e43718e8b15d42445c053d0feaa21",colSpan:this.checkoutsTable.columnData.length},t("pagination-menu",{key:"6b956571ed6ae297df5430cad4be92eee2bdb9cc",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["authPropChanged"],authToken:["authPropChanged"],subAccountId:["authPropChanged"],pagingParams:["pagingOrColumnsChanged"],columns:["pagingOrColumnsChanged"]}}};export{J as justifi_checkouts_list}
@@ -1 +1 @@
1
- import{h as s,r as t,c as i}from"./p-CV0Pyo1O.js";import{J as e}from"./p-DYL3RR2S.js";import{C as r,b as o}from"./p-DXTa04jn.js";import{m as n,b as h}from"./p-Da3fPDxu.js";import{B as a}from"./p-R_0S69Pr.js";import{A as p}from"./p-De4Pig-y.js";import"./p-CLHwhyvu.js";import{C as m,B as l,c as d}from"./p-BcNb9bVO.js";import{c as u}from"./p-C_SQBHCI.js";import{i as c}from"./p-BSs-2JKu.js";import{t as v}from"./p-CPKMvyV_.js";import{S as f}from"./p-DzEdYT8R.js";import{H as g}from"./p-jIDKmNHy.js";import"./p-CZfYo5-1.js";import{B as y}from"./p-XYgDHrVL.js";import{P as j}from"./p-DSclFZ32.js";import"./p-BtzgeLyZ.js";import"./p-CdwzNfP1.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-uZ5KAseb.js";const b=p();class C{async postProvisioning(s,t,i){return b.post({endpoint:"entities/provisioning",body:{business_id:t,product_category:i},authToken:s})}}const w=()=>s("div",{class:"row gap-3 p-5"},s("div",{class:"col-12"},s(g,{text:"Business Already Provisioned"})),s("div",{class:"col-12",part:v},s("p",null,"We have already received the onboarding information for this business."))),S=()=>s("div",{class:"row gap-3 p5"},s("div",{class:"col-12"},s(g,{text:"You're all set for now"})),s("div",{class:"col-12",part:v},s("p",null,"We're reviewing your information and working on your approval. We'll be in touch to let you know once you've been approved (or if we find anything that needs fixing). Have a good one!"))),k=class{constructor(s){t(this,s),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.submitEvent=i(this,"submit-event",7),this.loading=!1,this.businessLoading=!0,this.businessProvisioned=!1,this.formSubmitted=!1,this.currentStep=0,this.country=m.USA,this.allowOptionalFields=!1,this.formTitle="Business Information",this.refs=[],this.setBusinessProvisioned=()=>new Promise((s=>{this.getBusiness({onSuccess:t=>{const i=new l(t.data);this.businessProvisioned=d(i),this.country=i.country_of_establishment,this.businessProvisioned&&this.errorEvent.emit({message:"A request to provision payments for this business has already been submitted.",errorCode:o.PROVISIONING_REQUESTED,severity:r.INFO}),this.businessLoading=!1,s()},onError:({error:t,code:i,severity:e})=>{this.errorEvent.emit({message:t,errorCode:i,severity:e}),this.businessLoading=!1,s()}})})),this.postProvisioningData=()=>{this.postProvisioning({onSuccess:s=>{this.formSubmitted=!0,this.submitEvent.emit({response:s})},onError:({error:s,code:t,severity:i})=>{this.submitEvent.emit({response:{error:s}}),this.errorEvent.emit({message:s,errorCode:t,severity:i})}})},this.incrementSteps=()=>{if(this.currentStep<this.totalSteps)return this.currentStep++},this.decrementSteps=()=>{this.currentStep>0&&(this.currentStep-=1)},this.previousStepButtonOnClick=()=>{this.clickEvent.emit({name:y.previousStep}),this.decrementSteps()},this.nextStepButtonOnClick=(s,t)=>{s.preventDefault(),this.clickEvent.emit({name:t}),this.refs[this.currentStep].validateAndSubmit({onSuccess:this.incrementSteps})}}propChanged(){this.initializeApi()}handleFormCompleted(){this.postProvisioningData()}handleFormLoading(s){this.loading=s.detail}async componentWillLoad(){u(),this.analytics=new e(this),this.initializeApi(),this.getBusiness?await this.setBusinessProvisioned():this.businessLoading=!1,this.refs=new Array(8)}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeApi(){this.authToken&&this.businessId?c(this.authToken)?this.errorEvent.emit({message:"auth-token is expired",errorCode:o.NOT_AUTHENTICATED,severity:r.ERROR}):(this.getBusiness=n({authToken:this.authToken,businessId:this.businessId,service:new a}),this.postProvisioning=h({authToken:this.authToken,businessId:this.businessId,product:"payment",service:new C})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}get formDisabled(){return this.loading||this.businessProvisioned}get totalSteps(){return this.refs.length-1}get stepCounter(){return`Step ${this.currentStep+1} of ${this.totalSteps+1}`}render(){return s(f,null,this.businessLoading?s(j,null):this.businessProvisioned?s(w,null):this.formSubmitted?s(S,null):s("div",{class:"row gap-3"},s(g,{text:this.formTitle}),s("payment-provisioning-form-steps",{businessId:this.businessId,authToken:this.authToken,refs:this.refs,currentStep:this.currentStep,allowOptionalFields:this.allowOptionalFields,country:this.country,handleFormLoading:this.handleFormLoading}),s("div",{class:"d-flex justify-content-between align-items-center"},s("div",{class:"d-flex align-items-center",part:v},this.stepCounter),s("payment-provisioning-form-buttons",{currentStep:this.currentStep,totalSteps:this.totalSteps,formLoading:this.loading,formDisabled:this.formDisabled,previousStepButtonOnClick:this.previousStepButtonOnClick,nextStepButtonOnClick:this.nextStepButtonOnClick}))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};export{k as justifi_payment_provisioning}
1
+ import{h as s,r as t,c as i}from"./p-CV0Pyo1O.js";import{J as e}from"./p-CfIGO7TJ.js";import{C as r,b as o}from"./p-DXTa04jn.js";import{m as n,b as h}from"./p-Da3fPDxu.js";import{B as a}from"./p-R_0S69Pr.js";import{A as p}from"./p-De4Pig-y.js";import"./p-CLHwhyvu.js";import{C as m,B as l,c as d}from"./p-BcNb9bVO.js";import{c as u}from"./p-CqOzVXGL.js";import{i as c}from"./p-BSs-2JKu.js";import{t as v}from"./p-CPKMvyV_.js";import{S as f}from"./p-DzEdYT8R.js";import{H as g}from"./p-jIDKmNHy.js";import"./p-CZfYo5-1.js";import{B as y}from"./p-XYgDHrVL.js";import{P as j}from"./p-DSclFZ32.js";import"./p-Bx2_PW91.js";import"./p-CdwzNfP1.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-HXpYMWUU.js";import"./p-uZ5KAseb.js";const b=p();class C{async postProvisioning(s,t,i){return b.post({endpoint:"entities/provisioning",body:{business_id:t,product_category:i},authToken:s})}}const w=()=>s("div",{class:"row gap-3 p-5"},s("div",{class:"col-12"},s(g,{text:"Business Already Provisioned"})),s("div",{class:"col-12",part:v},s("p",null,"We have already received the onboarding information for this business."))),S=()=>s("div",{class:"row gap-3 p5"},s("div",{class:"col-12"},s(g,{text:"You're all set for now"})),s("div",{class:"col-12",part:v},s("p",null,"We're reviewing your information and working on your approval. We'll be in touch to let you know once you've been approved (or if we find anything that needs fixing). Have a good one!"))),k=class{constructor(s){t(this,s),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.submitEvent=i(this,"submit-event",7),this.loading=!1,this.businessLoading=!0,this.businessProvisioned=!1,this.formSubmitted=!1,this.currentStep=0,this.country=m.USA,this.allowOptionalFields=!1,this.formTitle="Business Information",this.refs=[],this.setBusinessProvisioned=()=>new Promise((s=>{this.getBusiness({onSuccess:t=>{const i=new l(t.data);this.businessProvisioned=d(i),this.country=i.country_of_establishment,this.businessProvisioned&&this.errorEvent.emit({message:"A request to provision payments for this business has already been submitted.",errorCode:o.PROVISIONING_REQUESTED,severity:r.INFO}),this.businessLoading=!1,s()},onError:({error:t,code:i,severity:e})=>{this.errorEvent.emit({message:t,errorCode:i,severity:e}),this.businessLoading=!1,s()}})})),this.postProvisioningData=()=>{this.postProvisioning({onSuccess:s=>{this.formSubmitted=!0,this.submitEvent.emit({response:s})},onError:({error:s,code:t,severity:i})=>{this.submitEvent.emit({response:{error:s}}),this.errorEvent.emit({message:s,errorCode:t,severity:i})}})},this.incrementSteps=()=>{if(this.currentStep<this.totalSteps)return this.currentStep++},this.decrementSteps=()=>{this.currentStep>0&&(this.currentStep-=1)},this.previousStepButtonOnClick=()=>{this.clickEvent.emit({name:y.previousStep}),this.decrementSteps()},this.nextStepButtonOnClick=(s,t)=>{s.preventDefault(),this.clickEvent.emit({name:t}),this.refs[this.currentStep].validateAndSubmit({onSuccess:this.incrementSteps})}}propChanged(){this.initializeApi()}handleFormCompleted(){this.postProvisioningData()}handleFormLoading(s){this.loading=s.detail}async componentWillLoad(){u(),this.analytics=new e(this),this.initializeApi(),this.getBusiness?await this.setBusinessProvisioned():this.businessLoading=!1,this.refs=new Array(8)}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeApi(){this.authToken&&this.businessId?c(this.authToken)?this.errorEvent.emit({message:"auth-token is expired",errorCode:o.NOT_AUTHENTICATED,severity:r.ERROR}):(this.getBusiness=n({authToken:this.authToken,businessId:this.businessId,service:new a}),this.postProvisioning=h({authToken:this.authToken,businessId:this.businessId,product:"payment",service:new C})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}get formDisabled(){return this.loading||this.businessProvisioned}get totalSteps(){return this.refs.length-1}get stepCounter(){return`Step ${this.currentStep+1} of ${this.totalSteps+1}`}render(){return s(f,null,this.businessLoading?s(j,null):this.businessProvisioned?s(w,null):this.formSubmitted?s(S,null):s("div",{class:"row gap-3"},s(g,{text:this.formTitle}),s("payment-provisioning-form-steps",{businessId:this.businessId,authToken:this.authToken,refs:this.refs,currentStep:this.currentStep,allowOptionalFields:this.allowOptionalFields,country:this.country,handleFormLoading:this.handleFormLoading}),s("div",{class:"d-flex justify-content-between align-items-center"},s("div",{class:"d-flex align-items-center",part:v},this.stepCounter),s("payment-provisioning-form-buttons",{currentStep:this.currentStep,totalSteps:this.totalSteps,formLoading:this.loading,formDisabled:this.formDisabled,previousStepButtonOnClick:this.previousStepButtonOnClick,nextStepButtonOnClick:this.nextStepButtonOnClick}))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};export{k as justifi_payment_provisioning}
@@ -1 +1 @@
1
- import{r as t,c as n,h as r,g as e}from"./p-CV0Pyo1O.js";import{g as o}from"./p-BFTU3MAI.js";import{C as i,b as u}from"./p-DXTa04jn.js";import{J as c}from"./p-DYL3RR2S.js";import{c as s}from"./p-C_SQBHCI.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-BtzgeLyZ.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";var f,a,h={};function l(){return a?f:(a=1,f=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then})}var d,w={},p={};function v(){if(d)return p;let t;d=1;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return p.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},p.getSymbolTotalCodewords=function(t){return n[t]},p.getBCHDigit=function(t){let n=0;for(;0!==t;)n++,t>>>=1;return n},p.setToSJISFunction=function(n){if("function"!=typeof n)throw new Error('"toSJISFunc" is not a valid function.');t=n},p.isKanjiModeEnabled=function(){return void 0!==t},p.toSJIS=function(n){return t(n)},p}var m,g,E,y,A,M={};function b(){return m||(m=1,(t=M).L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(n,r){if(t.isValid(n))return n;try{return function(n){if("string"!=typeof n)throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+n)}}(n)}catch(t){return r}}),M;var t}var T,C,R,I,x={},U={},k={},P={};function j(){if(I)return P;I=1;const t=b(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return P.getBlocksCount=function(r,e){switch(e){case t.L:return n[4*(r-1)+0];case t.M:return n[4*(r-1)+1];case t.Q:return n[4*(r-1)+2];case t.H:return n[4*(r-1)+3];default:return}},P.getTotalCodewordsCount=function(n,e){switch(e){case t.L:return r[4*(n-1)+0];case t.M:return r[4*(n-1)+1];case t.Q:return r[4*(n-1)+2];case t.H:return r[4*(n-1)+3];default:return}},P}var B,F,N,_,L={},D={};var S,$={},Q={},q={};function J(){return S||(S=1,q.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),q}var Z,z,H,O={};function V(){if(Z)return O;Z=1;const t="[0-9]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+")(?:.|[\r\n]))+";O.KANJI=new RegExp(n,"g"),O.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),O.BYTE=new RegExp(r,"g"),O.NUMERIC=new RegExp(t,"g"),O.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const e=new RegExp("^"+n+"$"),o=new RegExp("^"+t+"$"),i=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return O.testKanji=function(t){return e.test(t)},O.testNumeric=function(t){return o.test(t)},O.testAlphanumeric=function(t){return i.test(t)},O}function Y(){return z||(z=1,function(t){const n=J(),r=V();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!n.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(n){return r.testNumeric(n)?t.NUMERIC:r.testAlphanumeric(n)?t.ALPHANUMERIC:r.testKanji(n)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(n,r){if(t.isValid(n))return n;try{return function(n){if("string"!=typeof n)throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}(n)}catch(t){return r}}}(Q)),Q}var K,W,X,G,tt,nt,rt,et,ot,it,ut,ct,st={},ft={},at={exports:{}};function ht(){return it||(it=1,function(t){var n={single_source_shortest_paths:function(t,r,e){var o={},i={};i[r]=0;var u,c,s,f,a,h,l=n.PriorityQueue.make();for(l.push(r,0);!l.empty();)for(s in f=(u=l.pop()).cost,a=t[c=u.value]||{})a.hasOwnProperty(s)&&(h=f+a[s],(void 0===i[s]||i[s]>h)&&(i[s]=h,l.push(s,h),o[s]=c));if(void 0!==e&&void 0===i[e]){var d=["Could not find a path from ",r," to ",e,"."].join("");throw new Error(d)}return o},extract_shortest_path_from_predecessor_list:function(t,n){for(var r=[],e=n;e;)r.push(e),e=t[e];return r.reverse(),r},find_path:function(t,r,e){var o=n.single_source_shortest_paths(t,r,e);return n.extract_shortest_path_from_predecessor_list(o,e)},PriorityQueue:{make:function(t){var r,e=n.PriorityQueue,o={};for(r in t=t||{},e)e.hasOwnProperty(r)&&(o[r]=e[r]);return o.queue=[],o.sorter=t.sorter||e.default_sorter,o},default_sorter:function(t,n){return t.cost-n.cost},push:function(t,n){this.queue.push({value:t,cost:n}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=n}(at)),at.exports}function lt(){if(ct)return w;ct=1;const t=v(),n=b(),r=function(){if(E)return g;function t(){this.buffer=[],this.length=0}return E=1,t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let r=0;r<n;r++)this.putBit(1==(t>>>n-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},g=t}(),e=function(){if(A)return y;function t(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return A=1,t.prototype.set=function(t,n,r,e){const o=t*this.size+n;this.data[o]=r,e&&(this.reservedBit[o]=!0)},t.prototype.get=function(t,n){return this.data[t*this.size+n]},t.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},t.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},y=t}(),o=(T||(T=1,function(t){const n=v().getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const r=Math.floor(t/7)+2,e=n(t),o=145===e?26:2*Math.ceil((e-13)/(2*r-2)),i=[e-7];for(let t=1;t<r-1;t++)i[t]=i[t-1]-o;return i.push(6),i.reverse()},t.getPositions=function(n){const r=[],e=t.getRowColCoords(n),o=e.length;for(let t=0;t<o;t++)for(let n=0;n<o;n++)0===t&&0===n||0===t&&n===o-1||t===o-1&&0===n||r.push([e[t],e[n]]);return r}}(x)),x),i=function(){if(C)return U;C=1;const t=v().getSymbolSize;return U.getPositions=function(n){const r=t(n);return[[0,0],[r-7,0],[0,r-7]]},U}(),u=(R||(R=1,function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function n(n,r,e){switch(n){case t.Patterns.PATTERN000:return(r+e)%2==0;case t.Patterns.PATTERN001:return r%2==0;case t.Patterns.PATTERN010:return e%3==0;case t.Patterns.PATTERN011:return(r+e)%3==0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(e/3))%2==0;case t.Patterns.PATTERN101:return r*e%2+r*e%3==0;case t.Patterns.PATTERN110:return(r*e%2+r*e%3)%2==0;case t.Patterns.PATTERN111:return(r*e%3+(r+e)%2)%2==0;default:throw new Error("bad maskPattern:"+n)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,e=0,o=0,i=null,u=null;for(let c=0;c<n;c++){e=o=0,i=u=null;for(let s=0;s<n;s++){let n=t.get(c,s);n===i?e++:(e>=5&&(r+=e-5+3),i=n,e=1),n=t.get(s,c),n===u?o++:(o>=5&&(r+=o-5+3),u=n,o=1)}e>=5&&(r+=e-5+3),o>=5&&(r+=o-5+3)}return r},t.getPenaltyN2=function(t){const n=t.size;let r=0;for(let e=0;e<n-1;e++)for(let o=0;o<n-1;o++){const n=t.get(e,o)+t.get(e,o+1)+t.get(e+1,o)+t.get(e+1,o+1);4!==n&&0!==n||r++}return 3*r},t.getPenaltyN3=function(t){const n=t.size;let r=0,e=0,o=0;for(let i=0;i<n;i++){e=o=0;for(let u=0;u<n;u++)e=e<<1&2047|t.get(i,u),u>=10&&(1488===e||93===e)&&r++,o=o<<1&2047|t.get(u,i),u>=10&&(1488===o||93===o)&&r++}return 40*r},t.getPenaltyN4=function(t){let n=0;const r=t.data.length;for(let e=0;e<r;e++)n+=t.data[e];return 10*Math.abs(Math.ceil(100*n/r/5)-10)},t.applyMask=function(t,r){const e=r.size;for(let o=0;o<e;o++)for(let i=0;i<e;i++)r.isReserved(i,o)||r.xor(i,o,n(t,i,o))},t.getBestMask=function(n,r){const e=Object.keys(t.Patterns).length;let o=0,i=1/0;for(let u=0;u<e;u++){r(u),t.applyMask(u,n);const e=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(u,n),e<i&&(i=e,o=u)}return o}}(k)),k),c=j(),s=function(){if(_)return N;_=1;const t=(F||(F=1,function(t){const n=function(){if(B)return D;B=1;const t=new Uint8Array(512),n=new Uint8Array(256);return function(){let r=1;for(let e=0;e<255;e++)t[e]=r,n[r]=e,r<<=1,256&r&&(r^=285);for(let n=255;n<512;n++)t[n]=t[n-255]}(),D.log=function(t){if(t<1)throw new Error("log("+t+")");return n[t]},D.exp=function(n){return t[n]},D.mul=function(r,e){return 0===r||0===e?0:t[n[r]+n[e]]},D}();t.mul=function(t,r){const e=new Uint8Array(t.length+r.length-1);for(let o=0;o<t.length;o++)for(let i=0;i<r.length;i++)e[o+i]^=n.mul(t[o],r[i]);return e},t.mod=function(t,r){let e=new Uint8Array(t);for(;e.length-r.length>=0;){const t=e[0];for(let o=0;o<r.length;o++)e[o]^=n.mul(r[o],t);let o=0;for(;o<e.length&&0===e[o];)o++;e=e.slice(o)}return e},t.generateECPolynomial=function(r){let e=new Uint8Array([1]);for(let o=0;o<r;o++)e=t.mul(e,new Uint8Array([1,n.exp(o)]));return e}}(L)),L);function n(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(n){this.degree=n,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(n.length+this.degree);r.set(n);const e=t.mod(r,this.genPoly),o=this.degree-e.length;if(o>0){const t=new Uint8Array(this.degree);return t.set(e,o),t}return e},N=n}(),f=(H||(H=1,function(t){const n=v(),r=j(),e=b(),o=Y(),i=J(),u=n.getBCHDigit(7973);function c(t,n){return o.getCharCountIndicator(t,n)+4}function s(t,n){let r=0;return t.forEach((function(t){const e=c(t.mode,n);r+=e+t.getBitsLength()})),r}t.from=function(t,n){return i.isValid(t)?parseInt(t,10):n},t.getCapacity=function(t,e,u){if(!i.isValid(t))throw new Error("Invalid QR Code version");void 0===u&&(u=o.BYTE);const s=8*(n.getSymbolTotalCodewords(t)-r.getTotalCodewordsCount(t,e));if(u===o.MIXED)return s;const f=s-c(u,t);switch(u){case o.NUMERIC:return Math.floor(f/10*3);case o.ALPHANUMERIC:return Math.floor(f/11*2);case o.KANJI:return Math.floor(f/13);default:return Math.floor(f/8)}},t.getBestVersionForData=function(n,r){let i;const u=e.from(r,e.M);if(Array.isArray(n)){if(n.length>1)return function(n,r){for(let e=1;e<=40;e++)if(s(n,e)<=t.getCapacity(e,r,o.MIXED))return e}(n,u);if(0===n.length)return 1;i=n[0]}else i=n;return function(n,r,e){for(let o=1;o<=40;o++)if(r<=t.getCapacity(o,e,n))return o}(i.mode,i.getLength(),u)},t.getEncodedBits=function(t){if(!i.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;n.getBCHDigit(r)-u>=0;)r^=7973<<n.getBCHDigit(r)-u;return t<<12|r}}($)),$),a=function(){if(K)return st;K=1;const t=v(),n=t.getBCHDigit(1335);return st.getEncodedBits=function(r,e){const o=r.bit<<3|e;let i=o<<10;for(;t.getBCHDigit(i)-n>=0;)i^=1335<<t.getBCHDigit(i)-n;return 21522^(o<<10|i)},st}(),h=Y(),l=(ut||(ut=1,function(t){const n=Y(),r=function(){if(X)return W;X=1;const t=Y();function n(n){this.mode=t.NUMERIC,this.data=n.toString()}return n.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){let n,r,e;for(n=0;n+3<=this.data.length;n+=3)r=this.data.substr(n,3),e=parseInt(r,10),t.put(e,10);const o=this.data.length-n;o>0&&(r=this.data.substr(n),e=parseInt(r,10),t.put(e,3*o+1))},W=n}(),e=function(){if(tt)return G;tt=1;const t=Y(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=t.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let e=45*n.indexOf(this.data[r]);e+=n.indexOf(this.data[r+1]),t.put(e,11)}this.data.length%2&&t.put(n.indexOf(this.data[r]),6)},G=r}(),o=function(){if(rt)return nt;rt=1;const t=Y();function n(n){this.mode=t.BYTE,this.data="string"==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}return n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,r=this.data.length;n<r;n++)t.put(this.data[n],8)},nt=n}(),i=function(){if(ot)return et;ot=1;const t=Y(),n=v();function r(n){this.mode=t.KANJI,this.data=n}return r.getBitsLength=function(t){return 13*t},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){let r;for(r=0;r<this.data.length;r++){let e=n.toSJIS(this.data[r]);if(e>=33088&&e<=40956)e-=33088;else{if(!(e>=57408&&e<=60351))throw new Error("Invalid SJIS character: "+this.data[r]+"\nMake sure your charset is UTF-8");e-=49472}e=192*(e>>>8&255)+(255&e),t.put(e,13)}},et=r}(),u=V(),c=v(),s=ht();function f(t){return unescape(encodeURIComponent(t)).length}function a(t,n,r){const e=[];let o;for(;null!==(o=t.exec(r));)e.push({data:o[0],index:o.index,mode:n,length:o[0].length});return e}function h(t){const r=a(u.NUMERIC,n.NUMERIC,t),e=a(u.ALPHANUMERIC,n.ALPHANUMERIC,t);let o,i;return c.isKanjiModeEnabled()?(o=a(u.BYTE,n.BYTE,t),i=a(u.KANJI,n.KANJI,t)):(o=a(u.BYTE_KANJI,n.BYTE,t),i=[]),r.concat(e,o,i).sort((function(t,n){return t.index-n.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function l(t,u){switch(u){case n.NUMERIC:return r.getBitsLength(t);case n.ALPHANUMERIC:return e.getBitsLength(t);case n.KANJI:return i.getBitsLength(t);case n.BYTE:return o.getBitsLength(t)}}function d(t,u){let s;const f=n.getBestModeForData(t);if(s=n.from(u,f),s!==n.BYTE&&s.bit<f.bit)throw new Error('"'+t+'" cannot be encoded with mode '+n.toString(s)+".\n Suggested mode is: "+n.toString(f));switch(s!==n.KANJI||c.isKanjiModeEnabled()||(s=n.BYTE),s){case n.NUMERIC:return new r(t);case n.ALPHANUMERIC:return new e(t);case n.KANJI:return new i(t);case n.BYTE:return new o(t)}}t.fromArray=function(t){return t.reduce((function(t,n){return"string"==typeof n?t.push(d(n,null)):n.data&&t.push(d(n.data,n.mode)),t}),[])},t.fromString=function(r,e){const o=function(t,r){const e={},o={start:{}};let i=["start"];for(let u=0;u<t.length;u++){const c=t[u],s=[];for(let t=0;t<c.length;t++){const f=c[t],a=""+u+t;s.push(a),e[a]={node:f,lastCount:0},o[a]={};for(let t=0;t<i.length;t++){const u=i[t];e[u]&&e[u].node.mode===f.mode?(o[u][a]=l(e[u].lastCount+f.length,f.mode)-l(e[u].lastCount,f.mode),e[u].lastCount+=f.length):(e[u]&&(e[u].lastCount=f.length),o[u][a]=l(f.length,f.mode)+4+n.getCharCountIndicator(f.mode,r))}}i=s}for(let t=0;t<i.length;t++)o[i[t]].end=0;return{map:o,table:e}}(function(t){const r=[];for(let e=0;e<t.length;e++){const o=t[e];switch(o.mode){case n.NUMERIC:r.push([o,{data:o.data,mode:n.ALPHANUMERIC,length:o.length},{data:o.data,mode:n.BYTE,length:o.length}]);break;case n.ALPHANUMERIC:r.push([o,{data:o.data,mode:n.BYTE,length:o.length}]);break;case n.KANJI:r.push([o,{data:o.data,mode:n.BYTE,length:f(o.data)}]);break;case n.BYTE:r.push([{data:o.data,mode:n.BYTE,length:f(o.data)}])}}return r}(h(r,c.isKanjiModeEnabled())),e),i=s.find_path(o.map,"start","end"),u=[];for(let t=1;t<i.length-1;t++)u.push(o.table[i[t]].node);return t.fromArray(u.reduce((function(t,n){const r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)}),[]))},t.rawSplit=function(n){return t.fromArray(h(n,c.isKanjiModeEnabled()))}}(ft)),ft);function d(t,n,r){const e=t.size,o=a.getEncodedBits(n,r);let i,u;for(i=0;i<15;i++)u=1==(o>>i&1),t.set(i<6?i:i<8?i+1:e-15+i,8,u,!0),t.set(8,i<8?e-i-1:i<9?15-i-1+1:15-i-1,u,!0);t.set(e-8,8,1,!0)}function p(n,a,w,p){let v;if(Array.isArray(n))v=l.fromArray(n);else{if("string"!=typeof n)throw new Error("Invalid data");{let t=a;if(!t){const r=l.rawSplit(n);t=f.getBestVersionForData(r,w)}v=l.fromString(n,t||40)}}const m=f.getBestVersionForData(v,w);if(!m)throw new Error("The amount of data is too big to be stored in a QR Code");if(a){if(a<m)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+m+".\n")}else a=m;const g=function(n,e,o){const i=new r;o.forEach((function(t){i.put(t.mode.bit,4),i.put(t.getLength(),h.getCharCountIndicator(t.mode,n)),t.write(i)}));const u=8*(t.getSymbolTotalCodewords(n)-c.getTotalCodewordsCount(n,e));for(i.getLengthInBits()+4<=u&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const f=(u-i.getLengthInBits())/8;for(let t=0;t<f;t++)i.put(t%2?17:236,8);return function(n,r,e){const o=t.getSymbolTotalCodewords(r),i=o-c.getTotalCodewordsCount(r,e),u=c.getBlocksCount(r,e),f=u-o%u,a=Math.floor(o/u),h=Math.floor(i/u),l=h+1,d=a-h,w=new s(d);let p=0;const v=new Array(u),m=new Array(u);let g=0;const E=new Uint8Array(n.buffer);for(let t=0;t<u;t++){const n=t<f?h:l;v[t]=E.slice(p,p+n),m[t]=w.encode(v[t]),p+=n,g=Math.max(g,n)}const y=new Uint8Array(o);let A,M,b=0;for(A=0;A<g;A++)for(M=0;M<u;M++)A<v[M].length&&(y[b++]=v[M][A]);for(A=0;A<d;A++)for(M=0;M<u;M++)y[b++]=m[M][A];return y}(i,n,e)}(a,w,v),E=t.getSymbolSize(a),y=new e(E);return function(t,n){const r=t.size,e=i.getPositions(n);for(let n=0;n<e.length;n++){const o=e[n][0],i=e[n][1];for(let n=-1;n<=7;n++)if(!(o+n<=-1||r<=o+n))for(let e=-1;e<=7;e++)i+e<=-1||r<=i+e||t.set(o+n,i+e,n>=0&&n<=6&&(0===e||6===e)||e>=0&&e<=6&&(0===n||6===n)||n>=2&&n<=4&&e>=2&&e<=4,!0)}}(y,a),function(t){const n=t.size;for(let r=8;r<n-8;r++){const n=r%2==0;t.set(r,6,n,!0),t.set(6,r,n,!0)}}(y),function(t,n){const r=o.getPositions(n);for(let n=0;n<r.length;n++){const e=r[n][0],o=r[n][1];for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)t.set(e+n,o+r,-2===n||2===n||-2===r||2===r||0===n&&0===r,!0)}}(y,a),d(y,w,0),a>=7&&function(t,n){const r=t.size,e=f.getEncodedBits(n);let o,i,u;for(let n=0;n<18;n++)o=Math.floor(n/3),i=n%3+r-8-3,u=1==(e>>n&1),t.set(o,i,u,!0),t.set(i,o,u,!0)}(y,a),function(t,n){const r=t.size;let e=-1,o=r-1,i=7,u=0;for(let c=r-1;c>0;c-=2)for(6===c&&c--;;){for(let r=0;r<2;r++)if(!t.isReserved(o,c-r)){let e=!1;u<n.length&&(e=1==(n[u]>>>i&1)),t.set(o,c-r,e),i--,-1===i&&(u++,i=7)}if(o+=e,o<0||r<=o){o-=e,e=-e;break}}}(y,g),isNaN(p)&&(p=u.getBestMask(y,d.bind(null,y,w))),u.applyMask(p,y),d(y,w,p),{modules:y,version:a,errorCorrectionLevel:w,maskPattern:p,segments:v}}return w.create=function(r,e){if(void 0===r||""===r)throw new Error("No input text");let o,i,c=n.M;return void 0!==e&&(c=n.from(e.errorCorrectionLevel,n.M),o=f.from(e.version),i=u.from(e.maskPattern),e.toSJISFunc&&t.setToSJISFunction(e.toSJISFunc)),p(r,o,c,i)},w}var dt,wt,pt={},vt={};function mt(){return dt||(dt=1,function(t){function n(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let n=t.slice().replace("#","").split("");if(n.length<3||5===n.length||n.length>8)throw new Error("Invalid hex color: "+t);3!==n.length&&4!==n.length||(n=Array.prototype.concat.apply([],n.map((function(t){return[t,t]})))),6===n.length&&n.push("F","F");const r=parseInt(n.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const r=t.width&&t.width>=21?t.width:void 0;return{width:r,scale:r?4:t.scale||4,margin:null==t.margin||t.margin<0?4:t.margin,color:{dark:n(t.color.dark||"#000000ff"),light:n(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,n){return n.width&&n.width>=t+2*n.margin?n.width/(t+2*n.margin):n.scale},t.getImageWidth=function(n,r){const e=t.getScale(n,r);return Math.floor((n+2*r.margin)*e)},t.qrToImageData=function(n,r,e){const o=r.modules.size,i=r.modules.data,u=t.getScale(o,e),c=Math.floor((o+2*e.margin)*u),s=e.margin*u,f=[e.color.light,e.color.dark];for(let t=0;t<c;t++)for(let r=0;r<c;r++){let a=4*(t*c+r),h=e.color.light;t>=s&&r>=s&&t<c-s&&r<c-s&&(h=f[i[Math.floor((t-s)/u)*o+Math.floor((r-s)/u)]?1:0]),n[a++]=h.r,n[a++]=h.g,n[a++]=h.b,n[a]=h.a}}}(vt)),vt}var gt,Et,yt={};var At=function(){if(Et)return h;Et=1;const t=l(),n=lt(),r=(wt||(wt=1,function(t){const n=mt();t.render=function(t,r,e){let o=e,i=r;void 0!==o||r&&r.getContext||(o=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),o=n.getOptions(o);const u=n.getImageWidth(t.modules.size,o),c=i.getContext("2d"),s=c.createImageData(u,u);return n.qrToImageData(s.data,t,o),function(t,n,r){t.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=r,n.width=r,n.style.height=r+"px",n.style.width=r+"px"}(c,i,u),c.putImageData(s,0,0),i},t.renderToDataURL=function(n,r,e){let o=e;return void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={}),t.render(n,r,o).toDataURL(o.type||"image/png",(o.rendererOpts||{}).quality)}}(pt)),pt),e=function(){if(gt)return yt;gt=1;const t=mt();function n(t,n){const r=t.a/255,e=n+'="'+t.hex+'"';return r<1?e+" "+n+'-opacity="'+r.toFixed(2).slice(1)+'"':e}function r(t,n,r){let e=t+n;return void 0!==r&&(e+=" "+r),e}return yt.render=function(e,o,i){const u=t.getOptions(o),c=e.modules.size,s=e.modules.data,f=c+2*u.margin,a=u.color.light.a?"<path "+n(u.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",h="<path "+n(u.color.dark,"stroke")+' d="'+function(t,n,e){let o="",i=0,u=!1,c=0;for(let s=0;s<t.length;s++){const f=Math.floor(s%n),a=Math.floor(s/n);f||u||(u=!0),t[s]?(c++,s>0&&f>0&&t[s-1]||(o+=u?r("M",f+e,.5+a+e):r("m",i,0),i=0,u=!1),f+1<n&&t[s+1]||(o+=r("h",c),c=0)):i++}return o}(s,c,u.margin)+'"/>',l='<svg xmlns="http://www.w3.org/2000/svg" '+(u.width?'width="'+u.width+'" height="'+u.width+'" ':"")+'viewBox="0 0 '+f+" "+f+'" shape-rendering="crispEdges">'+a+h+"</svg>\n";return"function"==typeof i&&i(null,l),l},yt}();function o(r,e,o,i,u){const c=[].slice.call(arguments,1),s=c.length,f="function"==typeof c[s-1];if(!f&&!t())throw new Error("Callback required as last argument");if(!f){if(s<1)throw new Error("Too few arguments provided");return 1===s?(o=e,e=i=void 0):2!==s||e.getContext||(i=o,o=e,e=void 0),new Promise((function(t,u){try{const u=n.create(o,i);t(r(u,e,i))}catch(t){u(t)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(u=o,o=e,e=i=void 0):3===s&&(e.getContext&&void 0===u?(u=i,i=void 0):(u=i,i=o,o=e,e=void 0));try{const t=n.create(o,i);u(null,r(t,e,i))}catch(t){u(t)}}return h.create=n.create,h.toCanvas=o.bind(null,r.render),h.toDataURL=o.bind(null,r.renderToDataURL),h.toString=o.bind(null,(function(t,n,r){return e.render(t,r)})),h}(),Mt=o(At);const bt=class{constructor(r){t(this,r),this.errorEvent=n(this,"error-event",7),this.size=256}componentWillLoad(){s(),this.analytics=new c(this)}componentDidLoad(){this.renderQrCode()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.renderQrCode()}get checkoutUrl(){return`https://components.justifi.ai/hosted-checkout/${this.checkoutId}`}async renderQrCode(){if(!this.checkoutId)return void this.errorEvent.emit({message:"checkoutId is required",errorCode:u.MISSING_PROPS,severity:i.ERROR});if(!this.qrContainerEl)return;const t=await Mt.toString(this.checkoutUrl,{type:"svg",width:this.size,errorCorrectionLevel:"M"});this.qrContainerEl.innerHTML=t}render(){return this.checkoutId?r("div",{ref:t=>this.qrContainerEl=t}):null}get el(){return e(this)}static get watchers(){return{checkoutId:["propChanged"],size:["propChanged"]}}};export{bt as justifi_checkout_qr_code}
1
+ import{r as t,c as n,h as r,g as e}from"./p-CV0Pyo1O.js";import{g as o}from"./p-BFTU3MAI.js";import{C as i,b as u}from"./p-DXTa04jn.js";import{J as c}from"./p-CfIGO7TJ.js";import{c as s}from"./p-CqOzVXGL.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-Bx2_PW91.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";var f,a,h={};function l(){return a?f:(a=1,f=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then})}var d,w={},p={};function v(){if(d)return p;let t;d=1;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return p.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},p.getSymbolTotalCodewords=function(t){return n[t]},p.getBCHDigit=function(t){let n=0;for(;0!==t;)n++,t>>>=1;return n},p.setToSJISFunction=function(n){if("function"!=typeof n)throw new Error('"toSJISFunc" is not a valid function.');t=n},p.isKanjiModeEnabled=function(){return void 0!==t},p.toSJIS=function(n){return t(n)},p}var m,g,E,y,A,M={};function b(){return m||(m=1,(t=M).L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(t){return t&&void 0!==t.bit&&t.bit>=0&&t.bit<4},t.from=function(n,r){if(t.isValid(n))return n;try{return function(n){if("string"!=typeof n)throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+n)}}(n)}catch(t){return r}}),M;var t}var T,C,x,I,R={},U={},P={},k={};function j(){if(I)return k;I=1;const t=b(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return k.getBlocksCount=function(r,e){switch(e){case t.L:return n[4*(r-1)+0];case t.M:return n[4*(r-1)+1];case t.Q:return n[4*(r-1)+2];case t.H:return n[4*(r-1)+3];default:return}},k.getTotalCodewordsCount=function(n,e){switch(e){case t.L:return r[4*(n-1)+0];case t.M:return r[4*(n-1)+1];case t.Q:return r[4*(n-1)+2];case t.H:return r[4*(n-1)+3];default:return}},k}var F,N,B,_,L={},$={};var D,q={},J={},O={};function Q(){return D||(D=1,O.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),O}var S,z,V,Z={};function G(){if(S)return Z;S=1;const t="[0-9]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+")(?:.|[\r\n]))+";Z.KANJI=new RegExp(n,"g"),Z.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Z.BYTE=new RegExp(r,"g"),Z.NUMERIC=new RegExp(t,"g"),Z.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const e=new RegExp("^"+n+"$"),o=new RegExp("^"+t+"$"),i=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Z.testKanji=function(t){return e.test(t)},Z.testNumeric=function(t){return o.test(t)},Z.testAlphanumeric=function(t){return i.test(t)},Z}function H(){return z||(z=1,function(t){const n=Q(),r=G();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!n.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]},t.getBestModeForData=function(n){return r.testNumeric(n)?t.NUMERIC:r.testAlphanumeric(n)?t.ALPHANUMERIC:r.testKanji(n)?t.KANJI:t.BYTE},t.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},t.isValid=function(t){return t&&t.bit&&t.ccBits},t.from=function(n,r){if(t.isValid(n))return n;try{return function(n){if("string"!=typeof n)throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}(n)}catch(t){return r}}}(J)),J}var W,X,K,Y,tt,nt,rt,et,ot,it,ut,ct,st={},ft={},at={exports:{}};function ht(){return it||(it=1,function(t){var n={single_source_shortest_paths:function(t,r,e){var o={},i={};i[r]=0;var u,c,s,f,a,h,l=n.PriorityQueue.make();for(l.push(r,0);!l.empty();)for(s in f=(u=l.pop()).cost,a=t[c=u.value]||{})a.hasOwnProperty(s)&&(h=f+a[s],(void 0===i[s]||i[s]>h)&&(i[s]=h,l.push(s,h),o[s]=c));if(void 0!==e&&void 0===i[e]){var d=["Could not find a path from ",r," to ",e,"."].join("");throw new Error(d)}return o},extract_shortest_path_from_predecessor_list:function(t,n){for(var r=[],e=n;e;)r.push(e),e=t[e];return r.reverse(),r},find_path:function(t,r,e){var o=n.single_source_shortest_paths(t,r,e);return n.extract_shortest_path_from_predecessor_list(o,e)},PriorityQueue:{make:function(t){var r,e=n.PriorityQueue,o={};for(r in t=t||{},e)e.hasOwnProperty(r)&&(o[r]=e[r]);return o.queue=[],o.sorter=t.sorter||e.default_sorter,o},default_sorter:function(t,n){return t.cost-n.cost},push:function(t,n){this.queue.push({value:t,cost:n}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=n}(at)),at.exports}function lt(){if(ct)return w;ct=1;const t=v(),n=b(),r=function(){if(E)return g;function t(){this.buffer=[],this.length=0}return E=1,t.prototype={get:function(t){const n=Math.floor(t/8);return 1==(this.buffer[n]>>>7-t%8&1)},put:function(t,n){for(let r=0;r<n;r++)this.putBit(1==(t>>>n-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},g=t}(),e=function(){if(A)return y;function t(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return A=1,t.prototype.set=function(t,n,r,e){const o=t*this.size+n;this.data[o]=r,e&&(this.reservedBit[o]=!0)},t.prototype.get=function(t,n){return this.data[t*this.size+n]},t.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},t.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},y=t}(),o=(T||(T=1,function(t){const n=v().getSymbolSize;t.getRowColCoords=function(t){if(1===t)return[];const r=Math.floor(t/7)+2,e=n(t),o=145===e?26:2*Math.ceil((e-13)/(2*r-2)),i=[e-7];for(let t=1;t<r-1;t++)i[t]=i[t-1]-o;return i.push(6),i.reverse()},t.getPositions=function(n){const r=[],e=t.getRowColCoords(n),o=e.length;for(let t=0;t<o;t++)for(let n=0;n<o;n++)0===t&&0===n||0===t&&n===o-1||t===o-1&&0===n||r.push([e[t],e[n]]);return r}}(R)),R),i=function(){if(C)return U;C=1;const t=v().getSymbolSize;return U.getPositions=function(n){const r=t(n);return[[0,0],[r-7,0],[0,r-7]]},U}(),u=(x||(x=1,function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function n(n,r,e){switch(n){case t.Patterns.PATTERN000:return(r+e)%2==0;case t.Patterns.PATTERN001:return r%2==0;case t.Patterns.PATTERN010:return e%3==0;case t.Patterns.PATTERN011:return(r+e)%3==0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(e/3))%2==0;case t.Patterns.PATTERN101:return r*e%2+r*e%3==0;case t.Patterns.PATTERN110:return(r*e%2+r*e%3)%2==0;case t.Patterns.PATTERN111:return(r*e%3+(r+e)%2)%2==0;default:throw new Error("bad maskPattern:"+n)}}t.isValid=function(t){return null!=t&&""!==t&&!isNaN(t)&&t>=0&&t<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(t){const n=t.size;let r=0,e=0,o=0,i=null,u=null;for(let c=0;c<n;c++){e=o=0,i=u=null;for(let s=0;s<n;s++){let n=t.get(c,s);n===i?e++:(e>=5&&(r+=e-5+3),i=n,e=1),n=t.get(s,c),n===u?o++:(o>=5&&(r+=o-5+3),u=n,o=1)}e>=5&&(r+=e-5+3),o>=5&&(r+=o-5+3)}return r},t.getPenaltyN2=function(t){const n=t.size;let r=0;for(let e=0;e<n-1;e++)for(let o=0;o<n-1;o++){const n=t.get(e,o)+t.get(e,o+1)+t.get(e+1,o)+t.get(e+1,o+1);4!==n&&0!==n||r++}return 3*r},t.getPenaltyN3=function(t){const n=t.size;let r=0,e=0,o=0;for(let i=0;i<n;i++){e=o=0;for(let u=0;u<n;u++)e=e<<1&2047|t.get(i,u),u>=10&&(1488===e||93===e)&&r++,o=o<<1&2047|t.get(u,i),u>=10&&(1488===o||93===o)&&r++}return 40*r},t.getPenaltyN4=function(t){let n=0;const r=t.data.length;for(let e=0;e<r;e++)n+=t.data[e];return 10*Math.abs(Math.ceil(100*n/r/5)-10)},t.applyMask=function(t,r){const e=r.size;for(let o=0;o<e;o++)for(let i=0;i<e;i++)r.isReserved(i,o)||r.xor(i,o,n(t,i,o))},t.getBestMask=function(n,r){const e=Object.keys(t.Patterns).length;let o=0,i=1/0;for(let u=0;u<e;u++){r(u),t.applyMask(u,n);const e=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(u,n),e<i&&(i=e,o=u)}return o}}(P)),P),c=j(),s=function(){if(_)return B;_=1;const t=(N||(N=1,function(t){const n=function(){if(F)return $;F=1;const t=new Uint8Array(512),n=new Uint8Array(256);return function(){let r=1;for(let e=0;e<255;e++)t[e]=r,n[r]=e,r<<=1,256&r&&(r^=285);for(let n=255;n<512;n++)t[n]=t[n-255]}(),$.log=function(t){if(t<1)throw new Error("log("+t+")");return n[t]},$.exp=function(n){return t[n]},$.mul=function(r,e){return 0===r||0===e?0:t[n[r]+n[e]]},$}();t.mul=function(t,r){const e=new Uint8Array(t.length+r.length-1);for(let o=0;o<t.length;o++)for(let i=0;i<r.length;i++)e[o+i]^=n.mul(t[o],r[i]);return e},t.mod=function(t,r){let e=new Uint8Array(t);for(;e.length-r.length>=0;){const t=e[0];for(let o=0;o<r.length;o++)e[o]^=n.mul(r[o],t);let o=0;for(;o<e.length&&0===e[o];)o++;e=e.slice(o)}return e},t.generateECPolynomial=function(r){let e=new Uint8Array([1]);for(let o=0;o<r;o++)e=t.mul(e,new Uint8Array([1,n.exp(o)]));return e}}(L)),L);function n(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(n){this.degree=n,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(n.length+this.degree);r.set(n);const e=t.mod(r,this.genPoly),o=this.degree-e.length;if(o>0){const t=new Uint8Array(this.degree);return t.set(e,o),t}return e},B=n}(),f=(V||(V=1,function(t){const n=v(),r=j(),e=b(),o=H(),i=Q(),u=n.getBCHDigit(7973);function c(t,n){return o.getCharCountIndicator(t,n)+4}function s(t,n){let r=0;return t.forEach((function(t){const e=c(t.mode,n);r+=e+t.getBitsLength()})),r}t.from=function(t,n){return i.isValid(t)?parseInt(t,10):n},t.getCapacity=function(t,e,u){if(!i.isValid(t))throw new Error("Invalid QR Code version");void 0===u&&(u=o.BYTE);const s=8*(n.getSymbolTotalCodewords(t)-r.getTotalCodewordsCount(t,e));if(u===o.MIXED)return s;const f=s-c(u,t);switch(u){case o.NUMERIC:return Math.floor(f/10*3);case o.ALPHANUMERIC:return Math.floor(f/11*2);case o.KANJI:return Math.floor(f/13);default:return Math.floor(f/8)}},t.getBestVersionForData=function(n,r){let i;const u=e.from(r,e.M);if(Array.isArray(n)){if(n.length>1)return function(n,r){for(let e=1;e<=40;e++)if(s(n,e)<=t.getCapacity(e,r,o.MIXED))return e}(n,u);if(0===n.length)return 1;i=n[0]}else i=n;return function(n,r,e){for(let o=1;o<=40;o++)if(r<=t.getCapacity(o,e,n))return o}(i.mode,i.getLength(),u)},t.getEncodedBits=function(t){if(!i.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;n.getBCHDigit(r)-u>=0;)r^=7973<<n.getBCHDigit(r)-u;return t<<12|r}}(q)),q),a=function(){if(W)return st;W=1;const t=v(),n=t.getBCHDigit(1335);return st.getEncodedBits=function(r,e){const o=r.bit<<3|e;let i=o<<10;for(;t.getBCHDigit(i)-n>=0;)i^=1335<<t.getBCHDigit(i)-n;return 21522^(o<<10|i)},st}(),h=H(),l=(ut||(ut=1,function(t){const n=H(),r=function(){if(K)return X;K=1;const t=H();function n(n){this.mode=t.NUMERIC,this.data=n.toString()}return n.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){let n,r,e;for(n=0;n+3<=this.data.length;n+=3)r=this.data.substr(n,3),e=parseInt(r,10),t.put(e,10);const o=this.data.length-n;o>0&&(r=this.data.substr(n),e=parseInt(r,10),t.put(e,3*o+1))},X=n}(),e=function(){if(tt)return Y;tt=1;const t=H(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=t.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let e=45*n.indexOf(this.data[r]);e+=n.indexOf(this.data[r+1]),t.put(e,11)}this.data.length%2&&t.put(n.indexOf(this.data[r]),6)},Y=r}(),o=function(){if(rt)return nt;rt=1;const t=H();function n(n){this.mode=t.BYTE,this.data="string"==typeof n?(new TextEncoder).encode(n):new Uint8Array(n)}return n.getBitsLength=function(t){return 8*t},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(t){for(let n=0,r=this.data.length;n<r;n++)t.put(this.data[n],8)},nt=n}(),i=function(){if(ot)return et;ot=1;const t=H(),n=v();function r(n){this.mode=t.KANJI,this.data=n}return r.getBitsLength=function(t){return 13*t},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){let r;for(r=0;r<this.data.length;r++){let e=n.toSJIS(this.data[r]);if(e>=33088&&e<=40956)e-=33088;else{if(!(e>=57408&&e<=60351))throw new Error("Invalid SJIS character: "+this.data[r]+"\nMake sure your charset is UTF-8");e-=49472}e=192*(e>>>8&255)+(255&e),t.put(e,13)}},et=r}(),u=G(),c=v(),s=ht();function f(t){return unescape(encodeURIComponent(t)).length}function a(t,n,r){const e=[];let o;for(;null!==(o=t.exec(r));)e.push({data:o[0],index:o.index,mode:n,length:o[0].length});return e}function h(t){const r=a(u.NUMERIC,n.NUMERIC,t),e=a(u.ALPHANUMERIC,n.ALPHANUMERIC,t);let o,i;return c.isKanjiModeEnabled()?(o=a(u.BYTE,n.BYTE,t),i=a(u.KANJI,n.KANJI,t)):(o=a(u.BYTE_KANJI,n.BYTE,t),i=[]),r.concat(e,o,i).sort((function(t,n){return t.index-n.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function l(t,u){switch(u){case n.NUMERIC:return r.getBitsLength(t);case n.ALPHANUMERIC:return e.getBitsLength(t);case n.KANJI:return i.getBitsLength(t);case n.BYTE:return o.getBitsLength(t)}}function d(t,u){let s;const f=n.getBestModeForData(t);if(s=n.from(u,f),s!==n.BYTE&&s.bit<f.bit)throw new Error('"'+t+'" cannot be encoded with mode '+n.toString(s)+".\n Suggested mode is: "+n.toString(f));switch(s!==n.KANJI||c.isKanjiModeEnabled()||(s=n.BYTE),s){case n.NUMERIC:return new r(t);case n.ALPHANUMERIC:return new e(t);case n.KANJI:return new i(t);case n.BYTE:return new o(t)}}t.fromArray=function(t){return t.reduce((function(t,n){return"string"==typeof n?t.push(d(n,null)):n.data&&t.push(d(n.data,n.mode)),t}),[])},t.fromString=function(r,e){const o=function(t,r){const e={},o={start:{}};let i=["start"];for(let u=0;u<t.length;u++){const c=t[u],s=[];for(let t=0;t<c.length;t++){const f=c[t],a=""+u+t;s.push(a),e[a]={node:f,lastCount:0},o[a]={};for(let t=0;t<i.length;t++){const u=i[t];e[u]&&e[u].node.mode===f.mode?(o[u][a]=l(e[u].lastCount+f.length,f.mode)-l(e[u].lastCount,f.mode),e[u].lastCount+=f.length):(e[u]&&(e[u].lastCount=f.length),o[u][a]=l(f.length,f.mode)+4+n.getCharCountIndicator(f.mode,r))}}i=s}for(let t=0;t<i.length;t++)o[i[t]].end=0;return{map:o,table:e}}(function(t){const r=[];for(let e=0;e<t.length;e++){const o=t[e];switch(o.mode){case n.NUMERIC:r.push([o,{data:o.data,mode:n.ALPHANUMERIC,length:o.length},{data:o.data,mode:n.BYTE,length:o.length}]);break;case n.ALPHANUMERIC:r.push([o,{data:o.data,mode:n.BYTE,length:o.length}]);break;case n.KANJI:r.push([o,{data:o.data,mode:n.BYTE,length:f(o.data)}]);break;case n.BYTE:r.push([{data:o.data,mode:n.BYTE,length:f(o.data)}])}}return r}(h(r,c.isKanjiModeEnabled())),e),i=s.find_path(o.map,"start","end"),u=[];for(let t=1;t<i.length-1;t++)u.push(o.table[i[t]].node);return t.fromArray(u.reduce((function(t,n){const r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===n.mode?(t[t.length-1].data+=n.data,t):(t.push(n),t)}),[]))},t.rawSplit=function(n){return t.fromArray(h(n,c.isKanjiModeEnabled()))}}(ft)),ft);function d(t,n,r){const e=t.size,o=a.getEncodedBits(n,r);let i,u;for(i=0;i<15;i++)u=1==(o>>i&1),t.set(i<6?i:i<8?i+1:e-15+i,8,u,!0),t.set(8,i<8?e-i-1:i<9?15-i-1+1:15-i-1,u,!0);t.set(e-8,8,1,!0)}function p(n,a,w,p){let v;if(Array.isArray(n))v=l.fromArray(n);else{if("string"!=typeof n)throw new Error("Invalid data");{let t=a;if(!t){const r=l.rawSplit(n);t=f.getBestVersionForData(r,w)}v=l.fromString(n,t||40)}}const m=f.getBestVersionForData(v,w);if(!m)throw new Error("The amount of data is too big to be stored in a QR Code");if(a){if(a<m)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+m+".\n")}else a=m;const g=function(n,e,o){const i=new r;o.forEach((function(t){i.put(t.mode.bit,4),i.put(t.getLength(),h.getCharCountIndicator(t.mode,n)),t.write(i)}));const u=8*(t.getSymbolTotalCodewords(n)-c.getTotalCodewordsCount(n,e));for(i.getLengthInBits()+4<=u&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);const f=(u-i.getLengthInBits())/8;for(let t=0;t<f;t++)i.put(t%2?17:236,8);return function(n,r,e){const o=t.getSymbolTotalCodewords(r),i=o-c.getTotalCodewordsCount(r,e),u=c.getBlocksCount(r,e),f=u-o%u,a=Math.floor(o/u),h=Math.floor(i/u),l=h+1,d=a-h,w=new s(d);let p=0;const v=new Array(u),m=new Array(u);let g=0;const E=new Uint8Array(n.buffer);for(let t=0;t<u;t++){const n=t<f?h:l;v[t]=E.slice(p,p+n),m[t]=w.encode(v[t]),p+=n,g=Math.max(g,n)}const y=new Uint8Array(o);let A,M,b=0;for(A=0;A<g;A++)for(M=0;M<u;M++)A<v[M].length&&(y[b++]=v[M][A]);for(A=0;A<d;A++)for(M=0;M<u;M++)y[b++]=m[M][A];return y}(i,n,e)}(a,w,v),E=t.getSymbolSize(a),y=new e(E);return function(t,n){const r=t.size,e=i.getPositions(n);for(let n=0;n<e.length;n++){const o=e[n][0],i=e[n][1];for(let n=-1;n<=7;n++)if(!(o+n<=-1||r<=o+n))for(let e=-1;e<=7;e++)i+e<=-1||r<=i+e||t.set(o+n,i+e,n>=0&&n<=6&&(0===e||6===e)||e>=0&&e<=6&&(0===n||6===n)||n>=2&&n<=4&&e>=2&&e<=4,!0)}}(y,a),function(t){const n=t.size;for(let r=8;r<n-8;r++){const n=r%2==0;t.set(r,6,n,!0),t.set(6,r,n,!0)}}(y),function(t,n){const r=o.getPositions(n);for(let n=0;n<r.length;n++){const e=r[n][0],o=r[n][1];for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)t.set(e+n,o+r,-2===n||2===n||-2===r||2===r||0===n&&0===r,!0)}}(y,a),d(y,w,0),a>=7&&function(t,n){const r=t.size,e=f.getEncodedBits(n);let o,i,u;for(let n=0;n<18;n++)o=Math.floor(n/3),i=n%3+r-8-3,u=1==(e>>n&1),t.set(o,i,u,!0),t.set(i,o,u,!0)}(y,a),function(t,n){const r=t.size;let e=-1,o=r-1,i=7,u=0;for(let c=r-1;c>0;c-=2)for(6===c&&c--;;){for(let r=0;r<2;r++)if(!t.isReserved(o,c-r)){let e=!1;u<n.length&&(e=1==(n[u]>>>i&1)),t.set(o,c-r,e),i--,-1===i&&(u++,i=7)}if(o+=e,o<0||r<=o){o-=e,e=-e;break}}}(y,g),isNaN(p)&&(p=u.getBestMask(y,d.bind(null,y,w))),u.applyMask(p,y),d(y,w,p),{modules:y,version:a,errorCorrectionLevel:w,maskPattern:p,segments:v}}return w.create=function(r,e){if(void 0===r||""===r)throw new Error("No input text");let o,i,c=n.M;return void 0!==e&&(c=n.from(e.errorCorrectionLevel,n.M),o=f.from(e.version),i=u.from(e.maskPattern),e.toSJISFunc&&t.setToSJISFunction(e.toSJISFunc)),p(r,o,c,i)},w}var dt,wt,pt={},vt={};function mt(){return dt||(dt=1,function(t){function n(t){if("number"==typeof t&&(t=t.toString()),"string"!=typeof t)throw new Error("Color should be defined as hex string");let n=t.slice().replace("#","").split("");if(n.length<3||5===n.length||n.length>8)throw new Error("Invalid hex color: "+t);3!==n.length&&4!==n.length||(n=Array.prototype.concat.apply([],n.map((function(t){return[t,t]})))),6===n.length&&n.push("F","F");const r=parseInt(n.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function(t){t||(t={}),t.color||(t.color={});const r=t.width&&t.width>=21?t.width:void 0;return{width:r,scale:r?4:t.scale||4,margin:null==t.margin||t.margin<0?4:t.margin,color:{dark:n(t.color.dark||"#000000ff"),light:n(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},t.getScale=function(t,n){return n.width&&n.width>=t+2*n.margin?n.width/(t+2*n.margin):n.scale},t.getImageWidth=function(n,r){const e=t.getScale(n,r);return Math.floor((n+2*r.margin)*e)},t.qrToImageData=function(n,r,e){const o=r.modules.size,i=r.modules.data,u=t.getScale(o,e),c=Math.floor((o+2*e.margin)*u),s=e.margin*u,f=[e.color.light,e.color.dark];for(let t=0;t<c;t++)for(let r=0;r<c;r++){let a=4*(t*c+r),h=e.color.light;t>=s&&r>=s&&t<c-s&&r<c-s&&(h=f[i[Math.floor((t-s)/u)*o+Math.floor((r-s)/u)]?1:0]),n[a++]=h.r,n[a++]=h.g,n[a++]=h.b,n[a]=h.a}}}(vt)),vt}var gt,Et,yt={};var At=function(){if(Et)return h;Et=1;const t=l(),n=lt(),r=(wt||(wt=1,function(t){const n=mt();t.render=function(t,r,e){let o=e,i=r;void 0!==o||r&&r.getContext||(o=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}()),o=n.getOptions(o);const u=n.getImageWidth(t.modules.size,o),c=i.getContext("2d"),s=c.createImageData(u,u);return n.qrToImageData(s.data,t,o),function(t,n,r){t.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=r,n.width=r,n.style.height=r+"px",n.style.width=r+"px"}(c,i,u),c.putImageData(s,0,0),i},t.renderToDataURL=function(n,r,e){let o=e;return void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={}),t.render(n,r,o).toDataURL(o.type||"image/png",(o.rendererOpts||{}).quality)}}(pt)),pt),e=function(){if(gt)return yt;gt=1;const t=mt();function n(t,n){const r=t.a/255,e=n+'="'+t.hex+'"';return r<1?e+" "+n+'-opacity="'+r.toFixed(2).slice(1)+'"':e}function r(t,n,r){let e=t+n;return void 0!==r&&(e+=" "+r),e}return yt.render=function(e,o,i){const u=t.getOptions(o),c=e.modules.size,s=e.modules.data,f=c+2*u.margin,a=u.color.light.a?"<path "+n(u.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",h="<path "+n(u.color.dark,"stroke")+' d="'+function(t,n,e){let o="",i=0,u=!1,c=0;for(let s=0;s<t.length;s++){const f=Math.floor(s%n),a=Math.floor(s/n);f||u||(u=!0),t[s]?(c++,s>0&&f>0&&t[s-1]||(o+=u?r("M",f+e,.5+a+e):r("m",i,0),i=0,u=!1),f+1<n&&t[s+1]||(o+=r("h",c),c=0)):i++}return o}(s,c,u.margin)+'"/>',l='<svg xmlns="http://www.w3.org/2000/svg" '+(u.width?'width="'+u.width+'" height="'+u.width+'" ':"")+'viewBox="0 0 '+f+" "+f+'" shape-rendering="crispEdges">'+a+h+"</svg>\n";return"function"==typeof i&&i(null,l),l},yt}();function o(r,e,o,i,u){const c=[].slice.call(arguments,1),s=c.length,f="function"==typeof c[s-1];if(!f&&!t())throw new Error("Callback required as last argument");if(!f){if(s<1)throw new Error("Too few arguments provided");return 1===s?(o=e,e=i=void 0):2!==s||e.getContext||(i=o,o=e,e=void 0),new Promise((function(t,u){try{const u=n.create(o,i);t(r(u,e,i))}catch(t){u(t)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(u=o,o=e,e=i=void 0):3===s&&(e.getContext&&void 0===u?(u=i,i=void 0):(u=i,i=o,o=e,e=void 0));try{const t=n.create(o,i);u(null,r(t,e,i))}catch(t){u(t)}}return h.create=n.create,h.toCanvas=o.bind(null,r.render),h.toDataURL=o.bind(null,r.renderToDataURL),h.toString=o.bind(null,(function(t,n,r){return e.render(t,r)})),h}(),Mt=o(At);const bt=class{constructor(r){t(this,r),this.errorEvent=n(this,"error-event",7),this.size=256}componentWillLoad(){s(),this.analytics=new c(this)}componentDidLoad(){this.renderQrCode()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.renderQrCode()}get checkoutUrl(){return`https://components.justifi.ai/hosted-checkout/${this.checkoutId}`}async renderQrCode(){if(!this.checkoutId)return void this.errorEvent.emit({message:"checkoutId is required",errorCode:u.MISSING_PROPS,severity:i.ERROR});if(!this.qrContainerEl)return;const t=await Mt.toString(this.checkoutUrl,{type:"svg",width:this.size,errorCorrectionLevel:"M"});this.qrContainerEl.innerHTML=t}render(){return this.checkoutId?r("div",{ref:t=>this.qrContainerEl=t}):null}get el(){return e(this)}static get watchers(){return{checkoutId:["propChanged"],size:["propChanged"]}}};export{bt as justifi_checkout_qr_code}
@@ -1 +1 @@
1
- import{r as t,c as e,h as s,H as i}from"./p-CV0Pyo1O.js";import{C as a,b as r,B as n,x as o,y as l,z as h}from"./p-DXTa04jn.js";import{m as c,a as d,c as u,d as m,e as b,f as p,g as f}from"./p-Da3fPDxu.js";import{B as v,a as y,D as g,I as k}from"./p-R_0S69Pr.js";import{a as w,d as _,b as T,g as C,h as x}from"./p-C1gr32IS.js";import{F as L,c as O,a as S,b as j}from"./p-D9sqTVmd.js";import{A,C as D,e as E,R as I,f as V,O as P}from"./p-BcNb9bVO.js";import{C as H,P as N,I as B}from"./p-CVaOFfrI.js";import{b as M,a0 as R,C as F,x as W,u as z,D as q,aa as U,a6 as Z,aj as G,am as Y,A as $,a1 as K}from"./p-CPKMvyV_.js";import{P as X}from"./p-DSclFZ32.js";import{a as J,c as Q,d as tt,b as et}from"./p-BBSnDYJw.js";import{a as st,B as it}from"./p-XYgDHrVL.js";import{n as at}from"./p-BnjCmwMr.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import{B as rt,C as nt,v as ot,D as lt,E as ht,F as ct,G as dt}from"./p-z3RFjy9B.js";import{B as ut}from"./p-CHo7TfsM.js";import"./p-CZfYo5-1.js";import{c as mt}from"./p-DPA5TKvQ.js";import{s as bt,b as pt,d as ft}from"./p-BSs-2JKu.js";import{S as vt}from"./p-uZ5KAseb.js";import{u as yt,a as gt,b as kt}from"./p-C6o0liMT.js";import{A as wt}from"./p-De4Pig-y.js";import{S as _t}from"./p-DzEdYT8R.js";import{P as Tt}from"./p-DP9ysr2K.js";import"./p-CdwzNfP1.js";import"./p-BFTU3MAI.js";import"./p-D8GTwl9v.js";class Ct{constructor(t){this.id=t.id,this.account_owner_name=t.account_owner_name,this.full_name=t.full_name,this.account_type=t.account_type,this.account_number=t.account_number,this.acct_last_four=t.acct_last_four,this.account_number_last4=t.account_number_last4,this.routing_number=t.routing_number,this.institution_number=t.institution_number,this.transit_number=t.transit_number,this.bank_name=t.bank_name,this.country=t.country,this.currency=t.currency,this.nickname=t.nickname,this.metadata=t.metadata,this.business_id=t.business_id,this.platform_account_id=t.platform_account_id,this.created_at=t.created_at,this.updated_at=t.updated_at}get payload(){return{account_owner_name:this.account_owner_name||"",account_type:this.account_type||"",account_number:this.account_number||"",routing_number:this.routing_number||"",institution_number:this.institution_number||"",transit_number:this.transit_number||"",bank_name:this.bank_name||"",nickname:this.nickname||"",business_id:this.business_id||""}}}const xt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.additional_questions={},this.recurringPayments=!1,this.isLoading=!1,this.getData=()=>{this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.additional_questions=new A(t.data.additional_questions||{}),this.formController.setInitialValues(Object.assign({},this.additional_questions))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}})},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.additionalQuestions}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e})),this.additional_questions=new A(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}recurringPaymentsWatcher(t){this.recurringPayments="Yes"===(null==t?void 0:t.business_recurring_payments)}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return{additional_questions:new A(this.formController.values.getValue()).payload}}componentWillLoad(){this.initializeApi(),this.formController=new L(w(this.allowOptionalFields))}componentDidLoad(){this.getBusiness&&this.getData(),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t,e,i,a,r;const n=this.formController.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Additional Questions"),s("form-control-tooltip",{helpText:"This information helps us understand the business and identify and monitor trends to safeguard you and your customers."})),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-monetary-provisioning",{name:"business_revenue",label:"What is your business' estimated annual revenue from its primary business activities?",inputHandler:this.inputHandler,errorText:null===(t=this.errors)||void 0===t?void 0:t.business_revenue,defaultValue:null==n?void 0:n.business_revenue,maskOptions:H.WHOLE})),s("div",{class:"col-12 col-md-6"},s("form-control-monetary-provisioning",{name:"business_payment_volume",label:"What is your business' annual credit card & ACH volume anticipated to process?",inputHandler:this.inputHandler,errorText:null===(e=this.errors)||void 0===e?void 0:e.business_payment_volume,defaultValue:null==n?void 0:n.business_payment_volume,maskOptions:H.WHOLE})),s("div",{class:"col-12"},s("form-control-number",{name:"business_average_transaction_amount",label:"What is your average transaction size?",inputHandler:this.inputHandler,errorText:null===(i=this.errors)||void 0===i?void 0:i.business_average_transaction_amount,defaultValue:null==n?void 0:n.business_average_transaction_amount})),s("div",{class:"col-12"},s("form-control-select",{name:"business_when_service_received",label:"On average, how long after paying will your customers typically receive their goods or services?",inputHandler:this.inputHandler,errorText:null===(a=this.errors)||void 0===a?void 0:a.business_when_service_received,options:J,defaultValue:null==n?void 0:n.business_when_service_received})),s("div",{class:"col-12"},s("form-control-text",{name:"business_other_payment_details",label:"Is there anything else you would like us to know about how your customers pay the business? (optional)",inputHandler:this.inputHandler,errorText:null===(r=this.errors)||void 0===r?void 0:r.business_other_payment_details,defaultValue:null==n?void 0:n.business_other_payment_details})))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],additional_questions:["recurringPaymentsWatcher"]}}},Lt=class{constructor(e){t(this,e)}render(){var t,e,i,a,r,n;return s("div",{key:"d3445ce89732e19baea2e8f224c42011d5a03998",class:"row gy-3"},s("div",{key:"966e1d8ba6043b4f9b57ae0061ae94c177c12b48",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Bank Name",value:null===(t=this.defaultValue)||void 0===t?void 0:t.bank_name}):s("form-control-text",{name:"bank_name",label:"Bank Name",defaultValue:this.defaultValue.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler})),s("div",{key:"314a4f7e181b978b2ff1fdbfdfc8d9484089829a",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Nickname",value:null===(e=this.defaultValue)||void 0===e?void 0:e.nickname}):s("form-control-text",{name:"nickname",label:"Nickname",defaultValue:this.defaultValue.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler})),s("div",{key:"45ac55707ce44b208adaf72e944ea3056810183a",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Owner Name",value:null===(i=this.defaultValue)||void 0===i?void 0:i.account_owner_name}):s("form-control-text",{name:"account_owner_name",label:"Account Owner Name",defaultValue:this.defaultValue.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler})),s("div",{key:"74ce58b36eb3a425d900d7bb0858bda18b2e341c",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Type",value:null===(a=this.defaultValue)||void 0===a?void 0:a.account_type}):s("form-control-select",{name:"account_type",label:"Account Type",options:Q,defaultValue:this.defaultValue.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler})),s("div",{key:"2562105aaaae00d9c46eb61d931a43927d96a8ce",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Number",value:(null===(r=this.defaultValue)||void 0===r?void 0:r.account_number_last4)?`**** ${this.defaultValue.account_number_last4}`:""}):s("form-control-text",{name:"account_number",label:"Account Number",defaultValue:this.defaultValue.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"Please copy the account number as shown on your statement/check. Do not include spaces or dashes."})),s("div",{key:"4c7e6cba0ee1e2567dc5b608559b13ebd3fddd07",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Routing Number",value:(null===(n=this.defaultValue)||void 0===n?void 0:n.routing_number)||""}):s("form-control-text",{name:"routing_number",label:"Routing Number",defaultValue:this.defaultValue.routing_number,maxLength:9,errorText:this.errors.routing_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"A valid routing number is nine digits. Please include any leading or trailing zeroes."})))}},Ot=class{constructor(e){t(this,e)}render(){var t,e,i,a,r,n,o;return s("div",{key:"8de8f05777f72ecb1112328544e75be7cd929e8d",class:"row gy-3"},s("div",{key:"513fb78b434ba3aebe51b636f7494b54e437c65f",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Bank Name",value:null===(t=this.defaultValue)||void 0===t?void 0:t.bank_name}):s("form-control-text",{name:"bank_name",label:"Bank Name",defaultValue:this.defaultValue.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler})),s("div",{key:"37a1ef4ac58fbe1633a93020e786d546cd832867",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Nickname",value:null===(e=this.defaultValue)||void 0===e?void 0:e.nickname}):s("form-control-text",{name:"nickname",label:"Nickname",defaultValue:this.defaultValue.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler})),s("div",{key:"fc8820e264d14ac3c5a1c6fd171b381c2b6d99e1",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Owner Name",value:null===(i=this.defaultValue)||void 0===i?void 0:i.account_owner_name}):s("form-control-text",{name:"account_owner_name",label:"Account Owner Name",defaultValue:this.defaultValue.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler})),s("div",{key:"f183b1c5f6a8b0f905c916cd1715448f3e02d26f",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Type",value:null===(a=this.defaultValue)||void 0===a?void 0:a.account_type}):s("form-control-select",{name:"account_type",label:"Account Type",options:Q,defaultValue:this.defaultValue.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler})),s("div",{key:"8366ebde2f319f6d910a34917f57ad43b3ee234f",class:"col-3"},this.formDisabled?s("bank-account-read-only-value",{label:"Transit Number",value:(null===(r=this.defaultValue)||void 0===r?void 0:r.transit_number)||""}):s("form-control-text",{name:"transit_number",label:"Transit Number",defaultValue:this.defaultValue.transit_number,maxLength:5,errorText:this.errors.transit_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"5 digits"})),s("div",{key:"c91166337c2984048466014634f5d4e59ce2b40a",class:"col-3"},this.formDisabled?s("bank-account-read-only-value",{label:"Institution Number",value:(null===(n=this.defaultValue)||void 0===n?void 0:n.institution_number)||""}):s("form-control-text",{name:"institution_number",label:"Institution Number",defaultValue:this.defaultValue.institution_number,maxLength:3,errorText:this.errors.institution_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"3 digits"})),s("div",{key:"ebce2f50ec265ed2fef7a0b3dae84d33036ad145",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Number",value:(null===(o=this.defaultValue)||void 0===o?void 0:o.account_number_last4)?`**** ${this.defaultValue.account_number_last4}`:""}):s("form-control-text",{name:"account_number",label:"Account Number",defaultValue:this.defaultValue.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"Please copy the account number as shown on your statement. Do not include spaces or dashes."})))}},St=t=>t?{bank_name:ht.nullable(),nickname:lt.nullable(),account_owner_name:ot.nullable(),account_type:nt.nullable(),account_number:rt.nullable()}:{bank_name:ht.required("Enter bank name"),nickname:lt.required("Enter nickname"),account_owner_name:ot.required("Enter account owner name"),account_type:nt.required("Select account type"),account_number:rt.required("Enter account number")},jt={[D.USA]:t=>(t=>{const e=Object.assign(Object.assign({},St(t)),(t=>t?{routing_number:dt.nullable()}:{routing_number:dt.required("Enter routing number")})(t));return O().shape(e)})(t),[D.CAN]:t=>(t=>{const e=Object.assign(Object.assign({},St(t)),(t=>{const e=S().length(3,"Institution number must be 3 digits").matches(ct,"Enter valid institution number"),s=S().length(5,"Transit number must be 5 digits").matches(ct,"Enter valid transit number");return t?{institution_number:e.nullable(),transit_number:s.nullable()}:{institution_number:e.required("Enter institution number"),transit_number:s.required("Enter transit number")}})(t));return O().shape(e)})(t)},At=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.bankAccount={},this.isLoading=!1,this.viewMode="manual",this.bankAccountVerification=!1,this.platformAccountId=null,this.getSchema=()=>(0,jt[this.country])(this.allowOptionalFields),this.initializeFormController=()=>{this.formController=new L(this.getSchema()),this.formController.setInitialValues("readonly"===this.viewMode?Object.assign({},this.bankAccount):{business_id:this.businessId}),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))},this.getData=()=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.processBusinessResponse(t.data),this.determineViewMode()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.initializeFormController(),this.isLoading=!1}})},this.handleChangeBankAccount=()=>{this.viewMode=this.plaidAvailable?"plaid":"manual",this.initializeFormController()},this.handleCancel=()=>{this.viewMode=this.existingBankAccount?"readonly":"plaid",this.initializeFormController()},this.handleToggleToManualEntry=()=>{this.viewMode="manual"},this.handleToggleToPlaidVerification=()=>{this.viewMode="plaid"},this.handleSaveBankAccount=async()=>{this.formController.validateAndSubmit((()=>{this.sendData((()=>{}))}))}}propChanged(){this.initializeApi()}watchHandler(t){this.formLoading.emit(t)}async validateAndSubmit({onSuccess:t}){"readonly"===this.viewMode?this.sendData(t):this.formController.validateAndSubmit((()=>this.sendData(t)))}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData(),this.formController=new L(this.getSchema())}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.postBankAccount=u({authToken:this.authToken,service:new y})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}get postPayload(){const t=this.formController.values.getValue();return new Ct(t).payload}get existingBankAccount(){var t;return!!(null===(t=this.bankAccount)||void 0===t?void 0:t.id)}get plaidAvailable(){return this.bankAccountVerification&&!!this.platformAccountId}get showCancel(){return this.bankAccountVerification||this.existingBankAccount}processBusinessResponse(t){const{bank_accounts:e,settings:s,platform_account_id:i}=t;e.length>0?this.bankAccount=new Ct(e[e.length-1]):(this.bankAccount=new Ct({}),this.bankAccount.business_id=this.businessId),this.bankAccountVerification=!0===s.bank_account_verification,this.platformAccountId=i}determineViewMode(){this.viewMode=this.existingBankAccount?"readonly":this.plaidAvailable?"plaid":"manual"}async sendData(t){try{if("manual"===this.viewMode){if(!await this.postBankAccountData())return;this.viewMode="readonly",await this.refreshBankAccountData()}t()}catch(t){this.errorEvent.emit({message:t,errorCode:r.POST_ERROR,severity:a.ERROR})}}async postBankAccountData(){let t;return this.isLoading=!0,new Promise((e=>{let s=!1;this.postBankAccount({payload:this.postPayload,onSuccess:e=>{t=e,s=!0},onError:({error:t,code:e,severity:i})=>{s=!1,this.errorEvent.emit({message:t,errorCode:e,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:t,formStep:st.bankAccount}),this.isLoading=!1,e(s)}})}))}async refreshBankAccountData(){return new Promise((t=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.processBusinessResponse(t.data),this.determineViewMode(),this.initializeFormController()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.isLoading=!1,t()}})}))}renderBankAccountInputs(t){const e=this.formController.getInitialValues();return s(this.country===D.CAN?"bank-account-form-inputs-canada":"bank-account-form-inputs",{defaultValue:e,errors:this.errors,inputHandler:this.inputHandler,formDisabled:t})}renderReadonlyView(){return s("div",null,this.renderBankAccountInputs(!0),s("div",{class:"mt-3"},s(ut,{variant:"secondary",type:"button",onClick:this.handleChangeBankAccount,disabled:this.isLoading,part:R},"Change Bank Account")))}renderPlaidView(){return s("div",{class:"mt-3"},s("plaid-verification",{authToken:this.authToken,accountId:this.platformAccountId,businessId:this.businessId,onPlaidVerificationSuccess:()=>{this.viewMode="readonly",this.refreshBankAccountData()}}),s("div",{class:"mt-3"},s(ut,{type:"button",variant:"link",className:"p-0",onClick:this.handleToggleToManualEntry,disabled:this.isLoading,part:F},"Enter bank details manually (document upload required)")))}renderManualEntryView(){return s("div",null,this.plaidAvailable&&s("div",{class:"mb-3"},s(ut,{type:"button",variant:"secondary",onClick:this.handleToggleToPlaidVerification,disabled:this.isLoading,part:R},"Link bank account with Plaid instead")),this.renderBankAccountInputs(!1),s("div",{class:"mt-3 d-flex gap-2"},this.showCancel&&s(ut,{variant:"secondary",type:"button",onClick:this.handleCancel,disabled:this.isLoading,part:R},"Cancel"),s(ut,{variant:"primary",type:"button",onClick:this.handleSaveBankAccount,disabled:this.isLoading,isLoading:this.isLoading},"Save Bank Account")))}render(){return this.isLoading?s(X,null):s("form",null,s("fieldset",{class:"mb-4"},s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Bank Account Info"),s("form-control-tooltip",{helpText:"This direct deposit account is the designated bank account where incoming 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."})),s("hr",{class:"mt-2"}),"readonly"===this.viewMode&&this.renderReadonlyView(),"plaid"===this.viewMode&&this.renderPlaidView(),"manual"===this.viewMode&&this.renderManualEntryView()))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],isLoading:["watchHandler"]}}},Dt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.coreInfo={},this.isLoading=!1,this.isEditingTaxId=!1,this.getData=()=>{this.getBusiness&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.coreInfo=new E(t.data),this.formController.setInitialValues(Object.assign({},this.coreInfo))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t(),this.isEditingTaxId=!1},onError:({error:t,code:s,severity:i,rawError:a})=>{e=t,a&&"object"==typeof a&&a.param&&this.formController.setFieldError(a.param,a.message),this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.businessInfo}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.errors[t]&&this.formController.clearFieldError(t),this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return new E(this.formController.values.getValue()).payload}componentWillLoad(){this.initializeApi();const t=this.country===D.CAN?_(this.allowOptionalFields):T(this.allowOptionalFields);this.formController=new L(t),this.getData()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t,e;const i=this.formController.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Business Information")),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"legal_name",label:"Business Name",defaultValue:i.legal_name,errorText:this.errors.legal_name,inputHandler:this.inputHandler,helpText:"Enter this exactly as it appears on your tax records (don't use acronyms or abbreviations unless you registered that way)."})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"doing_business_as",label:"Doing Business As (DBA)",defaultValue:i.doing_business_as,errorText:this.errors.doing_business_as,inputHandler:this.inputHandler,helpText:"Enter this exactly as it appears on your tax records (leave blank if you don't have a registered DBA/trade name)"})),s("div",{class:"col-12 col-md-8"},s("form-control-select",{name:"classification",label:"Business Classification",options:tt,defaultValue:i.classification,errorText:this.errors.classification,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-4"},s("form-control-date",{name:"date_of_incorporation",label:"Date of Registration",defaultValue:i.date_of_incorporation,errorText:this.errors.date_of_incorporation,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"industry",label:"Industry",defaultValue:i.industry,errorText:this.errors.industry,inputHandler:this.inputHandler,helpText:"Describe what you sell"})),s("div",{class:"col-12 col-md-6"},!(null===(t=this.coreInfo)||void 0===t?void 0:t.tax_id_last4)||this.isEditingTaxId?s("form-control-number-masked",{name:"tax_id",label:mt[this.country].taxIdLabelOptional||mt[this.country].taxIdLabel,defaultValue:this.isEditingTaxId?"":i.tax_id,errorText:this.errors.tax_id,inputHandler:this.inputHandler,mask:"000000000",helpText:mt[this.country].taxIdHelpText}):s("div",null,s("label",{class:"form-label",part:W},mt[this.country].taxIdLabel),s("div",{class:"input-group mb-3"},s("input",{type:"text",class:"form-control",part:z,value:`****${null===(e=this.coreInfo)||void 0===e?void 0:e.tax_id_last4}`,disabled:!0}),s("button",{class:"btn btn-secondary",type:"button",part:R,onClick:()=>{this.isEditingTaxId=!0,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{tax_id:"",tax_id_last4:null}))}},"Change")))),s("div",{class:"col-12"},s("form-control-text",{name:"website_url",label:"Business Website URL",defaultValue:i.website_url,errorText:this.errors.website_url,inputHandler:this.inputHandler,helpText:"Don't have a live website? You can use your social media business page, app store link, or staging site URL."})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"email",label:"Business Email Address",defaultValue:i.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-6"},s("form-control-number-masked",{name:"phone",label:"Business Phone Number",defaultValue:i.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:N.US})))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Et=class{constructor(e){t(this,e),this.documents=[],this.isLoading=!1}render(){return this.isLoading?s(vt,{height:"50px"}):this.documents.length?s(i,null,s("div",{class:"card",part:q},s("div",{class:"card-body"},s("h5",{class:"card-title",part:M},"Documents Already on File"),s("div",{class:"table-responsive"},s("table",{class:"table table-sm table-borderless",part:U},s("thead",null,s("tr",null,s("th",{style:{width:"25%"},part:Z,scope:"col"},"File Name"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"File Type"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Document Type"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Date Uploaded"))),s("tbody",null,this.documents.sort(((t,e)=>t.document_type.localeCompare(e.document_type))).map(((t,e)=>s("tr",{class:0===e?"border-bottom border-top":"border-bottom"},s("td",{part:G},t.file_name),s("td",{part:G},t.file_type),s("td",{part:G},bt(t.document_type)),s("td",{part:G},`${pt(t.created_at)} - ${ft(t.created_at)}`))))))))),s("hr",null)):null}},It=class{constructor(s){t(this,s),this.clickEvent=e(this,"click-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.ownersPayload=[],this.refs=[],this.isLoading=!1,this.representativeIsOwner=null,this.matchRef=(t,e)=>{if(null===t)return;const s=this.ownersPayload.findIndex((t=>t.id===e));-1!==s&&(this.refs.length!==this.ownersPayload.length&&this.manageRefs(),this.refs[s]=t)},this.getData=()=>{this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.representative=new I(t.data.representative||{}),t.data.owners.length?this.ownersPayload=t.data.owners.map((t=>({id:t.id}))):this.addOwnerForm()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1,this.manageRefs()}})},this.sendData=async t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:{owners:this.ownersPayload},onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.owners}),this.formLoading.emit(!1)}})},this.addOwnerForm=t=>{this.newFormOpen=!0,this.ownersPayload=[...this.ownersPayload,{id:""}],t&&this.clickEvent.emit({name:it.addOwnerForm})},this.removeOwnerForm=t=>{this.ownersPayload=this.ownersPayload.filter((e=>e.id!==t)),this.newFormOpen&&(this.newFormOpen=!1)},this.handleRepresentativeIsOwnerChange=t=>{this.representativeIsOwner=t,this.representativeIsOwner&&(this.formLoading.emit(!0),this.isLoading=!0,this.ownersPayload=this.ownersPayload.filter((t=>""!==t.id)),this.patchBusiness({payload:{representative:{is_owner:!0},owners:[{id:this.representative.id},...this.ownersPayload]},onSuccess:()=>{this.getData(),this.newFormOpen=!1},finally:()=>{this.isLoading=!1,this.formLoading.emit(!1)}}))}}propChanged(){this.initializeApi()}get showAddOwnerButton(){return this.ownersPayload.length<4&&!this.newFormOpen}manageRefs(){this.refs=this.ownersPayload.map((t=>t.id))}async validateAndSubmit({onSuccess:t}){const e=this.refs.map((t=>t.validate()));if(!(await Promise.all(e)).every((t=>t)))return;if(!this.allowOptionalFields&&100!==(await Promise.all(this.refs.map((t=>t.getOwnershipPercentage())))).reduce(((t,e)=>t+(parseFloat(e)||0)),0))return void await Promise.all(this.refs.map((t=>t.setOwnershipPercentageError("Ownership percentages must total 100%"))));const s=this.refs.map((t=>t.submit()));(await Promise.all(s)).every((t=>t))&&this.sendData(t)}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}ownersWatcher(){this.manageRefs()}handleOwnerSubmit(t){const e=t.detail,s=this.ownersPayload.map((t=>t.id===e.id?e:t));s.includes(e)||(s[this.ownersPayload.findIndex((t=>!t.id))]=e,this.newFormOpen&&(this.newFormOpen=!1)),this.ownersPayload=s}render(){if(this.isLoading)return s(i,null,s(X,null));const t=this.ownersPayload.some((t=>t.id===this.representative.id)),e=null===this.representativeIsOwner&&!t;return s(i,null,s("div",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Owners"),s("form-control-tooltip",{helpText:"For partnerships, LLCs or privately held corporations, the business is required to apply with all individuals with 25% or more ownership to the application. For charities and registered non-profits, the business is required to apply with 1 individual with substantial control over the entity, such as a board member or director."})),s("hr",{class:"mt-2"}),e&&s("div",{class:"alert alert-warning mb-3",part:Y},s("div",{class:"card-body"},s("div",{class:"d-flex align-items-center mb-3"},s("strong",null,"Is the representative of this business also an owner?")),s("div",{class:"d-flex gap-2"},s(ut,{variant:"primary",onClick:()=>this.handleRepresentativeIsOwnerChange(!0)},"Yes"),s(ut,{variant:"secondary",onClick:()=>this.handleRepresentativeIsOwnerChange(!1)},"No")))),s("div",{class:"row gy-3"},this.ownersPayload.map((t=>s("owner-form",{key:t.id,authToken:this.authToken,businessId:this.businessId,ownerId:t.id,removeOwner:this.removeOwnerForm,newFormOpen:this.newFormOpen,ownersLength:this.ownersPayload.length,country:this.country,allowOptionalFields:this.allowOptionalFields,ref:e=>this.matchRef(e,t.id)})))),s("div",{class:"d-flex justify-content-start"},s("div",{class:"gap-2"},s(ut,{variant:"primary",onClick:()=>this.addOwnerForm(!0),hidden:!this.showAddOwnerButton},"Add Owner")))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],ownersPayload:["ownersWatcher"]}}},Vt=class{constructor(e){t(this,e),this.isEditingIdentification=!1,this.inputHandler=(t,e)=>{yt(this.formController,{[t]:e})},this.onAddressFormUpdate=t=>{gt(this.formController,Object.assign(Object.assign({},this.formController.values.getValue().address),t))}}render(){var t,e,i,a,r,n,o,l,h;return s("form",{key:"2346f250e4e2982b5b5b2624d039f551b5b5ed4e"},s("fieldset",{key:"7b496e6157e5eec02ef0d263c68fbd1e001c75ac"},s("div",{key:"b86d993c7fbee2269e48c7d4ea51826f199fecd4",class:"d-flex align-items-center gap-2"},s("legend",{key:"2b013e6068bbbca54a0852093ab4a2fae4ce64d2",class:"mb-0",part:M},"Representative"),s("form-control-tooltip",{key:"01e0f1d6ba2d5ee852593f7015a3ba7e0d980df9",helpText:"The representative for your business needs to be someone who has significant control over managing your business's finance. You will have an opportunity to add owners later in the form."})),s("hr",{key:"4bec34756ec7081e01809175bc3d2b6af0532537",class:"mt-2"}),s("div",{key:"6965720fabb1f12c6bb3c5a81f74ae12f44037b2",class:"row gy-3"},s("div",{key:"efbb768ba1e66d5ef47f792c39a17921b40e0eba",class:"col-12 col-md-8"},s("form-control-text",{key:"28477d3798ba7d14aee9201e84b276d8e85a21df",name:"name",label:"Full Name",defaultValue:null===(t=this.representativeDefaultValue)||void 0===t?void 0:t.name,errorText:this.errors.name,inputHandler:this.inputHandler})),s("div",{key:"28f17ccbe4da476256acd9c5a4e78a6a641ba6e9",class:"col-12 col-md-4"},s("form-control-select",{key:"dae6a93a0bc057abb97024277be0f10de01514e2",name:"title",label:"Title",options:et,defaultValue:null===(e=this.representativeDefaultValue)||void 0===e?void 0:e.title,errorText:this.errors.title,inputHandler:this.inputHandler})),s("div",{key:"2f9a45774adaa0040df2da1a8000d1ee61e16bf5",class:"col-12 col-md-6"},s("form-control-text",{key:"66a2a1ea8b54c03c012d76a74654ee19a9f958a7",name:"email",label:"Email Address",defaultValue:null===(i=this.representativeDefaultValue)||void 0===i?void 0:i.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{key:"3b34f0cb11d358db2220c01aac90e8b7ba3cc01b",class:"col-12 col-md-6"},s("form-control-number-masked",{key:"52c62ec653fb917a248a302f7cb5ad46dc7bcc23",name:"phone",label:"Phone Number",defaultValue:null===(a=this.representativeDefaultValue)||void 0===a?void 0:a.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:N.US})),s("div",{key:"d287ec225af1541cca227d3b8bc54466cbb86b07",class:"col-12 col-md-4"},s("form-control-date",{key:"7e1ff6cc40b01dc7f6ad0ad84d73c0e59eea0d6f",name:"dob_full",label:"Birth Date",defaultValue:null===(r=this.representativeDefaultValue)||void 0===r?void 0:r.dob_full,errorText:this.errors.dob_full,inputHandler:this.inputHandler,onFormControlInput:t=>kt(t,this.formController),helpText:"Must be 18 or older."})),s("div",{key:"283b09c845f1a12f4974f82a26fffbf7c5f608ba",class:"col-12 col-md-8"},!(null===(n=this.representativeDefaultValue)||void 0===n?void 0:n.ssn_last4)||this.isEditingIdentification?s("form-control-number-masked",{name:"identification_number",label:this.country===D.CAN?mt[this.country].idNumberLabelOptional:mt[this.country].idNumberLabel,defaultValue:this.isEditingIdentification?"":null===(o=this.representativeDefaultValue)||void 0===o?void 0:o.identification_number,errorText:this.errors.identification_number,inputHandler:this.inputHandler,mask:B[this.country],helpText:mt[this.country].identityHelpText}):s("div",null,s("label",{class:"form-label",part:W},this.country===D.CAN?mt[this.country].idNumberLabelOptional:mt[this.country].idNumberLabel),s("div",{class:"input-group mb-3"},s("input",{type:"text",class:"form-control",part:z,value:`****${null===(l=this.representativeDefaultValue)||void 0===l?void 0:l.ssn_last4}`,disabled:!0}),s("button",{class:"btn btn-secondary",type:"button",part:R,onClick:()=>{this.isEditingIdentification=!0,yt(this.formController,{identification_number:"",ssn_last4:null})}},"Change")))),s("div",{key:"0a40679570df7b85faa7530797ebc21ca8794263",class:"col-12"},s("identity-address-form",{key:"5a1590251365260413ab63ce9a417d3d71c71e84",errors:this.errors.address,defaultValues:null===(h=this.representativeDefaultValue)||void 0===h?void 0:h.address,handleFormUpdate:this.onAddressFormUpdate,country:this.country})))))}},Pt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.representative={},this.isLoading=!1,this.getData=()=>{this.getBusiness&&this.formController&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.representative=new I(t.data.representative||{}),this.representative.address.country=this.country,this.formController.setInitialValues(Object.assign({},this.representative))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.representative}),this.formLoading.emit(!1)}})}}propChanged(){this.initializeApi(),this.getData()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}componentWillLoad(){this.initializeApi(),this.initializeForm()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}initializeForm(){const t=C[this.country];t?(this.formController=new L(t("representative",this.allowOptionalFields)),this.getData()):this.errorEvent.emit({message:"Missing schema for selected country",errorCode:r.MISSING_PROPS,severity:a.ERROR})}componentDidLoad(){this.formController&&this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}get patchPayload(){return{representative:new I(this.formController.values.getValue()).payload}}render(){return!this.formController||this.isLoading?s(X,null):s("business-representative-form-inputs",{representativeDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController,country:this.country})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Ht=class{constructor(s){t(this,s),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.formCompleted=e(this,"formCompleted",7),this.errors={},this.fetchData=async()=>{this.formLoading.emit(!0);try{const t=await this.api.get({endpoint:this.businessEndpoint,authToken:this.authToken});this.acceptedTermsBefore=t.data.terms_conditions_accepted}catch(t){this.errorEvent.emit({errorCode:r.FETCH_ERROR,message:t.message,severity:a.ERROR,data:t})}finally{this.formLoading.emit(!1)}},this.sendData=async t=>{this.formLoading.emit(!0);try{const e=this.termsPayload,s=await this.api.post({endpoint:this.termsConditionsEndpoint,body:e,authToken:this.authToken});this.handleResponse(s,t)}catch(t){this.errorEvent.emit({errorCode:r.POST_ERROR,message:t.message,severity:a.ERROR,data:t})}finally{this.formLoading.emit(!1)}},this.inputHandler=(t,e)=>{this.acceptedTerms=e,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}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=wt(),this.formController=new L((t=>{const e=O({accepted:j().oneOf([!0],"You must agree to the terms and conditions to continue").required("You must agree to the terms and conditions to continue")}),s=O({accepted:j().nullable()});return t?s:e})(this.allowOptionalFields)),this.businessId&&this.authToken&&this.fetchData()}handleResponse(t,e){t.error?this.errorEvent.emit({errorCode:r.POST_ERROR,message:t.error.message,severity:a.ERROR,data:t.error}):e(),this.stepCompleteEvent.emit({response:t,formStep:st.termsAndConditions}),this.formCompleted.emit()}async validateAndSubmit({onSuccess:t}){this.acceptedTermsBefore?(this.stepCompleteEvent.emit({response:null,formStep:st.termsAndConditions,metadata:"no data submitted"}),this.formCompleted.emit(),t()):this.formController.validateAndSubmit((()=>this.sendData(t)))}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}get merchantAgreementLink(){return s("a",{href:"https://justifi.tech/merchant-agreement/",target:"_blank",rel:"noopener noreferrer"},"merchant agreement")}render(){return s("form",{key:"24b0a8ff0187894cf5e0f56e9e4b28c378e720cb"},s("fieldset",{key:"26fa9159dd6d61edd28b9443a10eeb981f150308"},s("legend",{key:"103bdecbc51f2cccd9105e2f9b271b60760618ec",part:M},"Terms and Conditions"),s("hr",{key:"dfd29fbe609a57d8160df7980ed0e63e75934a86"}),s("div",{key:"61e06597ec652c1d7c6e7e2bd8c9b653d061d076"},s("p",{key:"cd4def71580cd14d6edb5887221ebf6aa80cc2ea"},"Please read and accept the ",this.merchantAgreementLink," to submit your provisioning request.")),s("br",{key:"e3c64733f11a4f702e686e6c5ae7acd7e6bd1c34"}),s("div",{key:"71bd74de3aee69805a2aa1297356ff8b8db3c76c",class:"row-gy-3"},s("div",{key:"94a28c13e3bbc1c89cd1b5ebde2e1732b48f99ea",class:"col-12"},s("form-control-checkbox",{key:"fee95fa42192fee1bbfd544307b4e1c11c0d97f4",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})))))}},Nt=[{label:"Select a document type",value:""},{label:"Articles of Incorporation",value:"articles_of_incorporation"},{label:"Business Registration",value:"business_registration"}],Bt=[{label:"Select a document type",value:""},{label:"Voided Check",value:"voided_check"},{label:"Bank Statement",value:"bank_statement"}],Mt=[{label:"Select a document type",value:""},{label:"Voided Check",value:"voided_check"},{label:"Bank Letter",value:"bank_statement"}],Rt=[{label:"Select a document type",value:""},{label:"Canadian Passport",value:"passport"},{label:"Canadian Driver's License",value:"driver_license"},{label:"Canadian Government Issued ID Card",value:"government_id"},{label:"Permanent Resident Card",value:"resident_card"},{label:"Certificate of Indian Status",value:"status_card"},{label:"US State Issued Driver's License",value:"driver_license"}],Ft=[{label:"Select a document type",value:""},{label:"Nexus Card (Photo ID)",value:"nexus_card"},{label:"Canadian Citizenship/Naturalization Card or Certificate",value:"citizenship_card"},{label:"Foreign Passport",value:"foreign_passport"},{label:"Canadian Birth Certificate",value:"birth_certificate"},{label:"Social Insurance Number (SIN) Card",value:"sin_card"},{label:"Social Security Number (SSN) Card",value:"ssn_card"}];function Wt(t){return[{label:"Business Document",value:"business_document",docTypeOptions:Nt},{label:"Financial Document",value:"financial_document",docTypeOptions:t===D.CAN?Mt:Bt}]}const zt=[{label:"Financial Document",value:"financial_document",docTypeOptions:Bt}],qt=new Set(Rt.filter((t=>t.value)).map((t=>t.value))),Ut=new Set(Ft.filter((t=>t.value)).map((t=>t.value))),Zt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.owners=[],this.existingDocuments=[],this.selectedCategory="",this.selectedDocType="",this.uploadQueue=[],this.isLoading=!1,this.errors={},this.fileInputKey=0,this.categories=[],this.getData=()=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{const{owners:e,documents:s}=t.data;var i;this.owners=e||[],this.existingDocuments=s||[],this.categories=(i=this.country)===D.USA?zt:[...Wt(i),{label:"Identity Document - Group 1",value:"personal_group1",docTypeOptions:Rt},{label:"Identity Document - Group 2",value:"personal_group2",docTypeOptions:Ft}]},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.isLoading=!1}})},this.handleCategoryChange=(t,e)=>{this.selectedCategory=e,this.selectedDocType=""},this.handleDocTypeChange=(t,e)=>{e.startsWith("_")&&e.endsWith("_header")||(this.selectedDocType=e)},this.handleFileSelected=async t=>{const e=Array.from(t.detail.fileList),s=this.categories.find((t=>t.value===this.selectedCategory));if(!s)return;const i=s.docTypeOptions.find((t=>t.value===this.selectedDocType)),a=(null==i?void 0:i.label)||this.selectedDocType,r=e.map((t=>({categoryLabel:s.label,categoryValue:s.value,docTypeLabel:a,docTypeValue:this.selectedDocType,fileName:t.name,file:t,status:"uploading"}))),o=this.uploadQueue.length;this.uploadQueue=[...this.uploadQueue,...r],this.selectedCategory="",this.selectedDocType="",this.fileInputKey++,await Promise.all(r.map((async(t,e)=>{const s=o+e;try{const e=new n({file:t.file,document_type:t.docTypeValue},this.businessId);if(!await this.postDocumentRecordData(e))return void(this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:"error"}):t)));const i=await this.uploadDocument(e);this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:i?"uploaded":"error"}):t))}catch(t){this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:"error"}):t))}})))},this.postDocumentRecordData=async t=>{const e=t.record_data;return new Promise((s=>{this.postDocumentRecord({payload:e,onSuccess:e=>{s(this.handleDocRecordResponse(t,e))},onError:({error:t,code:e,severity:i})=>{this.errorEvent.emit({message:t,errorCode:e,severity:i}),s(!1)}})}))},this.handleDocRecordResponse=(t,e)=>e.error?(this.errorEvent.emit({errorCode:r.POST_ERROR,message:e.error.message,severity:a.ERROR,data:e.error}),!1):(t.setPresignedUrl(e.data.presigned_url),!0),this.uploadDocument=async t=>{if(!t.presigned_url)throw new Error("Presigned URL is not set");const e=await t.getFileData();return!!(await fetch(t.presigned_url,{method:"PUT",body:e})).ok||(this.errorEvent.emit({errorCode:r.POST_ERROR,message:"Failed to upload document",severity:a.ERROR}),!1)}}propChanged(){this.initializeApi()}watchHandler(t){this.formLoading.emit(t)}async validateAndSubmit({onSuccess:t}){const e=this.validate();Object.keys(e).length>0?this.errors=e:(this.errors={},this.stepCompleteEvent.emit({response:null,formStep:st.documentUpload}),t())}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.postDocumentRecord=m({authToken:this.authToken,service:new g})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}get categoryOptions(){return[{label:"Select a category",value:""},...this.categories.map((t=>({label:t.label,value:t.value})))]}get docTypeOptions(){if(!this.selectedCategory)return[{label:"Select a category first",value:""}];const t=this.categories.find((t=>t.value===this.selectedCategory));return(null==t?void 0:t.docTypeOptions)||[{label:"Select a category first",value:""}]}validate(){if(this.allowOptionalFields)return{};const t={},e=t=>this.existingDocuments.some((e=>t.includes(e.document_type))),s=t=>this.uploadQueue.some((e=>e.categoryValue===t&&"uploaded"===e.status));if(s("financial_document")||e(["voided_check","bank_statement"])||(t.financial_document="Please upload a financial document"),this.country===D.CAN){const i=["articles_of_incorporation","business_registration"];s("business_document")||e(i)||(t.business_document="Please upload a business document");const a=this.owners.length,r=this.uploadQueue.filter((t=>"personal_group1"===t.categoryValue&&"uploaded"===t.status)).length,n=this.existingDocuments.filter((t=>qt.has(t.document_type))).length;r+n<a&&(t.personal_group1=`Please upload ${a} Group 1 identity document(s) (${r+n} of ${a} provided)`);const o=this.uploadQueue.filter((t=>"personal_group2"===t.categoryValue&&"uploaded"===t.status)).length,l=this.existingDocuments.filter((t=>Ut.has(t.document_type))).length;o+l<a&&(t.personal_group2=`Please upload ${a} Group 2 identity document(s) (${o+l} of ${a} provided)`)}return t}render(){return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("legend",{class:"mb-0",part:M},"Document Uploads"),s("hr",{class:"mt-2"}),s("business-documents-on-file",{documents:this.existingDocuments,isLoading:this.isLoading})),this.country===D.CAN&&this.owners.length>0&&s("div",{class:"alert alert-info mt-3"},"One document from each group (Group 1 and Group 2) is required for each owner (",this.owners.length," owner(s))."),s("fieldset",{class:"mt-4"},s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Add Document"),s("form-control-tooltip",{helpText:"Upload documents one at a time. Select the category and type, then choose a file. For Canadian businesses, one Group 1 and one Group 2 identity document is required for each owner."})),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-select",{name:"document_category",label:"Document Category",options:this.categoryOptions,defaultValue:this.selectedCategory,inputHandler:this.handleCategoryChange})),s("div",{class:"col-12 col-md-6"},s("form-control-select",{name:"document_type",label:"Document Type",options:this.docTypeOptions,defaultValue:this.selectedDocType,inputHandler:this.handleDocTypeChange,disabled:!this.selectedCategory})),s("div",{class:"col-12"},s("form-control-file",{key:this.fileInputKey,name:"document_file",label:"Upload Document",documentType:this.selectedDocType,onFileSelected:this.handleFileSelected,disabled:!this.selectedDocType,multiple:!1})))),s("document-upload-list",{documents:this.uploadQueue}),Object.keys(this.errors).length>0&&s("div",{class:"alert alert-danger mt-3"},s("ul",{class:"mb-0"},Object.values(this.errors).map((t=>s("li",null,t))))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],isLoading:["watchHandler"]}}},Gt=class{constructor(e){t(this,e),this.documents=[]}renderStatus(t){switch(t){case"uploading":return s("span",{class:"badge bg-info"},"Uploading...");case"uploaded":return s("span",{class:"badge bg-success"},"Uploaded");case"error":return s("span",{class:"badge bg-danger"},"Error")}}render(){return this.documents.length?s("div",{class:"mt-4"},s("div",{class:"card",part:q},s("div",{class:"card-body"},s("h5",{class:"card-title",part:M},"Uploaded Documents"),s("div",{class:"table-responsive"},s("table",{class:"table table-sm table-borderless",part:U},s("thead",null,s("tr",null,s("th",{style:{width:"25%"},part:Z,scope:"col"},"Category"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Document Type"),s("th",{style:{width:"30%"},part:Z,scope:"col"},"File Name"),s("th",{style:{width:"20%"},part:Z,scope:"col"},"Status"))),s("tbody",null,this.documents.map(((t,e)=>s("tr",{class:0===e?"border-bottom border-top":"border-bottom"},s("td",{part:G},t.categoryLabel),s("td",{part:G},t.docTypeLabel),s("td",{part:G},t.fileName),s("td",{part:G},this.renderStatus(t.status))))))))))):null}},Yt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.legal_address={},this.isLoading=!1,this.getData=()=>{this.getBusiness&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{const e=new V((t.data||{}).legal_address||{});this.legal_address=Object.assign(Object.assign({},e),{country:this.country}),this.formController.setInitialValues(Object.assign({},this.legal_address))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.legalAddress}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return{legal_address:new V(this.formController.values.getValue()).payload}}componentWillLoad(){this.initializeApi(),this.formController=new L((0,x[this.country])(this.allowOptionalFields)),this.getData()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t;const e=null===(t=this.formController)||void 0===t?void 0:t.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Legal Address of your Business"),s("form-control-tooltip",{helpText:"No PO Boxes."})),s("hr",{class:"mt-2"}),s("form-address-fields",{country:this.country,errors:this.errors,defaultValues:e,inputHandler:this.inputHandler})))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},$t=class{loadingWatcher(){this.formLoading.emit(this.isLoading)}constructor(s){t(this,s),this.clickEvent=e(this,"click-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.ownerSubmitted=e(this,"ownerSubmitted",7),this.isLoading=!1,this.errors={},this.owner={},this.getData=()=>{this.getOwner&&(this.isLoading=!0,this.getOwner({onSuccess:t=>{this.instantiateOwner(t.data)},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>this.isLoading=!1}))},this.sendData=()=>(this.isLoading=!0,new Promise((t=>{this.ownerId?this.patchOwner({payload:this.payload,onSuccess:e=>{this.ownerSubmitted.emit({id:e.data.id}),this.instantiateOwner(e.data),t(!0)},onError:({error:e,code:s,severity:i})=>{this.errorEvent.emit({message:e,errorCode:s,severity:i}),t(!1)},final:()=>this.isLoading=!1}):this.postOwner({payload:this.payload,onSuccess:e=>{this.ownerSubmitted.emit({id:e.data.id}),this.instantiateOwner(e.data),t(!0)},onError:({error:e,code:s,severity:i})=>{this.errorEvent.emit({message:e,errorCode:s,severity:i}),t(!1)},final:()=>this.isLoading=!1})}))),this.instantiateOwner=async t=>{this.owner=Object.assign({},new P(t)),await this.formController.setInitialValues(this.owner)},this.handleAddOwner=()=>{this.clickEvent.emit({name:this.ownerId?it.updateOwner:it.addOwner})},this.handleRemoveOwner=()=>{this.removeOwner(this.ownerId),this.clickEvent.emit({name:it.removeOwner})},this.validate=this.validate.bind(this),this.submit=this.submit.bind(this),this.validateAndSubmit=this.validateAndSubmit.bind(this)}async returnOwnerData(){return this.ownerId}async getOwnershipPercentage(){var t;return(null===(t=this.formController.values.getValue())||void 0===t?void 0:t.ownership_percentage)||null}async setOwnershipPercentageError(t){this.formController.setFieldError("ownership_percentage",t)}async validate(){return this.formController.validate()}async submit(){if(await this.validate())return this.sendData()}async validateAndSubmit(t){t.preventDefault(),await this.validate()&&this.submit()}get payload(){const t=new P(this.formController.values.getValue()).payload;return this.ownerId?t:Object.assign(Object.assign({},t),{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 L((0,C[this.country])("owner",this.allowOptionalFields)),this.initializeApi(),this.ownerId&&this.getOwner?this.getData():this.instantiateOwner({})}componentDidLoad(){this.formController.errors.subscribe((t=>this.errors=Object.assign({},t)))}initializeApi(){this.authToken&&(this.getOwner=b({authToken:this.authToken,identityId:this.ownerId,service:new k}),this.patchOwner=p({authToken:this.authToken,identityId:this.ownerId,service:new k}),this.postOwner=f({authToken:this.authToken,service:new k}))}render(){return s(i,{key:"b168e9f5a52416984e6a04ab5f0771b63ee28b2e",style:{display:"block"}},s("form",{key:"d22a6aae3f5debd30d87b3bd37c67390a46c4590",onSubmit:this.validateAndSubmit},s("fieldset",{key:"30597bc1f4983bddbdc0ed45e6be7e715d0b9b8e"},s("legend",{key:"055ca2b6bbfa4e86591411668eaead3bd0d95ea8",class:"fw-semibold fs-5 w-100",part:$},this.formTitle),s("br",{key:"f0d2d9624611ee888ff318ec1525281bf007e346"}),s("div",{key:"2c38a166f681404c2ab303630217e54c15f1e5f2",class:"row gy-3"},s("owner-form-inputs",{key:"05253624d3d79f0ba7a4ec49b387e252e796e5b6",ownerDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController,country:this.country}),s("div",{key:"8e0e67966f047c3f9a4b30f28983f67db2372c0c",class:"d-flex gap-2 justify-content-start"},s(ut,{key:"e33368a968efe5faf52a08e36bb2bef215625c4a",variant:"secondary",type:"button",onClick:this.handleRemoveOwner,hidden:!this.showRemoveButton},"Remove"),s(ut,{key:"7bb79b0624dfb3a8645182432c484f288cc73692",variant:"primary",type:"submit",onClick:this.handleAddOwner,disabled:this.isLoading},this.submitButtonText))),s("hr",{key:"ef4f86dd1b1878e92c98e4a826f9fbad808e15b7"}))))}static get watchers(){return{isLoading:["loadingWatcher"]}}},Kt=class{constructor(s){t(this,s),this.plaidVerificationSuccess=e(this,"plaidVerificationSuccess",7),this.plaidVerificationError=e(this,"plaidVerificationError",7),this.linkToken=null,this.linkTokenId=null,this.plaidLink=null,this.isAuthenticating=!1,this.isSuccess=!1,this.error=null,this.isLoading=!1,this.plaidService=new Tt,this.abortController=null,this.timeoutId=null,this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:h.PLAID_SDK_LOAD_FAILED,message:l[h.PLAID_SDK_LOAD_FAILED],severity:o[h.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:h.PLAID_LINK_TOKEN_FAILED,message:l[h.PLAID_LINK_TOKEN_FAILED],severity:o[h.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:h.PLAID_LINK_INIT_FAILED,message:l[h.PLAID_LINK_INIT_FAILED],severity:o[h.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,s,i;try{if(!this.authToken||!this.accountId)return void this.handleError({code:h.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please provide authToken and accountId.",severity:a.ERROR,retryable:!1,userAction:"Provide required props"});this.abortController=new AbortController,this.timeoutId=setTimeout((()=>{var t;null===(t=this.abortController)||void 0===t||t.abort()}),3e4);const t=await this.plaidService.getLinkTokenForVerification(this.authToken,this.businessId,this.abortController.signal);if(this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),t.error)throw new Error("string"==typeof t.error?t.error:t.error.message||"Failed to get link token");this.linkToken=t.data.link_token,this.linkTokenId=t.data.id}catch(a){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let r=h.PLAID_LINK_TOKEN_FAILED,n=l[r],c=!0;"AbortError"===a.name?(r=h.PLAID_TIMEOUT,n=l[r],c=!0):(null===(t=a.message)||void 0===t?void 0:t.includes("network"))||(null===(e=a.message)||void 0===e?void 0:e.includes("fetch"))?(r=h.PLAID_NETWORK_ERROR,n=l[r],c=!0):((null===(s=a.message)||void 0===s?void 0:s.includes("401"))||(null===(i=a.message)||void 0===i?void 0:i.includes("unauthorized")))&&(r=h.PLAID_INVALID_CREDENTIALS,n="Authentication failed. Please check your credentials.",c=!1),this.handleError({code:r,message:n,severity:o[r],originalError:a,retryable:c,userAction:c?"Click to try again":"Check your credentials"})}},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=async t=>{var e;this.isAuthenticating=!1,this.isLoading=!0,this.clearError();try{const s=await this.plaidService.postPlaidVerifiedBankAccountData(this.authToken,this.businessId,{public_token:t,link_token_id:this.linkTokenId},null===(e=this.abortController)||void 0===e?void 0:e.signal);if(s.error)throw new Error("string"==typeof s.error?s.error:s.error.message||"Failed to verify bank account");this.isSuccess=!0,this.isLoading=!1,this.plaidVerificationSuccess.emit({publicToken:t,bankAccount:s.data})}catch(t){this.isLoading=!1,this.handleError({code:h.PLAID_AUTHENTICATION_FAILED,message:(null==t?void 0:t.message)||"Failed to verify bank account",severity:o[h.PLAID_AUTHENTICATION_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.handlePlaidExit=t=>{this.isAuthenticating=!1,t&&this.handlePlaidError(t)},this.handlePlaidEvent=(t,e)=>{switch(t){case"OPEN":this.isAuthenticating=!0;break;case"CLOSE":this.isAuthenticating=!1;break;case"ERROR":this.handlePlaidError(e)}},this.handlePlaidLoad=()=>{},this.handlePlaidError=t=>{let e=h.PLAID_AUTHENTICATION_FAILED,s=l[e],i=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=h.PLAID_INVALID_CREDENTIALS,s=l[e],i=!0;break;case"ITEM_LOGIN_REQUIRED":e=h.PLAID_INVALID_CREDENTIALS,s="Your bank requires re-authentication. Please try again.",i=!0;break;case"ITEM_LOCKED":e=h.PLAID_ACCOUNT_LOCKED,s=l[e],i=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=h.PLAID_MAINTENANCE,s=l[e],i=!0;break;case"RATE_LIMIT_EXCEEDED":e=h.PLAID_RATE_LIMITED,s=l[e],i=!0;break;default:t.error_message&&(s=t.error_message)}this.handleError({code:e,message:s,severity:o[e],originalError:t,retryable:i,userAction:a}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.isLoading=!1,this.plaidVerificationError.emit(t),console.error("Plaid verification error:",t)},this.clearError=()=>{this.error&&(this.error=null)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.initializePlaidLink()},this.scriptRef.onerror=()=>{this.handleError({code:h.PLAID_SDK_LOAD_FAILED,message:l[h.PLAID_SDK_LOAD_FAILED],severity:o[h.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})})}disconnectedCallback(){this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){const t=s("svg",{class:"plaid-logo-img",height:"20",width:"20",viewBox:"0 0 28 29",xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",marginLeft:"5px",marginRight:"5px",marginTop:"-2px"}},s("g",{fill:"#fff","fill-rule":"evenodd"},s("path",{d:"M25.7629 26.2628L28 17.5309L24.9691 14.5001L27.9999 11.4691L25.7628 2.73706L17.0309 0.5L14.0001 3.531L10.969 0.50014L2.23706 2.73734L0 11.4691L3.03128 14.4999L0.00014 17.531L2.2372 26.2629L10.9691 28.5L14.0001 25.469L17.031 28.4999L25.7629 26.2628ZM15.7321 23.7371L18.6186 20.8505L22.2912 24.5233L17.6956 25.7007L15.7321 23.7371ZM11.1136 9.88154L14.0003 6.99502L16.8868 9.8814L14.0001 12.7679L11.1136 9.88154ZM12.2682 14.5L9.38154 17.3865L6.49502 14.5L9.38154 11.6135L12.2682 14.5ZM18.6187 11.6133L21.5053 14.5L18.6186 17.3865L15.7321 14.5L18.6187 11.6133ZM16.8867 19.1186L14.0001 22.0051L11.1135 19.1185L14.0001 16.2319L16.8867 19.1186ZM10.3044 25.7007L5.70864 24.5233L9.38154 20.8504L12.2682 23.7371L10.3044 25.7007ZM4.76308 16.2319L7.6496 19.1185L3.9767 22.7914L2.7993 18.1957L4.76308 16.2319ZM3.9767 6.20836L7.64974 9.8814L4.76308 12.7681L2.7993 10.8041L3.9767 6.20836ZM12.2683 5.26294L9.38168 8.1496L5.70892 4.4767L10.3047 3.2993L12.2683 5.26294ZM17.6959 3.2993L22.2915 4.4767L18.6186 8.14946L15.7321 5.26294L17.6959 3.2993ZM23.2372 12.7681L20.3505 9.8814L24.0233 6.20878L25.2007 10.8046L23.2372 12.7681ZM24.0233 22.7914L20.3505 19.1186L23.2372 16.2321L25.2007 18.1957L24.0233 22.7914Z"})));return s(_t,null,s("script",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",async:!0,ref:t=>this.scriptRef=t}),s("div",null,s("div",{class:"mb-3"},s(ut,{variant:"primary",type:"button",onClick:t=>{t.preventDefault(),this.openPlaidLink()},disabled:this.isLoading,part:K},"Connect with Plaid ",t," (instant verification)")),(()=>this.error?s("div",{class:(this.error.severity===a.ERROR?"text-danger":this.error.severity===a.WARNING?"text-warning":"text-info")+" mt-2"},s("small",null,this.error.message),s("br",null),this.error.userAction&&s("small",{class:"text-muted"},this.error.userAction)):null)(),(()=>this.error?null:this.isLoading?s("div",{class:"text-info mt-2"},s("small",null,"Verifying bank account...")):this.isSuccess?s("div",{class:"text-success mt-2"},s("small",null,"✓ Bank account verified successfully")):this.isAuthenticating?s("div",{class:"text-info mt-2"},s("small",null,"Connecting to your bank...")):null)()))}};export{xt as additional_questions_form_step,Lt as bank_account_form_inputs,Ot as bank_account_form_inputs_canada,At as business_bank_account_form_step,Dt as business_core_info_form_step,Et as business_documents_on_file,It as business_owners_form_step,Vt as business_representative_form_inputs,Pt as business_representative_form_step,Ht as business_terms_conditions_form_step,Zt as document_upload_form_step,Gt as document_upload_list,Yt as legal_address_form_step,$t as owner_form,Kt as plaid_verification}
1
+ import{r as t,c as e,h as s,H as i}from"./p-CV0Pyo1O.js";import{C as a,b as r,B as n,x as o,y as l,z as h}from"./p-DXTa04jn.js";import{m as c,a as d,c as u,d as m,e as b,f as p,g as f}from"./p-Da3fPDxu.js";import{B as v,a as y,D as g,I as k}from"./p-R_0S69Pr.js";import{a as w,d as _,b as T,g as C,h as x}from"./p-DK_bjvk1.js";import{F as L,c as O,a as S,b as j}from"./p-D9sqTVmd.js";import{A,C as D,e as E,R as I,f as V,O as P}from"./p-BcNb9bVO.js";import{C as H,P as N,I as B}from"./p-CVaOFfrI.js";import{b as M,a0 as R,C as F,x as W,u as q,D as z,aa as U,a6 as Z,aj as G,am as Y,A as $,a1 as K}from"./p-CPKMvyV_.js";import{P as X}from"./p-DSclFZ32.js";import{a as J,c as Q,d as tt,b as et}from"./p-BBSnDYJw.js";import{a as st,B as it}from"./p-XYgDHrVL.js";import{n as at}from"./p-BnjCmwMr.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import{B as rt,C as nt,v as ot,D as lt,E as ht,F as ct,G as dt}from"./p-BxpXvXn-.js";import{B as ut}from"./p-CHo7TfsM.js";import"./p-CZfYo5-1.js";import{c as mt}from"./p-DPA5TKvQ.js";import{s as bt,b as pt,d as ft}from"./p-BSs-2JKu.js";import{S as vt}from"./p-uZ5KAseb.js";import{u as yt,a as gt,b as kt}from"./p-C6o0liMT.js";import{A as wt}from"./p-De4Pig-y.js";import{S as _t}from"./p-DzEdYT8R.js";import{P as Tt}from"./p-DP9ysr2K.js";import"./p-CdwzNfP1.js";import"./p-BFTU3MAI.js";import"./p-D8GTwl9v.js";class Ct{constructor(t){this.id=t.id,this.account_owner_name=t.account_owner_name,this.full_name=t.full_name,this.account_type=t.account_type,this.account_number=t.account_number,this.acct_last_four=t.acct_last_four,this.account_number_last4=t.account_number_last4,this.routing_number=t.routing_number,this.institution_number=t.institution_number,this.transit_number=t.transit_number,this.bank_name=t.bank_name,this.country=t.country,this.currency=t.currency,this.nickname=t.nickname,this.metadata=t.metadata,this.business_id=t.business_id,this.platform_account_id=t.platform_account_id,this.created_at=t.created_at,this.updated_at=t.updated_at}get payload(){return{account_owner_name:this.account_owner_name||"",account_type:this.account_type||"",account_number:this.account_number||"",routing_number:this.routing_number||"",institution_number:this.institution_number||"",transit_number:this.transit_number||"",bank_name:this.bank_name||"",nickname:this.nickname||"",business_id:this.business_id||""}}}const xt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.additional_questions={},this.recurringPayments=!1,this.isLoading=!1,this.getData=()=>{this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.additional_questions=new A(t.data.additional_questions||{}),this.formController.setInitialValues(Object.assign({},this.additional_questions))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}})},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.additionalQuestions}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e})),this.additional_questions=new A(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}recurringPaymentsWatcher(t){this.recurringPayments="Yes"===(null==t?void 0:t.business_recurring_payments)}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return{additional_questions:new A(this.formController.values.getValue()).payload}}componentWillLoad(){this.initializeApi(),this.formController=new L(w(this.allowOptionalFields))}componentDidLoad(){this.getBusiness&&this.getData(),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t,e,i,a,r;const n=this.formController.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Additional Questions"),s("form-control-tooltip",{helpText:"This information helps us understand the business and identify and monitor trends to safeguard you and your customers."})),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-monetary-provisioning",{name:"business_revenue",label:"What is your business' estimated annual revenue from its primary business activities?",inputHandler:this.inputHandler,errorText:null===(t=this.errors)||void 0===t?void 0:t.business_revenue,defaultValue:null==n?void 0:n.business_revenue,maskOptions:H.WHOLE})),s("div",{class:"col-12 col-md-6"},s("form-control-monetary-provisioning",{name:"business_payment_volume",label:"What is your business' annual credit card & ACH volume anticipated to process?",inputHandler:this.inputHandler,errorText:null===(e=this.errors)||void 0===e?void 0:e.business_payment_volume,defaultValue:null==n?void 0:n.business_payment_volume,maskOptions:H.WHOLE})),s("div",{class:"col-12"},s("form-control-number",{name:"business_average_transaction_amount",label:"What is your average transaction size?",inputHandler:this.inputHandler,errorText:null===(i=this.errors)||void 0===i?void 0:i.business_average_transaction_amount,defaultValue:null==n?void 0:n.business_average_transaction_amount})),s("div",{class:"col-12"},s("form-control-select",{name:"business_when_service_received",label:"On average, how long after paying will your customers typically receive their goods or services?",inputHandler:this.inputHandler,errorText:null===(a=this.errors)||void 0===a?void 0:a.business_when_service_received,options:J,defaultValue:null==n?void 0:n.business_when_service_received})),s("div",{class:"col-12"},s("form-control-text",{name:"business_other_payment_details",label:"Is there anything else you would like us to know about how your customers pay the business? (optional)",inputHandler:this.inputHandler,errorText:null===(r=this.errors)||void 0===r?void 0:r.business_other_payment_details,defaultValue:null==n?void 0:n.business_other_payment_details})))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],additional_questions:["recurringPaymentsWatcher"]}}},Lt=class{constructor(e){t(this,e)}render(){var t,e,i,a,r,n;return s("div",{key:"d3445ce89732e19baea2e8f224c42011d5a03998",class:"row gy-3"},s("div",{key:"966e1d8ba6043b4f9b57ae0061ae94c177c12b48",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Bank Name",value:null===(t=this.defaultValue)||void 0===t?void 0:t.bank_name}):s("form-control-text",{name:"bank_name",label:"Bank Name",defaultValue:this.defaultValue.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler})),s("div",{key:"314a4f7e181b978b2ff1fdbfdfc8d9484089829a",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Nickname",value:null===(e=this.defaultValue)||void 0===e?void 0:e.nickname}):s("form-control-text",{name:"nickname",label:"Nickname",defaultValue:this.defaultValue.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler})),s("div",{key:"45ac55707ce44b208adaf72e944ea3056810183a",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Owner Name",value:null===(i=this.defaultValue)||void 0===i?void 0:i.account_owner_name}):s("form-control-text",{name:"account_owner_name",label:"Account Owner Name",defaultValue:this.defaultValue.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler})),s("div",{key:"74ce58b36eb3a425d900d7bb0858bda18b2e341c",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Type",value:null===(a=this.defaultValue)||void 0===a?void 0:a.account_type}):s("form-control-select",{name:"account_type",label:"Account Type",options:Q,defaultValue:this.defaultValue.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler})),s("div",{key:"2562105aaaae00d9c46eb61d931a43927d96a8ce",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Number",value:(null===(r=this.defaultValue)||void 0===r?void 0:r.account_number_last4)?`**** ${this.defaultValue.account_number_last4}`:""}):s("form-control-text",{name:"account_number",label:"Account Number",defaultValue:this.defaultValue.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"Please copy the account number as shown on your statement/check. Do not include spaces or dashes."})),s("div",{key:"4c7e6cba0ee1e2567dc5b608559b13ebd3fddd07",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Routing Number",value:(null===(n=this.defaultValue)||void 0===n?void 0:n.routing_number)||""}):s("form-control-text",{name:"routing_number",label:"Routing Number",defaultValue:this.defaultValue.routing_number,maxLength:9,errorText:this.errors.routing_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"A valid routing number is nine digits. Please include any leading or trailing zeroes."})))}},Ot=class{constructor(e){t(this,e)}render(){var t,e,i,a,r,n,o;return s("div",{key:"8de8f05777f72ecb1112328544e75be7cd929e8d",class:"row gy-3"},s("div",{key:"513fb78b434ba3aebe51b636f7494b54e437c65f",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Bank Name",value:null===(t=this.defaultValue)||void 0===t?void 0:t.bank_name}):s("form-control-text",{name:"bank_name",label:"Bank Name",defaultValue:this.defaultValue.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler})),s("div",{key:"37a1ef4ac58fbe1633a93020e786d546cd832867",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Nickname",value:null===(e=this.defaultValue)||void 0===e?void 0:e.nickname}):s("form-control-text",{name:"nickname",label:"Nickname",defaultValue:this.defaultValue.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler})),s("div",{key:"fc8820e264d14ac3c5a1c6fd171b381c2b6d99e1",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Owner Name",value:null===(i=this.defaultValue)||void 0===i?void 0:i.account_owner_name}):s("form-control-text",{name:"account_owner_name",label:"Account Owner Name",defaultValue:this.defaultValue.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler})),s("div",{key:"f183b1c5f6a8b0f905c916cd1715448f3e02d26f",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Type",value:null===(a=this.defaultValue)||void 0===a?void 0:a.account_type}):s("form-control-select",{name:"account_type",label:"Account Type",options:Q,defaultValue:this.defaultValue.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler})),s("div",{key:"8366ebde2f319f6d910a34917f57ad43b3ee234f",class:"col-3"},this.formDisabled?s("bank-account-read-only-value",{label:"Transit Number",value:(null===(r=this.defaultValue)||void 0===r?void 0:r.transit_number)||""}):s("form-control-text",{name:"transit_number",label:"Transit Number",defaultValue:this.defaultValue.transit_number,maxLength:5,errorText:this.errors.transit_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"5 digits"})),s("div",{key:"c91166337c2984048466014634f5d4e59ce2b40a",class:"col-3"},this.formDisabled?s("bank-account-read-only-value",{label:"Institution Number",value:(null===(n=this.defaultValue)||void 0===n?void 0:n.institution_number)||""}):s("form-control-text",{name:"institution_number",label:"Institution Number",defaultValue:this.defaultValue.institution_number,maxLength:3,errorText:this.errors.institution_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"3 digits"})),s("div",{key:"ebce2f50ec265ed2fef7a0b3dae84d33036ad145",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Number",value:(null===(o=this.defaultValue)||void 0===o?void 0:o.account_number_last4)?`**** ${this.defaultValue.account_number_last4}`:""}):s("form-control-text",{name:"account_number",label:"Account Number",defaultValue:this.defaultValue.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"Please copy the account number as shown on your statement. Do not include spaces or dashes."})))}},St=t=>t?{bank_name:ht.nullable(),nickname:lt.nullable(),account_owner_name:ot.nullable(),account_type:nt.nullable(),account_number:rt.nullable()}:{bank_name:ht.required("Enter bank name"),nickname:lt.required("Enter nickname"),account_owner_name:ot.required("Enter account owner name"),account_type:nt.required("Select account type"),account_number:rt.required("Enter account number")},jt={[D.USA]:t=>(t=>{const e=Object.assign(Object.assign({},St(t)),(t=>t?{routing_number:dt.nullable()}:{routing_number:dt.required("Enter routing number")})(t));return O().shape(e)})(t),[D.CAN]:t=>(t=>{const e=Object.assign(Object.assign({},St(t)),(t=>{const e=S().length(3,"Institution number must be 3 digits").matches(ct,"Enter valid institution number"),s=S().length(5,"Transit number must be 5 digits").matches(ct,"Enter valid transit number");return t?{institution_number:e.nullable(),transit_number:s.nullable()}:{institution_number:e.required("Enter institution number"),transit_number:s.required("Enter transit number")}})(t));return O().shape(e)})(t)},At=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.bankAccount={},this.isLoading=!1,this.viewMode="manual",this.bankAccountVerification=!1,this.platformAccountId=null,this.getSchema=()=>(0,jt[this.country])(this.allowOptionalFields),this.initializeFormController=()=>{this.formController=new L(this.getSchema()),this.formController.setInitialValues("readonly"===this.viewMode?Object.assign({},this.bankAccount):{business_id:this.businessId}),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))},this.getData=()=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.processBusinessResponse(t.data),this.determineViewMode()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.initializeFormController(),this.isLoading=!1}})},this.handleChangeBankAccount=()=>{this.viewMode=this.plaidAvailable?"plaid":"manual",this.initializeFormController()},this.handleCancel=()=>{this.viewMode=this.existingBankAccount?"readonly":"plaid",this.initializeFormController()},this.handleToggleToManualEntry=()=>{this.viewMode="manual"},this.handleToggleToPlaidVerification=()=>{this.viewMode="plaid"},this.handleSaveBankAccount=async()=>{this.formController.validateAndSubmit((()=>{this.sendData((()=>{}))}))}}propChanged(){this.initializeApi()}watchHandler(t){this.formLoading.emit(t)}async validateAndSubmit({onSuccess:t}){"readonly"===this.viewMode?this.sendData(t):this.formController.validateAndSubmit((()=>this.sendData(t)))}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData(),this.formController=new L(this.getSchema())}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.postBankAccount=u({authToken:this.authToken,service:new y})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}get postPayload(){const t=this.formController.values.getValue();return new Ct(t).payload}get existingBankAccount(){var t;return!!(null===(t=this.bankAccount)||void 0===t?void 0:t.id)}get plaidAvailable(){return this.bankAccountVerification&&!!this.platformAccountId}get showCancel(){return this.bankAccountVerification||this.existingBankAccount}processBusinessResponse(t){const{bank_accounts:e,settings:s,platform_account_id:i}=t;e.length>0?this.bankAccount=new Ct(e[e.length-1]):(this.bankAccount=new Ct({}),this.bankAccount.business_id=this.businessId),this.bankAccountVerification=!0===s.bank_account_verification,this.platformAccountId=i}determineViewMode(){this.viewMode=this.existingBankAccount?"readonly":this.plaidAvailable?"plaid":"manual"}async sendData(t){try{if("manual"===this.viewMode){if(!await this.postBankAccountData())return;this.viewMode="readonly",await this.refreshBankAccountData()}t()}catch(t){this.errorEvent.emit({message:t,errorCode:r.POST_ERROR,severity:a.ERROR})}}async postBankAccountData(){let t;return this.isLoading=!0,new Promise((e=>{let s=!1;this.postBankAccount({payload:this.postPayload,onSuccess:e=>{t=e,s=!0},onError:({error:t,code:e,severity:i})=>{s=!1,this.errorEvent.emit({message:t,errorCode:e,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:t,formStep:st.bankAccount}),this.isLoading=!1,e(s)}})}))}async refreshBankAccountData(){return new Promise((t=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.processBusinessResponse(t.data),this.determineViewMode(),this.initializeFormController()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.isLoading=!1,t()}})}))}renderBankAccountInputs(t){const e=this.formController.getInitialValues();return s(this.country===D.CAN?"bank-account-form-inputs-canada":"bank-account-form-inputs",{defaultValue:e,errors:this.errors,inputHandler:this.inputHandler,formDisabled:t})}renderReadonlyView(){return s("div",null,this.renderBankAccountInputs(!0),s("div",{class:"mt-3"},s(ut,{variant:"secondary",type:"button",onClick:this.handleChangeBankAccount,disabled:this.isLoading,part:R},"Change Bank Account")))}renderPlaidView(){return s("div",{class:"mt-3"},s("plaid-verification",{authToken:this.authToken,accountId:this.platformAccountId,businessId:this.businessId,onPlaidVerificationSuccess:()=>{this.viewMode="readonly",this.refreshBankAccountData()}}),s("div",{class:"mt-3"},s(ut,{type:"button",variant:"link",className:"p-0",onClick:this.handleToggleToManualEntry,disabled:this.isLoading,part:F},"Enter bank details manually (document upload required)")))}renderManualEntryView(){return s("div",null,this.plaidAvailable&&s("div",{class:"mb-3"},s(ut,{type:"button",variant:"secondary",onClick:this.handleToggleToPlaidVerification,disabled:this.isLoading,part:R},"Link bank account with Plaid instead")),this.renderBankAccountInputs(!1),s("div",{class:"mt-3 d-flex gap-2"},this.showCancel&&s(ut,{variant:"secondary",type:"button",onClick:this.handleCancel,disabled:this.isLoading,part:R},"Cancel"),s(ut,{variant:"primary",type:"button",onClick:this.handleSaveBankAccount,disabled:this.isLoading,isLoading:this.isLoading},"Save Bank Account")))}render(){return this.isLoading?s(X,null):s("form",null,s("fieldset",{class:"mb-4"},s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Bank Account Info"),s("form-control-tooltip",{helpText:"This direct deposit account is the designated bank account where incoming 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."})),s("hr",{class:"mt-2"}),"readonly"===this.viewMode&&this.renderReadonlyView(),"plaid"===this.viewMode&&this.renderPlaidView(),"manual"===this.viewMode&&this.renderManualEntryView()))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],isLoading:["watchHandler"]}}},Dt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.coreInfo={},this.isLoading=!1,this.isEditingTaxId=!1,this.getData=()=>{this.getBusiness&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.coreInfo=new E(t.data),this.formController.setInitialValues(Object.assign({},this.coreInfo))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t(),this.isEditingTaxId=!1},onError:({error:t,code:s,severity:i,rawError:a})=>{e=t,a&&"object"==typeof a&&a.param&&this.formController.setFieldError(a.param,a.message),this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.businessInfo}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.errors[t]&&this.formController.clearFieldError(t),this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return new E(this.formController.values.getValue()).payload}componentWillLoad(){this.initializeApi();const t=this.country===D.CAN?_(this.allowOptionalFields):T(this.allowOptionalFields);this.formController=new L(t),this.getData()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t,e;const i=this.formController.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Business Information")),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"legal_name",label:"Business Name",defaultValue:i.legal_name,errorText:this.errors.legal_name,inputHandler:this.inputHandler,helpText:"Enter this exactly as it appears on your tax records (don't use acronyms or abbreviations unless you registered that way)."})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"doing_business_as",label:"Doing Business As (DBA)",defaultValue:i.doing_business_as,errorText:this.errors.doing_business_as,inputHandler:this.inputHandler,helpText:"Enter this exactly as it appears on your tax records (leave blank if you don't have a registered DBA/trade name)"})),s("div",{class:"col-12 col-md-8"},s("form-control-select",{name:"classification",label:"Business Classification",options:tt,defaultValue:i.classification,errorText:this.errors.classification,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-4"},s("form-control-date",{name:"date_of_incorporation",label:"Date of Registration",defaultValue:i.date_of_incorporation,errorText:this.errors.date_of_incorporation,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"industry",label:"Industry",defaultValue:i.industry,errorText:this.errors.industry,inputHandler:this.inputHandler,helpText:"Describe what you sell"})),s("div",{class:"col-12 col-md-6"},!(null===(t=this.coreInfo)||void 0===t?void 0:t.tax_id_last4)||this.isEditingTaxId?s("form-control-number-masked",{name:"tax_id",label:mt[this.country].taxIdLabelOptional||mt[this.country].taxIdLabel,defaultValue:this.isEditingTaxId?"":i.tax_id,errorText:this.errors.tax_id,inputHandler:this.inputHandler,mask:"000000000",helpText:mt[this.country].taxIdHelpText}):s("div",null,s("label",{class:"form-label",part:W},mt[this.country].taxIdLabel),s("div",{class:"input-group mb-3"},s("input",{type:"text",class:"form-control",part:q,value:`****${null===(e=this.coreInfo)||void 0===e?void 0:e.tax_id_last4}`,disabled:!0}),s("button",{class:"btn btn-secondary",type:"button",part:R,onClick:()=>{this.isEditingTaxId=!0,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{tax_id:"",tax_id_last4:null}))}},"Change")))),s("div",{class:"col-12"},s("form-control-text",{name:"website_url",label:"Business Website URL",defaultValue:i.website_url,errorText:this.errors.website_url,inputHandler:this.inputHandler,helpText:"Don't have a live website? You can use your social media business page, app store link, or staging site URL."})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"email",label:"Business Email Address",defaultValue:i.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-6"},s("form-control-number-masked",{name:"phone",label:"Business Phone Number",defaultValue:i.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:N.US})))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Et=class{constructor(e){t(this,e),this.documents=[],this.isLoading=!1}render(){return this.isLoading?s(vt,{height:"50px"}):this.documents.length?s(i,null,s("div",{class:"card",part:z},s("div",{class:"card-body"},s("h5",{class:"card-title",part:M},"Documents Already on File"),s("div",{class:"table-responsive"},s("table",{class:"table table-sm table-borderless",part:U},s("thead",null,s("tr",null,s("th",{style:{width:"25%"},part:Z,scope:"col"},"File Name"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"File Type"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Document Type"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Date Uploaded"))),s("tbody",null,this.documents.sort(((t,e)=>t.document_type.localeCompare(e.document_type))).map(((t,e)=>s("tr",{class:0===e?"border-bottom border-top":"border-bottom"},s("td",{part:G},t.file_name),s("td",{part:G},t.file_type),s("td",{part:G},bt(t.document_type)),s("td",{part:G},`${pt(t.created_at)} - ${ft(t.created_at)}`))))))))),s("hr",null)):null}},It=class{constructor(s){t(this,s),this.clickEvent=e(this,"click-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.ownersPayload=[],this.refs=[],this.isLoading=!1,this.representativeIsOwner=null,this.matchRef=(t,e)=>{if(null===t)return;const s=this.ownersPayload.findIndex((t=>t.id===e));-1!==s&&(this.refs.length!==this.ownersPayload.length&&this.manageRefs(),this.refs[s]=t)},this.getData=()=>{this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.representative=new I(t.data.representative||{}),t.data.owners.length?this.ownersPayload=t.data.owners.map((t=>({id:t.id}))):this.addOwnerForm()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1,this.manageRefs()}})},this.sendData=async t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:{owners:this.ownersPayload},onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.owners}),this.formLoading.emit(!1)}})},this.addOwnerForm=t=>{this.newFormOpen=!0,this.ownersPayload=[...this.ownersPayload,{id:""}],t&&this.clickEvent.emit({name:it.addOwnerForm})},this.removeOwnerForm=t=>{this.ownersPayload=this.ownersPayload.filter((e=>e.id!==t)),this.newFormOpen&&(this.newFormOpen=!1)},this.handleRepresentativeIsOwnerChange=t=>{this.representativeIsOwner=t,this.representativeIsOwner&&(this.formLoading.emit(!0),this.isLoading=!0,this.ownersPayload=this.ownersPayload.filter((t=>""!==t.id)),this.patchBusiness({payload:{representative:{is_owner:!0},owners:[{id:this.representative.id},...this.ownersPayload]},onSuccess:()=>{this.getData(),this.newFormOpen=!1},finally:()=>{this.isLoading=!1,this.formLoading.emit(!1)}}))}}propChanged(){this.initializeApi()}get showAddOwnerButton(){return this.ownersPayload.length<4&&!this.newFormOpen}manageRefs(){this.refs=this.ownersPayload.map((t=>t.id))}async validateAndSubmit({onSuccess:t}){const e=this.refs.map((t=>t.validate()));if(!(await Promise.all(e)).every((t=>t)))return;if(!this.allowOptionalFields&&100!==(await Promise.all(this.refs.map((t=>t.getOwnershipPercentage())))).reduce(((t,e)=>t+(parseFloat(e)||0)),0))return void await Promise.all(this.refs.map((t=>t.setOwnershipPercentageError("Ownership percentages must total 100%"))));const s=this.refs.map((t=>t.submit()));(await Promise.all(s)).every((t=>t))&&this.sendData(t)}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}ownersWatcher(){this.manageRefs()}handleOwnerSubmit(t){const e=t.detail,s=this.ownersPayload.map((t=>t.id===e.id?e:t));s.includes(e)||(s[this.ownersPayload.findIndex((t=>!t.id))]=e,this.newFormOpen&&(this.newFormOpen=!1)),this.ownersPayload=s}render(){if(this.isLoading)return s(i,null,s(X,null));const t=this.ownersPayload.some((t=>t.id===this.representative.id)),e=null===this.representativeIsOwner&&!t;return s(i,null,s("div",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Owners"),s("form-control-tooltip",{helpText:"For partnerships, LLCs or privately held corporations, the business is required to apply with all individuals with 25% or more ownership to the application. For charities and registered non-profits, the business is required to apply with 1 individual with substantial control over the entity, such as a board member or director."})),s("hr",{class:"mt-2"}),e&&s("div",{class:"alert alert-warning mb-3",part:Y},s("div",{class:"card-body"},s("div",{class:"d-flex align-items-center mb-3"},s("strong",null,"Is the representative of this business also an owner?")),s("div",{class:"d-flex gap-2"},s(ut,{variant:"primary",onClick:()=>this.handleRepresentativeIsOwnerChange(!0)},"Yes"),s(ut,{variant:"secondary",onClick:()=>this.handleRepresentativeIsOwnerChange(!1)},"No")))),s("div",{class:"row gy-3"},this.ownersPayload.map((t=>s("owner-form",{key:t.id,authToken:this.authToken,businessId:this.businessId,ownerId:t.id,removeOwner:this.removeOwnerForm,newFormOpen:this.newFormOpen,ownersLength:this.ownersPayload.length,country:this.country,allowOptionalFields:this.allowOptionalFields,ref:e=>this.matchRef(e,t.id)})))),s("div",{class:"d-flex justify-content-start"},s("div",{class:"gap-2"},s(ut,{variant:"primary",onClick:()=>this.addOwnerForm(!0),hidden:!this.showAddOwnerButton},"Add Owner")))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],ownersPayload:["ownersWatcher"]}}},Vt=class{constructor(e){t(this,e),this.isEditingIdentification=!1,this.inputHandler=(t,e)=>{yt(this.formController,{[t]:e})},this.onAddressFormUpdate=t=>{gt(this.formController,Object.assign(Object.assign({},this.formController.values.getValue().address),t))}}render(){var t,e,i,a,r,n,o,l,h;return s("form",{key:"2346f250e4e2982b5b5b2624d039f551b5b5ed4e"},s("fieldset",{key:"7b496e6157e5eec02ef0d263c68fbd1e001c75ac"},s("div",{key:"b86d993c7fbee2269e48c7d4ea51826f199fecd4",class:"d-flex align-items-center gap-2"},s("legend",{key:"2b013e6068bbbca54a0852093ab4a2fae4ce64d2",class:"mb-0",part:M},"Representative"),s("form-control-tooltip",{key:"01e0f1d6ba2d5ee852593f7015a3ba7e0d980df9",helpText:"The representative for your business needs to be someone who has significant control over managing your business's finance. You will have an opportunity to add owners later in the form."})),s("hr",{key:"4bec34756ec7081e01809175bc3d2b6af0532537",class:"mt-2"}),s("div",{key:"6965720fabb1f12c6bb3c5a81f74ae12f44037b2",class:"row gy-3"},s("div",{key:"efbb768ba1e66d5ef47f792c39a17921b40e0eba",class:"col-12 col-md-8"},s("form-control-text",{key:"28477d3798ba7d14aee9201e84b276d8e85a21df",name:"name",label:"Full Name",defaultValue:null===(t=this.representativeDefaultValue)||void 0===t?void 0:t.name,errorText:this.errors.name,inputHandler:this.inputHandler})),s("div",{key:"28f17ccbe4da476256acd9c5a4e78a6a641ba6e9",class:"col-12 col-md-4"},s("form-control-select",{key:"dae6a93a0bc057abb97024277be0f10de01514e2",name:"title",label:"Title",options:et,defaultValue:null===(e=this.representativeDefaultValue)||void 0===e?void 0:e.title,errorText:this.errors.title,inputHandler:this.inputHandler})),s("div",{key:"2f9a45774adaa0040df2da1a8000d1ee61e16bf5",class:"col-12 col-md-6"},s("form-control-text",{key:"66a2a1ea8b54c03c012d76a74654ee19a9f958a7",name:"email",label:"Email Address",defaultValue:null===(i=this.representativeDefaultValue)||void 0===i?void 0:i.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{key:"3b34f0cb11d358db2220c01aac90e8b7ba3cc01b",class:"col-12 col-md-6"},s("form-control-number-masked",{key:"52c62ec653fb917a248a302f7cb5ad46dc7bcc23",name:"phone",label:"Phone Number",defaultValue:null===(a=this.representativeDefaultValue)||void 0===a?void 0:a.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:N.US})),s("div",{key:"d287ec225af1541cca227d3b8bc54466cbb86b07",class:"col-12 col-md-4"},s("form-control-date",{key:"7e1ff6cc40b01dc7f6ad0ad84d73c0e59eea0d6f",name:"dob_full",label:"Birth Date",defaultValue:null===(r=this.representativeDefaultValue)||void 0===r?void 0:r.dob_full,errorText:this.errors.dob_full,inputHandler:this.inputHandler,onFormControlInput:t=>kt(t,this.formController),helpText:"Must be 18 or older."})),s("div",{key:"283b09c845f1a12f4974f82a26fffbf7c5f608ba",class:"col-12 col-md-8"},!(null===(n=this.representativeDefaultValue)||void 0===n?void 0:n.ssn_last4)||this.isEditingIdentification?s("form-control-number-masked",{name:"identification_number",label:this.country===D.CAN?mt[this.country].idNumberLabelOptional:mt[this.country].idNumberLabel,defaultValue:this.isEditingIdentification?"":null===(o=this.representativeDefaultValue)||void 0===o?void 0:o.identification_number,errorText:this.errors.identification_number,inputHandler:this.inputHandler,mask:B[this.country],helpText:mt[this.country].identityHelpText}):s("div",null,s("label",{class:"form-label",part:W},this.country===D.CAN?mt[this.country].idNumberLabelOptional:mt[this.country].idNumberLabel),s("div",{class:"input-group mb-3"},s("input",{type:"text",class:"form-control",part:q,value:`****${null===(l=this.representativeDefaultValue)||void 0===l?void 0:l.ssn_last4}`,disabled:!0}),s("button",{class:"btn btn-secondary",type:"button",part:R,onClick:()=>{this.isEditingIdentification=!0,yt(this.formController,{identification_number:"",ssn_last4:null})}},"Change")))),s("div",{key:"0a40679570df7b85faa7530797ebc21ca8794263",class:"col-12"},s("identity-address-form",{key:"5a1590251365260413ab63ce9a417d3d71c71e84",errors:this.errors.address,defaultValues:null===(h=this.representativeDefaultValue)||void 0===h?void 0:h.address,handleFormUpdate:this.onAddressFormUpdate,country:this.country})))))}},Pt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.representative={},this.isLoading=!1,this.getData=()=>{this.getBusiness&&this.formController&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.representative=new I(t.data.representative||{}),this.representative.address.country=this.country,this.formController.setInitialValues(Object.assign({},this.representative))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.representative}),this.formLoading.emit(!1)}})}}propChanged(){this.initializeApi(),this.getData()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}componentWillLoad(){this.initializeApi(),this.initializeForm()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}initializeForm(){const t=C[this.country];t?(this.formController=new L(t("representative",this.allowOptionalFields)),this.getData()):this.errorEvent.emit({message:"Missing schema for selected country",errorCode:r.MISSING_PROPS,severity:a.ERROR})}componentDidLoad(){this.formController&&this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}get patchPayload(){return{representative:new I(this.formController.values.getValue()).payload}}render(){return!this.formController||this.isLoading?s(X,null):s("business-representative-form-inputs",{representativeDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController,country:this.country})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Ht=class{constructor(s){t(this,s),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.formCompleted=e(this,"formCompleted",7),this.errors={},this.fetchData=async()=>{this.formLoading.emit(!0);try{const t=await this.api.get({endpoint:this.businessEndpoint,authToken:this.authToken});this.acceptedTermsBefore=t.data.terms_conditions_accepted}catch(t){this.errorEvent.emit({errorCode:r.FETCH_ERROR,message:t.message,severity:a.ERROR,data:t})}finally{this.formLoading.emit(!1)}},this.sendData=async t=>{this.formLoading.emit(!0);try{const e=this.termsPayload,s=await this.api.post({endpoint:this.termsConditionsEndpoint,body:e,authToken:this.authToken});this.handleResponse(s,t)}catch(t){this.errorEvent.emit({errorCode:r.POST_ERROR,message:t.message,severity:a.ERROR,data:t})}finally{this.formLoading.emit(!1)}},this.inputHandler=(t,e)=>{this.acceptedTerms=e,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}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=wt(),this.formController=new L((t=>{const e=O({accepted:j().oneOf([!0],"You must agree to the terms and conditions to continue").required("You must agree to the terms and conditions to continue")}),s=O({accepted:j().nullable()});return t?s:e})(this.allowOptionalFields)),this.businessId&&this.authToken&&this.fetchData()}handleResponse(t,e){t.error?this.errorEvent.emit({errorCode:r.POST_ERROR,message:t.error.message,severity:a.ERROR,data:t.error}):e(),this.stepCompleteEvent.emit({response:t,formStep:st.termsAndConditions}),this.formCompleted.emit()}async validateAndSubmit({onSuccess:t}){this.acceptedTermsBefore?(this.stepCompleteEvent.emit({response:null,formStep:st.termsAndConditions,metadata:"no data submitted"}),this.formCompleted.emit(),t()):this.formController.validateAndSubmit((()=>this.sendData(t)))}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}get merchantAgreementLink(){return s("a",{href:"https://justifi.tech/merchant-agreement/",target:"_blank",rel:"noopener noreferrer"},"merchant agreement")}render(){return s("form",{key:"24b0a8ff0187894cf5e0f56e9e4b28c378e720cb"},s("fieldset",{key:"26fa9159dd6d61edd28b9443a10eeb981f150308"},s("legend",{key:"103bdecbc51f2cccd9105e2f9b271b60760618ec",part:M},"Terms and Conditions"),s("hr",{key:"dfd29fbe609a57d8160df7980ed0e63e75934a86"}),s("div",{key:"61e06597ec652c1d7c6e7e2bd8c9b653d061d076"},s("p",{key:"cd4def71580cd14d6edb5887221ebf6aa80cc2ea"},"Please read and accept the ",this.merchantAgreementLink," to submit your provisioning request.")),s("br",{key:"e3c64733f11a4f702e686e6c5ae7acd7e6bd1c34"}),s("div",{key:"71bd74de3aee69805a2aa1297356ff8b8db3c76c",class:"row-gy-3"},s("div",{key:"94a28c13e3bbc1c89cd1b5ebde2e1732b48f99ea",class:"col-12"},s("form-control-checkbox",{key:"fee95fa42192fee1bbfd544307b4e1c11c0d97f4",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})))))}},Nt=[{label:"Select a document type",value:""},{label:"Articles of Incorporation",value:"articles_of_incorporation"},{label:"Business Registration",value:"business_registration"}],Bt=[{label:"Select a document type",value:""},{label:"Voided Check",value:"voided_check"},{label:"Bank Statement",value:"bank_statement"}],Mt=[{label:"Select a document type",value:""},{label:"Voided Check",value:"voided_check"},{label:"Bank Letter",value:"bank_statement"}],Rt=[{label:"Select a document type",value:""},{label:"Canadian Passport",value:"passport"},{label:"Canadian Driver's License",value:"driver_license"},{label:"Canadian Government Issued ID Card",value:"government_id"},{label:"Permanent Resident Card",value:"resident_card"},{label:"Certificate of Indian Status",value:"status_card"},{label:"US State Issued Driver's License",value:"driver_license"}],Ft=[{label:"Select a document type",value:""},{label:"Nexus Card (Photo ID)",value:"nexus_card"},{label:"Canadian Citizenship/Naturalization Card or Certificate",value:"citizenship_card"},{label:"Foreign Passport",value:"foreign_passport"},{label:"Canadian Birth Certificate",value:"birth_certificate"},{label:"Social Insurance Number (SIN) Card",value:"sin_card"},{label:"Social Security Number (SSN) Card",value:"ssn_card"}];function Wt(t){return[{label:"Business Document",value:"business_document",docTypeOptions:Nt},{label:"Financial Document",value:"financial_document",docTypeOptions:t===D.CAN?Mt:Bt}]}const qt=[{label:"Financial Document",value:"financial_document",docTypeOptions:Bt}],zt=new Set(Rt.filter((t=>t.value)).map((t=>t.value))),Ut=new Set(Ft.filter((t=>t.value)).map((t=>t.value))),Zt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.owners=[],this.existingDocuments=[],this.selectedCategory="",this.selectedDocType="",this.uploadQueue=[],this.isLoading=!1,this.errors={},this.fileInputKey=0,this.categories=[],this.getData=()=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{const{owners:e,documents:s}=t.data;var i;this.owners=e||[],this.existingDocuments=s||[],this.categories=(i=this.country)===D.USA?qt:[...Wt(i),{label:"Identity Document - Group 1",value:"personal_group1",docTypeOptions:Rt},{label:"Identity Document - Group 2",value:"personal_group2",docTypeOptions:Ft}]},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.isLoading=!1}})},this.handleCategoryChange=(t,e)=>{this.selectedCategory=e,this.selectedDocType=""},this.handleDocTypeChange=(t,e)=>{e.startsWith("_")&&e.endsWith("_header")||(this.selectedDocType=e)},this.handleFileSelected=async t=>{const e=Array.from(t.detail.fileList),s=this.categories.find((t=>t.value===this.selectedCategory));if(!s)return;const i=s.docTypeOptions.find((t=>t.value===this.selectedDocType)),a=(null==i?void 0:i.label)||this.selectedDocType,r=e.map((t=>({categoryLabel:s.label,categoryValue:s.value,docTypeLabel:a,docTypeValue:this.selectedDocType,fileName:t.name,file:t,status:"uploading"}))),o=this.uploadQueue.length;this.uploadQueue=[...this.uploadQueue,...r],this.selectedCategory="",this.selectedDocType="",this.fileInputKey++,await Promise.all(r.map((async(t,e)=>{const s=o+e;try{const e=new n({file:t.file,document_type:t.docTypeValue},this.businessId);if(!await this.postDocumentRecordData(e))return void(this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:"error"}):t)));const i=await this.uploadDocument(e);this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:i?"uploaded":"error"}):t))}catch(t){this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:"error"}):t))}})))},this.postDocumentRecordData=async t=>{const e=t.record_data;return new Promise((s=>{this.postDocumentRecord({payload:e,onSuccess:e=>{s(this.handleDocRecordResponse(t,e))},onError:({error:t,code:e,severity:i})=>{this.errorEvent.emit({message:t,errorCode:e,severity:i}),s(!1)}})}))},this.handleDocRecordResponse=(t,e)=>e.error?(this.errorEvent.emit({errorCode:r.POST_ERROR,message:e.error.message,severity:a.ERROR,data:e.error}),!1):(t.setPresignedUrl(e.data.presigned_url),!0),this.uploadDocument=async t=>{if(!t.presigned_url)throw new Error("Presigned URL is not set");const e=await t.getFileData();return!!(await fetch(t.presigned_url,{method:"PUT",body:e})).ok||(this.errorEvent.emit({errorCode:r.POST_ERROR,message:"Failed to upload document",severity:a.ERROR}),!1)}}propChanged(){this.initializeApi()}watchHandler(t){this.formLoading.emit(t)}async validateAndSubmit({onSuccess:t}){const e=this.validate();Object.keys(e).length>0?this.errors=e:(this.errors={},this.stepCompleteEvent.emit({response:null,formStep:st.documentUpload}),t())}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.postDocumentRecord=m({authToken:this.authToken,service:new g})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}get categoryOptions(){return[{label:"Select a category",value:""},...this.categories.map((t=>({label:t.label,value:t.value})))]}get docTypeOptions(){if(!this.selectedCategory)return[{label:"Select a category first",value:""}];const t=this.categories.find((t=>t.value===this.selectedCategory));return(null==t?void 0:t.docTypeOptions)||[{label:"Select a category first",value:""}]}validate(){if(this.allowOptionalFields)return{};const t={},e=t=>this.existingDocuments.some((e=>t.includes(e.document_type))),s=t=>this.uploadQueue.some((e=>e.categoryValue===t&&"uploaded"===e.status));if(s("financial_document")||e(["voided_check","bank_statement"])||(t.financial_document="Please upload a financial document"),this.country===D.CAN){const i=["articles_of_incorporation","business_registration"];s("business_document")||e(i)||(t.business_document="Please upload a business document");const a=this.owners.length,r=this.uploadQueue.filter((t=>"personal_group1"===t.categoryValue&&"uploaded"===t.status)).length,n=this.existingDocuments.filter((t=>zt.has(t.document_type))).length;r+n<a&&(t.personal_group1=`Please upload ${a} Group 1 identity document(s) (${r+n} of ${a} provided)`);const o=this.uploadQueue.filter((t=>"personal_group2"===t.categoryValue&&"uploaded"===t.status)).length,l=this.existingDocuments.filter((t=>Ut.has(t.document_type))).length;o+l<a&&(t.personal_group2=`Please upload ${a} Group 2 identity document(s) (${o+l} of ${a} provided)`)}return t}render(){return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("legend",{class:"mb-0",part:M},"Document Uploads"),s("hr",{class:"mt-2"}),s("business-documents-on-file",{documents:this.existingDocuments,isLoading:this.isLoading})),this.country===D.CAN&&this.owners.length>0&&s("div",{class:"alert alert-info mt-3"},"One document from each group (Group 1 and Group 2) is required for each owner (",this.owners.length," owner(s))."),s("fieldset",{class:"mt-4"},s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Add Document"),s("form-control-tooltip",{helpText:"Upload documents one at a time. Select the category and type, then choose a file. For Canadian businesses, one Group 1 and one Group 2 identity document is required for each owner."})),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-select",{name:"document_category",label:"Document Category",options:this.categoryOptions,defaultValue:this.selectedCategory,inputHandler:this.handleCategoryChange})),s("div",{class:"col-12 col-md-6"},s("form-control-select",{name:"document_type",label:"Document Type",options:this.docTypeOptions,defaultValue:this.selectedDocType,inputHandler:this.handleDocTypeChange,disabled:!this.selectedCategory})),s("div",{class:"col-12"},s("form-control-file",{key:this.fileInputKey,name:"document_file",label:"Upload Document",documentType:this.selectedDocType,onFileSelected:this.handleFileSelected,disabled:!this.selectedDocType,multiple:!1})))),s("document-upload-list",{documents:this.uploadQueue}),Object.keys(this.errors).length>0&&s("div",{class:"alert alert-danger mt-3"},s("ul",{class:"mb-0"},Object.values(this.errors).map((t=>s("li",null,t))))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],isLoading:["watchHandler"]}}},Gt=class{constructor(e){t(this,e),this.documents=[]}renderStatus(t){switch(t){case"uploading":return s("span",{class:"badge bg-info"},"Uploading...");case"uploaded":return s("span",{class:"badge bg-success"},"Uploaded");case"error":return s("span",{class:"badge bg-danger"},"Error")}}render(){return this.documents.length?s("div",{class:"mt-4"},s("div",{class:"card",part:z},s("div",{class:"card-body"},s("h5",{class:"card-title",part:M},"Uploaded Documents"),s("div",{class:"table-responsive"},s("table",{class:"table table-sm table-borderless",part:U},s("thead",null,s("tr",null,s("th",{style:{width:"25%"},part:Z,scope:"col"},"Category"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Document Type"),s("th",{style:{width:"30%"},part:Z,scope:"col"},"File Name"),s("th",{style:{width:"20%"},part:Z,scope:"col"},"Status"))),s("tbody",null,this.documents.map(((t,e)=>s("tr",{class:0===e?"border-bottom border-top":"border-bottom"},s("td",{part:G},t.categoryLabel),s("td",{part:G},t.docTypeLabel),s("td",{part:G},t.fileName),s("td",{part:G},this.renderStatus(t.status))))))))))):null}},Yt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.legal_address={},this.isLoading=!1,this.getData=()=>{this.getBusiness&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{const e=new V((t.data||{}).legal_address||{});this.legal_address=Object.assign(Object.assign({},e),{country:this.country}),this.formController.setInitialValues(Object.assign({},this.legal_address))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.legalAddress}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return{legal_address:new V(this.formController.values.getValue()).payload}}componentWillLoad(){this.initializeApi(),this.formController=new L((0,x[this.country])(this.allowOptionalFields)),this.getData()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t;const e=null===(t=this.formController)||void 0===t?void 0:t.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Legal Address of your Business"),s("form-control-tooltip",{helpText:"No PO Boxes."})),s("hr",{class:"mt-2"}),s("form-address-fields",{country:this.country,errors:this.errors,defaultValues:e,inputHandler:this.inputHandler})))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},$t=class{loadingWatcher(){this.formLoading.emit(this.isLoading)}constructor(s){t(this,s),this.clickEvent=e(this,"click-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.ownerSubmitted=e(this,"ownerSubmitted",7),this.isLoading=!1,this.errors={},this.owner={},this.getData=()=>{this.getOwner&&(this.isLoading=!0,this.getOwner({onSuccess:t=>{this.instantiateOwner(t.data)},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>this.isLoading=!1}))},this.sendData=()=>(this.isLoading=!0,new Promise((t=>{this.ownerId?this.patchOwner({payload:this.payload,onSuccess:e=>{this.ownerSubmitted.emit({id:e.data.id}),this.instantiateOwner(e.data),t(!0)},onError:({error:e,code:s,severity:i})=>{this.errorEvent.emit({message:e,errorCode:s,severity:i}),t(!1)},final:()=>this.isLoading=!1}):this.postOwner({payload:this.payload,onSuccess:e=>{this.ownerSubmitted.emit({id:e.data.id}),this.instantiateOwner(e.data),t(!0)},onError:({error:e,code:s,severity:i})=>{this.errorEvent.emit({message:e,errorCode:s,severity:i}),t(!1)},final:()=>this.isLoading=!1})}))),this.instantiateOwner=async t=>{this.owner=Object.assign({},new P(t)),await this.formController.setInitialValues(this.owner)},this.handleAddOwner=()=>{this.clickEvent.emit({name:this.ownerId?it.updateOwner:it.addOwner})},this.handleRemoveOwner=()=>{this.removeOwner(this.ownerId),this.clickEvent.emit({name:it.removeOwner})},this.validate=this.validate.bind(this),this.submit=this.submit.bind(this),this.validateAndSubmit=this.validateAndSubmit.bind(this)}async returnOwnerData(){return this.ownerId}async getOwnershipPercentage(){var t;return(null===(t=this.formController.values.getValue())||void 0===t?void 0:t.ownership_percentage)||null}async setOwnershipPercentageError(t){this.formController.setFieldError("ownership_percentage",t)}async validate(){return this.formController.validate()}async submit(){if(await this.validate())return this.sendData()}async validateAndSubmit(t){t.preventDefault(),await this.validate()&&this.submit()}get payload(){const t=new P(this.formController.values.getValue()).payload;return this.ownerId?t:Object.assign(Object.assign({},t),{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 L((0,C[this.country])("owner",this.allowOptionalFields)),this.initializeApi(),this.ownerId&&this.getOwner?this.getData():this.instantiateOwner({})}componentDidLoad(){this.formController.errors.subscribe((t=>this.errors=Object.assign({},t)))}initializeApi(){this.authToken&&(this.getOwner=b({authToken:this.authToken,identityId:this.ownerId,service:new k}),this.patchOwner=p({authToken:this.authToken,identityId:this.ownerId,service:new k}),this.postOwner=f({authToken:this.authToken,service:new k}))}render(){return s(i,{key:"b168e9f5a52416984e6a04ab5f0771b63ee28b2e",style:{display:"block"}},s("form",{key:"d22a6aae3f5debd30d87b3bd37c67390a46c4590",onSubmit:this.validateAndSubmit},s("fieldset",{key:"30597bc1f4983bddbdc0ed45e6be7e715d0b9b8e"},s("legend",{key:"055ca2b6bbfa4e86591411668eaead3bd0d95ea8",class:"fw-semibold fs-5 w-100",part:$},this.formTitle),s("br",{key:"f0d2d9624611ee888ff318ec1525281bf007e346"}),s("div",{key:"2c38a166f681404c2ab303630217e54c15f1e5f2",class:"row gy-3"},s("owner-form-inputs",{key:"05253624d3d79f0ba7a4ec49b387e252e796e5b6",ownerDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController,country:this.country}),s("div",{key:"8e0e67966f047c3f9a4b30f28983f67db2372c0c",class:"d-flex gap-2 justify-content-start"},s(ut,{key:"e33368a968efe5faf52a08e36bb2bef215625c4a",variant:"secondary",type:"button",onClick:this.handleRemoveOwner,hidden:!this.showRemoveButton},"Remove"),s(ut,{key:"7bb79b0624dfb3a8645182432c484f288cc73692",variant:"primary",type:"submit",onClick:this.handleAddOwner,disabled:this.isLoading},this.submitButtonText))),s("hr",{key:"ef4f86dd1b1878e92c98e4a826f9fbad808e15b7"}))))}static get watchers(){return{isLoading:["loadingWatcher"]}}},Kt=class{constructor(s){t(this,s),this.plaidVerificationSuccess=e(this,"plaidVerificationSuccess",7),this.plaidVerificationError=e(this,"plaidVerificationError",7),this.linkToken=null,this.linkTokenId=null,this.plaidLink=null,this.isAuthenticating=!1,this.isSuccess=!1,this.error=null,this.isLoading=!1,this.plaidService=new Tt,this.abortController=null,this.timeoutId=null,this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:h.PLAID_SDK_LOAD_FAILED,message:l[h.PLAID_SDK_LOAD_FAILED],severity:o[h.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:h.PLAID_LINK_TOKEN_FAILED,message:l[h.PLAID_LINK_TOKEN_FAILED],severity:o[h.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:h.PLAID_LINK_INIT_FAILED,message:l[h.PLAID_LINK_INIT_FAILED],severity:o[h.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,s,i;try{if(!this.authToken||!this.accountId)return void this.handleError({code:h.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please provide authToken and accountId.",severity:a.ERROR,retryable:!1,userAction:"Provide required props"});this.abortController=new AbortController,this.timeoutId=setTimeout((()=>{var t;null===(t=this.abortController)||void 0===t||t.abort()}),3e4);const t=await this.plaidService.getLinkTokenForVerification(this.authToken,this.businessId,this.abortController.signal);if(this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),t.error)throw new Error("string"==typeof t.error?t.error:t.error.message||"Failed to get link token");this.linkToken=t.data.link_token,this.linkTokenId=t.data.id}catch(a){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let r=h.PLAID_LINK_TOKEN_FAILED,n=l[r],c=!0;"AbortError"===a.name?(r=h.PLAID_TIMEOUT,n=l[r],c=!0):(null===(t=a.message)||void 0===t?void 0:t.includes("network"))||(null===(e=a.message)||void 0===e?void 0:e.includes("fetch"))?(r=h.PLAID_NETWORK_ERROR,n=l[r],c=!0):((null===(s=a.message)||void 0===s?void 0:s.includes("401"))||(null===(i=a.message)||void 0===i?void 0:i.includes("unauthorized")))&&(r=h.PLAID_INVALID_CREDENTIALS,n="Authentication failed. Please check your credentials.",c=!1),this.handleError({code:r,message:n,severity:o[r],originalError:a,retryable:c,userAction:c?"Click to try again":"Check your credentials"})}},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=async t=>{var e;this.isAuthenticating=!1,this.isLoading=!0,this.clearError();try{const s=await this.plaidService.postPlaidVerifiedBankAccountData(this.authToken,this.businessId,{public_token:t,link_token_id:this.linkTokenId},null===(e=this.abortController)||void 0===e?void 0:e.signal);if(s.error)throw new Error("string"==typeof s.error?s.error:s.error.message||"Failed to verify bank account");this.isSuccess=!0,this.isLoading=!1,this.plaidVerificationSuccess.emit({publicToken:t,bankAccount:s.data})}catch(t){this.isLoading=!1,this.handleError({code:h.PLAID_AUTHENTICATION_FAILED,message:(null==t?void 0:t.message)||"Failed to verify bank account",severity:o[h.PLAID_AUTHENTICATION_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.handlePlaidExit=t=>{this.isAuthenticating=!1,t&&this.handlePlaidError(t)},this.handlePlaidEvent=(t,e)=>{switch(t){case"OPEN":this.isAuthenticating=!0;break;case"CLOSE":this.isAuthenticating=!1;break;case"ERROR":this.handlePlaidError(e)}},this.handlePlaidLoad=()=>{},this.handlePlaidError=t=>{let e=h.PLAID_AUTHENTICATION_FAILED,s=l[e],i=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=h.PLAID_INVALID_CREDENTIALS,s=l[e],i=!0;break;case"ITEM_LOGIN_REQUIRED":e=h.PLAID_INVALID_CREDENTIALS,s="Your bank requires re-authentication. Please try again.",i=!0;break;case"ITEM_LOCKED":e=h.PLAID_ACCOUNT_LOCKED,s=l[e],i=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=h.PLAID_MAINTENANCE,s=l[e],i=!0;break;case"RATE_LIMIT_EXCEEDED":e=h.PLAID_RATE_LIMITED,s=l[e],i=!0;break;default:t.error_message&&(s=t.error_message)}this.handleError({code:e,message:s,severity:o[e],originalError:t,retryable:i,userAction:a}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.isLoading=!1,this.plaidVerificationError.emit(t),console.error("Plaid verification error:",t)},this.clearError=()=>{this.error&&(this.error=null)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.initializePlaidLink()},this.scriptRef.onerror=()=>{this.handleError({code:h.PLAID_SDK_LOAD_FAILED,message:l[h.PLAID_SDK_LOAD_FAILED],severity:o[h.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})})}disconnectedCallback(){this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){const t=s("svg",{class:"plaid-logo-img",height:"20",width:"20",viewBox:"0 0 28 29",xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",marginLeft:"5px",marginRight:"5px",marginTop:"-2px"}},s("g",{fill:"#fff","fill-rule":"evenodd"},s("path",{d:"M25.7629 26.2628L28 17.5309L24.9691 14.5001L27.9999 11.4691L25.7628 2.73706L17.0309 0.5L14.0001 3.531L10.969 0.50014L2.23706 2.73734L0 11.4691L3.03128 14.4999L0.00014 17.531L2.2372 26.2629L10.9691 28.5L14.0001 25.469L17.031 28.4999L25.7629 26.2628ZM15.7321 23.7371L18.6186 20.8505L22.2912 24.5233L17.6956 25.7007L15.7321 23.7371ZM11.1136 9.88154L14.0003 6.99502L16.8868 9.8814L14.0001 12.7679L11.1136 9.88154ZM12.2682 14.5L9.38154 17.3865L6.49502 14.5L9.38154 11.6135L12.2682 14.5ZM18.6187 11.6133L21.5053 14.5L18.6186 17.3865L15.7321 14.5L18.6187 11.6133ZM16.8867 19.1186L14.0001 22.0051L11.1135 19.1185L14.0001 16.2319L16.8867 19.1186ZM10.3044 25.7007L5.70864 24.5233L9.38154 20.8504L12.2682 23.7371L10.3044 25.7007ZM4.76308 16.2319L7.6496 19.1185L3.9767 22.7914L2.7993 18.1957L4.76308 16.2319ZM3.9767 6.20836L7.64974 9.8814L4.76308 12.7681L2.7993 10.8041L3.9767 6.20836ZM12.2683 5.26294L9.38168 8.1496L5.70892 4.4767L10.3047 3.2993L12.2683 5.26294ZM17.6959 3.2993L22.2915 4.4767L18.6186 8.14946L15.7321 5.26294L17.6959 3.2993ZM23.2372 12.7681L20.3505 9.8814L24.0233 6.20878L25.2007 10.8046L23.2372 12.7681ZM24.0233 22.7914L20.3505 19.1186L23.2372 16.2321L25.2007 18.1957L24.0233 22.7914Z"})));return s(_t,null,s("script",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",async:!0,ref:t=>this.scriptRef=t}),s("div",null,s("div",{class:"mb-3"},s(ut,{variant:"primary",type:"button",onClick:t=>{t.preventDefault(),this.openPlaidLink()},disabled:this.isLoading,part:K},"Connect with Plaid ",t," (instant verification)")),(()=>this.error?s("div",{class:(this.error.severity===a.ERROR?"text-danger":this.error.severity===a.WARNING?"text-warning":"text-info")+" mt-2"},s("small",null,this.error.message),s("br",null),this.error.userAction&&s("small",{class:"text-muted"},this.error.userAction)):null)(),(()=>this.error?null:this.isLoading?s("div",{class:"text-info mt-2"},s("small",null,"Verifying bank account...")):this.isSuccess?s("div",{class:"text-success mt-2"},s("small",null,"✓ Bank account verified successfully")):this.isAuthenticating?s("div",{class:"text-info mt-2"},s("small",null,"Connecting to your bank...")):null)()))}};export{xt as additional_questions_form_step,Lt as bank_account_form_inputs,Ot as bank_account_form_inputs_canada,At as business_bank_account_form_step,Dt as business_core_info_form_step,Et as business_documents_on_file,It as business_owners_form_step,Vt as business_representative_form_inputs,Pt as business_representative_form_step,Ht as business_terms_conditions_form_step,Zt as document_upload_form_step,Gt as document_upload_list,Yt as legal_address_form_step,$t as owner_form,Kt as plaid_verification}
@@ -1 +1 @@
1
- import{h as s,F as e,r as t,c as i}from"./p-CV0Pyo1O.js";import{E as a}from"./p-Cu7hgXL1.js";import{B as r}from"./p-R_0S69Pr.js";import{m as o}from"./p-CPJC6tlj.js";import{C as l,b as n}from"./p-DXTa04jn.js";import{J as d}from"./p-DYL3RR2S.js";import{c as h}from"./p-C_SQBHCI.js";import{S as c}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as p}from"./p-uZ5KAseb.js";import"./p-CPKMvyV_.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-CdwzNfP1.js";import"./p-BtzgeLyZ.js";const u=()=>{const t=()=>s("div",{class:"mt-5"},s(p,{width:"40%",height:"1.5rem"}),s("hr",null),s("div",{class:"row g-3"},s("div",{class:"col-12 col-md-6"},s(p,null),s(p,null),s(p,null)),s("div",{class:"col-12 col-md-6"},s(p,null),s(p,null),s(p,null))));return s(e,null,s(t,null),s(t,null),s(t,null),s(t,null))},m=class{constructor(s){t(this,s),this.errorEvent=i(this,"error-event",7),this.loading=!0}componentWillLoad(){h(),this.analytics=new d(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetBusiness()}initializeGetBusiness(){this.businessId&&this.authToken?(this.getBusiness=o({id:this.businessId,authToken:this.authToken,service:new r}),this.fetchData()):(this.errorMessage="Invalid business id or auth token",this.errorEvent.emit({errorCode:n.MISSING_PROPS,message:this.errorMessage,severity:l.ERROR}))}updateOnPropChange(){this.getBusiness&&this.fetchData()}fetchData(){this.loading=!0,this.getBusiness({onSuccess:({business:s})=>{this.business=s,this.errorMessage=null},onError:({error:s,code:e,severity:t})=>{this.errorMessage=s,this.errorEvent.emit({errorCode:e,message:s,severity:t})},final:()=>{this.loading=!1}})}render(){return s(c,{key:"7ce48e6905cdbbf8f94470913ecfa3ef8dbb76c7"},this.loading&&s(u,{key:"7c3439e0c247436cd7951d3bdc32e7672c9f8447"}),!this.loading&&this.errorMessage&&a(this.errorMessage),!this.loading&&!this.errorMessage&&this.business&&s("justifi-details",{key:"bf57dacf2067f2704014ce3e002958e3306bba73",errorMessage:this.errorMessage},s("div",{key:"46d19a178ba0d33aa21a4f3900128e3e905731a9",slot:"detail-sections"},s("core-info-details",{key:"ac217a4cfe6b45810a85ca320760b7331f76e60b",business:this.business}),s("legal-address-details",{key:"1fc1a196a43bcf5f9eafd09bfe74c8bb7c409797",legalAddress:this.business.legal_address}),s("representative-details",{key:"1e0833606b129f69a05946726172963cbec05189",representative:this.business.representative}),s("owner-details",{key:"c974111dc67a8961ef6435c34843ca927ad8a7e5",owners:this.business.owners}),s("additional-questions-details",{key:"0951d284a373457e98a1dafc80231ec3ee057e0a",additionalQuestions:this.business.additional_questions}))))}static get watchers(){return{businessId:["propChanged"],authToken:["propChanged"],getBusiness:["updateOnPropChange"]}}};export{m as justifi_business_details}
1
+ import{h as s,F as e,r as i,c as t}from"./p-CV0Pyo1O.js";import{E as a}from"./p-Cu7hgXL1.js";import{B as r}from"./p-R_0S69Pr.js";import{m as o}from"./p-CPJC6tlj.js";import{C as l,b as n}from"./p-DXTa04jn.js";import{J as d}from"./p-CfIGO7TJ.js";import{c as h}from"./p-CqOzVXGL.js";import{S as c}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as p}from"./p-uZ5KAseb.js";import"./p-CPKMvyV_.js";import"./p-De4Pig-y.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BSs-2JKu.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-CdwzNfP1.js";import"./p-Bx2_PW91.js";const u=()=>{const i=()=>s("div",{class:"mt-5"},s(p,{width:"40%",height:"1.5rem"}),s("hr",null),s("div",{class:"row g-3"},s("div",{class:"col-12 col-md-6"},s(p,null),s(p,null),s(p,null)),s("div",{class:"col-12 col-md-6"},s(p,null),s(p,null),s(p,null))));return s(e,null,s(i,null),s(i,null),s(i,null),s(i,null))},m=class{constructor(s){i(this,s),this.errorEvent=t(this,"error-event",7),this.loading=!0}componentWillLoad(){h(),this.analytics=new d(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetBusiness()}initializeGetBusiness(){this.businessId&&this.authToken?(this.getBusiness=o({id:this.businessId,authToken:this.authToken,service:new r}),this.fetchData()):(this.errorMessage="Invalid business id or auth token",this.errorEvent.emit({errorCode:n.MISSING_PROPS,message:this.errorMessage,severity:l.ERROR}))}updateOnPropChange(){this.getBusiness&&this.fetchData()}fetchData(){this.loading=!0,this.getBusiness({onSuccess:({business:s})=>{this.business=s,this.errorMessage=null},onError:({error:s,code:e,severity:i})=>{this.errorMessage=s,this.errorEvent.emit({errorCode:e,message:s,severity:i})},final:()=>{this.loading=!1}})}render(){return s(c,{key:"7ce48e6905cdbbf8f94470913ecfa3ef8dbb76c7"},this.loading&&s(u,{key:"7c3439e0c247436cd7951d3bdc32e7672c9f8447"}),!this.loading&&this.errorMessage&&a(this.errorMessage),!this.loading&&!this.errorMessage&&this.business&&s("justifi-details",{key:"bf57dacf2067f2704014ce3e002958e3306bba73",errorMessage:this.errorMessage},s("div",{key:"46d19a178ba0d33aa21a4f3900128e3e905731a9",slot:"detail-sections"},s("core-info-details",{key:"ac217a4cfe6b45810a85ca320760b7331f76e60b",business:this.business}),s("legal-address-details",{key:"1fc1a196a43bcf5f9eafd09bfe74c8bb7c409797",legalAddress:this.business.legal_address}),s("representative-details",{key:"1e0833606b129f69a05946726172963cbec05189",representative:this.business.representative}),s("owner-details",{key:"c974111dc67a8961ef6435c34843ca927ad8a7e5",owners:this.business.owners}),s("additional-questions-details",{key:"0951d284a373457e98a1dafc80231ec3ee057e0a",additionalQuestions:this.business.additional_questions}))))}static get watchers(){return{businessId:["propChanged"],authToken:["propChanged"],getBusiness:["updateOnPropChange"]}}};export{m as justifi_business_details}