@justifi/webcomponents 4.11.0 → 4.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/dist/cjs/{Business-7ae04d4f.js → Business-c928bf29.js} +36 -27
  2. package/dist/cjs/{Payment-89a8bc21.js → Payment-eceed10f.js} +1 -0
  3. package/dist/cjs/{SubAccount-05867651.js → SubAccount-b3902202.js} +1 -1
  4. package/dist/cjs/additional-questions-details_5.cjs.entry.js +5 -6
  5. package/dist/cjs/business-additional-questions-schema-3813615c.js +47 -0
  6. package/dist/cjs/business-details-core.cjs.entry.js +2 -2
  7. package/dist/cjs/{business-form-types-29b2bad9.js → business-form-types-4b138bf2.js} +26 -0
  8. package/dist/cjs/{form-control-datepart_4.cjs.entry.js → form-control-date_3.cjs.entry.js} +16 -93
  9. package/dist/cjs/form-control-datepart_2.cjs.entry.js +124 -0
  10. package/dist/cjs/form-control-monetary.cjs.entry.js +1 -1
  11. package/dist/cjs/form-control-select_2.cjs.entry.js +1 -1
  12. package/dist/cjs/{form-input-masks-e3bf2614.js → form-input-masks-efd44b8e.js} +3 -1
  13. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +3 -4
  14. package/dist/cjs/{index-69b9386b.js → index-5d5f2219.js} +3 -0
  15. package/dist/cjs/justifi-additional-questions-form-step_5.cjs.entry.js +20 -12
  16. package/dist/cjs/justifi-additional-questions_4.cjs.entry.js +17 -16
  17. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +1 -1
  18. package/dist/cjs/justifi-billing-form_4.cjs.entry.js +5 -5
  19. package/dist/cjs/justifi-business-details.cjs.entry.js +3 -4
  20. package/dist/cjs/justifi-business-form.cjs.entry.js +20 -12
  21. package/dist/cjs/justifi-business-list.cjs.entry.js +4 -6
  22. package/dist/cjs/justifi-business-owners.cjs.entry.js +2 -2
  23. package/dist/cjs/justifi-card-form.cjs.entry.js +1 -1
  24. package/dist/cjs/justifi-checkout-core.cjs.entry.js +34 -24
  25. package/dist/cjs/justifi-checkout.cjs.entry.js +14 -10
  26. package/dist/cjs/justifi-details.cjs.entry.js +2 -2
  27. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
  28. package/dist/cjs/{justifi-new-payment-method_3.cjs.entry.js → justifi-new-payment-method_4.cjs.entry.js} +95 -11
  29. package/dist/cjs/justifi-owner-form.cjs.entry.js +30 -16
  30. package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +3 -4
  31. package/dist/cjs/justifi-payment-details.cjs.entry.js +4 -4
  32. package/dist/cjs/justifi-payment-form.cjs.entry.js +3 -4
  33. package/dist/cjs/justifi-payment-method-selector.cjs.entry.js +2 -2
  34. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +11 -4
  35. package/dist/cjs/justifi-payments-list.cjs.entry.js +4 -4
  36. package/dist/cjs/justifi-payout-details.cjs.entry.js +4 -4
  37. package/dist/cjs/justifi-payouts-list.cjs.entry.js +4 -4
  38. package/dist/cjs/justifi-proceeds-list.cjs.entry.js +3 -4
  39. package/dist/cjs/justifi-refund-form.cjs.entry.js +2 -2
  40. package/dist/cjs/justifi-subaccount-details.cjs.entry.js +5 -6
  41. package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +4 -5
  42. package/dist/cjs/justifi-table_2.cjs.entry.js +1 -1
  43. package/dist/cjs/loader.cjs.js +2 -2
  44. package/dist/cjs/payload-parsers-58d3798e.js +201 -0
  45. package/dist/cjs/payment-details-core.cjs.entry.js +3 -4
  46. package/dist/cjs/{payment.service-0b0086dc.js → payment.service-9db24ab9.js} +1 -1
  47. package/dist/cjs/payments-list-core.cjs.entry.js +3 -4
  48. package/dist/cjs/payout-details-core.cjs.entry.js +3 -4
  49. package/dist/cjs/{payout.service-5cc3b4e9.js → payout.service-a0efb71a.js} +1 -1
  50. package/dist/cjs/payouts-list-core.cjs.entry.js +3 -4
  51. package/dist/cjs/subaccount-account-details_4.cjs.entry.js +5 -6
  52. package/dist/cjs/subaccount-bank-details.cjs.entry.js +2 -2
  53. package/dist/cjs/subaccount-terms-details.cjs.entry.js +2 -2
  54. package/dist/cjs/{utils-23e70ef2.js → utils-6e35fa70.js} +1 -1
  55. package/dist/cjs/{utils-2b9940e1.js → utils-6f62f7a1.js} +0 -7
  56. package/dist/cjs/{utils-87435719.js → utils-fc72268d.js} +1 -1
  57. package/dist/cjs/webcomponents.cjs.js +2 -2
  58. package/dist/collection/api/Business.js +2 -20
  59. package/dist/collection/api/Checkout.js +6 -1
  60. package/dist/collection/api/Identity.js +9 -4
  61. package/dist/collection/api/Payment.js +1 -0
  62. package/dist/collection/api/services/checkout.service.js +7 -3
  63. package/dist/collection/collection-manifest.json +2 -0
  64. package/dist/collection/components/business-details/generic-info-details/generic-info-details.js +2 -2
  65. package/dist/collection/components/business-forms/business-form/business-core-info/business-core-info.js +2 -2
  66. package/dist/collection/components/business-forms/business-form/business-form.js +48 -3
  67. package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +13 -10
  68. package/dist/collection/components/business-forms/owner-form/owner-form.js +25 -9
  69. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +2 -3
  70. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +12 -2
  71. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning.js +42 -1
  72. package/dist/collection/components/business-forms/schemas/business-address-schema.js +1 -31
  73. package/dist/collection/components/business-forms/schemas/business-core-info-schema.js +18 -18
  74. package/dist/collection/components/business-forms/schemas/business-form-schema.js +1 -1
  75. package/dist/collection/components/business-forms/schemas/business-identity-schema.js +15 -21
  76. package/dist/collection/components/business-forms/schemas/schema-helpers.js +9 -0
  77. package/dist/collection/components/business-forms/schemas/schema-validations.js +92 -0
  78. package/dist/collection/components/business-forms/utils/business-form-types.js +23 -0
  79. package/dist/collection/components/business-forms/utils/helpers.js +22 -2
  80. package/dist/collection/components/business-forms/utils/payload-parsers.js +2 -0
  81. package/dist/collection/components/business-list/business-list.js +0 -2
  82. package/dist/collection/components/checkout/checkout-actions.js +2 -2
  83. package/dist/collection/components/checkout/checkout-core.css +361 -0
  84. package/dist/collection/components/checkout/checkout-core.js +32 -27
  85. package/dist/collection/components/checkout/checkout.js +5 -5
  86. package/dist/collection/components/checkout/new-payment-method.js +12 -6
  87. package/dist/collection/components/checkout/payment-method-options.css +18 -2
  88. package/dist/collection/components/checkout/payment-method-options.js +62 -5
  89. package/dist/collection/components/checkout/payment-method-payload.js +1 -0
  90. package/dist/collection/components/checkout/saved-payment-method.js +11 -6
  91. package/dist/collection/components/checkout/sezzel-payment-method.js +247 -0
  92. package/dist/collection/components/form/form-control-date.css +1803 -0
  93. package/dist/collection/components/form/form-control-date.js +192 -0
  94. package/dist/collection/components/payment-form/payment-method-selector.js +1 -1
  95. package/dist/collection/components/payment-method-form/payment-method-form.js +1 -1
  96. package/dist/collection/components/select-input/select-input.js +1 -1
  97. package/dist/collection/components/select-input/test/select-input.spec.js +4 -4
  98. package/dist/collection/components/subaccount-details/subaccount-merchant-details/subaccount-merchant-details.js +3 -3
  99. package/dist/collection/components/text-input/test/text-input.spec.js +4 -4
  100. package/dist/collection/components/text-input/text-input.js +1 -1
  101. package/dist/collection/utils/form-input-masks.js +2 -1
  102. package/dist/collection/utils/utils.js +0 -5
  103. package/dist/docs.json +672 -117
  104. package/dist/esm/{Business-91caaccb.js → Business-6cb1b9c8.js} +33 -25
  105. package/dist/esm/{Payment-55886c86.js → Payment-ef9fc1ae.js} +1 -0
  106. package/dist/esm/{SubAccount-61ac70eb.js → SubAccount-f4ae9809.js} +1 -1
  107. package/dist/esm/additional-questions-details_5.entry.js +5 -6
  108. package/dist/esm/business-additional-questions-schema-228d86e0.js +44 -0
  109. package/dist/esm/business-details-core.entry.js +2 -2
  110. package/dist/esm/{business-form-types-0d76133c.js → business-form-types-5ba52d61.js} +25 -1
  111. package/dist/esm/{form-control-datepart_4.entry.js → form-control-date_3.entry.js} +16 -92
  112. package/dist/esm/form-control-datepart_2.entry.js +119 -0
  113. package/dist/esm/form-control-monetary.entry.js +1 -1
  114. package/dist/esm/form-control-select_2.entry.js +1 -1
  115. package/dist/esm/form-input-masks-84875967.js +7 -0
  116. package/dist/esm/gross-payment-chart-core.entry.js +3 -4
  117. package/dist/esm/{index-df86d9a2.js → index-83dcf934.js} +3 -0
  118. package/dist/esm/justifi-additional-questions-form-step_5.entry.js +20 -12
  119. package/dist/esm/justifi-additional-questions_4.entry.js +17 -16
  120. package/dist/esm/justifi-bank-account-form.entry.js +1 -1
  121. package/dist/esm/justifi-billing-form_4.entry.js +5 -5
  122. package/dist/esm/justifi-business-details.entry.js +3 -4
  123. package/dist/esm/justifi-business-form.entry.js +20 -12
  124. package/dist/esm/justifi-business-list.entry.js +4 -6
  125. package/dist/esm/justifi-business-owners.entry.js +2 -2
  126. package/dist/esm/justifi-card-form.entry.js +1 -1
  127. package/dist/esm/justifi-checkout-core.entry.js +34 -24
  128. package/dist/esm/justifi-checkout.entry.js +14 -10
  129. package/dist/esm/justifi-details.entry.js +2 -2
  130. package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
  131. package/dist/esm/{justifi-new-payment-method_3.entry.js → justifi-new-payment-method_4.entry.js} +95 -12
  132. package/dist/esm/justifi-owner-form.entry.js +30 -16
  133. package/dist/esm/justifi-payment-balance-transactions.entry.js +3 -4
  134. package/dist/esm/justifi-payment-details.entry.js +4 -4
  135. package/dist/esm/justifi-payment-form.entry.js +3 -4
  136. package/dist/esm/justifi-payment-method-selector.entry.js +2 -2
  137. package/dist/esm/justifi-payment-provisioning.entry.js +11 -4
  138. package/dist/esm/justifi-payments-list.entry.js +4 -4
  139. package/dist/esm/justifi-payout-details.entry.js +4 -4
  140. package/dist/esm/justifi-payouts-list.entry.js +4 -4
  141. package/dist/esm/justifi-proceeds-list.entry.js +3 -4
  142. package/dist/esm/justifi-refund-form.entry.js +2 -2
  143. package/dist/esm/justifi-subaccount-details.entry.js +5 -6
  144. package/dist/esm/justifi-subaccounts-list.entry.js +4 -5
  145. package/dist/esm/justifi-table_2.entry.js +1 -1
  146. package/dist/esm/loader.js +3 -3
  147. package/dist/esm/payload-parsers-3e817fe9.js +186 -0
  148. package/dist/esm/payment-details-core.entry.js +3 -4
  149. package/dist/esm/{payment.service-f274ef98.js → payment.service-ec28a959.js} +1 -1
  150. package/dist/esm/payments-list-core.entry.js +3 -4
  151. package/dist/esm/payout-details-core.entry.js +3 -4
  152. package/dist/esm/{payout.service-af293f61.js → payout.service-5fd5986c.js} +1 -1
  153. package/dist/esm/payouts-list-core.entry.js +3 -4
  154. package/dist/esm/subaccount-account-details_4.entry.js +5 -6
  155. package/dist/esm/subaccount-bank-details.entry.js +2 -2
  156. package/dist/esm/subaccount-terms-details.entry.js +2 -2
  157. package/dist/esm/{utils-d01c5f3a.js → utils-210fdf39.js} +1 -1
  158. package/dist/esm/{utils-d9e90399.js → utils-243abdb4.js} +1 -7
  159. package/dist/esm/{utils-684d2e47.js → utils-6f05d9d7.js} +1 -1
  160. package/dist/esm/webcomponents.js +3 -3
  161. package/dist/module/Business.js +11 -25
  162. package/dist/module/Payment.js +1 -0
  163. package/dist/module/SubAccount.js +1 -1
  164. package/dist/module/business-address-schema.js +2 -32
  165. package/dist/module/business-core-info-form-step.js +2 -3
  166. package/dist/module/business-core-info-schema.js +18 -18
  167. package/dist/module/business-core-info.js +2 -2
  168. package/dist/module/business-form-types.js +25 -1
  169. package/dist/module/business-identity-schema.js +15 -21
  170. package/dist/module/business-owners-form-step.js +3 -9
  171. package/dist/module/business-representative-form-step.js +16 -12
  172. package/dist/module/business-representative.js +16 -19
  173. package/dist/module/checkout-core.js +50 -33
  174. package/dist/module/form-control-date.d.ts +11 -0
  175. package/dist/module/form-control-date.js +6 -0
  176. package/dist/module/form-control-date2.js +68 -0
  177. package/dist/module/form-input-masks.js +3 -2
  178. package/dist/module/generic-info-details2.js +2 -2
  179. package/dist/module/helpers.js +24 -3
  180. package/dist/module/justifi-business-details.js +1 -1
  181. package/dist/module/justifi-business-form.js +23 -18
  182. package/dist/module/justifi-business-list.js +1 -3
  183. package/dist/module/justifi-checkout.js +31 -21
  184. package/dist/module/justifi-payment-balance-transactions.js +1 -1
  185. package/dist/module/justifi-payment-provisioning.js +14 -13
  186. package/dist/module/justifi-sezzel-payment-method.d.ts +11 -0
  187. package/dist/module/justifi-sezzel-payment-method.js +6 -0
  188. package/dist/module/justifi-subaccount-details.js +1 -1
  189. package/dist/module/justifi-subaccounts-list.js +1 -1
  190. package/dist/module/legal-address-form-step.js +2 -2
  191. package/dist/module/new-payment-method.js +5 -4
  192. package/dist/module/owner-form.js +30 -20
  193. package/dist/module/payload-parsers.js +106 -1
  194. package/dist/module/payment-details-core2.js +1 -1
  195. package/dist/module/payment-method-form.js +1 -1
  196. package/dist/module/payment-method-options.js +34 -12
  197. package/dist/module/payments-list-core2.js +1 -1
  198. package/dist/module/payout-details-core2.js +1 -1
  199. package/dist/module/payouts-list-core2.js +1 -1
  200. package/dist/module/saved-payment-method.js +4 -4
  201. package/dist/module/select-input2.js +1 -1
  202. package/dist/module/sezzel-payment-method.js +99 -0
  203. package/dist/module/subaccount-merchant-details2.js +3 -3
  204. package/dist/module/text-input2.js +1 -1
  205. package/dist/module/utils2.js +1 -7
  206. package/dist/types/api/Business.d.ts +0 -19
  207. package/dist/types/api/Checkout.d.ts +63 -2
  208. package/dist/types/api/Identity.d.ts +5 -0
  209. package/dist/types/api/Payment.d.ts +2 -1
  210. package/dist/types/api/SubAccount.d.ts +0 -2
  211. package/dist/types/api/services/checkout.service.d.ts +8 -2
  212. package/dist/types/components/business-forms/business-form/business-form.d.ts +5 -0
  213. package/dist/types/components/business-forms/business-form/business-representative/business-representative.d.ts +3 -3
  214. package/dist/types/components/business-forms/owner-form/owner-form.d.ts +4 -2
  215. package/dist/types/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.d.ts +1 -0
  216. package/dist/types/components/business-forms/payment-provisioning/payment-provisioning.d.ts +3 -0
  217. package/dist/types/components/business-forms/schemas/business-core-info-schema.d.ts +2 -2
  218. package/dist/types/components/business-forms/schemas/business-form-schema.d.ts +6 -8
  219. package/dist/types/components/business-forms/schemas/business-identity-schema.d.ts +5 -7
  220. package/dist/types/components/business-forms/schemas/schema-helpers.d.ts +7 -0
  221. package/dist/types/components/business-forms/schemas/schema-validations.d.ts +17 -0
  222. package/dist/types/components/business-forms/utils/business-form-types.d.ts +5 -0
  223. package/dist/types/components/business-forms/utils/helpers.d.ts +8 -2
  224. package/dist/types/components/checkout/checkout-actions.d.ts +3 -3
  225. package/dist/types/components/checkout/checkout-core.d.ts +5 -4
  226. package/dist/types/components/checkout/checkout.d.ts +1 -1
  227. package/dist/types/components/checkout/new-payment-method.d.ts +2 -1
  228. package/dist/types/components/checkout/payment-method-options.d.ts +5 -1
  229. package/dist/types/components/checkout/payment-method-payload.d.ts +8 -0
  230. package/dist/types/components/checkout/saved-payment-method.d.ts +2 -1
  231. package/dist/types/components/checkout/sezzel-payment-method.d.ts +23 -0
  232. package/dist/types/components/form/form-control-date.d.ts +18 -0
  233. package/dist/types/components.d.ts +112 -9
  234. package/dist/types/utils/form-input-masks.d.ts +1 -0
  235. package/dist/types/utils/utils.d.ts +0 -1
  236. package/dist/webcomponents/p-01913426.js +1 -0
  237. package/dist/webcomponents/p-02fa533c.js +1 -0
  238. package/dist/webcomponents/p-07080c01.entry.js +1 -0
  239. package/dist/webcomponents/{p-28cd23c8.entry.js → p-0c269feb.entry.js} +1 -1
  240. package/dist/webcomponents/p-0d371ff5.entry.js +1 -0
  241. package/dist/webcomponents/{p-0b76c770.entry.js → p-0eb56b44.entry.js} +1 -1
  242. package/dist/webcomponents/{p-436d27b9.entry.js → p-0eb77101.entry.js} +1 -1
  243. package/dist/webcomponents/p-1334f776.entry.js +1 -0
  244. package/dist/webcomponents/p-19001cc5.entry.js +1 -0
  245. package/dist/webcomponents/p-2319abaf.entry.js +1 -0
  246. package/dist/webcomponents/p-26fe62d6.entry.js +1 -0
  247. package/dist/webcomponents/p-28b38699.js +1 -0
  248. package/dist/webcomponents/{p-4df6174c.entry.js → p-29376518.entry.js} +1 -1
  249. package/dist/webcomponents/p-2bee72bd.entry.js +1 -0
  250. package/dist/webcomponents/p-2fbe8823.entry.js +1 -0
  251. package/dist/webcomponents/p-31ccb5f0.entry.js +1 -0
  252. package/dist/webcomponents/p-31e70d65.entry.js +1 -0
  253. package/dist/webcomponents/p-3302bc76.js +1 -0
  254. package/dist/webcomponents/p-3adc0688.entry.js +1 -0
  255. package/dist/webcomponents/{p-7c6a355f.entry.js → p-4616768c.entry.js} +1 -1
  256. package/dist/webcomponents/p-4c705f56.js +1 -0
  257. package/dist/webcomponents/{p-a46174e0.entry.js → p-5f5e730c.entry.js} +1 -1
  258. package/dist/webcomponents/p-5ff7826e.entry.js +1 -0
  259. package/dist/webcomponents/{p-8482c23f.js → p-65510838.js} +1 -1
  260. package/dist/webcomponents/p-71b8e2da.entry.js +1 -0
  261. package/dist/webcomponents/p-737473d8.js +1 -0
  262. package/dist/webcomponents/p-787d8f52.js +1 -0
  263. package/dist/webcomponents/{p-4d50d08a.entry.js → p-7d8d2984.entry.js} +1 -1
  264. package/dist/webcomponents/p-7da249b8.entry.js +1 -0
  265. package/dist/webcomponents/{p-07b326d0.entry.js → p-8657128b.entry.js} +1 -1
  266. package/dist/webcomponents/p-889a83d2.js +1 -0
  267. package/dist/webcomponents/p-8abba4c2.entry.js +1 -0
  268. package/dist/webcomponents/p-9245777b.js +1 -0
  269. package/dist/webcomponents/{p-221b9504.entry.js → p-927150b4.entry.js} +1 -1
  270. package/dist/webcomponents/p-9b0e5c25.entry.js +1 -0
  271. package/dist/webcomponents/p-9e3f9e05.entry.js +1 -0
  272. package/dist/webcomponents/{p-688bb5da.js → p-9ee8ad4d.js} +1 -1
  273. package/dist/webcomponents/p-9f529959.entry.js +1 -0
  274. package/dist/webcomponents/{p-fb49ef28.entry.js → p-a6f170ba.entry.js} +1 -1
  275. package/dist/webcomponents/{p-c071d8c1.entry.js → p-a8caec98.entry.js} +1 -1
  276. package/dist/webcomponents/p-a90f7ca0.js +1 -0
  277. package/dist/webcomponents/{p-d776fe10.entry.js → p-abc03d5a.entry.js} +1 -1
  278. package/dist/webcomponents/p-b9f04fb0.entry.js +1 -0
  279. package/dist/webcomponents/{p-1bfadb9f.entry.js → p-c1b92cec.entry.js} +1 -1
  280. package/dist/webcomponents/p-c556deda.entry.js +1 -0
  281. package/dist/webcomponents/{p-3d4aaa4a.entry.js → p-c6e207f6.entry.js} +1 -1
  282. package/dist/webcomponents/p-c865cda8.entry.js +1 -0
  283. package/dist/webcomponents/{p-b68f1dd9.entry.js → p-cdfde1ca.entry.js} +1 -1
  284. package/dist/webcomponents/{p-746bfba6.entry.js → p-d69a485a.entry.js} +1 -1
  285. package/dist/webcomponents/{p-ebf7c70f.entry.js → p-e4342f49.entry.js} +1 -1
  286. package/dist/webcomponents/{p-ea2cca2a.js → p-ed72a5cc.js} +1 -1
  287. package/dist/webcomponents/p-edab5f2b.entry.js +1 -0
  288. package/dist/webcomponents/{p-6b51cf97.entry.js → p-f0698778.entry.js} +1 -1
  289. package/dist/webcomponents/{p-ae21ed6f.entry.js → p-f76283a5.entry.js} +1 -1
  290. package/dist/webcomponents/p-fce2b224.entry.js +1 -0
  291. package/dist/webcomponents/webcomponents.css +1 -1
  292. package/dist/webcomponents/webcomponents.esm.js +1 -1
  293. package/package.json +1 -1
  294. package/dist/cjs/business-additional-questions-schema-18a82d19.js +0 -47
  295. package/dist/cjs/business-form-select-options-7ccd8dca.js +0 -85
  296. package/dist/cjs/payload-parsers-f437272e.js +0 -132
  297. package/dist/collection/components/business-forms/utils/business-form-select-options.js +0 -80
  298. package/dist/esm/business-additional-questions-schema-b642a2b7.js +0 -44
  299. package/dist/esm/business-form-select-options-6b9293fe.js +0 -82
  300. package/dist/esm/form-input-masks-a8187c77.js +0 -6
  301. package/dist/esm/payload-parsers-920f49dd.js +0 -123
  302. package/dist/module/business-form-select-options.js +0 -82
  303. package/dist/types/components/business-forms/utils/business-form-select-options.d.ts +0 -11
  304. package/dist/webcomponents/p-091f9732.entry.js +0 -1
  305. package/dist/webcomponents/p-0923e39c.js +0 -1
  306. package/dist/webcomponents/p-0d81883d.entry.js +0 -1
  307. package/dist/webcomponents/p-102b593a.entry.js +0 -1
  308. package/dist/webcomponents/p-2b8368d2.js +0 -1
  309. package/dist/webcomponents/p-2df32b4a.entry.js +0 -1
  310. package/dist/webcomponents/p-34352d04.js +0 -1
  311. package/dist/webcomponents/p-448063ba.entry.js +0 -1
  312. package/dist/webcomponents/p-5341321d.entry.js +0 -1
  313. package/dist/webcomponents/p-5b262705.entry.js +0 -1
  314. package/dist/webcomponents/p-5e503d7d.entry.js +0 -1
  315. package/dist/webcomponents/p-6047b960.entry.js +0 -1
  316. package/dist/webcomponents/p-60b2344a.js +0 -1
  317. package/dist/webcomponents/p-63296409.js +0 -1
  318. package/dist/webcomponents/p-6d39b8bc.entry.js +0 -1
  319. package/dist/webcomponents/p-7294eb89.entry.js +0 -1
  320. package/dist/webcomponents/p-7b2cddc7.js +0 -1
  321. package/dist/webcomponents/p-817211f2.entry.js +0 -1
  322. package/dist/webcomponents/p-935d6f55.js +0 -1
  323. package/dist/webcomponents/p-959250e3.entry.js +0 -1
  324. package/dist/webcomponents/p-975ab96e.js +0 -1
  325. package/dist/webcomponents/p-9b99370e.js +0 -1
  326. package/dist/webcomponents/p-a130a884.entry.js +0 -1
  327. package/dist/webcomponents/p-a4122c35.entry.js +0 -1
  328. package/dist/webcomponents/p-ac670a3e.js +0 -1
  329. package/dist/webcomponents/p-c340b60f.js +0 -1
  330. package/dist/webcomponents/p-d5aab6b5.entry.js +0 -1
  331. package/dist/webcomponents/p-d5c80489.entry.js +0 -1
  332. package/dist/webcomponents/p-d8679fad.entry.js +0 -1
  333. package/dist/webcomponents/p-da34bba7.entry.js +0 -1
  334. package/dist/webcomponents/p-e84b3616.entry.js +0 -1
  335. package/dist/webcomponents/p-ea03b424.entry.js +0 -1
  336. package/dist/webcomponents/p-ec230480.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { BusinessTypeOptions, BusinessStructureOptions } from "../../utils/business-form-select-options";
