@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
@@ -1,4 +1,5 @@
1
1
  import { Host, h } from "@stencil/core";
2
+ import { Business } from "../../api/Business";
2
3
  import { Api } from "../../api";
3
4
  import { ErrorState, LoadingState } from "../details/utils";
4
5
  import { config } from "../../../config";
@@ -49,7 +50,7 @@ export class BusinessDetails {
49
50
  this.renderState = RENDER_STATES.ERROR;
50
51
  return;
51
52
  }
52
- this.business = response.data;
53
+ this.business = new Business(response.data);
53
54
  this.renderState = RENDER_STATES.READY;
54
55
  }
55
56
  catch (error) {
@@ -62,14 +63,13 @@ export class BusinessDetails {
62
63
  }
63
64
  }
64
65
  render() {
65
- var _a, _b, _c;
66
66
  if (this.renderState === RENDER_STATES.LOADING) {
67
67
  return h(Host, null, LoadingState);
68
68
  }
69
69
  if (this.renderState === RENDER_STATES.ERROR) {
70
70
  return h(Host, null, ErrorState(this.errorMessage));
71
71
  }
72
- return (h(Host, null, h("generic-info-details", { business: this.business }), h("legal-address-details", { legalAddress: (_a = this.business) === null || _a === void 0 ? void 0 : _a.legal_address }), h("representative-details", { representative: (_b = this.business) === null || _b === void 0 ? void 0 : _b.representative }), h("owner-details", { owners: (_c = this.business) === null || _c === void 0 ? void 0 : _c.owners }), h("additional-questions-details", { business: this.business })));
72
+ return (h(Host, null, h("generic-info-details", { business: this.business }), h("legal-address-details", { legalAddress: this.business.legal_address }), h("representative-details", { representative: this.business.representative }), h("owner-details", { owners: this.business.owners }), h("additional-questions-details", { additionalQuestions: this.business.additional_questions })));
73
73
  }
74
74
  static get is() { return "justifi-business-details"; }
75
75
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,6 @@
1
+ export var ClickEvents;
2
+ (function (ClickEvents) {
3
+ ClickEvents["nextStep"] = "nextStep";
4
+ ClickEvents["previousStep"] = "previousStep";
5
+ ClickEvents["submit"] = "submit";
6
+ })(ClickEvents || (ClickEvents = {}));
@@ -2,7 +2,7 @@ import { object, string } from "yup";
2
2
  export const RegExZip = /^\d{5}/;
