@justifi/webcomponents 4.7.6 → 4.8.1

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 (276) hide show
  1. package/dist/cjs/Business-3c0aa22c.js +82 -0
  2. package/dist/cjs/BusinessFormEventTypes-863f48e9.js +42 -0
  3. package/dist/cjs/{Payout-7821eb61.js → Payout-44b49b2d.js} +2 -1
  4. package/dist/cjs/additional-questions-details_5.cjs.entry.js +4 -4
  5. package/dist/cjs/{business-form-schema-a2b87e77.js → business-form-schema-37e5381d.js} +17 -17
  6. package/dist/cjs/{form-control-datepart_2.cjs.entry.js → form-control-datepart_3.cjs.entry.js} +45 -2
  7. package/dist/cjs/{form-control-number_3.cjs.entry.js → form-control-select_2.cjs.entry.js} +0 -43
  8. package/dist/cjs/form-input-masks-e3bf2614.js +9 -0
  9. package/dist/cjs/{index.esm-c08c2adc.js → index.esm-d25bd7bf.js} +0 -259
  10. package/dist/cjs/{justifi-additional-questions_6.cjs.entry.js → justifi-additional-questions_5.cjs.entry.js} +10 -280
  11. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +1 -1
  12. package/dist/cjs/justifi-business-details.cjs.entry.js +5 -5
  13. package/dist/cjs/justifi-business-form-stepped.cjs.entry.js +46 -52
  14. package/dist/cjs/justifi-business-form.cjs.entry.js +31 -35
  15. package/dist/cjs/justifi-business-list.cjs.entry.js +3 -50
  16. package/dist/cjs/justifi-business-owners.cjs.entry.js +78 -0
  17. package/dist/cjs/justifi-details.cjs.entry.js +1 -1
  18. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
  19. package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +1 -1
  20. package/dist/cjs/justifi-payment-details.cjs.entry.js +43 -42
  21. package/dist/cjs/justifi-payment-form.cjs.entry.js +1 -1
  22. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +6 -4
  23. package/dist/cjs/justifi-payments-list.cjs.entry.js +46 -90
  24. package/dist/cjs/justifi-payout-details.cjs.entry.js +47 -45
  25. package/dist/cjs/justifi-payouts-list.cjs.entry.js +46 -112
  26. package/dist/cjs/justifi-proceeds-list.cjs.entry.js +1 -1
  27. package/dist/cjs/justifi-refund-form.cjs.entry.js +2 -2
  28. package/dist/cjs/justifi-subaccount-details.cjs.entry.js +2 -2
  29. package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +1 -1
  30. package/dist/cjs/justifi-table_2.cjs.entry.js +2 -2
  31. package/dist/cjs/loader.cjs.js +1 -1
  32. package/dist/cjs/payment-details-core.cjs.entry.js +52 -0
  33. package/dist/cjs/payment.service-605896dc.js +20 -0
  34. package/dist/cjs/payments-list-core.cjs.entry.js +98 -0
  35. package/dist/cjs/payout-details-core.cjs.entry.js +52 -0
  36. package/dist/cjs/payout.service-b39f2739.js +21 -0
  37. package/dist/cjs/payouts-list-core.cjs.entry.js +121 -0
  38. package/dist/cjs/subaccount-account-details_4.cjs.entry.js +1 -1
  39. package/dist/cjs/subaccount-bank-details.cjs.entry.js +1 -1
  40. package/dist/cjs/subaccount-terms-details.cjs.entry.js +1 -1
  41. package/dist/cjs/{utils-99c086ee.js → utils-d126d17c.js} +4 -4
  42. package/dist/cjs/utils-f5d82f21.js +10 -0
  43. package/dist/cjs/webcomponents.cjs.js +1 -1
  44. package/dist/collection/api/Business.js +32 -3
  45. package/dist/collection/api/Payment.js +2 -1
  46. package/dist/collection/api/mockData/MockPayments.js +25 -0
  47. package/dist/collection/api/services/payment.service.js +13 -0
  48. package/dist/collection/api/services/payout.service.js +14 -0
  49. package/dist/collection/api/services/utils.js +6 -0
  50. package/dist/collection/collection-manifest.json +4 -0
  51. package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +8 -8
  52. package/dist/collection/components/business-details/business-details.js +3 -3
  53. package/dist/collection/components/business-details/legal-address-details/legal-address-details.js +4 -4
  54. package/dist/collection/components/business-form/BusinessFormEventTypes.js +6 -0
  55. package/dist/collection/components/business-form/business-address/business-address-form-schema.js +1 -1
  56. package/dist/collection/components/business-form/business-form-schema.js +16 -16
  57. package/dist/collection/components/business-form/business-form-stepped.js +77 -50
  58. package/dist/collection/components/business-form/business-form.js +62 -33
  59. package/dist/collection/components/business-form/business-generic-info/business-generic-info.js +7 -3
  60. package/dist/collection/components/business-form/business-owners/business-owners.js +6 -21
  61. package/dist/collection/components/business-form/business-representative/business-representative.js +1 -1
  62. package/dist/collection/components/business-form/helpers.js +21 -20
  63. package/dist/collection/components/business-form/legal-address-form/legal-address-form-schema.js +1 -1
  64. package/dist/collection/components/business-form/legal-address-form/legal-address-form.js +3 -3
  65. package/dist/collection/components/business-form/test/business-form.spec.js +5 -14
  66. package/dist/collection/components/details/utils.js +2 -2
  67. package/dist/collection/components/pagination-menu/test/pagination-menu.spec.js +87 -0
  68. package/dist/collection/components/payment-details/get-payment-details.js +17 -0
  69. package/dist/collection/components/payment-details/payment-details-core.js +86 -0
  70. package/dist/collection/components/payment-details/payment-details.js +27 -52
  71. package/dist/collection/components/payment-details/test/get-payment-details.spec.js +64 -0
  72. package/dist/collection/components/payment-details/test/payment-details-core.spec.js +47 -0
  73. package/dist/collection/components/payment-details/test/payment-details.spec.js +31 -0
  74. package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js +1 -1
  75. package/dist/collection/components/payments-list/get-payments.js +20 -0
  76. package/dist/collection/components/payments-list/payments-list-core.js +158 -0
  77. package/dist/collection/components/payments-list/payments-list.js +27 -127
  78. package/dist/collection/components/payments-list/test/get-payments.spec.js +70 -0
  79. package/dist/collection/components/payments-list/test/payments-list-core.spec.js +100 -0
  80. package/dist/collection/components/payments-list/test/payments-list.spec.js +17 -21
  81. package/dist/collection/components/payout-details/get-payout-details.js +20 -0
  82. package/dist/collection/components/payout-details/payout-details-core.js +86 -0
  83. package/dist/collection/components/payout-details/payout-details.js +27 -78
  84. package/dist/collection/components/payout-details/test/get-payout-details.spec.js +55 -0
  85. package/dist/collection/components/payout-details/test/payout-details-core.spec.js +72 -0
  86. package/dist/collection/components/payout-details/test/payout-details.spec.js +13 -0
  87. package/dist/collection/components/payouts-list/get-payouts.js +20 -0
  88. package/dist/collection/components/payouts-list/payouts-list-core.js +181 -0
  89. package/dist/collection/components/payouts-list/payouts-list.js +26 -148
  90. package/dist/collection/components/payouts-list/test/get-payouts.spec.js +64 -0
  91. package/dist/collection/components/payouts-list/test/payouts-list-core.spec.js +105 -0
  92. package/dist/collection/components/payouts-list/test/payouts-list.spec.js +29 -0
  93. package/dist/collection/components/table/table.js +1 -1
  94. package/dist/collection/components/table/test/table.spec.js +18 -0
  95. package/dist/collection/components/table/utils.js +1 -1
  96. package/dist/collection/utils/{phone-masks.js → form-input-masks.js} +1 -0
  97. package/dist/docs.json +397 -233
  98. package/dist/esm/Business-954e1c1b.js +78 -0
  99. package/dist/esm/BusinessFormEventTypes-989960ba.js +39 -0
  100. package/dist/esm/{Payout-c42e3877.js → Payout-dc5f009c.js} +2 -1
  101. package/dist/esm/{SubAccount-b3ce8720.js → SubAccount-bd59f646.js} +1 -1
  102. package/dist/esm/additional-questions-details_5.entry.js +5 -5
  103. package/dist/esm/{business-form-schema-997c585c.js → business-form-schema-f8f554d1.js} +17 -17
  104. package/dist/esm/{form-control-datepart_2.entry.js → form-control-datepart_3.entry.js} +46 -4
  105. package/dist/esm/{form-control-number_3.entry.js → form-control-select_2.entry.js} +1 -43
  106. package/dist/esm/form-input-masks-a8187c77.js +6 -0
  107. package/dist/esm/{index.esm-8ae36d07.js → index.esm-22b47398.js} +1 -258
  108. package/dist/esm/{justifi-additional-questions_6.entry.js → justifi-additional-questions_5.entry.js} +10 -279
  109. package/dist/esm/justifi-billing-form_2.entry.js +1 -1
  110. package/dist/esm/justifi-business-details.entry.js +5 -5
  111. package/dist/esm/justifi-business-form-stepped.entry.js +47 -53
  112. package/dist/esm/justifi-business-form.entry.js +32 -36
  113. package/dist/esm/justifi-business-list.entry.js +3 -50
  114. package/dist/{module/business-owners.js → esm/justifi-business-owners.entry.js} +13 -55
  115. package/dist/esm/justifi-details.entry.js +1 -1
  116. package/dist/esm/justifi-gross-payment-chart.entry.js +3 -3
  117. package/dist/esm/justifi-payment-balance-transactions.entry.js +2 -2
  118. package/dist/esm/justifi-payment-details.entry.js +44 -43
  119. package/dist/esm/justifi-payment-form.entry.js +2 -2
  120. package/dist/esm/justifi-payment-method-form.entry.js +6 -4
  121. package/dist/esm/justifi-payments-list.entry.js +47 -91
  122. package/dist/esm/justifi-payout-details.entry.js +48 -46
  123. package/dist/esm/justifi-payouts-list.entry.js +47 -113
  124. package/dist/esm/justifi-proceeds-list.entry.js +2 -2
  125. package/dist/esm/justifi-refund-form.entry.js +2 -2
  126. package/dist/esm/justifi-subaccount-details.entry.js +4 -4
  127. package/dist/esm/justifi-subaccounts-list.entry.js +3 -3
  128. package/dist/esm/justifi-table_2.entry.js +2 -2
  129. package/dist/esm/loader.js +1 -1
  130. package/dist/esm/payment-details-core.entry.js +48 -0
  131. package/dist/esm/payment.service-bea02ccf.js +18 -0
  132. package/dist/esm/payments-list-core.entry.js +94 -0
  133. package/dist/{webcomponents/p-34c30022.entry.js → esm/payout-details-core.entry.js} +48 -1
  134. package/dist/esm/payout.service-92e56814.js +19 -0
  135. package/dist/esm/payouts-list-core.entry.js +117 -0
  136. package/dist/esm/subaccount-account-details_4.entry.js +2 -2
  137. package/dist/esm/subaccount-bank-details.entry.js +1 -1
  138. package/dist/esm/subaccount-terms-details.entry.js +1 -1
  139. package/dist/esm/utils-546ca6aa.js +8 -0
  140. package/dist/esm/{utils-f33f7e3c.js → utils-576874df.js} +4 -4
  141. package/dist/esm/{utils-26c7dd12.js → utils-dd428dba.js} +1 -1
  142. package/dist/esm/webcomponents.js +1 -1
  143. package/dist/module/Business.js +78 -0
  144. package/dist/module/BusinessFormEventTypes.js +39 -0
  145. package/dist/module/Payout.js +2 -1
  146. package/dist/module/additional-questions-details2.js +4 -4
  147. package/dist/module/business-generic-info.js +25 -27
  148. package/dist/module/business-representative.js +1 -1
  149. package/dist/module/form-input-masks.js +6 -0
  150. package/dist/module/index.esm.js +1 -258
  151. package/dist/module/justifi-business-details.js +3 -3
  152. package/dist/module/justifi-business-form-stepped.js +62 -74
  153. package/dist/module/justifi-business-form.js +47 -57
  154. package/dist/module/justifi-business-list.js +1 -48
  155. package/dist/module/justifi-business-owners.js +115 -1
  156. package/dist/module/justifi-payment-details.js +52 -48
  157. package/dist/module/justifi-payments-list.js +58 -102
  158. package/dist/module/justifi-payout-details.js +57 -52
  159. package/dist/module/justifi-payouts-list.js +59 -125
  160. package/dist/module/justifi-refund-form.js +1 -1
  161. package/dist/module/legal-address-form.js +3 -203
  162. package/dist/module/payment-details-core.d.ts +11 -0
  163. package/dist/module/payment-details-core.js +6 -0
  164. package/dist/module/payment-details-core2.js +76 -0
  165. package/dist/module/payment-method-form.js +6 -4
  166. package/dist/module/payment.service.js +18 -0
  167. package/dist/module/payments-list-core.d.ts +11 -0
  168. package/dist/module/payments-list-core.js +6 -0
  169. package/dist/module/payments-list-core2.js +131 -0
  170. package/dist/module/payout-details-core.d.ts +11 -0
  171. package/dist/module/payout-details-core.js +6 -0
  172. package/dist/module/payout-details-core2.js +76 -0
  173. package/dist/module/payout.service.js +19 -0
  174. package/dist/module/payouts-list-core.d.ts +11 -0
  175. package/dist/module/payouts-list-core.js +6 -0
  176. package/dist/module/payouts-list-core2.js +153 -0
  177. package/dist/module/table.js +2 -2
  178. package/dist/module/utils.js +4 -4
  179. package/dist/module/utils3.js +6 -29
  180. package/dist/types/api/Business.d.ts +64 -28
  181. package/dist/types/api/Payment.d.ts +33 -1
  182. package/dist/types/api/services/payment.service.d.ts +9 -0
  183. package/dist/types/api/services/payout.service.d.ts +9 -0
  184. package/dist/types/api/services/utils.d.ts +1 -0
  185. package/dist/types/components/business-details/additional-questions-details/additional-questions-details.d.ts +2 -2
  186. package/dist/types/components/business-details/business-details.d.ts +2 -2
  187. package/dist/types/components/business-details/legal-address-details/legal-address-details.d.ts +2 -2
  188. package/dist/types/components/business-form/BusinessFormEventTypes.d.ts +5 -0
  189. package/dist/types/components/business-form/business-form-schema.d.ts +1 -19
  190. package/dist/types/components/business-form/business-form-stepped.d.ts +19 -5
  191. package/dist/types/components/business-form/business-form.d.ts +11 -2
  192. package/dist/types/components/business-form/business-generic-info/business-generic-info.d.ts +2 -0
  193. package/dist/types/components/business-form/business-owners/business-owners.d.ts +1 -1
  194. package/dist/types/components/business-form/helpers.d.ts +1 -1
  195. package/dist/types/components/details/utils.d.ts +4 -3
  196. package/dist/types/components/payment-details/get-payment-details.d.ts +8 -0
  197. package/dist/types/components/payment-details/payment-details-core.d.ts +11 -0
  198. package/dist/types/components/payment-details/payment-details.d.ts +6 -6
  199. package/dist/types/components/payment-method-form/payment-method-responses.d.ts +10 -2
  200. package/dist/types/components/payments-list/get-payments.d.ts +9 -0
  201. package/dist/types/components/payments-list/payments-list-core.d.ts +17 -0
  202. package/dist/types/components/payments-list/payments-list.d.ts +4 -12
  203. package/dist/types/components/payout-details/get-payout-details.d.ts +8 -0
  204. package/dist/types/components/payout-details/payout-details-core.d.ts +11 -0
  205. package/dist/types/components/payout-details/payout-details.d.ts +5 -31
  206. package/dist/types/components/payouts-list/get-payouts.d.ts +9 -0
  207. package/dist/types/components/payouts-list/payouts-list-core.d.ts +18 -0
  208. package/dist/types/components/payouts-list/payouts-list.d.ts +4 -13
  209. package/dist/types/components.d.ts +136 -138
  210. package/dist/types/utils/form-input-masks.d.ts +6 -0
  211. package/dist/webcomponents/p-081cf5f6.entry.js +1 -0
  212. package/dist/webcomponents/p-0b9146cd.entry.js +1 -0
  213. package/dist/webcomponents/p-0e53f470.entry.js +1 -0
  214. package/dist/webcomponents/p-112acd3c.entry.js +1 -0
  215. package/dist/webcomponents/p-1555e6b1.js +1 -0
  216. package/dist/webcomponents/{p-ac8be2a8.entry.js → p-16f41fd0.entry.js} +1 -1
  217. package/dist/webcomponents/p-17715325.js +1 -0
  218. package/dist/webcomponents/p-19c5ddf1.entry.js +1 -0
  219. package/dist/webcomponents/{p-2b2f8162.entry.js → p-2e318b6a.entry.js} +1 -1
  220. package/dist/webcomponents/p-34de1c5d.entry.js +1 -0
  221. package/dist/webcomponents/p-3a4d4869.entry.js +1 -0
  222. package/dist/webcomponents/p-3cb0b96d.js +1 -0
  223. package/dist/webcomponents/p-4ba2c711.entry.js +1 -0
  224. package/dist/webcomponents/p-4c01df65.entry.js +1 -0
  225. package/dist/webcomponents/p-4fa27a28.entry.js +1 -0
  226. package/dist/webcomponents/{p-3bef762a.js → p-50730e69.js} +1 -1
  227. package/dist/webcomponents/p-5e142186.entry.js +1 -0
  228. package/dist/webcomponents/{p-85ddbe82.entry.js → p-5f8b9f64.entry.js} +1 -1
  229. package/dist/webcomponents/p-663bfe87.js +1 -0
  230. package/dist/webcomponents/p-6ab67031.entry.js +1 -0
  231. package/dist/webcomponents/p-6ed680e9.js +1 -0
  232. package/dist/webcomponents/{p-d8835e7a.entry.js → p-731cb109.entry.js} +1 -1
  233. package/dist/webcomponents/{p-525adabf.entry.js → p-7c0f91fa.entry.js} +1 -1
  234. package/dist/webcomponents/p-80140d5b.js +1 -0
  235. package/dist/webcomponents/p-810b72b5.js +1 -0
  236. package/dist/webcomponents/p-870c2e4d.entry.js +1 -0
  237. package/dist/webcomponents/{p-64a5126c.entry.js → p-896a9ddb.entry.js} +1 -1
  238. package/dist/webcomponents/{p-9ba0be02.entry.js → p-8a90b976.entry.js} +1 -1
  239. package/dist/webcomponents/p-9b99370e.js +1 -0
  240. package/dist/webcomponents/p-9cb3ff78.entry.js +1 -0
  241. package/dist/webcomponents/p-a5d662ac.entry.js +1 -0
  242. package/dist/webcomponents/p-ad9a6c20.entry.js +1 -0
  243. package/dist/webcomponents/p-ade12f56.js +1 -0
  244. package/dist/webcomponents/{p-45d2761d.entry.js → p-b5aba473.entry.js} +1 -1
  245. package/dist/webcomponents/p-b8a8b551.js +1 -0
  246. package/dist/webcomponents/{p-c950901c.entry.js → p-c0f882ce.entry.js} +1 -1
  247. package/dist/webcomponents/p-d66a6057.entry.js +1 -0
  248. package/dist/webcomponents/{p-9cec4a27.entry.js → p-d71ce1cd.entry.js} +1 -1
  249. package/dist/webcomponents/p-ea05d7c2.entry.js +1 -0
  250. package/dist/webcomponents/{p-c43e29ac.entry.js → p-ec4f27e7.entry.js} +1 -1
  251. package/dist/webcomponents/{p-40fb25c6.entry.js → p-eef5b15b.entry.js} +1 -1
  252. package/dist/webcomponents/{p-9a6e4749.js → p-f0c535ed.js} +1 -1
  253. package/dist/webcomponents/{p-c63a98f6.entry.js → p-f7a3fd12.entry.js} +1 -1
  254. package/dist/webcomponents/webcomponents.esm.js +1 -1
  255. package/package.json +6 -4
  256. package/dist/cjs/utils-931f4879.js +0 -34
  257. package/dist/esm/utils-8cc130a9.js +0 -31
  258. package/dist/module/phone-masks.js +0 -5
  259. package/dist/types/utils/phone-masks.d.ts +0 -3
  260. package/dist/webcomponents/p-0a1347cf.entry.js +0 -1
  261. package/dist/webcomponents/p-0f3e9483.js +0 -1
  262. package/dist/webcomponents/p-0fa49c38.entry.js +0 -1
  263. package/dist/webcomponents/p-1e2a98bf.js +0 -1
  264. package/dist/webcomponents/p-5a502ceb.entry.js +0 -1
  265. package/dist/webcomponents/p-5bf0ac1a.entry.js +0 -1
  266. package/dist/webcomponents/p-6e80f063.entry.js +0 -1
  267. package/dist/webcomponents/p-71679a41.js +0 -1
  268. package/dist/webcomponents/p-78baff54.js +0 -1
  269. package/dist/webcomponents/p-8bbb1b10.entry.js +0 -1
  270. package/dist/webcomponents/p-90926321.js +0 -1
  271. package/dist/webcomponents/p-9e0d2179.entry.js +0 -1
  272. package/dist/webcomponents/p-c4826a33.entry.js +0 -1
  273. package/dist/webcomponents/p-d4755024.entry.js +0 -1
  274. package/dist/webcomponents/p-e8e109bd.entry.js +0 -1
  275. package/dist/webcomponents/p-ead8cfc2.entry.js +0 -1
  276. package/dist/webcomponents/p-f74899b9.entry.js +0 -1