2
+ import { BusinessTypeOptions } from "../../utils/business-form-types";
3
3
  import { PHONE_MASKS, TAX_ID_MASKS } from "../../../../utils/form-input-masks";
4
4
  import { CoreBusinessInfo } from "../../../../api/Business";
5
5
  /**
@@ -30,7 +30,7 @@ export class BusinessCoreInfo {
30
30
  }
31
31
  render() {
32
32
  const coreInfoDefaultValue = this.formController.getInitialValues();
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: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.business_structure, error: this.errors.business_structure, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-text", { name: "industry", label: "Industry", defaultValue: coreInfoDefaultValue.industry, error: this.errors.industry, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-number-masked", { name: "tax_id", label: "Tax ID", defaultValue: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.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" }, h("form-control-text", { name: "legal_name", label: "Legal Name", defaultValue: coreInfoDefaultValue.legal_name, error: this.errors.legal_name, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-text", { name: "doing_business_as", label: "Doing Business As (DBA)", defaultValue: coreInfoDefaultValue.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: coreInfoDefaultValue.business_type, error: this.errors.business_type, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "industry", label: "Industry", defaultValue: coreInfoDefaultValue.industry, error: this.errors.industry, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-number-masked", { name: "tax_id", label: "Tax ID", defaultValue: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US }))))));
34
34
  }
35
35
  static get is() { return "justifi-business-core-info"; }
36
36
  static get originalStyleUrls() {
@@ -14,6 +14,10 @@ import { Business } from "../../../api/Business";
14
14
  */
