@justifi/webcomponents 4.7.5 → 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 (298) 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 +5 -5
  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} +46 -3
  7. package/dist/cjs/form-control-monetary.cjs.entry.js +1 -1
  8. package/dist/cjs/{form-control-number_3.cjs.entry.js → form-control-select_2.cjs.entry.js} +1 -44
  9. package/dist/cjs/form-input-masks-e3bf2614.js +9 -0
  10. package/dist/cjs/{index-4286ac32.js → index-55950669.js} +31 -1
  11. package/dist/cjs/{index.esm-c08c2adc.js → index.esm-d25bd7bf.js} +0 -259
  12. package/dist/cjs/{justifi-additional-questions_6.cjs.entry.js → justifi-additional-questions_5.cjs.entry.js} +10 -280
  13. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +1 -1
  14. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +2 -2
  15. package/dist/cjs/justifi-business-details.cjs.entry.js +6 -6
  16. package/dist/cjs/justifi-business-form-stepped.cjs.entry.js +56 -49
  17. package/dist/cjs/justifi-business-form.cjs.entry.js +43 -36
  18. package/dist/cjs/justifi-business-list.cjs.entry.js +4 -51
  19. package/dist/cjs/justifi-business-owners.cjs.entry.js +78 -0
  20. package/dist/cjs/justifi-card-form.cjs.entry.js +1 -1
  21. package/dist/cjs/justifi-details.cjs.entry.js +2 -2
  22. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +3 -3
  23. package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +2 -2
  24. package/dist/cjs/justifi-payment-details.cjs.entry.js +44 -43
  25. package/dist/cjs/justifi-payment-form.cjs.entry.js +2 -2
  26. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +7 -5
  27. package/dist/cjs/justifi-payments-list.cjs.entry.js +47 -91
  28. package/dist/cjs/justifi-payout-details.cjs.entry.js +48 -46
  29. package/dist/cjs/justifi-payouts-list.cjs.entry.js +47 -113
  30. package/dist/cjs/justifi-proceeds-list.cjs.entry.js +2 -2
  31. package/dist/cjs/justifi-refund-form.cjs.entry.js +3 -3
  32. package/dist/cjs/justifi-subaccount-details.cjs.entry.js +3 -3
  33. package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +4 -4
  34. package/dist/cjs/justifi-table_2.cjs.entry.js +33 -30
  35. package/dist/cjs/loader.cjs.js +2 -2
  36. package/dist/cjs/payment-details-core.cjs.entry.js +52 -0
  37. package/dist/cjs/payment.service-605896dc.js +20 -0
  38. package/dist/cjs/payments-list-core.cjs.entry.js +98 -0
  39. package/dist/cjs/payout-details-core.cjs.entry.js +52 -0
  40. package/dist/cjs/payout.service-b39f2739.js +21 -0
  41. package/dist/cjs/payouts-list-core.cjs.entry.js +121 -0
  42. package/dist/cjs/select-input_2.cjs.entry.js +1 -1
  43. package/dist/cjs/subaccount-account-details_4.cjs.entry.js +2 -2
  44. package/dist/cjs/subaccount-bank-details.cjs.entry.js +2 -2
  45. package/dist/cjs/subaccount-terms-details.cjs.entry.js +2 -2
  46. package/dist/cjs/{utils-a2ee48ca.js → utils-d126d17c.js} +5 -5
  47. package/dist/cjs/utils-f5d82f21.js +10 -0
  48. package/dist/cjs/webcomponents.cjs.js +2 -2
  49. package/dist/collection/api/Business.js +18 -3
  50. package/dist/collection/api/Payment.js +2 -1
  51. package/dist/collection/api/mockData/MockPayments.js +25 -0
  52. package/dist/collection/api/services/payment.service.js +13 -0
  53. package/dist/collection/api/services/payout.service.js +14 -0
  54. package/dist/collection/api/services/utils.js +6 -0
  55. package/dist/collection/collection-manifest.json +4 -0
  56. package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +8 -8
  57. package/dist/collection/components/business-details/business-details.js +3 -3
  58. package/dist/collection/components/business-form/BusinessFormEventTypes.js +6 -0
  59. package/dist/collection/components/business-form/business-address/business-address-form-schema.js +1 -1
  60. package/dist/collection/components/business-form/business-form-schema.js +16 -16
  61. package/dist/collection/components/business-form/business-form-stepped.js +99 -57
  62. package/dist/collection/components/business-form/business-form.css +95 -0
  63. package/dist/collection/components/business-form/business-form.js +92 -32
  64. package/dist/collection/components/business-form/business-generic-info/business-generic-info.js +7 -3
  65. package/dist/collection/components/business-form/business-owners/business-owners.js +6 -21
  66. package/dist/collection/components/business-form/business-representative/business-representative.js +1 -1
  67. package/dist/collection/components/business-form/helpers.js +21 -20
  68. package/dist/collection/components/business-form/legal-address-form/legal-address-form-schema.js +1 -1
  69. package/dist/collection/components/business-form/legal-address-form/legal-address-form.js +1 -2
  70. package/dist/collection/components/business-form/test/business-form.spec.js +5 -14
  71. package/dist/collection/components/details/utils.js +2 -2
  72. package/dist/collection/components/form/utils.js +2 -0
  73. package/dist/collection/components/pagination-menu/test/pagination-menu.spec.js +87 -0
  74. package/dist/collection/components/payment-details/get-payment-details.js +17 -0
  75. package/dist/collection/components/payment-details/payment-details-core.js +86 -0
  76. package/dist/collection/components/payment-details/payment-details.js +27 -52
  77. package/dist/collection/components/payment-details/test/get-payment-details.spec.js +64 -0
  78. package/dist/collection/components/payment-details/test/payment-details-core.spec.js +47 -0
  79. package/dist/collection/components/payment-details/test/payment-details.spec.js +31 -0
  80. package/dist/collection/components/payments-list/get-payments.js +20 -0
  81. package/dist/collection/components/payments-list/payments-list-core.js +158 -0
  82. package/dist/collection/components/payments-list/payments-list.js +27 -127
  83. package/dist/collection/components/payments-list/test/get-payments.spec.js +70 -0
  84. package/dist/collection/components/payments-list/test/payments-list-core.spec.js +100 -0
  85. package/dist/collection/components/payments-list/test/payments-list.spec.js +17 -21
  86. package/dist/collection/components/payout-details/get-payout-details.js +20 -0
  87. package/dist/collection/components/payout-details/payout-details-core.js +86 -0
  88. package/dist/collection/components/payout-details/payout-details.js +27 -78
  89. package/dist/collection/components/payout-details/test/get-payout-details.spec.js +55 -0
  90. package/dist/collection/components/payout-details/test/payout-details-core.spec.js +72 -0
  91. package/dist/collection/components/payout-details/test/payout-details.spec.js +13 -0
  92. package/dist/collection/components/payouts-list/get-payouts.js +20 -0
  93. package/dist/collection/components/payouts-list/payouts-list-core.js +181 -0
  94. package/dist/collection/components/payouts-list/payouts-list.js +26 -148
  95. package/dist/collection/components/payouts-list/test/get-payouts.spec.js +64 -0
  96. package/dist/collection/components/payouts-list/test/payouts-list-core.spec.js +105 -0
  97. package/dist/collection/components/payouts-list/test/payouts-list.spec.js +29 -0
  98. package/dist/collection/components/subaccounts-list/subaccounts-list.js +2 -2
  99. package/dist/collection/components/table/table.js +22 -29
  100. package/dist/collection/components/table/test/table.spec.js +47 -13
  101. package/dist/collection/components/table/utils.js +4 -0
  102. package/dist/collection/utils/{phone-masks.js → form-input-masks.js} +1 -0
  103. package/dist/docs.json +486 -317
  104. package/dist/esm/Business-1f5e9f6b.js +64 -0
  105. package/dist/esm/BusinessFormEventTypes-989960ba.js +39 -0
  106. package/dist/esm/{Payout-c42e3877.js → Payout-dc5f009c.js} +2 -1
  107. package/dist/esm/{SubAccount-b3ce8720.js → SubAccount-bd59f646.js} +1 -1
  108. package/dist/esm/additional-questions-details_5.entry.js +6 -6
  109. package/dist/esm/{business-form-schema-997c585c.js → business-form-schema-f8f554d1.js} +17 -17
  110. package/dist/esm/{form-control-datepart_2.entry.js → form-control-datepart_3.entry.js} +46 -4
  111. package/dist/esm/form-control-monetary.entry.js +1 -1
  112. package/dist/esm/{form-control-number_3.entry.js → form-control-select_2.entry.js} +2 -44
  113. package/dist/esm/form-input-masks-a8187c77.js +6 -0
  114. package/dist/esm/{index-ff8194f9.js → index-62b8aa8a.js} +31 -1
  115. package/dist/esm/{index.esm-8ae36d07.js → index.esm-22b47398.js} +1 -258
  116. package/dist/esm/{justifi-additional-questions_6.entry.js → justifi-additional-questions_5.entry.js} +10 -279
  117. package/dist/esm/justifi-bank-account-form.entry.js +1 -1
  118. package/dist/esm/justifi-billing-form_2.entry.js +2 -2
  119. package/dist/esm/justifi-business-details.entry.js +6 -6
  120. package/dist/esm/justifi-business-form-stepped.entry.js +56 -49
  121. package/dist/esm/justifi-business-form.entry.js +43 -36
  122. package/dist/esm/justifi-business-list.entry.js +4 -51
  123. package/dist/{module/business-owners.js → esm/justifi-business-owners.entry.js} +13 -55
  124. package/dist/esm/justifi-card-form.entry.js +1 -1
  125. package/dist/esm/justifi-details.entry.js +2 -2
  126. package/dist/esm/justifi-gross-payment-chart.entry.js +4 -4
  127. package/dist/esm/justifi-payment-balance-transactions.entry.js +3 -3
  128. package/dist/esm/justifi-payment-details.entry.js +44 -43
  129. package/dist/esm/justifi-payment-form.entry.js +3 -3
  130. package/dist/esm/justifi-payment-method-form.entry.js +7 -5
  131. package/dist/esm/justifi-payments-list.entry.js +47 -91
  132. package/dist/esm/justifi-payout-details.entry.js +48 -46
  133. package/dist/esm/justifi-payouts-list.entry.js +47 -113
  134. package/dist/esm/justifi-proceeds-list.entry.js +3 -3
  135. package/dist/esm/justifi-refund-form.entry.js +3 -3
  136. package/dist/esm/justifi-subaccount-details.entry.js +5 -5
  137. package/dist/esm/justifi-subaccounts-list.entry.js +6 -6
  138. package/dist/esm/justifi-table_2.entry.js +33 -30
  139. package/dist/esm/loader.js +3 -3
  140. package/dist/esm/payment-details-core.entry.js +48 -0
  141. package/dist/esm/payment.service-bea02ccf.js +18 -0
  142. package/dist/esm/payments-list-core.entry.js +94 -0
  143. package/dist/{webcomponents/p-b2dc938f.entry.js → esm/payout-details-core.entry.js} +48 -1
  144. package/dist/esm/payout.service-92e56814.js +19 -0
  145. package/dist/esm/payouts-list-core.entry.js +117 -0
  146. package/dist/esm/select-input_2.entry.js +1 -1
  147. package/dist/esm/subaccount-account-details_4.entry.js +3 -3
  148. package/dist/esm/subaccount-bank-details.entry.js +2 -2
  149. package/dist/esm/subaccount-terms-details.entry.js +2 -2
  150. package/dist/esm/utils-546ca6aa.js +8 -0
  151. package/dist/esm/{utils-7c6bd149.js → utils-576874df.js} +5 -5
  152. package/dist/esm/{utils-26c7dd12.js → utils-dd428dba.js} +1 -1
  153. package/dist/esm/webcomponents.js +3 -3
  154. package/dist/module/Business.js +64 -0
  155. package/dist/module/BusinessFormEventTypes.js +39 -0
  156. package/dist/module/Payout.js +2 -1
  157. package/dist/module/additional-questions-details2.js +4 -4
  158. package/dist/module/business-generic-info.js +25 -27
  159. package/dist/module/business-representative.js +1 -1
  160. package/dist/module/form-input-masks.js +6 -0
  161. package/dist/module/index.esm.js +1 -258
  162. package/dist/module/justifi-business-details.js +3 -3
  163. package/dist/module/justifi-business-form-stepped.js +74 -72
  164. package/dist/module/justifi-business-form.js +62 -58
  165. package/dist/module/justifi-business-list.js +1 -48
  166. package/dist/module/justifi-business-owners.js +115 -1
  167. package/dist/module/justifi-payment-details.js +52 -48
  168. package/dist/module/justifi-payments-list.js +58 -102
  169. package/dist/module/justifi-payout-details.js +57 -52
  170. package/dist/module/justifi-payouts-list.js +59 -125
  171. package/dist/module/justifi-refund-form.js +1 -1
  172. package/dist/module/justifi-subaccounts-list.js +2 -2
  173. package/dist/module/legal-address-form.js +1 -202
  174. package/dist/module/payment-details-core.d.ts +11 -0
  175. package/dist/module/payment-details-core.js +6 -0
  176. package/dist/module/payment-details-core2.js +76 -0
  177. package/dist/module/payment-method-form.js +6 -4
  178. package/dist/module/payment.service.js +18 -0
  179. package/dist/module/payments-list-core.d.ts +11 -0
  180. package/dist/module/payments-list-core.js +6 -0
  181. package/dist/module/payments-list-core2.js +131 -0
  182. package/dist/module/payout-details-core.d.ts +11 -0
  183. package/dist/module/payout-details-core.js +6 -0
  184. package/dist/module/payout-details-core2.js +76 -0
  185. package/dist/module/payout.service.js +19 -0
  186. package/dist/module/payouts-list-core.d.ts +11 -0
  187. package/dist/module/payouts-list-core.js +6 -0
  188. package/dist/module/payouts-list-core2.js +153 -0
  189. package/dist/module/table.js +33 -30
  190. package/dist/module/utils.js +4 -4
  191. package/dist/module/utils3.js +8 -0
  192. package/dist/types/api/Business.d.ts +60 -37
  193. package/dist/types/api/Payment.d.ts +33 -1
  194. package/dist/types/api/services/payment.service.d.ts +9 -0
  195. package/dist/types/api/services/payout.service.d.ts +9 -0
  196. package/dist/types/api/services/utils.d.ts +1 -0
  197. package/dist/types/components/business-details/additional-questions-details/additional-questions-details.d.ts +2 -2
  198. package/dist/types/components/business-details/business-details.d.ts +2 -2
  199. package/dist/types/components/business-form/BusinessFormEventTypes.d.ts +5 -0
  200. package/dist/types/components/business-form/business-form-schema.d.ts +1 -19
  201. package/dist/types/components/business-form/business-form-stepped.d.ts +22 -4
  202. package/dist/types/components/business-form/business-form.d.ts +15 -1
  203. package/dist/types/components/business-form/business-generic-info/business-generic-info.d.ts +2 -0
  204. package/dist/types/components/business-form/business-owners/business-owners.d.ts +1 -1
  205. package/dist/types/components/business-form/helpers.d.ts +1 -1
  206. package/dist/types/components/details/utils.d.ts +4 -3
  207. package/dist/types/components/form/utils.d.ts +1 -0
  208. package/dist/types/components/payment-details/get-payment-details.d.ts +8 -0
  209. package/dist/types/components/payment-details/payment-details-core.d.ts +11 -0
  210. package/dist/types/components/payment-details/payment-details.d.ts +6 -6
  211. package/dist/types/components/payment-method-form/payment-method-responses.d.ts +10 -2
  212. package/dist/types/components/payments-list/get-payments.d.ts +9 -0
  213. package/dist/types/components/payments-list/payments-list-core.d.ts +17 -0
  214. package/dist/types/components/payments-list/payments-list.d.ts +4 -12
  215. package/dist/types/components/payout-details/get-payout-details.d.ts +8 -0
  216. package/dist/types/components/payout-details/payout-details-core.d.ts +11 -0
  217. package/dist/types/components/payout-details/payout-details.d.ts +5 -31
  218. package/dist/types/components/payouts-list/get-payouts.d.ts +9 -0
  219. package/dist/types/components/payouts-list/payouts-list-core.d.ts +18 -0
  220. package/dist/types/components/payouts-list/payouts-list.d.ts +4 -13
  221. package/dist/types/components/table/table.d.ts +3 -4
  222. package/dist/types/components/table/utils.d.ts +3 -0
  223. package/dist/types/components.d.ts +138 -138
  224. package/dist/types/utils/form-input-masks.d.ts +6 -0
  225. package/dist/webcomponents/p-081cf5f6.entry.js +1 -0
  226. package/dist/webcomponents/{p-04817850.entry.js → p-0a0cf2e6.entry.js} +1 -1
  227. package/dist/webcomponents/p-0b9146cd.entry.js +1 -0
  228. package/dist/webcomponents/p-112acd3c.entry.js +1 -0
  229. package/dist/webcomponents/p-1555e6b1.js +1 -0
  230. package/dist/webcomponents/{p-377303af.entry.js → p-16f41fd0.entry.js} +1 -1
  231. package/dist/webcomponents/p-17715325.js +1 -0
  232. package/dist/webcomponents/p-19c5ddf1.entry.js +1 -0
  233. package/dist/webcomponents/p-1b6ff0d3.entry.js +1 -0
  234. package/dist/webcomponents/p-1cb65d15.entry.js +1 -0
  235. package/dist/webcomponents/{p-8302a5e2.entry.js → p-2e318b6a.entry.js} +1 -1
  236. package/dist/webcomponents/p-34de1c5d.entry.js +1 -0
  237. package/dist/webcomponents/p-36618b59.entry.js +1 -0
  238. package/dist/webcomponents/p-3a4d4869.entry.js +1 -0
  239. package/dist/webcomponents/p-3cb0b96d.js +1 -0
  240. package/dist/webcomponents/p-4ba2c711.entry.js +1 -0
  241. package/dist/webcomponents/p-4c01df65.entry.js +1 -0
  242. package/dist/webcomponents/p-4f14df36.js +2 -0
  243. package/dist/webcomponents/p-4fa27a28.entry.js +1 -0
  244. package/dist/webcomponents/{p-3bef762a.js → p-50730e69.js} +1 -1
  245. package/dist/webcomponents/{p-d84cd3a5.entry.js → p-57aab065.entry.js} +1 -1
  246. package/dist/webcomponents/p-57e592ac.entry.js +1 -0
  247. package/dist/webcomponents/p-5e142186.entry.js +1 -0
  248. package/dist/webcomponents/{p-57efe345.entry.js → p-5f8b9f64.entry.js} +1 -1
  249. package/dist/webcomponents/p-663bfe87.js +1 -0
  250. package/dist/webcomponents/p-6ab67031.entry.js +1 -0
  251. package/dist/webcomponents/p-6ed680e9.js +1 -0
  252. package/dist/webcomponents/{p-cf656598.entry.js → p-731cb109.entry.js} +1 -1
  253. package/dist/webcomponents/{p-c8916484.entry.js → p-7c0f91fa.entry.js} +1 -1
  254. package/dist/webcomponents/{p-0f5206f0.entry.js → p-7dd83492.entry.js} +1 -1
  255. package/dist/webcomponents/p-810b72b5.js +1 -0
  256. package/dist/webcomponents/p-876c7257.entry.js +1 -0
  257. package/dist/webcomponents/p-88027949.js +1 -0
  258. package/dist/webcomponents/{p-dd4e8fa1.entry.js → p-896a9ddb.entry.js} +1 -1
  259. package/dist/webcomponents/{p-22c2a11e.entry.js → p-8a90b976.entry.js} +1 -1
  260. package/dist/webcomponents/p-9b99370e.js +1 -0
  261. package/dist/webcomponents/p-9cb3ff78.entry.js +1 -0
  262. package/dist/webcomponents/p-ade12f56.js +1 -0
  263. package/dist/webcomponents/{p-0a351e24.entry.js → p-b5aba473.entry.js} +1 -1
  264. package/dist/webcomponents/p-b8a8b551.js +1 -0
  265. package/dist/webcomponents/{p-439a79c7.entry.js → p-bd099662.entry.js} +1 -1
  266. package/dist/webcomponents/{p-cb5352a3.entry.js → p-c0f882ce.entry.js} +1 -1
  267. package/dist/webcomponents/p-d66a6057.entry.js +1 -0
  268. package/dist/webcomponents/{p-650eb614.entry.js → p-d71ce1cd.entry.js} +1 -1
  269. package/dist/webcomponents/{p-33e74da7.entry.js → p-ec4f27e7.entry.js} +1 -1
  270. package/dist/webcomponents/{p-9a6e4749.js → p-f0c535ed.js} +1 -1
  271. package/dist/webcomponents/{p-0ad353cc.entry.js → p-f7a3fd12.entry.js} +1 -1
  272. package/dist/webcomponents/{p-68427454.entry.js → p-f9183f12.entry.js} +1 -1
  273. package/dist/webcomponents/webcomponents.esm.js +1 -1
  274. package/package.json +6 -4
  275. package/readme.md +1 -1
  276. package/dist/cjs/helpers-b254d050.js +0 -26
  277. package/dist/esm/helpers-d8a6a0f1.js +0 -24
  278. package/dist/module/helpers.js +0 -24
  279. package/dist/module/phone-masks.js +0 -5
  280. package/dist/types/utils/phone-masks.d.ts +0 -3
  281. package/dist/webcomponents/p-173fb8ef.entry.js +0 -1
  282. package/dist/webcomponents/p-1e2a98bf.js +0 -1
  283. package/dist/webcomponents/p-210677e3.js +0 -1
  284. package/dist/webcomponents/p-2cab231e.entry.js +0 -1
  285. package/dist/webcomponents/p-2ea68b03.entry.js +0 -1
  286. package/dist/webcomponents/p-34430db2.entry.js +0 -1
  287. package/dist/webcomponents/p-42bc8e53.entry.js +0 -1
  288. package/dist/webcomponents/p-59ecc2d7.entry.js +0 -1
  289. package/dist/webcomponents/p-71679a41.js +0 -1
  290. package/dist/webcomponents/p-78baff54.js +0 -1
  291. package/dist/webcomponents/p-7d922421.entry.js +0 -1
  292. package/dist/webcomponents/p-862f38cc.entry.js +0 -1
  293. package/dist/webcomponents/p-bedada09.js +0 -1
  294. package/dist/webcomponents/p-c8099443.entry.js +0 -1
  295. package/dist/webcomponents/p-da00d9bf.js +0 -2
  296. package/dist/webcomponents/p-df8f6a0f.entry.js +0 -1
  297. package/dist/webcomponents/p-e8f41c84.entry.js +0 -1
  298. package/dist/webcomponents/p-e9589e45.entry.js +0 -1