@@ -1,8 +1,8 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { Api, Payout, PayoutStatuses, PayoutStatusesSafeNames, pagingDefaults } from "../../api";
3
- import { formatCurrency, formatDate, formatTime } from "../../utils/utils";
4
- import { config } from "../../../config";
5
2
  import { tableExportedParts } from "../table/exported-parts";
3
+ import { PayoutService } from "../../api/services/payout.service";
4
+ import { makeGetPayouts } from "./get-payouts";
5
+ import { ErrorState } from "../details/utils";
6
6
  /**
7
7
  * @exportedPart table-head: Table head
8
8
  * @exportedPart table-head-row: Head row
@@ -24,129 +24,37 @@ import { tableExportedParts } from "../table/exported-parts";
24
24
  */
25
25
  export class PayoutsList {
26
26
  constructor() {
27
- this.mapStatusToBadge = (status) => {
28
- switch (status) {
29
- case PayoutStatuses.scheduled:
30
- return `<span class="badge bg-primary" title='Batched and scheduled to be transferred'>${PayoutStatusesSafeNames[status]}</span>`;
31
- case PayoutStatuses.in_transit:
32
- return `<span class="badge bg-primary" title='Transfer to your bank account has been initiated'>${PayoutStatusesSafeNames[status]}</span>`;
33
- case PayoutStatuses.failed:
34
- return `<span class="badge bg-danger" title='Transfer to your bank account failed'>${PayoutStatusesSafeNames[status]}</span>`;
35
- case PayoutStatuses.canceled:
36
- return `<span class="badge bg-danger" title='Transfer to your bank account failed'>${PayoutStatusesSafeNames[status]}</span>`;
37
- case PayoutStatuses.forwarded:
38
- return `<span class="badge bg-secondary" title='This payout initially failed; the funds have been forwarded to your next successful payout'>${PayoutStatusesSafeNames[status]}</span>`;
39
- case PayoutStatuses.paid:
40
- return `<span class="badge bg-success" title='Successfully deposited into your bank account'>${PayoutStatusesSafeNames[status]}</span>`;
41
- }
42
- };
43
- this.handleClickPrevious = (beforeCursor) => {
44
- const newParams = Object.assign({}, this.params);
45
- delete newParams.after_cursor;
46
- this.params = (Object.assign(Object.assign({}, newParams), { before_cursor: beforeCursor }));
47
- };
48
- this.handleClickNext = (afterCursor) => {
49
- const newParams = Object.assign({}, this.params);
50
- delete newParams.before_cursor;
51
- this.params = (Object.assign(Object.assign({}, newParams), { after_cursor: afterCursor }));
52
- };
53
27
  this.accountId = undefined;
54
28
  this.authToken = undefined;
55
- this.payouts = [];
56
- this.loading = true;
57
- this.errorMessage = undefined;
58
- this.paging = pagingDefaults;
59
- this.params = undefined;
29
+ this.getPayouts = undefined;
30
+ this.errorMessage = null;
60
31
  }
61
- updateOnPropChange() {
62
- this.fetchData();
32
+ componentWillLoad() {
33
+ this.initializeGetPayouts();
63
34
  }
64
- connectedCallback() {
65
- this.fetchData();
35
+ propChanged() {
36
+ this.initializeGetPayouts();
66
37
  }
67
- async fetchData() {
68
- var _a;
69
- if (!this.accountId || !this.authToken) {
70
- this.errorMessage = "Can not fetch any data without an AccountID and an AuthToken";
71
- this.loading = false;
72
- return;
73
- }
74
- this.loading = true;
75
- try {
76
- const api = Api(this.authToken, config.proxyApiOrigin);
77
- const endpoint = `account/${this.accountId}/payouts`;
78
- const response = await api.get(endpoint, this.params);
79
- if (!response.error) {
80
- this.paging = Object.assign(Object.assign({}, this.paging), response.page_info);
81
- const data = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.map(dataItem => new Payout(dataItem));
82
- this.payouts = data;
83
- }
84
- else {
85
- const responseError = typeof response.error === 'string' ? response.error : response.error.message;
86
- console.error(`Error fetching payouts: ${responseError}`);
87
- this.errorMessage = 'No results';
88
- }
38
+ initializeGetPayouts() {
39
+ if (this.accountId && this.authToken) {
40
+ this.getPayouts = makeGetPayouts({
41
+ id: this.accountId,
42
+ authToken: this.authToken,
43
+ service: new PayoutService(),
44
+ });
89
45
  }
90
- catch (error) {
91
- console.error(`Error fetching payouts: ${error}`);
92
- this.errorMessage = 'No results';
93
- }
94
- finally {
95
- this.loading = false;
46
+ else {
47
+ this.errorMessage = 'Account ID and Auth Token are required';
96
48
  }
97
49
  }
98
50
  render() {
99
- return (h(Host, { exportedparts: tableExportedParts }, h("justifi-table", { rowClickHandler: (e) => {
100
- const clickedPayoutID = e.target.closest('tr').dataset.rowEntityId;
101
- if (!clickedPayoutID) {
102
- return;
103
- }
104
- this.rowClicked.emit(this.payouts.find((payout) => payout.id === clickedPayoutID));
105
- }, columnData: [
106
- ['Paid Out On', 'The date each transaction occurred'],
107
- ['Type', 'The type of each transaction'],
108
- ['Account', 'The ID of the account associated with each payout'],
109
- ['Paid Out To', 'The bank account to which each payout was transferred'],
110
- ['Payments', 'Sum of payments in each payout'],
111
- ['Refunds', 'Sum of refunds in each payout'],
112
- ['Fees', 'Sum of fees in each payout'],
113
- ['Other', 'Sum of less common transactions in each payout (disputes, ACH returns, fee refunds, and forwarded balances due to failed payouts)'],
114
- ['Payout Amount', 'The net sum of all transactions in each payout. This is the amount you\'ll see reflected on your bank statement'],
115
- ['Status', 'The real-time status of each payout']
116
- ], entityId: this.payouts.map((payout) => payout.id), rowData: this.payouts.map((payout) => ([
117
- {
118
- type: 'head',
119
- value: `
120
- <div class='fw-bold'>${formatDate(payout.created_at)}</div>
121
- <div class='fw-bold'>${formatTime(payout.created_at)}</div>
122
- `,
123
- },
124
- payout.payout_type,
125
- payout.account_id,
126
- `${payout.bank_account.full_name} ${payout.bank_account.account_number_last4}`,
127
- formatCurrency(payout.payments_total),
128
- formatCurrency(payout.refunds_total),
129
- formatCurrency(payout.fees_total),
130
- formatCurrency(payout.other_total),
131
- formatCurrency(payout.amount),
132
- {
133
- type: 'inner',
134
- value: this.mapStatusToBadge(payout.status)
135
- }
136
- ])), loading: this.loading, "error-message": this.errorMessage, params: this.params, paging: Object.assign(Object.assign({}, this.paging), { handleClickNext: this.handleClickNext, handleClickPrevious: this.handleClickPrevious }) })));
51
+ if (this.errorMessage) {
52
+ return ErrorState(this.errorMessage);
53
+ }
54
+ return (h(Host, { exportedparts: tableExportedParts }, h("payouts-list-core", { getPayouts: this.getPayouts })));
137
55
  }
138
56
  static get is() { return "justifi-payouts-list"; }
139
57
  static get encapsulation() { return "shadow"; }
140
- static get originalStyleUrls() {
141
- return {
142
- "$": ["payouts-list.scss"]
143
- };
144
- }
145
- static get styleUrls() {
146
- return {
147
- "$": ["payouts-list.css"]
148
- };
149
- }
150
58
  static get properties() {
151
59
  return {
152
60
  "accountId": {
@@ -187,47 +95,17 @@ export class PayoutsList {
187
95
  }
188
96
  static get states() {
189
97
  return {
190
- "payouts": {},
191
- "loading": {},
192
- "errorMessage": {},
193
- "paging": {},
194
- "params": {}
98
+ "getPayouts": {},
99
+ "errorMessage": {}
195
100
  };
196
101
  }
197
- static get events() {
198
- return [{
199
- "method": "rowClicked",
200
- "name": "payout-row-clicked",
201
- "bubbles": true,
202
- "cancelable": true,
203
- "composed": true,
204
- "docs": {
205
- "tags": [],
206
- "text": ""
207
- },
208
- "complexType": {
209
- "original": "Payout",
210
- "resolved": "Payout",
211
- "references": {
212
- "Payout": {
213
- "location": "import",
214
- "path": "../../api",
215
- "id": "src/api/index.ts::Payout"
216
- }
217
- }
218
- }
219
- }];
220
- }
221
102
  static get watchers() {
222
103
  return [{
223
104
  "propName": "accountId",
224
- "methodName": "updateOnPropChange"
105
+ "methodName": "propChanged"
225
106
  }, {
226
107
  "propName": "authToken",
227
- "methodName": "updateOnPropChange"
228
- }, {
229
- "propName": "params",
230
- "methodName": "updateOnPropChange"
108
+ "methodName": "propChanged"
231
109
  }];
232
110
  }
233
111
  }
@@ -0,0 +1,64 @@
1
+ import { Payout } from "../../../api";
2
+ import { PayoutService } from "../../../api/services/payout.service";
3
+ import { makeGetPayouts } from "../get-payouts";
4
+ import mockResponse from "../../../api/mockData/mockPayoutsSuccess.json";
5
+ describe('makeGetPayouts', () => {
6
+ const mockId = '123';
7
+ const mockAuthToken = 'token';
8
+ const mockParams = { limit: 10, page: 1 };
9
+ let mockServiceInstance;
10
+ beforeEach(() => {
11
+ jest.clearAllMocks();
12
+ // Create a new instance of the mocked PayoutService
13
+ mockServiceInstance = new PayoutService();
14
+ // Explicitly mock fetchPayouts as a jest mock function
15
+ mockServiceInstance.fetchPayouts = jest.fn();
16
+ });
17
+ it('should call onSuccess with payouts and pagingInfo on successful fetch', async () => {
18
+ const onSuccess = jest.fn();
19
+ const onError = jest.fn();
20
+ // Mock fetchPayouts to resolve with mockResponse
21
+ mockServiceInstance.fetchPayouts.mockResolvedValue(mockResponse);
22
+ const getPayouts = makeGetPayouts({
23
+ id: mockId,
24
+ authToken: mockAuthToken,
25
+ service: mockServiceInstance,
26
+ });
27
+ await getPayouts({ params: mockParams, onSuccess, onError });
28
+ expect(onSuccess).toHaveBeenCalledWith({
29
+ payouts: expect.arrayContaining([expect.any(Payout), expect.any(Payout)]),
30
+ pagingInfo: mockResponse.page_info,
31
+ });
32
+ expect(onError).not.toHaveBeenCalled();
33
+ });
34
+ it('should call onError with an error message on API failure', async () => {
35
+ const mockError = new Error('Error fetching payouts');
36
+ const onSuccess = jest.fn();
37
+ const onError = jest.fn();
38
+ // Mock fetchPayouts to reject with mockError
39
+ mockServiceInstance.fetchPayouts.mockRejectedValue(mockError);
40
+ const getPayouts = makeGetPayouts({
41
+ id: mockId,
42
+ authToken: mockAuthToken,
43
+ service: mockServiceInstance,
44
+ });
45
+ await getPayouts({ params: mockParams, onSuccess, onError });
46
+ expect(onError).toHaveBeenCalledWith('Error fetching payouts');
47
+ expect(onSuccess).not.toHaveBeenCalled();
48
+ });
49
+ it('should call onError with an error message on API failure', async () => {
50
+ const mockError = new Error('Error fetching payouts');
51
+ const onSuccess = jest.fn();
52
+ const onError = jest.fn();
53
+ // Mock fetchPayouts to reject with mockError
54
+ mockServiceInstance.fetchPayouts.mockRejectedValue(mockError);
55
+ const getPayouts = makeGetPayouts({
56
+ id: mockId,
57
+ authToken: mockAuthToken,
58
+ service: mockServiceInstance,
59
+ });
60
+ await getPayouts({ params: mockParams, onSuccess, onError });
61
+ expect(onError).toHaveBeenCalledWith('Error fetching payouts');
62
+ expect(onSuccess).not.toHaveBeenCalled();
63
+ });
64
+ });
@@ -0,0 +1,105 @@
1
+ import { newSpecPage } from "@stencil/core/testing";
2
+ import { Table } from "../../table/table";
3
+ import { PaginationMenu } from "../../pagination-menu/pagination-menu";
4
+ import { PayoutsListCore } from "../payouts-list-core";
5
+ import mockSuccessResponse from "../../../api/mockData/mockPayoutsSuccess.json";
6
+ import { makeGetPayouts } from "../get-payouts";
7
+ const mockPayoutsResponse = mockSuccessResponse;
8
+ describe('payouts-list-core', () => {
9
+ it('renders properly', async () => {
10
+ const mockPayoutService = {
11
+ fetchPayouts: jest.fn().mockResolvedValue(mockPayoutsResponse),
12
+ };
13
+ const page = await newSpecPage({
14
+ components: [PayoutsListCore, Table, PaginationMenu],
15
+ html: `
16
+ <payouts-list-core></payouts-list-core>
17
+ `,
18
+ });
19
+ page.rootInstance.componentWillLoad = () => { };
20
+ page.rootInstance.getPayouts = makeGetPayouts({
21
+ id: '123',
22
+ authToken: '123',
23
+ service: mockPayoutService
24
+ });
25
+ page.rootInstance.fetchData();
26
+ await page.waitForChanges();
27
+ const justifiTable = page.root.querySelector('justifi-table');
28
+ const shadowRoot = justifiTable.shadowRoot;
29
+ const rows = shadowRoot.querySelectorAll('[data-test-id="table-row"]');
30
+ expect(rows.length).toBe(4);
31
+ // expect(page.root).toMatchSnapshot();
32
+ });
33
+ it('displays an error state on failed data fetch', async () => {
34
+ const mockPayoutService = {
35
+ fetchPayouts: jest.fn().mockRejectedValue(new Error('Fetch error'))
36
+ };
37
+ const getPayouts = makeGetPayouts({
38
+ id: 'some-id',
39
+ authToken: 'some-auth-token',
40
+ service: mockPayoutService
41
+ });
42
+ const page = await newSpecPage({
43
+ components: [PayoutsListCore, Table, PaginationMenu],
44
+ html: '<payouts-list-core></payouts-list-core>',
45
+ });
46
+ page.rootInstance.componentWillLoad = () => { };
47
+ page.rootInstance.getPayouts = getPayouts;
48
+ page.rootInstance.fetchData();
49
+ await page.waitForChanges();
50
+ const justifiTable = page.root.querySelector('justifi-table');
51
+ const shadowRoot = justifiTable.shadowRoot;
52
+ const error = shadowRoot.querySelector('[data-test-id="table-error-state"]');
53
+ expect(error).toBeTruthy();
54
+ // expect(page.root).toMatchSnapshot();
55
+ });
56
+ it('emits payout-row-clicked event on row click', async () => {
57
+ const mockPayoutService = {
58
+ fetchPayouts: jest.fn().mockResolvedValue(mockPayoutsResponse),
59
+ };
60
+ const page = await newSpecPage({
61
+ components: [PayoutsListCore, Table, PaginationMenu],
62
+ html: '<payouts-list-core></payouts-list-core>',
63
+ });
64
+ page.rootInstance.componentWillLoad = () => { };
65
+ page.rootInstance.getPayouts = makeGetPayouts({
66
+ id: '123',
67
+ authToken: '123',
68
+ service: mockPayoutService
69
+ });
70
+ page.rootInstance.fetchData();
71
+ await page.waitForChanges();
72
+ const rowClickedHandler = jest.fn();
73
+ page.win.addEventListener('payout-row-clicked', rowClickedHandler);
74
+ const justifiTable = page.root.querySelector('justifi-table');
75
+ const shadowRoot = justifiTable.shadowRoot;
76
+ const rows = shadowRoot.querySelectorAll('[data-test-id="table-row"]');
77
+ if (rows.length > 0) {
78
+ rows[0].click();
79
+ await page.waitForChanges();
80
+ }
81
+ });
82
+ it('updates params and refetches data on pagination interaction', async () => {
83
+ const mockPayoutService = {
84
+ fetchPayouts: jest.fn().mockResolvedValue(mockPayoutsResponse),
85
+ };
86
+ const page = await newSpecPage({
87
+ components: [PayoutsListCore, Table, PaginationMenu],
88
+ html: `<payouts-list-core></payouts-list-core>`,
89
+ });
90
+ page.rootInstance.componentWillLoad = () => { };
91
+ page.rootInstance.getPayouts = makeGetPayouts({
92
+ id: '123',
93
+ authToken: '123',
94
+ service: mockPayoutService
95
+ });
96
+ page.rootInstance.fetchData();
97
+ await page.waitForChanges();
98
+ page.rootInstance.handleClickNext('nextCursor');
99
+ await page.waitForChanges();
100
+ // The mock function should be called 3 times: once for the initial load, twice for when mockGetPayouts is set and later after the pagination interaction
101
+ expect(mockPayoutService.fetchPayouts).toHaveBeenCalledTimes(3);
102
+ const updatedParams = page.rootInstance.params;
103
+ expect(updatedParams.after_cursor).toBe('nextCursor');
104
+ });
105
+ });
@@ -0,0 +1,29 @@
1
+ import { newSpecPage } from "@stencil/core/testing";
2
+ import { PayoutsList } from "../payouts-list";
3
+ import { PayoutsListCore } from "../payouts-list-core";
4
+ describe('payouts-list', () => {
5
+ it('renders an error message when accountId and authToken are not provided', async () => {
6
+ const page = await newSpecPage({
7
+ components: [PayoutsList, PayoutsListCore],
8
+ html: '<justifi-payouts-list></justifi-payouts-list>',
9
+ });
10
+ await page.waitForChanges();
11
+ // expect(page.root).toMatchSnapshot();
12
+ });
13
+ it('renders an error message when accountId is not provided', async () => {
14
+ const page = await newSpecPage({
15
+ components: [PayoutsList, PayoutsListCore],
16
+ html: '<justifi-payouts-list auth-token="abc"></justifi-payouts-list>',
17
+ });
18
+ await page.waitForChanges();
19
+ // expect(page.root).toMatchSnapshot();
20
+ });
21
+ it('renders an error message when authToken is not provided', async () => {
22
+ const page = await newSpecPage({
23
+ components: [PayoutsList, PayoutsListCore],
24
+ html: '<justifi-payouts-list account-id="abc"></justifi-payouts-list>',
25
+ });
26
+ await page.waitForChanges();
27
+ // expect(page.root).toMatchSnapshot();
28
+ });
29
+ });
@@ -25,7 +25,7 @@ export class Table {
25
25
  render() {
26
26
  var _a, _b;
27
27
  return (h(Host, { exportparts: tableExportedParts }, h("div", { class: "table-wrapper" }, h("table", { class: "table table-hover" }, h("thead", { class: "table-head sticky-top", part: "table-head" }, h("tr", { class: "table-light text-nowrap", part: 'table-head-row' }, (_a = this.columnData) === null || _a === void 0 ? void 0 : _a.map((column) => h("th", { part: "table-head-cell", scope: "col", title: Array.isArray(column) ? column[1] : '' }, !Array.isArray(column) ? column : column[0])))), h("tbody", { class: "table-body", part: 'table-body' }, this.loading && LoadingState(this.columnData.length), this.showEmptyState && EmptyState(this.columnData.length), this.showErrorState && ErrorState(this.columnData.length, this.errorMessage), this.showRowData && (this.rowData.map((data, index) => {
28
- return (h("tr", { "data-row-entity-id": this.entityId[index], onClick: e => this.rowClickHandler ? this.rowClickHandler(e) : null, part: `table-row ${index % 2 ? 'table-row-even' : 'table-row-odd'}` }, data.map((dataEntry) => {
28
+ return (h("tr", { "data-test-id": "table-row", "data-row-entity-id": this.entityId[index], onClick: e => this.rowClickHandler ? this.rowClickHandler(e) : null, part: `table-row ${index % 2 ? 'table-row-even' : 'table-row-odd'}` }, data.map((dataEntry) => {
29
29
  let nestedHtml = dataEntry === null || dataEntry === void 0 ? void 0 : dataEntry.type;
30
30
  if (nestedHtml) {
31
31
  return (h("td", { part: "table-cell", innerHTML: dataEntry.value }));
@@ -71,4 +71,22 @@ describe('justifi-table', () => {
71
71
  const error = await page.root.shadowRoot.querySelector('.error-state');
72
72
  expect(error).toBeNull();
73
73
  });
74
+ it('renders rows and columns based on columnData and rowData', async () => {
75
+ const columnData = ['Name', 'Age'];
76
+ const rowData = [['John Doe', 30], ['Jane Doe', 25]];
77
+ const entityId = ['id1', 'id2']; // Corresponding entity IDs for each row
78
+ const page = await newSpecPage({
79
+ components: [Table],
80
+ template: () => (h("justifi-table", { columnData: columnData, rowData: rowData, entityId: entityId, loading: false })),
81
+ });
82
+ const rows = page.root.shadowRoot.querySelectorAll('[data-test-id="table-row"]');
83
+ expect(rows.length).toBe(rowData.length);
84
+ rows.forEach((row, index) => {
85
+ const cells = row.querySelectorAll('td');
86
+ expect(cells.length).toBe(columnData.length);
87
+ cells.forEach((cell, cellIndex) => {
88
+ expect(cell.textContent).toBe(String(rowData[index][cellIndex]));
89
+ });
90
+ });
91
+ });
74
92
  });
@@ -1,4 +1,4 @@
1
1
  import { h } from "@stencil/core";
2
2
  export const LoadingState = (columnSpan) => (h("tr", null, h("td", { class: "loading-state", part: "loading-state-cell", colSpan: columnSpan, style: { textAlign: 'center' } }, h("div", { part: "loading-state-spinner", class: "spinner-border", role: "status" }, h("span", { class: "visually-hidden" }, "Loading...")))));
3
3
  export const EmptyState = (columnSpan) => (h("tr", null, h("td", { class: "empty-state", part: "empty-state", colSpan: columnSpan, style: { textAlign: 'center' } }, "No results")));
4
- export const ErrorState = (columnSpan, errorMessage) => (h("tr", null, h("td", { class: "error-state", part: "error-state", colSpan: columnSpan, style: { textAlign: 'center' } }, "An unexpected error occurred: ", errorMessage)));
4
+ export const ErrorState = (columnSpan, errorMessage) => (h("tr", null, h("td", { class: "error-state", part: "error-state", colSpan: columnSpan, "data-test-id": "table-error-state", style: { textAlign: 'center' } }, "An unexpected error occurred: ", errorMessage)));
@@ -1,3 +1,4 @@
1
1
  export const PHONE_MASKS = {
2
2
  US: '(000) 000-0000',
3
3
  };
4
+ export const TAX_ID_MASKS = { US: '00-000000000' };