15
15
  export class BusinessForm {
16
16
  constructor() {
17
+ this.instantiateBusiness = (data) => {
18
+ const business = new Business(data);
19
+ this.formController.setInitialValues(Object.assign({}, business));
20
+ };
17
21
  this.sendData = async () => {
18
22
  this.isLoading = true;
19
23
  try {
@@ -34,8 +38,7 @@ export class BusinessForm {
34
38
  this.isLoading = true;
35
39
  try {
36
40
  const response = await this.api.get(this.businessEndpoint);
37
- const business = new Business(response.data);
38
- this.formController.setInitialValues(Object.assign({}, business));
41
+ this.instantiateBusiness(response.data);
39
42
  }
40
43
  catch (error) {
41
44
  this.errorMessage = BusinessFormServerErrors.fetchData;
@@ -51,6 +54,8 @@ export class BusinessForm {
51
54
  this.authToken = undefined;
52
55
  this.businessId = undefined;
53
56
  this.hideErrors = false;
57
+ this.formTitle = 'Business Information';
58
+ this.removeTitle = false;
54
59
  this.isLoading = false;
55
60
  this.errorMessage = undefined;
56
61
  }
@@ -59,6 +64,9 @@ export class BusinessForm {
59
64
  this.clickEventNew.emit(event);
60
65
  this.clickEventOld.emit(event);
61
66
  }
67
+ get title() {
68
+ return this.removeTitle ? '' : this.formTitle;
69
+ }
62
70
  get disabledState() {
63
71
  return this.isLoading;
64
72
  }
@@ -84,9 +92,10 @@ export class BusinessForm {
84
92
  this.errorMessage = BusinessFormServerErrors.patchData;
85
93
  }
86
94
  this.submitted.emit({ data: response });
95
+ this.instantiateBusiness(response.data);
87
96
  }
88
97
  render() {
89
- 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-core-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.fireClickEvents({ name: BusinessFormClickActions.submit }) }, this.isLoading ? 'Loading...' : 'Submit'))))));
98
+ 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, this.title)), this.showErrors && FormAlert(this.errorMessage), h("div", { class: "col-12 mb-4" }, h("justifi-business-core-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.fireClickEvents({ name: BusinessFormClickActions.submit }) }, this.isLoading ? 'Loading...' : 'Submit'))))));
90
99
  }
91
100
  static get is() { return "justifi-business-form"; }
92
101
  static get originalStyleUrls() {
@@ -152,6 +161,42 @@ export class BusinessForm {
152
161
  "attribute": "hide-errors",
153
162
  "reflect": false,
154
163
  "defaultValue": "false"
164
+ },
165
+ "formTitle": {
166
+ "type": "string",
167
+ "mutable": false,
168
+ "complexType": {
169
+ "original": "string",
170
+ "resolved": "string",
171
+ "references": {}
172
+ },
173
+ "required": false,
174
+ "optional": true,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": ""
178
+ },
179
+ "attribute": "form-title",
180
+ "reflect": false,
181
+ "defaultValue": "'Business Information'"
182
+ },
183
+ "removeTitle": {
184
+ "type": "boolean",
185
+ "mutable": false,
186
+ "complexType": {
187
+ "original": "boolean",
188
+ "resolved": "boolean",
189
+ "references": {}
190
+ },
191
+ "required": false,
192
+ "optional": true,
193
+ "docs": {
194
+ "tags": [],
195
+ "text": ""
196
+ },
197
+ "attribute": "remove-title",
198
+ "reflect": false,
199
+ "defaultValue": "false"
155
200
  }
156
201
  };
