@justifi/webcomponents 6.16.0-rc.2 → 6.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/{Analytics-CDE3KpL6.js → Analytics-BiltKWA1.js} +2 -2
  3. package/dist/cjs/{Api-CaEn8pKs.js → Api-w_3MKA4i.js} +1 -1
  4. package/dist/cjs/additional-questions-form-step_15.cjs.entry.js +5 -5
  5. package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
  6. package/dist/cjs/{business.service-DIspRonp.js → business.service-OC3N6Ih_.js} +1 -1
  7. package/dist/cjs/card-form.cjs.entry.js +2 -2
  8. package/dist/cjs/{checkout.service-CM1Duar4.js → checkout.service-WHoN6aeA.js} +1 -1
  9. package/dist/cjs/{detect-duplicate-version-DyHHkx4J.js → detect-duplicate-version-CNXbBY8q.js} +1 -1
  10. package/dist/cjs/dispute-notification_2.cjs.entry.js +5 -5
  11. package/dist/cjs/{event-types-DNCxVTir.js → event-types-Cai0mEQK.js} +1 -1
  12. package/dist/cjs/form-alert_3.cjs.entry.js +1 -1
  13. package/dist/cjs/{get-subaccounts-8LeFCTm6.js → get-subaccounts-CeCBRq_d.js} +1 -1
  14. package/dist/cjs/justifi-apple-pay_12.cjs.entry.js +36 -18
  15. package/dist/cjs/justifi-bank-account-billing-form-simple.cjs.entry.js +5 -5
  16. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +5 -5
  17. package/dist/cjs/justifi-billing-form-full.cjs.entry.js +1 -1
  18. package/dist/cjs/justifi-billing-form.cjs.entry.js +1 -1
  19. package/dist/cjs/justifi-business-details.cjs.entry.js +6 -6
  20. package/dist/cjs/justifi-business-form.cjs.entry.js +6 -6
  21. package/dist/cjs/justifi-card-billing-form-simple.cjs.entry.js +1 -1
  22. package/dist/cjs/justifi-card-form.cjs.entry.js +5 -5
  23. package/dist/cjs/justifi-checkout-qr-code.cjs.entry.js +4 -4
  24. package/dist/cjs/justifi-checkout.cjs.entry.js +5 -5
  25. package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +1 -1
  26. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +7 -7
  27. package/dist/cjs/justifi-dispute-management.cjs.entry.js +6 -6
  28. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +5 -5
  29. package/dist/cjs/justifi-order-terminals.cjs.entry.js +7 -7
  30. package/dist/cjs/justifi-payment-details.cjs.entry.js +6 -6
  31. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +6 -6
  32. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +6 -6
  33. package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +1 -1
  34. package/dist/cjs/justifi-payments-list.cjs.entry.js +6 -6
  35. package/dist/cjs/justifi-payout-details.cjs.entry.js +6 -6
  36. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +6 -6
  37. package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/justifi-payouts-list.cjs.entry.js +7 -7
  39. package/dist/cjs/justifi-qr-terminal.cjs.entry.js +5 -5
  40. package/dist/cjs/justifi-refund-payment.cjs.entry.js +6 -6
  41. package/dist/cjs/justifi-save-new-payment-method.cjs.entry.js +1 -1
  42. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +5 -5
  43. package/dist/cjs/justifi-skeleton.cjs.entry.js +1 -1
  44. package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +1 -1
  45. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +5 -5
  46. package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +1 -1
  47. package/dist/cjs/justifi-terminals-list.cjs.entry.js +7 -7
  48. package/dist/cjs/{package-DGrVUpde.js → package-DnJ-D1hz.js} +1 -1
  49. package/dist/cjs/payment-method-option.cjs.entry.js +1 -1
  50. package/dist/cjs/{payment.service-By7aeVkC.js → payment.service-8VwquZX4.js} +1 -1
  51. package/dist/cjs/{payout.service-Dn0rXkmg.js → payout.service-CfjxVIch.js} +1 -1
  52. package/dist/cjs/{plaid.service-CjaugrzX.js → plaid.service-C32Ot0be.js} +1 -1
  53. package/dist/cjs/styled-host-BxbU-bI7.js +20 -0
  54. package/dist/cjs/{terminal.service-C0_r_A60.js → terminal.service-CWCqdsOs.js} +1 -1
  55. package/dist/collection/components/modular-checkout/sub-components/justifi-plaid-payment-method.js +12 -8
  56. package/dist/collection/components/tokenize-payment-method/justifi-tokenize-payment-method.js +18 -2
  57. package/dist/collection/ui-components/styled-host/styled-host.js +10 -1
  58. package/dist/docs.json +1 -1
  59. package/dist/esm/{Analytics-tBzmPsnT.js → Analytics-BRg-ot7B.js} +2 -2
  60. package/dist/esm/{Api-BH6Wa9CT.js → Api-IpJbOluD.js} +1 -1
  61. package/dist/esm/additional-questions-form-step_15.entry.js +5 -5
  62. package/dist/esm/bank-account-form.entry.js +2 -2
  63. package/dist/esm/{business.service-XOnczlAa.js → business.service-CUq26RAr.js} +1 -1
  64. package/dist/esm/card-form.entry.js +2 -2
  65. package/dist/esm/{checkout.service-DvSxk9EZ.js → checkout.service-CoV-isHr.js} +1 -1
  66. package/dist/esm/{detect-duplicate-version-BD3-8NL2.js → detect-duplicate-version-Buk1JhSy.js} +1 -1
  67. package/dist/esm/dispute-notification_2.entry.js +5 -5
  68. package/dist/esm/{event-types-CM5AGGBD.js → event-types-qSUHE7co.js} +1 -1
  69. package/dist/esm/form-alert_3.entry.js +1 -1
  70. package/dist/esm/{get-subaccounts-P-x_RqL5.js → get-subaccounts-Cvolc0kY.js} +1 -1
  71. package/dist/esm/justifi-apple-pay_12.entry.js +37 -19
  72. package/dist/esm/justifi-bank-account-billing-form-simple.entry.js +5 -5
  73. package/dist/esm/justifi-bank-account-form.entry.js +5 -5
  74. package/dist/esm/justifi-billing-form-full.entry.js +1 -1
  75. package/dist/esm/justifi-billing-form.entry.js +1 -1
  76. package/dist/esm/justifi-business-details.entry.js +6 -6
  77. package/dist/esm/justifi-business-form.entry.js +6 -6
  78. package/dist/esm/justifi-card-billing-form-simple.entry.js +1 -1
  79. package/dist/esm/justifi-card-form.entry.js +5 -5
  80. package/dist/esm/justifi-checkout-qr-code.entry.js +4 -4
  81. package/dist/esm/justifi-checkout.entry.js +5 -5
  82. package/dist/esm/justifi-checkouts-list-filters.entry.js +1 -1
  83. package/dist/esm/justifi-checkouts-list.entry.js +7 -7
  84. package/dist/esm/justifi-dispute-management.entry.js +6 -6
  85. package/dist/esm/justifi-gross-payment-chart.entry.js +5 -5
  86. package/dist/esm/justifi-order-terminals.entry.js +7 -7
  87. package/dist/esm/justifi-payment-details.entry.js +6 -6
  88. package/dist/esm/justifi-payment-provisioning.entry.js +6 -6
  89. package/dist/esm/justifi-payment-transactions-list.entry.js +6 -6
  90. package/dist/esm/justifi-payments-list-filters.entry.js +1 -1
  91. package/dist/esm/justifi-payments-list.entry.js +6 -6
  92. package/dist/esm/justifi-payout-details.entry.js +6 -6
  93. package/dist/esm/justifi-payout-transactions-list.entry.js +6 -6
  94. package/dist/esm/justifi-payouts-list-filters.entry.js +1 -1
  95. package/dist/esm/justifi-payouts-list.entry.js +7 -7
  96. package/dist/esm/justifi-qr-terminal.entry.js +5 -5
  97. package/dist/esm/justifi-refund-payment.entry.js +6 -6
  98. package/dist/esm/justifi-save-new-payment-method.entry.js +1 -1
  99. package/dist/esm/justifi-season-interruption-insurance.entry.js +5 -5
  100. package/dist/esm/justifi-skeleton.entry.js +1 -1
  101. package/dist/esm/justifi-terminal-orders-list-filters.entry.js +1 -1
  102. package/dist/esm/justifi-terminal-orders-list.entry.js +5 -5
  103. package/dist/esm/justifi-terminals-list-filters.entry.js +1 -1
  104. package/dist/esm/justifi-terminals-list.entry.js +7 -7
  105. package/dist/esm/{package-DhrQechy.js → package-Deobp59r.js} +1 -1
  106. package/dist/esm/payment-method-option.entry.js +1 -1
  107. package/dist/esm/{payment.service-CBUnE4bP.js → payment.service-Cw6qInd6.js} +1 -1
  108. package/dist/esm/{payout.service-DUYaYbeJ.js → payout.service-DOieTpcO.js} +1 -1
  109. package/dist/esm/{plaid.service-Umm80G4q.js → plaid.service-BMWf7Ieo.js} +1 -1
  110. package/dist/esm/styled-host-CXEpP1m_.js +18 -0
  111. package/dist/esm/{terminal.service-DeunLqmo.js → terminal.service-sR0ii2iZ.js} +1 -1
  112. package/dist/module/badge.js +1 -1
  113. package/dist/module/justifi-plaid-payment-method2.js +12 -9
  114. package/dist/module/justifi-tokenize-payment-method2.js +18 -2
  115. package/dist/module/package.js +1 -1
  116. package/dist/module/pagination-menu2.js +1 -1
  117. package/dist/module/parts.js +1 -1
  118. package/dist/module/spinner.js +1 -1
  119. package/dist/module/styled-host.js +11 -2
  120. package/dist/module/terminal-quantity-selector2.js +1 -1
  121. package/dist/types/components/tokenize-payment-method/justifi-tokenize-payment-method.d.ts +1 -0
  122. package/dist/webcomponents/{p-6f7756b7.entry.js → p-01f47ab2.entry.js} +1 -1
  123. package/dist/webcomponents/{p-5f20b0da.entry.js → p-027b4d63.entry.js} +1 -1
  124. package/dist/webcomponents/{p-12f5fdc0.entry.js → p-080a121b.entry.js} +1 -1
  125. package/dist/webcomponents/p-119fd3ce.entry.js +1 -0
  126. package/dist/webcomponents/p-1411a042.entry.js +1 -0
  127. package/dist/webcomponents/{p-e1fbadea.entry.js → p-1f83d0b1.entry.js} +1 -1
  128. package/dist/webcomponents/{p-89ed2d99.entry.js → p-2a01b6f6.entry.js} +1 -1
  129. package/dist/webcomponents/p-2e2dfaef.entry.js +1 -0
  130. package/dist/webcomponents/{p-63e02d42.entry.js → p-32c553c4.entry.js} +1 -1
  131. package/dist/webcomponents/{p-adaa1c98.entry.js → p-3902016f.entry.js} +1 -1
  132. package/dist/webcomponents/{p-5be775e8.entry.js → p-43cba173.entry.js} +1 -1
  133. package/dist/webcomponents/{p-bd4d2924.entry.js → p-445cc319.entry.js} +1 -1
  134. package/dist/webcomponents/p-4791e1d5.entry.js +1 -0
  135. package/dist/webcomponents/p-4b291405.entry.js +1 -0
  136. package/dist/webcomponents/{p-b39c7414.entry.js → p-4d1b2975.entry.js} +1 -1
  137. package/dist/webcomponents/{p-e5feca94.entry.js → p-62ad58a0.entry.js} +1 -1
  138. package/dist/webcomponents/p-7b401cf3.entry.js +1 -0
  139. package/dist/webcomponents/{p-d19d7d41.entry.js → p-8bb301a0.entry.js} +1 -1
  140. package/dist/webcomponents/{p-abebb03c.entry.js → p-8ff641ef.entry.js} +1 -1
  141. package/dist/webcomponents/{p-9c4ac3c5.entry.js → p-921b0976.entry.js} +1 -1
  142. package/dist/webcomponents/{p-357d14ee.entry.js → p-9a6ce4ed.entry.js} +1 -1
  143. package/dist/webcomponents/{p-CEGSQXGU.js → p-B4ZUdQg4.js} +1 -1
  144. package/dist/webcomponents/{p-B6kC9tX2.js → p-B85aBmeH.js} +1 -1
  145. package/dist/webcomponents/{p-Bo7ndXwR.js → p-BTeWJbG_.js} +1 -1
  146. package/dist/webcomponents/{p-DF7oFWnO.js → p-But70V31.js} +1 -1
  147. package/dist/webcomponents/p-BzLTI5Dx.js +1 -0
  148. package/dist/webcomponents/{p-CRaiEpKf.js → p-C9sMQVpY.js} +1 -1
  149. package/dist/webcomponents/{p-C8J9uVEs.js → p-CSFjBLVs.js} +1 -1
  150. package/dist/webcomponents/{p-BKrZL95i.js → p-CaMgPHyw.js} +1 -1
  151. package/dist/webcomponents/{p-CEHwp4sh.js → p-CiVEIyOt.js} +1 -1
  152. package/dist/webcomponents/p-CkyOiDKD.js +1 -0
  153. package/dist/webcomponents/p-DTnmhThV.js +1 -0
  154. package/dist/webcomponents/p-Deobp59r.js +1 -0
  155. package/dist/webcomponents/{p-DCpGH4xL.js → p-DohdDWHF.js} +1 -1
  156. package/dist/webcomponents/{p-2b5533a1.entry.js → p-a65ab079.entry.js} +1 -1
  157. package/dist/webcomponents/{p-511bc0b2.entry.js → p-a6695920.entry.js} +1 -1
  158. package/dist/webcomponents/{p-a8f1c9b3.entry.js → p-ae41697b.entry.js} +1 -1
  159. package/dist/webcomponents/{p-deff4422.entry.js → p-aea1e9e4.entry.js} +1 -1
  160. package/dist/webcomponents/p-b013685d.entry.js +1 -0
  161. package/dist/webcomponents/{p-6bfdc443.entry.js → p-b54c0942.entry.js} +1 -1
  162. package/dist/webcomponents/{p-521c534c.entry.js → p-b699d24b.entry.js} +1 -1
  163. package/dist/webcomponents/{p-3d02cb78.entry.js → p-ba40fffb.entry.js} +1 -1
  164. package/dist/webcomponents/{p-2272a65b.entry.js → p-bebd8879.entry.js} +1 -1
  165. package/dist/webcomponents/{p-5331e011.entry.js → p-d3e734d2.entry.js} +1 -1
  166. package/dist/webcomponents/{p-91358854.entry.js → p-db854b84.entry.js} +1 -1
  167. package/dist/webcomponents/{p-06ed3518.entry.js → p-dc31825e.entry.js} +1 -1
  168. package/dist/webcomponents/{p-28fb6b50.entry.js → p-dec8952b.entry.js} +1 -1
  169. package/dist/webcomponents/{p-fd1718e0.entry.js → p-df32a424.entry.js} +1 -1
  170. package/dist/webcomponents/{p-a1ef7674.entry.js → p-e637a15b.entry.js} +1 -1
  171. package/dist/webcomponents/{p-b2b0303d.entry.js → p-e87da85d.entry.js} +1 -1
  172. package/dist/webcomponents/{p-d59d6c23.entry.js → p-f0195acf.entry.js} +1 -1
  173. package/dist/webcomponents/{p-ff67c8f7.entry.js → p-f5e14a09.entry.js} +1 -1
  174. package/dist/webcomponents/{p-9b930446.entry.js → p-feae3963.entry.js} +1 -1
  175. package/dist/webcomponents/webcomponents.esm.js +1 -1
  176. package/package.json +14 -14
  177. package/dist/cjs/styled-host-CW1WUnUq.js +0 -11
  178. package/dist/esm/styled-host-RvPhw8Gu.js +0 -9
  179. package/dist/webcomponents/p-05AWudQe.js +0 -1
  180. package/dist/webcomponents/p-4dabcfd6.entry.js +0 -1
  181. package/dist/webcomponents/p-51238f79.entry.js +0 -1
  182. package/dist/webcomponents/p-5e196140.entry.js +0 -1
  183. package/dist/webcomponents/p-80177bcb.entry.js +0 -1
  184. package/dist/webcomponents/p-CKL24GQA.js +0 -1
  185. package/dist/webcomponents/p-DEfLsy2W.js +0 -1
  186. package/dist/webcomponents/p-DhrQechy.js +0 -1
  187. package/dist/webcomponents/p-aba3b0dc.entry.js +0 -1
  188. package/dist/webcomponents/p-e75d1756.entry.js +0 -1
  189. package/dist/webcomponents/p-f2c99647.entry.js +0 -1