3
3
  const BusinessAddressFormSchema = object({
4
4
  line1: string().required('Enter street address'),
5
- line2: string(),
5
+ line2: string().nullable(),
6
6
  city: string().required('Enter city'),
7
7
  state: string().required('Choose state'),
8
8
  postal_code: string()
@@ -1,4 +1,4 @@
1
- import { array, boolean, object, string } from "yup";
1
+ import { object, string } from "yup";
2
2
  import legalAddressSchema from "./legal-address-form/legal-address-form-schema";
3
3
  export const RegExZip = /^\d{5}/;
4
4
  export class Business {
@@ -135,25 +135,25 @@ const representativeSchema = object({
135
135
  identification_number: string(),
136
136
  address: addressSchema,
137
137
  });
138
- const ownerSchema = object({
139
- name: string().required('Enter owner name'),
140
- title: string().required('Enter owner title'),
141
- email: string()
142
- .email('Enter valid owner email')
143
- .required('Enter owner email'),
144
- phone: string().required('Enter owner phone number'),
145
- dob_day: string().required('Enter owner birth day'),
146
- dob_month: string().required('Enter owner birth month'),
147
- dob_year: string().required('Enter owner birth year'),
148
- identification_number: string(),
149
- is_owner: boolean(),
150
- address: addressSchema,
151
- });
138
+ // const ownerSchema = object({
139
+ // name: string().required('Enter owner name'),
140
+ // title: string().required('Enter owner title'),
141
+ // email: string()
142
+ // .email('Enter valid owner email')
143
+ // .required('Enter owner email'),
144
+ // phone: string().required('Enter owner phone number'),
145
+ // dob_day: string().required('Enter owner birth day'),
146
+ // dob_month: string().required('Enter owner birth month'),
147
+ // dob_year: string().required('Enter owner birth year'),
148
+ // identification_number: string(),
149
+ // is_owner: boolean(),
150
+ // address: addressSchema,
151
+ // });
152
152
  const additionQuestionsSchema = object({
153
153
  business_revenue: string().required('Enter business revenue'),
154
154
  business_payment_volume: string().required('Enter business payment volume'),
155
155
  business_dispute_volume: string().required('Enter business dispute volume'),
156
156
  business_receivable_volume: string().required('Enter business receivable volume'),
157
157
  });
158
- const businessFormSchema = object(Object.assign(Object.assign({}, businessGenericInfoSchema.fields), { legal_address: legalAddressSchema.required('Enater legal address'), additional_questions: additionQuestionsSchema.required('Enter additional questions'), representative: representativeSchema.required('Enter representative information'), owners: array().of(ownerSchema).min(1, 'Enter at least 1 owners') }));
158
+ const businessFormSchema = object(Object.assign(Object.assign({}, businessGenericInfoSchema.fields), { legal_address: legalAddressSchema, additional_questions: additionQuestionsSchema, representative: representativeSchema }));
159
159
  export default businessFormSchema;
@@ -5,33 +5,25 @@ import { Api } from "../../api";
5
5
  import { parseForPatching } from "./helpers";
6
6
  import { config } from "../../../config";
7
7
  import { FormAlert } from "../form/utils";
8
- const componentStepMapping = {
9
- 0: (formController) => h("justifi-business-generic-info", { formController: formController }),
10
- 1: (formController) => h("justifi-legal-address-form", { formController: formController }),
11
- 2: (formController) => h("justifi-additional-questions", { formController: formController }),
12
- 3: (formController) => h("justifi-business-representative", { formController: formController }),
13
- 4: (formController) => h("justifi-business-owners", { formController: formController })
14
- };
8
+ import { ClickEvents } from "./BusinessFormEventTypes";
9
+ import { Business } from "../../api/Business";
15
10
  /**
16
11
  * @exportedPart label: Label for inputs
17
12
  * @exportedPart input: The input fields
18
13
  * @exportedPart input-invalid: Invalid state for inputfs
19
14
  */
20
15
  export class BusinessFormStepped {
21
- get submitDisabled() {
22
- return !this.authToken || this.isLoading || this.serverError;
23
- }
24
- get nextDisabled() {
25
- return !this.authToken || this.isLoading || this.serverError;
26
- }
27
- get showErrors() {
28
- return this.serverError && !this.hideErrors;
29
- }
30
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
+ };
31
23
  this.authToken = undefined;
32
24
  this.businessId = undefined;
33
25
  this.testMode = false;
34
- this.hideErrors = undefined;
26
+ this.hideErrors = false;
35
27
  this.isLoading = false;
36
28
  this.currentStep = 0;
37
29
  this.totalSteps = 4;
@@ -40,23 +32,26 @@ export class BusinessFormStepped {
40
32
  this.sendData = this.sendData.bind(this);
41
33
  this.fetchData = this.fetchData.bind(this);
42
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
+ }
43
44
  componentWillLoad() {
44
- if (!this.authToken) {
45
- console.warn('Warning: Missing auth-token. The form will not be functional without it.');
46
- }
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);
47
51
  this.formController = new FormController(businessFormSchema);
48
52
  this.api = Api(this.authToken, config.proxyApiOrigin);
49
- this.totalSteps = Object.keys(componentStepMapping).length - 1;
50
- if (this.businessId) {
51
- this.fetchData(this.businessId);
52
- }
53
- else {
54
- this.formController.setInitialValues({
55
- legal_address: {
56
- country: 'US',
57
- },
58
- });
59
- }
53
+ this.totalSteps = Object.keys(this.componentStepMapping).length - 1;
54
+ this.fetchData();
60
55
  }
61
56
  handleResponse(response, onSuccess) {
62
57
  if (response.error) {
@@ -78,17 +73,12 @@ export class BusinessFormStepped {
78
73
  }
79
74
  this.isLoading = true;
80
75
  try {
81
- const data = this.formController.values.getValue();
82
- // Conditionally making either POST or PATCH request
83
- if (this.businessId) {
84
- const payload = parseForPatching(data);
85
- const response = await this.api.patch(`entities/business/${this.businessId}`, JSON.stringify(payload));
86
- this.handleResponse(response, onSuccess);
87
- }
88
- else {
89
- const response = await this.api.post('entities/business', JSON.stringify(data));
90
- this.handleResponse(response, onSuccess);
91
- }
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 });
92
82
  }
93
83
  catch (error) {
94
84
  this.serverError = true;
@@ -98,11 +88,12 @@ export class BusinessFormStepped {
98
88
  this.isLoading = false;
99
89
  }
100
90
  }
101
- async fetchData(businessId) {
91
+ async fetchData() {
102
92
  this.isLoading = true;
103
93
  try {
104
- const response = await this.api.get(`entities/business/${businessId}`);
105
- 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);
106
97
  }
107
98
  catch (error) {
108
99
  this.serverError = true;
@@ -120,22 +111,24 @@ export class BusinessFormStepped {
120
111
  return this.currentStep > 0;
121
112
  }
122
113
  previousStepButtonOnClick() {
114
+ this.clickEvent.emit({ name: ClickEvents.previousStep });
123
115
  this.sendData(() => this.currentStep--);
124
116
  }
125
117
  showNextStepButton() {
126
118
  return this.currentStep < this.totalSteps;
127
119
  }
128
- nextStepButtonOnClick() {
120
+ nextStepButtonOnClick(clickEventName) {
121
+ this.clickEvent.emit({ name: clickEventName });
129
122
  this.sendData(() => this.currentStep++);
130
123
  }
131
124
  showSubmitButton() {
132
125
  return this.currentStep === this.totalSteps;
133
126
  }
134
127
  currentStepComponent() {
135
- return componentStepMapping[this.currentStep](this.formController);
128
+ return this.componentStepMapping[this.currentStep](this.formController);
136
129
  }
137
130
  render() {
138
- 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(), disabled: this.nextDisabled }, "Next")), this.showSubmitButton() && (h("button", { type: "submit", class: "btn btn-primary", onClick: () => this.nextStepButtonOnClick(), disabled: this.submitDisabled }, "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")))))));
139
132
  }