157
202
  }
@@ -1,26 +1,29 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { PHONE_MASKS } from "../../../../utils/form-input-masks";
2
+ import { PHONE_MASKS, SSN_MASK } from "../../../../utils/form-input-masks";
3
+ import { deconstructDate } from "../../utils/helpers";
3
4
  export class BusinessRepresentative {
4
5
  constructor() {
6
+ this.inputHandler = (name, value) => {
7
+ this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { [name]: value }) }));
8
+ };
9
+ this.onAddressFormUpdate = (values) => {
10
+ this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { address: Object.assign(Object.assign({}, this.formController.values.getValue().representative.address), values) }) }));
11
+ };
12
+ this.onDateOfBirthUpdate = (event) => {
13
+ const dob_values = deconstructDate(event.detail);
14
+ this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { dob_day: dob_values.dob_day, dob_month: dob_values.dob_month, dob_year: dob_values.dob_year }) }));
15
+ };
5
16
  this.formController = undefined;
6
17
  this.errors = {};
7
18
  this.representative = {};
8
- this.inputHandler = this.inputHandler.bind(this);
9
- this.onAddressFormUpdate = this.onAddressFormUpdate.bind(this);
10
19
  }
11
20
  componentDidLoad() {
12
21
  this.formController.errors.subscribe(errors => (this.errors = Object.assign({}, errors.representative)));
13
22
  this.formController.values.subscribe(values => (this.representative = Object.assign({}, values.representative)));
14
23
  }
