@justifi/webcomponents 6.14.5 → 6.15.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (444) hide show
  1. package/dist/cjs/{Analytics-BVHauOC2.js → Analytics-COhunq0p.js} +3 -3
  2. package/dist/cjs/{Api-BzB0rppJ.js → Api-Do6SaltY.js} +1 -1
  3. package/dist/cjs/{Plaid-B2o4c_Ej.js → Plaid-D85oV9FN.js} +5 -0
  4. package/dist/cjs/additional-questions-form-step_15.cjs.entry.js +7 -7
  5. package/dist/cjs/additional-statement_8.cjs.entry.js +8 -8
  6. package/dist/cjs/bank-account-billing-form-simple_4.cjs.entry.js +4 -4
  7. package/dist/cjs/bank-account-document-form-inputs.cjs.entry.js +1 -1
  8. package/dist/cjs/bank-account-form.cjs.entry.js +5 -5
  9. package/dist/cjs/{business.service-j_VDzA2-.js → business.service-72YETCdB.js} +2 -2
  10. package/dist/cjs/card-form.cjs.entry.js +5 -5
  11. package/dist/cjs/{check-pkg-version-JMiLuNXu.js → check-pkg-version-BxGoSXGD.js} +1 -1
  12. package/dist/cjs/{checkout-actions-VCJi-q4z.js → checkout-actions-BRQFQ6n-.js} +2 -2
  13. package/dist/cjs/{checkout.service-0vHtBDZY.js → checkout.service-CPsXfx0Z.js} +2 -2
  14. package/dist/cjs/{checkout.store-DOa1-SjA.js → checkout.store-DaV9lvEQ.js} +6 -1
  15. package/dist/cjs/custom-popper_2.cjs.entry.js +2 -2
  16. package/dist/cjs/dispute-notification_2.cjs.entry.js +10 -10
  17. package/dist/cjs/{event-types-CMpeGHw8.js → event-types-UHzCC7Ga.js} +2 -2
  18. package/dist/cjs/form-address-fields_3.cjs.entry.js +2 -2
  19. package/dist/cjs/form-alert_3.cjs.entry.js +5 -5
  20. package/dist/cjs/form-control-checkbox.cjs.entry.js +2 -2
  21. package/dist/cjs/form-control-date.cjs.entry.js +2 -2
  22. package/dist/cjs/form-control-file-v2_2.cjs.entry.js +3 -3
  23. package/dist/cjs/form-control-file.cjs.entry.js +2 -2
  24. package/dist/cjs/form-control-monetary.cjs.entry.js +2 -2
  25. package/dist/cjs/form-control-number_2.cjs.entry.js +2 -2
  26. package/dist/cjs/form-control-radio.cjs.entry.js +2 -2
  27. package/dist/cjs/form-control-select_2.cjs.entry.js +4 -4
  28. package/dist/cjs/{get-business-BBDsPv-b.js → get-business-BpaRbn5S.js} +2 -2
  29. package/dist/cjs/{get-payment-details-BYZeUFAB.js → get-payment-details-Cmg8gWvo.js} +2 -2
  30. package/dist/cjs/{get-subaccounts-B7e8Eovg.js → get-subaccounts-Bp7DOmM_.js} +3 -3
  31. package/dist/cjs/{index-CajjbB9t.js → index-DDa1jd08.js} +4 -0
  32. package/dist/cjs/index.cjs.js +1 -1
  33. package/dist/cjs/internal-button.cjs.entry.js +1 -1
  34. package/dist/cjs/{justifi-apple-pay_11.cjs.entry.js → justifi-apple-pay_12.cjs.entry.js} +314 -26
  35. package/dist/cjs/justifi-bank-account-billing-form-simple.cjs.entry.js +6 -6
  36. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +6 -6
  37. package/dist/cjs/justifi-billing-form-full.cjs.entry.js +1 -1
  38. package/dist/cjs/justifi-billing-form.cjs.entry.js +1 -1
  39. package/dist/cjs/justifi-business-details.cjs.entry.js +8 -8
  40. package/dist/cjs/justifi-business-form.cjs.entry.js +8 -8
  41. package/dist/cjs/justifi-card-billing-form-simple.cjs.entry.js +1 -1
  42. package/dist/cjs/justifi-card-form.cjs.entry.js +6 -6
  43. package/dist/cjs/justifi-checkout-qr-code.cjs.entry.js +5 -5
  44. package/dist/cjs/justifi-checkout.cjs.entry.js +8 -8
  45. package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +3 -3
  46. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +10 -10
  47. package/dist/cjs/justifi-dispute-management.cjs.entry.js +8 -8
  48. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +6 -6
  49. package/dist/cjs/justifi-order-terminals.cjs.entry.js +10 -10
  50. package/dist/cjs/justifi-payment-details.cjs.entry.js +16 -16
  51. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +8 -8
  52. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +8 -8
  53. package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +2 -2
  54. package/dist/cjs/justifi-payments-list.cjs.entry.js +8 -8
  55. package/dist/cjs/justifi-payout-details.cjs.entry.js +11 -11
  56. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +8 -8
  57. package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +3 -3
  58. package/dist/cjs/justifi-payouts-list.cjs.entry.js +10 -10
  59. package/dist/cjs/justifi-qr-terminal.cjs.entry.js +8 -8
  60. package/dist/cjs/justifi-refund-payment.cjs.entry.js +8 -8
  61. package/dist/cjs/justifi-save-new-payment-method.cjs.entry.js +1 -1
  62. package/dist/cjs/justifi-saved-payment-method.cjs.entry.js +1 -1
  63. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +8 -8
  64. package/dist/cjs/justifi-skeleton.cjs.entry.js +1 -1
  65. package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +4 -4
  66. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +8 -8
  67. package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +2 -2
  68. package/dist/cjs/justifi-terminals-list.cjs.entry.js +9 -9
  69. package/dist/cjs/loader.cjs.js +1 -1
  70. package/dist/cjs/{package-DfdMLmz7.js → package-G3Vs7Jx5.js} +1 -1
  71. package/dist/cjs/payment-method-option.cjs.entry.js +1 -1
  72. package/dist/cjs/{payment-provisioning-actions-CIsDrh8k.js → payment-provisioning-actions-DDooZhhk.js} +2 -2
  73. package/dist/cjs/{payment.service-Bs3HJ4Kv.js → payment.service-CVwTrHEL.js} +2 -2
  74. package/dist/cjs/{payout.service-DNWZxt3R.js → payout.service-CL3VR0hN.js} +2 -2
  75. package/dist/cjs/{payouts-status-DVU5138C.js → payouts-status-1IUtW-UQ.js} +2 -2
  76. package/dist/cjs/{plaid.service-B_YQGBoC.js → plaid.service-Cukg5wuY.js} +2 -2
  77. package/dist/cjs/radio-list-item.cjs.entry.js +1 -1
  78. package/dist/cjs/save-new-payment-method.cjs.entry.js +3 -3
  79. package/dist/cjs/table-filters-menu.cjs.entry.js +1 -1
  80. package/dist/cjs/terminal-quantity-selector.cjs.entry.js +1 -1
  81. package/dist/cjs/{terminal.service-CvFZEemr.js → terminal.service-C0KG7BqL.js} +2 -2
  82. package/dist/cjs/{utils-WrOn06xB.js → utils-CBriZzRC.js} +1 -1
  83. package/dist/cjs/webcomponents.cjs.js +1 -1
  84. package/dist/collection/api/Checkout.js +5 -0
  85. package/dist/collection/api/Paypal.js +1 -0
  86. package/dist/collection/api/index.js +1 -0
  87. package/dist/collection/api/services/paypal.service.js +9 -0
  88. package/dist/collection/collection-manifest.json +1 -0
  89. package/dist/collection/components/checkout/billing-form/bank-account-billing-form-simple.js +1 -1
  90. package/dist/collection/components/checkout/billing-form/card-billing-form-simple.js +1 -1
  91. package/dist/collection/components/checkout/billing-form/justifi-billing-form.js +1 -1
  92. package/dist/collection/components/checkout/card-form/card-form.js +2 -2
  93. package/dist/collection/components/checkout/justifi-checkout.js +1 -1
  94. package/dist/collection/components/checkout/justifi-saved-payment-method.js +1 -1
  95. package/dist/collection/components/checkout/save-new-payment-method/justifi-save-new-payment-method.js +1 -1
  96. package/dist/collection/components/checkout/save-new-payment-method/save-new-payment-method.js +1 -1
  97. package/dist/collection/components/checkouts-list/checkouts-list-filters.js +3 -3
  98. package/dist/collection/components/checkouts-list/justifi-checkouts-list.js +2 -2
  99. package/dist/collection/components/dispute-management/dispute-notification.js +2 -2
  100. package/dist/collection/components/dispute-management/dispute-response/additional-statement.js +1 -1
  101. package/dist/collection/components/dispute-management/dispute-response/cancellation-policy.js +1 -1
  102. package/dist/collection/components/dispute-management/dispute-response/customer-details.js +1 -1
  103. package/dist/collection/components/dispute-management/dispute-response/dispute-response.js +1 -1
  104. package/dist/collection/components/dispute-management/dispute-response/duplicate-charge.js +1 -1
  105. package/dist/collection/components/dispute-management/dispute-response/electronic-evidence.js +1 -1
  106. package/dist/collection/components/dispute-management/dispute-response/product-or-service.js +1 -1
  107. package/dist/collection/components/dispute-management/dispute-response/refund-policy.js +1 -1
  108. package/dist/collection/components/dispute-management/dispute-response/shipping-details.js +1 -1
  109. package/dist/collection/components/dispute-management/justifi-dispute-management.js +1 -1
  110. package/dist/collection/components/filters/table-filters-menu.js +1 -1
  111. package/dist/collection/components/modular-checkout/ModularCheckout.js +4 -0
  112. package/dist/collection/components/modular-checkout/justifi-modular-checkout.js +75 -11
  113. package/dist/collection/components/modular-checkout/sub-components/justifi-bank-account-billing-form-simple.js +1 -1
  114. package/dist/collection/components/modular-checkout/sub-components/justifi-bank-account-form.js +1 -1
  115. package/dist/collection/components/modular-checkout/sub-components/justifi-billing-form-full.js +1 -1
  116. package/dist/collection/components/modular-checkout/sub-components/justifi-card-billing-form-simple.js +1 -1
  117. package/dist/collection/components/modular-checkout/sub-components/justifi-card-form.js +1 -1
  118. package/dist/collection/components/modular-checkout/sub-components/justifi-checkout-summary.js +1 -1
  119. package/dist/collection/components/modular-checkout/sub-components/payment-method-option.js +1 -1
  120. package/dist/collection/components/modular-checkout/sub-components/paypal/justifi-paypal.js +278 -0
  121. package/dist/collection/components/modular-checkout/sub-components/paypal/paypal.js +17 -0
  122. package/dist/collection/components/order-terminals/justifi-order-terminals.js +1 -1
  123. package/dist/collection/components/order-terminals/terminal-quantity-selector/terminal-quantity-selector.js +1 -1
  124. package/dist/collection/components/payment-details/justifi-payment-details.js +8 -8
  125. package/dist/collection/components/payment-transactions-list/justifi-payment-transactions-list.js +1 -1
  126. package/dist/collection/components/payments-list/justifi-payments-list-filters.js +2 -2
  127. package/dist/collection/components/payments-list/justifi-payments-list.js +1 -1
  128. package/dist/collection/components/payout-details/justifi-payout-details.js +3 -3
  129. package/dist/collection/components/payout-transactions-list/justifi-payout-transactions-list.js +1 -1
  130. package/dist/collection/components/payouts-list/justifi-payouts-list-filters.js +2 -2
  131. package/dist/collection/components/payouts-list/justifi-payouts-list.js +1 -1
  132. package/dist/collection/components/terminal-orders-list/justifi-terminal-orders-list-filters.js +3 -3
  133. package/dist/collection/components/terminal-orders-list/justifi-terminal-orders-list.js +2 -2
  134. package/dist/collection/components/terminals-list/justifi-terminals-list-filters.js +1 -1
  135. package/dist/collection/components/terminals-list/justifi-terminals-list.js +1 -1
  136. package/dist/collection/components/tokenize-payment-method/justifi-tokenize-payment-method.js +1 -1
  137. package/dist/collection/store/checkout.store.js +5 -0
  138. package/dist/collection/ui-components/custom-popper/custom-popper.js +2 -2
  139. package/dist/collection/ui-components/form/form-control-checkbox.js +2 -2
  140. package/dist/collection/ui-components/form/form-control-date.js +2 -2
  141. package/dist/collection/ui-components/form/form-control-file-v2.js +1 -1
  142. package/dist/collection/ui-components/form/form-control-file.js +2 -2
  143. package/dist/collection/ui-components/form/form-control-monetary.js +2 -2
  144. package/dist/collection/ui-components/form/form-control-number-masked.js +2 -2
  145. package/dist/collection/ui-components/form/form-control-number.js +2 -2
  146. package/dist/collection/ui-components/form/form-control-radio.js +2 -2
  147. package/dist/collection/ui-components/form/form-control-select.js +2 -2
  148. package/dist/collection/ui-components/form/form-control-text.js +2 -2
  149. package/dist/collection/ui-components/form/form-control-textarea.js +2 -2
  150. package/dist/collection/ui-components/form/hidden-input.js +1 -1
  151. package/dist/collection/ui-components/form/iframe-input.js +3 -3
  152. package/dist/collection/ui-components/internal-button.js +1 -1
  153. package/dist/collection/ui-components/radio-list-item.js +1 -1
  154. package/dist/collection/ui-components/shadow-dom-components/justifi-button.js +1 -1
  155. package/dist/collection/ui-components/shadow-dom-components/justifi-header.js +1 -1
  156. package/dist/collection/ui-components/shadow-dom-components/justifi-skeleton.js +1 -1
  157. package/dist/docs.json +115 -3
  158. package/dist/esm/{Analytics-Dgz_MQ1D.js → Analytics-3WmRTICF.js} +3 -3
  159. package/dist/esm/{Api-DScockhO.js → Api-83B3f28Q.js} +1 -1
  160. package/dist/esm/{Plaid-DJ-4YL0_.js → Plaid-BP3xNxQF.js} +5 -0
  161. package/dist/esm/additional-questions-form-step_15.entry.js +7 -7
  162. package/dist/esm/additional-statement_8.entry.js +8 -8
  163. package/dist/esm/bank-account-billing-form-simple_4.entry.js +4 -4
  164. package/dist/esm/bank-account-document-form-inputs.entry.js +1 -1
  165. package/dist/esm/bank-account-form.entry.js +5 -5
  166. package/dist/esm/{business.service-DR2ldRqG.js → business.service-CTqiKKy5.js} +2 -2
  167. package/dist/esm/card-form.entry.js +5 -5
  168. package/dist/esm/{check-pkg-version-CPMg0K2m.js → check-pkg-version-CmFl6VLH.js} +1 -1
  169. package/dist/esm/{checkout-actions-DhL8YxrK.js → checkout-actions-0ftD0elo.js} +2 -2
  170. package/dist/esm/{checkout.service-CU4BnB34.js → checkout.service-wjFjBxIB.js} +2 -2
  171. package/dist/esm/{checkout.store-B6amfNq_.js → checkout.store-B2mtQcB5.js} +6 -1
  172. package/dist/esm/custom-popper_2.entry.js +2 -2
  173. package/dist/esm/dispute-notification_2.entry.js +10 -10
  174. package/dist/esm/{event-types-BNfdthYa.js → event-types-cqQHLwCy.js} +2 -2
  175. package/dist/esm/form-address-fields_3.entry.js +2 -2
  176. package/dist/esm/form-alert_3.entry.js +5 -5
  177. package/dist/esm/form-control-checkbox.entry.js +2 -2
  178. package/dist/esm/form-control-date.entry.js +2 -2
  179. package/dist/esm/form-control-file-v2_2.entry.js +3 -3
  180. package/dist/esm/form-control-file.entry.js +2 -2
  181. package/dist/esm/form-control-monetary.entry.js +2 -2
  182. package/dist/esm/form-control-number_2.entry.js +2 -2
  183. package/dist/esm/form-control-radio.entry.js +2 -2
  184. package/dist/esm/form-control-select_2.entry.js +4 -4
  185. package/dist/esm/{get-business-BSyOONF0.js → get-business-BLCT-zfN.js} +2 -2
  186. package/dist/esm/{get-payment-details-CoGzqJ6o.js → get-payment-details-BokzuPGl.js} +2 -2
  187. package/dist/esm/{get-subaccounts-BraeNX17.js → get-subaccounts-ClGG-LRZ.js} +3 -3
  188. package/dist/esm/{index-DkoufM1t.js → index-DEx8fQeW.js} +4 -0
  189. package/dist/esm/index.js +1 -1
  190. package/dist/esm/internal-button.entry.js +1 -1
  191. package/dist/esm/{justifi-apple-pay_11.entry.js → justifi-apple-pay_12.entry.js} +314 -27
  192. package/dist/esm/justifi-bank-account-billing-form-simple.entry.js +6 -6
  193. package/dist/esm/justifi-bank-account-form.entry.js +6 -6
  194. package/dist/esm/justifi-billing-form-full.entry.js +1 -1
  195. package/dist/esm/justifi-billing-form.entry.js +1 -1
  196. package/dist/esm/justifi-business-details.entry.js +8 -8
  197. package/dist/esm/justifi-business-form.entry.js +8 -8
  198. package/dist/esm/justifi-card-billing-form-simple.entry.js +1 -1
  199. package/dist/esm/justifi-card-form.entry.js +6 -6
  200. package/dist/esm/justifi-checkout-qr-code.entry.js +5 -5
  201. package/dist/esm/justifi-checkout.entry.js +8 -8
  202. package/dist/esm/justifi-checkouts-list-filters.entry.js +3 -3
  203. package/dist/esm/justifi-checkouts-list.entry.js +10 -10
  204. package/dist/esm/justifi-dispute-management.entry.js +8 -8
  205. package/dist/esm/justifi-gross-payment-chart.entry.js +6 -6
  206. package/dist/esm/justifi-order-terminals.entry.js +10 -10
  207. package/dist/esm/justifi-payment-details.entry.js +16 -16
  208. package/dist/esm/justifi-payment-provisioning.entry.js +8 -8
  209. package/dist/esm/justifi-payment-transactions-list.entry.js +8 -8
  210. package/dist/esm/justifi-payments-list-filters.entry.js +2 -2
  211. package/dist/esm/justifi-payments-list.entry.js +8 -8
  212. package/dist/esm/justifi-payout-details.entry.js +11 -11
  213. package/dist/esm/justifi-payout-transactions-list.entry.js +8 -8
  214. package/dist/esm/justifi-payouts-list-filters.entry.js +3 -3
  215. package/dist/esm/justifi-payouts-list.entry.js +10 -10
  216. package/dist/esm/justifi-qr-terminal.entry.js +8 -8
  217. package/dist/esm/justifi-refund-payment.entry.js +8 -8
  218. package/dist/esm/justifi-save-new-payment-method.entry.js +1 -1
  219. package/dist/esm/justifi-saved-payment-method.entry.js +1 -1
  220. package/dist/esm/justifi-season-interruption-insurance.entry.js +8 -8
  221. package/dist/esm/justifi-skeleton.entry.js +1 -1
  222. package/dist/esm/justifi-terminal-orders-list-filters.entry.js +4 -4
  223. package/dist/esm/justifi-terminal-orders-list.entry.js +8 -8
  224. package/dist/esm/justifi-terminals-list-filters.entry.js +2 -2
  225. package/dist/esm/justifi-terminals-list.entry.js +9 -9
  226. package/dist/esm/loader.js +1 -1
  227. package/dist/esm/{package-CiypNylL.js → package-CAVi_ne1.js} +1 -1
  228. package/dist/esm/payment-method-option.entry.js +1 -1
  229. package/dist/esm/{payment-provisioning-actions-DJKGndr3.js → payment-provisioning-actions-VRIPjnAQ.js} +2 -2
  230. package/dist/esm/{payment.service-BxBf9T-D.js → payment.service-D7uv5vym.js} +2 -2
  231. package/dist/esm/{payout.service-DKe3_O4y.js → payout.service-BoSyqft1.js} +2 -2
  232. package/dist/esm/{payouts-status-C0nijel1.js → payouts-status-CaiC5qpn.js} +2 -2
  233. package/dist/esm/{plaid.service-DwWljJOH.js → plaid.service-DufQkxDk.js} +2 -2
  234. package/dist/esm/radio-list-item.entry.js +1 -1
  235. package/dist/esm/save-new-payment-method.entry.js +3 -3
  236. package/dist/esm/table-filters-menu.entry.js +1 -1
  237. package/dist/esm/terminal-quantity-selector.entry.js +1 -1
  238. package/dist/esm/{terminal.service-Q4KXLOka.js → terminal.service-BM2aebB6.js} +2 -2
  239. package/dist/esm/{utils-D6LKoG0M.js → utils-YUOJKtjO.js} +1 -1
  240. package/dist/esm/webcomponents.js +1 -1
  241. package/dist/module/ModularCheckout.js +4 -0
  242. package/dist/module/Plaid.js +5 -0
  243. package/dist/module/additional-statement2.js +1 -1
  244. package/dist/module/bank-account-billing-form-simple2.js +1 -1
  245. package/dist/module/cancellation-policy2.js +1 -1
  246. package/dist/module/card-billing-form-simple2.js +1 -1
  247. package/dist/module/card-form2.js +2 -2
  248. package/dist/module/checkout.store.js +5 -0
  249. package/dist/module/custom-popper2.js +2 -2
  250. package/dist/module/customer-details2.js +1 -1
  251. package/dist/module/dispute-notification2.js +2 -2
  252. package/dist/module/dispute-response2.js +1 -1
  253. package/dist/module/duplicate-charge2.js +1 -1
  254. package/dist/module/electronic-evidence2.js +1 -1
  255. package/dist/module/form-control-checkbox2.js +2 -2
  256. package/dist/module/form-control-date2.js +2 -2
  257. package/dist/module/form-control-file-v22.js +1 -1
  258. package/dist/module/form-control-file2.js +2 -2
  259. package/dist/module/form-control-monetary2.js +2 -2
  260. package/dist/module/form-control-number-masked2.js +2 -2
  261. package/dist/module/form-control-number2.js +2 -2
  262. package/dist/module/form-control-radio2.js +2 -2
  263. package/dist/module/form-control-select2.js +2 -2
  264. package/dist/module/form-control-text2.js +2 -2
  265. package/dist/module/form-control-textarea2.js +2 -2
  266. package/dist/module/hidden-input2.js +1 -1
  267. package/dist/module/iframe-input2.js +3 -3
  268. package/dist/module/internal-button2.js +1 -1
  269. package/dist/module/justifi-bank-account-billing-form-simple.js +1 -1
  270. package/dist/module/justifi-bank-account-form.js +1 -1
  271. package/dist/module/justifi-billing-form-full.js +1 -1
  272. package/dist/module/justifi-billing-form.js +1 -1
  273. package/dist/module/justifi-button2.js +1 -1
  274. package/dist/module/justifi-card-billing-form-simple.js +1 -1
  275. package/dist/module/justifi-card-form.js +1 -1
  276. package/dist/module/justifi-checkout-summary2.js +1 -1
  277. package/dist/module/justifi-checkout.js +53 -47
  278. package/dist/module/justifi-checkouts-list-filters.js +2 -2
  279. package/dist/module/justifi-checkouts-list.js +2 -2
  280. package/dist/module/justifi-dispute-management.js +1 -1
  281. package/dist/module/justifi-header2.js +1 -1
  282. package/dist/module/justifi-modular-checkout2.js +75 -11
  283. package/dist/module/justifi-order-terminals.js +1 -1
  284. package/dist/module/justifi-payment-details.js +8 -8
  285. package/dist/module/justifi-payment-transactions-list.js +1 -1
  286. package/dist/module/justifi-payments-list-filters.js +2 -2
  287. package/dist/module/justifi-payments-list.js +1 -1
  288. package/dist/module/justifi-payout-details.js +3 -3
  289. package/dist/module/justifi-payout-transactions-list.js +1 -1
  290. package/dist/module/justifi-payouts-list-filters.js +2 -2
  291. package/dist/module/justifi-payouts-list.js +1 -1
  292. package/dist/module/justifi-paypal.d.ts +11 -0
  293. package/dist/module/justifi-paypal.js +6 -0
  294. package/dist/module/justifi-paypal2.js +254 -0
  295. package/dist/module/justifi-save-new-payment-method.js +1 -1
  296. package/dist/module/justifi-saved-payment-method.js +1 -1
  297. package/dist/module/justifi-skeleton.js +1 -1
  298. package/dist/module/justifi-terminal-orders-list-filters.js +3 -3
  299. package/dist/module/justifi-terminal-orders-list.js +2 -2
  300. package/dist/module/justifi-terminals-list-filters.js +1 -1
  301. package/dist/module/justifi-terminals-list.js +1 -1
  302. package/dist/module/justifi-tokenize-payment-method2.js +1 -1
  303. package/dist/module/package.js +1 -1
  304. package/dist/module/payment-method-option.js +1 -1
  305. package/dist/module/product-or-service2.js +1 -1
  306. package/dist/module/radio-list-item2.js +1 -1
  307. package/dist/module/refund-policy2.js +1 -1
  308. package/dist/module/save-new-payment-method2.js +1 -1
  309. package/dist/module/shipping-details2.js +1 -1
  310. package/dist/module/table-filters-menu2.js +1 -1
  311. package/dist/module/terminal-quantity-selector2.js +1 -1
  312. package/dist/types/api/Checkout.d.ts +13 -1
  313. package/dist/types/api/Paypal.d.ts +11 -0
  314. package/dist/types/api/index.d.ts +1 -0
  315. package/dist/types/api/services/paypal.service.d.ts +8 -0
  316. package/dist/types/components/modular-checkout/ModularCheckout.d.ts +6 -2
  317. package/dist/types/components/modular-checkout/justifi-modular-checkout.d.ts +7 -0
  318. package/dist/types/components/modular-checkout/sub-components/paypal/justifi-paypal.d.ts +43 -0
  319. package/dist/types/components/modular-checkout/sub-components/paypal/paypal.d.ts +39 -0
  320. package/dist/types/components.d.ts +53 -0
  321. package/dist/types/store/checkout.store.d.ts +2 -0
  322. package/dist/webcomponents/index.esm.js +1 -1
  323. package/dist/webcomponents/{p-49e40ebe.entry.js → p-0aa96018.entry.js} +1 -1
  324. package/dist/webcomponents/p-0fbc806f.entry.js +1 -0
  325. package/dist/webcomponents/p-10787684.entry.js +1 -0
  326. package/dist/webcomponents/{p-bc435cae.entry.js → p-1365a46b.entry.js} +1 -1
  327. package/dist/webcomponents/p-1fa62eba.entry.js +1 -0
  328. package/dist/webcomponents/p-25f70d5f.entry.js +1 -0
  329. package/dist/webcomponents/{p-BlqdDtQr.js → p-27igUlku.js} +1 -1
  330. package/dist/webcomponents/{p-4f54d1b2.entry.js → p-28fb6b50.entry.js} +1 -1
  331. package/dist/webcomponents/{p-f0083ace.entry.js → p-2b5533a1.entry.js} +1 -1
  332. package/dist/webcomponents/{p-da21ae43.entry.js → p-36340e63.entry.js} +1 -1
  333. package/dist/webcomponents/p-3642e189.entry.js +1 -0
  334. package/dist/webcomponents/p-388082cd.entry.js +1 -0
  335. package/dist/webcomponents/p-3f2fb856.entry.js +1 -0
  336. package/dist/webcomponents/{p-041a22dd.entry.js → p-42021e67.entry.js} +1 -1
  337. package/dist/webcomponents/{p-0d9022e5.entry.js → p-4cad48c1.entry.js} +1 -1
  338. package/dist/webcomponents/{p-373586db.entry.js → p-50c2b8f0.entry.js} +1 -1
  339. package/dist/webcomponents/p-5842d4e8.entry.js +1 -0
  340. package/dist/webcomponents/{p-e7909732.entry.js → p-5c89dcdf.entry.js} +1 -1
  341. package/dist/webcomponents/p-5d7b3d71.entry.js +1 -0
  342. package/dist/webcomponents/p-5dcb1713.entry.js +1 -0
  343. package/dist/webcomponents/p-5f8c30b6.entry.js +1 -0
  344. package/dist/webcomponents/p-68e88747.entry.js +1 -0
  345. package/dist/webcomponents/p-6931a1f2.entry.js +1 -0
  346. package/dist/webcomponents/{p-f8f01bbb.entry.js → p-6c94218c.entry.js} +1 -1
  347. package/dist/webcomponents/{p-e954f46c.entry.js → p-6eb65d23.entry.js} +1 -1
  348. package/dist/webcomponents/{p-027ef7e9.entry.js → p-7002286e.entry.js} +1 -1
  349. package/dist/webcomponents/{p-d6122124.entry.js → p-72bb4aff.entry.js} +1 -1
  350. package/dist/webcomponents/p-74575a99.entry.js +1 -0
  351. package/dist/webcomponents/p-777470cb.entry.js +1 -0
  352. package/dist/webcomponents/p-7c405573.entry.js +1 -0
  353. package/dist/webcomponents/p-825a7ee6.entry.js +1 -0
  354. package/dist/webcomponents/p-8d11aa27.entry.js +1 -0
  355. package/dist/webcomponents/{p-3870712e.entry.js → p-909a9828.entry.js} +4 -4
  356. package/dist/webcomponents/p-955c06d3.entry.js +1 -0
  357. package/dist/webcomponents/{p-2139497d.entry.js → p-97c6593d.entry.js} +1 -1
  358. package/dist/webcomponents/p-9e3e2e32.entry.js +1 -0
  359. package/dist/webcomponents/{p-29f68bd0.entry.js → p-9e9a2546.entry.js} +1 -1
  360. package/dist/webcomponents/{p-cb977890.entry.js → p-9f0ef3f3.entry.js} +1 -1
  361. package/dist/webcomponents/{p-DD9-ceDZ.js → p-B0DHIvEj.js} +1 -1
  362. package/dist/webcomponents/{p-BL112JyU.js → p-BAKuMxC9.js} +1 -1
  363. package/dist/webcomponents/{p-DcA_wt-j.js → p-BEL8sLz6.js} +1 -1
  364. package/dist/webcomponents/{p-H4vl65HO.js → p-BSxXlu9H.js} +1 -1
  365. package/dist/webcomponents/p-CAVi_ne1.js +1 -0
  366. package/dist/webcomponents/{p-rIJv0FaI.js → p-CIpBEUtx.js} +1 -1
  367. package/dist/webcomponents/{p-CnHbIkmu.js → p-CJEetAx7.js} +1 -1
  368. package/dist/webcomponents/p-CLq3Og7o.js +1 -0
  369. package/dist/webcomponents/p-CXsRwohv.js +1 -0
  370. package/dist/webcomponents/p-Cy2N3vAg.js +1 -0
  371. package/dist/webcomponents/p-CyOXIqHo.js +1 -0
  372. package/dist/webcomponents/p-D6uhYbLo.js +1 -0
  373. package/dist/webcomponents/p-DEx8fQeW.js +1 -0
  374. package/dist/webcomponents/p-DN7VhlTn.js +1 -0
  375. package/dist/webcomponents/{p-Co3Rtlnu.js → p-DZQBPUfH.js} +1 -1
  376. package/dist/webcomponents/p-D_84NsmN.js +1 -0
  377. package/dist/webcomponents/p-Fpaf7CLD.js +1 -0
  378. package/dist/webcomponents/{p-CnDagPty.js → p-PdwJswAy.js} +1 -1
  379. package/dist/webcomponents/p-acb0b66c.entry.js +1 -0
  380. package/dist/webcomponents/p-b23dfa13.entry.js +1 -0
  381. package/dist/webcomponents/{p-b17fabdc.entry.js → p-b98ea26a.entry.js} +1 -1
  382. package/dist/webcomponents/{p-6884fa3d.entry.js → p-c3818a5a.entry.js} +1 -1
  383. package/dist/webcomponents/{p-61eae8cd.entry.js → p-c4889a06.entry.js} +1 -1
  384. package/dist/webcomponents/{p-b9316945.entry.js → p-c5424fda.entry.js} +1 -1
  385. package/dist/webcomponents/p-ca13117d.entry.js +1 -0
  386. package/dist/webcomponents/p-ca6c5365.entry.js +1 -0
  387. package/dist/webcomponents/{p-f6b900f4.entry.js → p-cb1cc88e.entry.js} +1 -1
  388. package/dist/webcomponents/{p-387aba3d.entry.js → p-ced6f6f1.entry.js} +1 -1
  389. package/dist/webcomponents/{p-c5560a87.entry.js → p-d59676ea.entry.js} +1 -1
  390. package/dist/webcomponents/p-d98bc829.entry.js +1 -0
  391. package/dist/webcomponents/{p-b9b5d046.entry.js → p-e55216fb.entry.js} +1 -1
  392. package/dist/webcomponents/{p-cb5d2198.entry.js → p-ead48010.entry.js} +1 -1
  393. package/dist/webcomponents/p-eb31024f.entry.js +1 -0
  394. package/dist/webcomponents/{p-543fcff2.entry.js → p-ee7fe3a8.entry.js} +1 -1
  395. package/dist/webcomponents/p-f0434a13.entry.js +1 -0
  396. package/dist/webcomponents/{p-c14dde7c.entry.js → p-f3682c72.entry.js} +1 -1
  397. package/dist/webcomponents/{p-537ea763.entry.js → p-f5358a80.entry.js} +1 -1
  398. package/dist/webcomponents/{p-b945fa49.entry.js → p-f9f0cb1f.entry.js} +1 -1
  399. package/dist/webcomponents/p-fda6f27d.entry.js +1 -0
  400. package/dist/webcomponents/p-fdd087d4.entry.js +1 -0
  401. package/dist/webcomponents/{p-C8g8unYJ.js → p-nbKvRcwU.js} +1 -1
  402. package/dist/webcomponents/{p-WnMmPpEb.js → p-vIQBTQmc.js} +1 -1
  403. package/dist/webcomponents/webcomponents.esm.js +1 -1
  404. package/package.json +15 -15
  405. package/LICENSE +0 -21
  406. package/dist/webcomponents/p-04153e8c.entry.js +0 -1
  407. package/dist/webcomponents/p-0464be7b.entry.js +0 -1
  408. package/dist/webcomponents/p-0c1cc1e9.entry.js +0 -1
  409. package/dist/webcomponents/p-0fe976d6.entry.js +0 -1
  410. package/dist/webcomponents/p-15934f30.entry.js +0 -1
  411. package/dist/webcomponents/p-2128265d.entry.js +0 -1
  412. package/dist/webcomponents/p-21a5c3d8.entry.js +0 -1
  413. package/dist/webcomponents/p-25d24964.entry.js +0 -1
  414. package/dist/webcomponents/p-3086ee7a.entry.js +0 -1
  415. package/dist/webcomponents/p-36d7033b.entry.js +0 -1
  416. package/dist/webcomponents/p-3ef039ec.entry.js +0 -1
  417. package/dist/webcomponents/p-49f279c3.entry.js +0 -1
  418. package/dist/webcomponents/p-4d60d249.entry.js +0 -1
  419. package/dist/webcomponents/p-51714ea9.entry.js +0 -1
  420. package/dist/webcomponents/p-558677a7.entry.js +0 -1
  421. package/dist/webcomponents/p-568b81a2.entry.js +0 -1
  422. package/dist/webcomponents/p-6f34fa90.entry.js +0 -1
  423. package/dist/webcomponents/p-8fO8CrtQ.js +0 -1
  424. package/dist/webcomponents/p-9b758a11.entry.js +0 -1
  425. package/dist/webcomponents/p-9c506058.entry.js +0 -1
  426. package/dist/webcomponents/p-BEOJqK7T.js +0 -1
  427. package/dist/webcomponents/p-C0w_sG9P.js +0 -1
  428. package/dist/webcomponents/p-CMvr3y5s.js +0 -1
  429. package/dist/webcomponents/p-CaLXuYmg.js +0 -1
  430. package/dist/webcomponents/p-CiypNylL.js +0 -1
  431. package/dist/webcomponents/p-D1H6VUbM.js +0 -1
  432. package/dist/webcomponents/p-DNxN6bjU.js +0 -1
  433. package/dist/webcomponents/p-DkoufM1t.js +0 -1
  434. package/dist/webcomponents/p-Dl0CAW76.js +0 -1
  435. package/dist/webcomponents/p-a14d3d7d.entry.js +0 -1
  436. package/dist/webcomponents/p-a47854b9.entry.js +0 -1
  437. package/dist/webcomponents/p-b8d46fc5.entry.js +0 -1
  438. package/dist/webcomponents/p-c0bd4006.entry.js +0 -1
  439. package/dist/webcomponents/p-c4799285.entry.js +0 -1
  440. package/dist/webcomponents/p-cc5a97a0.entry.js +0 -1
  441. package/dist/webcomponents/p-d57ae599.entry.js +0 -1
  442. package/dist/webcomponents/p-de8c6cd4.entry.js +0 -1
  443. package/dist/webcomponents/p-f6941969.entry.js +0 -1
  444. package/dist/webcomponents/p-f8cff289.entry.js +0 -1