140
133
  static get is() { return "justifi-business-form-stepped"; }
141
134
  static get originalStyleUrls() {
@@ -176,7 +169,7 @@ export class BusinessFormStepped {
176
169
  "references": {}
177
170
  },
178
171
  "required": false,
179
- "optional": true,
172
+ "optional": false,
180
173
  "docs": {
181
174
  "tags": [],
182
175
  "text": ""
@@ -217,7 +210,8 @@ export class BusinessFormStepped {
217
210
  "text": ""
218
211
  },
219
212
  "attribute": "hide-errors",
220
- "reflect": false
213
+ "reflect": false,
214
+ "defaultValue": "false"
221
215
  }
222
216
  };
223
217
  }
@@ -230,4 +224,37 @@ export class BusinessFormStepped {
230
224
  "errorMessage": {}
231
225
  };
232
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
+ }
233
260
  }
@@ -5,59 +5,53 @@ import { Api } from "../../api";
5
5
  import { parseForPatching } from "./helpers";
6
6
  import { config } from "../../../config";
7
7
  import { FormAlert } from "../form/utils";
8
+ import { ClickEvents } from "./BusinessFormEventTypes";
9
+ import { Business } from "../../api/Business";
8
10
  /**
9
11
  * @exportedPart label: Label for inputs
10
12
  * @exportedPart input: The input fields
11
13
  * @exportedPart input-invalid: Invalid state for inputfs
12
14
  */
13
15
  export class BusinessForm {
14
- get submitDisabled() {
15
- return !this.authToken || this.isLoading || this.serverError;
16
+ get disabledState() {
17
+ return this.isLoading;
16
18
  }
17
19
  get showErrors() {
18
20
  return this.serverError && !this.hideErrors;
19
21
  }
22
+ get businessEndpoint() {
23
+ return `entities/business/${this.businessId}`;
24
+ }
20
25
  constructor() {
21
26
  this.authToken = undefined;
22
27
  this.businessId = undefined;
23
- this.hideErrors = undefined;
28
+ this.hideErrors = false;
24
29
  this.isLoading = false;
25
30
  this.serverError = false;
26
31
  this.errorMessage = '';
27
32
  this.sendData = this.sendData.bind(this);
28
33
  this.fetchData = this.fetchData.bind(this);
34
+ this.validateAndSubmit = this.validateAndSubmit.bind(this);
29
35
  }
30
36
  componentWillLoad() {
31
- if (!this.authToken) {
32
- console.warn('Warning: Missing auth-token. The form will not be functional without it.');
33
- }
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);
34
43
  this.formController = new FormController(businessFormSchema);
35
44
  this.api = Api(this.authToken, config.proxyApiOrigin);
36
- if (this.businessId) {
37
- this.fetchData(this.businessId);
38
- }
39
- else {
40
- this.formController.setInitialValues({
41
- legal_address: {
42
- country: 'US',
43
- },
44
- });
45
- }
45
+ this.fetchData();
46
46
  }
47
47
  async sendData() {
48
48
  this.isLoading = true;
49
49
  try {
50
- const data = this.formController.values.getValue();
51
- // Conditionally making either POST or PATCH request
52
- if (this.businessId) {
53
- const payload = parseForPatching(data);
54
- const response = await this.api.patch(`entities/business/${this.businessId}`, JSON.stringify(payload));
55
- console.log('Server response from PATCH:', response);
56
- }
57
- else {
58
- const response = await this.api.post('entities/business', JSON.stringify(data));
59
- console.log('Server response from POST:', response);
60
- }
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 });
61
55
  }