@@ -4,13 +4,9 @@ import businessFormSchema from "./business-form-schema";
4
4
  import { Api } from "../../api";
5
5
  import { parseForPatching } from "./helpers";
6
6
  import { config } from "../../../config";
7
- const componentStepMapping = {
8
- 0: (formController) => h("justifi-business-generic-info", { formController: formController }),
9
- 1: (formController) => h("justifi-legal-address-form", { formController: formController }),
10
- 2: (formController) => h("justifi-additional-questions", { formController: formController }),
11
- 3: (formController) => h("justifi-business-representative", { formController: formController }),
12
- 4: (formController) => h("justifi-business-owners", { formController: formController })
13
- };
7
+ import { FormAlert } from "../form/utils";
8
+ import { ClickEvents } from "./BusinessFormEventTypes";
9
+ import { Business } from "../../api/Business";
14
10
  /**
15
11
  * @exportedPart label: Label for inputs
16
12
  * @exportedPart input: The input fields
@@ -18,41 +14,52 @@ const componentStepMapping = {
18
14
  */
19
15
  export class BusinessFormStepped {
20
16
  constructor() {
17
+ this.componentStepMapping = {
18
+ 0: (formController) => h("justifi-business-generic-info", { formController: formController }),
19
+ 1: (formController) => h("justifi-legal-address-form", { formController: formController }),
20
+ 2: (formController) => h("justifi-additional-questions", { formController: formController }),
21
+ 3: (formController) => h("justifi-business-representative", { formController: formController })
22
+ };
21
23
  this.authToken = undefined;
22
- this.accountId = undefined;
23
24
  this.businessId = undefined;
24
25
  this.testMode = false;
26
+ this.hideErrors = false;
25
27
  this.isLoading = false;
26
28
  this.currentStep = 0;
27
29
  this.totalSteps = 4;
28
- this.serverError = undefined;
30
+ this.serverError = false;
31
+ this.errorMessage = '';
29
32
  this.sendData = this.sendData.bind(this);
30
33
  this.fetchData = this.fetchData.bind(this);
31
34
  }
35
+ get disabledState() {
36
+ return this.isLoading;
37
+ }
38
+ get showErrors() {
39
+ return this.serverError && !this.hideErrors;
40
+ }
41
+ get businessEndpoint() {
42
+ return `entities/business/${this.businessId}`;
43
+ }
32
44
  componentWillLoad() {
33
- if (!this.authToken) {
34
- console.warn('Warning: Missing auth-token. The form will not be functional without it.');
35
- }
45
+ const missingAuthTokenMessage = 'Warning: Missing auth-token. The form will not be functional without it.';
46
+ const missingBusinessIdMessage = 'Warning: Missing business-id. The form requires an existing business-id to function.';
47
+ if (!this.authToken)
48
+ console.error(missingAuthTokenMessage);
49
+ if (!this.businessId)
50
+ console.error(missingBusinessIdMessage);
36
51
  this.formController = new FormController(businessFormSchema);
37
52
  this.api = Api(this.authToken, config.proxyApiOrigin);
38
- this.totalSteps = Object.keys(componentStepMapping).length - 1;
39
- if (this.businessId) {
40
- this.fetchData(this.businessId);
41
- }
42
- else {
43
- this.formController.setInitialValues({
44
- legal_address: {
45
- country: 'US',
46
- },
47
- });
48
- }
53
+ this.totalSteps = Object.keys(this.componentStepMapping).length - 1;
54
+ this.fetchData();
49
55
  }
50
56
  handleResponse(response, onSuccess) {
51
57
  if (response.error) {
52
- this.serverError = response.error.message;
58
+ this.serverError = true;
59
+ this.errorMessage = response.error.message;
53
60
  }
54
61
  else {
55
- this.serverError = '';
62
+ this.serverError = false;
56
63
  this.businessId = response.data.id;
57
64
  this.formController.setInitialValues(response.data);
58
65
  onSuccess();
@@ -66,33 +73,31 @@ export class BusinessFormStepped {
66
73
  }
67
74
  this.isLoading = true;
68
75
  try {
69
- const data = this.formController.values.getValue();
70
- // Conditionally making either POST or PATCH request
71
- if (this.businessId) {
72
- const payload = parseForPatching(data);
73
- const response = await this.api.patch(`entities/business/${this.businessId}`, JSON.stringify(payload), { account_id: this.accountId });
74
- this.handleResponse(response, onSuccess);
75
- }
76
- else {
77
- const response = await this.api.post('entities/business', JSON.stringify(data), { account_id: this.accountId });
78
- this.handleResponse(response, onSuccess);
79
- }
76
+ const values = this.formController.values.getValue();
77
+ const initialValues = this.formController.getInitialValues();
78
+ const payload = parseForPatching(values, initialValues);
79
+ const response = await this.api.patch(this.businessEndpoint, JSON.stringify(payload));
80
+ this.handleResponse(response, onSuccess);
81
+ this.submitted.emit({ data: response.data });
80
82
  }
81
83
  catch (error) {
82
- console.error('Error sending data:', error);
84
+ this.serverError = true;
85
+ this.errorMessage = error.message;
83
86
  }
84
87
  finally {
85
88
  this.isLoading = false;
86
89
  }
87
90
  }
88
- async fetchData(businessId) {
91
+ async fetchData() {
89
92
  this.isLoading = true;
90
93
  try {
91
- const response = await this.api.get(`entities/business/${businessId}`);
92
- this.formController.setInitialValues(response.data);
94
+ const response = await this.api.get(this.businessEndpoint);
95
+ const business = new Business(response.data);
96
+ this.formController.setInitialValues(business);
93
97
  }
94
98
  catch (error) {
95
- console.error('Error fetching data:', error);
99
+ this.serverError = true;
100
+ this.errorMessage = `Error fetching data: ${error.message}`;
96
101
  }
97
102
  finally {
98
103
  this.isLoading = false;
@@ -106,22 +111,24 @@ export class BusinessFormStepped {
106
111
  return this.currentStep > 0;
107
112
  }
108
113
  previousStepButtonOnClick() {
114
+ this.clickEvent.emit({ name: ClickEvents.previousStep });
109
115
  this.sendData(() => this.currentStep--);
110
116
  }
111
117
  showNextStepButton() {
112
118
  return this.currentStep < this.totalSteps;
113
119
  }
114
- nextStepButtonOnClick() {
120
+ nextStepButtonOnClick(clickEventName) {
121
+ this.clickEvent.emit({ name: clickEventName });
115
122
  this.sendData(() => this.currentStep++);
116
123
  }
117
124
  showSubmitButton() {
118
125
  return this.currentStep === this.totalSteps;
119
126
  }
120
127
  currentStepComponent() {
121
- return componentStepMapping[this.currentStep](this.formController);
128
+ return this.componentStepMapping[this.currentStep](this.formController);
122
129
  }
123
130
  render() {
124
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("h1", null, "Business Information"), this.serverError && (h("div", { class: "alert alert-danger", role: "alert" }, this.serverError)), h("form", { onSubmit: this.validateAndSubmit }, h("div", { class: "my-4" }, this.currentStepComponent()), h("div", { class: "d-flex justify-content-between align-items-center" }, h("div", { class: "d-flex align-items-center" }, "Step ", this.currentStep + 1, " of ", this.totalSteps + 1), h("div", { class: "d-flex gap-2" }, this.showPreviousStepButton() && (h("button", { type: "button", class: "btn btn-secondary", onClick: () => this.previousStepButtonOnClick(), disabled: this.isLoading }, "Previous")), this.showNextStepButton() && (h("button", { type: "button", class: "btn btn-primary", onClick: () => this.nextStepButtonOnClick(), disabled: this.isLoading }, "Next")), this.showSubmitButton() && (h("button", { type: "submit", class: "btn btn-primary", onClick: () => this.nextStepButtonOnClick(), disabled: this.isLoading }, "Submit")))))));
131
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("h1", null, "Business Information"), this.showErrors && FormAlert(this.errorMessage), h("form", { onSubmit: this.validateAndSubmit }, h("div", { class: "my-4" }, this.currentStepComponent()), h("div", { class: "d-flex justify-content-between align-items-center" }, h("div", { class: "d-flex align-items-center" }, "Step ", this.currentStep + 1, " of ", this.totalSteps + 1), h("div", { class: "d-flex gap-2" }, this.showPreviousStepButton() && (h("button", { type: "button", class: "btn btn-secondary", onClick: () => this.previousStepButtonOnClick(), disabled: this.isLoading }, "Previous")), this.showNextStepButton() && (h("button", { type: "button", class: "btn btn-primary", onClick: () => this.nextStepButtonOnClick(ClickEvents.nextStep), disabled: this.disabledState }, "Next")), this.showSubmitButton() && (h("button", { type: "submit", class: "btn btn-primary", onClick: () => this.nextStepButtonOnClick(ClickEvents.submit), disabled: this.disabledState }, "Submit")))))));
125
132
  }
126
133
  static get is() { return "justifi-business-form-stepped"; }
127
134
  static get originalStyleUrls() {
@@ -153,7 +160,7 @@ export class BusinessFormStepped {
153
160
  "attribute": "auth-token",
154
161
  "reflect": false
155
162
  },
156
- "accountId": {
163
+ "businessId": {
157
164
  "type": "string",
158
165
  "mutable": false,
159
166
  "complexType": {
@@ -167,27 +174,28 @@ export class BusinessFormStepped {
167
174
  "tags": [],
168
175
  "text": ""
169
176
  },
170
- "attribute": "account-id",
177
+ "attribute": "business-id",
171
178
  "reflect": false
172
179
  },
173
- "businessId": {
174
- "type": "string",
180
+ "testMode": {
181
+ "type": "boolean",
175
182
  "mutable": false,
176
183
  "complexType": {
177
- "original": "string",
178
- "resolved": "string",
184
+ "original": "boolean",
185
+ "resolved": "boolean",
179
186
  "references": {}
180
187
  },
181
188
  "required": false,
182
- "optional": true,
189
+ "optional": false,
183
190
  "docs": {
184
191
  "tags": [],
185
192
  "text": ""
186
193
  },
187
- "attribute": "business-id",
188
- "reflect": false
194
+ "attribute": "test-mode",
195
+ "reflect": false,
196
+ "defaultValue": "false"
189
197
  },
190
- "testMode": {
198
+ "hideErrors": {
191
199
  "type": "boolean",
192
200
  "mutable": false,
193
201
  "complexType": {
@@ -196,12 +204,12 @@ export class BusinessFormStepped {
196
204
  "references": {}
197
205
  },
198
206
  "required": false,
199
- "optional": false,
207
+ "optional": true,
200
208
  "docs": {
201
209
  "tags": [],
202
210
  "text": ""
203
211
  },
204
- "attribute": "test-mode",
212
+ "attribute": "hide-errors",
205
213
  "reflect": false,
206
214
  "defaultValue": "false"
207
215
  }
@@ -212,7 +220,41 @@ export class BusinessFormStepped {
212
220
  "isLoading": {},
213
221
  "currentStep": {},
214
222
  "totalSteps": {},
215
- "serverError": {}
223
+ "serverError": {},
224
+ "errorMessage": {}
216
225
  };
217
226
  }
227
+ static get events() {
228
+ return [{
229
+ "method": "clickEvent",
230
+ "name": "clickEvent",
231
+ "bubbles": true,
232
+ "cancelable": true,
233
+ "composed": true,
234
+ "docs": {
235
+ "tags": [],
236
+ "text": ""
237
+ },
238
+ "complexType": {
239
+ "original": "{ data?: any, name: string }",
240
+ "resolved": "{ data?: any; name: string; }",
241
+ "references": {}
242
+ }
243
+ }, {
244
+ "method": "submitted",
245
+ "name": "submitted",
246
+ "bubbles": true,
247
+ "cancelable": true,
248
+ "composed": true,
249
+ "docs": {
250
+ "tags": [],
251
+ "text": ""
252
+ },
253
+ "complexType": {
254
+ "original": "{ data: any }",
255
+ "resolved": "{ data: any; }",
256
+ "references": {}
257
+ }
258
+ }];
259
+ }
218
260
  }
@@ -7727,6 +7727,101 @@ progress {
7727
7727
  display: none !important;
7728
7728
  }
7729
7729
  }
7730
+ .alert {
7731
+ --bs-alert-bg: transparent;
7732
+ --bs-alert-padding-x: 1rem;
7733
+ --bs-alert-padding-y: 1rem;
7734
+ --bs-alert-margin-bottom: 1rem;
7735
+ --bs-alert-color: inherit;
7736
+ --bs-alert-border-color: transparent;
7737
+ --bs-alert-border: var(--bs-border-width) solid var(--bs-alert-border-color);
7738
+ --bs-alert-border-radius: var(--bs-border-radius);
7739
+ --bs-alert-link-color: inherit;
7740
+ position: relative;
7741
+ padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x);
7742
+ margin-bottom: var(--bs-alert-margin-bottom);
7743
+ color: var(--bs-alert-color);
7744
+ background-color: var(--bs-alert-bg);
7745
+ border: var(--bs-alert-border);
7746
+ border-radius: var(--bs-alert-border-radius);
7747
+ }
7748
+
7749
+ .alert-heading {
7750
+ color: inherit;
7751
+ }
7752
+
7753
+ .alert-link {
7754
+ font-weight: 700;
7755
+ color: var(--bs-alert-link-color);
7756
+ }
7757
+
7758
+ .alert-dismissible {
7759
+ padding-right: 3rem;
7760
+ }
7761
+ .alert-dismissible .btn-close {
7762
+ position: absolute;
7763
+ top: 0;
7764
+ right: 0;
7765
+ z-index: 2;
7766
+ padding: 1.25rem 1rem;
7767
+ }
7768
+
7769
+ .alert-primary {
7770
+ --bs-alert-color: var(--bs-primary-text-emphasis);
7771
+ --bs-alert-bg: var(--bs-primary-bg-subtle);
7772
+ --bs-alert-border-color: var(--bs-primary-border-subtle);
7773
+ --bs-alert-link-color: var(--bs-primary-text-emphasis);
7774
+ }
7775
+
7776
+ .alert-secondary {
7777
+ --bs-alert-color: var(--bs-secondary-text-emphasis);
7778
+ --bs-alert-bg: var(--bs-secondary-bg-subtle);
7779
+ --bs-alert-border-color: var(--bs-secondary-border-subtle);
7780
+ --bs-alert-link-color: var(--bs-secondary-text-emphasis);
7781
+ }
7782
+
7783
+ .alert-success {
7784
+ --bs-alert-color: var(--bs-success-text-emphasis);
7785
+ --bs-alert-bg: var(--bs-success-bg-subtle);
7786
+ --bs-alert-border-color: var(--bs-success-border-subtle);
7787
+ --bs-alert-link-color: var(--bs-success-text-emphasis);
7788
+ }
7789
+
7790
+ .alert-info {
7791
+ --bs-alert-color: var(--bs-info-text-emphasis);
7792
+ --bs-alert-bg: var(--bs-info-bg-subtle);
7793
+ --bs-alert-border-color: var(--bs-info-border-subtle);
7794
+ --bs-alert-link-color: var(--bs-info-text-emphasis);
7795
+ }
7796
+
7797
+ .alert-warning {
7798
+ --bs-alert-color: var(--bs-warning-text-emphasis);
7799
+ --bs-alert-bg: var(--bs-warning-bg-subtle);
7800
+ --bs-alert-border-color: var(--bs-warning-border-subtle);
7801
+ --bs-alert-link-color: var(--bs-warning-text-emphasis);
7802
+ }
7803
+
7804
+ .alert-danger {
7805
+ --bs-alert-color: var(--bs-danger-text-emphasis);
7806
+ --bs-alert-bg: var(--bs-danger-bg-subtle);
7807
+ --bs-alert-border-color: var(--bs-danger-border-subtle);
7808
+ --bs-alert-link-color: var(--bs-danger-text-emphasis);
7809
+ }
7810
+
7811
+ .alert-light {
7812
+ --bs-alert-color: var(--bs-light-text-emphasis);
7813
+ --bs-alert-bg: var(--bs-light-bg-subtle);
7814
+ --bs-alert-border-color: var(--bs-light-border-subtle);
7815
+ --bs-alert-link-color: var(--bs-light-text-emphasis);
7816
+ }
7817
+
7818
+ .alert-dark {
7819
+ --bs-alert-color: var(--bs-dark-text-emphasis);
7820
+ --bs-alert-bg: var(--bs-dark-bg-subtle);
7821
+ --bs-alert-border-color: var(--bs-dark-border-subtle);
7822
+ --bs-alert-link-color: var(--bs-dark-text-emphasis);
7823
+ }
7824
+
7730
7825
  :host {
7731
7826
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
7732
7827
  font-size: 1rem;
@@ -4,66 +4,73 @@ import businessFormSchema from "./business-form-schema";
4
4
  import { Api } from "../../api";
5
5
  import { parseForPatching } from "./helpers";
6
6
  import { config } from "../../../config";
7
+ import { FormAlert } from "../form/utils";
8
+ import { ClickEvents } from "./BusinessFormEventTypes";
9
+ import { Business } from "../../api/Business";
7
10
  /**
8
11
  * @exportedPart label: Label for inputs
9
12
  * @exportedPart input: The input fields
10
13
  * @exportedPart input-invalid: Invalid state for inputfs
11
14
  */
12
15
  export class BusinessForm {
16
+ get disabledState() {
17
+ return this.isLoading;
18
+ }
19
+ get showErrors() {
20
+ return this.serverError && !this.hideErrors;
21
+ }
22
+ get businessEndpoint() {
23
+ return `entities/business/${this.businessId}`;
24
+ }
13
25
  constructor() {
14
26
  this.authToken = undefined;
15
27
  this.businessId = undefined;
28
+ this.hideErrors = false;
16
29
  this.isLoading = false;
30
+ this.serverError = false;
31
+ this.errorMessage = '';
17
32
  this.sendData = this.sendData.bind(this);
18
33
  this.fetchData = this.fetchData.bind(this);
34
+ this.validateAndSubmit = this.validateAndSubmit.bind(this);
19
35
  }
20
36
  componentWillLoad() {
21
- if (!this.authToken) {
22
- console.warn('Warning: Missing auth-token. The form will not be functional without it.');
23
- }
37
+ const missingAuthTokenMessage = 'Warning: Missing auth-token. The form will not be functional without it.';
38
+ const missingBusinessIdMessage = 'Warning: Missing business-id. The form requires an existing business-id to function.';
39
+ if (!this.authToken)
40
+ console.error(missingAuthTokenMessage);
41
+ if (!this.businessId)
42
+ console.error(missingBusinessIdMessage);
24
43
  this.formController = new FormController(businessFormSchema);
25
44
  this.api = Api(this.authToken, config.proxyApiOrigin);
26
- if (this.businessId) {
27
- this.fetchData(this.businessId);
28
- }
29
- else {
30
- this.formController.setInitialValues({
31
- legal_address: {
32
- country: 'US',
33
- },
34
- });
35
- }
45
+ this.fetchData();
36
46
  }
37
47
  async sendData() {
38
48
  this.isLoading = true;
39
49
  try {
40
- const data = this.formController.values.getValue();
41
- // Conditionally making either POST or PATCH request
42
- if (this.businessId) {
43
- const payload = parseForPatching(data);
44
- const response = await this.api.patch(`entities/business/${this.businessId}`, JSON.stringify(payload));
45
- console.log('Server response from PATCH:', response);
46
- }
47
- else {
48
- const response = await this.api.post('entities/business', JSON.stringify(data));
49
- console.log('Server response from POST:', response);
50
- }
50
+ const values = this.formController.values.getValue();
51
+ const initialValues = this.formController.getInitialValues();
52
+ const payload = parseForPatching(values, initialValues);
53
+ const response = await this.api.patch(this.businessEndpoint, JSON.stringify(payload));
54
+ this.submitted.emit({ data: response });
51
55
  }
52
56
  catch (error) {
53
- console.error('Error sending data:', error);
57
+ this.serverError = true;
58
+ this.errorMessage = error.message;
54
59
  }
55
60
  finally {
56
61
  this.isLoading = false;
57
62
  }
58
63
  }
59
- async fetchData(businessId) {
64
+ async fetchData() {
60
65
  this.isLoading = true;
61
66
  try {
62
- const response = await this.api.get(`entities/business/${businessId}`);
63
- this.formController.setInitialValues(response.data);
67
+ const response = await this.api.get(this.businessEndpoint);
68
+ const business = new Business(response.data);
69
+ this.formController.setInitialValues(business);
64
70
  }
65
71
  catch (error) {
66
- console.error('Error fetching data:', error);
72
+ this.serverError = true;
73
+ this.errorMessage = `Error fetching data: ${error.message}`;
67
74
  }
68
75
  finally {
69
76
  this.isLoading = false;
@@ -74,7 +81,7 @@ export class BusinessForm {
74
81
  this.formController.validateAndSubmit(this.sendData);
75
82
  }
76
83
  render() {
77
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", { onSubmit: event => this.validateAndSubmit(event) }, h("div", { class: "row gap-3" }, h("div", { class: "col-12 mb-4" }, h("h1", null, "Business Information")), h("div", { class: "col-12 mb-4" }, h("justifi-business-generic-info", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-legal-address-form", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-additional-questions", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-business-representative", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-business-owners", { isEditing: !!this.businessId, formController: this.formController })), h("div", { class: "col-12 d-flex flex-row-reverse" }, h("button", { type: "submit", class: "btn btn-primary jfi-submit-button", disabled: !this.authToken || this.isLoading }, this.isLoading ? 'Loading...' : 'Submit'))))));
84
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", { onSubmit: this.validateAndSubmit }, h("div", { class: "row gap-3" }, h("div", { class: "col-12 mb-4" }, h("h1", null, "Business Information")), this.showErrors && FormAlert(this.errorMessage), h("div", { class: "col-12 mb-4" }, h("justifi-business-generic-info", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-legal-address-form", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-additional-questions", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-business-representative", { formController: this.formController })), h("div", { class: "col-12 d-flex flex-row-reverse" }, h("button", { type: "submit", class: "btn btn-primary jfi-submit-button", disabled: this.disabledState, onClick: () => this.clickEvent.emit({ name: ClickEvents.submit }) }, this.isLoading ? 'Loading...' : 'Submit'))))));
78
85
  }
79
86
  static get is() { return "justifi-business-form"; }
80
87
  static get originalStyleUrls() {
@@ -115,19 +122,72 @@ export class BusinessForm {
115
122
  "references": {}
116
123
  },
117
124
  "required": false,
118
- "optional": true,
125
+ "optional": false,
119
126
  "docs": {
120
127
  "tags": [],
121
128
  "text": ""
122
129
  },
123
130
  "attribute": "business-id",
124
131
  "reflect": false
132
+ },
133
+ "hideErrors": {
134
+ "type": "boolean",
135
+ "mutable": false,
136
+ "complexType": {
137
+ "original": "boolean",
138
+ "resolved": "boolean",
139
+ "references": {}
140
+ },
141
+ "required": false,
142
+ "optional": true,
143
+ "docs": {
144
+ "tags": [],
145
+ "text": ""
146
+ },
147
+ "attribute": "hide-errors",
148
+ "reflect": false,
149
+ "defaultValue": "false"
125
150
  }
126
151
  };
127
152
  }
128
153
  static get states() {
129
154
  return {
130
- "isLoading": {}
155
+ "isLoading": {},
156
+ "serverError": {},
157
+ "errorMessage": {}
131
158
  };
132
159
  }
160
+ static get events() {
161
+ return [{
162
+ "method": "clickEvent",
163
+ "name": "clickEvent",
164
+ "bubbles": true,
165
+ "cancelable": true,
166
+ "composed": true,
167
+ "docs": {
168
+ "tags": [],
169
+ "text": ""
170
+ },
171
+ "complexType": {
172
+ "original": "{ data?: any, name: string }",
173
+ "resolved": "{ data?: any; name: string; }",
174
+ "references": {}
175
+ }
176
+ }, {
177
+ "method": "submitted",
178
+ "name": "submitted",
179
+ "bubbles": true,
180
+ "cancelable": true,
181
+ "composed": true,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": ""
185
+ },
186
+ "complexType": {
187
+ "original": "{ data: any }",
188
+ "resolved": "{ data: any; }",
189
+ "references": {}
190
+ }
191
+ }];
192
+ }
133
193
  }