@@ -0,0 +1 @@
1
+ import{h as s,r as t,c as i}from"./p-CV0Pyo1O.js";import{c as e,F as r}from"./p-D9sqTVmd.js";import{b as o,i as a,a as h,c as n,d as p,e as l,f as m}from"./p-CbyGKcz_.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{C as c,b as d}from"./p-D6uhYbLo.js";import"./p-CLHwhyvu.js";import{C as u,B as j,b as v}from"./p-DaDqgDrb.js";import{J as b}from"./p-nbKvRcwU.js";import{B as f}from"./p-CU2Dwa94.js";import{S as g}from"./p-05AWudQe.js";import{H as w}from"./p-CZk3i5Tu.js";import"./p-CZfYo5-1.js";import{c as C}from"./p-BEL8sLz6.js";import{S as y}from"./p-eBK-iWrz.js";import{B}from"./p-XYgDHrVL.js";import{m as x,a as O}from"./p-B0DHIvEj.js";import{B as D}from"./p-CJEetAx7.js";import"./p-BFTU3MAI.js";import"./p-Do9dxNjh.js";import"./p-CawcnSoV.js";import"./p-OReJ-ZQb.js";import"./p-DgTOxu8x.js";import"./p-Ds_P-dB8.js";import"./p-CAVi_ne1.js";import"./p-vIQBTQmc.js";import"./p-Bu7gdOaV.js";import"./p-CLq3Og7o.js";const L=e(Object.assign(Object.assign({},o().fields),{legal_address:n(),additional_questions:h(),representative:a("representative")}));e(Object.assign(Object.assign({},p().fields),{legal_address:m(),additional_questions:h(),representative:l("representative")}));const _=L,S=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(y,{width:"25%"})),s("div",{class:"col-12"},s(y,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(y,{width:"50%"}),s(y,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(y,{width:"65%"}),s(y,{width:"35%"}))),k=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(y,{width:"40%",height:"40px"})),s(S,null),s(S,null),s(S,null)),q=class{constructor(s){t(this,s),this.submitEvent=i(this,"submit-event",7),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.isLoading=!1,this.isSaving=!1,this.country=u.USA,this.hideErrors=!1,this.formTitle="Business Information",this.removeTitle=!1,this.instantiateBusiness=s=>{const t=new j(s);this.country=t.country_of_establishment,this.formController.setInitialValues(Object.assign({},t))},this.sendData=async()=>{this.isSaving=!0;const s=this.formController.values.getValue(),t=this.formController.getInitialValues(),i=new j(Object.assign(Object.assign({},t),s)).payload;this.patchBusiness({payload:i,onSuccess:s=>{this.handleReponse(s)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isSaving=!1}})},this.validateAndSubmit=s=>{s.preventDefault(),this.formController.validateAndSubmit(this.sendData)}}componentWillLoad(){C(),this.analytics=new b(this),this.formController=new r(_),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}get title(){return this.removeTitle?"":this.formTitle}get disabledState(){return this.isSaving}get businessEndpoint(){return`entities/business/${this.businessId}`}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=x({authToken:this.authToken,businessId:this.businessId,service:new D}),this.patchBusiness=O({authToken:this.authToken,businessId:this.businessId,service:new D}),this.getBusiness({onSuccess:s=>{this.instantiateBusiness(s.data)},onError:({error:s,code:t,severity:i})=>{this.errorMessage=s.message,this.errorEvent.emit({errorCode:t,message:s.message,severity:i})},final:()=>{this.isLoading=!1}})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:d.MISSING_PROPS,severity:c.ERROR})}handleReponse(s){s.error&&(this.errorMessage=v.patchData),this.submitEvent.emit({response:s}),this.instantiateBusiness(s.data)}render(){return s(g,null,this.isLoading?s(k,null):s("form",{onSubmit:this.validateAndSubmit},s("div",{class:"row gap-3"},s(w,{text:this.title}),s("form-alert",{text:this.errorMessage,hideAlert:this.hideErrors}),s("div",{class:"col-12 mb-4"},s("business-core-info",{formController:this.formController,country:this.country})),s("div",{class:"col-12 mb-4"},s("legal-address-form",{formController:this.formController,country:this.country})),s("div",{class:"col-12 mb-4"},s("additional-questions",{formController:this.formController})),s("div",{class:"col-12 mb-4"},s("business-representative",{formController:this.formController,country:this.country})),s("div",{class:"col-12 d-flex flex-row-reverse"},s(f,{type:"submit",disabled:this.disabledState,variant:"primary",onClick:()=>this.clickEvent.emit({name:B.submit}),isLoading:this.isSaving},"Submit")))))}};export{q as justifi_business_form}
@@ -0,0 +1 @@
1
+ import{h as t,r as a,c as e}from"./p-CV0Pyo1O.js";import{P as s}from"./p-BAKuMxC9.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{e as i,C as r,b as o}from"./p-D6uhYbLo.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-DaDqgDrb.js";import{g as c,a as h}from"./p-CLq3Og7o.js";import{J as p}from"./p-nbKvRcwU.js";import{c as d}from"./p-BEL8sLz6.js";import{S as m}from"./p-05AWudQe.js";import{T as f,a as l,b as u,c as y,d as b,e as g,f as v,g as j,h as _,i as k,j as C,k as w,l as T}from"./p-DZr0wLGh.js";import{T as D}from"./p-CZfYo5-1.js";import{M as P}from"./p-Bi_GCMx0.js";import{a as O}from"./p-Ds_P-dB8.js";import{a6 as S,a7 as A}from"./p-Bu7gdOaV.js";import{o as B,g as L}from"./p-BLhz_ggG.js";import"./p-vIQBTQmc.js";import"./p-CAVi_ne1.js";import"./p-DgTOxu8x.js";import"./p-MPer3Rw7.js";import"./p-Dz8KJn2G.js";const x={created_at:()=>t("th",{part:S,scope:"col",title:"The date and time each payment was made"},"Date"),amount:()=>t("th",{part:S,scope:"col",title:"The dollar amount of each payment"},"Amount"),status:()=>t("th",{part:S,scope:"col",title:"The current status of each payment"},"Status"),payment_type:()=>t("th",{part:S,scope:"col",title:"The type of each payment"},"Type"),description:()=>t("th",{part:S,scope:"col",title:"The payment description, if you provided one"},"Description"),payers_name:()=>t("th",{part:S,scope:"col",title:"The name associated with the payment method"},"Account Holder"),last_four_digits:()=>t("th",{part:S,scope:"col",title:"The brand and last 4 digits of the payment method"},"Payment Method"),card_brand:()=>t("th",{part:S,scope:"col",title:"The brand of the payment method"},"Card Brand")},M={created_at:(a,e)=>t("td",{part:A(e)},t("div",{class:"fw-bold"},O(a.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},O(a.created_at,{showTime:!0}))),amount:(a,e)=>t("td",{part:A(e)},a.formattedPaymentAmount(a.amount)),status:(a,e)=>t("td",{part:A(e)},P(a.status)),payment_type:(a,e)=>t("td",{part:A(e)},a.payment_type),description:(a,e)=>t("td",{part:A(e)},a.description),payers_name:(a,e)=>t("td",{part:A(e)},a.payers_name),last_four_digits:(a,e)=>t("td",{part:A(e)},a.last_four_digits),card_brand:(a,e)=>{var s,i,r;return t("td",{part:A(e)},(r=(null===(s=a.payment_method.card)||void 0===s?void 0:s.brand)||(null===(i=a.payment_method.bank_account)||void 0===i?void 0:i.brand))?{visa:"VISA",mastercard:"Mastercard",american_express:"American Express",discover:"Discover",diners_club:"Diners Club",jcb:"JCB",china_unionpay:"China UnionPay",unknown:"Unknown"}[r.toLowerCase()]||r:"N/A")}},E=class{constructor(t){a(this,t),this.errorEvent=e(this,"error-event",7),this.clickEvent=e(this,"click-event",7),this.errorMessage=null,this.payments=[],this.loading=!0,this.paging=n,this.pagingParams={},this.columns="created_at,amount,status,payment_type,description,payers_name,last_four_digits,card_brand",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:D.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:D.next})},this.rowClickHandler=t=>{const a=t.target.closest("tr").dataset.rowEntityId;if(!a)return;const e=this.payments.find((t=>t.id===a));this.clickEvent.emit({name:D.row,data:e})}}componentWillLoad(){d(),this.analytics=new p(this),this.paymentsTable=new f(this.payments,this.columns,x,M),this.initializeGetPayments(),B("set",(()=>{this.pagingParams={},this.errorMessage=""})),B("reset",(()=>{this.pagingParams={},this.errorMessage=""}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetPayments()}updateOnPropChange(){this.fetchData()}initializeGetPayments(){this.accountId&&this.authToken?this.getPayments=(({id:t,authToken:a,service:e})=>async({params:s,onSuccess:o,onError:n,final:p})=>{var d,m;try{const p=await e.fetchPayments(t,a,s);if(p.error)return n({error:h(p.error),code:c(null===(m=p.error)||void 0===m?void 0:m.code),severity:r.ERROR});{const t=Object.assign({},p.page_info);o({payments:(null===(d=p.data)||void 0===d?void 0:d.map((t=>new i(t))))||[],pagingInfo:t})}}catch(t){const a=c(null==t?void 0:t.code);return n({error:t.message||t,code:a,severity:r.ERROR})}finally{p()}})({id:this.accountId,authToken:this.authToken,service:new s}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:r.ERROR}))}fetchData(){this.getPayments&&(this.loading=!0,this.getPayments({params:this.paymentParams,onSuccess:({payments:t,pagingInfo:a})=>{this.payments=t,this.paging=a,this.paymentsTable.collectionData=this.payments},onError:({error:t,code:a,severity:e})=>{this.errorMessage=t,this.errorEvent.emit({errorCode:a,message:t,severity:e})},final:()=>{this.loading=!1}}))}get paymentParams(){const t=L();return Object.assign(Object.assign({},t),this.pagingParams)}get entityId(){return this.payments.map((t=>t.id))}get showEmptyState(){return!this.loading&&!this.errorMessage&&this.paymentsTable.rowData.length<1}get showErrorState(){return!this.loading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.loading}render(){return t(m,{key:"eb828891504cbcb38a6d7b73ab2411b23bca30a2"},t(l,{key:"f523dae8af945d79a36734bb35ecca94ea094fff"},t(u,{key:"8a69883c8217fdc36280cc3f2f95c83ad449b621"},t(y,{key:"1b47d5b433eaf0a749f8bdf97afb269518840e10"},t(b,{key:"4a1be7574f03aefd7687f200dc5cdc2b92a47d90"},this.paymentsTable.columnData.map((t=>t)))),t(g,{key:"02ad2f601a923526c2555f598f54e674763c3cc6"},t(v,{key:"274a86633dfbf13395acdfe9725cd14e13c59d8a",columnSpan:this.paymentsTable.columnData.length,isLoading:this.loading}),t(j,{key:"18ceb62121b9387a1bb8a8a74dfa458dba869b01",isEmpty:this.showEmptyState,columnSpan:this.paymentsTable.columnData.length}),t(_,{key:"7cbbc7524f44ac22d16c257c5bdc4998f21d1983",columnSpan:this.paymentsTable.columnData.length,errorMessage:this.errorMessage}),this.showRowData&&this.paymentsTable.rowData.map(((a,e)=>t(k,{"data-test-id":"table-row","data-row-entity-id":this.entityId[e],onClick:this.rowClickHandler},a)))),this.paging&&t(C,{key:"0da01573eaaa7cf98b08f9f5910d536a687dc6a3"},t(w,{key:"402175c67d164d0f6deba109ff11230ef4772675"},t(T,{key:"e2c8b098aacadcf5b0a5587e01f1191e287cd9fa",colSpan:this.paymentsTable.columnData.length},t("pagination-menu",{key:"91bffb1511a93c0b39f7cdc711c1f92e5381f5ec",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"],pagingParams:["updateOnPropChange"],getPayments:["updateOnPropChange"],columns:["updateOnPropChange"]}}};export{E as justifi_payments_list}
@@ -0,0 +1 @@
1
+ import{h as i,r as e,c as a}from"./p-CV0Pyo1O.js";import{S as t}from"./p-eBK-iWrz.js";import{w as r,c as s}from"./p-B4vLfYnZ.js";import{e as d}from"./p-Ds_P-dB8.js";import{c as n}from"./p-BEL8sLz6.js";import{C as o,c,b as h}from"./p-D6uhYbLo.js";import"./p-CLHwhyvu.js";import"./p-DaDqgDrb.js";import{B as l}from"./p-CU2Dwa94.js";import"./p-CZfYo5-1.js";import"./p-Bu7gdOaV.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";import"./p-CAVi_ne1.js";const f=()=>i("div",{class:"container-fluid p-0"},i("div",{class:"mb-3"},i(t,{height:"18px",width:"100px"}),i(t,{height:"36px"})),i("div",{class:"row"},i("div",{class:"col-4 align-content-end"},i(t,{height:"18px",width:"80px"}),i(t,{height:"36px"})),i("div",{class:"col-4 align-content-end"},i(t,{height:"36px"})),i("div",{class:"col-4 align-content-end"},i(t,{height:"18px",width:"30px"}),i(t,{height:"36px"})))),p=class{constructor(i){e(this,i),this.errorEvent=a(this,"error-event",7),this.iframeState="loading",this.reloadIframes=()=>{this.iframeState="loading",this.iframeElements.forEach((i=>i.reload())),this.watchIframesLoad()}}async componentWillLoad(){await r(),this.iframeOrigin=s.iframeOrigin,this.tabId=d(),n()}componentDidLoad(){this.watchIframesLoad()}disconnectedCallback(){var i;null===(i=this.loadAbortController)||void 0===i||i.abort()}async validate(){const i=await this.cardNumberIframeElement.validate(),e=await this.expirationMonthIframeElement.validate(),a=await this.expirationYearIframeElement.validate(),t=await this.cvvIframeElement.validate();return i&&e&&a&&t}async tokenize({clientId:i,paymentMethodMetadata:e,account:a}){return await this.cardNumberIframeElement.tokenize(i,e,a)}get isReady(){return"ready"===this.iframeState}get iframeElements(){return[this.cardNumberIframeElement,this.expirationMonthIframeElement,this.expirationYearIframeElement,this.cvvIframeElement]}watchIframesLoad(){var i;null===(i=this.loadAbortController)||void 0===i||i.abort();const{signal:e}=this.loadAbortController=new AbortController,a=new Set(this.iframeElements.map((i=>i.inputId))),t=Promise.all(this.iframeElements.map((i=>new Promise((t=>{i.addEventListener("iframeLoaded",(()=>{a.delete(i.inputId),t()}),{once:!0,signal:e})}))))),r=new Promise(((i,t)=>{const r=window.setTimeout((()=>t(new Error(`Iframes failed to load: ${Array.from(a).join(", ")}`))),1e4);e.addEventListener("abort",(()=>{window.clearTimeout(r),t(new Error("iframe load watch aborted"))}),{once:!0})}));Promise.race([t,r]).then((()=>{var i;e.aborted||(this.iframeState="ready",null===(i=this.loadAbortController)||void 0===i||i.abort())})).catch((i=>{var a;e.aborted||(this.iframeState="error",null===(a=this.loadAbortController)||void 0===a||a.abort(),this.errorEvent.emit({errorCode:h.IFRAME_LOAD_ERROR,message:c.IFRAME_LOAD_ERROR,severity:o.ERROR,data:{errorMessage:i.message}}))}))}renderIframeError(){return i("div",null,i("form-alert",{text:c.IFRAME_LOAD_ERROR,hideAlert:!1}),i(l,{variant:"link",clickHandler:this.reloadIframes,"aria-label":"Reload payment form",type:"button"},"Try again"))}render(){return i("div",{key:"a6630edeb25e19b72a6ad2588a28003ee53bda91"},"loading"===this.iframeState&&i(f,{key:"346df12a8dcfa70ff35381491c10550a44dee1c1"}),"error"===this.iframeState&&this.renderIframeError(),i("hidden-input",{key:"e63dfbd08d05c929d7f25257a0832d68246aa037"}),i("div",{key:"3cffef99661c7fc1289581c3c43cf7f2c2ec4558",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},i("div",{key:"493e63b1e26542e502fb028192a2ed1479d85c8d",class:"mb-3"},i("iframe-input",{key:"337b63edc91e78baa975bbfa067e17bd29a5b704",inputId:"cardNumber",ref:i=>this.cardNumberIframeElement=i,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber?tabId=${this.tabId}`})),i("div",{key:"04628f41b2c78cbb68bcabfe7809c047dc394c50",class:"row"},i("div",{key:"9ea7675dcab4ad6f6bce214b79527569ffc272b9",class:"col-4 align-content-end"},i("iframe-input",{key:"ab7f0c3e68848a048104a6644b2617e9b8b94e35",inputId:"expirationMonth",ref:i=>this.expirationMonthIframeElement=i,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth?tabId=${this.tabId}`})),i("div",{key:"a24a31ef92175734aa8d5a6be241ddb37f94e4d2",class:"col-4 align-content-end"},i("iframe-input",{key:"623fffa1cdc854b629314fc125b476d2541f2290",inputId:"expirationYear",ref:i=>this.expirationYearIframeElement=i,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear?tabId=${this.tabId}`})),i("div",{key:"ab7737e03a1d6ccad1e70e575cea100040de70fd",class:"col-4 align-content-end"},i("iframe-input",{key:"b755098bc225d91125a70bcb2cae933e4cd08f2d",inputId:"CVV",ref:i=>this.cvvIframeElement=i,label:"CVV",iframeOrigin:`${this.iframeOrigin}/v2/CVV?tabId=${this.tabId}`})))))}};export{p as card_form}
@@ -1 +1 @@
1
- import{h as s,r as t,c as i}from"./p-CV0Pyo1O.js";import{J as e}from"./p-C8g8unYJ.js";import{C as r,b as o}from"./p-8fO8CrtQ.js";import{m as n,b as a}from"./p-DD9-ceDZ.js";import{B as h}from"./p-CnHbIkmu.js";import{A as p}from"./p-WnMmPpEb.js";import"./p-CLHwhyvu.js";import{C as l,B as m,e as u}from"./p-DaDqgDrb.js";import{c as d}from"./p-DcA_wt-j.js";import{l as c}from"./p-Ds_P-dB8.js";import{t as v}from"./p-Bu7gdOaV.js";import{S as g}from"./p-05AWudQe.js";import{H as f}from"./p-CZk3i5Tu.js";import"./p-CZfYo5-1.js";import{B as y}from"./p-XYgDHrVL.js";import{P as b}from"./p-B-Ik8b-s.js";import"./p-CiypNylL.js";import"./p-D1H6VUbM.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";import"./p-eBK-iWrz.js";const j=p();class w{async postProvisioning(s,t,i){return j.post({endpoint:"entities/provisioning",body:{business_id:t,product_category:i},authToken:s})}}const C=()=>s("div",{class:"row gap-3 p-5"},s("div",{class:"col-12"},s(f,{text:"Business Already Provisioned"})),s("div",{class:"col-12",part:v},s("p",null,"We have already received the onboarding information for this business."))),k=()=>s("div",{class:"row gap-3 p5"},s("div",{class:"col-12"},s(f,{text:"You're all set for now"})),s("div",{class:"col-12",part:v},s("p",null,"We're reviewing your information and working on your approval. We'll be in touch to let you know once you've been approved (or if we find anything that needs fixing). Have a good one!"))),D=()=>s("div",{class:"row gap-3 p-5"},s("div",{class:"col-12"},s(f,{text:"Something went wrong"})),s("div",{class:"col-12",part:v},s("p",null,"There was an error submitting the provisioning. Your progress has been saved — please try again later or contact the support team."))),x=class{constructor(s){t(this,s),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.submitEvent=i(this,"submit-event",7),this.loading=!1,this.businessLoading=!0,this.businessProvisioned=!1,this.formSubmitted=!1,this.submissionFailed=!1,this.currentStep=0,this.country=l.USA,this.allowOptionalFields=!1,this.formTitle="Business Information",this.refs=[],this.setBusinessProvisioned=()=>new Promise((s=>{this.getBusiness({onSuccess:t=>{const i=new m(t.data);this.businessProvisioned=u(i),this.country=i.country_of_establishment,this.businessProvisioned&&this.errorEvent.emit({message:"A request to provision payments for this business has already been submitted.",errorCode:o.PROVISIONING_REQUESTED,severity:r.INFO}),this.businessLoading=!1,s()},onError:({error:t,code:i,severity:e})=>{this.errorEvent.emit({message:t,errorCode:i,severity:e}),this.businessLoading=!1,s()}})})),this.postProvisioningData=()=>{this.postProvisioning({onSuccess:s=>{this.formSubmitted=!0,this.submitEvent.emit({response:s})},onError:({error:s,code:t,severity:i})=>{this.submissionFailed=!0,this.submitEvent.emit({response:{error:s}}),this.errorEvent.emit({message:s,errorCode:t,severity:i})}})},this.incrementSteps=()=>{if(this.currentStep<this.totalSteps)return this.currentStep++},this.decrementSteps=()=>{this.currentStep>0&&(this.currentStep-=1)},this.previousStepButtonOnClick=()=>{this.clickEvent.emit({name:y.previousStep}),this.decrementSteps()},this.nextStepButtonOnClick=(s,t)=>{s.preventDefault(),this.clickEvent.emit({name:t}),this.refs[this.currentStep].validateAndSubmit({onSuccess:this.incrementSteps})}}propChanged(){this.initializeApi()}handleFormCompleted(){this.postProvisioningData()}handleFormLoading(s){this.loading=s.detail}async componentWillLoad(){d(),this.analytics=new e(this),this.initializeApi(),this.getBusiness?await this.setBusinessProvisioned():this.businessLoading=!1,this.refs=new Array(8)}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeApi(){this.authToken&&this.businessId?c(this.authToken)?this.errorEvent.emit({message:"auth-token is expired",errorCode:o.NOT_AUTHENTICATED,severity:r.ERROR}):(this.getBusiness=n({authToken:this.authToken,businessId:this.businessId,service:new h}),this.postProvisioning=a({authToken:this.authToken,businessId:this.businessId,product:"payment",service:new w})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}get formDisabled(){return this.loading||this.businessProvisioned}get totalSteps(){return this.refs.length-1}get stepCounter(){return`Step ${this.currentStep+1} of ${this.totalSteps+1}`}render(){return s(g,null,this.businessLoading?s(b,null):this.businessProvisioned?s(C,null):this.formSubmitted?s(k,null):this.submissionFailed?s(D,null):s("div",{class:"row gap-3"},s(f,{text:this.formTitle}),s("payment-provisioning-form-steps",{businessId:this.businessId,authToken:this.authToken,refs:this.refs,currentStep:this.currentStep,allowOptionalFields:this.allowOptionalFields,country:this.country,handleFormLoading:this.handleFormLoading}),s("div",{class:"d-flex justify-content-between align-items-center"},s("div",{class:"d-flex align-items-center",part:v},this.stepCounter),s("payment-provisioning-form-buttons",{currentStep:this.currentStep,totalSteps:this.totalSteps,formLoading:this.loading,formDisabled:this.formDisabled,previousStepButtonOnClick:this.previousStepButtonOnClick,nextStepButtonOnClick:this.nextStepButtonOnClick}))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};export{x as justifi_payment_provisioning}
1
+ import{h as s,r as t,c as i}from"./p-CV0Pyo1O.js";import{J as e}from"./p-nbKvRcwU.js";import{C as r,b as o}from"./p-D6uhYbLo.js";import{m as n,b as a}from"./p-B0DHIvEj.js";import{B as h}from"./p-CJEetAx7.js";import{A as p}from"./p-vIQBTQmc.js";import"./p-CLHwhyvu.js";import{C as l,B as m,e as d}from"./p-DaDqgDrb.js";import{c as u}from"./p-BEL8sLz6.js";import{l as c}from"./p-Ds_P-dB8.js";import{t as v}from"./p-Bu7gdOaV.js";import{S as g}from"./p-05AWudQe.js";import{H as f}from"./p-CZk3i5Tu.js";import"./p-CZfYo5-1.js";import{B as y}from"./p-XYgDHrVL.js";import{P as b}from"./p-B-Ik8b-s.js";import"./p-CAVi_ne1.js";import"./p-CLq3Og7o.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";import"./p-eBK-iWrz.js";const j=p();class w{async postProvisioning(s,t,i){return j.post({endpoint:"entities/provisioning",body:{business_id:t,product_category:i},authToken:s})}}const C=()=>s("div",{class:"row gap-3 p-5"},s("div",{class:"col-12"},s(f,{text:"Business Already Provisioned"})),s("div",{class:"col-12",part:v},s("p",null,"We have already received the onboarding information for this business."))),k=()=>s("div",{class:"row gap-3 p5"},s("div",{class:"col-12"},s(f,{text:"You're all set for now"})),s("div",{class:"col-12",part:v},s("p",null,"We're reviewing your information and working on your approval. We'll be in touch to let you know once you've been approved (or if we find anything that needs fixing). Have a good one!"))),B=()=>s("div",{class:"row gap-3 p-5"},s("div",{class:"col-12"},s(f,{text:"Something went wrong"})),s("div",{class:"col-12",part:v},s("p",null,"There was an error submitting the provisioning. Your progress has been saved — please try again later or contact the support team."))),x=class{constructor(s){t(this,s),this.clickEvent=i(this,"click-event",7),this.errorEvent=i(this,"error-event",7),this.submitEvent=i(this,"submit-event",7),this.loading=!1,this.businessLoading=!0,this.businessProvisioned=!1,this.formSubmitted=!1,this.submissionFailed=!1,this.currentStep=0,this.country=l.USA,this.allowOptionalFields=!1,this.formTitle="Business Information",this.refs=[],this.setBusinessProvisioned=()=>new Promise((s=>{this.getBusiness({onSuccess:t=>{const i=new m(t.data);this.businessProvisioned=d(i),this.country=i.country_of_establishment,this.businessProvisioned&&this.errorEvent.emit({message:"A request to provision payments for this business has already been submitted.",errorCode:o.PROVISIONING_REQUESTED,severity:r.INFO}),this.businessLoading=!1,s()},onError:({error:t,code:i,severity:e})=>{this.errorEvent.emit({message:t,errorCode:i,severity:e}),this.businessLoading=!1,s()}})})),this.postProvisioningData=()=>{this.postProvisioning({onSuccess:s=>{this.formSubmitted=!0,this.submitEvent.emit({response:s})},onError:({error:s,code:t,severity:i})=>{this.submissionFailed=!0,this.submitEvent.emit({response:{error:s}}),this.errorEvent.emit({message:s,errorCode:t,severity:i})}})},this.incrementSteps=()=>{if(this.currentStep<this.totalSteps)return this.currentStep++},this.decrementSteps=()=>{this.currentStep>0&&(this.currentStep-=1)},this.previousStepButtonOnClick=()=>{this.clickEvent.emit({name:y.previousStep}),this.decrementSteps()},this.nextStepButtonOnClick=(s,t)=>{s.preventDefault(),this.clickEvent.emit({name:t}),this.refs[this.currentStep].validateAndSubmit({onSuccess:this.incrementSteps})}}propChanged(){this.initializeApi()}handleFormCompleted(){this.postProvisioningData()}handleFormLoading(s){this.loading=s.detail}async componentWillLoad(){u(),this.analytics=new e(this),this.initializeApi(),this.getBusiness?await this.setBusinessProvisioned():this.businessLoading=!1,this.refs=new Array(8)}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeApi(){this.authToken&&this.businessId?c(this.authToken)?this.errorEvent.emit({message:"auth-token is expired",errorCode:o.NOT_AUTHENTICATED,severity:r.ERROR}):(this.getBusiness=n({authToken:this.authToken,businessId:this.businessId,service:new h}),this.postProvisioning=a({authToken:this.authToken,businessId:this.businessId,product:"payment",service:new w})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}get formDisabled(){return this.loading||this.businessProvisioned}get totalSteps(){return this.refs.length-1}get stepCounter(){return`Step ${this.currentStep+1} of ${this.totalSteps+1}`}render(){return s(g,null,this.businessLoading?s(b,null):this.businessProvisioned?s(C,null):this.formSubmitted?s(k,null):this.submissionFailed?s(B,null):s("div",{class:"row gap-3"},s(f,{text:this.formTitle}),s("payment-provisioning-form-steps",{businessId:this.businessId,authToken:this.authToken,refs:this.refs,currentStep:this.currentStep,allowOptionalFields:this.allowOptionalFields,country:this.country,handleFormLoading:this.handleFormLoading}),s("div",{class:"d-flex justify-content-between align-items-center"},s("div",{class:"d-flex align-items-center",part:v},this.stepCounter),s("payment-provisioning-form-buttons",{currentStep:this.currentStep,totalSteps:this.totalSteps,formLoading:this.loading,formDisabled:this.formDisabled,previousStepButtonOnClick:this.previousStepButtonOnClick,nextStepButtonOnClick:this.nextStepButtonOnClick}))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};export{x as justifi_payment_provisioning}
@@ -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-8fO8CrtQ.js";import"./p-CLHwhyvu.js";import"./p-DaDqgDrb.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-BL112JyU.js";import{m as p}from"./p-CaLXuYmg.js";import{J as f}from"./p-C8g8unYJ.js";import{c as y}from"./p-DcA_wt-j.js";import{g as v,a as j}from"./p-D1H6VUbM.js";import{A as b}from"./p-WnMmPpEb.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-CiypNylL.js";const g=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:g(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=b();class A{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 P=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(w,{width:"100%",height:"40px"}))),S=()=>t(d,null,t("div",{class:"row gap-5"},t(P,null),t(P,null),t(P,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 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(S,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{k 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 c}from"./p-D6uhYbLo.js";import"./p-CLHwhyvu.js";import"./p-DaDqgDrb.js";import{B as l}from"./p-CU2Dwa94.js";import{S as d}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import{P as m}from"./p-BAKuMxC9.js";import{m as p}from"./p-Cy2N3vAg.js";import{J as f}from"./p-nbKvRcwU.js";import{c as v}from"./p-BEL8sLz6.js";import{g as y,a as j}from"./p-CLq3Og7o.js";import{A as b}from"./p-vIQBTQmc.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-CAVi_ne1.js";const g=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:g(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"}],A=b();class x{async postRefund(t,e,s,r){return A.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":e},body:r,authToken:s})}}const I=b();class B{async postVoid(t,e,s){return I.post({endpoint:`payments/${t}/void`,headers:{"Sub-Account":e},authToken:s})}}const D=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(w,{width:"100%",height:"40px"}))),S=()=>t(d,null,t("div",{class:"row gap-5"},t(D,null),t(D,null),t(D,null))),k=class{constructor(t){e(this,t),this.errorEvent=s(this,"error-event",7),this.submitEvent=s(this,"submit-event",7),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}componentWillLoad(){v(),this.analytics=new f(this),this.initializeApi(),this.formController=new n(C())}handleError(t,e,s){this.errorEvent.emit({errorCode:t,message:e,severity:s})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(h.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",u.ERROR)}isPaymentCreatedWithin25Minutes(){var t;if(!this.payment||!(null===(t=this.payment)||void 0===t?void 0:t.created_at))return!1;const e=new Date(this.payment.created_at);return((new Date).getTime()-e.getTime())/6e4<=25}initializeFormController(){const t=this.refundPayload.amount,e=t?t.toString():"0";this.formController=new n(C(e)),this.formController.setInitialValues({amount:e}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?p({id:this.paymentId,authToken:this.authToken,service:new m})({onSuccess:({payment:t})=>{this.payment=t,this.refundPayload=new c({amount:t.amount_refundable})},onError:({error:t,code:e,severity:s})=>{this.handleError(e,t,s)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(h.MISSING_PROPS,"Payment ID and Auth Token are required",u.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const e=this.formController.values.getValue();return this.refundLoading=!0,this.isPaymentCreatedWithin25Minutes()?this.tryVoidPayment():this.processRefund(e)}async tryVoidPayment(){const t=(({authToken:t,accountId:e,paymentId:s,service:r})=>async({onSuccess:i,onError:n,final:o})=>{var a;try{const o=await r.postVoid(s,e,t);if(o.error)return n({error:j(o.error),code:y(null===(a=o.error)||void 0===a?void 0:a.code),severity:u.ERROR});i(o)}catch(t){const e=y(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:u.ERROR})}finally{o()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new B});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:y(null===(h=a.error)||void 0===h?void 0:h.code),severity:u.ERROR});n(a)}catch(t){const e=y(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:u.ERROR})}finally{a()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new x});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(S,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(l,{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 t,c as e,h as s}from"./p-CV0Pyo1O.js";import{m as i}from"./p-Dl0CAW76.js";import{C as h}from"./p-BlqdDtQr.js";import{C as r,b as o,I as l,c as a,d as n}from"./p-8fO8CrtQ.js";import{J as c}from"./p-C8g8unYJ.js";import{c as d}from"./p-DcA_wt-j.js";import"./p-D1H6VUbM.js";import"./p-WnMmPpEb.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-Ds_P-dB8.js";import"./p-HXpYMWUU.js";import"./p-CiypNylL.js";import"./p-CLHwhyvu.js";import"./p-DaDqgDrb.js";const u=class{constructor(s){t(this,s),this.checkoutCompleted=e(this,"checkout-completed",7),this.checkoutExpired=e(this,"checkout-expired",7),this.errorEvent=e(this,"error-event",7),this.pollIntervalMs=3e3,this.pollTimeoutMs=6e5,this.terminalState="loading",this.paymentStatus="",this.errorMessage="",this.pollIntervalHandle=null,this.pollTimeoutHandle=null,this.failedDismissHandle=null,this.seenCompletionCreatedAts=new Set,this.inFlight=!1}componentWillLoad(){d(),this.analytics=new c(this),this.initialize()}disconnectedCallback(){var t;this.stopAll(),null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.stopAll(),this.initialize()}suppressInnerErrors(t){t.stopPropagation()}get effectivePollInterval(){return Math.max(1e3,this.pollIntervalMs)}initialize(){this.authToken&&this.checkoutId?(this.terminalState="loading",this.getCheckout=i({authToken:this.authToken,checkoutId:this.checkoutId,service:new h}),this.getCheckout({onSuccess:({checkout:t})=>this.handleInitialLoad(t),onError:({error:t,code:e,severity:s})=>{this.terminalState="error",this.errorMessage=t,this.errorEvent.emit({message:t,errorCode:e,severity:s})}})):this.errorEvent.emit({message:"authToken and checkoutId are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}handleInitialLoad(t){var e;switch(t.status){case l.expired:this.terminalState="expired",this.checkoutExpired.emit({checkoutId:this.checkoutId}),this.errorEvent.emit({message:a.CHECKOUT_EXPIRED,errorCode:o.CHECKOUT_EXPIRED,severity:r.ERROR});break;case l.completed:this.terminalState="completed",this.paymentStatus=this.resolvePaymentStatus(t),this.checkoutCompleted.emit({checkoutId:this.checkoutId,paymentStatus:this.paymentStatus});break;default:(null!==(e=t.completions)&&void 0!==e?e:[]).forEach((t=>this.seenCompletionCreatedAts.add(t.created_at))),this.terminalState="ready",this.startPolling()}}startPolling(){this.pollTimeoutHandle=setTimeout((()=>{this.stopAll(),this.terminalState="error",this.errorMessage="Checkout polling timed out",this.errorEvent.emit({message:"Checkout polling timed out",errorCode:o.FETCH_ERROR,severity:r.ERROR})}),this.pollTimeoutMs),this.pollIntervalHandle=setInterval((()=>this.tick()),this.effectivePollInterval)}tick(){this.inFlight||(this.inFlight=!0,this.getCheckout({onSuccess:({checkout:t})=>{this.inFlight=!1,this.handlePollResult(t)},onError:({error:t,code:e,severity:s})=>{this.inFlight=!1,this.stopAll(),this.terminalState="error",this.errorMessage=t,this.errorEvent.emit({message:t,errorCode:e,severity:s})}}))}handlePollResult(t){var e;const s=(null!==(e=t.completions)&&void 0!==e?e:[]).filter((t=>!this.seenCompletionCreatedAts.has(t.created_at)&&"failed"===t.payment_status));if(s.forEach((t=>this.seenCompletionCreatedAts.add(t.created_at))),s.length>0&&(this.terminalState="payment-failed",this.failedDismissHandle&&clearTimeout(this.failedDismissHandle),this.failedDismissHandle=setTimeout((()=>{"payment-failed"===this.terminalState&&(this.terminalState="ready")}),3e3)),t.status===l.completed)return this.stopAll(),this.terminalState="completed",this.paymentStatus=this.resolvePaymentStatus(t),void this.checkoutCompleted.emit({checkoutId:this.checkoutId,paymentStatus:this.paymentStatus});t.status===l.expired&&(this.stopAll(),this.terminalState="expired",this.checkoutExpired.emit({checkoutId:this.checkoutId}),this.errorEvent.emit({message:a.CHECKOUT_EXPIRED,errorCode:o.CHECKOUT_EXPIRED,severity:r.ERROR}))}resolvePaymentStatus(t){var e,s;const i=null===(s=[...null!==(e=t.completions)&&void 0!==e?e:[]].sort(((t,e)=>new Date(e.updated_at).getTime()-new Date(t.updated_at).getTime()))[0])||void 0===s?void 0:s.payment_status;return i===n.succeeded||null==i&&t.successful_payment_id?"succeeded":"pending"}stopAll(){this.pollIntervalHandle&&(clearInterval(this.pollIntervalHandle),this.pollIntervalHandle=null),this.pollTimeoutHandle&&(clearTimeout(this.pollTimeoutHandle),this.pollTimeoutHandle=null),this.failedDismissHandle&&(clearTimeout(this.failedDismissHandle),this.failedDismissHandle=null),this.inFlight=!1}render(){return this.authToken&&this.checkoutId?s("div",null,"loading"===this.terminalState&&null,("ready"===this.terminalState||"payment-failed"===this.terminalState)&&s("div",null,s("justifi-checkout-qr-code",{checkoutId:this.checkoutId}),"payment-failed"===this.terminalState&&s("p",null,"Payment failed. Please try again."),"ready"===this.terminalState&&s("p",null,"Scan to pay")),"completed"===this.terminalState&&s("div",null,s("p",null,"succeeded"===this.paymentStatus?"Payment received":"Payment pending")),"expired"===this.terminalState&&s("p",null,"Checkout expired. Please create a new checkout."),"error"===this.terminalState&&s("p",null,this.errorMessage)):null}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"]}}};export{u as justifi_qr_terminal}
1
+ import{r as t,c as e,h as s}from"./p-CV0Pyo1O.js";import{m as i}from"./p-CXsRwohv.js";import{C as h}from"./p-27igUlku.js";import{C as r,b as o,I as a,c as l,d as n}from"./p-D6uhYbLo.js";import{J as c}from"./p-nbKvRcwU.js";import{c as d}from"./p-BEL8sLz6.js";import"./p-CLq3Og7o.js";import"./p-vIQBTQmc.js";import"./p-B4vLfYnZ.js";import"./p-DgTOxu8x.js";import"./p-Ds_P-dB8.js";import"./p-HXpYMWUU.js";import"./p-CAVi_ne1.js";import"./p-CLHwhyvu.js";import"./p-DaDqgDrb.js";const u=class{constructor(s){t(this,s),this.checkoutCompleted=e(this,"checkout-completed",7),this.checkoutExpired=e(this,"checkout-expired",7),this.errorEvent=e(this,"error-event",7),this.pollIntervalMs=3e3,this.pollTimeoutMs=6e5,this.terminalState="loading",this.paymentStatus="",this.errorMessage="",this.pollIntervalHandle=null,this.pollTimeoutHandle=null,this.failedDismissHandle=null,this.seenCompletionCreatedAts=new Set,this.inFlight=!1}componentWillLoad(){d(),this.analytics=new c(this),this.initialize()}disconnectedCallback(){var t;this.stopAll(),null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.stopAll(),this.initialize()}suppressInnerErrors(t){t.stopPropagation()}get effectivePollInterval(){return Math.max(1e3,this.pollIntervalMs)}initialize(){this.authToken&&this.checkoutId?(this.terminalState="loading",this.getCheckout=i({authToken:this.authToken,checkoutId:this.checkoutId,service:new h}),this.getCheckout({onSuccess:({checkout:t})=>this.handleInitialLoad(t),onError:({error:t,code:e,severity:s})=>{this.terminalState="error",this.errorMessage=t,this.errorEvent.emit({message:t,errorCode:e,severity:s})}})):this.errorEvent.emit({message:"authToken and checkoutId are required",errorCode:o.MISSING_PROPS,severity:r.ERROR})}handleInitialLoad(t){var e;switch(t.status){case a.expired:this.terminalState="expired",this.checkoutExpired.emit({checkoutId:this.checkoutId}),this.errorEvent.emit({message:l.CHECKOUT_EXPIRED,errorCode:o.CHECKOUT_EXPIRED,severity:r.ERROR});break;case a.completed:this.terminalState="completed",this.paymentStatus=this.resolvePaymentStatus(t),this.checkoutCompleted.emit({checkoutId:this.checkoutId,paymentStatus:this.paymentStatus});break;default:(null!==(e=t.completions)&&void 0!==e?e:[]).forEach((t=>this.seenCompletionCreatedAts.add(t.created_at))),this.terminalState="ready",this.startPolling()}}startPolling(){this.pollTimeoutHandle=setTimeout((()=>{this.stopAll(),this.terminalState="error",this.errorMessage="Checkout polling timed out",this.errorEvent.emit({message:"Checkout polling timed out",errorCode:o.FETCH_ERROR,severity:r.ERROR})}),this.pollTimeoutMs),this.pollIntervalHandle=setInterval((()=>this.tick()),this.effectivePollInterval)}tick(){this.inFlight||(this.inFlight=!0,this.getCheckout({onSuccess:({checkout:t})=>{this.inFlight=!1,this.handlePollResult(t)},onError:({error:t,code:e,severity:s})=>{this.inFlight=!1,this.stopAll(),this.terminalState="error",this.errorMessage=t,this.errorEvent.emit({message:t,errorCode:e,severity:s})}}))}handlePollResult(t){var e;const s=(null!==(e=t.completions)&&void 0!==e?e:[]).filter((t=>!this.seenCompletionCreatedAts.has(t.created_at)&&"failed"===t.payment_status));if(s.forEach((t=>this.seenCompletionCreatedAts.add(t.created_at))),s.length>0&&(this.terminalState="payment-failed",this.failedDismissHandle&&clearTimeout(this.failedDismissHandle),this.failedDismissHandle=setTimeout((()=>{"payment-failed"===this.terminalState&&(this.terminalState="ready")}),3e3)),t.status===a.completed)return this.stopAll(),this.terminalState="completed",this.paymentStatus=this.resolvePaymentStatus(t),void this.checkoutCompleted.emit({checkoutId:this.checkoutId,paymentStatus:this.paymentStatus});t.status===a.expired&&(this.stopAll(),this.terminalState="expired",this.checkoutExpired.emit({checkoutId:this.checkoutId}),this.errorEvent.emit({message:l.CHECKOUT_EXPIRED,errorCode:o.CHECKOUT_EXPIRED,severity:r.ERROR}))}resolvePaymentStatus(t){var e,s;const i=null===(s=[...null!==(e=t.completions)&&void 0!==e?e:[]].sort(((t,e)=>new Date(e.updated_at).getTime()-new Date(t.updated_at).getTime()))[0])||void 0===s?void 0:s.payment_status;return i===n.succeeded||null==i&&t.successful_payment_id?"succeeded":"pending"}stopAll(){this.pollIntervalHandle&&(clearInterval(this.pollIntervalHandle),this.pollIntervalHandle=null),this.pollTimeoutHandle&&(clearTimeout(this.pollTimeoutHandle),this.pollTimeoutHandle=null),this.failedDismissHandle&&(clearTimeout(this.failedDismissHandle),this.failedDismissHandle=null),this.inFlight=!1}render(){return this.authToken&&this.checkoutId?s("div",null,"loading"===this.terminalState&&null,("ready"===this.terminalState||"payment-failed"===this.terminalState)&&s("div",null,s("justifi-checkout-qr-code",{checkoutId:this.checkoutId}),"payment-failed"===this.terminalState&&s("p",null,"Payment failed. Please try again."),"ready"===this.terminalState&&s("p",null,"Scan to pay")),"completed"===this.terminalState&&s("div",null,s("p",null,"succeeded"===this.paymentStatus?"Payment received":"Payment pending")),"expired"===this.terminalState&&s("p",null,"Checkout expired. Please create a new checkout."),"error"===this.terminalState&&s("p",null,this.errorMessage)):null}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"]}}};export{u as justifi_qr_terminal}
@@ -1 +1 @@
1
- import{r as 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 i,a as c}from"./p-Bu7gdOaV.js";import{S as r}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import{c as f,a as o}from"./p-Ds_P-dB8.js";import"./p-BFTU3MAI.js";import"./p-DgTOxu8x.js";import"./p-HXpYMWUU.js";const b=class{constructor(a){e(this,a),this.setParamsOnChange=(e,a)=>{d[e]=a},this.handleDateInput=(e,a)=>{const t=f(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:"09966b2b69d97d14d988b1658c50755be453451b"},a("table-filters-menu",{key:"e5e1e3bf59528776e0ce67be1d57f442cc47d717",params:e,clearParams:l,part:i},a("div",{key:"dfb76c7b261911aaecba4ddc179f935e076ab6a0",class:"grid-cols-2 gap-3 p-1"},a("div",{key:"e875c8eb14dd1ca1bfe3d0973de89cba0627063d",class:"p-2"},a("form-control-text",{key:"cba3e7736f5d85f32ac8023125d59f25a4e5e427",name:"payment_id",label:"Payment ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.paymentId||d.payment_id,disabled:!!this.paymentId,part:c})),a("div",{key:"468b20f8494330c1db0a00f63e928c656e47e463",class:"p-2"},a("form-control-text",{key:"f9a48b0116e239f97a39246647470fd7f8e3718f",name:"terminal_id",label:"Terminal ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.terminalId||d.terminal_id,disabled:!!this.terminalId,part:c})),a("div",{key:"805d358d7a091b4826f20af9df930f61cf754364",class:"p-2"},a("form-control-select",{key:"07c7d0627be6629864cc9b130c347d110e7b337d",name:"payment_status",label:"Status",options:this.paymentStatusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentStatus||d.payment_status||"",disabled:!!this.paymentStatus,part:c})),a("div",{key:"aa3f3d30fe781dce7f516d80730362bed20348be",class:"p-2"},a("form-control-select",{key:"7d70542a944db0588361ab5be7df9c8bf83d0463",name:"payment_mode",label:"Payment Mode",options:this.paymentModeOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentMode||d.payment_mode||"",disabled:!!this.paymentMode,part:c})),a("div",{key:"df2642d3a148199d9ffbfd01cae6ba4aaef6f2a4",class:"p-2"},a("form-control-text",{key:"b462acc0489803f54b2beb4d8cc58bb1c11ebb48",name:"checkout_id",label:"Checkout ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.checkoutId||d.checkout_id,disabled:!!this.checkoutId,part:c})),a("div",{key:"c5eb36e85489492d4cc66707762d04bf4e38e56f",class:"p-2"},a("form-control-text",{key:"483a8cea7f8f1f6128fc16789b34015041fb250b",name:"account_holder",label:"Account Holder",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.accountHolder||d.account_holder,disabled:!!this.accountHolder,part:c})),a("div",{key:"669126e41e31c84745dd7c4c6dc0f0d2eb843e9a",class:"p-2"},a("form-control-date",{key:"20b993fad450f448bc1cbce6a24c05f5038df2da",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:o(this.createdAfter,{showInputDateTime:!0})||o(d.created_after,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdAfter,part:c})),a("div",{key:"49002f16423461fca88249d9fdd7fc0a27abe117",class:"p-2"},a("form-control-date",{key:"5a3b0093e5c2593e1f39b82220511704210a6179",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:o(this.createdBefore,{showInputDateTime:!0})||o(d.created_before,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdBefore,part:c})))))}};export{b 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 i,a as c}from"./p-Bu7gdOaV.js";import{S as r}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import{c as f,a as o}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=f(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:"e3eaa38735042ba3618a8c042e7e1b351ba3c92d"},a("table-filters-menu",{key:"af5a94add7dcefe868e65d46a38a662b4d7986b3",params:e,clearParams:l,part:i},a("div",{key:"c2c02f915eaf984458b3f99dac4bb9317aac8b7e",class:"grid-cols-2 gap-3 p-1"},a("div",{key:"2130e16ffea403ac5fec93e7d77aba470529264f",class:"p-2"},a("form-control-text",{key:"4e45a57455eed0be81236e1939c2ca5e5d741c81",name:"payment_id",label:"Payment ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.paymentId||d.payment_id,disabled:!!this.paymentId,part:c})),a("div",{key:"fef1849cf8f58c70f0fe8a5604545cabb58901d6",class:"p-2"},a("form-control-text",{key:"f8f076fff19c4a90901e1adacc61023a88d0bbfa",name:"terminal_id",label:"Terminal ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.terminalId||d.terminal_id,disabled:!!this.terminalId,part:c})),a("div",{key:"304d816e47dae74e1d493df5ffd34cef2cd93600",class:"p-2"},a("form-control-select",{key:"265350ed2411acc1bbfe6dec019a79e808713349",name:"payment_status",label:"Status",options:this.paymentStatusOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentStatus||d.payment_status||"",disabled:!!this.paymentStatus,part:c})),a("div",{key:"d644bf25f3e524403ee5d7590d4d32fad0e56688",class:"p-2"},a("form-control-select",{key:"871056ad4364d14a18621e4da6e49bda609ef17a",name:"payment_mode",label:"Payment Mode",options:this.paymentModeOptions,inputHandler:this.setParamsOnChange,defaultValue:this.paymentMode||d.payment_mode||"",disabled:!!this.paymentMode,part:c})),a("div",{key:"e568ba09614c66e5a589b745dee36465e5c962b5",class:"p-2"},a("form-control-text",{key:"e58eb1b507c87220437ef0d9b3fcee8643408244",name:"checkout_id",label:"Checkout ID",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.checkoutId||d.checkout_id,disabled:!!this.checkoutId,part:c})),a("div",{key:"b27cde43483bffbef99f22d707d28bebce514069",class:"p-2"},a("form-control-text",{key:"bf35df034fcb1e3c2e09503b94adca74083ccb7f",name:"account_holder",label:"Account Holder",inputHandler:this.debouncedSetParamsOnChange,defaultValue:this.accountHolder||d.account_holder,disabled:!!this.accountHolder,part:c})),a("div",{key:"3ef0ccf656c147044586a2f88c718a0c833ee6c4",class:"p-2"},a("form-control-date",{key:"c6b2dbfab6749f853ecf54959cd5f94c8db7a9ae",name:"created_after",label:"Created After",inputHandler:this.handleDateInput,defaultValue:o(this.createdAfter,{showInputDateTime:!0})||o(d.created_after,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdAfter,part:c})),a("div",{key:"02c746e653dac58005381d19eaa5371347e02297",class:"p-2"},a("form-control-date",{key:"dd7d369a655e0f1e10497f45cfa7085c045287d3",name:"created_before",label:"Created Before",inputHandler:this.handleDateInput,defaultValue:o(this.createdBefore,{showInputDateTime:!0})||o(d.created_before,{showInputDateTime:!0}),showTime:!0,disabled:!!this.createdBefore,part:c})))))}};export{n as justifi_payments_list_filters}
@@ -0,0 +1 @@
1
+ import{h as t,r as e,c as a}from"./p-CV0Pyo1O.js";import"./p-B4vLfYnZ.js";import"./p-HXpYMWUU.js";import{j as s,C as i,b as r}from"./p-D6uhYbLo.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-DaDqgDrb.js";import{J as o}from"./p-nbKvRcwU.js";import{c}from"./p-BEL8sLz6.js";import{g as p,a as h}from"./p-CLq3Og7o.js";import{P as d}from"./p-BAKuMxC9.js";import{T as f,a as l,b as u,c as m,d as b,e as y,f as _,g,h as j,i as T,j as w,k,l as v}from"./p-DZr0wLGh.js";import{S as C}from"./p-05AWudQe.js";import{T as D}from"./p-CZfYo5-1.js";import{a as P}from"./p-Ds_P-dB8.js";import{a6 as R,a7 as F}from"./p-Bu7gdOaV.js";import"./p-DgTOxu8x.js";import"./p-CAVi_ne1.js";import"./p-vIQBTQmc.js";import"./p-MPer3Rw7.js";const x={created_at:()=>t("th",{part:R,scope:"col",title:"The date and time each transaction was made"},"Processed On"),type:()=>t("th",{part:R,scope:"col",title:"The type of each transaction"},"Type"),id:()=>t("th",{part:R,scope:"col",title:"The unique identifier of each transaction"},"ID"),amount:()=>t("th",{part:R,scope:"col",title:"The dollar amount of each transaction",class:"text-end"},"Amount"),balance:()=>t("th",{part:R,scope:"col",title:"The running total amount of this payment that belongs to you",class:"text-end"},"Balance"),currency:()=>t("th",{part:R,scope:"col",title:"The currency of each transaction"},"Currency"),financial_transaction_id:()=>t("th",{part:R,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),payment_id:()=>t("th",{part:R,scope:"col",title:"The unique identifier of the payment associated with the payment balance transaction"},"Payment ID"),payment_balance_txn_type:()=>t("th",{part:R,scope:"col",title:"The type of the payment balance transaction"},"Transaction Type"),source_id:()=>t("th",{part:R,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),source_type:()=>t("th",{part:R,scope:"col",title:"The type of the source object associated with the payment balance transaction"},"Source Type")},S={ach_return:"ACH Return",ach_return_fee:"ACH Return Fee",dispute:"Dispute",dispute_fee:"Dispute Fee",dispute_fee_refund:"Dispute Fee Refund",dispute_refund:"Dispute Refund",payment:"Payment",payment_fee:"Fee",platform_fee:"Platform Fee",platform_fee_return:"Platform Fee Return",processing_fee:"Processing Fee",processing_fee_return:"Processing Fee Return",refund:"Refund",fee_refund:"Fee Refund",application_fee_returned:"Application Fee Returned",refund_failure:"Refund Failure",void:"Void"},I={created_at:(e,a)=>t("td",{part:F(a)},t("div",{class:"fw-bold"},P(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},P(e.created_at,{showTime:!0}))),type:(e,a)=>t("td",{part:F(a)},S[e.payment_balance_txn_type]),id:(e,a)=>t("td",{part:F(a)},e.id),amount:(e,a)=>t("td",{part:F(a),class:"text-end"},e.formattedPaymentAmount(e.amount)),balance:(e,a)=>t("td",{part:F(a),class:"text-end"},e.formattedPaymentAmount(e.balance)),currency:(e,a)=>t("td",{part:F(a)},e.currency),financial_transaction_id:(e,a)=>t("td",{part:F(a)},e.financial_transaction_id),payment_id:(e,a)=>t("td",{part:F(a)},e.payment_id),payment_balance_txn_type:(e,a)=>t("td",{part:F(a)},e.payment_balance_txn_type),source_id:(e,a)=>t("td",{part:F(a)},e.source_id),source_type:(e,a)=>t("td",{part:F(a)},e.source_type)},L=class{constructor(t){e(this,t),this.clickEvent=a(this,"click-event",7),this.errorEvent=a(this,"error-event",7),this.balanceTransactions=[],this.isLoading=!0,this.errorMessage=null,this.paging=n,this.pagingParams={},this.columns="created_at,type,id,amount,balance",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:D.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:D.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const a=this.balanceTransactions.find((t=>t.id===e));this.clickEvent.emit({name:D.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,x,I),c(),this.analytics=new o(this),this.initializeApi()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeApi()}handleError(t,e,a){this.isLoading=!1,this.errorEvent.emit({errorCode:t,message:e,severity:a})}initializeApi(){this.paymentId&&this.authToken?(({id:t,authToken:e,service:a})=>async({params:r,onSuccess:n,onError:o,final:c})=>{var d;try{const c=await a.fetchPaymentTransactions(t,e,r);c.error?o({error:h(c.error),code:p(null===(d=c.error)||void 0===d?void 0:d.code),severity:i.ERROR}):n({balanceTransactions:c.data.map((t=>new s(t))),pagingInfo:Object.assign({},c.page_info)})}catch(t){const e=p(null==t?void 0:t.code);o({error:h(t),code:e,severity:i.ERROR})}finally{c()}})({id:this.paymentId,authToken:this.authToken,service:new d})({params:this.pagingParams,onSuccess:({balanceTransactions:t,pagingInfo:e})=>{this.balanceTransactions=t,this.paging=e,this.transactionsTable.collectionData=this.balanceTransactions},onError:({error:t,code:e,severity:a})=>{this.errorMessage=t.message,this.handleError(t,e,a)},final:()=>{this.isLoading=!1}}):(this.errorMessage="payment-id and auth-token props are required",this.handleError(r.MISSING_PROPS,this.errorMessage,i.ERROR))}get entityId(){return this.balanceTransactions.map((t=>t.id))}get showEmptyState(){return!this.isLoading&&!this.errorMessage&&this.transactionsTable.rowData.length<1}get showErrorState(){return!this.isLoading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.isLoading}render(){return t(C,{key:"f8b0f3a58ef7f88c0ac42fc58955b28ad97922e4"},t(l,{key:"2dc653b63611cbdfa388b386cec9b3adf751bd12"},t(u,{key:"a0bd64c01870ccd4bb921d5d90c7453650131f16"},t(m,{key:"b92ce24dab41cbaf1d8ecb1df43739d2548fe73f"},t(b,{key:"5f983b93b2b9b6661cae2cf74802519175aae8cc"},this.transactionsTable.columnData.map((t=>t)))),t(y,{key:"d9a51ecfc54c16a4859f9d66fb783f3876fc3428"},t(_,{key:"232f1b59ddeb9f949901678a67c652cc3aedfdf7",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(g,{key:"bd9a853887da939c651c234cd4f0e3ab35d610d1",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(j,{key:"da157eb9d18d89353f6aebb085bb4becb15ac89f",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(T,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(w,{key:"41ffc1c9d3591dad7973f862b78b488e089af863"},t(k,{key:"17780690e1b44eb6ba13128d3ecfee73c6be06a7"},t(v,{key:"312b9a0b9649ffd9033ec1333b2d9d8eb666d185",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"4ef805672cf530850ecdf13e26eefc8015f80fa3",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],paymentId:["propChanged"],authToken:["propChanged"]}}};export{L as justifi_payment_transactions_list}
@@ -0,0 +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:"a8b450dc8d759d10da91b81e062adfcc4ec803f1"},s("save-new-payment-method",{key:"f463f223c38e4078b96efb0a99c3d932663b3574",label:this.label,hidden:this.hidden,onCheckboxChanged:e=>this.checkboxChanged.emit(e.detail)}))}};export{o as justifi_save_new_payment_method}
@@ -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-vIQBTQmc.js";import{A as o,r,s as l,t as h,u as c,v as d,w as u,C as p,b as y,c as m,I as v,x as f,y as g,z as b}from"./p-D6uhYbLo.js";import{S as M}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import{S as w}from"./p-eBK-iWrz.js";import{c as k,o as P,a as j,g as C,b as T}from"./p-Fpaf7CLD.js";import{t as A,r as E}from"./p-Bu7gdOaV.js";import{f as I}from"./p-Ds_P-dB8.js";import{w as N,c as D}from"./p-B4vLfYnZ.js";import{H as S}from"./p-CZk3i5Tu.js";import{H as O,b as L,h as x,i as z}from"./p-x2oNTAWh.js";import{H as _}from"./p-BAB1lPu0.js";import{J as R}from"./p-nbKvRcwU.js";import{c as U}from"./p-BEL8sLz6.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-DaDqgDrb.js";import{m as B,a as Y}from"./p-CXsRwohv.js";import{C as F}from"./p-27igUlku.js";import{P as V}from"./p-DN7VhlTn.js";import{P as Q,a as H,b as W}from"./p-DEx8fQeW.js";import{C as Z}from"./p-ZpPDShvP.js";import"./p-CAVi_ne1.js";import"./p-DgTOxu8x.js";import"./p-CLq3Og7o.js";const G=class{constructor(i){t(this,i),this.radioClick=e(this,"radio-click",7),this.checked=!1,this.hidden=!1}render(){return i(M,{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 J{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 K=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(w,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null},$=t=>i("div",{class:"apple-pay-button-container"},i("button",Object.assign({class:(()=>{let e="apple-pay-button";switch(t.buttonStyle){case c.WHITE:e+=" apple-pay-button-white";break;case c.WHITE_OUTLINE:e+=" apple-pay-button-white-outline";break;default:e+=" apple-pay-button-black"}switch(t.buttonType){case d.BUY:e+=" apple-pay-button-type-buy";break;case d.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 ")),X=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=d.PLAIN,this.buttonStyle=c.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.countryCode,currencyCode:k.paymentCurrency,merchantCapabilities:[u.SUPPORTS_3DS,u.SUPPORTS_CREDIT,u.SUPPORTS_DEBIT],supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(k.paymentDescription,k.paymentAmount)},s=await this.applePayService.startPaymentSession(i,k.authToken,k.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)||X.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:X.ErrorCode.PAYMENT_FAILED}),this.applePayCompleted.emit({success:!1,error:e})}}finally{this.isProcessing=!1}}}componentWillLoad(){this.isAvailable=r.isApplePaySupported(),this.isAvailable?k.checkoutLoaded?this.loadApplePaySDK():P("checkoutLoaded",(t=>{t&&this.loadApplePaySDK()})):this.isLoading=!1}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(k.paymentAmount)&&Boolean(k.paymentCurrency)&&Boolean(k.authToken)))return this.error="Missing required Apple Pay configuration",this.isConfigValid=!1,this.applePayError.emit({error:this.error,code:X.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:X.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:X.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 J,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:X.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(!k.applePayEnabled)return null;if(!this.isAvailable)return null;const t=!this.isLoading&&this.isAvailable&&this.canMakePayments&&this.isConfigValid;return i(M,null,i("div",{class:"apple-pay-container"},i(K,{isLoading:this.isLoading}),t&&i($,{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 "))}};X.ErrorCode={CONFIG_ERROR:"CONFIG_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",NOT_AVAILABLE:"NOT_AVAILABLE",INITIALIZATION_ERROR:"INITIALIZATION_ERROR",PAYMENT_FAILED:"PAYMENT_FAILED"};const tt=class{constructor(e){t(this,e),this.variant="primary",this.type="button"}render(){return i(M,{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}))}},et=class{constructor(e){t(this,e)}render(){return i(M,{key:"7d3447ff4daa9bf4f603ca381027b3f43cfcc6a1"},i("section",{key:"1c8189ccde6dc986ad2d4c74da2dd10cacfc1c36"},i("div",{key:"45e6d5f47d8a92e0bd4a7bfa427630a96f049b4a"},i("div",{key:"9900b5fd770cd59b00803c3614216c16a803da41",part:A},null==k?void 0:k.paymentDescription),i("div",{key:"16cec140ef6912533a80b1f6341fcc9cb341b478"},i("span",{key:"f8883538c99a524017bb102bfd8cfaea7062e650",part:A},"Total")," ",i("span",{key:"11baa64630a60c56cedfa53548c107ec3fe3c0f5",part:A},I(+(null==k?void 0:k.totalAmount)))))))}},it=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(w,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null};var st;!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"}(st||(st={}));const at=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 st.ready:this.iframeReady=!0;break;case st.sdkLoaded:this.sdkLoaded=!0,this.sendInitialize();break;case st.initializeResult:this.isReadyToPay=i.isReadyToPay,i.error&&console.error("Init error:",i.error);break;case st.error:console.error("Google Pay error:",i);break;case st.buttonClicked:this.googlePayStarted.emit(),this.sendStartPayment();break;case st.paymentSuccess:this.googlePayCompleted.emit({success:!0,paymentMethodId:i.paymentMethodId,cardNetwork:i.cardNetwork,cardDetails:i.cardDetails});break;case st.paymentCanceled:this.googlePayCancelled.emit();break;case st.paymentError:this.googlePayCompleted.emit({success:!1,error:{code:i.code,message:i.message}})}}}async componentWillLoad(){await N(),this.iframeOrigin=D.iframeOrigin}componentDidLoad(){window.addEventListener("message",this.handleMessage)}disconnectedCallback(){window.removeEventListener("message",this.handleMessage)}googlePayEnvironment(){return void 0!==this.environment?this.environment:"test"===k.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:k.accountId,merchantName:this.merchantDisplayName,authToken:k.authToken,accountId:k.accountId,useNativePaymentRequest:this.useNativePaymentRequest};this.iframeElement.contentWindow.postMessage({eventType:st.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(k.paymentAmount/100),totalPriceStatus:"FINAL",currencyCode:k.paymentCurrency||"USD"};this.iframeElement.contentWindow.postMessage({eventType:st.startPayment,data:e},this.iframeOrigin)}render(){return k.checkoutLoaded?k.googlePayEnabled?i(s,null,i(it,{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}},nt=class{constructor(e){t(this,e),this.levels={h1:S,h2:O,h3:_},this.level="h1"}render(){return i(M,{key:"1843adabddf7d439036f8ce6f55627b7ca3e4a9f"},i(this.levels[this.level],{key:"b16e5624ce7e092cc8c144a7cdfd9cb6afdf7a83",text:this.text,class:this.class}))}},ot=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 V,this.handlePaypalStarted=()=>{k.isWalletProcessing=!0},this.handlePaypalCompleted=t=>{const{success:e,paymentMethodId:i,fundingSource:s}=t.detail||{};k.isWalletProcessing=!1,e&&i?(k.paymentToken=i,k.selectedPaymentMethod={type:"venmo"===s?Q.VENMO:Q.PAYPAL},this.submitCheckout()):this.errorEvent.emit({message:"Paypal payment failed",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR})},this.handlePaypalCancelled=()=>{k.isWalletProcessing=!1,k.paymentToken=void 0,k.selectedPaymentMethod=void 0},this.handlePaypalError=t=>{k.isWalletProcessing=!1;const{error:e,code:i}=t.detail||{};this.errorEvent.emit({message:e||"Paypal error occurred",errorCode:`PAYPAL_${i}`,severity:p.ERROR})},this.handleApplePayStarted=()=>{k.isWalletProcessing=!0},this.handleGooglePayStarted=()=>{k.isWalletProcessing=!0},this.handleGooglePayCompleted=t=>{const{success:e,paymentMethodId:i,error:s}=t.detail||{};e&&i?(k.isWalletProcessing=!1,k.paymentToken=i,k.selectedPaymentMethod={type:Q.GOOGLE_PAY},this.submitCheckout()):(k.isWalletProcessing=!1,this.errorEvent.emit({message:s&&s.message||"Google Pay payment failed",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR}))},this.handleGooglePayCancelled=()=>{k.isWalletProcessing=!1,k.paymentToken=void 0,k.selectedPaymentMethod=void 0},this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:a}=t.detail;e&&i?(k.isWalletProcessing=!1,k.paymentToken=s,k.selectedPaymentMethod={type:Q.APPLE_PAY},this.submitCheckout()):(k.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:p.ERROR}))},this.handleApplePayError=t=>{k.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:p.ERROR})},this.handleApplePayCancelled=()=>{k.isWalletProcessing=!1,k.paymentToken=void 0,k.selectedPaymentMethod=void 0}}connectedCallback(){var t;this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners(),this.setupPaypalListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),k.checkoutId=this.checkoutId;const e={authToken:this.authToken,checkoutId:this.checkoutId,service:new F};this.getCheckout=B(e),this.completeCheckout=Y(e),null===(t=this.unsubscribeCheckoutChanges)||void 0===t||t.call(this),this.unsubscribeCheckoutChanges=j((()=>{this.emitCheckoutChanged()}))}componentWillLoad(){this.analytics=new R(this),U(),k.authToken=this.authToken,this.fetchCheckout(),L("set",(t=>{const e=z[t];void 0!==e&&x(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:p.ERROR}):this.errorEvent.emit({message:m.CHECKOUT_ALREADY_COMPLETED,errorCode:y.CHECKOUT_ALREADY_COMPLETED,severity:p.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:t.code,severity:t.severity})}}):this.errorEvent.emit({message:m.NOT_AUTHENTICATED,errorCode:y.NOT_AUTHENTICATED,severity:p.ERROR})}updateStore(t){var e,i,s,a,n,o,r,l,h,c,d,u,p,y,m;k.accountId=t.account_id;const v=null!=t.mode?String(t.mode).toLowerCase():"";k.checkoutMode="test"===v?"test":"live"===v?"live":null;const f=t.payment_methods.map((t=>new H(t))),g=Boolean(null===(e=t.payment_settings)||void 0===e?void 0:e.ach_payments);k.paymentMethods=f.filter((t=>t.type!==Q.SAVED_BANK_ACCOUNT||g)),k.paymentMethodGroupId=t.payment_method_group_id,k.paymentDescription=t.payment_description,k.totalAmount=t.total_amount,k.paymentAmount=t.payment_amount,k.bnplEnabled=t.payment_settings.bnpl_payments,k.insuranceEnabled=null!==(i=t.payment_settings.insurance_payments)&&void 0!==i&&i,k.bankAccountVerification=null===(s=t.payment_settings)||void 0===s?void 0:s.bank_account_verification,k.applePayEnabled=null!==(n=null===(a=t.payment_settings)||void 0===a?void 0:a.apple_payments)&&void 0!==n&&n,k.googlePayEnabled=null!==(r=null===(o=t.payment_settings)||void 0===o?void 0:o.google_payments)&&void 0!==r&&r,k.paypalEnabled=null!==(h=null===(l=t.payment_settings)||void 0===l?void 0:l.paypal_payments)&&void 0!==h&&h,k.paypalProviderClientId=null!==(d=null===(c=t.paypal)||void 0===c?void 0:c.provider_client_id)&&void 0!==d?d:"",k.achPaymentsEnabled=g,k.bnplProviderClientId=null===(u=null==t?void 0:t.bnpl)||void 0===u?void 0:u.provider_client_id,k.bnplProviderMode=null===(p=null==t?void 0:t.bnpl)||void 0===p?void 0:p.provider_mode,k.bnplProviderApiVersion=null===(y=null==t?void 0:t.bnpl)||void 0===y?void 0:y.provider_api_version,k.bnplProviderCheckoutUrl=null===(m=null==t?void 0:t.bnpl)||void 0===m?void 0:m.provider_checkout_url,k.paymentCurrency=(t.payment_currency||k.paymentCurrency).toUpperCase(),k.checkoutLoaded=!0}emitCheckoutChanged(){const t={availablePaymentMethodTypes:C(),selectedPaymentMethod:k.selectedPaymentMethod,savedPaymentMethods:k.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"),!k.selectedPaymentMethod&&this.paymentMethodFormRef){const t=this.paymentMethodFormRef.tagName.toLowerCase();"justifi-card-form"===t?k.selectedPaymentMethod={type:Q.NEW_CARD}:"justifi-bank-account-form"!==t||k.checkoutLoaded&&!k.achPaymentsEnabled||(k.selectedPaymentMethod={type:Q.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:k.accountId,payment_method_group_id:void 0},n);k.savePaymentMethod&&(o.payment_method_group_id=k.paymentMethodGroupId);const r=await(null===(s=this.paymentMethodFormRef)||void 0===s?void 0:s.tokenize({clientId:this.authToken,paymentMethodMetadata:o,account:k.accountId}));return r.error?r:(k.paymentToken=r.id,r.id)}async fillBillingForm(t){k.billingFormFields=t}async setSelectedPaymentMethod(t){k.selectedPaymentMethod=t,k.paymentToken=t.id||void 0}async validate(){var t,e;const i=[];k.insuranceEnabled&&this.insuranceFormRef&&i.push(this.insuranceFormRef.validate());const s=(null===(t=k.selectedPaymentMethod)||void 0===t?void 0:t.type)===Q.NEW_CARD,a=(null===(e=k.selectedPaymentMethod)||void 0===e?void 0:e.type)===Q.NEW_BANK_ACCOUNT;if((s||a)&&(this.paymentMethodFormRef&&i.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&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:p.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){var e,i,s,a,n,o,r,l;if(k.isSubmitting)return;k.isSubmitting=!0;const h=await this.validate();if(!k.selectedPaymentMethod)return k.isSubmitting=!1,void this.errorEvent.emit({message:"No payment method selected.",errorCode:y.VALIDATION_ERROR,severity:p.ERROR});const c=(null===(e=k.selectedPaymentMethod)||void 0===e?void 0:e.type)===Q.NEW_CARD,d=(null===(i=k.selectedPaymentMethod)||void 0===i?void 0:i.type)===Q.NEW_BANK_ACCOUNT,u=(null===(s=k.selectedPaymentMethod)||void 0===s?void 0:s.type)===Q.PLAID;if(c||d){const e=await this.tokenizePaymentMethod(t);if(null==e?void 0:e.error)return k.isSubmitting=!1,void this.errorEvent.emit({message:e.error.message,errorCode:y.TOKENIZE_ERROR,severity:p.ERROR})}if(u&&!k.paymentToken){const t=k.plaidPublicToken,e=k.plaidLinkTokenId;if(!t)return k.isSubmitting=!1,void this.errorEvent.emit({message:"Missing Plaid public token. Please connect your bank.",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR});try{const i=await this.plaidService.tokenizeBankAccount(k.authToken,k.accountId,t,e||void 0,k.savePaymentMethod?k.paymentMethodGroupId:void 0);if(null==i?void 0:i.error)return k.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:p.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);k.paymentToken=n}catch(t){return k.isSubmitting=!1,void this.errorEvent.emit({message:(null==t?void 0:t.message)||"Plaid exchange error",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR})}}if(!h)return k.isSubmitting=!1,void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:y.VALIDATION_ERROR,severity:p.ERROR});const m=(null===(n=k.selectedPaymentMethod)||void 0===n?void 0:n.type)===Q.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 k.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:p.ERROR})}if(!m&&!k.paymentToken)return k.isSubmitting=!1,void this.errorEvent.emit({message:"Payment token not found.",errorCode:y.TOKENIZE_ERROR,severity:p.ERROR});const v={payment_mode:(t=>{switch(t){case Q.NEW_CARD:case Q.SAVED_CARD:case Q.NEW_BANK_ACCOUNT:case Q.SAVED_BANK_ACCOUNT:case Q.PLAID:return W.ECOM;case Q.SEZZLE:return W.BNPL;case Q.APPLE_PAY:return W.APPLE_PAY;case Q.GOOGLE_PAY:return W.GOOGLE_PAY;case Q.PAYPAL:return W.PAYPAL;case Q.VENMO:return W.VENMO;default:return}})(null===(l=k.selectedPaymentMethod)||void 0===l?void 0:l.type),payment_token:m?void 0:k.paymentToken};if(this.preCompleteHook){const t=T();try{await new Promise(((e,i)=>{this.preCompleteHook(t,(()=>e()),(()=>i()))}))}catch(t){return k.isSubmitting=!1,void console.log("Checkout cancelled by preCompleteHook",t)}}this.completeCheckout({payment:v,onSuccess:({checkout:t})=>{k.isSubmitting=!1,this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{k.isSubmitting=!1,this.errorEvent.emit({message:t.message,errorCode:y.COMPLETE_CHECKOUT_ERROR,severity:p.ERROR})}})}render(){return i(s,{key:"127bf2aea6758c7d91e33f252a3db4bc27b066ff"})}get hostEl(){return a(this)}},rt=n();class lt{async createPaypalOrder(t,e,i,s){return rt.post({endpoint:`checkouts/${e}/paypal/orders`,body:{funding_source:i},authToken:t,signal:s})}}const ht="paypal-script",ct=["paypal-payments","venmo-payments"],dt="PAYMENT_FAILED",ut="shown",pt=(t,e)=>{t&&(e?t.classList.add(ut):t.classList.remove(ut))},yt=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 lt,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",dt)}}}componentDidLoad(){k.checkoutLoaded?this.initializePaypal():P("checkoutLoaded",(t=>{t&&this.initializePaypal()}))}componentDidRender(){this.applyVisibility()}get currencyCode(){return(k.paymentCurrency||"USD").toUpperCase()}get showPaypal(){return!!k.paypalEnabled&&this.paypalEligible}get showVenmo(){return!!k.paypalEnabled&&this.venmoEligible&&"USD"===this.currencyCode}applyVisibility(){const{showPaypal:t,showVenmo:e}=this;pt(this.buttonsEl,t||e),pt(this.paypalButtonEl,t),pt(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="${ht}"]`);i||(i=document.createElement("script"),i.src="test"===k.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",ht),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=k.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:ct,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",dt)}}async createOrder(t){const e=await this.paypalService.createPaypalOrder(k.authToken,k.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(M,{key:"05c771ae41d3b21da7046e70c7d0e03efc296a0c"},i("div",{key:"8e7a14372ce29b4da284efadb43c27d0c059607e",class:"paypal-buttons",ref:t=>this.buttonsEl=t},i("paypal-button",{key:"aa7fa82c96ca4d41872f445a01e72a18f6f5920a",type:"pay",ref:t=>this.paypalButtonEl=t,onClick:()=>this.startSession(this.paypalSession,"paypal")}),i("venmo-button",{key:"2cb068aa82460068548f133607cebec096028a41",type:"pay",ref:t=>this.venmoButtonEl=t,onClick:()=>this.startSession(this.venmoSession,"venmo")})),i("style",{key:"159cc68f682ed79a9a83be7d1b4c88127f8a2623"},"\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 "))}},mt=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 V,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.hasLoggedAchPaymentsDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{k.authToken&&k.accountId&&k.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:b.PLAID_SDK_LOAD_FAILED,message:g[b.PLAID_SDK_LOAD_FAILED],severity:f[b.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:b.PLAID_LINK_TOKEN_FAILED,message:g[b.PLAID_LINK_TOKEN_FAILED],severity:f[b.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:b.PLAID_LINK_INIT_FAILED,message:g[b.PLAID_LINK_INIT_FAILED],severity:f[b.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,s,a;try{if(!k.authToken||!k.accountId)return void this.handleError({code:b.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:p.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(k.authToken,k.accountId,k.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&&(k.plaidLinkTokenId=this.linkTokenId)}catch(t){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let n=b.PLAID_LINK_TOKEN_FAILED,o=g[n],r=!0;"AbortError"===t.name?(n=b.PLAID_TIMEOUT,o=g[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=b.PLAID_NETWORK_ERROR,o=g[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=b.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 b.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return b.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return b.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return b.PLAID_RATE_LIMITED;case"maintenance":return b.PLAID_MAINTENANCE;case"not_authenticated":return b.PLAID_INVALID_CREDENTIALS;default:return b.PLAID_LINK_TOKEN_FAILED}return b.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,k.selectedPaymentMethod={type:Q.PLAID}),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:p.INFO}),k.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=b.PLAID_AUTHENTICATION_FAILED,i=g[e],s=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=b.PLAID_INVALID_CREDENTIALS,i=g[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=b.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=b.PLAID_ACCOUNT_LOCKED,i=g[e],s=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=b.PLAID_MAINTENANCE,i=g[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=b.PLAID_RATE_LIMITED,i=g[e],s=!0;break;case"INVALID_REQUEST":e=b.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=b.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=b.PLAID_BANK_NOT_SUPPORTED,i=g[e],s=!1,a="Try a different payment method"):(n.includes("expired")||n.includes("timeout"))&&(e=b.PLAID_TOKEN_EXPIRED,i=g[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=k.selectedPaymentMethod)||void 0===t?void 0:t.type)===Q.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=k.selectedPaymentMethod)||void 0===e?void 0:e.type)!==Q.PLAID&&(k.selectedPaymentMethod={type:Q.PLAID}),!t||!this.plaidLink||this.publicToken||this.isAuthenticating||this.error||this.openPlaidLink()}componentWillLoad(){var t;this.isSelected=(null===(t=k.selectedPaymentMethod)||void 0===t?void 0:t.type)===Q.PLAID,!0===k.bankAccountVerification&&(k.checkoutLoaded?k.achPaymentsEnabled&&this.loadPlaidSDK():P("checkoutLoaded",(t=>{t&&!0===k.bankAccountVerification&&k.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:b.PLAID_SDK_LOAD_FAILED,message:g[b.PLAID_SDK_LOAD_FAILED],severity:f[b.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 k.paymentToken}async handleSelectionClick(){if(this.isSelected=!0,k.selectedPaymentMethod={type:Q.PLAID},this.error)return this.clearError(),void this.waitForStoreAndInitialize();!this.plaidLink||this.publicToken||this.isAuthenticating||this.openPlaidLink()}async setSelected(t){this.isSelected=t,t&&(k.selectedPaymentMethod={type:Q.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=P("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(k.checkoutLoaded&&!k.achPaymentsEnabled)return this.hasLoggedAchPaymentsDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] ACH payments are disabled for this checkout. Component will not render."),this.hasLoggedAchPaymentsDisabledWarning=!0),null;if(!0!==k.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[JustifiPlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const t=i("img",{class:"plaid-logo-img",src:"data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgMjggMjkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgY2xhc3M9ImNzcy0xcmRhajhtIj48ZyBmaWxsPSIjMTExIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yNS43NjI5IDI2LjI2MjhMMjggMTcuNTMwOUwyNC45NjkxIDE0LjUwMDFMMjcuOTk5OSAxMS40NjkxTDI1Ljc2MjggMi43MzcwNkwxNy4wMzA5IDAuNUwxNC4wMDAxIDMuNTMxTDEwLjk2OSAwLjUwMDE0TDIuMjM3MDYgMi43MzczNEwwIDExLjQ2OTFMMy4wMzEyOCAxNC40OTk5TDAuMDAwMTQgMTcuNTMxTDIuMjM3MiAyNi4yNjI5TDEwLjk2OTEgMjguNUwxNC4wMDAxIDI1LjQ2OUwxNy4wMzEgMjguNDk5OUwyNS43NjI5IDI2LjI2MjhaTTE1LjczMjEgMjMuNzM3MUwxOC42MTg2IDIwLjg1MDVMMjIuMjkxMiAyNC41MjMzTDE3LjY5NTYgMjUuNzAwN0wxNS43MzIxIDIzLjczNzFaTTExLjExMzYgOS44ODE1NEwxNC4wMDAzIDYuOTk1MDJMMTYuODg2OCA5Ljg4MTRMMTQuMDAwMSAxMi43Njc5TDExLjExMzYgOS44ODE1NFpNMTIuMjY4MiAxNC41TDkuMzgxNTQgMTcuMzg2NUw2LjQ5NTAyIDE0LjVMOS4zODE1NCAxMS42MTM1TDEyLjI2ODIgMTQuNVpNMTguNjE4NyAxMS42MTMzTDIxLjUwNTMgMTQuNUwxOC42MTg2IDE3LjM4NjVMMTUuNzMyMSAxNC41TDE4LjYxODcgMTEuNjEzM1pNMTYuODg2NyAxOS4xMTg2TDE0LjAwMDEgMjIuMDA1MUwxMS4xMTM1IDE5LjExODVMMTQuMDAwMSAxNi4yMzE5TDE2Ljg4NjcgMTkuMTE4NlpNMTAuMzA0NCAyNS43MDA3TDUuNzA4NjQgMjQuNTIzM0w5LjM4MTU0IDIwLjg1MDRMMTIuMjY4MiAyMy43MzcxTDEwLjMwNDQgMjUuNzAwN1pNNC43NjMwOCAxNi4yMzE5TDcuNjQ5NiAxOS4xMTg1TDMuOTc2NyAyMi43OTE0TDIuNzk5MyAxOC4xOTU3TDQuNzYzMDggMTYuMjMxOVpNMy45NzY3IDYuMjA4MzZMNy42NDk3NCA5Ljg4MTRMNC43NjMwOCAxMi43NjgxTDIuNzk5MyAxMC44MDQxTDMuOTc2NyA2LjIwODM2Wk0xMi4yNjgzIDUuMjYyOTRMOS4zODE2OCA4LjE0OTZMNS43MDg5MiA0LjQ3NjdMMTAuMzA0NyAzLjI5OTNMMTIuMjY4MyA1LjI2Mjk0Wk0xNy42OTU5IDMuMjk5M0wyMi4yOTE1IDQuNDc2N0wxOC42MTg2IDguMTQ5NDZMMTUuNzMyMSA1LjI2Mjk0TDE3LjY5NTkgMy4yOTkzWk0yMy4yMzcyIDEyLjc2ODFMMjAuMzUwNSA5Ljg4MTRMMjQuMDIzMyA2LjIwODc4TDI1LjIwMDcgMTAuODA0NkwyMy4yMzcyIDEyLjc2ODFaTTI0LjAyMzMgMjIuNzkxNEwyMC4zNTA1IDE5LjExODZMMjMuMjM3MiAxNi4yMzIxTDI1LjIwMDcgMTguMTk1N0wyNC4wMjMzIDIyLjc5MTRaIj48L3BhdGg+PC9nPjwvc3ZnPgo=",alt:"Plaid",title:"Plaid",style:{display:"inline",width:"20px",height:"20px",marginLeft:"5px",marginTop:"-2px"}});return i(M,{class:"payment-method"},i("div",{title:"Pay with Plaid"},i("div",{onClick:t=>{t.preventDefault(),this.handleSelectionClick()}},"Pay with Bank Account ",t," "),(()=>this.error?i("div",{class:(this.error.severity===p.ERROR?"text-danger":this.error.severity===p.WARNING?"text-warning":"text-info")+" mt-2"},i("small",null,this.error.message),i("br",null),i("small",{class:"text-muted"},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",null,"Connecting to your bank...")):this.publicToken?i("div",{class:"text-success mt-2"},i("small",null,"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:i("div",{class:"text-muted mt-2"},i("small",null,"Click to connect your bank account")))()))}static get watchers(){return{isSelected:["onSelectionChange"]}}},vt=class{constructor(e){t(this,e),this.onPaymentMethodOptionClick=t=>e=>{e.preventDefault(),k.selectedPaymentMethod={id:t.id,type:t.type},k.paymentToken=t.id},this.isAllowedPaymentMethod=t=>!(t===Q.SAVED_CARD&&k.disableCreditCard||t===Q.SAVED_BANK_ACCOUNT&&k.disableBankAccount)}componentWillLoad(){k.checkoutLoaded&&(k.paymentMethods.length||console.warn("No saved payment methods available."),k.disablePaymentMethodGroup&&console.warn("Payment method group is disabled."))}render(){return k.disablePaymentMethodGroup?null:i(M,null,i("div",{class:"saved-payment-methods"},k.paymentMethods.length?k.paymentMethods.filter((t=>this.isAllowedPaymentMethod(t.type))).map((t=>i("div",{class:"radio-list-item p-3",part:E,onClick:this.onPaymentMethodOptionClick(t)},i("form-control-radio",{name:"paymentMethodType",value:null==t?void 0:t.id,checked:k.paymentToken===(null==t?void 0:t.id),label:`${Z[null==t?void 0:t.brand]||""} *${null==t?void 0:t.acct_last_four}`})))):null))}},ft=class{constructor(i){t(this,i),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.paymentMethodOptionId=Q.SEZZLE,this.initializeSezzleCheckout=()=>{const t=Number(k.paymentAmount),e=new(0,window.Checkout)({mode:"popup",publicKey:k.bnplProviderClientId,apiMode:k.bnplProviderMode,apiVersion:k.bnplProviderApiVersion});e.sezzleButtonElement=this.sezzleButtonRef,e.init({onClick:function(t){t.preventDefault(),e.startCheckout({checkout_url:k.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(){k.selectedPaymentMethod={type:Q.SEZZLE},this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)}render(){var t,e;return k.bnplEnabled?i(M,{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"},I(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)}},gt={[Q.NEW_BANK_ACCOUNT]:"New bank account",[Q.NEW_CARD]:"New credit or debit card"},bt="Payment form not ready",Mt="Validation error",wt=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()}componentWillLoad(){U(),this.analytics=new R(this)}handleRadioClick(t){this.selectedPaymentMethod=t.detail,k.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:Mt}),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){k.billingFormFields=t}async validate(){if(!this.areFormsReady())return{isValid:!1,errors:{general:bt}};const[t,e]=await Promise.all([this.billingFormRef.validate(),this.paymentMethodFormRef.validate()]);return{isValid:t.isValid&&e.isValid,errors:Object.assign(Object.assign({},t.errors),e.errors)}}async getValues(){return this.billingFormRef.getValues()}async tokenize(){try{const t=await this.billingFormRef.getValues(),e={clientId:this.authToken||k.authToken,account:this.accountId||k.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||k.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||k.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||k.checkoutLoaded&&!k.achPaymentsEnabled||(this.selectedPaymentMethod=Q.NEW_BANK_ACCOUNT,k.selectedPaymentMethod={type:Q.NEW_BANK_ACCOUNT}):(this.selectedPaymentMethod=Q.NEW_CARD,k.selectedPaymentMethod={type:Q.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=!k.checkoutLoaded||k.achPaymentsEnabled;return this.disableCreditCard||t.push(Q.NEW_CARD),!this.disableBankAccount&&e&&t.push(Q.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:p.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",bt);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||Mt;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||k.paymentMethodGroupId}get shouldSavePaymentMethod(){return!(!this.paymentMethodGroupId&&!k.savePaymentMethod)}get shouldHideRadioInput(){return this.disableCreditCard||this.disableBankAccount}renderPaymentMethodOption(t){const e=this.selectedPaymentMethod===t&&void 0===k.selectedPaymentMethod.id;return i("div",{class:"payment-method"},i("radio-list-item",{name:"paymentMethodType",value:t,checked:e,label:gt[t],hidden:this.shouldHideRadioInput}),e&&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 i(t===Q.NEW_CARD?"card-form":"bank-account-form",{ref:t=>{t&&(this.paymentMethodFormRef=t)}})}render(){return i(M,{key:"16a5a47febb09295c95f141ddc96a849e530c477"},i("form",{key:"e1ac3ac80435b32cb0a742198d814778bffd635c"},i("fieldset",{key:"68d0f984d3e66a6abc794e8b2086e27f26ecc809"},i("div",{key:"b1759ec1b9c94a976da992947b06da6d8f48f553",class:"row gy-3"},i("div",{key:"bc1ef82406d3da36c5d4d97b1a10259de87fdd09",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),i("div",{key:"ed26f2908aa90daba5ab320a668369566b9dacfa",class:"col-12"},i("internal-button",{key:"094cdacb592825374ad33dd80a05091747bfec4b",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{X as justifi_apple_pay,tt as justifi_button,et as justifi_checkout_summary,at as justifi_google_pay,nt as justifi_header,ot as justifi_modular_checkout,yt as justifi_paypal,mt as justifi_plaid_payment_method,G as justifi_radio_list_item,vt as justifi_saved_payment_methods,ft as justifi_sezzle_payment_method,wt as justifi_tokenize_payment_method}
@@ -0,0 +1 @@
1
+ import{r as t,h as o}from"./p-CV0Pyo1O.js";import{J as r}from"./p-nbKvRcwU.js";import{c as s}from"./p-BEL8sLz6.js";import{w as a}from"./p-B4vLfYnZ.js";import{S as p}from"./p-05AWudQe.js";import"./p-CZfYo5-1.js";import"./p-CAVi_ne1.js";import"./p-vIQBTQmc.js";import"./p-Ds_P-dB8.js";import"./p-HXpYMWUU.js";import"./p-D6uhYbLo.js";import"./p-CLHwhyvu.js";import"./p-DaDqgDrb.js";import"./p-DgTOxu8x.js";const i=class{constructor(o){t(this,o)}async componentWillLoad(){await a(),s(),this.analytics=new r(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return this.cardFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:o,account:r}){return this.cardFormElement.tokenize({clientId:t,paymentMethodMetadata:o,account:r})}render(){return o(p,{key:"4fa9ff677d40a6733c33d34135fe85e52392f8b0"},o("card-form",{key:"3fe97adcb966b78dc28d5902409671e88525ca41",ref:t=>this.cardFormElement=t}))}};export{i as justifi_card_form}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as o,H as i}from"./p-CV0Pyo1O.js";import{C as s}from"./p-ZpPDShvP.js";import{r as a}from"./p-Bu7gdOaV.js";import"./p-HXpYMWUU.js";const r=class{constructor(o){t(this,o),this.paymentMethodOptionSelected=e(this,"paymentMethodOptionSelected",7),this.onPaymentMethodOptionClick=t=>{t.preventDefault(),this.paymentMethodOptionSelected.emit(this.paymentMethodOption)}}async resolvePaymentMethod(t){var e;return t.isValid?{token:null===(e=this.paymentMethodOption)||void 0===e?void 0:e.id}:{validationError:!0}}render(){var t,e,r;return o(i,{key:"d775b9a1bc4bc1e2c8992e165cd50b23f5e0d8dd",class:"payment-method"},o("div",{key:"812af6ff715167c3a50e308e868fe582fa838f8a",class:"radio-list-item p-3",part:a,onClick:this.onPaymentMethodOptionClick},o("form-control-radio",{key:"cb1b06940efa7394c03178cb4f6b9fa7edc49133",name:"paymentMethodType",value:null===(t=this.paymentMethodOption)||void 0===t?void 0:t.id,checked:this.isSelected,label:`${s[null===(e=this.paymentMethodOption)||void 0===e?void 0:e.brand]||""} *${null===(r=this.paymentMethodOption)||void 0===r?void 0:r.acct_last_four}`})))}};export{r as justifi_saved_payment_method}