15
- inputHandler(name, value) {
16
- this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { [name]: value }) }));
17
- }
18
- onAddressFormUpdate(values) {
19
- this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { representative: Object.assign(Object.assign({}, this.formController.values.getValue().representative), { address: Object.assign(Object.assign({}, this.formController.values.getValue().representative.address), values) }) }));
20
- }
21
24
  render() {
22
25
  const representativeDefaultValue = this.formController.getInitialValues().representative;
23
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "Representative"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-8" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-4" }, h("form-control-text", { name: "title", label: "Title", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.title, error: this.errors.title, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.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: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { class: "col-12" }, h("label", { part: "label", class: "form-label" }, "Birth Date")), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_day", label: "Day", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_day, error: this.errors.dob_day, inputHandler: this.inputHandler, type: "day" })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_month", label: "Month", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_month, error: this.errors.dob_month, inputHandler: this.inputHandler, type: "month" })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_year", label: "Year", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_year, error: this.errors.dob_year, inputHandler: this.inputHandler, type: "year" })), h("div", { class: "col-12" }, h("form-control-number", { name: "identification_number", label: "SSN", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.identification_number, error: this.errors.identification_number, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("justifi-identity-address-form", { errors: this.errors.address, defaultValues: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate }))))));
26
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "Representative"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-8" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-4" }, h("form-control-text", { name: "title", label: "Title", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.title, error: this.errors.title, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.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: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { class: "col-12 col-md-4" }, h("form-control-date", { name: "dob_full", label: "Birth Date", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_full, error: this.errors.dob_full, inputHandler: this.inputHandler, onFormControlInput: this.onDateOfBirthUpdate })), h("div", { class: "col-12 col-md-8" }, h("form-control-number-masked", { name: "identification_number", label: "SSN", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.identification_number, error: this.errors.identification_number, inputHandler: this.inputHandler, mask: SSN_MASK })), h("div", { class: "col-12" }, h("justifi-identity-address-form", { errors: this.errors.address, defaultValues: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate }))))));
24
27
  }
25
28
  static get is() { return "justifi-business-representative"; }