@@ -1,6 +1,7 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { BusinessStructureOptions, BusinessTypeOptions, } from "../business-form-schema";
3
- import { PHONE_MASKS } from "../../../utils/phone-masks";
3
+ import { PHONE_MASKS, TAX_ID_MASKS } from "../../../utils/form-input-masks";
4
+ import { CoreBusinessInfo } from "../../../api/Business";
4
5
  /**
5
6
  *
6
7
  * The difference between this component and business-generic-info-details
@@ -15,9 +16,11 @@ export class BusinessGenericInfo {
15
16
  constructor() {
16
17
  this.formController = undefined;
17
18
  this.errors = {};
19
+ this.genericInfo = {};
18
20
  this.inputHandler = this.inputHandler.bind(this);
19
21
  }
20
22
  componentDidLoad() {
23
+ this.formController.values.subscribe(values => (this.genericInfo = Object.assign({}, new CoreBusinessInfo(values))));
21
24
  this.formController.errors.subscribe(errors => {
22
25
  this.errors = Object.assign({}, errors);
23
26
  });
@@ -27,7 +30,7 @@ export class BusinessGenericInfo {
27
30
  }
28
31
  render() {
29
32
  const genericInfoDefaultValue = this.formController.getInitialValues();
30
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "General Info"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "legal_name", label: "Legal Name", defaultValue: genericInfoDefaultValue.legal_name, error: this.errors.legal_name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "doing_business_as", label: "Doing Business As (DBA)", defaultValue: genericInfoDefaultValue.doing_business_as, error: this.errors.doing_business_as, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-select", { name: "business_type", label: "Business Type", options: BusinessTypeOptions, defaultValue: genericInfoDefaultValue.business_type, error: this.errors.business_type, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-select", { name: "business_structure", label: "Business Structure", options: BusinessStructureOptions, defaultValue: genericInfoDefaultValue.business_structure, error: this.errors.business_structure, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-text", { name: "industry", label: "Industry", defaultValue: genericInfoDefaultValue.industry, error: this.errors.business_structure, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-number", { name: "tax_id", label: "Tax ID", defaultValue: genericInfoDefaultValue.tax_id, error: this.errors.tax_id, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-text", { name: "website_url", label: "Website URL", defaultValue: genericInfoDefaultValue.website_url, error: this.errors.website_url, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: genericInfoDefaultValue.email, error: this.errors.email, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-number-masked", { name: "phone", label: "Phone Number", defaultValue: genericInfoDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US }))))));
33
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "General Info"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "legal_name", label: "Legal Name", defaultValue: genericInfoDefaultValue.legal_name, error: this.errors.legal_name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "doing_business_as", label: "Doing Business As (DBA)", defaultValue: genericInfoDefaultValue.doing_business_as, error: this.errors.doing_business_as, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-select", { name: "business_type", label: "Business Type", options: BusinessTypeOptions, defaultValue: genericInfoDefaultValue.business_type, error: this.errors.business_type, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-select", { name: "business_structure", label: "Business Structure", options: BusinessStructureOptions, defaultValue: genericInfoDefaultValue.business_structure, error: this.errors.business_structure, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-text", { name: "industry", label: "Industry", defaultValue: genericInfoDefaultValue.industry, error: this.errors.business_structure, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-number-masked", { name: "tax_id", label: "Tax ID", defaultValue: genericInfoDefaultValue.tax_id, error: this.errors.tax_id, inputHandler: this.inputHandler, mask: TAX_ID_MASKS.US })), h("div", { class: "col-12" }, h("form-control-text", { name: "website_url", label: "Website URL", defaultValue: genericInfoDefaultValue.website_url, error: this.errors.website_url, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: genericInfoDefaultValue.email, error: this.errors.email, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-number-masked", { name: "phone", label: "Phone Number", defaultValue: genericInfoDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US }))))));
31
34
  }
32
35
  static get is() { return "justifi-business-generic-info"; }
33
36
  static get originalStyleUrls() {
@@ -67,7 +70,8 @@ export class BusinessGenericInfo {
67
70
  }
68
71
  static get states() {
69
72
  return {
70
- "errors": {}
73
+ "errors": {},
74
+ "genericInfo": {}
71
75
  };
72
76
  }
73
77
  }