62
56
  catch (error) {
63
57
  this.serverError = true;
@@ -67,11 +61,12 @@ export class BusinessForm {
67
61
  this.isLoading = false;
68
62
  }
69
63
  }
70
- async fetchData(businessId) {
64
+ async fetchData() {
71
65
  this.isLoading = true;
72
66
  try {
73
- const response = await this.api.get(`entities/business/${businessId}`);
74
- 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);
75
70
  }
76
71
  catch (error) {
77
72
  this.serverError = true;
@@ -86,7 +81,7 @@ export class BusinessForm {
86
81
  this.formController.validateAndSubmit(this.sendData);
87
82
  }
88
83
  render() {
89
- 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")), 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 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.submitDisabled }, 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'))))));
90
85
  }
91
86
  static get is() { return "justifi-business-form"; }
92
87
  static get originalStyleUrls() {
@@ -127,7 +122,7 @@ export class BusinessForm {
127
122
  "references": {}
128
123
  },
129
124
  "required": false,
130
- "optional": true,
125
+ "optional": false,
131
126
  "docs": {
132
127
  "tags": [],
133
128
  "text": ""
@@ -150,7 +145,8 @@ export class BusinessForm {
150
145
  "text": ""
151
146
  },
152
147
  "attribute": "hide-errors",
153
- "reflect": false
148
+ "reflect": false,
149
+ "defaultValue": "false"
154
150
  }
155
151
  };
156
152
  }
@@ -161,4 +157,37 @@ export class BusinessForm {
161
157
  "errorMessage": {}
162
158
  };
163
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
+ }
164
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
  }