26
29
  static get originalStyleUrls() {
@@ -1,26 +1,29 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { FormController } from "../../form/form";
3
- import { PHONE_MASKS } from "../../../utils/form-input-masks";
3
+ import { PHONE_MASKS, SSN_MASK } from "../../../utils/form-input-masks";
4
4
  import { Api } from "../../../api";
5
5
  import { Owner } from "../../../api/Identity";
6
6
  import { parseIdentityInfo } from "../utils/payload-parsers";
7
7
  import { identitySchema } from "../schemas/business-identity-schema";
8
8
  import { config } from "../../../../config";
9
9
  import { LoadingSpinner } from "../../form/utils";
10
+ import { deconstructDate } from "../utils/helpers";
10
11
  import { OwnerFormServerErrors, OwnerFormClickActions } from "../utils/business-form-types";
11
12
  export class BusinessOwnerForm {
12
13
  constructor() {
14
+ this.instantiateOwner = (data) => {
15
+ this.owner = Object.assign({}, new Owner(data));
16
+ this.formController.setInitialValues(this.owner);
17
+ };
13
18
  this.fetchData = async () => {
14
19
  if (!this.ownerId) {
15
- this.owner = Object.assign({}, new Owner({}));
16
- this.formController.setInitialValues(this.owner);
20
+ this.instantiateOwner({});
17
21
  return;
18
22
  }
19
23
  this.isLoading = true;
20
24
  try {
21
25
  const response = await this.api.get(this.identityEndpoint);
22
- this.owner = Object.assign({}, new Owner(response.data));
23
- this.formController.setInitialValues(this.owner);
26
+ this.instantiateOwner(response.data);
24
27
  }
25
28
  catch (error) {
26
29
  this.serverError.emit({ data: error, message: OwnerFormServerErrors.fetchData });
@@ -57,6 +60,15 @@ export class BusinessOwnerForm {
57
60
  this.onAddressFormUpdate = (values) => {
58
61
  this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { address: Object.assign(Object.assign({}, this.formController.values.getValue().address), values) }));
59
62
  };
63
+ this.onDateOfBirthUpdate = (event) => {
64
+ if (event.detail === '') {
65
+ this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { dob_day: null, dob_month: null, dob_year: null }));
66
+ }
67
+ else {
68
+ const dob_values = deconstructDate(event.detail);
69
+ this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { dob_day: dob_values.dob_day, dob_month: dob_values.dob_month, dob_year: dob_values.dob_year }));
70
+ }
71
+ };
60
72
  this.handleAddOwner = () => {
61
73
  const eventName = this.ownerId ? OwnerFormClickActions.updateOwner : OwnerFormClickActions.addOwner;
62
74
  this.clickEvent.emit({ name: eventName });
@@ -65,9 +77,9 @@ export class BusinessOwnerForm {
65
77
  this.removeOwner(this.ownerId);
66
78
  this.clickEvent.emit({ name: OwnerFormClickActions.removeOwner });
67
79
  };
68
- this.validateAndSubmit = (event) => {
80
+ this.validateAndSubmit = async (event) => {
69
81
  event.preventDefault();
70
- const isValid = this.formController.validate();
82
+ const isValid = await this.validate();
71
83
  if (isValid) {
72
84
  this.submit();
73
85
  }
@@ -118,6 +130,7 @@ export class BusinessOwnerForm {
118
130
  return false;
119
131
  }
120
132
  else {
133
+ this.instantiateOwner(response.data);
121
134
  return true;
122
135
  }
123
136
  }
@@ -137,11 +150,14 @@ export class BusinessOwnerForm {
137
150
  return this.formController.validate();
138
151
  }
139
152
  async submit() {
140
- return this.sendData();
153
+ const isValid = await this.validate();
154
+ if (isValid) {
155
+ return this.sendData();
156
+ }
141
157
  }
142
158
  render() {
143
159
  const ownerDefaultValue = this.formController.getInitialValues();
144
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", { onSubmit: this.validateAndSubmit }, h("fieldset", null, h("legend", null, this.formTitle), h("div", { class: 'row gy-3' }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-4" }, h("form-control-text", { name: "title", label: "Title", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.title, error: this.errors.title, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.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: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { class: "col-12" }, h("label", { part: "label", class: "form-label" }, "Birth Date")), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_day", label: "Day", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.dob_day, error: this.errors.dob_day, inputHandler: this.inputHandler, type: "day" })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_month", label: "Month", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.dob_month, error: this.errors.dob_month, inputHandler: this.inputHandler, type: "month" })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_year", label: "Year", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.dob_year, error: this.errors.dob_year, inputHandler: this.inputHandler, type: "year" })), h("div", { class: "col-12" }, h("form-control-number", { name: "identification_number", label: "EIN/SSN", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.identification_number, error: this.errors.identification_number, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("justifi-identity-address-form", { errors: this.errors.address, defaultValues: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate })), h("div", { class: "container d-flex gap-2" }, h("button", { type: "submit", class: `btn btn-primary jfi-submit-button${this.isLoading ? ' jfi-submit-button-loading' : ''}`, onClick: () => this.handleAddOwner(), disabled: this.isLoading }, this.isLoading ? LoadingSpinner() : this.submitButtonText), this.showRemoveButton &&
160
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", { onSubmit: this.validateAndSubmit }, h("fieldset", null, h("legend", null, this.formTitle), h("div", { class: 'row gy-3' }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-4" }, h("form-control-text", { name: "title", label: "Title", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.title, error: this.errors.title, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.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: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { class: "col-12 col-md-4" }, h("form-control-date", { name: "dob_full", label: "Birth Date", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.dob_full, error: this.errors.dob_full, inputHandler: this.inputHandler, onFormControlInput: this.onDateOfBirthUpdate })), h("div", { class: "col-12 col-md-8" }, h("form-control-number-masked", { name: "identification_number", label: "SSN", defaultValue: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.identification_number, error: this.errors.identification_number, inputHandler: this.inputHandler, mask: SSN_MASK })), h("div", { class: "col-12" }, h("justifi-identity-address-form", { errors: this.errors.address, defaultValues: ownerDefaultValue === null || ownerDefaultValue === void 0 ? void 0 : ownerDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate })), h("div", { class: "container d-flex gap-2" }, h("button", { type: "submit", class: `btn btn-primary jfi-submit-button${this.isLoading ? ' jfi-submit-button-loading' : ''}`, onClick: () => this.handleAddOwner(), disabled: this.isLoading }, this.isLoading ? LoadingSpinner() : this.submitButtonText), this.showRemoveButton &&
145
161
  h("button", { type: "button", class: "btn btn-danger", onClick: () => this.handleRemoveOwner() }, "Remove owner"))), h("hr", null)))));
146
162
  }
147
163
  static get is() { return "justifi-owner-form"; }
@@ -1,5 +1,4 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { BusinessTypeOptions, BusinessStructureOptions } from "../../utils/business-form-select-options";
3
2
  import { FormController } from "../../../form/form";
4
3
  import { PHONE_MASKS, TAX_ID_MASKS } from "../../../../utils/form-input-masks";
5
4
  import { CoreBusinessInfo } from "../../../../api/Business";
@@ -8,7 +7,7 @@ import { businessCoreInfoSchema } from "../../schemas/business-core-info-schema"
8
7
  import { config } from "../../../../../config";
9
8
  import { parseCoreInfo } from "../../utils/payload-parsers";
10
9
  import { flattenNestedObject } from "../../../../utils/utils";
