@justifi/webcomponents 4.7.6 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/dist/cjs/Business-540a6feb.js +67 -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} +9 -279
  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 +18 -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-form/BusinessFormEventTypes.js +6 -0
  54. package/dist/collection/components/business-form/business-address/business-address-form-schema.js +1 -1
  55. package/dist/collection/components/business-form/business-form-schema.js +16 -16
  56. package/dist/collection/components/business-form/business-form-stepped.js +77 -50
  57. package/dist/collection/components/business-form/business-form.js +62 -33
  58. package/dist/collection/components/business-form/business-generic-info/business-generic-info.js +7 -3
  59. package/dist/collection/components/business-form/business-owners/business-owners.js +6 -21
  60. package/dist/collection/components/business-form/business-representative/business-representative.js +1 -1
  61. package/dist/collection/components/business-form/helpers.js +21 -20
  62. package/dist/collection/components/business-form/legal-address-form/legal-address-form-schema.js +1 -1
  63. package/dist/collection/components/business-form/legal-address-form/legal-address-form.js +1 -2
  64. package/dist/collection/components/business-form/test/business-form.spec.js +5 -14
  65. package/dist/collection/components/details/utils.js +2 -2
  66. package/dist/collection/components/pagination-menu/test/pagination-menu.spec.js +87 -0
  67. package/dist/collection/components/payment-details/get-payment-details.js +17 -0
  68. package/dist/collection/components/payment-details/payment-details-core.js +86 -0
  69. package/dist/collection/components/payment-details/payment-details.js +27 -52
  70. package/dist/collection/components/payment-details/test/get-payment-details.spec.js +64 -0
  71. package/dist/collection/components/payment-details/test/payment-details-core.spec.js +47 -0
  72. package/dist/collection/components/payment-details/test/payment-details.spec.js +31 -0
  73. package/dist/collection/components/payments-list/get-payments.js +20 -0
  74. package/dist/collection/components/payments-list/payments-list-core.js +158 -0
  75. package/dist/collection/components/payments-list/payments-list.js +27 -127
  76. package/dist/collection/components/payments-list/test/get-payments.spec.js +70 -0
  77. package/dist/collection/components/payments-list/test/payments-list-core.spec.js +100 -0
  78. package/dist/collection/components/payments-list/test/payments-list.spec.js +17 -21
  79. package/dist/collection/components/payout-details/get-payout-details.js +20 -0
  80. package/dist/collection/components/payout-details/payout-details-core.js +86 -0
  81. package/dist/collection/components/payout-details/payout-details.js +27 -78
  82. package/dist/collection/components/payout-details/test/get-payout-details.spec.js +55 -0
  83. package/dist/collection/components/payout-details/test/payout-details-core.spec.js +72 -0
  84. package/dist/collection/components/payout-details/test/payout-details.spec.js +13 -0
  85. package/dist/collection/components/payouts-list/get-payouts.js +20 -0
  86. package/dist/collection/components/payouts-list/payouts-list-core.js +181 -0
  87. package/dist/collection/components/payouts-list/payouts-list.js +26 -148
  88. package/dist/collection/components/payouts-list/test/get-payouts.spec.js +64 -0
  89. package/dist/collection/components/payouts-list/test/payouts-list-core.spec.js +105 -0
  90. package/dist/collection/components/payouts-list/test/payouts-list.spec.js +29 -0
  91. package/dist/collection/components/table/table.js +1 -1
  92. package/dist/collection/components/table/test/table.spec.js +18 -0
  93. package/dist/collection/components/table/utils.js +1 -1
  94. package/dist/collection/utils/{phone-masks.js → form-input-masks.js} +1 -0
  95. package/dist/docs.json +390 -226
  96. package/dist/esm/Business-1f5e9f6b.js +64 -0
  97. package/dist/esm/BusinessFormEventTypes-989960ba.js +39 -0
  98. package/dist/esm/{Payout-c42e3877.js → Payout-dc5f009c.js} +2 -1
  99. package/dist/esm/{SubAccount-b3ce8720.js → SubAccount-bd59f646.js} +1 -1
  100. package/dist/esm/additional-questions-details_5.entry.js +5 -5
  101. package/dist/esm/{business-form-schema-997c585c.js → business-form-schema-f8f554d1.js} +17 -17
  102. package/dist/esm/{form-control-datepart_2.entry.js → form-control-datepart_3.entry.js} +46 -4
  103. package/dist/esm/{form-control-number_3.entry.js → form-control-select_2.entry.js} +1 -43
  104. package/dist/esm/form-input-masks-a8187c77.js +6 -0
  105. package/dist/esm/{index.esm-8ae36d07.js → index.esm-22b47398.js} +1 -258
  106. package/dist/esm/{justifi-additional-questions_6.entry.js → justifi-additional-questions_5.entry.js} +9 -278
  107. package/dist/esm/justifi-billing-form_2.entry.js +1 -1
  108. package/dist/esm/justifi-business-details.entry.js +5 -5
  109. package/dist/esm/justifi-business-form-stepped.entry.js +47 -53
  110. package/dist/esm/justifi-business-form.entry.js +32 -36
  111. package/dist/esm/justifi-business-list.entry.js +3 -50
  112. package/dist/{module/business-owners.js → esm/justifi-business-owners.entry.js} +13 -55
  113. package/dist/esm/justifi-details.entry.js +1 -1
  114. package/dist/esm/justifi-gross-payment-chart.entry.js +3 -3
  115. package/dist/esm/justifi-payment-balance-transactions.entry.js +2 -2
  116. package/dist/esm/justifi-payment-details.entry.js +44 -43
  117. package/dist/esm/justifi-payment-form.entry.js +2 -2
  118. package/dist/esm/justifi-payment-method-form.entry.js +6 -4
  119. package/dist/esm/justifi-payments-list.entry.js +47 -91
  120. package/dist/esm/justifi-payout-details.entry.js +48 -46
  121. package/dist/esm/justifi-payouts-list.entry.js +47 -113
  122. package/dist/esm/justifi-proceeds-list.entry.js +2 -2
  123. package/dist/esm/justifi-refund-form.entry.js +2 -2
  124. package/dist/esm/justifi-subaccount-details.entry.js +4 -4
  125. package/dist/esm/justifi-subaccounts-list.entry.js +3 -3
  126. package/dist/esm/justifi-table_2.entry.js +2 -2
  127. package/dist/esm/loader.js +1 -1
  128. package/dist/esm/payment-details-core.entry.js +48 -0
  129. package/dist/esm/payment.service-bea02ccf.js +18 -0
  130. package/dist/esm/payments-list-core.entry.js +94 -0
  131. package/dist/{webcomponents/p-34c30022.entry.js → esm/payout-details-core.entry.js} +48 -1
  132. package/dist/esm/payout.service-92e56814.js +19 -0
  133. package/dist/esm/payouts-list-core.entry.js +117 -0
  134. package/dist/esm/subaccount-account-details_4.entry.js +2 -2
  135. package/dist/esm/subaccount-bank-details.entry.js +1 -1
  136. package/dist/esm/subaccount-terms-details.entry.js +1 -1
  137. package/dist/esm/utils-546ca6aa.js +8 -0
  138. package/dist/esm/{utils-f33f7e3c.js → utils-576874df.js} +4 -4
  139. package/dist/esm/{utils-26c7dd12.js → utils-dd428dba.js} +1 -1
  140. package/dist/esm/webcomponents.js +1 -1
  141. package/dist/module/Business.js +64 -0
  142. package/dist/module/BusinessFormEventTypes.js +39 -0
  143. package/dist/module/Payout.js +2 -1
  144. package/dist/module/additional-questions-details2.js +4 -4
  145. package/dist/module/business-generic-info.js +25 -27
  146. package/dist/module/business-representative.js +1 -1
  147. package/dist/module/form-input-masks.js +6 -0
  148. package/dist/module/index.esm.js +1 -258
  149. package/dist/module/justifi-business-details.js +3 -3
  150. package/dist/module/justifi-business-form-stepped.js +62 -74
  151. package/dist/module/justifi-business-form.js +47 -57
  152. package/dist/module/justifi-business-list.js +1 -48
  153. package/dist/module/justifi-business-owners.js +115 -1
  154. package/dist/module/justifi-payment-details.js +52 -48
  155. package/dist/module/justifi-payments-list.js +58 -102
  156. package/dist/module/justifi-payout-details.js +57 -52
  157. package/dist/module/justifi-payouts-list.js +59 -125
  158. package/dist/module/justifi-refund-form.js +1 -1
  159. package/dist/module/legal-address-form.js +1 -202
  160. package/dist/module/payment-details-core.d.ts +11 -0
  161. package/dist/module/payment-details-core.js +6 -0
  162. package/dist/module/payment-details-core2.js +76 -0
  163. package/dist/module/payment-method-form.js +6 -4
  164. package/dist/module/payment.service.js +18 -0
  165. package/dist/module/payments-list-core.d.ts +11 -0
  166. package/dist/module/payments-list-core.js +6 -0
  167. package/dist/module/payments-list-core2.js +131 -0
  168. package/dist/module/payout-details-core.d.ts +11 -0
  169. package/dist/module/payout-details-core.js +6 -0
  170. package/dist/module/payout-details-core2.js +76 -0
  171. package/dist/module/payout.service.js +19 -0
  172. package/dist/module/payouts-list-core.d.ts +11 -0
  173. package/dist/module/payouts-list-core.js +6 -0
  174. package/dist/module/payouts-list-core2.js +153 -0
  175. package/dist/module/table.js +2 -2
  176. package/dist/module/utils.js +4 -4
  177. package/dist/module/utils3.js +6 -29
  178. package/dist/types/api/Business.d.ts +60 -37
  179. package/dist/types/api/Payment.d.ts +33 -1
  180. package/dist/types/api/services/payment.service.d.ts +9 -0
  181. package/dist/types/api/services/payout.service.d.ts +9 -0
  182. package/dist/types/api/services/utils.d.ts +1 -0
  183. package/dist/types/components/business-details/additional-questions-details/additional-questions-details.d.ts +2 -2
  184. package/dist/types/components/business-details/business-details.d.ts +2 -2
  185. package/dist/types/components/business-form/BusinessFormEventTypes.d.ts +5 -0
  186. package/dist/types/components/business-form/business-form-schema.d.ts +1 -19
  187. package/dist/types/components/business-form/business-form-stepped.d.ts +19 -5
  188. package/dist/types/components/business-form/business-form.d.ts +11 -2
  189. package/dist/types/components/business-form/business-generic-info/business-generic-info.d.ts +2 -0
  190. package/dist/types/components/business-form/business-owners/business-owners.d.ts +1 -1
  191. package/dist/types/components/business-form/helpers.d.ts +1 -1
  192. package/dist/types/components/details/utils.d.ts +4 -3
  193. package/dist/types/components/payment-details/get-payment-details.d.ts +8 -0
  194. package/dist/types/components/payment-details/payment-details-core.d.ts +11 -0
  195. package/dist/types/components/payment-details/payment-details.d.ts +6 -6
  196. package/dist/types/components/payment-method-form/payment-method-responses.d.ts +10 -2
  197. package/dist/types/components/payments-list/get-payments.d.ts +9 -0
  198. package/dist/types/components/payments-list/payments-list-core.d.ts +17 -0
  199. package/dist/types/components/payments-list/payments-list.d.ts +4 -12
  200. package/dist/types/components/payout-details/get-payout-details.d.ts +8 -0
  201. package/dist/types/components/payout-details/payout-details-core.d.ts +11 -0
  202. package/dist/types/components/payout-details/payout-details.d.ts +5 -31
  203. package/dist/types/components/payouts-list/get-payouts.d.ts +9 -0
  204. package/dist/types/components/payouts-list/payouts-list-core.d.ts +18 -0
  205. package/dist/types/components/payouts-list/payouts-list.d.ts +4 -13
  206. package/dist/types/components.d.ts +134 -136
  207. package/dist/types/utils/form-input-masks.d.ts +6 -0
  208. package/dist/webcomponents/p-081cf5f6.entry.js +1 -0
  209. package/dist/webcomponents/p-0b9146cd.entry.js +1 -0
  210. package/dist/webcomponents/p-112acd3c.entry.js +1 -0
  211. package/dist/webcomponents/p-1555e6b1.js +1 -0
  212. package/dist/webcomponents/{p-ac8be2a8.entry.js → p-16f41fd0.entry.js} +1 -1
  213. package/dist/webcomponents/p-17715325.js +1 -0
  214. package/dist/webcomponents/p-19c5ddf1.entry.js +1 -0
  215. package/dist/webcomponents/p-1b6ff0d3.entry.js +1 -0
  216. package/dist/webcomponents/p-1cb65d15.entry.js +1 -0
  217. package/dist/webcomponents/{p-2b2f8162.entry.js → p-2e318b6a.entry.js} +1 -1
  218. package/dist/webcomponents/p-34de1c5d.entry.js +1 -0
  219. package/dist/webcomponents/p-36618b59.entry.js +1 -0
  220. package/dist/webcomponents/p-3a4d4869.entry.js +1 -0
  221. package/dist/webcomponents/p-3cb0b96d.js +1 -0
  222. package/dist/webcomponents/p-4ba2c711.entry.js +1 -0
  223. package/dist/webcomponents/p-4c01df65.entry.js +1 -0
  224. package/dist/webcomponents/p-4fa27a28.entry.js +1 -0
  225. package/dist/webcomponents/{p-3bef762a.js → p-50730e69.js} +1 -1
  226. package/dist/webcomponents/p-57e592ac.entry.js +1 -0
  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-40fb25c6.entry.js → p-7dd83492.entry.js} +1 -1
  235. package/dist/webcomponents/p-810b72b5.js +1 -0
  236. package/dist/webcomponents/p-876c7257.entry.js +1 -0
  237. package/dist/webcomponents/p-88027949.js +1 -0
  238. package/dist/webcomponents/{p-64a5126c.entry.js → p-896a9ddb.entry.js} +1 -1
  239. package/dist/webcomponents/{p-9ba0be02.entry.js → p-8a90b976.entry.js} +1 -1
  240. package/dist/webcomponents/p-9b99370e.js +1 -0
  241. package/dist/webcomponents/p-9cb3ff78.entry.js +1 -0
  242. package/dist/webcomponents/p-ade12f56.js +1 -0
  243. package/dist/webcomponents/{p-45d2761d.entry.js → p-b5aba473.entry.js} +1 -1
  244. package/dist/webcomponents/p-b8a8b551.js +1 -0
  245. package/dist/webcomponents/{p-c950901c.entry.js → p-c0f882ce.entry.js} +1 -1
  246. package/dist/webcomponents/p-d66a6057.entry.js +1 -0
  247. package/dist/webcomponents/{p-9cec4a27.entry.js → p-d71ce1cd.entry.js} +1 -1
  248. package/dist/webcomponents/{p-c43e29ac.entry.js → p-ec4f27e7.entry.js} +1 -1
  249. package/dist/webcomponents/{p-9a6e4749.js → p-f0c535ed.js} +1 -1
  250. package/dist/webcomponents/{p-c63a98f6.entry.js → p-f7a3fd12.entry.js} +1 -1
  251. package/dist/webcomponents/webcomponents.esm.js +1 -1
  252. package/package.json +6 -4
  253. package/dist/cjs/utils-931f4879.js +0 -34
  254. package/dist/esm/utils-8cc130a9.js +0 -31
  255. package/dist/module/phone-masks.js +0 -5
  256. package/dist/types/utils/phone-masks.d.ts +0 -3
  257. package/dist/webcomponents/p-0a1347cf.entry.js +0 -1
  258. package/dist/webcomponents/p-0f3e9483.js +0 -1
  259. package/dist/webcomponents/p-0fa49c38.entry.js +0 -1
  260. package/dist/webcomponents/p-1e2a98bf.js +0 -1
  261. package/dist/webcomponents/p-5a502ceb.entry.js +0 -1
  262. package/dist/webcomponents/p-5bf0ac1a.entry.js +0 -1
  263. package/dist/webcomponents/p-6e80f063.entry.js +0 -1
  264. package/dist/webcomponents/p-71679a41.js +0 -1
  265. package/dist/webcomponents/p-78baff54.js +0 -1
  266. package/dist/webcomponents/p-8bbb1b10.entry.js +0 -1
  267. package/dist/webcomponents/p-90926321.js +0 -1
  268. package/dist/webcomponents/p-9e0d2179.entry.js +0 -1
  269. package/dist/webcomponents/p-c4826a33.entry.js +0 -1
  270. package/dist/webcomponents/p-d4755024.entry.js +0 -1
  271. package/dist/webcomponents/p-e8e109bd.entry.js +0 -1
  272. package/dist/webcomponents/p-ead8cfc2.entry.js +0 -1
  273. package/dist/webcomponents/p-f74899b9.entry.js +0 -1