@@ -0,0 +1 @@
1
+ var r={version:"6.16.0"};export{r as p}
@@ -1 +1 @@
1
- import{w as n,c as o}from"./p-B4vLfYnZ.js";import{g as t}from"./p-Ds_P-dB8.js";import{p as a}from"./p-DhrQechy.js";const e=()=>{async function e(e){var s,i;const{authToken:r,endpoint:d,method:p,params:u,body:c,signal:h,headers:l}=e;await n();const m=`${o.apiOrigin}/v1/${d}`,f=u?`${m}?${new URLSearchParams(u)}`:m,y=await async function(n){return n?{Authorization:`Bearer ${n}`,"Idempotency-Key":t(),"Content-Type":"application/json","Justifi-Web-Component-Version":a.version}:{"Content-Type":"application/json","Justifi-Web-Component-Version":a.version}}(r),T=Object.assign(Object.assign({},y),l),g=await fetch(f,{method:p,headers:T,body:c,signal:h});if(!g)return void function(n){console.error(`Error fetching from ${n}`)}(f);if(204===g.status)return{};const b=await g.json().catch((()=>({})));if(!g.ok){const n=new Error((null===(s=null==b?void 0:b.error)||void 0===s?void 0:s.message)||("string"==typeof(null==b?void 0:b.error)?b.error:null)||(null==b?void 0:b.message)||`Request failed: ${g.status}`);throw n.code=null===(i=null==b?void 0:b.error)||void 0===i?void 0:i.code,n.status=g.status,n.body=b,n}return b}return{get:async function(n){const{authToken:o,endpoint:t,params:a,signal:s,headers:i}=n;return e({authToken:o,endpoint:t,method:"GET",params:a,signal:s,headers:i})},post:async function(n){const{authToken:o,endpoint:t,body:a,params:s,signal:i,headers:r}=n;return e({authToken:o,endpoint:t,method:"POST",params:s,body:JSON.stringify(a),signal:i,headers:r})},put:async function(n){const{authToken:o,endpoint:t,body:a,params:s,signal:i}=n;return e({authToken:o,endpoint:t,method:"PUT",params:s,body:JSON.stringify(a),signal:i})},patch:async function(n){const{authToken:o,endpoint:t,body:a,params:s,signal:i}=n;return e({authToken:o,endpoint:t,method:"PATCH",params:s,body:JSON.stringify(a),signal:i})},destroy:async function(n){const{authToken:o,endpoint:t,params:a,signal:s}=n;return e({authToken:o,endpoint:t,method:"DELETE",params:a,signal:s})}}};export{e as A}
1
+ import{w as n,c as o}from"./p-B4vLfYnZ.js";import{g as t}from"./p-Ds_P-dB8.js";import{p as a}from"./p-Deobp59r.js";const e=()=>{async function e(e){var s,i;const{authToken:r,endpoint:d,method:p,params:u,body:c,signal:h,headers:l}=e;await n();const m=`${o.apiOrigin}/v1/${d}`,f=u?`${m}?${new URLSearchParams(u)}`:m,y=await async function(n){return n?{Authorization:`Bearer ${n}`,"Idempotency-Key":t(),"Content-Type":"application/json","Justifi-Web-Component-Version":a.version}:{"Content-Type":"application/json","Justifi-Web-Component-Version":a.version}}(r),T=Object.assign(Object.assign({},y),l),g=await fetch(f,{method:p,headers:T,body:c,signal:h});if(!g)return void function(n){console.error(`Error fetching from ${n}`)}(f);if(204===g.status)return{};const b=await g.json().catch((()=>({})));if(!g.ok){const n=new Error((null===(s=null==b?void 0:b.error)||void 0===s?void 0:s.message)||("string"==typeof(null==b?void 0:b.error)?b.error:null)||(null==b?void 0:b.message)||`Request failed: ${g.status}`);throw n.code=null===(i=null==b?void 0:b.error)||void 0===i?void 0:i.code,n.status=g.status,n.body=b,n}return b}return{get:async function(n){const{authToken:o,endpoint:t,params:a,signal:s,headers:i}=n;return e({authToken:o,endpoint:t,method:"GET",params:a,signal:s,headers:i})},post:async function(n){const{authToken:o,endpoint:t,body:a,params:s,signal:i,headers:r}=n;return e({authToken:o,endpoint:t,method:"POST",params:s,body:JSON.stringify(a),signal:i,headers:r})},put:async function(n){const{authToken:o,endpoint:t,body:a,params:s,signal:i}=n;return e({authToken:o,endpoint:t,method:"PUT",params:s,body:JSON.stringify(a),signal:i})},patch:async function(n){const{authToken:o,endpoint:t,body:a,params:s,signal:i}=n;return e({authToken:o,endpoint:t,method:"PATCH",params:s,body:JSON.stringify(a),signal:i})},destroy:async function(n){const{authToken:o,endpoint:t,params:a,signal:s}=n;return e({authToken:o,endpoint:t,method:"DELETE",params:a,signal:s})}}};export{e as A}
@@ -1 +1 @@
1
- import{r as s,h as e}from"./p-CV0Pyo1O.js";import{S as t}from"./p-05AWudQe.js";import{S as r}from"./p-eBK-iWrz.js";import"./p-Bu7gdOaV.js";const i=class{constructor(e){s(this,e)}render(){return e(t,{key:"aae82594ed1833982d7bb06ea0808e56e06b11f8"},e(r,{key:"52c5680b1dc298b75646e5409b9c5c5b83f53eae",component:this.component,height:this.height,width:this.width,className:this.class,styles:this.customStyle}))}};export{i as justifi_skeleton}
1
+ import{r as s,h as e}from"./p-CV0Pyo1O.js";import{S as t}from"./p-DTnmhThV.js";import{S as r}from"./p-eBK-iWrz.js";import"./p-Bu7gdOaV.js";const i=class{constructor(e){s(this,e)}render(){return e(t,{key:"aae82594ed1833982d7bb06ea0808e56e06b11f8"},e(r,{key:"52c5680b1dc298b75646e5409b9c5c5b83f53eae",component:this.component,height:this.height,width:this.width,className:this.class,styles:this.customStyle}))}};export{i as justifi_skeleton}
@@ -1 +1 @@
1
- import{r as s,c as t,h as i}from"./p-CV0Pyo1O.js";import{D as e,C as r,b as o,h}from"./p-Dqxyi-uK.js";import{J as p}from"./p-CEHwp4sh.js";import{d as a}from"./p-DF7oFWnO.js";import{g as n,a as d}from"./p-BhpaUYtS.js";import{D as u,a as c}from"./p-B6kC9tX2.js";import{S as m}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import"./p-Ds_P-dB8.js";import"./p-HXpYMWUU.js";import"./p-DhrQechy.js";import"./p-DCpGH4xL.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";const f=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event",7),this.isLoading=!0,this.showDisputeResponseForm=!1,this.fetchDisputePending=!1}scheduleFetchDispute(){this.getDispute&&!this.fetchDisputePending&&(this.fetchDisputePending=!0,queueMicrotask((()=>{this.fetchDisputePending=!1,this.getDispute&&this.fetchData()})))}disputeResponseHandler(s){s.detail.name===u.respondToDispute&&(this.showDisputeResponseForm=!0),s.detail.name===u.cancelDispute&&(this.showDisputeResponseForm=!1)}disputeSubmittedHandler(){this.fetchData()}componentWillLoad(){a(),this.analytics=new p(this),this.initializeGetDispute()}componentDidLoad(){this.scheduleFetchDispute()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetDispute(),this.scheduleFetchDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:s,authToken:t,service:i})=>async({onSuccess:o,onError:h})=>{var p;try{const a=await i.fetchDispute(s,t);if(a.error)return h({error:d(a.error),code:n(null===(p=a.error)||void 0===p?void 0:p.code),severity:r.ERROR});{const s=Object.assign({},a.page_info);o({dispute:new e(a.data),pagingInfo:s})}}catch(s){const t=n(null==s?void 0:s.code);return h({error:s.message||s,code:t,severity:r.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new c}):this.errorEvent.emit({message:"Dispute ID and Auth Token are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}fetchData(){this.getDispute&&(this.isLoading=!0,this.getDispute({onSuccess:({dispute:s})=>{this.dispute=new e(s),this.isLoading=!1,this.dispute.status!==h.needsResponse&&(this.showDisputeResponseForm=!1)},onError:({error:s,code:t,severity:i})=>{this.errorEvent.emit({errorCode:t,message:s,severity:i}),this.isLoading=!1}}))}render(){return i(m,{key:"536b3342783fa8e51a46da6d44ec403ffdd39bcf"},i("div",{key:"b365ed8379080dbe949065e4c2101c288da498c5"},this.showDisputeResponseForm?i("dispute-response",{disputeId:this.disputeId,disputeResponse:this.dispute.dispute_response,authToken:this.authToken}):i("dispute-notification",{dispute:this.dispute,authToken:this.authToken,isLoading:this.isLoading})))}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_dispute_management}
1
+ import{r as s,c as t,h as i}from"./p-CV0Pyo1O.js";import{D as e,C as r,b as o,h}from"./p-Dqxyi-uK.js";import{J as p}from"./p-CiVEIyOt.js";import{d as a}from"./p-But70V31.js";import{g as n,a as d}from"./p-BhpaUYtS.js";import{D as u,a as c}from"./p-B85aBmeH.js";import{S as m}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import"./p-Ds_P-dB8.js";import"./p-HXpYMWUU.js";import"./p-Deobp59r.js";import"./p-DohdDWHF.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";const f=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event",7),this.isLoading=!0,this.showDisputeResponseForm=!1,this.fetchDisputePending=!1}scheduleFetchDispute(){this.getDispute&&!this.fetchDisputePending&&(this.fetchDisputePending=!0,queueMicrotask((()=>{this.fetchDisputePending=!1,this.getDispute&&this.fetchData()})))}disputeResponseHandler(s){s.detail.name===u.respondToDispute&&(this.showDisputeResponseForm=!0),s.detail.name===u.cancelDispute&&(this.showDisputeResponseForm=!1)}disputeSubmittedHandler(){this.fetchData()}componentWillLoad(){a(),this.analytics=new p(this),this.initializeGetDispute()}componentDidLoad(){this.scheduleFetchDispute()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetDispute(),this.scheduleFetchDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:s,authToken:t,service:i})=>async({onSuccess:o,onError:h})=>{var p;try{const a=await i.fetchDispute(s,t);if(a.error)return h({error:d(a.error),code:n(null===(p=a.error)||void 0===p?void 0:p.code),severity:r.ERROR});{const s=Object.assign({},a.page_info);o({dispute:new e(a.data),pagingInfo:s})}}catch(s){const t=n(null==s?void 0:s.code);return h({error:s.message||s,code:t,severity:r.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new c}):this.errorEvent.emit({message:"Dispute ID and Auth Token are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}fetchData(){this.getDispute&&(this.isLoading=!0,this.getDispute({onSuccess:({dispute:s})=>{this.dispute=new e(s),this.isLoading=!1,this.dispute.status!==h.needsResponse&&(this.showDisputeResponseForm=!1)},onError:({error:s,code:t,severity:i})=>{this.errorEvent.emit({errorCode:t,message:s,severity:i}),this.isLoading=!1}}))}render(){return i(m,{key:"536b3342783fa8e51a46da6d44ec403ffdd39bcf"},i("div",{key:"b365ed8379080dbe949065e4c2101c288da498c5"},this.showDisputeResponseForm?i("dispute-response",{disputeId:this.disputeId,disputeResponse:this.dispute.dispute_response,authToken:this.authToken}):i("dispute-notification",{dispute:this.dispute,authToken:this.authToken,isLoading:this.isLoading})))}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_dispute_management}
@@ -1 +1 @@
1
- import{r as e,h as a}from"./p-CV0Pyo1O.js";import{l as t}from"./p-OeJ-3w3l.js";import"./p-B4vLfYnZ.js";import{c as s,a as l}from"./p-Ds_P-dB8.js";import{I as d,a as i}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{f as c,p as r,c as o}from"./p-CArdj6i_.js";import{f,a as p}from"./p-Bu7gdOaV.js";import{S as b}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import"./p-BFTU3MAI.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";const u=class{constructor(a){e(this,a),this.setParamsOnChange=(e,a)=>{c[e]=a},this.handleDateInput=(e,a)=>{const t=s(a,{setExactTime:!0});this.setParamsOnChange(e,t)}}componentWillLoad(){this.debouncedSetParamsOnChange=t.debounce(this.setParamsOnChange,300),Object.entries({status:this.checkoutStatus,payment_mode:this.paymentMode,checkout_id:this.checkoutId,successful_payment_id:this.successfulPaymentId,created_after:this.createdAfter,created_before:this.createdBefore}).forEach((([e,a])=>{a&&(r[e]=a)}))}get checkoutStatusOptions(){return[{label:"All",value:""},{label:"Created",value:d.created},{label:"Completed",value:d.completed},{label:"Attempted",value:d.attempted},{label:"Expired",value:d.expired}]}get checkoutPaymentModeOptions(){return[{label:"All",value:""},{label:"E-commerce",value:i.ecom},{label:"BNPL",value:i.bnpl},{label:"Apple Pay",value:i.apple_pay},{label:"Paypal",value:i.paypal},{label:"Venmo",value:i.venmo}]}render(){const e=Object.assign({},c);return a(b,{key:"a84f587608b49683633b26d23e548b576c5daba3"},a("table-filters-menu",{key:"d7a43576bb803d706755ce9deafda5f8732540c1",params:e,clearParams:o,part:f},a("div",{key:"6ce5861f974a8d2c7bc5bcb03b7b0df60e10d780",class:"grid-cols-2 gap-3 p-1"},a("div",{key:"492714a0263fb27222e17794a640e3855c9ba6e1",class:"p-2"},a("form-control-text",{key:"357b10f4f290c9500fb5fe24e4bc97ea80511e2c",name:"checkout_id",label:"Checkout ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.checkoutId||c.checkout_id,disabled:!!this.checkoutId,part:p})),a("div",{key:"cc8535898de01f417080c984ed53f1582848fd74",class:"p-2"},a("form-control-text",{key:"37aa831598c6496af4fd358f94c54a118f309d82",name:"successful_payment_id",label:"Successful Payment ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.successfulPaymentId||c.successful_payment_id,disabled:!!this.successfulPaymentId,part:p})),a("div",{key:"751c3f3b60b0140b9eb954de3a0e94f5feb6075f",class:"p-2"},a("form-control-select",{key:"afa69abd4be56a27d0cafce1508a7edeb119d7b0",name:"status",label:"Status",options:this.checkoutStatusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.checkoutStatus||c.status||"",disabled:!!this.checkoutStatus,part:p})),a("div",{key:"86c4e7121a67e4ef1bb96fcb6ccbe9a900378556",class:"p-2"},a("form-control-select",{key:"eaa9e1b1214fb3955de0f0421760da4bf1a773a2",name:"payment_mode",label:"Payment Mode",options:this.checkoutPaymentModeOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentMode||c.payment_mode||"",disabled:!!this.paymentMode,part:p})),a("div",{key:"8f28caa07d711135223507f1864343531d451a15",class:"p-2"},a("form-control-date",{key:"038141b8b8fc669cca8c849d23cba1a7e2f1d5aa",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:l(this.createdAfter,{showInputDateTime:!0})||l(c.created_after,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdAfter,part:p})),a("div",{key:"ddb442863d596de25c392d14b8fb364db3afdaec",class:"p-2"},a("form-control-date",{key:"cee1d9337dd5f6f9c258892f89573a2b07c2180c",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:l(this.createdBefore,{showInputDateTime:!0})||l(c.created_before,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdBefore,part:p})))))}};export{u as justifi_checkouts_list_filters}
1
+ import{r as e,h as a}from"./p-CV0Pyo1O.js";import{l as t}from"./p-OeJ-3w3l.js";import"./p-B4vLfYnZ.js";import{c as s,a as l}from"./p-Ds_P-dB8.js";import{I as d,a as i}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{f as c,p as r,c as o}from"./p-CArdj6i_.js";import{f,a as p}from"./p-Bu7gdOaV.js";import{S as b}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import"./p-BFTU3MAI.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";const m=class{constructor(a){e(this,a),this.setParamsOnChange=(e,a)=>{c[e]=a},this.handleDateInput=(e,a)=>{const t=s(a,{setExactTime:!0});this.setParamsOnChange(e,t)}}componentWillLoad(){this.debouncedSetParamsOnChange=t.debounce(this.setParamsOnChange,300),Object.entries({status:this.checkoutStatus,payment_mode:this.paymentMode,checkout_id:this.checkoutId,successful_payment_id:this.successfulPaymentId,created_after:this.createdAfter,created_before:this.createdBefore}).forEach((([e,a])=>{a&&(r[e]=a)}))}get checkoutStatusOptions(){return[{label:"All",value:""},{label:"Created",value:d.created},{label:"Completed",value:d.completed},{label:"Attempted",value:d.attempted},{label:"Expired",value:d.expired}]}get checkoutPaymentModeOptions(){return[{label:"All",value:""},{label:"E-commerce",value:i.ecom},{label:"BNPL",value:i.bnpl},{label:"Apple Pay",value:i.apple_pay},{label:"Paypal",value:i.paypal},{label:"Venmo",value:i.venmo}]}render(){const e=Object.assign({},c);return a(b,{key:"a84f587608b49683633b26d23e548b576c5daba3"},a("table-filters-menu",{key:"d7a43576bb803d706755ce9deafda5f8732540c1",params:e,clearParams:o,part:f},a("div",{key:"6ce5861f974a8d2c7bc5bcb03b7b0df60e10d780",class:"grid-cols-2 gap-3 p-1"},a("div",{key:"492714a0263fb27222e17794a640e3855c9ba6e1",class:"p-2"},a("form-control-text",{key:"357b10f4f290c9500fb5fe24e4bc97ea80511e2c",name:"checkout_id",label:"Checkout ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.checkoutId||c.checkout_id,disabled:!!this.checkoutId,part:p})),a("div",{key:"cc8535898de01f417080c984ed53f1582848fd74",class:"p-2"},a("form-control-text",{key:"37aa831598c6496af4fd358f94c54a118f309d82",name:"successful_payment_id",label:"Successful Payment ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.successfulPaymentId||c.successful_payment_id,disabled:!!this.successfulPaymentId,part:p})),a("div",{key:"751c3f3b60b0140b9eb954de3a0e94f5feb6075f",class:"p-2"},a("form-control-select",{key:"afa69abd4be56a27d0cafce1508a7edeb119d7b0",name:"status",label:"Status",options:this.checkoutStatusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.checkoutStatus||c.status||"",disabled:!!this.checkoutStatus,part:p})),a("div",{key:"86c4e7121a67e4ef1bb96fcb6ccbe9a900378556",class:"p-2"},a("form-control-select",{key:"eaa9e1b1214fb3955de0f0421760da4bf1a773a2",name:"payment_mode",label:"Payment Mode",options:this.checkoutPaymentModeOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentMode||c.payment_mode||"",disabled:!!this.paymentMode,part:p})),a("div",{key:"8f28caa07d711135223507f1864343531d451a15",class:"p-2"},a("form-control-date",{key:"038141b8b8fc669cca8c849d23cba1a7e2f1d5aa",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:l(this.createdAfter,{showInputDateTime:!0})||l(c.created_after,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdAfter,part:p})),a("div",{key:"ddb442863d596de25c392d14b8fb364db3afdaec",class:"p-2"},a("form-control-date",{key:"cee1d9337dd5f6f9c258892f89573a2b07c2180c",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:l(this.createdBefore,{showInputDateTime:!0})||l(c.created_before,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdBefore,part:p})))))}};export{m as justifi_checkouts_list_filters}
@@ -1 +1 @@
1
- import{r,h as i}from"./p-CV0Pyo1O.js";import{S as s}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";const a=class{constructor(i){r(this,i)}async getValues(){var r,i;return null!==(i=null===(r=this.cardBillingFormSimpleRef)||void 0===r?void 0:r.getValues())&&void 0!==i?i:{}}async validate(){var r,i;return null!==(i=null===(r=this.cardBillingFormSimpleRef)||void 0===r?void 0:r.validate())&&void 0!==i?i:{isValid:!1,errors:{}}}render(){return i(s,{key:"f8cdac6b006bbaf15d7e6b92db8f781afa40899f"},i("card-billing-form-simple",{key:"b0973b5459109da5eac937fd0aefbff1c924924c",legend:this.legend,ref:r=>this.cardBillingFormSimpleRef=r}))}};export{a as justifi_card_billing_form_simple}
1
+ import{r,h as i}from"./p-CV0Pyo1O.js";import{S as s}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";const a=class{constructor(i){r(this,i)}async getValues(){var r,i;return null!==(i=null===(r=this.cardBillingFormSimpleRef)||void 0===r?void 0:r.getValues())&&void 0!==i?i:{}}async validate(){var r,i;return null!==(i=null===(r=this.cardBillingFormSimpleRef)||void 0===r?void 0:r.validate())&&void 0!==i?i:{isValid:!1,errors:{}}}render(){return i(s,{key:"f8cdac6b006bbaf15d7e6b92db8f781afa40899f"},i("card-billing-form-simple",{key:"b0973b5459109da5eac937fd0aefbff1c924924c",legend:this.legend,ref:r=>this.cardBillingFormSimpleRef=r}))}};export{a as justifi_card_billing_form_simple}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as i,H as s,g as a}from"./p-CV0Pyo1O.js";import{A as n}from"./p-DohdDWHF.js";import{A as o,r,s as l,t as h,u as d,v as c,w as p,C as u,b as y,c as m,I as v,x as f,y as b,z as g}from"./p-Dqxyi-uK.js";import{S as k}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import{S as P}from"./p-eBK-iWrz.js";import{c as w,o as C,a as L,g as E,b as A}from"./p-FsWkrvEF.js";import{t as S,B as _,x as M,z as j,r as I}from"./p-Bu7gdOaV.js";import{f as R}from"./p-Ds_P-dB8.js";import{w as T,c as O}from"./p-B4vLfYnZ.js";import{H as N}from"./p-CZk3i5Tu.js";import{H as x,b as z,h as D,i as B}from"./p-x2oNTAWh.js";import{H as F}from"./p-BAB1lPu0.js";import{J as V}from"./p-CiVEIyOt.js";import{d as U}from"./p-But70V31.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{m as H,a as Z}from"./p-D7nyPi2Q.js";import{C as q}from"./p-CaMgPHyw.js";import{P as W}from"./p-BzLTI5Dx.js";import{P as G,a as Y,b as K}from"./p-DEx8fQeW.js";import{C as $}from"./p-ZpPDShvP.js";import"./p-Deobp59r.js";import"./p-DgTOxu8x.js";import"./p-BhpaUYtS.js";const J=class{constructor(i){t(this,i),this.radioClick=e(this,"radio-click",7),this.checked=!1,this.hidden=!1}render(){return i(k,{key:"02955940079320bd9c6bf94e239545385ac36458"},i("radio-list-item",{key:"fc6b98e456e4326b843b2b3248b7327436767cf4",name:this.name,value:this.value,label:this.label,checked:this.checked,hidden:this.hidden,class:this.class,"onRadio-click":t=>this.radioClick.emit(t.detail)}))}};var Q;!function(t){t.UNAVAILABLE="UNAVAILABLE",t.SESSION_ERROR="SESSION_ERROR",t.MERCHANT_VALIDATION_ERROR="MERCHANT_VALIDATION_ERROR",t.PAYMENT_PROCESSING_ERROR="PAYMENT_PROCESSING_ERROR",t.USER_CANCELLED="USER_CANCELLED"}(Q||(Q={}));class X{constructor(){this.api=n()}initialize(t){if(this.applePayConfig=new o(t),!this.applePayConfig.isValid)throw new Error("Invalid Apple Pay configuration provided")}async validateMerchant(t,e){try{return await this.api.post({endpoint:"apple_pay/merchant_session",authToken:t,headers:{"Sub-Account":e},body:{domain:window.location.hostname,display_name:this.applePayConfig.displayName}})}catch(t){throw console.error("Backend validation failed:",t),new Error("Merchant validation failed")}}async processPayment(t,e,i){const s=await this.api.post({endpoint:"apple_pay/process_token",authToken:t,body:i,headers:{"Sub-Account":e}});return{success:s.id&&!!s.data.token,data:s}}isAvailable(){return r.isApplePaySupported()&&r.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await r.canMakePaymentsWithActiveCard(this.applePayConfig.merchantIdentifier)}async startPaymentSession(t,e,i){if(!this.applePayConfig)throw console.error("[ApplePayService] Missing applePayConfig. Did you call initialize()?"),new Error("Apple Pay not initialized. Call initialize() first.");const s=new l(t);if(!s.isValid){const t=[];throw s.countryCode||t.push("countryCode"),s.currencyCode||t.push("currencyCode"),s.merchantCapabilities&&0!==s.merchantCapabilities.length||t.push("merchantCapabilities"),s.supportedNetworks&&0!==s.supportedNetworks.length||t.push("supportedNetworks"),s.total&&s.total.label&&s.total.amount||t.push("total"),console.error("[ApplePayService] Payment request is invalid. Missing/invalid:",t),new Error("Invalid payment request provided")}return this.currentPaymentRequest=s,new Promise(((t,a)=>{try{if("undefined"==typeof window||!("ApplePaySession"in window))return console.error("[ApplePayService] ApplePaySession not available on window"),a({success:!1,error:{code:Q.UNAVAILABLE,message:"ApplePaySession API is not available in this environment"}});this.currentSession=new window.ApplePaySession(3,s),this.setupSessionEventHandlers(t,a,e,i),this.currentSession.begin()}catch(t){console.error("[ApplePayService] Exception while starting session:",t),a({success:!1,error:{code:Q.SESSION_ERROR,message:t instanceof Error?t.message:"Failed to start Apple Pay session"}})}}))}abortPaymentSession(){this.currentSession&&(this.currentSession.abort(),this.currentSession=void 0,this.currentPaymentRequest=void 0)}setupSessionEventHandlers(t,e,i,s){this.currentSession&&this.applePayConfig&&this.currentPaymentRequest?(this.currentSession.onvalidatemerchant=async()=>{try{if(!i)throw console.error("[ApplePayService] Missing authToken for merchant validation"),new Error("Authentication token not provided.");const t=await this.validateMerchant(i,s);try{this.currentSession.completeMerchantValidation(t)}catch(t){throw console.error("Error calling completeMerchantValidation:",t),t}}catch(t){console.error("=== MERCHANT VALIDATION ERROR ==="),console.error("Error during merchant validation:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.abort(),e({success:!1,error:{code:Q.MERCHANT_VALIDATION_ERROR,message:t instanceof Error?t.message:"Merchant validation failed"}})}},this.currentSession.onpaymentauthorized=async a=>{try{const n=a.payment,o=Object.assign(Object.assign({},n.token),{product_details:{name:this.currentPaymentRequest.total.label,price:r.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),l=await this.processPayment(i,s,o);l.success?(this.currentSession.completePayment({status:h.STATUS_SUCCESS}),t({success:!0,token:n.token,paymentMethodId:l.data.id})):(console.error("PSP reported payment failure:",l.data),this.currentSession.completePayment({status:h.STATUS_FAILURE}),e({success:!1,error:{code:Q.PAYMENT_PROCESSING_ERROR,message:"Payment processing failed"}}))}catch(t){console.error("=== PAYMENT PROCESSING ERROR ==="),console.error("Error processing payment:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.completePayment({status:h.STATUS_FAILURE}),e({success:!1,error:{code:Q.PAYMENT_PROCESSING_ERROR,message:t instanceof Error?t.message:"Payment processing failed"}})}finally{this.currentSession=void 0,this.currentPaymentRequest=void 0}},this.currentSession.onpaymentmethodselected=()=>{const t={newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]};try{this.currentSession.completePaymentMethodSelection(t)}catch(t){console.error("Error completing payment method selection:",t),this.currentSession.abort()}},this.currentSession.onshippingmethodselected=()=>{this.currentSession.completeShippingMethodSelection({status:h.STATUS_SUCCESS,newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]})},this.currentSession.oncancel=t=>{if(t.sessionError)switch(console.error(t.sessionError),t.sessionError.code){case"unknown":console.error("Unknown error - likely merchant validation issue"),console.error("This usually means:"),console.error("1. Merchant certificate is invalid or expired"),console.error("2. Merchant identifier mismatch"),console.error("3. Backend validation endpoint issues");break;case"invalidMerchantSession":console.error("Invalid merchant session provided"),console.error("Check that the merchant session from backend is valid");break;case"userCancel":console.error("User cancelled the payment");break;default:console.error("Other error code:",t.sessionError.code)}this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:Q.USER_CANCELLED,message:"User cancelled the Apple Pay session"}})},"onerror"in this.currentSession&&(this.currentSession.onerror=t=>{console.error("=== APPLE PAY SESSION ERROR ==="),console.error("Session error:",t),this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:Q.SESSION_ERROR,message:"Apple Pay session error occurred"}})})):console.error("[ApplePayService] setupSessionEventHandlers called without required state",{hasSession:Boolean(this.currentSession),hasConfig:Boolean(this.applePayConfig),hasPaymentRequest:Boolean(this.currentPaymentRequest)})}static createPaymentRequest(t,e,i="US",s="USD"){return{countryCode:i,currencyCode:s,merchantCapabilities:r.getDefaultMerchantCapabilities(),supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const tt=t=>{const{isLoading:e}=t;return e?i("div",{class:"container-fluid p-0"},i("div",{class:"row mb-3"},i("div",{class:"col-12 align-content-center"},i(P,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null},et=t=>i("div",{class:"apple-pay-button-container"},i("button",Object.assign({class:(()=>{let e="apple-pay-button";switch(t.buttonStyle){case d.WHITE:e+=" apple-pay-button-white";break;case d.WHITE_OUTLINE:e+=" apple-pay-button-white-outline";break;default:e+=" apple-pay-button-black"}switch(t.buttonType){case c.BUY:e+=" apple-pay-button-type-buy";break;case c.DONATE:e+=" apple-pay-button-type-donate";break;default:e+=" apple-pay-button-type-plain"}return(t.disabled||t.isProcessing||!t.isAvailable)&&(e+=" disabled"),e})(),style:{width:t.width,height:t.height},onClick:()=>{!t.disabled&&!t.isProcessing&&t.isAvailable&&t.clickHandler&&t.clickHandler()},disabled:t.disabled||t.isProcessing||!t.isAvailable,"aria-label":"Pay with Apple Pay",type:"button"},t),t.isProcessing&&i("div",{class:"processing-overlay"},i("div",{class:"spinner"}),i("span",null,"Processing..."))),i("style",null,"\n .apple-pay-button-container {\n display: block;\n position: relative;\n width: 100%;\n }\n\n /* Apple Pay CSS classes - these are the official Apple Pay button styles */\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: plain; /* default */\n -apple-pay-button-style: black; /* default */\n border-radius: 8px;\n cursor: pointer;\n border: none;\n outline: none;\n transition: opacity 0.2s ease;\n position: relative;\n }\n\n /* Button styles */\n .apple-pay-button.apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n\n .apple-pay-button.apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n\n .apple-pay-button.apple-pay-button-white-outline {\n -apple-pay-button-style: white-outline;\n }\n\n /* Button types */\n .apple-pay-button.apple-pay-button-type-plain {\n -apple-pay-button-type: plain;\n }\n\n .apple-pay-button.apple-pay-button-type-buy {\n -apple-pay-button-type: buy;\n }\n\n .apple-pay-button.apple-pay-button-type-donate {\n -apple-pay-button-type: donate;\n }\n\n /* Hover and disabled states */\n .apple-pay-button:hover:not(.disabled) {\n opacity: 0.9;\n }\n\n .apple-pay-button.disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Processing overlay */\n .processing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: rgba(0, 0, 0, 0.8);\n color: white;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n }\n\n .spinner {\n width: 16px;\n height: 16px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-top: 2px solid #fff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n /* Responsive design */\n @media (max-width: 480px) {\n .apple-pay-button {\n width: 100% !important;\n min-width: 200px;\n }\n }\n ")),it=class{constructor(i){t(this,i),this.applePayStarted=e(this,"applePayStarted",7),this.applePayCompleted=e(this,"applePayCompleted",7),this.applePayCancelled=e(this,"applePayCancelled",7),this.applePayError=e(this,"applePayError",7),this.sdkLoaded=!1,this.countryCode="US",this.merchantIdentifier="merchant.com.staging-justifi.checkout-dev",this.merchantDisplayName="JustiFi Checkout",this.initiativeContext="dev-checkout.justifi-staging.com",this.buttonType=c.PLAIN,this.buttonStyle=d.BLACK,this.disabled=!1,this.width="100%",this.height="48px",this.isLoading=!0,this.isProcessing=!1,this.isAvailable=!1,this.canMakePayments=!1,this.isConfigValid=!0,this.error=null,this.handleApplePayClick=async()=>{var t,e,i;if(!this.isProcessing&&!this.disabled&&this.isAvailable)try{this.isProcessing=!0,this.error=null,this.applePayStarted.emit();const i={countryCode:this.countryCodeForCurrency(w.paymentCurrency),currencyCode:w.paymentCurrency,merchantCapabilities:[p.SUPPORTS_3DS,p.SUPPORTS_CREDIT,p.SUPPORTS_DEBIT],supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(w.paymentDescription,w.paymentAmount)},s=await this.applePayService.startPaymentSession(i,w.authToken,w.accountId);s.success?this.applePayCompleted.emit({success:!0,token:s.token,paymentMethodId:s.paymentMethodId}):(this.applePayCompleted.emit({success:!1,error:s.error}),this.applePayError.emit({error:(null===(t=s.error)||void 0===t?void 0:t.message)||"Payment failed",code:(null===(e=s.error)||void 0===e?void 0:e.code)||it.ErrorCode.PAYMENT_FAILED}))}catch(t){if((null===(i=null==t?void 0:t.error)||void 0===i?void 0:i.code)===Q.USER_CANCELLED)this.applePayCancelled.emit();else{const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e,code:it.ErrorCode.PAYMENT_FAILED}),this.applePayCompleted.emit({success:!1,error:e})}}finally{this.isProcessing=!1}}}componentWillLoad(){this.isAvailable=r.isApplePaySupported(),this.isAvailable?w.checkoutLoaded?this.loadApplePaySDK():C("checkoutLoaded",(t=>{t&&this.loadApplePaySDK()})):this.isLoading=!1}countryCodeForCurrency(t){return"cad"==t.toLowerCase()?"CA":"US"}loadApplePaySDK(){if(this.sdkLoaded)return;this.sdkLoaded=!0;const t=document.createElement("script");t.src="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",t.async=!0,t.onload=()=>this.initializeApplePay(),document.head.appendChild(t)}async initializeApplePay(){try{if(this.isLoading=!0,this.error=null,this.isConfigValid=!0,!(Boolean(w.paymentAmount)&&Boolean(w.paymentCurrency)&&Boolean(w.authToken)))return this.error="Missing required Apple Pay configuration",this.isConfigValid=!1,this.applePayError.emit({error:this.error,code:it.ErrorCode.CONFIG_ERROR}),void(this.isLoading=!1);if(this.isAvailable=r.isApplePaySupported(),this.canMakePayments=r.canMakePayments(),!this.isAvailable)return this.error="Apple Pay is not supported on this device",this.applePayError.emit({error:this.error,code:it.ErrorCode.NOT_SUPPORTED}),void(this.isLoading=!1);if(!this.canMakePayments)return this.error="Apple Pay is not available",this.applePayError.emit({error:this.error,code:it.ErrorCode.NOT_AVAILABLE}),void(this.isLoading=!1);const t={merchantIdentifier:this.merchantIdentifier,displayName:this.merchantDisplayName,initiative:"web",initiativeContext:this.initiativeContext,buttonType:this.buttonType,buttonStyle:this.buttonStyle};this.applePayService=new X,this.applePayService.initialize(t),await this.applePayService.canMakePaymentsWithActiveCard()||console.warn("No Apple Pay cards available, but continuing...")}catch(t){this.error=t instanceof Error?t.message:"Failed to initialize Apple Pay",this.applePayError.emit({error:this.error,code:it.ErrorCode.INITIALIZATION_ERROR})}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?r.getDefaultSupportedNetworks():[]}async abort(){var t;null===(t=this.applePayService)||void 0===t||t.abortPaymentSession(),this.isProcessing=!1,this.applePayCancelled.emit()}render(){if(!w.applePayEnabled)return null;if(!this.isAvailable)return null;const t=!this.isLoading&&this.isAvailable&&this.canMakePayments&&this.isConfigValid;return i(k,null,i("div",{class:"apple-pay-container"},i(tt,{isLoading:this.isLoading}),t&&i(et,{buttonType:this.buttonType,buttonStyle:this.buttonStyle,disabled:this.disabled,isProcessing:this.isProcessing,isAvailable:this.isAvailable,clickHandler:this.handleApplePayClick,width:this.width,height:this.height})),i("style",null,"\n .apple-pay-container {\n width: 100%;\n }\n "))}};it.ErrorCode={CONFIG_ERROR:"CONFIG_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",NOT_AVAILABLE:"NOT_AVAILABLE",INITIALIZATION_ERROR:"INITIALIZATION_ERROR",PAYMENT_FAILED:"PAYMENT_FAILED"};const st=class{constructor(e){t(this,e),this.variant="primary",this.type="button"}render(){return i(k,{key:"1e09a302d064e2e4a860dc4efd9eb9693d4d0055"},i("internal-button",{key:"9ce7819853789c44860de43f26632c62415ebdb5",text:this.text,variant:this.variant,isLoading:this.isLoading,clickHandler:this.clickHandler,type:this.type,disabled:this.disabled,class:this.class,customStyle:this.customStyle,hidden:this.hidden}))}},at=class{constructor(e){t(this,e)}render(){return i(k,{key:"13d0570e2bdb79d842f9c0a17c7403963ea167c8"},i("section",{key:"c15f36caa2a9ebb66c7f0a16393926b643f1bc3b"},i("div",{key:"1e4e5d32cebb57ceaeb3786a29a9e08c8e83ac80"},i("div",{key:"42ff5c6ef33654a88858e8ed48e230dd674d1953",part:S},null==w?void 0:w.paymentDescription),i("div",{key:"c21d5eb012664efdd71e82bf24a88d0fefedad8c"},i("span",{key:"a8876afe5d7e993077ed8c4fb140c745d98e9196",part:S},"Total")," ",i("span",{key:"b81156e9f9240656b51f6ed374db9878bb3137c9",part:S},R(+(null==w?void 0:w.totalAmount)))))))}},nt=t=>{const{isLoading:e}=t;return e?i("div",{class:"container-fluid p-0"},i("div",{class:"row mb-3"},i("div",{class:"col-12 align-content-center"},i(P,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null};var ot;!function(t){t.initialize="justifi.googlePay.initialize",t.ready="justifi.googlePay.ready",t.sdkLoaded="justifi.googlePay.sdkLoaded",t.initializeResult="justifi.googlePay.initializeResult",t.error="justifi.googlePay.error",t.buttonClicked="justifi.googlePay.buttonClicked",t.startPayment="justifi.googlePay.startPayment",t.paymentSuccess="justifi.googlePay.paymentSuccess",t.paymentCanceled="justifi.googlePay.paymentCanceled",t.paymentError="justifi.googlePay.paymentError"}(ot||(ot={}));const rt=class{constructor(i){t(this,i),this.googlePayStarted=e(this,"googlePayStarted",7),this.googlePayCompleted=e(this,"googlePayCompleted",7),this.googlePayCancelled=e(this,"googlePayCancelled",7),this.merchantDisplayName="JustiFi Checkout",this.useNativePaymentRequest=!1,this.iframeReady=!1,this.sdkLoaded=!1,this.isReadyToPay=!1,this.handleMessage=t=>{if(t.origin!==this.iframeOrigin)return;const{eventType:e,data:i}=t.data||{};switch(e){case ot.ready:this.iframeReady=!0;break;case ot.sdkLoaded:this.sdkLoaded=!0,this.sendInitialize();break;case ot.initializeResult:this.isReadyToPay=i.isReadyToPay,i.error&&console.error("Init error:",i.error);break;case ot.error:console.error("Google Pay error:",i);break;case ot.buttonClicked:this.googlePayStarted.emit(),this.sendStartPayment();break;case ot.paymentSuccess:this.googlePayCompleted.emit({success:!0,paymentMethodId:i.paymentMethodId,cardNetwork:i.cardNetwork,cardDetails:i.cardDetails});break;case ot.paymentCanceled:this.googlePayCancelled.emit();break;case ot.paymentError:this.googlePayCompleted.emit({success:!1,error:{code:i.code,message:i.message}})}}}async componentWillLoad(){await T(),this.iframeOrigin=O.iframeOrigin}componentDidLoad(){window.addEventListener("message",this.handleMessage)}disconnectedCallback(){window.removeEventListener("message",this.handleMessage)}googlePayEnvironment(){return void 0!==this.environment?this.environment:"test"===w.checkoutMode?"TEST":"PRODUCTION"}sendInitialize(){var t;if(!(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow))return;const e={environment:this.googlePayEnvironment(),gatewayMerchantId:w.accountId,merchantName:this.merchantDisplayName,authToken:w.authToken,accountId:w.accountId,useNativePaymentRequest:this.useNativePaymentRequest};this.iframeElement.contentWindow.postMessage({eventType:ot.initialize,data:e},this.iframeOrigin)}sendStartPayment(){var t;if(!(null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow))return;const e={totalPrice:String(w.paymentAmount/100),totalPriceStatus:"FINAL",currencyCode:w.paymentCurrency||"USD"};this.iframeElement.contentWindow.postMessage({eventType:ot.startPayment,data:e},this.iframeOrigin)}render(){return w.checkoutLoaded?w.googlePayEnabled?i(s,null,i(nt,{isLoading:!this.isReadyToPay}),i("iframe",{ref:t=>this.iframeElement=t,src:`${this.iframeOrigin}/v2/googlePay`,allow:"payment",style:{border:"none",width:"100%",height:"48px",display:this.isReadyToPay?"block":"none"}})):(console.warn("Google Pay is not enabled for this checkout"),null):null}},lt=class{constructor(e){t(this,e),this.levels={h1:N,h2:x,h3:F},this.level="h1"}render(){return i(k,{key:"1843adabddf7d439036f8ce6f55627b7ca3e4a9f"},i(this.levels[this.level],{key:"b16e5624ce7e092cc8c144a7cdfd9cb6afdf7a83",text:this.text,class:this.class}))}},ht=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event",7),this.submitEvent=e(this,"submit-event",7),this.checkoutChangedEvent=e(this,"checkout-changed",7),this.plaidService=new W,this.maskCardNumber=!1,this.handlePaypalStarted=()=>{w.isWalletProcessing=!0},this.handlePaypalCompleted=t=>{const{success:e,paymentMethodId:i,fundingSource:s}=t.detail||{};w.isWalletProcessing=!1,e&&i?(w.paymentToken=i,w.selectedPaymentMethod={type:"venmo"===s?G.VENMO:G.PAYPAL},this.submitCheckout()):this.errorEvent.emit({message:"Paypal payment failed",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR})},this.handlePaypalCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0},this.handlePaypalError=t=>{w.isWalletProcessing=!1;const{error:e,code:i}=t.detail||{};this.errorEvent.emit({message:e||"Paypal error occurred",errorCode:`PAYPAL_${i}`,severity:u.ERROR})},this.handleApplePayStarted=()=>{w.isWalletProcessing=!0},this.handleGooglePayStarted=()=>{w.isWalletProcessing=!0},this.handleGooglePayCompleted=t=>{const{success:e,paymentMethodId:i,error:s}=t.detail||{};e&&i?(w.isWalletProcessing=!1,w.paymentToken=i,w.selectedPaymentMethod={type:G.GOOGLE_PAY},this.submitCheckout()):(w.isWalletProcessing=!1,this.errorEvent.emit({message:s&&s.message||"Google Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR}))},this.handleGooglePayCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0},this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:a}=t.detail;e&&i?(w.isWalletProcessing=!1,w.paymentToken=s,w.selectedPaymentMethod={type:G.APPLE_PAY},this.submitCheckout()):(w.isWalletProcessing=!1,console.error("Apple Pay completed but failed:",a),this.errorEvent.emit({message:(null==a?void 0:a.message)||"Apple Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR}))},this.handleApplePayError=t=>{w.isWalletProcessing=!1;const{error:e,code:i}=t.detail;console.error("Apple Pay error:",e),this.errorEvent.emit({message:e||"Apple Pay error occurred",errorCode:`APPLE_PAY_${i}`,severity:u.ERROR})},this.handleApplePayCancelled=()=>{w.isWalletProcessing=!1,w.paymentToken=void 0,w.selectedPaymentMethod=void 0}}maskCardNumberChanged(){w.maskCardNumber=!!this.maskCardNumber}connectedCallback(){var t;this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners(),this.setupPaypalListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),w.checkoutId=this.checkoutId,w.maskCardNumber=!!this.maskCardNumber;const e={authToken:this.authToken,checkoutId:this.checkoutId,service:new q};this.getCheckout=H(e),this.completeCheckout=Z(e),null===(t=this.unsubscribeCheckoutChanges)||void 0===t||t.call(this),this.unsubscribeCheckoutChanges=L((()=>{this.emitCheckoutChanged()}))}componentWillLoad(){this.analytics=new V(this),U(),w.authToken=this.authToken,this.fetchCheckout(),z("set",(t=>{const e=B[t];void 0!==e&&D(t,e)&&this.fetchCheckout()}))}componentDidLoad(){this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners(),this.setupPaypalListeners()}disconnectedCallback(){var t,e;null===(t=this.unsubscribeCheckoutChanges)||void 0===t||t.call(this),this.unsubscribeCheckoutChanges=void 0,null===(e=this.observer)||void 0===e||e.disconnect(),this.removeApplePayListeners(),this.removeGooglePayListeners(),this.removePaypalListeners()}fetchCheckout(){this.authToken&&this.checkoutId?this.getCheckout&&this.getCheckout({onSuccess:({checkout:t})=>{this.updateStore(t),t.status!==v.completed?t.status!==v.expired||this.errorEvent.emit({message:m.CHECKOUT_EXPIRED,errorCode:y.CHECKOUT_EXPIRED,severity:u.ERROR}):this.errorEvent.emit({message:m.CHECKOUT_ALREADY_COMPLETED,errorCode:y.CHECKOUT_ALREADY_COMPLETED,severity:u.ERROR})},onError:({error:t,code:e,severity:i})=>{this.errorEvent.emit({message:t,errorCode:e,severity:i})}}):this.errorEvent.emit({message:m.NOT_AUTHENTICATED,errorCode:y.NOT_AUTHENTICATED,severity:u.ERROR})}updateStore(t){var e,i,s,a,n,o,r,l,h,d,c,p,u,y,m;w.accountId=t.account_id;const v=null!=t.mode?String(t.mode).toLowerCase():"";w.checkoutMode="test"===v?"test":"live"===v?"live":null;const f=t.payment_methods.map((t=>new Y(t))),b=Boolean(null===(e=t.payment_settings)||void 0===e?void 0:e.ach_payments);w.paymentMethods=f.filter((t=>t.type!==G.SAVED_BANK_ACCOUNT||b)),w.paymentMethodGroupId=t.payment_method_group_id,w.paymentDescription=t.payment_description,w.totalAmount=t.total_amount,w.paymentAmount=t.payment_amount,w.bnplEnabled=t.payment_settings.bnpl_payments,w.insuranceEnabled=null!==(i=t.payment_settings.insurance_payments)&&void 0!==i&&i,w.bankAccountVerification=null===(s=t.payment_settings)||void 0===s?void 0:s.bank_account_verification,w.applePayEnabled=null!==(n=null===(a=t.payment_settings)||void 0===a?void 0:a.apple_payments)&&void 0!==n&&n,w.googlePayEnabled=null!==(r=null===(o=t.payment_settings)||void 0===o?void 0:o.google_payments)&&void 0!==r&&r,w.paypalEnabled=null!==(h=null===(l=t.payment_settings)||void 0===l?void 0:l.paypal_payments)&&void 0!==h&&h,w.paypalProviderClientId=null!==(c=null===(d=t.paypal)||void 0===d?void 0:d.provider_client_id)&&void 0!==c?c:"",w.achPaymentsEnabled=b,w.bnplProviderClientId=null===(p=null==t?void 0:t.bnpl)||void 0===p?void 0:p.provider_client_id,w.bnplProviderMode=null===(u=null==t?void 0:t.bnpl)||void 0===u?void 0:u.provider_mode,w.bnplProviderApiVersion=null===(y=null==t?void 0:t.bnpl)||void 0===y?void 0:y.provider_api_version,w.bnplProviderCheckoutUrl=null===(m=null==t?void 0:t.bnpl)||void 0===m?void 0:m.provider_checkout_url,w.paymentCurrency=(t.payment_currency||w.paymentCurrency).toUpperCase(),w.checkoutLoaded=!0}emitCheckoutChanged(){const t={availablePaymentMethodTypes:E(),selectedPaymentMethod:w.selectedPaymentMethod,savedPaymentMethods:w.paymentMethods};this.checkoutChangedEvent.emit(t)}queryFormRefs(){if(this.billingFormRef=this.hostEl.querySelector("justifi-billing-form, justifi-bank-account-billing-form-simple, justifi-card-billing-form-simple, justifi-billing-form-full, justifi-tokenize-payment-method"),this.applePayRef=this.hostEl.querySelector("justifi-apple-pay"),this.googlePayRef=this.hostEl.querySelector("justifi-google-pay"),this.paypalRef=this.hostEl.querySelector("justifi-paypal"),this.paymentMethodFormRef=this.hostEl.querySelector("justifi-card-form, justifi-bank-account-form, justifi-tokenize-payment-method"),!w.selectedPaymentMethod&&this.paymentMethodFormRef){const t=this.paymentMethodFormRef.tagName.toLowerCase();"justifi-card-form"===t?w.selectedPaymentMethod={type:G.NEW_CARD}:"justifi-bank-account-form"!==t||w.checkoutLoaded&&!w.achPaymentsEnabled||(w.selectedPaymentMethod={type:G.NEW_BANK_ACCOUNT})}this.insuranceFormRef=this.hostEl.querySelector("justifi-season-interruption-insurance")}setupApplePayListeners(){this.applePayRef&&(this.applePayRef.addEventListener("applePayStarted",this.handleApplePayStarted),this.applePayRef.addEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.addEventListener("applePayError",this.handleApplePayError),this.applePayRef.addEventListener("applePayCancelled",this.handleApplePayCancelled))}removeApplePayListeners(){this.applePayRef&&(this.applePayRef.removeEventListener("applePayStarted",this.handleApplePayStarted),this.applePayRef.removeEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.removeEventListener("applePayError",this.handleApplePayError),this.applePayRef.removeEventListener("applePayCancelled",this.handleApplePayCancelled))}setupGooglePayListeners(){this.googlePayRef&&(this.googlePayRef.addEventListener("googlePayStarted",this.handleGooglePayStarted),this.googlePayRef.addEventListener("googlePayCompleted",this.handleGooglePayCompleted),this.googlePayRef.addEventListener("googlePayCancelled",this.handleGooglePayCancelled))}removeGooglePayListeners(){this.googlePayRef&&(this.googlePayRef.removeEventListener("googlePayStarted",this.handleGooglePayStarted),this.googlePayRef.removeEventListener("googlePayCompleted",this.handleGooglePayCompleted),this.googlePayRef.removeEventListener("googlePayCancelled",this.handleGooglePayCancelled))}setupPaypalListeners(){this.paypalRef&&(this.paypalRef.addEventListener("paypalStarted",this.handlePaypalStarted),this.paypalRef.addEventListener("paypalCompleted",this.handlePaypalCompleted),this.paypalRef.addEventListener("paypalCancelled",this.handlePaypalCancelled),this.paypalRef.addEventListener("paypalError",this.handlePaypalError))}removePaypalListeners(){this.paypalRef&&(this.paypalRef.removeEventListener("paypalStarted",this.handlePaypalStarted),this.paypalRef.removeEventListener("paypalCompleted",this.handlePaypalCompleted),this.paypalRef.removeEventListener("paypalCancelled",this.handlePaypalCancelled),this.paypalRef.removeEventListener("paypalError",this.handlePaypalError))}async tokenizePaymentMethod(t){var e,i,s;const a=null!==(i=await(null===(e=this.billingFormRef)||void 0===e?void 0:e.getValues()))&&void 0!==i?i:{},n=Object.assign(Object.assign({},t),a),o=Object.assign({accountId:w.accountId,payment_method_group_id:void 0},n);w.savePaymentMethod&&(o.payment_method_group_id=w.paymentMethodGroupId);const r=await(null===(s=this.paymentMethodFormRef)||void 0===s?void 0:s.tokenize({clientId:this.authToken,paymentMethodMetadata:o,account:w.accountId}));return r.error?r:(w.paymentToken=r.id,r.id)}async fillBillingForm(t){w.billingFormFields=t}async setSelectedPaymentMethod(t){w.selectedPaymentMethod=t,w.paymentToken=t.id||void 0}async validate(){var t,e;const i=[];w.insuranceEnabled&&this.insuranceFormRef&&i.push(this.insuranceFormRef.validate());const s=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===G.NEW_CARD,a=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===G.NEW_BANK_ACCOUNT;if((s||a)&&(this.paymentMethodFormRef&&i.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&this.billingFormRef!==this.paymentMethodFormRef&&i.push(this.billingFormRef.validate())),0===i.length)return!0;try{return!!(await Promise.all(i)).every((t=>"boolean"==typeof t?t:!1!==(null==t?void 0:t.isValid)))||(this.errorEvent.emit({message:"Validation error",errorCode:y.VALIDATION_ERROR,severity:u.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){var e,i,s,a,n,o,r,l;if(w.isSubmitting)return;w.isSubmitting=!0;const h=await this.validate();if(!w.selectedPaymentMethod)return w.isSubmitting=!1,void this.errorEvent.emit({message:"No payment method selected.",errorCode:y.VALIDATION_ERROR,severity:u.ERROR});if(!h)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:y.VALIDATION_ERROR,severity:u.ERROR});const d=(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)===G.NEW_CARD,c=(null===(i=w.selectedPaymentMethod)||void 0===i?void 0:i.type)===G.NEW_BANK_ACCOUNT,p=(null===(s=w.selectedPaymentMethod)||void 0===s?void 0:s.type)===G.PLAID;if(d||c){const e=await this.tokenizePaymentMethod(t);if(null==e?void 0:e.error)return w.isSubmitting=!1,void this.errorEvent.emit({message:e.error.message,errorCode:y.TOKENIZE_ERROR,severity:u.ERROR})}if(p&&!w.paymentToken){const t=w.plaidPublicToken,e=w.plaidLinkTokenId;if(!t)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Missing Plaid public token. Please connect your bank.",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR});try{const i=await this.plaidService.tokenizeBankAccount(w.authToken,w.accountId,t,e||void 0,w.savePaymentMethod?w.paymentMethodGroupId:void 0);if(null==i?void 0:i.error)return w.isSubmitting=!1,void this.errorEvent.emit({message:"string"==typeof i.error?i.error:i.error.message||"Failed to tokenize bank account",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR});const s=null==i?void 0:i.data,n=(null===(a=null==s?void 0:s.bank_account)||void 0===a?void 0:a.token)||(null==s?void 0:s.token)||(null==s?void 0:s.id);w.paymentToken=n}catch(t){return w.isSubmitting=!1,void this.errorEvent.emit({message:(null==t?void 0:t.message)||"Plaid exchange error",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR})}}const m=(null===(n=w.selectedPaymentMethod)||void 0===n?void 0:n.type)===G.SEZZLE;if(m){const t=this.hostEl.querySelector("justifi-sezzle-payment-method"),e=await(null==t?void 0:t.resolvePaymentMethod({isValid:h}));if("success"!==(null===(o=null==e?void 0:e.bnpl)||void 0===o?void 0:o.status))return w.isSubmitting=!1,void this.errorEvent.emit({message:(null===(r=null==e?void 0:e.error)||void 0===r?void 0:r.message)||"Sezzle checkout was not completed.",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR})}if(!m&&!w.paymentToken)return w.isSubmitting=!1,void this.errorEvent.emit({message:"Payment token not found.",errorCode:y.TOKENIZE_ERROR,severity:u.ERROR});const v={payment_mode:(t=>{switch(t){case G.NEW_CARD:case G.SAVED_CARD:case G.NEW_BANK_ACCOUNT:case G.SAVED_BANK_ACCOUNT:case G.PLAID:return K.ECOM;case G.SEZZLE:return K.BNPL;case G.APPLE_PAY:return K.APPLE_PAY;case G.GOOGLE_PAY:return K.GOOGLE_PAY;case G.PAYPAL:return K.PAYPAL;case G.VENMO:return K.VENMO;default:return}})(null===(l=w.selectedPaymentMethod)||void 0===l?void 0:l.type),payment_token:m?void 0:w.paymentToken};if(this.preCompleteHook){const t=A();try{await new Promise(((e,i)=>{this.preCompleteHook(t,(()=>e()),(()=>i()))}))}catch(t){return w.isSubmitting=!1,void console.log("Checkout cancelled by preCompleteHook",t)}}this.completeCheckout({payment:v,onSuccess:({checkout:t})=>{w.isSubmitting=!1,this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:({error:t})=>{w.isSubmitting=!1,this.errorEvent.emit({message:t,errorCode:y.COMPLETE_CHECKOUT_ERROR,severity:u.ERROR})}})}render(){return i(s,{key:"d1e1326e66bc9347de573bc8b3aa30e19178ade9"})}get hostEl(){return a(this)}static get watchers(){return{maskCardNumber:["maskCardNumberChanged"]}}},dt=n();class ct{async createPaypalOrder(t,e,i,s){return dt.post({endpoint:`checkouts/${e}/paypal/orders`,body:{funding_source:i},authToken:t,signal:s})}}const pt="paypal-script",ut=["paypal-payments","venmo-payments"],yt="PAYMENT_FAILED",mt="shown",vt=(t,e)=>{t&&(e?t.classList.add(mt):t.classList.remove(mt))},ft=class{constructor(i){t(this,i),this.paypalStarted=e(this,"paypalStarted",7),this.paypalCompleted=e(this,"paypalCompleted",7),this.paypalCancelled=e(this,"paypalCancelled",7),this.paypalError=e(this,"paypalError",7),this.paypalService=new ct,this.paypalEligible=!1,this.venmoEligible=!1,this.startSession=async(t,e)=>{if(!t)return;this.pendingOrderId=void 0,this.paypalStarted.emit({fundingSource:e});let i=!1;const s=this.createOrder(e).then((t=>({orderId:t.provider_order_id}))).catch((t=>{throw i=!0,this.emitError((null==t?void 0:t.message)||"Could not create the Paypal order","ORDER_ERROR"),t}));s.catch((()=>{}));try{await t.start({presentationMode:"auto"},s)}catch(t){if(i)return;this.emitError((null==t?void 0:t.message)||"Paypal payment failed",yt)}}}componentDidLoad(){w.checkoutLoaded?this.initializePaypal():C("checkoutLoaded",(t=>{t&&this.initializePaypal()}))}componentDidRender(){this.applyVisibility()}get currencyCode(){return(w.paymentCurrency||"USD").toUpperCase()}get showPaypal(){return!!w.paypalEnabled&&this.paypalEligible}get showVenmo(){return!!w.paypalEnabled&&this.venmoEligible&&"USD"===this.currencyCode}applyVisibility(){const{showPaypal:t,showVenmo:e}=this;vt(this.buttonsEl,t||e),vt(this.paypalButtonEl,t),vt(this.venmoButtonEl,e)}emitError(t,e){this.paypalError.emit({error:t,code:e})}loadPaypalScript(){const t=window.paypal;return t?Promise.resolve(t):new Promise(((t,e)=>{let i=document.head.querySelector(`script[data-test-id="${pt}"]`);i||(i=document.createElement("script"),i.src="test"===w.checkoutMode?"https://www.sandbox.paypal.com/web-sdk/v6/core":"https://www.paypal.com/web-sdk/v6/core",i.async=!0,i.setAttribute("data-test-id",pt),document.head.appendChild(i)),i.addEventListener("load",(()=>{const i=window.paypal;i?t(i):e(new Error("Paypal script loaded but window.paypal is undefined"))})),i.addEventListener("error",(()=>e(new Error("Error loading Paypal script"))))}))}metadataId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async initializePaypal(){const t=w.paypalProviderClientId;if(!t)return this.paypalEligible=!1,this.venmoEligible=!1,this.applyVisibility(),void this.emitError("Missing Paypal client id","CONFIG_ERROR");try{const e=await this.loadPaypalScript();this.sdkInstance=await e.createInstance({clientId:t,components:ut,pageType:"checkout",metadataId:this.metadataId()});const i=await this.sdkInstance.findEligibleMethods({currencyCode:this.currencyCode});this.paypalEligible=i.isEligible("paypal"),this.venmoEligible=i.isEligible("venmo"),this.paypalEligible&&(this.paypalSession=this.sdkInstance.createPayPalOneTimePaymentSession(this.sessionOptions("paypal"))),this.venmoEligible&&(this.venmoSession=this.sdkInstance.createVenmoOneTimePaymentSession(this.sessionOptions("venmo"))),this.applyVisibility()}catch(t){this.paypalEligible=!1,this.venmoEligible=!1,this.applyVisibility(),this.emitError((null==t?void 0:t.message)||"Error initializing Paypal","INITIALIZATION_ERROR")}}sessionOptions(t){return{onApprove:()=>this.paypalCompleted.emit({success:!0,paymentMethodId:this.pendingOrderId,fundingSource:t}),onCancel:()=>this.paypalCancelled.emit({fundingSource:t}),onError:t=>this.emitError((null==t?void 0:t.message)||"Paypal payment failed",yt)}}async createOrder(t){const e=await this.paypalService.createPaypalOrder(w.authToken,w.checkoutId,t);if(null==e?void 0:e.error)throw new Error(("string"==typeof e.error?e.error:e.error.message)||"Could not create the Paypal order");const i=null==e?void 0:e.data;if(!(null==i?void 0:i.provider_order_id))throw new Error("Paypal order is missing a provider order id");return this.pendingOrderId=i.id,i}render(){return i(k,{key:"39a2b473cfa47da5e079adbaffa93663289cb8ec"},i("div",{key:"9d3e3ff9236d2462157b310d691c43f54b6651dd",class:"paypal-buttons",ref:t=>this.buttonsEl=t},i("paypal-button",{key:"a0049d2bcf4aa295f65563f49c3287b2da2e63b8",type:"pay",ref:t=>this.paypalButtonEl=t,onClick:()=>this.startSession(this.paypalSession,"paypal")}),i("venmo-button",{key:"fd71ba73af2223271160601ec76039d3e0d6cb02",type:"pay",ref:t=>this.venmoButtonEl=t,onClick:()=>this.startSession(this.venmoSession,"venmo")})),i("style",{key:"7c7b62b3bbdf001760e888b4206702d210aeadcb"},"\n .paypal-buttons {\n display: none;\n gap: 8px;\n width: 100%;\n }\n .paypal-buttons.shown {\n display: flex;\n }\n .paypal-buttons > * {\n display: none;\n flex: 1 1 0;\n min-width: 0;\n }\n .paypal-buttons > .shown {\n display: block;\n }\n "))}},bt=class{constructor(i){t(this,i),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.plaidError=e(this,"plaidError",7),this.plaidErrorRecovered=e(this,"plaidErrorRecovered",7),this.isAuthenticating=!1,this.publicToken=null,this.linkToken=null,this.linkTokenId=null,this.error=null,this.plaidLink=null,this.isSelected=!1,this.retryCount=0,this.isRetrying=!1,this.sdkLoaded=!1,this.plaidService=new W,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.hasLoggedAchPaymentsDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{w.authToken&&w.accountId&&w.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:g.PLAID_SDK_LOAD_FAILED,message:b[g.PLAID_SDK_LOAD_FAILED],severity:f[g.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:g.PLAID_LINK_TOKEN_FAILED,message:b[g.PLAID_LINK_TOKEN_FAILED],severity:f[g.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:g.PLAID_LINK_INIT_FAILED,message:b[g.PLAID_LINK_INIT_FAILED],severity:f[g.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,s,a;try{if(!w.authToken||!w.accountId)return void this.handleError({code:g.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:u.ERROR,retryable:!1,userAction:"Refresh the page"});this.abortController=new AbortController,this.timeoutId=setTimeout((()=>{var t;null===(t=this.abortController)||void 0===t||t.abort()}),3e4);const e=await this.plaidService.getLinkToken(w.authToken,w.accountId,w.checkoutId,this.abortController.signal);if(this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),e.error)throw new Error("string"==typeof e.error?e.error:e.error.message||"Failed to get link token");this.linkToken=e.data.link_token,this.linkTokenId=(null==e?void 0:e.id)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||null,this.linkTokenId&&(w.plaidLinkTokenId=this.linkTokenId)}catch(t){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let n=g.PLAID_LINK_TOKEN_FAILED,o=b[n],r=!0;"AbortError"===t.name?(n=g.PLAID_TIMEOUT,o=b[n],r=!0):(null===(e=t.message)||void 0===e?void 0:e.includes("network"))||(null===(i=t.message)||void 0===i?void 0:i.includes("fetch"))?(n=g.PLAID_NETWORK_ERROR,o=b[n],r=!0):((null===(s=t.message)||void 0===s?void 0:s.includes("401"))||(null===(a=t.message)||void 0===a?void 0:a.includes("unauthorized")))&&(n=g.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:n,message:o,severity:f[n],originalError:t,retryable:r,userAction:r?"Click to try again":"Refresh the page"})}},this.mapApiErrorToPlaidError=t=>{if("string"==typeof t){if(t.includes("rate_limit"))return g.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return g.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return g.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return g.PLAID_RATE_LIMITED;case"maintenance":return g.PLAID_MAINTENANCE;case"not_authenticated":return g.PLAID_INVALID_CREDENTIALS;default:return g.PLAID_LINK_TOKEN_FAILED}return g.PLAID_LINK_TOKEN_FAILED},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=t=>{this.publicToken=t,this.isAuthenticating=!1,this.clearError(),this.retryCount=0,this.isSelected||(this.isSelected=!0,w.selectedPaymentMethod={type:G.PLAID}),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:u.INFO}),w.plaidPublicToken=t},this.handlePlaidExit=t=>{this.isAuthenticating=!1,t&&this.handlePlaidError(t)},this.handlePlaidEvent=(t,e)=>{switch(t){case"OPEN":this.isAuthenticating=!0;break;case"CLOSE":this.isAuthenticating=!1;break;case"ERROR":this.handlePlaidError(e)}},this.handlePlaidLoad=()=>{},this.handlePlaidError=t=>{let e=g.PLAID_AUTHENTICATION_FAILED,i=b[e],s=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=g.PLAID_INVALID_CREDENTIALS,i=b[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=g.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=g.PLAID_ACCOUNT_LOCKED,i=b[e],s=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=g.PLAID_MAINTENANCE,i=b[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=g.PLAID_RATE_LIMITED,i=b[e],s=!0;break;case"INVALID_REQUEST":e=g.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=g.PLAID_AUTHENTICATION_FAILED,i=t.error_message||"Bank authentication failed. Please try again.",s=!0;break;default:t.error_message&&(i=t.error_message)}if(t.error_message){const n=t.error_message.toLowerCase();n.includes("not supported")||n.includes("unsupported")?(e=g.PLAID_BANK_NOT_SUPPORTED,i=b[e],s=!1,a="Try a different payment method"):(n.includes("expired")||n.includes("timeout"))&&(e=g.PLAID_TOKEN_EXPIRED,i=b[e],s=!0)}this.handleError({code:e,message:i,severity:f[e],originalError:t,retryable:s,userAction:a}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.plaidError.emit({code:t.code,message:t.message,severity:t.severity,data:{originalError:t.originalError,retryable:t.retryable,userAction:t.userAction,retryCount:this.retryCount}}),console.error("Plaid error:",t),t.retryable&&this.retryCount<this.maxRetries&&this.scheduleRetry()},this.scheduleRetry=()=>{this.isRetrying||(this.isRetrying=!0,this.retryCount++,setTimeout((()=>{this.isRetrying=!1,this.clearError(),this.waitForStoreAndInitialize()}),this.retryDelay*this.retryCount))},this.clearError=()=>{this.error&&(this.error=null,this.retryCount=0)},this.syncWithStore=()=>{var t;const e=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===G.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=w.selectedPaymentMethod)||void 0===e?void 0:e.type)!==G.PLAID&&(w.selectedPaymentMethod={type:G.PLAID}),!t||!this.plaidLink||this.publicToken||this.isAuthenticating||this.error||this.openPlaidLink()}componentWillLoad(){var t;this.isSelected=(null===(t=w.selectedPaymentMethod)||void 0===t?void 0:t.type)===G.PLAID,!0===w.bankAccountVerification&&(w.checkoutLoaded?w.achPaymentsEnabled&&this.loadPlaidSDK():C("checkoutLoaded",(t=>{t&&!0===w.bankAccountVerification&&w.achPaymentsEnabled&&this.loadPlaidSDK()})))}loadPlaidSDK(){if(this.sdkLoaded)return;this.sdkLoaded=!0;const t=document.createElement("script");t.src="https://cdn.plaid.com/link/v2/stable/link-initialize.js",t.async=!0,t.onload=()=>this.initializePlaidLink(),t.onerror=()=>{this.handleError({code:g.PLAID_SDK_LOAD_FAILED,message:b[g.PLAID_SDK_LOAD_FAILED],severity:f[g.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})},document.head.appendChild(t)}async resolvePaymentMethod(){return this.publicToken?{token:this.publicToken,data:{type:"bank_account",plaid_public_token:this.publicToken}}:{validationError:!0}}async getPaymentToken(){return w.paymentToken}async handleSelectionClick(){if(this.isSelected=!0,w.selectedPaymentMethod={type:G.PLAID},this.error)return this.clearError(),void this.waitForStoreAndInitialize();!this.plaidLink||this.publicToken||this.isAuthenticating||this.openPlaidLink()}async setSelected(t){this.isSelected=t,t&&(w.selectedPaymentMethod={type:G.PLAID})}async isCurrentlySelected(){return this.isSelected}async deselect(){this.isSelected=!1}async reset(){this.publicToken=null,this.clearError(),this.isAuthenticating=!1,this.linkToken=null,this.plaidLink=null,this.retryCount=0,this.isRetrying=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.abortController&&(this.abortController.abort(),this.abortController=null)}async isReadyForAuthentication(){return!(!this.plaidLink||!this.linkToken||this.isAuthenticating)}async retry(){this.error&&this.error.retryable&&(this.clearError(),this.waitForStoreAndInitialize())}async getErrorInfo(){return this.error}componentDidLoad(){const t=C("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(w.checkoutLoaded&&!w.achPaymentsEnabled)return this.hasLoggedAchPaymentsDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] ACH payments are disabled for this checkout. Component will not render."),this.hasLoggedAchPaymentsDisabledWarning=!0),null;if(!0!==w.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const t=i("svg",{class:"plaid-logo-img",part:_,role:"img","aria-label":"Plaid",viewBox:"0 0 28 29",xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",width:"20px",height:"20px",marginLeft:"5px",marginTop:"-2px"}},i("title",null,"Plaid"),i("path",{fill:"currentColor","fill-rule":"evenodd",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 i(k,{class:"payment-method",exportparts:"label,text,color,font-family,text-danger,image"},i("div",{title:"Pay with Plaid"},i("div",{part:M,onClick:t=>{t.preventDefault(),this.handleSelectionClick()}},"Pay with Bank Account ",t," "),(()=>this.error?i("div",{class:"mt-2"},i("div",{class:this.error.severity===u.ERROR?"text-danger":this.error.severity===u.WARNING?"text-warning":"text-info"},i("small",{part:this.error.severity===u.ERROR?j:S},this.error.message)),i("div",{class:"text-muted"},i("small",{part:S},this.error.userAction,this.error.retryable&&this.retryCount<this.maxRetries&&i("span",null," • Auto-retry in progress...")))):null)(),(()=>this.error?null:this.isAuthenticating?i("div",{class:"text-info mt-2"},i("small",{part:S},"Connecting to your bank...")):this.publicToken?i("div",{class:"text-success mt-2"},i("small",{part:S},"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:i("div",{class:"text-muted mt-2"},i("small",{part:S},"Click to connect your bank account")))()))}static get watchers(){return{isSelected:["onSelectionChange"]}}},gt=class{constructor(e){t(this,e),this.onPaymentMethodOptionClick=t=>e=>{e.preventDefault(),w.selectedPaymentMethod={id:t.id,type:t.type},w.paymentToken=t.id},this.isAllowedPaymentMethod=t=>!(t===G.SAVED_CARD&&w.disableCreditCard||t===G.SAVED_BANK_ACCOUNT&&w.disableBankAccount)}componentWillLoad(){w.checkoutLoaded&&(w.paymentMethods.length||console.warn("No saved payment methods available."),w.disablePaymentMethodGroup&&console.warn("Payment method group is disabled."))}render(){return w.disablePaymentMethodGroup?null:i(k,null,i("div",{class:"saved-payment-methods"},w.paymentMethods.length?w.paymentMethods.filter((t=>this.isAllowedPaymentMethod(t.type))).map((t=>i("div",{class:"radio-list-item p-3",part:I,onClick:this.onPaymentMethodOptionClick(t)},i("form-control-radio",{name:"paymentMethodType",value:null==t?void 0:t.id,checked:w.paymentToken===(null==t?void 0:t.id),label:`${$[null==t?void 0:t.brand]||""} *${null==t?void 0:t.acct_last_four}`})))):null))}},kt=class{constructor(i){t(this,i),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.paymentMethodOptionId=G.SEZZLE,this.initializeSezzleCheckout=()=>{const t=Number(w.paymentAmount),e=new(0,window.Checkout)({mode:"popup",publicKey:w.bnplProviderClientId,apiMode:w.bnplProviderMode,apiVersion:w.bnplProviderApiVersion});e.sezzleButtonElement=this.sezzleButtonRef,e.init({onClick:function(t){t.preventDefault(),e.startCheckout({checkout_url:w.bnplProviderCheckoutUrl})},onComplete:t=>{var e;return null===(e=this.resolveSezzlePromise)||void 0===e?void 0:e.call(this,{bnpl:t.data})},onCancel:t=>{var e;return null===(e=this.resolveSezzlePromise)||void 0===e?void 0:e.call(this,{bnpl:t.data})},onFailure:t=>{var e;return null===(e=this.resolveSezzlePromise)||void 0===e?void 0:e.call(this,{bnpl:t.data})}}),this.sezzleCheckout=e,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(t)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()})}async resolvePaymentMethod(t){if(!t.isValid)return{validationError:!0};if(!this.sezzleButtonRef)return{error:{code:"sezzle_not_ready",message:"Sezzle is not ready yet. Please try again.",decline_code:""}};const e=new Promise((t=>{this.resolveSezzlePromise=t}));return this.sezzleButtonRef.click(),e}async handleSelectionClick(){w.selectedPaymentMethod={type:G.SEZZLE},this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)}render(){var t,e;return w.bnplEnabled?i(k,{class:"payment-method"},i("script",{src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),i("div",null,i("div",null,"Buy now, pay later with ",i("img",{class:"sezzle-smart-button-logo-img",src:"https://media.sezzle.com/branding/2.0/Sezzle_Logo_FullColor.svg",alt:"Sezzle",style:{display:"inline",width:"80px",marginLeft:"5px",marginTop:"-5px"}})),this.installmentPlan&&i("small",null,i("span",null,null===(t=this.installmentPlan)||void 0===t?void 0:t.installments.length)," ",i("span",null,this.installmentPlan.schedule," payments of")," ",i("span",{class:"fw-bold"},R(null===(e=this.installmentPlan)||void 0===e?void 0:e.installments[0].amountInCents))))):(console.warn("justifi-sezzle-payment-method: BNPL is not enabled for this account."),null)}},Pt={[G.NEW_BANK_ACCOUNT]:"New bank account",[G.NEW_CARD]:"New credit or debit card"},wt="Payment form not ready",Ct="Validation error",Lt=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event",7),this.submitEvent=e(this,"submit-event",7),this.computedHideSubmitButton=!1,this.isLoading=!1,this.submitButtonText="Submit"}paymentMethodsChanged(){this.setDefaultSelectedPaymentMethod()}connectedCallback(){this.setDefaultSelectedPaymentMethod(),this.setComputedHideSubmitButton()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup(),this.unsubscribeFromStore&&this.unsubscribeFromStore()}componentWillRender(){this.selectedPaymentMethod&&!w.selectedPaymentMethod&&(w.selectedPaymentMethod={type:this.selectedPaymentMethod})}componentWillLoad(){U(),this.analytics=new V(this)}handleRadioClick(t){this.selectedPaymentMethod=t.detail,w.selectedPaymentMethod={type:t.detail}}async tokenizePaymentMethod(t){null==t||t.preventDefault(),this.validateRequiredProps(),this.isLoading=!0;try{if(!(await this.validate()).isValid)return this.errorEvent.emit({errorCode:y.TOKENIZE_ERROR,message:Ct}),void(this.isLoading=!1);const t=await this.resolvePaymentMethod({isValid:!0});return t.error&&this.emitError({errorCode:t.error.code,message:t.error.message}),this.submitEvent.emit({response:t}),t}catch(t){const e=this.createErrorResponse(y.TOKENIZE_ERROR,t.message);return this.emitError({errorCode:y.TOKENIZE_ERROR,message:t.message}),this.submitEvent.emit({response:e}),e}finally{this.isLoading=!1}}async fillBillingForm(t){w.billingFormFields=t}async validate(){if(!this.areFormsReady())return{isValid:!1,errors:{general:wt}};const[t,e]=await Promise.all([this.billingFormRef.validate(),this.paymentMethodFormRef.validate()]);return{isValid:t.isValid&&e.isValid,errors:Object.assign({},t.errors)}}async getValues(){return this.billingFormRef.getValues()}async tokenize(){try{const t=await this.billingFormRef.getValues(),e={clientId:this.authToken||w.authToken,account:this.accountId||w.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||w.authToken||this.emitError({errorCode:y.TOKENIZE_ERROR,message:"Auth token is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"}),this.accountId||w.accountId||this.emitError({errorCode:y.TOKENIZE_ERROR,message:"Account ID is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"})}setDefaultSelectedPaymentMethod(){this.selectedPaymentMethod||(this.disableCreditCard?this.disableBankAccount||w.checkoutLoaded&&!w.achPaymentsEnabled||(this.selectedPaymentMethod=G.NEW_BANK_ACCOUNT,w.selectedPaymentMethod={type:G.NEW_BANK_ACCOUNT}):(this.selectedPaymentMethod=G.NEW_CARD,w.selectedPaymentMethod={type:G.NEW_CARD}))}setComputedHideSubmitButton(){if(void 0!==this.hideSubmitButton)return void(this.computedHideSubmitButton=this.hideSubmitButton);const t=this.isSlottedWithinModularCheckout();this.computedHideSubmitButton=t}isSlottedWithinModularCheckout(){var t;let e=null===(t=this.host)||void 0===t?void 0:t.parentElement;for(;e;){if("JUSTIFI-MODULAR-CHECKOUT"===e.tagName)return!0;e=e.parentElement}return!1}get availablePaymentMethods(){const t=[],e=!w.checkoutLoaded||w.achPaymentsEnabled;return this.disableCreditCard||t.push(G.NEW_CARD),!this.disableBankAccount&&e&&t.push(G.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:u.ERROR}))}createErrorResponse(t,e){return{error:{code:t,message:e,decline_code:void 0}}}async resolvePaymentMethod(t){if(!this.areFormsReady())return this.createErrorResponse("form_not_ready",wt);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||Ct;return{validationError:!0,error:{code:"validation_error",message:String(t),decline_code:void 0}}}return await this.performTokenization()}catch(t){return{error:t}}}async performTokenization(){var t,e;const i=await this.tokenize();if(i.error)return{error:i.error};const s=i.data;return{token:(null===(t=s.card)||void 0===t?void 0:t.token)||(null===(e=s.bank_account)||void 0===e?void 0:e.token),data:s}}buildPaymentMethodMetadata(t){return this.shouldSavePaymentMethod?Object.assign(Object.assign({},t),{payment_method_group_id:this.paymentMethodGroupID}):Object.assign({},t)}get paymentMethodGroupID(){return this.paymentMethodGroupId||w.paymentMethodGroupId}get shouldSavePaymentMethod(){return!(!this.paymentMethodGroupId&&!w.savePaymentMethod)}get shouldHideRadioInput(){return this.disableCreditCard||this.disableBankAccount}renderPaymentMethodOption(t){const e=w.selectedPaymentMethod,s=this.selectedPaymentMethod===t&&!(e&&(void 0!==e.id||e.type!==t));return i("div",{class:"payment-method"},i("radio-list-item",{name:"paymentMethodType",value:t,checked:s,label:Pt[t],hidden:this.shouldHideRadioInput}),s&&this.renderSelectedPaymentMethodForm(t))}renderSelectedPaymentMethodForm(t){return i("div",{class:"mt-4 pb-4"},this.renderPaymentMethodForm(t),i("div",{class:"mt-4"},i("billing-form",{ref:t=>{t&&(this.billingFormRef=t)},hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:t})),i("div",{class:"mt-4"},i("save-new-payment-method",{hidden:!this.paymentMethodGroupID,label:this.savePaymentMethodLabel})))}renderPaymentMethodForm(t){return t===G.NEW_CARD?i("card-form",{ref:t=>{t&&(this.paymentMethodFormRef=t)},maskCardNumber:this.maskCardNumber}):i("bank-account-form",{ref:t=>{t&&(this.paymentMethodFormRef=t)},showAccountNumberConfirmation:this.showAccountNumberConfirmation})}render(){return i(k,{key:"eff8f53ba9e7935822cb6848422bb0e86d5c762b"},i("form",{key:"a1af6ad70700565a46644a487109cb8be91a2a1e"},i("fieldset",{key:"289038090f6a03feb2467b4da0be0231da4c9d58"},i("div",{key:"fc536a12ac5a2245dc2f458a5cb5eb42a0faa2c9",class:"row gy-3"},i("div",{key:"42f5add1ed97ddca1b7f229f572f94c0f5eb990b",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),i("div",{key:"34c980bab861d09c0bed6666409197a9067610a1",class:"col-12"},i("internal-button",{key:"71800d244d727d42bb50acea662cc1d8ebb37775",text:this.submitButtonText,variant:"primary",type:"submit",clickHandler:t=>this.tokenizePaymentMethod(t),isLoading:this.isLoading,"data-testid":"submit-button",hidden:this.computedHideSubmitButton}))))))}get host(){return a(this)}static get watchers(){return{disableCreditCard:["paymentMethodsChanged"],disableBankAccount:["paymentMethodsChanged"]}}};export{it as justifi_apple_pay,st as justifi_button,at as justifi_checkout_summary,rt as justifi_google_pay,lt as justifi_header,ht as justifi_modular_checkout,ft as justifi_paypal,bt as justifi_plaid_payment_method,J as justifi_radio_list_item,gt as justifi_saved_payment_methods,kt as justifi_sezzle_payment_method,Lt as justifi_tokenize_payment_method}
@@ -1 +1 @@
1
- import{r as e,h as a}from"./p-CV0Pyo1O.js";import{l as t}from"./p-OeJ-3w3l.js";import{f as d,p as s,c as l}from"./p-BLhz_ggG.js";import{f as c,a as i}from"./p-Bu7gdOaV.js";import{S as r}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import{c as o,a as f}from"./p-Ds_P-dB8.js";import"./p-BFTU3MAI.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";const n=class{constructor(a){e(this,a),this.setParamsOnChange=(e,a)=>{d[e]=a},this.handleDateInput=(e,a)=>{const t=o(a,{setExactTime:!0});this.setParamsOnChange(e,t)}}componentWillLoad(){this.debouncedSetParamsOnChange=t.debounce(this.setParamsOnChange,300),Object.entries({payment_id:this.paymentId,terminal_id:this.terminalId,payment_status:this.paymentStatus,payment_mode:this.paymentMode,checkout_id:this.checkoutId,account_holder:this.accountHolder,created_after:this.createdAfter,created_before:this.createdBefore}).forEach((([e,a])=>{a&&(s[e]=a)}))}get paymentStatusOptions(){return[{label:"All",value:""},{label:"Pending",value:"pending"},{label:"Authorized",value:"authorized"},{label:"Succeeded",value:"succeeded"},{label:"Failed",value:"failed"},{label:"Disputed",value:"disputed"},{label:"Refunded",value:"refunded"}]}get paymentModeOptions(){return[{label:"All",value:""},{label:"E-commerce",value:"ecom"},{label:"ACH",value:"ach"},{label:"Card Present",value:"card_present"}]}render(){const e=Object.assign({},d);return a(r,{key:"fd6a6c240ed15d7d28d4d58db57085d9789e055c"},a("table-filters-menu",{key:"bc1524c293cc12f9d5976d1a7f888c4d35096b5a",params:e,clearParams:l,part:c},a("div",{key:"5180f595ac0d5c36e16fbcb8a6751c48ac88d166",class:"grid-cols-2 gap-3 p-1"},a("div",{key:"2771ebb890c0a9f469e02f22523cb7cfb418d513",class:"p-2"},a("form-control-text",{key:"3c93cc523f8e5e2d9e63c1b6265e8e03c08377fa",name:"payment_id",label:"Payment ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.paymentId||d.payment_id,disabled:!!this.paymentId,part:i})),a("div",{key:"66e985568825d8992c4081f0d459807a7773fd49",class:"p-2"},a("form-control-text",{key:"63efc9b447218119d90a0601eb85528117197b42",name:"terminal_id",label:"Terminal ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.terminalId||d.terminal_id,disabled:!!this.terminalId,part:i})),a("div",{key:"0147be1acda5af7b2ddd3ae76e61e0e2ec33ddcd",class:"p-2"},a("form-control-select",{key:"786ab3d3205d2feda8c11840a9c5429915f6ab4c",name:"payment_status",label:"Status",options:this.paymentStatusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentStatus||d.payment_status||"",disabled:!!this.paymentStatus,part:i})),a("div",{key:"e08cee43b808e3246989c277d1b5b870799b602d",class:"p-2"},a("form-control-select",{key:"b2edc5a654ad50a00ee8171f673c48a2f0b10699",name:"payment_mode",label:"Payment Mode",options:this.paymentModeOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentMode||d.payment_mode||"",disabled:!!this.paymentMode,part:i})),a("div",{key:"9c393aed8075c68fa21e919fad3e66a75bf0801b",class:"p-2"},a("form-control-text",{key:"40967dca09780e59a096f117068c1f49dc7f68fb",name:"checkout_id",label:"Checkout ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.checkoutId||d.checkout_id,disabled:!!this.checkoutId,part:i})),a("div",{key:"4c5177f35cd58c1e465f5750bdf92559119bbffa",class:"p-2"},a("form-control-text",{key:"4a905f81a07c1a10df4d72ba85657baad464cc87",name:"account_holder",label:"Account Holder",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.accountHolder||d.account_holder,disabled:!!this.accountHolder,part:i})),a("div",{key:"272f47c23883018d4fda9a215738b6b81764b99e",class:"p-2"},a("form-control-date",{key:"40f7c019ec33378c42b7093c9023eb80df7f787f",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:f(this.createdAfter,{showInputDateTime:!0})||f(d.created_after,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdAfter,part:i})),a("div",{key:"b714a400679ed1f4bcf96afe44e9100c6e52cef7",class:"p-2"},a("form-control-date",{key:"361a3d52c4f2c78aec9727cf6cfdd5b8d900bd3d",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:f(this.createdBefore,{showInputDateTime:!0})||f(d.created_before,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdBefore,part:i})))))}};export{n as justifi_payments_list_filters}
1
+ import{r as e,h as a}from"./p-CV0Pyo1O.js";import{l as t}from"./p-OeJ-3w3l.js";import{f as d,p as s,c as l}from"./p-BLhz_ggG.js";import{f as c,a as i}from"./p-Bu7gdOaV.js";import{S as r}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import{c as o,a as f}from"./p-Ds_P-dB8.js";import"./p-BFTU3MAI.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";const n=class{constructor(a){e(this,a),this.setParamsOnChange=(e,a)=>{d[e]=a},this.handleDateInput=(e,a)=>{const t=o(a,{setExactTime:!0});this.setParamsOnChange(e,t)}}componentWillLoad(){this.debouncedSetParamsOnChange=t.debounce(this.setParamsOnChange,300),Object.entries({payment_id:this.paymentId,terminal_id:this.terminalId,payment_status:this.paymentStatus,payment_mode:this.paymentMode,checkout_id:this.checkoutId,account_holder:this.accountHolder,created_after:this.createdAfter,created_before:this.createdBefore}).forEach((([e,a])=>{a&&(s[e]=a)}))}get paymentStatusOptions(){return[{label:"All",value:""},{label:"Pending",value:"pending"},{label:"Authorized",value:"authorized"},{label:"Succeeded",value:"succeeded"},{label:"Failed",value:"failed"},{label:"Disputed",value:"disputed"},{label:"Refunded",value:"refunded"}]}get paymentModeOptions(){return[{label:"All",value:""},{label:"E-commerce",value:"ecom"},{label:"ACH",value:"ach"},{label:"Card Present",value:"card_present"}]}render(){const e=Object.assign({},d);return a(r,{key:"fd6a6c240ed15d7d28d4d58db57085d9789e055c"},a("table-filters-menu",{key:"bc1524c293cc12f9d5976d1a7f888c4d35096b5a",params:e,clearParams:l,part:c},a("div",{key:"5180f595ac0d5c36e16fbcb8a6751c48ac88d166",class:"grid-cols-2 gap-3 p-1"},a("div",{key:"2771ebb890c0a9f469e02f22523cb7cfb418d513",class:"p-2"},a("form-control-text",{key:"3c93cc523f8e5e2d9e63c1b6265e8e03c08377fa",name:"payment_id",label:"Payment ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.paymentId||d.payment_id,disabled:!!this.paymentId,part:i})),a("div",{key:"66e985568825d8992c4081f0d459807a7773fd49",class:"p-2"},a("form-control-text",{key:"63efc9b447218119d90a0601eb85528117197b42",name:"terminal_id",label:"Terminal ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.terminalId||d.terminal_id,disabled:!!this.terminalId,part:i})),a("div",{key:"0147be1acda5af7b2ddd3ae76e61e0e2ec33ddcd",class:"p-2"},a("form-control-select",{key:"786ab3d3205d2feda8c11840a9c5429915f6ab4c",name:"payment_status",label:"Status",options:this.paymentStatusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentStatus||d.payment_status||"",disabled:!!this.paymentStatus,part:i})),a("div",{key:"e08cee43b808e3246989c277d1b5b870799b602d",class:"p-2"},a("form-control-select",{key:"b2edc5a654ad50a00ee8171f673c48a2f0b10699",name:"payment_mode",label:"Payment Mode",options:this.paymentModeOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentMode||d.payment_mode||"",disabled:!!this.paymentMode,part:i})),a("div",{key:"9c393aed8075c68fa21e919fad3e66a75bf0801b",class:"p-2"},a("form-control-text",{key:"40967dca09780e59a096f117068c1f49dc7f68fb",name:"checkout_id",label:"Checkout ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.checkoutId||d.checkout_id,disabled:!!this.checkoutId,part:i})),a("div",{key:"4c5177f35cd58c1e465f5750bdf92559119bbffa",class:"p-2"},a("form-control-text",{key:"4a905f81a07c1a10df4d72ba85657baad464cc87",name:"account_holder",label:"Account Holder",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.accountHolder||d.account_holder,disabled:!!this.accountHolder,part:i})),a("div",{key:"272f47c23883018d4fda9a215738b6b81764b99e",class:"p-2"},a("form-control-date",{key:"40f7c019ec33378c42b7093c9023eb80df7f787f",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:f(this.createdAfter,{showInputDateTime:!0})||f(d.created_after,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdAfter,part:i})),a("div",{key:"b714a400679ed1f4bcf96afe44e9100c6e52cef7",class:"p-2"},a("form-control-date",{key:"361a3d52c4f2c78aec9727cf6cfdd5b8d900bd3d",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:f(this.createdBefore,{showInputDateTime:!0})||f(d.created_before,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdBefore,part:i})))))}};export{n as justifi_payments_list_filters}
@@ -1 +1 @@
1
- import{r as e,h as a}from"./p-CV0Pyo1O.js";import{r as t}from"./p-Bu7gdOaV.js";import{S as o}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";const d=class{constructor(a){e(this,a)}render(){return a(o,{key:"45a24177da27e09c500054f09e8d5a432fc790d6",class:"payment-method"},a("div",{key:"2d5cdef6c196b9be0c09ed109f20b44cd94eac8c",class:"radio-list-item p-3",part:t,onClick:this.clickHandler,hidden:this.radioButtonHidden},a("form-control-radio",{key:"4cc39aae8c3a1ad7dadd385e99ff854643172b38",name:"paymentMethodType",value:this.paymentMethodOptionId,checked:this.isSelected,label:this.label})))}};export{d as payment_method_option}
1
+ import{r as e,h as a}from"./p-CV0Pyo1O.js";import{r as t}from"./p-Bu7gdOaV.js";import{S as o}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";const s=class{constructor(a){e(this,a)}render(){return a(o,{key:"45a24177da27e09c500054f09e8d5a432fc790d6",class:"payment-method"},a("div",{key:"2d5cdef6c196b9be0c09ed109f20b44cd94eac8c",class:"radio-list-item p-3",part:t,onClick:this.clickHandler,hidden:this.radioButtonHidden},a("form-control-radio",{key:"4cc39aae8c3a1ad7dadd385e99ff854643172b38",name:"paymentMethodType",value:this.paymentMethodOptionId,checked:this.isSelected,label:this.label})))}};export{s as payment_method_option}
@@ -1 +1 @@
1
- import{h as t,r as e,c as i}from"./p-CV0Pyo1O.js";import{n as s,C as a,b as r}from"./p-Dqxyi-uK.js";import{J as n}from"./p-CEHwp4sh.js";import{d as o}from"./p-DF7oFWnO.js";import{T as c}from"./p-CEGSQXGU.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{p as h}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{g as d,a as p}from"./p-BhpaUYtS.js";import{m,S as u}from"./p-C8J9uVEs.js";import{S as l}from"./p-05AWudQe.js";import{T as f,a as b,b as v,c as g,d as y,e as j,f as k,g as T,h as C,i as w,j as _,k as S,l as D}from"./p-DZr0wLGh.js";import{T as O}from"./p-CZfYo5-1.js";import{B as P,a as x}from"./p-Dz8KJn2G.js";import{a6 as A,a7 as I}from"./p-Bu7gdOaV.js";import{j as E}from"./p-Ds_P-dB8.js";import{o as G,g as B}from"./p-BzjgvHHT.js";import"./p-DhrQechy.js";import"./p-DCpGH4xL.js";import"./p-DgTOxu8x.js";import"./p-MPer3Rw7.js";const H={nickname:()=>t("th",{part:A,scope:"col",title:"The nickname associated with the terminal"},"Nickname"),model_name:()=>t("th",{part:A,scope:"col",title:"The model name of the terminal"},"Model Name"),id:()=>t("th",{part:A,scope:"col",title:"The ID of the terminal"},"ID"),provider:()=>t("th",{part:A,scope:"col",title:"The provider of the terminal"},"Provider"),provider_serial_number:()=>t("th",{part:A,scope:"col",title:"The serial number of the terminal"},"Serial Number"),device_id:()=>t("th",{part:A,scope:"col",title:"The device/provider ID of the terminal"},"Device ID"),sub_account_name:()=>t("th",{part:A,scope:"col",title:"The sub account associated with the terminal"},"Sub Account"),status:()=>t("th",{part:A,scope:"col",title:"The current status of each terminal"},"Status")},L={nickname:(e,i)=>t("td",{part:I(i)},e.nickname),model_name:(e,i)=>t("td",{part:I(i)},e.model_name),id:(e,i)=>t("td",{part:I(i)},e.id),provider:(e,i)=>t("td",{part:I(i)},E(e.provider)),provider_serial_number:(e,i)=>t("td",{part:I(i)},e.provider_serial_number),device_id:(e,i)=>t("td",{part:I(i)},e.provider_id),sub_account_name:(e,i)=>t("td",{part:I(i)},e.sub_account_name),status:(e,i)=>t("td",{part:I(i)},t(x,Object.assign({},{connected:{variant:P.SUCCESS,title:"This terminal is connected",text:"Connected"},disconnected:{variant:P.DANGER,title:"This terminal is disconnected",text:"Disconnected"},unknown:{variant:P.SECONDARY,title:"The status of this terminal is unknown",text:"Unknown"},pending_configuration:{variant:P.WARNING,title:"This terminal is pending configuration",text:"Pending configuration"},archived:{variant:P.SECONDARY,title:"This terminal is archived",text:"Archived"}}[e.status])))},z=class{constructor(t){e(this,t),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.terminals=[],this.subAccounts=[],this.loading=!0,this.paging=h,this.pagingParams={},this.columns="nickname,provider_serial_number,status",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:O.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:O.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const i=this.terminals.find((t=>t.id===e));this.clickEvent.emit({name:O.row,data:i})}}componentWillLoad(){o(),this.analytics=new n(this),this.terminalsTable=new f(this.terminals,this.columns,H,L),this.initializeGetData(),this.getTerminals&&this.getSubAccounts&&this.fetchData(),G("set",(()=>{this.pagingParams={}})),G("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}updateOnPropChange(){this.fetchData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:t,authToken:e,service:i})=>async({params:r,onSuccess:n,onError:o})=>{var c,h;try{const m=await i.fetchTerminals(t,e,r);if(m.error)return o({error:p(m.error),code:d(null===(h=m.error)||void 0===h?void 0:h.code),severity:a.ERROR});{const t=Object.assign({},m.page_info);n({terminals:(null===(c=m.data)||void 0===c?void 0:c.map((t=>new s(t))))||[],pagingInfo:t})}}catch(t){const e=d(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:a.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new c}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:r.MISSING_PROPS,message:this.errorMessage,severity:a.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=m({primaryAccountId:this.accountId,authToken:this.authToken,service:new u}))}fetchData(){this.loading=!0,this.getTerminals({params:this.terminalParams,onSuccess:async({terminals:t,pagingInfo:e})=>{this.terminals=t,this.paging=e,this.terminalsTable.collectionData=this.terminals,this.terminalsTable.columnKeys.includes("sub_account_name")?await this.fetchSubAccounts():this.loading=!1},onError:({error:t,code:e,severity:i})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:i}),this.loading=!1}})}async fetchSubAccounts(){this.getSubAccounts({params:this.subAccountParams,onSuccess:({subAccounts:t})=>{this.subAccounts=t,this.terminals=this.terminals.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:i})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:i}),this.loading=!1}})}get terminalParams(){const t=B();return Object.assign(Object.assign({},t),this.pagingParams)}get subAccountParams(){const t=this.terminals.map((t=>t.account_id));return{sub_account_id:[...new Set(t)].join(",")}}get entityId(){return this.terminals.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.terminalsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(l,{key:"7aff8b07dcd19216c714f2318c1af5dbebc54147"},t(b,{key:"7daec7f4553f687b3ebbeb7d561fbf904049841b"},t(v,{key:"2f67e873333800bdd78d8c60f9db218c349097d0"},t(g,{key:"61499a69253f0add24f5e60c385b14fc3e6ba90f"},t(y,{key:"fcd5d3287d6dd3dbf4e20837ca06d9f6dcc74a16"},this.terminalsTable.columnData.map((t=>t)))),t(j,{key:"664b70934aae39f8ccceeaaf012e1933a4c27c95"},t(k,{key:"3d5e79192be7a6a8e2611d9ac7d551e15a4a4207",columnSpan:this.terminalsTable.columnKeys.length,isLoading:this.loading}),t(T,{key:"60d4263bd934af2c6d204a3d2f0aee6639043d80",isEmpty:this.showEmptyState,columnSpan:this.terminalsTable.columnKeys.length}),t(C,{key:"2d3340153f20d7a057e31f3eb2b570ec1d7c4e9f",columnSpan:this.terminalsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.terminalsTable.rowData.map(((e,i)=>t(w,{"data-test-id":"table-row","data-row-entity-id":this.entityId[i],onClick:this.rowClickHandler},e)))),this.paging&&t(_,{key:"b893b1cd12d3c0440b1c5cb015503aa8309a84e1"},t(S,{key:"532462ef72bc8c9fbbf8cae69c1f7ebd60b403b4"},t(D,{key:"c18d2a8f05cbc17f7dc21a18a814a7eb8c83d6ea",colSpan:this.terminalsTable.columnData.length},t("pagination-menu",{key:"fd1aef3373787dfb79f517a69e2d771d61d5dee3",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"],pagingParams:["updateOnPropChange"],getTerminals:["updateOnPropChange"],getSubAccounts:["updateOnPropChange"],columns:["updateOnPropChange"]}}};export{z as justifi_terminals_list}
1
+ import{h as t,r as e,c as i}from"./p-CV0Pyo1O.js";import{n as s,C as a,b as r}from"./p-Dqxyi-uK.js";import{J as n}from"./p-CiVEIyOt.js";import{d as o}from"./p-But70V31.js";import{T as c}from"./p-B4ZUdQg4.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{p as h}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{g as d,a as p}from"./p-BhpaUYtS.js";import{m,S as u}from"./p-CSFjBLVs.js";import{S as l}from"./p-DTnmhThV.js";import{T as f,a as b,b as v,c as g,d as j,e as y,f as k,g as T,h as _,i as w,j as C,k as S,l as D}from"./p-DZr0wLGh.js";import{T as O}from"./p-CZfYo5-1.js";import{B as P,a as I}from"./p-Dz8KJn2G.js";import{a6 as x,a7 as A}from"./p-Bu7gdOaV.js";import{j as B}from"./p-Ds_P-dB8.js";import{o as E,g as V}from"./p-BzjgvHHT.js";import"./p-Deobp59r.js";import"./p-DohdDWHF.js";import"./p-DgTOxu8x.js";import"./p-MPer3Rw7.js";const G={nickname:()=>t("th",{part:x,scope:"col",title:"The nickname associated with the terminal"},"Nickname"),model_name:()=>t("th",{part:x,scope:"col",title:"The model name of the terminal"},"Model Name"),id:()=>t("th",{part:x,scope:"col",title:"The ID of the terminal"},"ID"),provider:()=>t("th",{part:x,scope:"col",title:"The provider of the terminal"},"Provider"),provider_serial_number:()=>t("th",{part:x,scope:"col",title:"The serial number of the terminal"},"Serial Number"),device_id:()=>t("th",{part:x,scope:"col",title:"The device/provider ID of the terminal"},"Device ID"),sub_account_name:()=>t("th",{part:x,scope:"col",title:"The sub account associated with the terminal"},"Sub Account"),status:()=>t("th",{part:x,scope:"col",title:"The current status of each terminal"},"Status")},L={nickname:(e,i)=>t("td",{part:A(i)},e.nickname),model_name:(e,i)=>t("td",{part:A(i)},e.model_name),id:(e,i)=>t("td",{part:A(i)},e.id),provider:(e,i)=>t("td",{part:A(i)},B(e.provider)),provider_serial_number:(e,i)=>t("td",{part:A(i)},e.provider_serial_number),device_id:(e,i)=>t("td",{part:A(i)},e.provider_id),sub_account_name:(e,i)=>t("td",{part:A(i)},e.sub_account_name),status:(e,i)=>t("td",{part:A(i)},t(I,Object.assign({},{connected:{variant:P.SUCCESS,title:"This terminal is connected",text:"Connected"},disconnected:{variant:P.DANGER,title:"This terminal is disconnected",text:"Disconnected"},unknown:{variant:P.SECONDARY,title:"The status of this terminal is unknown",text:"Unknown"},pending_configuration:{variant:P.WARNING,title:"This terminal is pending configuration",text:"Pending configuration"},archived:{variant:P.SECONDARY,title:"This terminal is archived",text:"Archived"}}[e.status])))},z=class{constructor(t){e(this,t),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.terminals=[],this.subAccounts=[],this.loading=!0,this.paging=h,this.pagingParams={},this.columns="nickname,provider_serial_number,status",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:O.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:O.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const i=this.terminals.find((t=>t.id===e));this.clickEvent.emit({name:O.row,data:i})}}componentWillLoad(){o(),this.analytics=new n(this),this.terminalsTable=new f(this.terminals,this.columns,G,L),this.initializeGetData(),this.getTerminals&&this.getSubAccounts&&this.fetchData(),E("set",(()=>{this.pagingParams={}})),E("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}updateOnPropChange(){this.fetchData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:t,authToken:e,service:i})=>async({params:r,onSuccess:n,onError:o})=>{var c,h;try{const m=await i.fetchTerminals(t,e,r);if(m.error)return o({error:p(m.error),code:d(null===(h=m.error)||void 0===h?void 0:h.code),severity:a.ERROR});{const t=Object.assign({},m.page_info);n({terminals:(null===(c=m.data)||void 0===c?void 0:c.map((t=>new s(t))))||[],pagingInfo:t})}}catch(t){const e=d(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:a.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new c}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:r.MISSING_PROPS,message:this.errorMessage,severity:a.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=m({primaryAccountId:this.accountId,authToken:this.authToken,service:new u}))}fetchData(){this.loading=!0,this.getTerminals({params:this.terminalParams,onSuccess:async({terminals:t,pagingInfo:e})=>{this.terminals=t,this.paging=e,this.terminalsTable.collectionData=this.terminals,this.terminalsTable.columnKeys.includes("sub_account_name")?await this.fetchSubAccounts():this.loading=!1},onError:({error:t,code:e,severity:i})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:i}),this.loading=!1}})}async fetchSubAccounts(){this.getSubAccounts({params:this.subAccountParams,onSuccess:({subAccounts:t})=>{this.subAccounts=t,this.terminals=this.terminals.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:i})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:i}),this.loading=!1}})}get terminalParams(){const t=V();return Object.assign(Object.assign({},t),this.pagingParams)}get subAccountParams(){const t=this.terminals.map((t=>t.account_id));return{sub_account_id:[...new Set(t)].join(",")}}get entityId(){return this.terminals.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.terminalsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(l,{key:"7aff8b07dcd19216c714f2318c1af5dbebc54147"},t(b,{key:"7daec7f4553f687b3ebbeb7d561fbf904049841b"},t(v,{key:"2f67e873333800bdd78d8c60f9db218c349097d0"},t(g,{key:"61499a69253f0add24f5e60c385b14fc3e6ba90f"},t(j,{key:"fcd5d3287d6dd3dbf4e20837ca06d9f6dcc74a16"},this.terminalsTable.columnData.map((t=>t)))),t(y,{key:"664b70934aae39f8ccceeaaf012e1933a4c27c95"},t(k,{key:"3d5e79192be7a6a8e2611d9ac7d551e15a4a4207",columnSpan:this.terminalsTable.columnKeys.length,isLoading:this.loading}),t(T,{key:"60d4263bd934af2c6d204a3d2f0aee6639043d80",isEmpty:this.showEmptyState,columnSpan:this.terminalsTable.columnKeys.length}),t(_,{key:"2d3340153f20d7a057e31f3eb2b570ec1d7c4e9f",columnSpan:this.terminalsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.terminalsTable.rowData.map(((e,i)=>t(w,{"data-test-id":"table-row","data-row-entity-id":this.entityId[i],onClick:this.rowClickHandler},e)))),this.paging&&t(C,{key:"b893b1cd12d3c0440b1c5cb015503aa8309a84e1"},t(S,{key:"532462ef72bc8c9fbbf8cae69c1f7ebd60b403b4"},t(D,{key:"c18d2a8f05cbc17f7dc21a18a814a7eb8c83d6ea",colSpan:this.terminalsTable.columnData.length},t("pagination-menu",{key:"fd1aef3373787dfb79f517a69e2d771d61d5dee3",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"],pagingParams:["updateOnPropChange"],getTerminals:["updateOnPropChange"],getSubAccounts:["updateOnPropChange"],columns:["updateOnPropChange"]}}};export{z as justifi_terminals_list}
@@ -1 +1 @@
1
- import{r as e,c as t,h as s}from"./p-CV0Pyo1O.js";import{S as a}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";const o=class{constructor(s){e(this,s),this.checkboxChanged=t(this,"checkboxChanged",7),this.label="Save New Payment Method"}render(){return s(a,{key:"e5792a56b3a21bcf3d5fb0604fbf487ce536b498"},s("save-new-payment-method",{key:"f01b1546e90db73bc8da8edcab4a3d384e4f742e",label:this.label,hidden:this.hidden,onCheckboxChanged:e=>this.checkboxChanged.emit(e.detail)}))}};export{o as justifi_save_new_payment_method}
1
+ import{r as e,c as t,h as s}from"./p-CV0Pyo1O.js";import{S as a}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";const h=class{constructor(s){e(this,s),this.checkboxChanged=t(this,"checkboxChanged",7),this.label="Save New Payment Method"}render(){return s(a,{key:"e5792a56b3a21bcf3d5fb0604fbf487ce536b498"},s("save-new-payment-method",{key:"f01b1546e90db73bc8da8edcab4a3d384e4f742e",label:this.label,hidden:this.hidden,onCheckboxChanged:e=>this.checkboxChanged.emit(e.detail)}))}};export{h as justifi_save_new_payment_method}
@@ -1 +1 @@
1
- import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import{c as r,a as i,F as n}from"./p-D9sqTVmd.js";import{f as o}from"./p-Ds_P-dB8.js";import"./p-B4vLfYnZ.js";import{R as a,C as u,b as h,q as l}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{B as c}from"./p-CU2Dwa94.js";import{S as d}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import{P as m}from"./p-CRaiEpKf.js";import{m as p}from"./p-C9p1gWAC.js";import{J as f}from"./p-CEHwp4sh.js";import{d as y}from"./p-DF7oFWnO.js";import{g as v,a as j}from"./p-BhpaUYtS.js";import{A as w}from"./p-DCpGH4xL.js";import{S as b}from"./p-eBK-iWrz.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-DgTOxu8x.js";import"./p-Bu7gdOaV.js";import"./p-DhrQechy.js";const C=t=>{const e=+t;return i().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${o(e)}`,(function(t){return+t<=+e})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},g=t=>{if(t)return r({amount:C(t),description:i().optional(),reason:i().optional().oneOf([a.customerRequest,a.duplicate,a.fraudulent],"Select a reason")})},T=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],x=w();class A{async postRefund(t,e,s,r){return x.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":e},body:r,authToken:s})}}const S=w();class D{async postVoid(t,e,s){return S.post({endpoint:`payments/${t}/void`,headers:{"Sub-Account":e},authToken:s})}}const I=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(b,{width:"100%",height:"40px"}))),k=()=>t(d,null,t("div",{class:"row gap-5"},t(I,null),t(I,null),t(I,null))),P=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}componentWillLoad(){y(),this.analytics=new f(this),this.initializeApi(),this.formController=new n(g())}handleError(t,e,s){this.errorEvent.emit({errorCode:t,message:e,severity:s})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(h.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",u.ERROR)}isPaymentCreatedWithin25Minutes(){var t;if(!this.payment||!(null===(t=this.payment)||void 0===t?void 0:t.created_at))return!1;const e=new Date(this.payment.created_at);return((new Date).getTime()-e.getTime())/6e4<=25}initializeFormController(){const t=this.refundPayload.amount,e=t?t.toString():"0";this.formController=new n(g(e)),this.formController.setInitialValues({amount:e}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?p({id:this.paymentId,authToken:this.authToken,service:new m})({onSuccess:({payment:t})=>{this.payment=t,this.refundPayload=new l({amount:t.amount_refundable})},onError:({error:t,code:e,severity:s})=>{this.handleError(e,t,s)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(h.MISSING_PROPS,"Payment ID and Auth Token are required",u.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const e=this.formController.values.getValue();return this.refundLoading=!0,this.isPaymentCreatedWithin25Minutes()?this.tryVoidPayment():this.processRefund(e)}async tryVoidPayment(){const t=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({onSuccess:i,onError:n,final:o})=>{var a;try{const o=await r.postVoid(s,e,t);if(o.error)return n({error:j(o.error),code:v(null===(a=o.error)||void 0===a?void 0:a.code),severity:u.ERROR});i(o)}catch(t){const e=v(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:u.ERROR})}finally{o()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new D});return new Promise((e=>{let s,r=!1;const i=this.formController.values.getValue();t({onSuccess:t=>{s=t,r=!0},onError:({error:t,code:s,severity:n})=>{r=!0,this.handleError(s,t,n),this.processRefund(i).then(e)},final:()=>{s&&!s.error&&r&&(this.submitEvent.emit({response:s}),this.submitDisabled=!0,this.refundLoading=!1,e(s.data))}})}))}async processRefund(t){const e=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({refundBody:i,onSuccess:n,onError:o,final:a})=>{var h;try{const a=await r.postRefund(s,e,t,i);if(a.error)return o({error:j(a.error),code:v(null===(h=a.error)||void 0===h?void 0:h.code),severity:u.ERROR});n(a)}catch(t){const e=v(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:u.ERROR})}finally{a()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new A});return new Promise((s=>{let r;e({refundBody:t,onSuccess:t=>{r=t},onError:({error:t,code:e,severity:s})=>{r=t,this.handleError(e,t,s)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,s(r.data)}})}))}render(){if(this.paymentLoading)return t(k,null);const e=this.formController.getInitialValues(),s=this.refundPayload.amount;return t(d,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:e.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:e.reason,inputHandler:this.inputHandler,options:T,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:e.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(c,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${o(+s)}`))))))}};export{P as justifi_refund_payment}
1
+ import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import{c as r,a as i,F as n}from"./p-D9sqTVmd.js";import{f as o}from"./p-Ds_P-dB8.js";import"./p-B4vLfYnZ.js";import{R as a,C as u,b as h,q as l}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{B as c}from"./p-CU2Dwa94.js";import{S as d}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import{P as m}from"./p-C9sMQVpY.js";import{m as p}from"./p-C9p1gWAC.js";import{J as f}from"./p-CiVEIyOt.js";import{d as y}from"./p-But70V31.js";import{g as v,a as j}from"./p-BhpaUYtS.js";import{A as b}from"./p-DohdDWHF.js";import{S as w}from"./p-eBK-iWrz.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-DgTOxu8x.js";import"./p-Bu7gdOaV.js";import"./p-Deobp59r.js";const T=t=>{const e=+t;return i().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${o(e)}`,(function(t){return+t<=+e})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},C=t=>{if(t)return r({amount:T(t),description:i().optional(),reason:i().optional().oneOf([a.customerRequest,a.duplicate,a.fraudulent],"Select a reason")})},g=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],x=b();class V{async postRefund(t,e,s,r){return x.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":e},body:r,authToken:s})}}const D=b();class I{async postVoid(t,e,s){return D.post({endpoint:`payments/${t}/void`,headers:{"Sub-Account":e},authToken:s})}}const S=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(w,{width:"100%",height:"40px"}))),A=()=>t(d,null,t("div",{class:"row gap-5"},t(S,null),t(S,null),t(S,null))),k=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}componentWillLoad(){y(),this.analytics=new f(this),this.initializeApi(),this.formController=new n(C())}handleError(t,e,s){this.errorEvent.emit({errorCode:t,message:e,severity:s})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(h.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",u.ERROR)}isPaymentCreatedWithin25Minutes(){var t;if(!this.payment||!(null===(t=this.payment)||void 0===t?void 0:t.created_at))return!1;const e=new Date(this.payment.created_at);return((new Date).getTime()-e.getTime())/6e4<=25}initializeFormController(){const t=this.refundPayload.amount,e=t?t.toString():"0";this.formController=new n(C(e)),this.formController.setInitialValues({amount:e}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?p({id:this.paymentId,authToken:this.authToken,service:new m})({onSuccess:({payment:t})=>{this.payment=t,this.refundPayload=new l({amount:t.amount_refundable})},onError:({error:t,code:e,severity:s})=>{this.handleError(e,t,s)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(h.MISSING_PROPS,"Payment ID and Auth Token are required",u.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const e=this.formController.values.getValue();return this.refundLoading=!0,this.isPaymentCreatedWithin25Minutes()?this.tryVoidPayment():this.processRefund(e)}async tryVoidPayment(){const t=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({onSuccess:i,onError:n,final:o})=>{var a;try{const o=await r.postVoid(s,e,t);if(o.error)return n({error:j(o.error),code:v(null===(a=o.error)||void 0===a?void 0:a.code),severity:u.ERROR});i(o)}catch(t){const e=v(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:u.ERROR})}finally{o()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new I});return new Promise((e=>{let s,r=!1;const i=this.formController.values.getValue();t({onSuccess:t=>{s=t,r=!0},onError:({error:t,code:s,severity:n})=>{r=!0,this.handleError(s,t,n),this.processRefund(i).then(e)},final:()=>{s&&!s.error&&r&&(this.submitEvent.emit({response:s}),this.submitDisabled=!0,this.refundLoading=!1,e(s.data))}})}))}async processRefund(t){const e=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({refundBody:i,onSuccess:n,onError:o,final:a})=>{var h;try{const a=await r.postRefund(s,e,t,i);if(a.error)return o({error:j(a.error),code:v(null===(h=a.error)||void 0===h?void 0:h.code),severity:u.ERROR});n(a)}catch(t){const e=v(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:u.ERROR})}finally{a()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new V});return new Promise((s=>{let r;e({refundBody:t,onSuccess:t=>{r=t},onError:({error:t,code:e,severity:s})=>{r=t,this.handleError(e,t,s)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,s(r.data)}})}))}render(){if(this.paymentLoading)return t(A,null);const e=this.formController.getInitialValues(),s=this.refundPayload.amount;return t(d,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:e.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:e.reason,inputHandler:this.inputHandler,options:g,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:e.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(c,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${o(+s)}`))))))}};export{k as justifi_refund_payment}
@@ -1 +1 @@
1
- import{r as a,h as e}from"./p-CV0Pyo1O.js";import{f as t,p as s,c as r}from"./p-CGnRD4wF.js";import{f as l,a as d}from"./p-Bu7gdOaV.js";import{S as f}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import{c as i,a as o}from"./p-Ds_P-dB8.js";import"./p-B4vLfYnZ.js";import{P as c}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";const p=class{constructor(e){a(this,e),this.setParamsOnChange=(a,e)=>{t[a]=e},this.handleDateInput=(a,e)=>{const t=i(e,{setEndOfDay:!0});this.setParamsOnChange(a,t)}}componentWillLoad(){Object.entries({status:this.status,created_after:this.createdAfter,created_before:this.createdBefore}).forEach((([a,e])=>{e&&(s[a]=e)}))}get statusOptions(){return[{label:"All",value:""},{label:c.paid,value:"paid"},{label:c.failed,value:"failed"},{label:c.forwarded,value:"forwarded"},{label:c.scheduled,value:"scheduled"},{label:c.in_transit,value:"in_transit"},{label:c.canceled,value:"canceled"}]}render(){const a=Object.assign({},t);return e(f,{key:"57aded74e21baf8bb4e48c372752a5f1160eede2"},e("table-filters-menu",{key:"28bd015a59ac27d25c91aa76a98d53a1d17f1ddd",params:a,clearParams:r,part:l},e("div",{key:"50afcc5bb969c562fc81ff4630a1cf0e778729b9",class:"grid-cols-2 gap-3 p-1"},e("div",{key:"9066f408b3e80d84c1259376ea5f333c64efbd1a",class:"p-2"},e("form-control-select",{key:"49fa9695945cf0bec87fe80ab20783ab86868e42",name:"status",label:"Status",options:this.statusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.status||t.status||"",disabled:!!this.status,part:d})),e("div",{key:"169fd2190f8696a194436b8b8a22477c01e28c3f",class:"p-2"},e("form-control-date",{key:"edc8aa14f0162f74172a7eac92bb98bf7afe0185",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:o(this.createdAfter,{showInputDate:!0})||o(t.created_after,{showInputDate:!0}),disabled:!!this.createdAfter,part:d})),e("div",{key:"6367da41915508aeb28ee8ff60f538322bfbd1c8",class:"p-2"},e("form-control-date",{key:"2768b468eccbfb746c62c1b9172c12213e70a4ed",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:o(this.createdBefore,{showInputDate:!0})||o(t.created_before,{showInputDate:!0}),disabled:!!this.createdBefore,part:d})))))}};export{p as justifi_payouts_list_filters}
1
+ import{r as a,h as e}from"./p-CV0Pyo1O.js";import{f as t,p as s,c as r}from"./p-CGnRD4wF.js";import{f as l,a as d}from"./p-Bu7gdOaV.js";import{S as f}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import{c as i,a as o}from"./p-Ds_P-dB8.js";import"./p-B4vLfYnZ.js";import{P as c}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";const p=class{constructor(e){a(this,e),this.setParamsOnChange=(a,e)=>{t[a]=e},this.handleDateInput=(a,e)=>{const t=i(e,{setEndOfDay:!0});this.setParamsOnChange(a,t)}}componentWillLoad(){Object.entries({status:this.status,created_after:this.createdAfter,created_before:this.createdBefore}).forEach((([a,e])=>{e&&(s[a]=e)}))}get statusOptions(){return[{label:"All",value:""},{label:c.paid,value:"paid"},{label:c.failed,value:"failed"},{label:c.forwarded,value:"forwarded"},{label:c.scheduled,value:"scheduled"},{label:c.in_transit,value:"in_transit"},{label:c.canceled,value:"canceled"}]}render(){const a=Object.assign({},t);return e(f,{key:"57aded74e21baf8bb4e48c372752a5f1160eede2"},e("table-filters-menu",{key:"28bd015a59ac27d25c91aa76a98d53a1d17f1ddd",params:a,clearParams:r,part:l},e("div",{key:"50afcc5bb969c562fc81ff4630a1cf0e778729b9",class:"grid-cols-2 gap-3 p-1"},e("div",{key:"9066f408b3e80d84c1259376ea5f333c64efbd1a",class:"p-2"},e("form-control-select",{key:"49fa9695945cf0bec87fe80ab20783ab86868e42",name:"status",label:"Status",options:this.statusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.status||t.status||"",disabled:!!this.status,part:d})),e("div",{key:"169fd2190f8696a194436b8b8a22477c01e28c3f",class:"p-2"},e("form-control-date",{key:"edc8aa14f0162f74172a7eac92bb98bf7afe0185",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:o(this.createdAfter,{showInputDate:!0})||o(t.created_after,{showInputDate:!0}),disabled:!!this.createdAfter,part:d})),e("div",{key:"6367da41915508aeb28ee8ff60f538322bfbd1c8",class:"p-2"},e("form-control-date",{key:"2768b468eccbfb746c62c1b9172c12213e70a4ed",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:o(this.createdBefore,{showInputDate:!0})||o(t.created_before,{showInputDate:!0}),disabled:!!this.createdBefore,part:d})))))}};export{p as justifi_payouts_list_filters}
@@ -1 +1 @@
1
- import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import{S as a}from"./p-05AWudQe.js";import{T as r,a as i,b as o,c as d,d as h,e as n,f as c,g as p,h as l,i as m,j as u,k as f,l as b}from"./p-DZr0wLGh.js";import{T as y}from"./p-CZfYo5-1.js";import{d as g}from"./p-DF7oFWnO.js";import{a6 as v,a7 as w}from"./p-Bu7gdOaV.js";import{a as j}from"./p-Ds_P-dB8.js";import"./p-B4vLfYnZ.js";import{f as T,p as C,C as k,b as _}from"./p-Dqxyi-uK.js";import{p as O}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{B as D,a as S}from"./p-Dz8KJn2G.js";import"./p-HXpYMWUU.js";import{g as x,a as P}from"./p-BhpaUYtS.js";import{A as B}from"./p-DCpGH4xL.js";import{J as I}from"./p-CEHwp4sh.js";import{o as A,g as E}from"./p-DUtecvro.js";import"./p-MPer3Rw7.js";import"./p-DhrQechy.js";import"./p-DgTOxu8x.js";const L={created_at:()=>t("th",{part:v,scope:"col",title:"The date and time the order was created"},"Created At"),updated_at:()=>t("th",{part:v,scope:"col",title:"The date and time the order was last updated"},"Updated At"),order_status:()=>t("th",{part:v,scope:"col",title:"The current status of the order"},"Order Status"),business_id:()=>t("th",{part:v,scope:"col",title:"The business ID associated with the order"},"Business ID"),company_name:()=>t("th",{part:v,scope:"col",title:"The business name associated with the order"},"Business Name"),provider:()=>t("th",{part:v,scope:"col",title:"The provider associated with the order"},"Provider"),order_type:()=>t("th",{part:v,scope:"col",title:"The type of order"},"Order Type"),quantity:()=>t("th",{part:v,scope:"col",title:"The number of terminals associated with the order"},"Order Quantity")},q={created_at:(e,s)=>t("td",{part:w(s)},t("div",{class:"fw-bold"},j(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},j(e.created_at,{showTime:!0}))),updated_at:(e,s)=>t("td",{part:w(s)},t("div",{class:"fw-bold"},j(e.updated_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},j(e.updated_at,{showTime:!0}))),order_status:(e,s)=>t("td",{part:w(s)},t(S,Object.assign({},{submitted:{variant:D.PRIMARY,title:"This order is submitted",text:"Submitted"},completed:{variant:D.SUCCESS,title:"This order has been completed",text:"Completed"},created:{variant:D.SECONDARY,title:"This order is created",text:"Created"},in_progress:{variant:D.PRIMARY,title:"This order is in progress",text:"In Progress"},on_hold:{variant:D.WARNING,title:"This order is on hold",text:"On Hold"},canceled:{variant:D.DANGER,title:"This order is canceled",text:"Canceled"}}[e.order_status]))),business_id:(e,s)=>t("td",{part:w(s)},e.business_id),company_name:(e,s)=>t("td",{part:w(s)},e.company_name),provider:(e,s)=>t("td",{part:w(s)},e.provider),order_type:(e,s)=>{let a;return e.order_type===T.boardingOnly?a="Boarding Only":e.order_type===T.boardingShipping&&(a="Boarding & Shipping"),t("td",{part:w(s)},a)},quantity:(e,s)=>t("td",{part:w(s)},e.terminals.length)},G=B();class H{async fetchTerminalOrders(t,e,s){return G.get({endpoint:"terminals/orders",params:s,headers:{account:t},authToken:e})}}const U=class{constructor(t){e(this,t),this.clickEvent=s(this,"click-event",7),this.errorEvent=s(this,"error-event",7),this.columns="created_at,updated_at,order_status,quantity",this.terminalOrders=[],this.loading=!0,this.paging=O,this.pagingParams={},this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:y.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:y.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const s=this.terminalOrders.find((t=>t.id===e));this.clickEvent.emit({name:y.row,data:s})}}componentWillLoad(){g(),this.analytics=new I(this),this.terminalOrdersTable=new r(this.terminalOrders,this.columns,L,q),this.initializeGetData(),this.getTerminalOrders&&this.fetchData(),A("set",(()=>{this.pagingParams={}})),A("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}authPropChanged(){this.initializeGetData(),this.getTerminalOrders&&this.fetchData()}pagingOrColumnsChanged(){this.getTerminalOrders&&this.fetchData()}initializeGetData(){this.accountId&&this.authToken?this.getTerminalOrders=(({id:t,authToken:e,service:s})=>async({params:a,onSuccess:r,onError:i,final:o})=>{var d,h;try{const o=await s.fetchTerminalOrders(t,e,a);if(o.error)return i({error:P(o.error),code:x(null===(h=o.error)||void 0===h?void 0:h.code),severity:k.ERROR});{const t=Object.assign({},o.page_info);r({terminalOrders:(null===(d=o.data)||void 0===d?void 0:d.map((t=>new C(t))))||[],pagingInfo:t})}}catch(t){const e=x(null==t?void 0:t.code);return i({error:t.message||t,code:e,severity:k.ERROR})}finally{o()}})({id:this.accountId,authToken:this.authToken,service:new H}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:_.MISSING_PROPS,message:this.errorMessage,severity:k.ERROR}))}fetchData(){this.getTerminalOrders&&(this.loading=!0,this.getTerminalOrders({params:this.terminalOrderParams,onSuccess:async({terminalOrders:t,pagingInfo:e})=>{this.terminalOrders=t,this.paging=e,this.terminalOrdersTable.collectionData=this.terminalOrders},onError:({error:t,code:e,severity:s})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:s})},final:()=>{this.loading=!1}}))}get terminalOrderParams(){const t=E();return Object.assign(Object.assign({},t),this.pagingParams)}get entityId(){return this.terminalOrders.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.terminalOrdersTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(a,{key:"536aeda1d21130b0289b62a77728e06c4c925b4d"},t(i,{key:"7865e36b01c6c37f45a66465680cf545ebe4529b"},t(o,{key:"301d38dab2c6ea3e88c86ff8bc3904fe9dc37100"},t(d,{key:"0da6586396379ae6bd10dcfecc814533df737a29"},t(h,{key:"5fd721f7fdffd547d3eda557ec55a1575334c88d"},this.terminalOrdersTable.columnData.map((t=>t)))),t(n,{key:"e6568d2f0a6cc0e52d729c4e3890c896e4538ee8"},t(c,{key:"286bfd64db33d107c13961f377055785756fc6ba",columnSpan:this.terminalOrdersTable.columnKeys.length,isLoading:this.loading}),t(p,{key:"0aed85e9c5912c327755b71dab28cb8b0c43ba64",isEmpty:this.showEmptyState,columnSpan:this.terminalOrdersTable.columnKeys.length}),t(l,{key:"718c86be52dd5bdf545ed1976cd51b474072ef41",columnSpan:this.terminalOrdersTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.terminalOrdersTable.rowData.map(((e,s)=>t(m,{"data-test-id":"table-row","data-row-entity-id":this.entityId[s],onClick:this.rowClickHandler},e)))),this.paging&&t(u,{key:"783e78b798f8bbf0b03b193c9858e5afd991af68"},t(f,{key:"29057f6fec58617a44c328076e4856bc896eb3c2"},t(b,{key:"20ff58db34905a4d388c2b9425d3abb85099ec7a",colSpan:this.terminalOrdersTable.columnData.length},t("pagination-menu",{key:"e466c95839f3aaf33cfa8bc6baa8564a30022059",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["authPropChanged"],authToken:["authPropChanged"],pagingParams:["pagingOrColumnsChanged"],columns:["pagingOrColumnsChanged"]}}};export{U as justifi_terminal_orders_list}
1
+ import{h as t,r as e,c as s}from"./p-CV0Pyo1O.js";import{S as a}from"./p-DTnmhThV.js";import{T as r,a as i,b as o,c as d,d as h,e as n,f as c,g as p,h as l,i as m,j as u,k as f,l as b}from"./p-DZr0wLGh.js";import{T as y}from"./p-CZfYo5-1.js";import{d as g}from"./p-But70V31.js";import{a6 as v,a7 as w}from"./p-Bu7gdOaV.js";import{a as T}from"./p-Ds_P-dB8.js";import"./p-B4vLfYnZ.js";import{f as j,p as C,C as k,b as _}from"./p-Dqxyi-uK.js";import{p as O}from"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{B as D,a as S}from"./p-Dz8KJn2G.js";import"./p-HXpYMWUU.js";import{g as x,a as P}from"./p-BhpaUYtS.js";import{A as B}from"./p-DohdDWHF.js";import{J as I}from"./p-CiVEIyOt.js";import{o as E,g as V}from"./p-DUtecvro.js";import"./p-MPer3Rw7.js";import"./p-Deobp59r.js";import"./p-DgTOxu8x.js";const q={created_at:()=>t("th",{part:v,scope:"col",title:"The date and time the order was created"},"Created At"),updated_at:()=>t("th",{part:v,scope:"col",title:"The date and time the order was last updated"},"Updated At"),order_status:()=>t("th",{part:v,scope:"col",title:"The current status of the order"},"Order Status"),business_id:()=>t("th",{part:v,scope:"col",title:"The business ID associated with the order"},"Business ID"),company_name:()=>t("th",{part:v,scope:"col",title:"The business name associated with the order"},"Business Name"),provider:()=>t("th",{part:v,scope:"col",title:"The provider associated with the order"},"Provider"),order_type:()=>t("th",{part:v,scope:"col",title:"The type of order"},"Order Type"),quantity:()=>t("th",{part:v,scope:"col",title:"The number of terminals associated with the order"},"Order Quantity")},A={created_at:(e,s)=>t("td",{part:w(s)},t("div",{class:"fw-bold"},T(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},T(e.created_at,{showTime:!0}))),updated_at:(e,s)=>t("td",{part:w(s)},t("div",{class:"fw-bold"},T(e.updated_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},T(e.updated_at,{showTime:!0}))),order_status:(e,s)=>t("td",{part:w(s)},t(S,Object.assign({},{submitted:{variant:D.PRIMARY,title:"This order is submitted",text:"Submitted"},completed:{variant:D.SUCCESS,title:"This order has been completed",text:"Completed"},created:{variant:D.SECONDARY,title:"This order is created",text:"Created"},in_progress:{variant:D.PRIMARY,title:"This order is in progress",text:"In Progress"},on_hold:{variant:D.WARNING,title:"This order is on hold",text:"On Hold"},canceled:{variant:D.DANGER,title:"This order is canceled",text:"Canceled"}}[e.order_status]))),business_id:(e,s)=>t("td",{part:w(s)},e.business_id),company_name:(e,s)=>t("td",{part:w(s)},e.company_name),provider:(e,s)=>t("td",{part:w(s)},e.provider),order_type:(e,s)=>{let a;return e.order_type===j.boardingOnly?a="Boarding Only":e.order_type===j.boardingShipping&&(a="Boarding & Shipping"),t("td",{part:w(s)},a)},quantity:(e,s)=>t("td",{part:w(s)},e.terminals.length)},L=B();class U{async fetchTerminalOrders(t,e,s){return L.get({endpoint:"terminals/orders",params:s,headers:{account:t},authToken:e})}}const Y=class{constructor(t){e(this,t),this.clickEvent=s(this,"click-event",7),this.errorEvent=s(this,"error-event",7),this.columns="created_at,updated_at,order_status,quantity",this.terminalOrders=[],this.loading=!0,this.paging=O,this.pagingParams={},this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:y.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:y.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const s=this.terminalOrders.find((t=>t.id===e));this.clickEvent.emit({name:y.row,data:s})}}componentWillLoad(){g(),this.analytics=new I(this),this.terminalOrdersTable=new r(this.terminalOrders,this.columns,q,A),this.initializeGetData(),this.getTerminalOrders&&this.fetchData(),E("set",(()=>{this.pagingParams={}})),E("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}authPropChanged(){this.initializeGetData(),this.getTerminalOrders&&this.fetchData()}pagingOrColumnsChanged(){this.getTerminalOrders&&this.fetchData()}initializeGetData(){this.accountId&&this.authToken?this.getTerminalOrders=(({id:t,authToken:e,service:s})=>async({params:a,onSuccess:r,onError:i,final:o})=>{var d,h;try{const o=await s.fetchTerminalOrders(t,e,a);if(o.error)return i({error:P(o.error),code:x(null===(h=o.error)||void 0===h?void 0:h.code),severity:k.ERROR});{const t=Object.assign({},o.page_info);r({terminalOrders:(null===(d=o.data)||void 0===d?void 0:d.map((t=>new C(t))))||[],pagingInfo:t})}}catch(t){const e=x(null==t?void 0:t.code);return i({error:t.message||t,code:e,severity:k.ERROR})}finally{o()}})({id:this.accountId,authToken:this.authToken,service:new U}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:_.MISSING_PROPS,message:this.errorMessage,severity:k.ERROR}))}fetchData(){this.getTerminalOrders&&(this.loading=!0,this.getTerminalOrders({params:this.terminalOrderParams,onSuccess:async({terminalOrders:t,pagingInfo:e})=>{this.terminalOrders=t,this.paging=e,this.terminalOrdersTable.collectionData=this.terminalOrders},onError:({error:t,code:e,severity:s})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:e,message:t,severity:s})},final:()=>{this.loading=!1}}))}get terminalOrderParams(){const t=V();return Object.assign(Object.assign({},t),this.pagingParams)}get entityId(){return this.terminalOrders.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.terminalOrdersTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(a,{key:"536aeda1d21130b0289b62a77728e06c4c925b4d"},t(i,{key:"7865e36b01c6c37f45a66465680cf545ebe4529b"},t(o,{key:"301d38dab2c6ea3e88c86ff8bc3904fe9dc37100"},t(d,{key:"0da6586396379ae6bd10dcfecc814533df737a29"},t(h,{key:"5fd721f7fdffd547d3eda557ec55a1575334c88d"},this.terminalOrdersTable.columnData.map((t=>t)))),t(n,{key:"e6568d2f0a6cc0e52d729c4e3890c896e4538ee8"},t(c,{key:"286bfd64db33d107c13961f377055785756fc6ba",columnSpan:this.terminalOrdersTable.columnKeys.length,isLoading:this.loading}),t(p,{key:"0aed85e9c5912c327755b71dab28cb8b0c43ba64",isEmpty:this.showEmptyState,columnSpan:this.terminalOrdersTable.columnKeys.length}),t(l,{key:"718c86be52dd5bdf545ed1976cd51b474072ef41",columnSpan:this.terminalOrdersTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.terminalOrdersTable.rowData.map(((e,s)=>t(m,{"data-test-id":"table-row","data-row-entity-id":this.entityId[s],onClick:this.rowClickHandler},e)))),this.paging&&t(u,{key:"783e78b798f8bbf0b03b193c9858e5afd991af68"},t(f,{key:"29057f6fec58617a44c328076e4856bc896eb3c2"},t(b,{key:"20ff58db34905a4d388c2b9425d3abb85099ec7a",colSpan:this.terminalOrdersTable.columnData.length},t("pagination-menu",{key:"e466c95839f3aaf33cfa8bc6baa8564a30022059",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["authPropChanged"],authToken:["authPropChanged"],pagingParams:["pagingOrColumnsChanged"],columns:["pagingOrColumnsChanged"]}}};export{Y as justifi_terminal_orders_list}
@@ -1 +1 @@
1
- import{r as i,h as r}from"./p-CV0Pyo1O.js";import{S as o}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";const s=class{constructor(r){i(this,r)}async getValues(){var i,r;return null!==(r=null===(i=this.billingFormRef)||void 0===i?void 0:i.getValues())&&void 0!==r?r:{}}async validate(){var i,r;return null!==(r=null===(i=this.billingFormRef)||void 0===i?void 0:i.validate())&&void 0!==r?r:{isValid:!1,errors:{}}}render(){return r(o,{key:"5f845819a98bb3f9c477d39447c342dbc568f541"},r("billing-form",{key:"992fb4ea8df4767d7359b73250581b8b1e5c83ad",legend:this.legend,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:this.paymentMethodType,ref:i=>this.billingFormRef=i}))}};export{s as justifi_billing_form}
1
+ import{r as i,h as r}from"./p-CV0Pyo1O.js";import{S as o}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";const s=class{constructor(r){i(this,r)}async getValues(){var i,r;return null!==(r=null===(i=this.billingFormRef)||void 0===i?void 0:i.getValues())&&void 0!==r?r:{}}async validate(){var i,r;return null!==(r=null===(i=this.billingFormRef)||void 0===i?void 0:i.validate())&&void 0!==r?r:{isValid:!1,errors:{}}}render(){return r(o,{key:"5f845819a98bb3f9c477d39447c342dbc568f541"},r("billing-form",{key:"992fb4ea8df4767d7359b73250581b8b1e5c83ad",legend:this.legend,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:this.paymentMethodType,ref:i=>this.billingFormRef=i}))}};export{s as justifi_billing_form}
@@ -1,4 +1,4 @@
1
- import{r as t,c as i,h as e}from"./p-CV0Pyo1O.js";import{A as s}from"./p-DCpGH4xL.js";import{C as n,b as r}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{g as o,a as h}from"./p-BhpaUYtS.js";import{E as a}from"./p-Bh6Q8AqQ.js";import{J as c}from"./p-CEHwp4sh.js";import{d as l}from"./p-DF7oFWnO.js";import{f as u,o as f}from"./p-Ds_P-dB8.js";import{S as d}from"./p-MPer3Rw7.js";import{S as p}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-DhrQechy.js";import"./p-Bu7gdOaV.js";import"./p-HXpYMWUU.js";
1
+ import{r as t,c as i,h as e}from"./p-CV0Pyo1O.js";import{A as s}from"./p-DohdDWHF.js";import{C as n,b as r}from"./p-Dqxyi-uK.js";import"./p-CLHwhyvu.js";import"./p-CTtGaVYs.js";import{g as o,a as h}from"./p-BhpaUYtS.js";import{E as a}from"./p-Bh6Q8AqQ.js";import{J as c}from"./p-CiVEIyOt.js";import{d as l}from"./p-But70V31.js";import{f as u,o as f}from"./p-Ds_P-dB8.js";import{S as d}from"./p-MPer3Rw7.js";import{S as p}from"./p-DTnmhThV.js";import"./p-CZfYo5-1.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-Deobp59r.js";import"./p-Bu7gdOaV.js";import"./p-HXpYMWUU.js";
2
2
  /*!
3
3
  * @kurkle/color v0.3.4
4
4
  * https://github.com/kurkle/color#readme