11
- import { BusinessFormServerErrors } from "../../utils/business-form-types";
10
+ import { BusinessFormServerErrors, BusinessTypeOptions } from "../../utils/business-form-types";
12
11
  /**
13
12
  *
14
13
  * The difference between this component and business-generic-info-details
@@ -94,7 +93,7 @@ export class BusinessCoreInfoFormStep {
94
93
  }
95
94
  render() {
96
95
  const coreInfoDefaultValue = this.formController.getInitialValues();
97
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", null, 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: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.business_structure, error: this.errors.business_structure, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-text", { name: "industry", label: "Industry", defaultValue: coreInfoDefaultValue.industry, error: this.errors.industry, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-number-masked", { name: "tax_id", label: "Tax ID", defaultValue: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })))))));
96
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", null, h("fieldset", null, h("legend", null, "General Info"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("form-control-text", { name: "legal_name", label: "Legal Name", defaultValue: coreInfoDefaultValue.legal_name, error: this.errors.legal_name, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-text", { name: "doing_business_as", label: "Doing Business As (DBA)", defaultValue: coreInfoDefaultValue.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: coreInfoDefaultValue.business_type, error: this.errors.business_type, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "industry", label: "Industry", defaultValue: coreInfoDefaultValue.industry, error: this.errors.industry, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("form-control-number-masked", { name: "tax_id", label: "Tax ID", defaultValue: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.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: coreInfoDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })))))));
98
97
  }
99
98
  static get is() { return "justifi-business-core-info-form-step"; }
100
99
  static get originalStyleUrls() {
@@ -1,12 +1,13 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { FormController } from "../../../form/form";
3
- import { PHONE_MASKS } from "../../../../utils/form-input-masks";
3
+ import { PHONE_MASKS, SSN_MASK } from "../../../../utils/form-input-masks";
4
4
  import Api from "../../../../api/Api";
5
5
  import { parseIdentityInfo } from "../../utils/payload-parsers";
6
6
  import { identitySchema } from "../../schemas/business-identity-schema";
7
7
  import { config } from "../../../../../config";
8
8
  import { BusinessFormServerErrors } from "../../utils/business-form-types";
9
9
  import { Representative } from "../../../../api/Identity";
10
+ import { deconstructDate } from "../../utils/helpers";
10
11
  export class BusinessRepresentativeFormStep {
11
12
  constructor() {
12
13
  this.fetchData = async () => {
@@ -43,6 +44,15 @@ export class BusinessRepresentativeFormStep {
43
44
  this.onAddressFormUpdate = (values) => {
44
45
  this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { address: Object.assign(Object.assign({}, this.formController.values.getValue().address), values) }));
45
46
  };
47
+ this.onDateOfBirthUpdate = (event) => {
48
+ if (event.detail === '') {
49
+ this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { dob_day: null, dob_month: null, dob_year: null }));
50
+ }
51
+ else {
52
+ const dob_values = deconstructDate(event.detail);
53
+ this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { dob_day: dob_values.dob_day, dob_month: dob_values.dob_month, dob_year: dob_values.dob_year }));
54
+ }
55
+ };
46
56
  this.authToken = undefined;
47
57
  this.businessId = undefined;
48
58
  this.allowOptionalFields = undefined;
@@ -83,7 +93,7 @@ export class BusinessRepresentativeFormStep {
83
93
  }
84
94
  render() {
85
95
  const representativeDefaultValue = this.formController.getInitialValues();
86
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", null, h("fieldset", null, h("legend", null, "Representative"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-8" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-4" }, h("form-control-text", { name: "title", label: "Title", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.title, error: this.errors.title, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.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: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { class: "col-12" }, h("label", { part: "label", class: "form-label" }, "Birth Date")), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_day", label: "Day", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_day, error: this.errors.dob_day, inputHandler: this.inputHandler, type: "day" })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_month", label: "Month", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_month, error: this.errors.dob_month, inputHandler: this.inputHandler, type: "month" })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_year", label: "Year", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_year, error: this.errors.dob_year, inputHandler: this.inputHandler, type: "year" })), h("div", { class: "col-12" }, h("form-control-number", { name: "identification_number", label: "EIN/SSN", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.identification_number, error: this.errors.identification_number, inputHandler: this.inputHandler })), h("div", { class: "col-12" }, h("justifi-identity-address-form", { errors: this.errors.address, defaultValues: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate })))))));
96
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", null, h("fieldset", null, h("legend", null, "Representative"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-8" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-4" }, h("form-control-text", { name: "title", label: "Title", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.title, error: this.errors.title, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.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: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { class: "col-12 col-md-4" }, h("form-control-date", { name: "dob_full", label: "Birth Date", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_full, error: this.errors.dob_full, inputHandler: this.inputHandler, onFormControlInput: this.onDateOfBirthUpdate })), h("div", { class: "col-12 col-md-8" }, h("form-control-number-masked", { name: "identification_number", label: "SSN", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.identification_number, error: this.errors.identification_number, inputHandler: this.inputHandler, mask: SSN_MASK })), h("div", { class: "col-12" }, h("justifi-identity-address-form", { errors: this.errors.address, defaultValues: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate })))))));
87
97
  }
88
98
  static get is() { return "justifi-business-representative-form-step"; }
89
99
  static get originalStyleUrls() {
@@ -33,11 +33,16 @@ export class PaymentProvisioning {
33
33
  this.testMode = false;
34
34
  this.hideErrors = false;
35
35
  this.allowOptionalFields = false;
36
+ this.formTitle = 'Business Information';
37
+ this.removeTitle = false;
36
38
  this.formLoading = false;
37
39
  this.errorMessage = '';
38
40
  this.currentStep = 0;
39
41
  this.totalSteps = 5;
40
42
  }
43
+ get title() {
44
+ return this.removeTitle ? '' : this.formTitle;
45
+ }
41
46
  get showErrors() {
42
47
  return this.errorMessage && !this.hideErrors;
43
48
  }
@@ -77,7 +82,7 @@ export class PaymentProvisioning {
77
82
  return this.componentStepMapping[this.currentStep]();
78
83
  }
79
84
  render() {
80
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("h1", null, "Business Information"), this.showErrors && FormAlert(this.errorMessage), 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.formLoading }, "Previous")), this.showNextStepButton() && (h("button", { type: "button", class: `btn btn-primary jfi-submit-button${this.formLoading ? ' jfi-submit-button-loading' : ''}`, onClick: (e) => this.nextStepButtonOnClick(e, BusinessFormClickActions.nextStep), disabled: this.formLoading }, this.formLoading ? LoadingSpinner() : 'Next')), this.showSubmitButton() && (h("button", { type: "submit", class: `btn btn-primary jfi-submit-button${this.formLoading ? ' jfi-submit-button-loading' : ''}`, onClick: (e) => this.nextStepButtonOnClick(e, BusinessFormClickActions.submit), disabled: this.formLoading }, this.formLoading ? LoadingSpinner() : 'Submit'))))));
85
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("h1", null, this.title), this.showErrors && FormAlert(this.errorMessage), 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.formLoading }, "Previous")), this.showNextStepButton() && (h("button", { type: "button", class: `btn btn-primary jfi-submit-button${this.formLoading ? ' jfi-submit-button-loading' : ''}`, onClick: (e) => this.nextStepButtonOnClick(e, BusinessFormClickActions.nextStep), disabled: this.formLoading }, this.formLoading ? LoadingSpinner() : 'Next')), this.showSubmitButton() && (h("button", { type: "submit", class: `btn btn-primary jfi-submit-button${this.formLoading ? ' jfi-submit-button-loading' : ''}`, onClick: (e) => this.nextStepButtonOnClick(e, BusinessFormClickActions.submit), disabled: this.formLoading }, this.formLoading ? LoadingSpinner() : 'Submit'))))));
81
86
  }
82
87
  static get is() { return "justifi-payment-provisioning"; }
83
88
  static get originalStyleUrls() {
@@ -179,6 +184,42 @@ export class PaymentProvisioning {
179
184
  "attribute": "allow-optional-fields",
180
185
  "reflect": false,
181
186
  "defaultValue": "false"
187
+ },
188
+ "formTitle": {
189
+ "type": "string",
190
+ "mutable": false,
191
+ "complexType": {
192
+ "original": "string",
193
+ "resolved": "string",
194
+ "references": {}
195
+ },
196
+ "required": false,
197
+ "optional": true,
198
+ "docs": {
199
+ "tags": [],
200
+ "text": ""
201
+ },
202
+ "attribute": "form-title",
203
+ "reflect": false,
204
+ "defaultValue": "'Business Information'"
205
+ },
206
+ "removeTitle": {
207
+ "type": "boolean",
208
+ "mutable": false,
209
+ "complexType": {
210
+ "original": "boolean",
211
+ "resolved": "boolean",
212
+ "references": {}
213
+ },
214
+ "required": false,
215
+ "optional": true,
216
+ "docs": {
217
+ "tags": [],
218
+ "text": ""
219
+ },
220
+ "attribute": "remove-title",
221
+ "reflect": false,
222
+ "defaultValue": "false"
182
223
  }
183
224
  };
184
225
  }
@@ -1,35 +1,5 @@
1
1
  import { object, string } from "yup";
2
- import StateOptions from "../../../utils/state-options";
3
- const lineOneValidation = string()
4
- .min(5, 'Address must be at least 5 characters')
5
- .max(100, 'Address must be less than 100 characters')
6
- .matches(/^(?!^\s+$)[a-zA-Z0-9\s,.'-]*$/, 'Invalid characters in address')
7
- .transform((value) => {
8
- return value === '' ? null : value;
9
- });
10
- const lineTwoValidation = string()
11
- .max(100, 'Address must be less than 100 characters')
12
- .matches(/^(?!^\s+$)[a-zA-Z0-9\s,.'-]*$/, 'Invalid characters in address')
13
- .transform((value) => {
14
- return value === '' ? null : value;
15
- });
16
- const cityValidation = string()
17
- .min(2, 'City must be at least 2 characters')
18
- .max(50, 'City must be less than 50 characters')
19
- .matches(/^(?!^\s+$)[a-zA-Z\s]*$/, 'Invalid characters in city')
20
- .transform((value) => {
21
- return value === '' ? null : value;
22
- });
23
- const stateValidation = string()
24
- .oneOf(StateOptions.map((option) => option.value), 'Select state')
25
- .transform((value) => {
26
- return value === '' ? null : value;
27
- });
28
- const postalValidation = string()
29
- .matches(/^[0-9]{5}$/, 'Enter valid postal code')
30
- .transform((value) => {
31
- return value === '' ? null : value;
32
- });
2
+ import { cityValidation, lineOneValidation, lineTwoValidation, postalValidation, stateValidation } from "./schema-validations";
33
3
  export const addressSchema = (allowOptionalFields) => {
34
4
  const schema = object({
35
5
  line1: lineOneValidation.required('Enter street address'),
@@ -1,25 +1,25 @@
1
- import { object, string } from "yup";
2
- import { phoneRegex, urlRegex } from "../utils/helpers";
1
+ import { object } from "yup";
2
+ import { businessTypeValidation, doingBusinessAsValidation, emailValidation, industryValidation, businessNameValidation, phoneValidation, taxIdValidation, websiteUrlValidation } from "./schema-validations";
3
3
  export const businessCoreInfoSchema = (allowOptionalFields) => {
4
4
  const schema = object({
5
- legal_name: string().required('Enter legal name'),
6
- website_url: string().matches(urlRegex, 'Enter valid website url').required('Enter website url'),
7
- email: string().email('Enter valid email').required('Enter email'),
8
- phone: string().matches(phoneRegex, 'Enter valid phone number').required('Enter phone number'),
9
- doing_business_as: string().required('Enter doing business as'),
10
- business_type: string().required('Select business type'),
11
- business_structure: string().required('Select business structure'),
12
- industry: string().required('Enter a business industry'),
5
+ legal_name: businessNameValidation.required('Enter legal name'),
6
+ website_url: websiteUrlValidation.required('Enter business website url'),
7
+ email: emailValidation.required('Enter business email'),
8
+ phone: phoneValidation.required('Enter phone number'),
9
+ doing_business_as: doingBusinessAsValidation.required('Enter doing business as'),
10
+ business_type: businessTypeValidation.required('Select business type'),
11
+ industry: industryValidation.required('Enter a business industry'),
12
+ tax_id: taxIdValidation.required('Enter tax id'),
13
13
  });
14
14
  const easySchema = object({
15
- legal_name: string().required('Enter legal name'),
16
- website_url: string().matches(urlRegex, 'Enter valid website url').nullable(),
17
- email: string().email('Enter valid email').nullable(),
18
- phone: string().matches(phoneRegex, 'Enter valid phone number').nullable(),
19
- doing_business_as: string().nullable(),
20
- business_type: string().nullable(),
21
- business_structure: string().nullable(),
22
- industry: string().nullable(),
15
+ legal_name: businessNameValidation.required('Enter legal name'),
16
+ website_url: websiteUrlValidation.nullable(),
17
+ email: emailValidation.nullable(),
18
+ phone: phoneValidation.nullable(),
19
+ doing_business_as: doingBusinessAsValidation.nullable(),
20
+ business_type: businessTypeValidation.nullable(),
21
+ industry: industryValidation.nullable(),
22
+ tax_id: taxIdValidation.nullable(),
23
23
  });
24
24
  return allowOptionalFields ? easySchema : schema;
25
25
  };
@@ -3,4 +3,4 @@ import { businessCoreInfoSchema } from "./business-core-info-schema";
3
3
  import { additionalQuestionsSchema } from "./business-additional-questions-schema";
4
4
  import { identitySchema } from "./business-identity-schema";
5
5
  import { addressSchema } from "./business-address-schema";
6
- export const businessFormSchema = object(Object.assign(Object.assign({}, businessCoreInfoSchema().fields), { legal_address: addressSchema(), additional_questions: additionalQuestionsSchema(), representative: identitySchema('Representative') }));
6
+ export const businessFormSchema = object(Object.assign(Object.assign({}, businessCoreInfoSchema().fields), { legal_address: addressSchema(), additional_questions: additionalQuestionsSchema(), representative: identitySchema('representative') }));
@@ -1,29 +1,23 @@
1
- import { object, string } from "yup";
1
+ import { object } from "yup";
2
2
  import { addressSchema } from "./business-address-schema";
3
- import { phoneRegex } from "../utils/helpers";
4
- export const identitySchema = (title, allowOptionalFields) => {
3
+ import { dobValidation, emailValidation, identityNameValidation, identityTitleValidation, phoneValidation, ssnValidation } from "./schema-validations";
4
+ export const identitySchema = (role, allowOptionalFields) => {
5
5
  const schema = object({
6
- name: string().required(`Enter ${title} name`),
7
- email: string()
8
- .email(`Enter valid ${title} email`)
9
- .required(`Enter ${title} email`),
10
- phone: string().matches(phoneRegex, 'Enter valid phone number').required('Enter phone number'),
11
- dob_day: string().required(`Enter ${title} birth day`),
12
- dob_month: string().required(`Enter ${title} birth month`),
13
- dob_year: string().required(`Enter ${title} birth year`),
14
- identification_number: string(),
6
+ name: identityNameValidation.required(`Enter ${role} name`),
7
+ title: identityTitleValidation.required(`Enter ${role} title`),
8
+ email: emailValidation.required(`Enter ${role} email`),
9
+ phone: phoneValidation.required('Enter phone number'),
10
+ dob_full: dobValidation(role).required('Enter date of birth'),
11
+ identification_number: ssnValidation.required('Enter SSN'),
15
12
  address: addressSchema(allowOptionalFields),
16
13
  });
17
14
  const easySchema = object({
18
- name: string().required(`Enter ${title} name`),
19
- email: string()
20
- .email(`Enter valid ${title} email`)
21
- .nullable(),
22
- phone: string().matches(phoneRegex, 'Enter valid phone number').nullable(),
23
- dob_day: string().nullable(),
24
- dob_month: string().nullable(),
25
- dob_year: string().nullable(),
26
- identification_number: string().nullable(),
15
+ name: identityNameValidation.required(`Enter ${role} name`),
16
+ title: identityTitleValidation.nullable(),
17
+ email: emailValidation.nullable(),
18
+ phone: phoneValidation.nullable(),
19
+ dob_full: dobValidation(role).nullable(),
20
+ identification_number: ssnValidation.nullable(),
27
21
  address: addressSchema(allowOptionalFields),
28
22
  });
29
23
  return allowOptionalFields ? easySchema : schema;
@@ -0,0 +1,9 @@
1
+ export const transformEmptyString = (value) => {
2
+ return value === '' ? null : value;
3
+ };
4
+ export const businessNameRegex = /^(?!^\s+$)[a-zA-Z0-9\s,&.-]*$/;
5
+ export const phoneRegex = /^\d{10}$/;
6
+ export const urlRegex = /^(?:http(s)?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
7
+ export const taxIdRegex = /^\d{9}$/;
8
+ export const stringLettersOnlyRegex = /^(?!^\s+$)[a-zA-Z\s]*$/;
9
+ export const ssnRegex = /^(?!000|666|9\d{2})\d{3}(?!00)\d{2}(?!0000)\d{4}$/;