@@ -0,0 +1,86 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { MapPayoutStatusToBadge, formatCurrency, formatDate, formatTime } from "../../utils/utils";
3
+ import { CodeBlock, DetailItem, DetailSection, EntityHeadInfo, EntityHeadInfoItem, ErrorState, LoadingState } from "../details/utils";
4
+ export class PayoutDetailsCore {
5
+ constructor() {
6
+ this.getPayout = undefined;
7
+ this.payout = undefined;
8
+ this.loading = true;
9
+ this.errorMessage = null;
10
+ }
11
+ componentWillLoad() {
12
+ if (this.getPayout) {
13
+ this.fetchData();
14
+ }
15
+ }
16
+ getPayoutWatcher() {
17
+ this.fetchData();
18
+ }
19
+ fetchData() {
20
+ this.loading = true;
21
+ this.getPayout({
22
+ onSuccess: (payout) => {
23
+ this.errorMessage = null;
24
+ this.payout = payout;
25
+ this.loading = false;
26
+ },
27
+ onError: (errorMessage) => {
28
+ this.errorMessage = errorMessage;
29
+ console.error(this.errorMessage);
30
+ this.loading = false;
31
+ },
32
+ });
33
+ }
34
+ render() {
35
+ var _a;
36
+ return (h(Host, null, this.loading && LoadingState(), !this.loading && this.errorMessage && ErrorState(this.errorMessage), !this.loading && this.payout && (h("justifi-details", { "error-message": this.errorMessage }, h(EntityHeadInfo, { slot: "head-info", badge: h("span", { slot: 'badge', innerHTML: MapPayoutStatusToBadge((_a = this.payout) === null || _a === void 0 ? void 0 : _a.status) }), title: `${formatCurrency(this.payout.amount)} ${this.payout.currency.toUpperCase()}` }, h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Updated At", value: `${formatDate(this.payout.updated_at)} ${formatTime(this.payout.updated_at)}` }), h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Created At", value: `${formatDate(this.payout.created_at)} ${formatTime(this.payout.created_at)}` }), h(EntityHeadInfoItem, { title: "ID", value: this.payout.id })), h("div", { slot: 'detail-sections' }, h(DetailSection, { sectionTitle: "Details" }, h(DetailItem, { title: "Date paid", value: formatDate(this.payout.deposits_at) }), h(DetailItem, { title: "Statement Description", value: this.payout.description }), h(DetailItem, { title: "Payout Method", value: this.payout.delivery_method }), h(DetailItem, { title: "Amount", value: formatCurrency(this.payout.amount) }), h(DetailItem, { title: "Fee", value: formatCurrency(this.payout.fees_total) })), h(DetailSection, { sectionTitle: "Account" }, h(DetailItem, { title: "ID", value: this.payout.account_id }), h(DetailItem, { title: "Account Type", value: this.payout.bank_account.account_type }), h(DetailItem, { title: "Institution", value: this.payout.bank_account.account_type }), h(DetailItem, { title: "Routing Number", value: this.payout.bank_account.routing_number }), h(DetailItem, { title: "Account Number", value: this.payout.bank_account.account_number_last4 })), h(DetailSection, { sectionTitle: 'Metadata' }, h(CodeBlock, { metadata: this.payout.metadata })))))));
37
+ }
38
+ static get is() { return "payout-details-core"; }
39
+ static get originalStyleUrls() {
40
+ return {
41
+ "$": ["payout-details.scss"]
42
+ };
43
+ }
44
+ static get styleUrls() {
45
+ return {
46
+ "$": ["payout-details.css"]
47
+ };
48
+ }
49
+ static get properties() {
50
+ return {
51
+ "getPayout": {
52
+ "type": "unknown",
53
+ "mutable": false,
54
+ "complexType": {
55
+ "original": "Function",
56
+ "resolved": "Function",
57
+ "references": {
58
+ "Function": {
59
+ "location": "global",
60
+ "id": "global::Function"
61
+ }
62
+ }
63
+ },
64
+ "required": false,
65
+ "optional": false,
66
+ "docs": {
67
+ "tags": [],
68
+ "text": ""
69
+ }
70
+ }
71
+ };
72
+ }
73
+ static get states() {
74
+ return {
75
+ "payout": {},
76
+ "loading": {},
77
+ "errorMessage": {}
78
+ };
79
+ }
80
+ static get watchers() {
81
+ return [{
82
+ "propName": "getPayout",
83
+ "methodName": "getPayoutWatcher"
84
+ }];
85
+ }
86
+ }
@@ -1,90 +1,40 @@
1
- import { Host, h } from "@stencil/core";
2
- import { Api, Payout } from "../../api";
3
- import { MapPayoutStatusToBadge, formatCurrency, formatDate, formatTime } from "../../utils/utils";
4
- import { CodeBlock, DetailItem, DetailSection, EntityHeadInfo, EntityHeadInfoItem, ErrorState, LoadingState } from "../details/utils";
5
- import { config } from "../../../config";
6
- /**
7
- * @exportedPart detail-loading-spinner
8
- * @exportedPart detail-loading-state
9
- * @exportedPart detail-empty-state
10
- * @exportedPart detail-head
11
- * @exportedPart detail-title
12
- * @exportedPart detail-method
13
- * @exportedPart detail-info
14
- * @exportedPart detail-info-item
15
- * @exportedPart detail-info-item-title
16
- * @exportedPart detail-info-item-data
17
- * @exportedPart detail-metadata
18
- * @exportedPart detail-metadata-title
19
- * @exportedPart detail-method-title
20
- * @exportedPart detail-method-data
21
- * @exportedPart detail-section
22
- * @exportedPart detail-section-title
23
- * @exportedPart detail-section-item-title
24
- * @exportedPart detail-section-item-data
25
- * @exportedPart detail-head-info
26
- * @exportedPart detail-head-info-item
27
- * @exportedPart detail-head-info-item-title
28
- * @exportedPart detail-head-info-item-data
29
- */
30
- export class PaymentDetails {
1
+ import { h } from "@stencil/core";
2
+ import { PayoutService } from "../../api/services/payout.service";
3
+ import { makeGetPayoutDetails } from "./get-payout-details";
4
+ import { ErrorState } from "../details/utils";
5
+ export class PayoutDetails {
31
6
  constructor() {
32
7
  this.payoutId = undefined;
33
8
  this.authToken = undefined;
34
- this.payout = undefined;
35
- this.loading = true;
36
- this.errorMessage = undefined;
9
+ this.getPayout = undefined;
10
+ this.errorMessage = null;
37
11
  }
38
- updateOnPropChange() {
39
- this.fetchData();
12
+ componentWillLoad() {
13
+ this.initializeGetPayout();
40
14
  }
41
- connectedCallback() {
42
- this.fetchData();
15
+ propChanged() {
16
+ this.initializeGetPayout();
43
17
  }
44
- async fetchData() {
45
- this.errorMessage = '';
46
- if (!this.payoutId || !this.authToken) {
47
- this.errorMessage = "Can not fetch any data without a PayoutID and an AuthToken";
48
- this.loading = false;
49
- return;
18
+ initializeGetPayout() {
19
+ if (this.payoutId && this.authToken) {
20
+ this.getPayout = makeGetPayoutDetails({
21
+ id: this.payoutId,
22
+ authToken: this.authToken,
23
+ service: new PayoutService()
24
+ });
50
25
  }
51
- this.loading = true;
52
- try {
53
- const endpoint = `payouts/${this.payoutId}`;
54
- const response = await Api(this.authToken, config.proxyApiOrigin).get(endpoint);
55
- if (!response.error) {
56
- this.payout = new Payout(response.data);
57
- }
58
- else {
59
- const responseError = typeof response.error === 'string' ? response.error : response.error.message;
60
- this.errorMessage = `Error fetching payout details: ${responseError}`;
61
- console.error(this.errorMessage);
62
- }
63
- }
64
- catch (error) {
65
- this.errorMessage = `Error fetching payout details: ${error}`;
66
- console.error(this.errorMessage);
67
- }
68
- finally {
69
- this.loading = false;
26
+ else {
27
+ this.errorMessage = 'Failed to load payout details. payoutId or authToken is not provided.';
70
28
  }
71
29
  }
72
30
  render() {
73
- var _a;
74
- return (h(Host, null, this.loading && LoadingState, !this.loading && this.errorMessage && ErrorState(this.errorMessage), !this.loading && this.payout && (h("justifi-details", { "error-message": this.errorMessage }, h(EntityHeadInfo, { slot: "head-info", badge: h("span", { slot: 'badge', innerHTML: MapPayoutStatusToBadge((_a = this.payout) === null || _a === void 0 ? void 0 : _a.status) }), title: `${formatCurrency(this.payout.amount)} ${this.payout.currency.toUpperCase()}` }, h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Updated At", value: `${formatDate(this.payout.updated_at)} ${formatTime(this.payout.updated_at)}` }), h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Created At", value: `${formatDate(this.payout.created_at)} ${formatTime(this.payout.created_at)}` }), h(EntityHeadInfoItem, { title: "ID", value: this.payout.id })), h("div", { slot: 'detail-sections' }, h(DetailSection, { sectionTitle: "Details" }, h(DetailItem, { title: "Date paid", value: formatDate(this.payout.deposits_at) }), h(DetailItem, { title: "Statement Description", value: this.payout.description }), h(DetailItem, { title: "Payout Method", value: this.payout.delivery_method }), h(DetailItem, { title: "Amount", value: formatCurrency(this.payout.amount) }), h(DetailItem, { title: "Fee", value: formatCurrency(this.payout.fees_total) })), h(DetailSection, { sectionTitle: "Account" }, h(DetailItem, { title: "ID", value: this.payout.account_id }), h(DetailItem, { title: "Account Type", value: this.payout.bank_account.account_type }), h(DetailItem, { title: "Institution", value: this.payout.bank_account.account_type }), h(DetailItem, { title: "Routing Number", value: this.payout.bank_account.routing_number }), h(DetailItem, { title: "Account Number", value: this.payout.bank_account.account_number_last4 })), h(DetailSection, { sectionTitle: 'Metadata' }, h(CodeBlock, { metadata: this.payout.metadata })))))));
31
+ if (this.errorMessage) {
32
+ return ErrorState(this.errorMessage);
33
+ }
34
+ return (h("payout-details-core", { getPayout: this.getPayout }));
75
35
  }
76
36
  static get is() { return "justifi-payout-details"; }
77
37
  static get encapsulation() { return "shadow"; }
78
- static get originalStyleUrls() {
79
- return {
80
- "$": ["payout-details.scss"]
81
- };
82
- }
83
- static get styleUrls() {
84
- return {
85
- "$": ["payout-details.css"]
86
- };
87
- }
88
38
  static get properties() {
89
39
  return {
90
40
  "payoutId": {
@@ -125,18 +75,17 @@ export class PaymentDetails {
125
75
  }
126
76
  static get states() {
127
77
  return {
128
- "payout": {},
129
- "loading": {},
78
+ "getPayout": {},
130
79
  "errorMessage": {}
131
80
  };
132
81
  }
133
82
  static get watchers() {
134
83
  return [{
135
84
  "propName": "payoutId",
136
- "methodName": "updateOnPropChange"
85
+ "methodName": "propChanged"
137
86
  }, {
138
87
  "propName": "authToken",
139
- "methodName": "updateOnPropChange"
88
+ "methodName": "propChanged"
140
89
  }];
141
90
  }
142
91
  }
@@ -0,0 +1,55 @@
1
+ import { Payout } from "../../../api";
2
+ import { PayoutService } from "../../../api/services/payout.service";
3
+ import { makeGetPayoutDetails } from "../get-payout-details";
4
+ import mockResponse from "../../../api/mockData/mockPayoutDetailsSuccess.json";
5
+ describe('getPayout', () => {
6
+ const mockId = '123';
7
+ const mockAuthToken = '123';
8
+ let mockServiceInstance;
9
+ beforeEach(() => {
10
+ jest.clearAllMocks();
11
+ mockServiceInstance = new PayoutService();
12
+ mockServiceInstance.fetchPayout = jest.fn();
13
+ });
14
+ it('should call onSuccess with payout on successful fetch', async () => {
15
+ const onSuccess = jest.fn();
16
+ const onError = jest.fn();
17
+ mockServiceInstance.fetchPayout.mockResolvedValue(mockResponse);
18
+ const getPayout = makeGetPayoutDetails({
19
+ id: mockId,
20
+ authToken: mockAuthToken,
21
+ service: mockServiceInstance,
22
+ });
23
+ await getPayout({ onSuccess, onError });
24
+ expect(onSuccess).toHaveBeenCalledWith(expect.any(Payout));
25
+ expect(onError).not.toHaveBeenCalled();
26
+ });
27
+ it('should call onError with an error message on API failure', async () => {
28
+ const mockError = new Error('Error fetching payout');
29
+ const onSuccess = jest.fn();
30
+ const onError = jest.fn();
31
+ mockServiceInstance.fetchPayout.mockRejectedValue(mockError);
32
+ const getPayout = makeGetPayoutDetails({
33
+ id: mockId,
34
+ authToken: mockAuthToken,
35
+ service: mockServiceInstance,
36
+ });
37
+ await getPayout({ onSuccess, onError });
38
+ expect(onSuccess).not.toHaveBeenCalled();
39
+ expect(onError).toHaveBeenCalledWith(`Error fetching payout details: ${mockError}`);
40
+ });
41
+ it('should call onError with an error message on API failure with error message', async () => {
42
+ const mockError = new Error('Error fetching payout');
43
+ const onSuccess = jest.fn();
44
+ const onError = jest.fn();
45
+ mockServiceInstance.fetchPayout.mockRejectedValue(mockError);
46
+ const getPayout = makeGetPayoutDetails({
47
+ id: mockId,
48
+ authToken: mockAuthToken,
49
+ service: mockServiceInstance,
50
+ });
51
+ await getPayout({ onSuccess, onError });
52
+ expect(onSuccess).not.toHaveBeenCalled();
53
+ expect(onError).toHaveBeenCalledWith(`Error fetching payout details: ${mockError}`);
54
+ });
55
+ });
@@ -0,0 +1,72 @@
1
+ import { newSpecPage } from "@stencil/core/testing";
2
+ import { PayoutDetailsCore } from "../payout-details-core";
3
+ import mockPayoutDetailSuccess from "../../../api/mockData/mockPayoutDetailsSuccess.json";
4
+ import { makeGetPayoutDetails } from "../get-payout-details";
5
+ describe('payout-details-core', () => {
6
+ it('renders loading state initially', async () => {
7
+ // Define a mock getPayout function as part of the component initialization
8
+ const mockGetPayout = jest.fn().mockImplementation(({ onSuccess }) => {
9
+ // Simulate an asynchronous operation without resolving immediately
10
+ setTimeout(() => onSuccess({ /* mock data */}), 1000);
11
+ });
12
+ // Initialize the page with the mock getPayout function included in the component tag
13
+ const page = await newSpecPage({
14
+ components: [PayoutDetailsCore],
15
+ html: `<payout-details-core></payout-details-core>`,
16
+ });
17
+ page.rootInstance.componentWillLoad = () => { };
18
+ page.rootInstance.getPayout = mockGetPayout;
19
+ // Wait for any state changes to complete
20
+ await page.waitForChanges();
21
+ // Assert the loading state is visible in the snapshot
22
+ expect(page.root).toMatchSnapshot();
23
+ });
24
+ it('fetches payout details on connected callback', async () => {
25
+ const mockService = {
26
+ fetchPayout: jest.fn().mockResolvedValue(mockPayoutDetailSuccess),
27
+ };
28
+ const getPayout = makeGetPayoutDetails({
29
+ id: 'some-id',
30
+ authToken: 'some-auth-token',
31
+ service: mockService,
32
+ });
33
+ const page = await newSpecPage({
34
+ components: [PayoutDetailsCore],
35
+ html: '<payout-details-core></payout-details-core>',
36
+ });
37
+ page.rootInstance.componentWillLoad = () => { };
38
+ page.rootInstance.getPayout = getPayout;
39
+ page.rootInstance.fetchData();
40
+ await page.waitForChanges();
41
+ expect(mockService.fetchPayout).toHaveBeenCalled(); // Verify the mock service method was called
42
+ expect(page.rootInstance.payout).toEqual(expect.objectContaining({
43
+ "id": mockPayoutDetailSuccess.id, // Verify the component state was updated with mock data
44
+ }));
45
+ expect(page.root).toMatchSnapshot(); // Verify the rendered output
46
+ });
47
+ it('handles fetch payout error correctly', async () => {
48
+ // Mock the service method that gets called by getPayout
49
+ const mockService = {
50
+ fetchPayout: jest.fn().mockRejectedValue(new Error('Fetch error'))
51
+ };
52
+ // Real getPayout function but with mocked service
53
+ const realGetPayoutWithMockedService = makeGetPayoutDetails({
54
+ id: 'some-id', // Use appropriate id
55
+ authToken: 'some-auth-token', // Use appropriate auth token
56
+ service: mockService // Injecting the mocked service
57
+ });
58
+ const page = await newSpecPage({
59
+ components: [PayoutDetailsCore],
60
+ html: '<payout-details-core></payout-details-core>',
61
+ });
62
+ page.rootInstance.componentWillLoad = () => { };
63
+ // Inject the getPayout function with mocked service into the component
64
+ page.rootInstance.getPayout = realGetPayoutWithMockedService;
65
+ // Manually call fetchData if necessary, depending on how your component is set up
66
+ await page.rootInstance.fetchData();
67
+ await page.waitForChanges();
68
+ // Assertions to verify the error handling
69
+ expect(page.rootInstance.errorMessage).toBe('Error fetching payout details: Error: Fetch error');
70
+ expect(page.root).toMatchSnapshot();
71
+ });
72
+ });
@@ -0,0 +1,13 @@
1
+ import { newSpecPage } from "@stencil/core/testing";
2
+ import { PayoutDetails } from "../payout-details";
3
+ import { PayoutDetailsCore } from "../payout-details-core";
4
+ describe('payout-details', () => {
5
+ it('renders error state when no payoutId or authToken', async () => {
6
+ const page = await newSpecPage({
7
+ components: [PayoutDetails, PayoutDetailsCore],
8
+ html: '<justifi-payout-details></justifi-payout-details>',
9
+ });
10
+ await page.waitForChanges();
11
+ expect(page.root).toMatchSnapshot();
12
+ });
13
+ });
@@ -0,0 +1,20 @@
1
+ import { Payout } from "../../api";
2
+ import { getErrorMessage } from "../../api/services/utils";
3
+ export const makeGetPayouts = ({ id, authToken, service }) => async ({ params, onSuccess, onError }) => {
4
+ var _a;
5
+ try {
6
+ const response = await service.fetchPayouts(id, authToken, params);
7
+ if (!response.error) {
8
+ const pagingInfo = Object.assign({}, response.page_info);
9
+ const payouts = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.map((dataItem) => new Payout(dataItem))) || [];
10
+ onSuccess({ payouts, pagingInfo });
11
+ }
12
+ else {
13
+ const responseError = getErrorMessage(response.error);
14
+ return onError(responseError);
15
+ }
16
+ }
17
+ catch (error) {
18
+ return onError(error.message || error);
19
+ }
20
+ };
@@ -0,0 +1,181 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { PayoutStatuses, PayoutStatusesSafeNames, pagingDefaults } from "../../api";
3
+ import { formatCurrency, formatDate, formatTime } from "../../utils/utils";
4
+ import { tableExportedParts } from "../table/exported-parts";
5
+ export class PayoutsListCore {
6
+ constructor() {
7
+ this.mapStatusToBadge = (status) => {
8
+ switch (status) {
9
+ case PayoutStatuses.scheduled:
10
+ return `<span class="badge bg-primary" title='Batched and scheduled to be transferred'>${PayoutStatusesSafeNames[status]}</span>`;
11
+ case PayoutStatuses.in_transit:
12
+ return `<span class="badge bg-primary" title='Transfer to your bank account has been initiated'>${PayoutStatusesSafeNames[status]}</span>`;
13
+ case PayoutStatuses.failed:
14
+ return `<span class="badge bg-danger" title='Transfer to your bank account failed'>${PayoutStatusesSafeNames[status]}</span>`;
15
+ case PayoutStatuses.canceled:
16
+ return `<span class="badge bg-danger" title='Transfer to your bank account failed'>${PayoutStatusesSafeNames[status]}</span>`;
17
+ case PayoutStatuses.forwarded:
18
+ return `<span class="badge bg-secondary" title='This payout initially failed; the funds have been forwarded to your next successful payout'>${PayoutStatusesSafeNames[status]}</span>`;
19
+ case PayoutStatuses.paid:
20
+ return `<span class="badge bg-success" title='Successfully deposited into your bank account'>${PayoutStatusesSafeNames[status]}</span>`;
21
+ }
22
+ };
23
+ this.handleClickPrevious = (beforeCursor) => {
24
+ const newParams = Object.assign({}, this.params);
25
+ delete newParams.after_cursor;
26
+ this.params = (Object.assign(Object.assign({}, newParams), { before_cursor: beforeCursor }));
27
+ };
28
+ this.handleClickNext = (afterCursor) => {
29
+ const newParams = Object.assign({}, this.params);
30
+ delete newParams.before_cursor;
31
+ this.params = (Object.assign(Object.assign({}, newParams), { after_cursor: afterCursor }));
32
+ };
33
+ this.getPayouts = undefined;
34
+ this.payouts = [];
35
+ this.loading = true;
36
+ this.errorMessage = undefined;
37
+ this.paging = pagingDefaults;
38
+ this.params = undefined;
39
+ }
40
+ componentWillLoad() {
41
+ if (this.getPayouts) {
42
+ this.fetchData();
43
+ }
44
+ }
45
+ updateOnPropChange() {
46
+ this.fetchData();
47
+ }
48
+ fetchData() {
49
+ this.loading = true;
50
+ this.getPayouts({
51
+ params: this.params,
52
+ onSuccess: ({ payouts, pagingInfo }) => {
53
+ this.payouts = payouts;
54
+ this.paging = pagingInfo;
55
+ this.loading = false;
56
+ },
57
+ onError: (errorMessage) => {
58
+ this.errorMessage = errorMessage;
59
+ this.loading = false;
60
+ },
61
+ });
62
+ }
63
+ ;
64
+ render() {
65
+ return (h(Host, { exportedparts: tableExportedParts }, h("justifi-table", { rowClickHandler: (e) => {
66
+ const clickedPayoutID = e.target.closest('tr').dataset.rowEntityId;
67
+ if (!clickedPayoutID) {
68
+ return;
69
+ }
70
+ this.rowClicked.emit(this.payouts.find((payout) => payout.id === clickedPayoutID));
71
+ }, columnData: [
72
+ ['Paid Out On', 'The date each transaction occurred'],
73
+ ['Type', 'The type of each transaction'],
74
+ ['Account', 'The ID of the account associated with each payout'],
75
+ ['Paid Out To', 'The bank account to which each payout was transferred'],
76
+ ['Payments', 'Sum of payments in each payout'],
77
+ ['Refunds', 'Sum of refunds in each payout'],
78
+ ['Fees', 'Sum of fees in each payout'],
79
+ ['Other', 'Sum of less common transactions in each payout (disputes, ACH returns, fee refunds, and forwarded balances due to failed payouts)'],
80
+ ['Payout Amount', 'The net sum of all transactions in each payout. This is the amount you\'ll see reflected on your bank statement'],
81
+ ['Status', 'The real-time status of each payout']
82
+ ], entityId: this.payouts.map((payout) => payout.id), rowData: this.payouts.map((payout) => ([
83
+ {
84
+ type: 'head',
85
+ value: `
86
+ <div class='fw-bold'>${formatDate(payout.created_at)}</div>
87
+ <div class='fw-bold'>${formatTime(payout.created_at)}</div>
88
+ `,
89
+ },
90
+ payout.payout_type,
91
+ payout.account_id,
92
+ `${payout.bank_account.full_name} ${payout.bank_account.account_number_last4}`,
93
+ formatCurrency(payout.payments_total),
94
+ formatCurrency(payout.refunds_total),
95
+ formatCurrency(payout.fees_total),
96
+ formatCurrency(payout.other_total),
97
+ formatCurrency(payout.amount),
98
+ {
99
+ type: 'inner',
100
+ value: this.mapStatusToBadge(payout.status)
101
+ }
102
+ ])), loading: this.loading, "error-message": this.errorMessage, params: this.params, paging: Object.assign(Object.assign({}, this.paging), { handleClickNext: this.handleClickNext, handleClickPrevious: this.handleClickPrevious }) })));
103
+ }
104
+ static get is() { return "payouts-list-core"; }
105
+ static get originalStyleUrls() {
106
+ return {
107
+ "$": ["payouts-list.scss"]
108
+ };
109
+ }
110
+ static get styleUrls() {
111
+ return {
112
+ "$": ["payouts-list.css"]
113
+ };
114
+ }
115
+ static get properties() {
116
+ return {
117
+ "getPayouts": {
118
+ "type": "unknown",
119
+ "mutable": false,
120
+ "complexType": {
121
+ "original": "Function",
122
+ "resolved": "Function",
123
+ "references": {
124
+ "Function": {
125
+ "location": "global",
126
+ "id": "global::Function"
127
+ }
128
+ }
129
+ },
130
+ "required": false,
131
+ "optional": false,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": ""
135
+ }
136
+ }
137
+ };
138
+ }
139
+ static get states() {
140
+ return {
141
+ "payouts": {},
142
+ "loading": {},
143
+ "errorMessage": {},
144
+ "paging": {},
145
+ "params": {}
146
+ };
147
+ }
148
+ static get events() {
149
+ return [{
150
+ "method": "rowClicked",
151
+ "name": "payout-row-clicked",
152
+ "bubbles": true,
153
+ "cancelable": true,
154
+ "composed": true,
155
+ "docs": {
156
+ "tags": [],
157
+ "text": ""
158
+ },
159
+ "complexType": {
160
+ "original": "Payout",
161
+ "resolved": "Payout",
162
+ "references": {
163
+ "Payout": {
164
+ "location": "import",
165
+ "path": "../../api",
166
+ "id": "src/api/index.ts::Payout"
167
+ }
168
+ }
169
+ }
170
+ }];
171
+ }
172
+ static get watchers() {
173
+ return [{
174
+ "propName": "params",
175
+ "methodName": "updateOnPropChange"
176
+ }, {
177
+ "propName": "getPayouts",
178
+ "methodName": "updateOnPropChange"
179
+ }];
180
+ }
181
+ }