@@ -1,5 +1,5 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { PHONE_MASKS } from "../../../utils/phone-masks";
2
+ import { PHONE_MASKS } from "../../../utils/form-input-masks";
3
3
  class BusinessOwner {
4
4
  constructor() {
5
5
  this.name = '';
@@ -21,9 +21,11 @@ class BusinessOwner {
21
21
  * @exportedPart input-invalid: Invalid state for inputfs
22
22
  */
23
23
  export class BusinessOwners {
24
+ get disabledState() {
25
+ return !!this.formController.getInitialValues().owners && !!this.formController.getInitialValues().owners.length;
26
+ }
24
27
  constructor() {
25
28
  this.formController = undefined;
26
- this.isEditing = undefined;
27
29
  this.errors = [];
28
30
  this.owners = [];
29
31
  this.inputHandler = this.inputHandler.bind(this);
@@ -64,8 +66,8 @@ export class BusinessOwners {
64
66
  const ownersDefaultValue = this.formController.values.getValue().owners || [];
65
67
  return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "Owners"), h("hr", null), this.owners.map((_owner, index) => {
66
68
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
67
- return (h("div", { class: "row gx-2 gy-2 mb-4" }, h("div", { class: "col-12" }, h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: (_a = ownersDefaultValue[index]) === null || _a === void 0 ? void 0 : _a.name, error: (_b = this.errors[index]) === null || _b === void 0 ? void 0 : _b.name, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.isEditing })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "title", label: "Title", defaultValue: (_c = ownersDefaultValue[index]) === null || _c === void 0 ? void 0 : _c.title, error: (_d = this.errors[index]) === null || _d === void 0 ? void 0 : _d.title, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.isEditing }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email", defaultValue: (_e = ownersDefaultValue[index]) === null || _e === void 0 ? void 0 : _e.email, error: (_f = this.errors[index]) === null || _f === void 0 ? void 0 : _f.email, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.isEditing })), h("div", { class: "col-12 col-md-6" }, h("form-control-number-masked", { name: "phone", label: "Phone", defaultValue: (_g = ownersDefaultValue[index]) === null || _g === void 0 ? void 0 : _g.phone, error: (_h = this.errors[index]) === null || _h === void 0 ? void 0 : _h.phone, inputHandler: (name, value) => this.inputHandler(name, value, index), mask: PHONE_MASKS.US, disabled: this.isEditing }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_day", label: "Date of Birth - Day", defaultValue: (_j = ownersDefaultValue[index]) === null || _j === void 0 ? void 0 : _j.dob_day, error: (_k = this.errors[index]) === null || _k === void 0 ? void 0 : _k.dob_day, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "day", disabled: this.isEditing })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_month", label: "Date of Birth - Month", defaultValue: (_l = ownersDefaultValue[index]) === null || _l === void 0 ? void 0 : _l.dob_month, error: (_m = this.errors[index]) === null || _m === void 0 ? void 0 : _m.dob_month, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "month", disabled: this.isEditing })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_year", label: "Date of Birth - Year", defaultValue: (_o = ownersDefaultValue[index]) === null || _o === void 0 ? void 0 : _o.dob_year, error: (_p = this.errors[index]) === null || _p === void 0 ? void 0 : _p.dob_year, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "year", disabled: this.isEditing }))), h("div", { class: "mb-3" }, h("form-control-number", { name: "identification_number", label: "Identification Number", defaultValue: (_q = ownersDefaultValue[index]) === null || _q === void 0 ? void 0 : _q.identification_number, error: (_r = this.errors[index]) === null || _r === void 0 ? void 0 : _r.identification_number, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.isEditing })), h("div", { class: "grid gap-3" }, h("legend", { class: "mb-3" }, "Owner Address:"), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "line1", label: "Street Address", defaultValue: (_t = (_s = ownersDefaultValue[index]) === null || _s === void 0 ? void 0 : _s.address) === null || _t === void 0 ? void 0 : _t.line1, error: (_v = (_u = this.errors[index]) === null || _u === void 0 ? void 0 : _u.address) === null || _v === void 0 ? void 0 : _v.line1, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.isEditing })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "city", label: "City", defaultValue: (_x = (_w = ownersDefaultValue[index]) === null || _w === void 0 ? void 0 : _w.address) === null || _x === void 0 ? void 0 : _x.city, error: (_z = (_y = this.errors[index]) === null || _y === void 0 ? void 0 : _y.address) === null || _z === void 0 ? void 0 : _z.city, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.isEditing }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "state", label: "State", defaultValue: (_1 = (_0 = ownersDefaultValue[index]) === null || _0 === void 0 ? void 0 : _0.address) === null || _1 === void 0 ? void 0 : _1.state, error: (_3 = (_2 = this.errors[index]) === null || _2 === void 0 ? void 0 : _2.address) === null || _3 === void 0 ? void 0 : _3.state, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.isEditing })), h("div", { class: "col-12 col-md-6" }, h("form-control-number", { name: "postal_code", label: "Postal Code", defaultValue: (_5 = (_4 = ownersDefaultValue[index]) === null || _4 === void 0 ? void 0 : _4.address) === null || _5 === void 0 ? void 0 : _5.postal_code, error: (_7 = (_6 = this.errors[index]) === null || _6 === void 0 ? void 0 : _6.address) === null || _7 === void 0 ? void 0 : _7.postal_code, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.isEditing })))), h("button", { type: "button", class: "btn btn-outline-danger", onClick: event => this.removeOwner(event, index) }, "Remove owner"))));
68
- }), h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("button", { type: "button", class: "btn btn-outline-primary", onClick: event => this.addOwner(event) }, "Add an owner"))))));
69
+ return (h("div", { class: "row gx-2 gy-2 mb-4" }, h("div", { class: "col-12" }, h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: (_a = ownersDefaultValue[index]) === null || _a === void 0 ? void 0 : _a.name, error: (_b = this.errors[index]) === null || _b === void 0 ? void 0 : _b.name, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "title", label: "Title", defaultValue: (_c = ownersDefaultValue[index]) === null || _c === void 0 ? void 0 : _c.title, error: (_d = this.errors[index]) === null || _d === void 0 ? void 0 : _d.title, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.disabledState }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email", defaultValue: (_e = ownersDefaultValue[index]) === null || _e === void 0 ? void 0 : _e.email, error: (_f = this.errors[index]) === null || _f === void 0 ? void 0 : _f.email, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "col-12 col-md-6" }, h("form-control-number-masked", { name: "phone", label: "Phone", defaultValue: (_g = ownersDefaultValue[index]) === null || _g === void 0 ? void 0 : _g.phone, error: (_h = this.errors[index]) === null || _h === void 0 ? void 0 : _h.phone, inputHandler: (name, value) => this.inputHandler(name, value, index), mask: PHONE_MASKS.US, disabled: this.disabledState }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_day", label: "Date of Birth - Day", defaultValue: (_j = ownersDefaultValue[index]) === null || _j === void 0 ? void 0 : _j.dob_day, error: (_k = this.errors[index]) === null || _k === void 0 ? void 0 : _k.dob_day, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "day", disabled: this.disabledState })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_month", label: "Date of Birth - Month", defaultValue: (_l = ownersDefaultValue[index]) === null || _l === void 0 ? void 0 : _l.dob_month, error: (_m = this.errors[index]) === null || _m === void 0 ? void 0 : _m.dob_month, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "month", disabled: this.disabledState })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_year", label: "Date of Birth - Year", defaultValue: (_o = ownersDefaultValue[index]) === null || _o === void 0 ? void 0 : _o.dob_year, error: (_p = this.errors[index]) === null || _p === void 0 ? void 0 : _p.dob_year, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "year", disabled: this.disabledState }))), h("div", { class: "mb-3" }, h("form-control-number", { name: "identification_number", label: "Identification Number", defaultValue: (_q = ownersDefaultValue[index]) === null || _q === void 0 ? void 0 : _q.identification_number, error: (_r = this.errors[index]) === null || _r === void 0 ? void 0 : _r.identification_number, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "grid gap-3" }, h("legend", { class: "mb-3" }, "Owner Address:"), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "line1", label: "Street Address", defaultValue: (_t = (_s = ownersDefaultValue[index]) === null || _s === void 0 ? void 0 : _s.address) === null || _t === void 0 ? void 0 : _t.line1, error: (_v = (_u = this.errors[index]) === null || _u === void 0 ? void 0 : _u.address) === null || _v === void 0 ? void 0 : _v.line1, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "city", label: "City", defaultValue: (_x = (_w = ownersDefaultValue[index]) === null || _w === void 0 ? void 0 : _w.address) === null || _x === void 0 ? void 0 : _x.city, error: (_z = (_y = this.errors[index]) === null || _y === void 0 ? void 0 : _y.address) === null || _z === void 0 ? void 0 : _z.city, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.disabledState }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "state", label: "State", defaultValue: (_1 = (_0 = ownersDefaultValue[index]) === null || _0 === void 0 ? void 0 : _0.address) === null || _1 === void 0 ? void 0 : _1.state, error: (_3 = (_2 = this.errors[index]) === null || _2 === void 0 ? void 0 : _2.address) === null || _3 === void 0 ? void 0 : _3.state, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "col-12 col-md-6" }, h("form-control-number", { name: "postal_code", label: "Postal Code", defaultValue: (_5 = (_4 = ownersDefaultValue[index]) === null || _4 === void 0 ? void 0 : _4.address) === null || _5 === void 0 ? void 0 : _5.postal_code, error: (_7 = (_6 = this.errors[index]) === null || _6 === void 0 ? void 0 : _6.address) === null || _7 === void 0 ? void 0 : _7.postal_code, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.disabledState })))), h("button", { type: "button", class: "btn btn-outline-danger", onClick: event => this.removeOwner(event, index), disabled: this.disabledState }, "Remove owner"))));
70
+ }), h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("button", { type: "button", class: "btn btn-outline-primary", onClick: event => this.addOwner(event), disabled: this.disabledState }, "Add an owner"))))));
69
71
  }
70
72
  static get is() { return "justifi-business-owners"; }
71
73
  static get originalStyleUrls() {
@@ -100,23 +102,6 @@ export class BusinessOwners {
100
102
  "tags": [],
101
103
  "text": ""
102
104
  }
103
- },
104
- "isEditing": {
105
- "type": "boolean",
106
- "mutable": false,
107
- "complexType": {
108
- "original": "boolean",
109
- "resolved": "boolean",
110
- "references": {}
111
- },
112
- "required": false,
113
- "optional": false,
114
- "docs": {
115
- "tags": [],
116
- "text": ""
117
- },
118
- "attribute": "is-editing",
119
- "reflect": false
120
105
  }
121
106
  };
122
107
  }
@@ -1,5 +1,5 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { PHONE_MASKS } from "../../../utils/phone-masks";
2
+ import { PHONE_MASKS } from "../../../utils/form-input-masks";
3
3
  export class BusinessRepresentative {
4
4
  constructor() {
5
5
  this.formController = undefined;