@justifi/webcomponents 4.10.0-rc.0 → 4.11.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 (386) hide show
  1. package/dist/cjs/{Business-79361c8a.js → Business-7ae04d4f.js} +58 -2
  2. package/dist/cjs/{SubAccount-b3902202.js → SubAccount-05867651.js} +1 -1
  3. package/dist/cjs/additional-questions-details_5.cjs.entry.js +2 -1
  4. package/dist/cjs/business-additional-questions-schema-18a82d19.js +47 -0
  5. package/dist/cjs/business-details-core.cjs.entry.js +7 -2
  6. package/dist/cjs/{business-form-types-3cdd5447.js → business-form-types-29b2bad9.js} +7 -0
  7. package/dist/cjs/{form-control-datepart_3.cjs.entry.js → form-control-datepart_4.cjs.entry.js} +97 -46
  8. package/dist/cjs/form-control-monetary.cjs.entry.js +19 -17
  9. package/dist/cjs/{form-control-number_3.cjs.entry.js → form-control-select_2.cjs.entry.js} +7 -45
  10. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +9 -2
  11. package/dist/cjs/justifi-additional-questions-form-step_5.cjs.entry.js +29 -24
  12. package/dist/cjs/justifi-additional-questions_4.cjs.entry.js +7 -7
  13. package/dist/cjs/justifi-billing-form_4.cjs.entry.js +3 -3
  14. package/dist/cjs/justifi-business-details.cjs.entry.js +23 -4
  15. package/dist/cjs/justifi-business-form.cjs.entry.js +62 -51
  16. package/dist/cjs/justifi-business-list.cjs.entry.js +3 -2
  17. package/dist/cjs/justifi-checkout-core.cjs.entry.js +5 -4
  18. package/dist/cjs/justifi-checkout.cjs.entry.js +1 -1
  19. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +29 -5
  20. package/dist/cjs/justifi-owner-form.cjs.entry.js +22 -12
  21. package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +2 -1
  22. package/dist/cjs/justifi-payment-details.cjs.entry.js +25 -4
  23. package/dist/cjs/justifi-payment-form.cjs.entry.js +18 -4
  24. package/dist/cjs/{justifi-business-form-stepped.cjs.entry.js → justifi-payment-provisioning.cjs.entry.js} +20 -20
  25. package/dist/cjs/justifi-payments-list.cjs.entry.js +25 -5
  26. package/dist/cjs/justifi-payout-details.cjs.entry.js +27 -7
  27. package/dist/cjs/justifi-payouts-list.cjs.entry.js +26 -6
  28. package/dist/cjs/justifi-proceeds-list.cjs.entry.js +2 -1
  29. package/dist/cjs/justifi-subaccount-details.cjs.entry.js +3 -2
  30. package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +3 -2
  31. package/dist/cjs/loader.cjs.js +1 -1
  32. package/dist/cjs/payload-parsers-f437272e.js +132 -0
  33. package/dist/cjs/payment-details-core.cjs.entry.js +9 -2
  34. package/dist/cjs/payments-list-core.cjs.entry.js +10 -3
  35. package/dist/cjs/payout-details-core.cjs.entry.js +10 -4
  36. package/dist/cjs/payouts-list-core.cjs.entry.js +10 -3
  37. package/dist/cjs/subaccount-account-details_4.cjs.entry.js +2 -1
  38. package/dist/cjs/{utils-6f62f7a1.js → utils-2b9940e1.js} +7 -0
  39. package/dist/cjs/{utils-df5167a8.js → utils-87435719.js} +7 -0
  40. package/dist/cjs/utils-f8079741.js +41 -0
  41. package/dist/cjs/webcomponents.cjs.js +1 -1
  42. package/dist/collection/api/Business.js +12 -2
  43. package/dist/collection/api/ComponentError.js +14 -0
  44. package/dist/collection/api/services/utils.js +11 -0
  45. package/dist/collection/api/shared.js +11 -1
  46. package/dist/collection/collection-manifest.json +7 -8
  47. package/dist/collection/components/billing-form/billing-form.js +1 -1
  48. package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +4 -4
  49. package/dist/collection/components/business-details/additional-questions-details/test/additional-questions.spec.js +1 -1
  50. package/dist/collection/components/business-details/business-details-core.js +30 -2
  51. package/dist/collection/components/business-details/business-details.js +30 -0
  52. package/dist/collection/components/business-details/generic-info-details/test/generic-info-details.spec.js +1 -1
  53. package/dist/collection/components/business-details/get-business.js +15 -3
  54. package/dist/collection/components/business-details/legal-address-details/test/legal-address-details.spec.js +1 -1
  55. package/dist/collection/components/business-details/owner-details/test/owner-details.spec.js +1 -1
  56. package/dist/collection/components/business-details/representative-details/test/representative-details.spec.js +1 -1
  57. package/dist/collection/components/business-details/test/busines-details-core.spec.js +56 -16
  58. package/dist/collection/components/business-details/test/business-details.spec.js +20 -4
  59. package/dist/collection/components/business-details/test/get-business.spec.js +13 -6
  60. package/dist/collection/components/business-forms/business-form/business-form.js +79 -50
  61. package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +1 -4
  62. package/dist/collection/components/business-forms/business-form/legal-address-form/legal-address-form.js +4 -2
  63. package/dist/collection/components/business-forms/{business-form-stepped/business-address/business-address-form-step.js → owner-form/identity-address/identity-address-form.js} +14 -11
  64. package/dist/collection/components/business-forms/owner-form/identity-address/test/identity-address.e2e.js +9 -0
  65. package/dist/collection/components/business-forms/{business-form/business-address/test/business-address.spec.js → owner-form/identity-address/test/identity-address.spec.js} +21 -14
  66. package/dist/collection/components/business-forms/owner-form/owner-form.js +54 -8
  67. package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/additional-questions/business-additional-questions-form-step.js +23 -4
  68. package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-core-info/business-core-info-form-step.js +19 -1
  69. package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-owners/business-owners-form-step.js +44 -4
  70. package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-representative/business-representative-form-step.js +24 -8
  71. package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/legal-address-form/legal-address-form-step.js +24 -4
  72. package/dist/collection/components/business-forms/{business-form-stepped/business-form-stepped.js → payment-provisioning/payment-provisioning.js} +36 -18
  73. package/dist/collection/components/business-forms/payment-provisioning/test/payment-provisioning.spec.js +61 -0
  74. package/dist/collection/components/business-forms/schemas/business-additional-questions-schema.js +15 -6
  75. package/dist/collection/components/business-forms/schemas/business-address-schema.js +49 -13
  76. package/dist/collection/components/business-forms/schemas/business-core-info-schema.js +24 -12
  77. package/dist/collection/components/business-forms/schemas/business-form-schema.js +4 -4
  78. package/dist/collection/components/business-forms/schemas/business-identity-schema.js +29 -34
  79. package/dist/collection/components/business-forms/utils/business-form-types.js +7 -0
  80. package/dist/collection/components/business-forms/utils/helpers.js +2 -0
  81. package/dist/collection/components/checkout/checkout-core.js +4 -4
  82. package/dist/collection/components/form/form-control-datepart.js +39 -34
  83. package/dist/collection/components/form/form-control-monetary.js +22 -20
  84. package/dist/collection/components/form/form-control-number.js +1 -0
  85. package/dist/collection/components/form/form-control-select.js +3 -1
  86. package/dist/collection/components/form/form-control-text.js +36 -1
  87. package/dist/collection/components/form/test/form-control-datepart.spec.js +88 -0
  88. package/dist/collection/components/form/test/form-control-monetary.spec.js +69 -0
  89. package/dist/collection/components/form/test/form-control-number.spec.js +77 -0
  90. package/dist/collection/components/form/test/form-control-select.spec.js +84 -0
  91. package/dist/collection/components/form/test/form-control-text.spec.js +104 -0
  92. package/dist/collection/components/form/test/form.spec.js +60 -0
  93. package/dist/collection/components/form/utils.js +6 -0
  94. package/dist/collection/components/gross-payment-chart/get-gross-payment-chart-data.js +17 -2
  95. package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +30 -1
  96. package/dist/collection/components/gross-payment-chart/gross-payment-chart.js +35 -1
  97. package/dist/collection/components/gross-payment-chart/test/get-gross-payment-chart-data.spec.js +26 -8
  98. package/dist/collection/components/gross-payment-chart/test/gross-payment-chart-core.spec.js +51 -11
  99. package/dist/collection/components/gross-payment-chart/test/gross-payment-chart.spec.js +55 -3
  100. package/dist/collection/components/payment-details/get-payment-details.js +15 -3
  101. package/dist/collection/components/payment-details/payment-details-core.js +30 -1
  102. package/dist/collection/components/payment-details/payment-details.js +35 -1
  103. package/dist/collection/components/payment-details/test/get-payment-details.spec.js +11 -3
  104. package/dist/collection/components/payment-details/test/payment-details-core.spec.js +55 -12
  105. package/dist/collection/components/payment-details/test/payment-details.spec.js +69 -3
  106. package/dist/collection/components/payment-form/payment-form.js +54 -3
  107. package/dist/collection/components/payment-form/test/payment-form.spec.js +60 -1
  108. package/dist/collection/components/payments-list/get-payments.js +15 -4
  109. package/dist/collection/components/payments-list/payments-list-core.js +28 -2
  110. package/dist/collection/components/payments-list/payments-list.js +35 -1
  111. package/dist/collection/components/payments-list/test/get-payments.spec.js +11 -3
  112. package/dist/collection/components/payments-list/test/payments-list-core.spec.js +43 -28
  113. package/dist/collection/components/payments-list/test/payments-list.spec.js +31 -3
  114. package/dist/collection/components/payout-details/get-payout-details.js +17 -6
  115. package/dist/collection/components/payout-details/payout-details-core.js +31 -3
  116. package/dist/collection/components/payout-details/payout-details.js +35 -1
  117. package/dist/collection/components/payout-details/test/get-payout-details.spec.js +15 -5
  118. package/dist/collection/components/payout-details/test/payout-details-core.spec.js +54 -16
  119. package/dist/collection/components/payout-details/test/payout-details.spec.js +50 -1
  120. package/dist/collection/components/payouts-list/get-payouts.js +17 -5
  121. package/dist/collection/components/payouts-list/payouts-list-core.js +28 -2
  122. package/dist/collection/components/payouts-list/payouts-list.js +34 -1
  123. package/dist/collection/components/payouts-list/test/get-payouts.spec.js +11 -3
  124. package/dist/collection/components/payouts-list/test/payouts-list-core.spec.js +42 -29
  125. package/dist/collection/components/payouts-list/test/payouts-list.spec.js +33 -0
  126. package/dist/collection/utils/utils.js +5 -0
  127. package/dist/docs.json +1018 -618
  128. package/dist/esm/{Business-1df362e0.js → Business-91caaccb.js} +56 -3
  129. package/dist/esm/{SubAccount-f4ae9809.js → SubAccount-61ac70eb.js} +1 -1
  130. package/dist/esm/additional-questions-details_5.entry.js +2 -1
  131. package/dist/esm/business-additional-questions-schema-b642a2b7.js +44 -0
  132. package/dist/esm/business-details-core.entry.js +8 -3
  133. package/dist/esm/{business-form-types-de9f38cd.js → business-form-types-0d76133c.js} +8 -1
  134. package/dist/esm/{form-control-datepart_3.entry.js → form-control-datepart_4.entry.js} +97 -47
  135. package/dist/esm/form-control-monetary.entry.js +19 -17
  136. package/dist/esm/{form-control-number_3.entry.js → form-control-select_2.entry.js} +8 -45
  137. package/dist/esm/gross-payment-chart-core.entry.js +10 -3
  138. package/dist/esm/justifi-additional-questions-form-step_5.entry.js +28 -23
  139. package/dist/esm/justifi-additional-questions_4.entry.js +7 -7
  140. package/dist/esm/justifi-billing-form_4.entry.js +3 -3
  141. package/dist/esm/justifi-business-details.entry.js +24 -5
  142. package/dist/esm/justifi-business-form.entry.js +62 -51
  143. package/dist/esm/justifi-business-list.entry.js +3 -2
  144. package/dist/esm/justifi-checkout-core.entry.js +5 -4
  145. package/dist/esm/justifi-checkout.entry.js +1 -1
  146. package/dist/esm/justifi-gross-payment-chart.entry.js +28 -4
  147. package/dist/esm/justifi-owner-form.entry.js +21 -11
  148. package/dist/esm/justifi-payment-balance-transactions.entry.js +2 -1
  149. package/dist/esm/justifi-payment-details.entry.js +26 -5
  150. package/dist/esm/justifi-payment-form.entry.js +18 -4
  151. package/dist/esm/{justifi-business-form-stepped.entry.js → justifi-payment-provisioning.entry.js} +20 -20
  152. package/dist/esm/justifi-payments-list.entry.js +26 -6
  153. package/dist/esm/justifi-payout-details.entry.js +28 -8
  154. package/dist/esm/justifi-payouts-list.entry.js +27 -7
  155. package/dist/esm/justifi-proceeds-list.entry.js +2 -1
  156. package/dist/esm/justifi-subaccount-details.entry.js +3 -2
  157. package/dist/esm/justifi-subaccounts-list.entry.js +3 -2
  158. package/dist/esm/loader.js +1 -1
  159. package/dist/esm/payload-parsers-920f49dd.js +123 -0
  160. package/dist/esm/payment-details-core.entry.js +10 -3
  161. package/dist/esm/payments-list-core.entry.js +10 -3
  162. package/dist/esm/payout-details-core.entry.js +11 -5
  163. package/dist/esm/payouts-list-core.entry.js +10 -3
  164. package/dist/esm/subaccount-account-details_4.entry.js +2 -1
  165. package/dist/esm/utils-4609f32c.js +38 -0
  166. package/dist/esm/{utils-2828201a.js → utils-684d2e47.js} +7 -1
  167. package/dist/esm/{utils-243abdb4.js → utils-d9e90399.js} +7 -1
  168. package/dist/esm/webcomponents.js +1 -1
  169. package/dist/module/Business.js +56 -3
  170. package/dist/module/SubAccount.js +1 -1
  171. package/dist/module/business-additional-questions-form-step.js +7 -4
  172. package/dist/module/business-additional-questions-schema.js +16 -7
  173. package/dist/module/business-address-schema.js +50 -14
  174. package/dist/module/business-core-info-form-step.js +3 -1
  175. package/dist/module/business-core-info-schema.js +24 -12
  176. package/dist/module/business-details-core2.js +8 -3
  177. package/dist/module/business-form-types.js +8 -1
  178. package/dist/module/business-identity-schema.js +30 -35
  179. package/dist/module/business-owners-form-step.js +13 -8
  180. package/dist/module/business-representative-form-step.js +11 -11
  181. package/dist/module/business-representative.js +4 -7
  182. package/dist/module/checkout-core.js +4 -4
  183. package/dist/module/form-control-datepart2.js +37 -33
  184. package/dist/module/form-control-monetary2.js +20 -18
  185. package/dist/module/form-control-number2.js +1 -0
  186. package/dist/module/form-control-select2.js +3 -1
  187. package/dist/module/form-control-text2.js +6 -1
  188. package/dist/module/gross-payment-chart-core2.js +8 -2
  189. package/dist/module/helpers.js +4 -0
  190. package/dist/module/{business-address-form.js → identity-address-form.js} +17 -20
  191. package/dist/module/justifi-business-details.js +21 -4
  192. package/dist/module/justifi-business-form.js +65 -56
  193. package/dist/module/justifi-gross-payment-chart.js +28 -4
  194. package/dist/module/justifi-identity-address-form.d.ts +11 -0
  195. package/dist/module/justifi-identity-address-form.js +6 -0
  196. package/dist/module/justifi-payment-balance-transactions.js +1 -1
  197. package/dist/module/justifi-payment-details.js +26 -5
  198. package/dist/module/justifi-payment-form.js +18 -4
  199. package/dist/module/justifi-payment-provisioning.d.ts +11 -0
  200. package/dist/module/{justifi-business-form-stepped.js → justifi-payment-provisioning.js} +32 -31
  201. package/dist/module/justifi-payments-list.js +26 -6
  202. package/dist/module/justifi-payout-details.js +28 -8
  203. package/dist/module/justifi-payouts-list.js +27 -7
  204. package/dist/module/justifi-subaccount-details.js +1 -1
  205. package/dist/module/justifi-subaccounts-list.js +1 -1
  206. package/dist/module/legal-address-form-step.js +10 -12
  207. package/dist/module/legal-address-form.js +5 -9
  208. package/dist/module/owner-form.js +23 -35
  209. package/dist/module/payment-details-core2.js +9 -3
  210. package/dist/module/payment-method-form.js +1 -1
  211. package/dist/module/payments-list-core2.js +9 -3
  212. package/dist/module/payout-details-core2.js +10 -5
  213. package/dist/module/payouts-list-core2.js +9 -3
  214. package/dist/module/subaccount-merchant-details2.js +1 -1
  215. package/dist/module/utils2.js +7 -1
  216. package/dist/module/utils3.js +31 -1
  217. package/dist/module/utils4.js +7 -1
  218. package/dist/types/api/Business.d.ts +10 -3
  219. package/dist/types/api/ComponentError.d.ts +18 -0
  220. package/dist/types/api/services/utils.d.ts +2 -0
  221. package/dist/types/api/shared.d.ts +9 -0
  222. package/dist/types/components/business-details/additional-questions-details/additional-questions-details.d.ts +2 -2
  223. package/dist/types/components/business-details/business-details-core.d.ts +3 -0
  224. package/dist/types/components/business-details/business-details.d.ts +3 -0
  225. package/dist/types/components/business-forms/business-form/business-form.d.ts +4 -2
  226. package/dist/types/components/business-forms/owner-form/identity-address/identity-address-form.d.ts +10 -0
  227. package/dist/types/components/business-forms/owner-form/owner-form.d.ts +5 -1
  228. package/dist/types/components/business-forms/{business-form-stepped → payment-provisioning}/additional-questions/business-additional-questions-form-step.d.ts +3 -1
  229. package/dist/types/components/business-forms/{business-form-stepped → payment-provisioning}/business-core-info/business-core-info-form-step.d.ts +1 -0
  230. package/dist/types/components/business-forms/{business-form-stepped → payment-provisioning}/business-owners/business-owners-form-step.d.ts +3 -1
  231. package/dist/types/components/business-forms/{business-form-stepped → payment-provisioning}/business-representative/business-representative-form-step.d.ts +3 -1
  232. package/dist/types/components/business-forms/{business-form-stepped → payment-provisioning}/legal-address-form/legal-address-form-step.d.ts +1 -0
  233. package/dist/types/components/business-forms/{business-form-stepped/business-form-stepped.d.ts → payment-provisioning/payment-provisioning.d.ts} +4 -3
  234. package/dist/types/components/business-forms/schemas/business-additional-questions-schema.d.ts +1 -1
  235. package/dist/types/components/business-forms/schemas/business-address-schema.d.ts +1 -12
  236. package/dist/types/components/business-forms/schemas/business-core-info-schema.d.ts +1 -1
  237. package/dist/types/components/business-forms/schemas/business-form-schema.d.ts +7 -3
  238. package/dist/types/components/business-forms/schemas/business-identity-schema.d.ts +5 -31
  239. package/dist/types/components/business-forms/utils/business-form-types.d.ts +10 -0
  240. package/dist/types/components/business-forms/utils/helpers.d.ts +2 -0
  241. package/dist/types/components/form/form-control-datepart.d.ts +2 -1
  242. package/dist/types/components/form/form-control-monetary.d.ts +2 -1
  243. package/dist/types/components/form/form-control-text.d.ts +2 -0
  244. package/dist/types/components/form/utils.d.ts +1 -0
  245. package/dist/types/components/gross-payment-chart/get-gross-payment-chart-data.d.ts +5 -8
  246. package/dist/types/components/gross-payment-chart/gross-payment-chart-core.d.ts +3 -0
  247. package/dist/types/components/gross-payment-chart/gross-payment-chart.d.ts +4 -0
  248. package/dist/types/components/payment-details/payment-details-core.d.ts +3 -0
  249. package/dist/types/components/payment-details/payment-details.d.ts +4 -0
  250. package/dist/types/components/payment-form/payment-form.d.ts +4 -1
  251. package/dist/types/components/payments-list/payments-list-core.d.ts +2 -0
  252. package/dist/types/components/payments-list/payments-list.d.ts +4 -0
  253. package/dist/types/components/payout-details/payout-details-core.d.ts +3 -0
  254. package/dist/types/components/payout-details/payout-details.d.ts +4 -0
  255. package/dist/types/components/payouts-list/payouts-list-core.d.ts +2 -0
  256. package/dist/types/components/payouts-list/payouts-list.d.ts +4 -0
  257. package/dist/types/components.d.ts +278 -104
  258. package/dist/types/utils/utils.d.ts +1 -0
  259. package/dist/webcomponents/p-091f9732.entry.js +1 -0
  260. package/dist/webcomponents/p-0b76c770.entry.js +1 -0
  261. package/dist/webcomponents/p-0d81883d.entry.js +1 -0
  262. package/dist/webcomponents/p-102b593a.entry.js +1 -0
  263. package/dist/webcomponents/p-221b9504.entry.js +1 -0
  264. package/dist/webcomponents/p-28cd23c8.entry.js +1 -0
  265. package/dist/webcomponents/p-2b8368d2.js +1 -0
  266. package/dist/webcomponents/p-2df32b4a.entry.js +1 -0
  267. package/dist/webcomponents/p-3d4aaa4a.entry.js +1 -0
  268. package/dist/webcomponents/p-436d27b9.entry.js +1 -0
  269. package/dist/webcomponents/p-448063ba.entry.js +1 -0
  270. package/dist/webcomponents/p-5341321d.entry.js +1 -0
  271. package/dist/webcomponents/{p-0399f02b.entry.js → p-5b262705.entry.js} +1 -1
  272. package/dist/webcomponents/p-5e503d7d.entry.js +1 -0
  273. package/dist/webcomponents/p-6047b960.entry.js +1 -0
  274. package/dist/webcomponents/p-60b2344a.js +1 -0
  275. package/dist/webcomponents/p-6d39b8bc.entry.js +1 -0
  276. package/dist/webcomponents/p-6f294d5d.js +1 -0
  277. package/dist/webcomponents/p-7294eb89.entry.js +1 -0
  278. package/dist/webcomponents/p-746bfba6.entry.js +1 -0
  279. package/dist/webcomponents/p-7c6a355f.entry.js +1 -0
  280. package/dist/webcomponents/p-817211f2.entry.js +1 -0
  281. package/dist/webcomponents/{p-65510838.js → p-8482c23f.js} +1 -1
  282. package/dist/webcomponents/p-935d6f55.js +1 -0
  283. package/dist/webcomponents/{p-e924f2e1.entry.js → p-959250e3.entry.js} +1 -1
  284. package/dist/webcomponents/p-a130a884.entry.js +1 -0
  285. package/dist/webcomponents/p-a4122c35.entry.js +1 -0
  286. package/dist/webcomponents/p-ac670a3e.js +1 -0
  287. package/dist/webcomponents/p-ae21ed6f.entry.js +19 -0
  288. package/dist/webcomponents/p-c071d8c1.entry.js +1 -0
  289. package/dist/webcomponents/p-c340b60f.js +1 -0
  290. package/dist/webcomponents/p-d5aab6b5.entry.js +1 -0
  291. package/dist/webcomponents/p-d5c80489.entry.js +1 -0
  292. package/dist/webcomponents/p-d776fe10.entry.js +1 -0
  293. package/dist/webcomponents/p-d8679fad.entry.js +1 -0
  294. package/dist/webcomponents/p-e84b3616.entry.js +1 -0
  295. package/dist/webcomponents/p-ea03b424.entry.js +1 -0
  296. package/dist/webcomponents/p-ea2cca2a.js +1 -0
  297. package/dist/webcomponents/p-ec230480.entry.js +1 -0
  298. package/dist/webcomponents/webcomponents.esm.js +1 -1
  299. package/package.json +1 -1
  300. package/dist/cjs/Identity-b6364aee.js +0 -27
  301. package/dist/cjs/business-additional-questions-schema-cbac27f2.js +0 -26
  302. package/dist/cjs/justifi-business-address-form-step.cjs.entry.js +0 -35
  303. package/dist/cjs/payload-parsers-25ed3936.js +0 -98
  304. package/dist/cjs/utils-f5d82f21.js +0 -10
  305. package/dist/collection/api/mockData/MockOnboardingData.js +0 -117
  306. package/dist/collection/api/mockData/MockPayments.js +0 -243
  307. package/dist/collection/api/mockData/MockSubAccount.js +0 -102
  308. package/dist/collection/api/mockData/mockGrossVolumeReport.js +0 -125
  309. package/dist/collection/components/business-forms/business-form/business-address/business-address-form.css +0 -2536
  310. package/dist/collection/components/business-forms/business-form/business-address/business-address-form.js +0 -97
  311. package/dist/collection/components/business-forms/business-form/business-address/test/business-address.e2e.js +0 -9
  312. package/dist/collection/components/business-forms/business-form-stepped/business-address/test/business-address-form-step.spec.js +0 -97
  313. package/dist/collection/components/business-forms/business-form-stepped/test/business-form-stepped.spec.js +0 -61
  314. package/dist/collection/components/business-forms/schemas/business-owners-schema.js +0 -16
  315. package/dist/collection/components/card-form/test/card-form.e2e.js +0 -13
  316. package/dist/esm/Identity-774788c0.js +0 -25
  317. package/dist/esm/business-additional-questions-schema-2cb80f70.js +0 -23
  318. package/dist/esm/justifi-business-address-form-step.entry.js +0 -31
  319. package/dist/esm/payload-parsers-1dd7474f.js +0 -90
  320. package/dist/esm/utils-546ca6aa.js +0 -8
  321. package/dist/module/justifi-business-address-form-step.d.ts +0 -11
  322. package/dist/module/justifi-business-address-form-step.js +0 -75
  323. package/dist/module/justifi-business-address-form.d.ts +0 -11
  324. package/dist/module/justifi-business-address-form.js +0 -6
  325. package/dist/module/justifi-business-form-stepped.d.ts +0 -11
  326. package/dist/types/api/mockData/MockOnboardingData.d.ts +0 -8
  327. package/dist/types/api/mockData/MockPayments.d.ts +0 -3
  328. package/dist/types/api/mockData/MockSubAccount.d.ts +0 -3
  329. package/dist/types/components/business-forms/business-form/business-address/business-address-form.d.ts +0 -9
  330. package/dist/types/components/business-forms/business-form-stepped/business-address/business-address-form-step.d.ts +0 -9
  331. package/dist/types/components/business-forms/schemas/business-owners-schema.d.ts +0 -33
  332. package/dist/webcomponents/p-04a98c63.js +0 -1
  333. package/dist/webcomponents/p-06888c2e.entry.js +0 -1
  334. package/dist/webcomponents/p-0811bc77.entry.js +0 -1
  335. package/dist/webcomponents/p-17d72f4a.js +0 -1
  336. package/dist/webcomponents/p-17f64853.entry.js +0 -1
  337. package/dist/webcomponents/p-22085999.entry.js +0 -1
  338. package/dist/webcomponents/p-252835df.entry.js +0 -1
  339. package/dist/webcomponents/p-28b38699.js +0 -1
  340. package/dist/webcomponents/p-374c44e6.entry.js +0 -1
  341. package/dist/webcomponents/p-4697ccfa.entry.js +0 -1
  342. package/dist/webcomponents/p-4781cd06.js +0 -1
  343. package/dist/webcomponents/p-4d806131.entry.js +0 -1
  344. package/dist/webcomponents/p-4e0b3206.entry.js +0 -1
  345. package/dist/webcomponents/p-583dd5a2.entry.js +0 -1
  346. package/dist/webcomponents/p-5be4e217.entry.js +0 -1
  347. package/dist/webcomponents/p-5da4fbe7.entry.js +0 -1
  348. package/dist/webcomponents/p-6103c20d.entry.js +0 -1
  349. package/dist/webcomponents/p-6ed680e9.js +0 -1
  350. package/dist/webcomponents/p-7654c70d.entry.js +0 -1
  351. package/dist/webcomponents/p-847441ce.entry.js +0 -1
  352. package/dist/webcomponents/p-861ba3fc.entry.js +0 -1
  353. package/dist/webcomponents/p-9207ccb2.entry.js +0 -1
  354. package/dist/webcomponents/p-9ce8d98c.entry.js +0 -1
  355. package/dist/webcomponents/p-9e4b81ad.entry.js +0 -1
  356. package/dist/webcomponents/p-a141c531.js +0 -1
  357. package/dist/webcomponents/p-a2dbe90f.entry.js +0 -1
  358. package/dist/webcomponents/p-a98eea84.entry.js +0 -1
  359. package/dist/webcomponents/p-b1bc23af.entry.js +0 -1
  360. package/dist/webcomponents/p-b27c9b0d.entry.js +0 -1
  361. package/dist/webcomponents/p-b8f22856.js +0 -1
  362. package/dist/webcomponents/p-c8d62072.entry.js +0 -1
  363. package/dist/webcomponents/p-e3748ea4.entry.js +0 -1
  364. package/dist/webcomponents/p-eef5ed19.entry.js +0 -1
  365. package/dist/webcomponents/p-efc7025c.entry.js +0 -1
  366. package/dist/webcomponents/p-f3453ca2.js +0 -1
  367. package/dist/webcomponents/p-f3ca6fda.entry.js +0 -1
  368. package/dist/webcomponents/p-fe2af0cf.entry.js +0 -19
  369. package/dist/webcomponents/p-fe8a94c1.entry.js +0 -1
  370. /package/dist/cjs/{state-options-96d05a98.js → state-options-4fbcb48a.js} +0 -0
  371. /package/dist/collection/components/business-forms/{business-form-stepped/business-address/business-address-form-step.css → owner-form/identity-address/identity-address-form.css} +0 -0
  372. /package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/additional-questions/test/business-additional-questions-form-step.spec.js +0 -0
  373. /package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-core-info/business-core-info-form-step.css +0 -0
  374. /package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-core-info/test/business-core-info-form-step.spec.js +0 -0
  375. /package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-owners/business-owners-form-step.css +0 -0
  376. /package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-owners/test/business-owners-form-step.spec.js +0 -0
  377. /package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-representative/business-representative-form-step.css +0 -0
  378. /package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/business-representative/test/business-representative-form-step.spec.js +0 -0
  379. /package/dist/collection/components/business-forms/{business-form-stepped → payment-provisioning}/legal-address-form/legal-address-form-step.css +0 -0
  380. /package/dist/collection/components/business-forms/{business-form-stepped/business-form-stepped.css → payment-provisioning/payment-provisioning.css} +0 -0
  381. /package/dist/collection/{components/billing-form → utils}/state-options.js +0 -0
  382. /package/dist/esm/{state-options-fc1daf67.js → state-options-a356fb11.js} +0 -0
  383. /package/dist/types/{api → home/runner/work/web-component-library/web-component-library/packages/webcomponents/.stencil}/mockData/mockGrossVolumeReport.d.ts +0 -0
  384. /package/dist/types/home/runner/work/web-component-library/web-component-library/packages/webcomponents/.stencil/{config.d.ts → packages/webcomponents/config.d.ts} +0 -0
  385. /package/dist/types/{components/billing-form → utils}/state-options.d.ts +0 -0
  386. /package/dist/webcomponents/{p-8e2a88a8.js → p-6078a370.js} +0 -0
@@ -25,10 +25,14 @@ export class BusinessDetailsCore {
25
25
  this.business = business;
26
26
  this.renderState = RENDER_STATES.READY;
27
27
  },
28
- onError: ({ error }) => {
29
- console.error(error);
28
+ onError: ({ error, code, severity }) => {
30
29
  this.errorMessage = error;
31
30
  this.renderState = RENDER_STATES.ERROR;
31
+ this.errorEvent.emit({
32
+ errorCode: code,
33
+ message: error,
34
+ severity,
35
+ });
32
36
  }
33
37
  });
34
38
  }
@@ -83,4 +87,28 @@ export class BusinessDetailsCore {
83
87
  "errorMessage": {}
84
88
  };
85
89
  }
90
+ static get events() {
91
+ return [{
92
+ "method": "errorEvent",
93
+ "name": "error-event",
94
+ "bubbles": true,
95
+ "cancelable": true,
96
+ "composed": true,
97
+ "docs": {
98
+ "tags": [],
99
+ "text": ""
100
+ },
101
+ "complexType": {
102
+ "original": "ComponentError",
103
+ "resolved": "ComponentError",
104
+ "references": {
105
+ "ComponentError": {
106
+ "location": "import",
107
+ "path": "../../api/ComponentError",
108
+ "id": "src/api/ComponentError.ts::ComponentError"
109
+ }
110
+ }
111
+ }
112
+ }];
113
+ }
86
114
  }
@@ -2,6 +2,7 @@ import { Host, h } from "@stencil/core";
2
2
  import { ErrorState } from "../details/utils";
3
3
  import { BusinessService } from "../../api/services/business.service";
4
4
  import { makeGetBusiness } from "./get-business";
5
+ import { ComponentErrorCodes, ComponentErrorSeverity } from "../../api/ComponentError";
5
6
  /**
6
7
  *
7
8
  * @exportedPart detail-section
@@ -23,6 +24,11 @@ export class BusinessDetails {
23
24
  initializeGetBusiness() {
24
25
  if (!this.businessId || !this.authToken) {
25
26
  this.errorMessage = 'Invalid business id or auth token';
27
+ this.errorEvent.emit({
28
+ errorCode: ComponentErrorCodes.MISSING_PROPS,
29
+ message: this.errorMessage,
30
+ severity: ComponentErrorSeverity.ERROR,
31
+ });
26
32
  return;
27
33
  }
28
34
  this.getBusiness = makeGetBusiness({
@@ -83,4 +89,28 @@ export class BusinessDetails {
83
89
  "getBusiness": {}
84
90
  };
85
91
  }
92
+ static get events() {
93
+ return [{
94
+ "method": "errorEvent",
95
+ "name": "error-event",
96
+ "bubbles": true,
97
+ "cancelable": true,
98
+ "composed": true,
99
+ "docs": {
100
+ "tags": [],
101
+ "text": ""
102
+ },
103
+ "complexType": {
104
+ "original": "ComponentError",
105
+ "resolved": "ComponentError",
106
+ "references": {
107
+ "ComponentError": {
108
+ "location": "import",
109
+ "path": "../../api/ComponentError",
110
+ "id": "src/api/ComponentError.ts::ComponentError"
111
+ }
112
+ }
113
+ }
114
+ }];
115
+ }
86
116
  }
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
2
2
  import { newSpecPage } from "@stencil/core/testing";
3
3
  import { Business } from "../../../../api/Business";
4
4
  import { GenericInfoDetails } from "../generic-info-details";
5
- import mockedBusinessDetails from "../../../../api/mockData/mockBusinessDetails.json";
5
+ import mockedBusinessDetails from "../../../../../../../mockData/mockBusinessDetails.json";
6
6
  describe('GenericInfoDetails', () => {
7
7
  it('should render', async () => {
8
8
  const businessDetails = new Business(mockedBusinessDetails.data);
@@ -1,6 +1,8 @@
1
1
  import { Business } from "../../api/Business";
2
- import { getErrorMessage } from "../../api/services/utils";
2
+ import { ComponentErrorSeverity } from "../../api/ComponentError";
3
+ import { getErrorCode, getErrorMessage } from "../../api/services/utils";
3
4
  export const makeGetBusiness = ({ id, authToken, service }) => async ({ onSuccess, onError }) => {
5
+ var _a;
4
6
  try {
5
7
  const response = await service.fetchBusiness(id, authToken);
6
8
  if (!response.error) {
@@ -8,10 +10,20 @@ export const makeGetBusiness = ({ id, authToken, service }) => async ({ onSucces
8
10
  }
9
11
  else {
10
12
  const responseError = getErrorMessage(response.error);
11
- return onError({ error: responseError });
13
+ const code = getErrorCode((_a = response.error) === null || _a === void 0 ? void 0 : _a.code);
14
+ return onError({
15
+ error: responseError,
16
+ code,
17
+ severity: ComponentErrorSeverity.ERROR,
18
+ });
12
19
  }
13
20
  }
14
21
  catch (error) {
15
- return onError({ error: error.message || error });
22
+ const code = getErrorCode(error === null || error === void 0 ? void 0 : error.code);
23
+ return onError({
24
+ error: error.message || error,
25
+ code,
26
+ severity: ComponentErrorSeverity.ERROR,
27
+ });
16
28
  }
17
29
  };
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
2
2
  import { newSpecPage } from "@stencil/core/testing";
3
3
  import { Business } from "../../../../api/Business";
4
4
  import { LegalAddressDetails } from "../legal-address-details";
5
- import mockedBusinessDetails from "../../../../api/mockData/mockBusinessDetails.json";
5
+ import mockedBusinessDetails from "../../../../../../../mockData/mockBusinessDetails.json";
6
6
  describe('LegalAddressDetails', () => {
7
7
  it('should render', async () => {
8
8
  const businessDetails = new Business(mockedBusinessDetails.data);
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { newSpecPage } from "@stencil/core/testing";
3
3
  import { Business } from "../../../../api/Business";
4
- import mockedBusinessDetails from "../../../../api/mockData/mockBusinessDetails.json";
4
+ import mockedBusinessDetails from "../../../../../../../mockData/mockBusinessDetails.json";
5
5
  import { OwnerDetails } from "../owner-details";
6
6
  describe('owner-details', () => {
7
7
  it('should render owner-details', async () => {
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { newSpecPage } from "@stencil/core/testing";
3
3
  import { Business } from "../../../../api/Business";
4
- import mockedBusinessDetails from "../../../../api/mockData/mockBusinessDetails.json";
4
+ import mockedBusinessDetails from "../../../../../../../mockData/mockBusinessDetails.json";
5
5
  import { JustifiRepresentativeDetails } from "../representative-details";
6
6
  describe('RepresentativeDetails', () => {
7
7
  it('should render', async () => {
@@ -1,22 +1,20 @@
1
+ import { h } from "@stencil/core";
1
2
  import { newSpecPage } from "@stencil/core/testing";
2
3
  import { BusinessDetailsCore } from "../business-details-core";
3
4
  import { makeGetBusiness } from "../get-business";
4
- import mockBusinessDetails from "./../../../api/mockData/mockBusinessDetails.json";
5
+ import mockBusinessDetails from "./../../../../../../mockData/mockBusinessDetails.json";
5
6
  import { Business } from "../../../api/Business";
7
+ import { API_NOT_AUTHENTICATED_ERROR } from "../../../api/shared";
6
8
  describe('BusinessDetailsCore', () => {
7
9
  it('should display loading state correclty', async () => {
8
10
  const page = await newSpecPage({
9
11
  components: [BusinessDetailsCore],
10
- html: '<business-details-core></business-details-core>',
12
+ template: () => h("business-details-core", null),
11
13
  });
12
14
  await page.waitForChanges();
13
15
  expect(page.root).toMatchSnapshot();
14
16
  });
15
17
  it('should display error state correctly', async () => {
16
- const page = await newSpecPage({
17
- components: [BusinessDetailsCore],
18
- html: '<business-details-core></business-details-core>',
19
- });
20
18
  const getBusiness = makeGetBusiness({
21
19
  id: '',
22
20
  authToken: '',
@@ -24,17 +22,14 @@ describe('BusinessDetailsCore', () => {
24
22
  fetchBusiness: async () => ({ error: 'error' }),
25
23
  },
26
24
  });
27
- page.rootInstance.componentWillLoad = () => { };
28
- page.rootInstance.getBusiness = getBusiness;
29
- page.rootInstance.fetchData();
25
+ const page = await newSpecPage({
26
+ components: [BusinessDetailsCore],
27
+ template: () => h("business-details-core", { getBusiness: getBusiness }),
28
+ });
30
29
  await page.waitForChanges();
31
30
  expect(page.root).toMatchSnapshot();
32
31
  });
33
32
  it('should set business details correctly to state', async () => {
34
- const page = await newSpecPage({
35
- components: [BusinessDetailsCore],
36
- html: '<business-details-core></business-details-core>',
37
- });
38
33
  const getBusiness = makeGetBusiness({
39
34
  id: '',
40
35
  authToken: '',
@@ -42,12 +37,57 @@ describe('BusinessDetailsCore', () => {
42
37
  fetchBusiness: async () => Promise.resolve(mockBusinessDetails),
43
38
  },
44
39
  });
45
- page.rootInstance.componentWillLoad = () => { };
46
- page.rootInstance.getBusiness = getBusiness;
47
- page.rootInstance.fetchData();
40
+ const page = await newSpecPage({
41
+ components: [BusinessDetailsCore],
42
+ template: () => h("business-details-core", { getBusiness: getBusiness }),
43
+ });
48
44
  await page.waitForChanges();
49
45
  const expectedBusiness = new Business(mockBusinessDetails.data);
50
46
  expect(page.rootInstance.business).toEqual(expectedBusiness);
51
47
  expect(page.root).toMatchSnapshot();
52
48
  });
49
+ it('should emit error event when fetch fails', async () => {
50
+ const getBusiness = makeGetBusiness({
51
+ authToken: 'abc',
52
+ id: 'abc',
53
+ service: {
54
+ fetchBusiness: jest.fn().mockRejectedValue(new Error('Fetch error')),
55
+ },
56
+ });
57
+ const errorSpy = jest.fn();
58
+ const page = await newSpecPage({
59
+ components: [BusinessDetailsCore],
60
+ template: () => h("business-details-core", { getBusiness: getBusiness, "onError-event": errorSpy }),
61
+ });
62
+ await page.waitForChanges();
63
+ expect(errorSpy).toHaveBeenCalledWith(expect.objectContaining({
64
+ detail: {
65
+ errorCode: 'fetch-error',
66
+ message: 'Fetch error',
67
+ severity: 'error',
68
+ }
69
+ }));
70
+ });
71
+ it('should emit error event when API returns error', async () => {
72
+ const getBusiness = makeGetBusiness({
73
+ authToken: 'abc',
74
+ id: 'abc',
75
+ service: {
76
+ fetchBusiness: jest.fn().mockResolvedValue(API_NOT_AUTHENTICATED_ERROR),
77
+ },
78
+ });
79
+ const errorSpy = jest.fn();
80
+ const page = await newSpecPage({
81
+ components: [BusinessDetailsCore],
82
+ template: () => h("business-details-core", { getBusiness: getBusiness, "onError-event": errorSpy }),
83
+ });
84
+ await page.waitForChanges();
85
+ expect(errorSpy).toHaveBeenCalledWith(expect.objectContaining({
86
+ detail: {
87
+ errorCode: 'not-authenticated',
88
+ message: 'Not Authenticated',
89
+ severity: 'error',
90
+ }
91
+ }));
92
+ });
53
93
  });
@@ -1,3 +1,4 @@
1
+ import { h } from "@stencil/core";
1
2
  import { newSpecPage } from "@stencil/core/testing";
2
3
  import { BusinessDetails } from "../business-details";
3
4
  import { BusinessDetailsCore } from "../business-details-core";
@@ -5,7 +6,7 @@ describe('justifi-business-details', () => {
5
6
  it('initializes getBusiness on load with valid props', async () => {
6
7
  const page = await newSpecPage({
7
8
  components: [BusinessDetails],
8
- html: `<justifi-business-details business-id="123" auth-token="token" />`,
9
+ template: () => h("justifi-business-details", { "business-id": "123", "auth-token": "token" }),
9
10
  });
10
11
  page.waitForChanges();
11
12
  expect(page.rootInstance.getBusiness).toBeDefined();
@@ -14,7 +15,7 @@ describe('justifi-business-details', () => {
14
15
  it('sets an error message with invalid props', async () => {
15
16
  const page = await newSpecPage({
16
17
  components: [BusinessDetails],
17
- html: `<justifi-business-details></justifi-business-details>`, // No props provided
18
+ template: () => h("justifi-business-details", null), // No props provided
18
19
  });
19
20
  page.waitForChanges();
20
21
  expect(page.rootInstance.errorMessage).toBe('Invalid business id or auth token');
@@ -22,7 +23,7 @@ describe('justifi-business-details', () => {
22
23
  it('renders the error state when there is an error message', async () => {
23
24
  const page = await newSpecPage({
24
25
  components: [BusinessDetails, BusinessDetailsCore],
25
- html: `<justifi-business-details />`,
26
+ template: () => h("justifi-business-details", null),
26
27
  });
27
28
  await page.waitForChanges();
28
29
  expect(page.rootInstance.errorMessage).toBe('Invalid business id or auth token');
@@ -31,10 +32,25 @@ describe('justifi-business-details', () => {
31
32
  it('renders business-details-core when there is no error message', async () => {
32
33
  const page = await newSpecPage({
33
34
  components: [BusinessDetails, BusinessDetailsCore],
34
- html: `<justifi-business-details business-id="123" auth-token="token" />`,
35
+ template: () => h("justifi-business-details", { "business-id": "123", "auth-token": "token" }),
35
36
  });
36
37
  page.waitForChanges();
37
38
  const core = page.root.shadowRoot.querySelector('business-details-core');
38
39
  expect(core).not.toBeNull();
39
40
  });
41
+ it('emits an error event when there is no auth token', async () => {
42
+ const errorSpy = jest.fn();
43
+ const page = await newSpecPage({
44
+ components: [BusinessDetails],
45
+ template: () => h("justifi-business-details", { "business-id": "123", "onError-event": errorSpy }),
46
+ });
47
+ page.waitForChanges();
48
+ expect(errorSpy).toHaveBeenCalledWith(expect.objectContaining({
49
+ detail: {
50
+ errorCode: 'missing-props',
51
+ message: 'Invalid business id or auth token',
52
+ severity: 'error',
53
+ }
54
+ }));
55
+ });
40
56
  });
@@ -1,6 +1,7 @@
1
1
  import { makeGetBusiness } from "../get-business";
2
- import mockResponse from "../../../api/mockData/mockBusinessDetails.json";
2
+ import mockResponse from "../../../../../../mockData/mockBusinessDetails.json";
3
3
  import { Business } from "../../../api/Business";
4
+ import { API_NOT_AUTHENTICATED_ERROR } from "../../../api/shared";
4
5
  // Mocks
5
6
  jest.mock('../../../api/services/utils.ts', () => ({
6
7
  getErrorMessage: jest.fn(),
@@ -31,9 +32,7 @@ describe('makeGetBusiness', () => {
31
32
  expect(onError).not.toHaveBeenCalled();
32
33
  });
33
34
  it('calls onError with an error message on fetch error', async () => {
34
- const error = 'Test error';
35
- const responseError = { error };
36
- mockService.fetchBusiness.mockResolvedValue(responseError);
35
+ mockService.fetchBusiness.mockResolvedValue(API_NOT_AUTHENTICATED_ERROR);
37
36
  const onSuccess = jest.fn();
38
37
  const onError = jest.fn();
39
38
  const getBusiness = makeGetBusiness({
@@ -42,7 +41,11 @@ describe('makeGetBusiness', () => {
42
41
  service: mockService,
43
42
  });
44
43
  await getBusiness({ onSuccess, onError });
45
- expect(onError).toHaveBeenCalledWith({ error });
44
+ expect(onError).toHaveBeenCalledWith({
45
+ error: 'Not Authenticated',
46
+ code: 'not-authenticated',
47
+ severity: 'error',
48
+ });
46
49
  });
47
50
  it('calls onError with an error message on fetch exception', async () => {
48
51
  const error = new Error('Network error');
@@ -55,6 +58,10 @@ describe('makeGetBusiness', () => {
55
58
  service: mockService,
56
59
  });
57
60
  await getBusiness({ onSuccess, onError });
58
- expect(onError).toHaveBeenCalledWith({ error: error.message });
61
+ expect(onError).toHaveBeenCalledWith({
62
+ error: error.message,
63
+ code: 'fetch-error',
64
+ severity: 'error',
65
+ });
59
66
  });
60
67
  });
@@ -13,6 +13,52 @@ import { Business } from "../../../api/Business";
13
13
  * @exportedPart input-invalid: Invalid state for inputfs
14
14
  */
15
15
  export class BusinessForm {
16
+ constructor() {
17
+ this.sendData = async () => {
18
+ this.isLoading = true;
19
+ try {
20
+ const values = this.formController.values.getValue();
21
+ const initialValues = this.formController.getInitialValues();
22
+ const payload = parseBusiness(values, initialValues);
23
+ const response = await this.api.patch(this.businessEndpoint, JSON.stringify(payload));
24
+ this.handleReponse(response);
25
+ }
26
+ catch (error) {
27
+ this.errorMessage = BusinessFormServerErrors.patchData;
28
+ }
29
+ finally {
30
+ this.isLoading = false;
31
+ }
32
+ };
33
+ this.fetchData = async () => {
34
+ this.isLoading = true;
35
+ try {
36
+ const response = await this.api.get(this.businessEndpoint);
37
+ const business = new Business(response.data);
38
+ this.formController.setInitialValues(Object.assign({}, business));
39
+ }
40
+ catch (error) {
41
+ this.errorMessage = BusinessFormServerErrors.fetchData;
42
+ }
43
+ finally {
44
+ this.isLoading = false;
45
+ }
46
+ };
47
+ this.validateAndSubmit = (event) => {
48
+ event.preventDefault();
49
+ this.formController.validateAndSubmit(this.sendData);
50
+ };
51
+ this.authToken = undefined;
52
+ this.businessId = undefined;
53
+ this.hideErrors = false;
54
+ this.isLoading = false;
55
+ this.errorMessage = undefined;
56
+ }
57
+ fireClickEvents(event) {
58
+ console.warn('`clickEvent` is deprecated and will be removed in the next major release. Please use `click-event` instead.');
59
+ this.clickEventNew.emit(event);
60
+ this.clickEventOld.emit(event);
61
+ }
16
62
  get disabledState() {
17
63
  return this.isLoading;
18
64
  }
@@ -22,16 +68,6 @@ export class BusinessForm {
22
68
  get businessEndpoint() {
23
69
  return `entities/business/${this.businessId}`;
24
70
  }
25
- constructor() {
26
- this.authToken = undefined;
27
- this.businessId = undefined;
28
- this.hideErrors = false;
29
- this.isLoading = false;
30
- this.errorMessage = undefined;
31
- this.sendData = this.sendData.bind(this);
32
- this.fetchData = this.fetchData.bind(this);
33
- this.validateAndSubmit = this.validateAndSubmit.bind(this);
34
- }
35
71
  componentWillLoad() {
36
72
  const missingAuthTokenMessage = 'Warning: Missing auth-token. The form will not be functional without it.';
37
73
  const missingBusinessIdMessage = 'Warning: Missing business-id. The form requires an existing business-id to function.';
@@ -43,42 +79,14 @@ export class BusinessForm {
43
79
  this.api = Api(this.authToken, config.proxyApiOrigin);
44
80
  this.fetchData();
45
81
  }
46
- async sendData() {
47
- this.isLoading = true;
48
- try {
49
- const values = this.formController.values.getValue();
50
- const initialValues = this.formController.getInitialValues();
51
- const payload = parseBusiness(values, initialValues);
52
- const response = await this.api.patch(this.businessEndpoint, JSON.stringify(payload));
53
- this.submitted.emit({ data: response });
54
- }
55
- catch (error) {
82
+ handleReponse(response) {
83
+ if (response.error) {
56
84
  this.errorMessage = BusinessFormServerErrors.patchData;
57
85
  }
58
- finally {
59
- this.isLoading = false;
60
- }
61
- }
62
- async fetchData() {
63
- this.isLoading = true;
64
- try {
65
- const response = await this.api.get(this.businessEndpoint);
66
- const business = new Business(response.data);
67
- this.formController.setInitialValues(Object.assign({}, business));
68
- }
69
- catch (error) {
70
- this.errorMessage = BusinessFormServerErrors.fetchData;
71
- }
72
- finally {
73
- this.isLoading = false;
74
- }
75
- }
76
- validateAndSubmit(event) {
77
- event.preventDefault();
78
- this.formController.validateAndSubmit(this.sendData);
86
+ this.submitted.emit({ data: response });
79
87
  }
80
88
  render() {
81
- 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.clickEvent.emit({ name: BusinessFormClickActions.submit }) }, this.isLoading ? 'Loading...' : 'Submit'))))));
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'))))));
82
90
  }
83
91
  static get is() { return "justifi-business-form"; }
84
92
  static get originalStyleUrls() {
@@ -155,8 +163,29 @@ export class BusinessForm {
155
163
  }
156
164
  static get events() {
157
165
  return [{
158
- "method": "clickEvent",
159
- "name": "clickEvent",
166
+ "method": "submitted",
167
+ "name": "submitted",
168
+ "bubbles": true,
169
+ "cancelable": true,
170
+ "composed": true,
171
+ "docs": {
172
+ "tags": [],
173
+ "text": ""
174
+ },
175
+ "complexType": {
176
+ "original": "BusinessFormSubmitEvent",
177
+ "resolved": "BusinessFormSubmitEvent",
178
+ "references": {
179
+ "BusinessFormSubmitEvent": {
180
+ "location": "import",
181
+ "path": "../utils/business-form-types",
182
+ "id": "src/components/business-forms/utils/business-form-types.ts::BusinessFormSubmitEvent"
183
+ }
184
+ }
185
+ }
186
+ }, {
187
+ "method": "clickEventNew",
188
+ "name": "click-event",
160
189
  "bubbles": true,
161
190
  "cancelable": true,
162
191
  "composed": true,
@@ -176,8 +205,8 @@ export class BusinessForm {
176
205
  }
177
206
  }
178
207
  }, {
179
- "method": "submitted",
180
- "name": "submitted",
208
+ "method": "clickEventOld",
209
+ "name": "clickEvent",
181
210
  "bubbles": true,
182
211
  "cancelable": true,
183
212
  "composed": true,
@@ -186,13 +215,13 @@ export class BusinessForm {
186
215
  "text": ""
187
216
  },
188
217
  "complexType": {
189
- "original": "BusinessFormSubmitEvent",
190
- "resolved": "BusinessFormSubmitEvent",
218
+ "original": "BusinessFormClickEvent",
219
+ "resolved": "BusinessFormClickEvent",
191
220
  "references": {
192
- "BusinessFormSubmitEvent": {
221
+ "BusinessFormClickEvent": {
193
222
  "location": "import",
194
223
  "path": "../utils/business-form-types",
195
- "id": "src/components/business-forms/utils/business-form-types.ts::BusinessFormSubmitEvent"
224
+ "id": "src/components/business-forms/utils/business-form-types.ts::BusinessFormClickEvent"
196
225
  }
197
226
  }
198
227
  }
@@ -20,10 +20,7 @@ export class BusinessRepresentative {
20
20
  }
21
21
  render() {
22
22
  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-select", { name: "title", label: "Prefix", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.title, options: [
24
- { label: 'Select Prefix', value: '' },
25
- { label: 'Mrs.', value: 'Mrs.' },
26
- ], 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-business-address-form", { errors: this.errors.address, defaultValues: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.address, handleFormUpdate: values => this.onAddressFormUpdate(values) }))))));
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 }))))));
27
24
  }
28
25
  static get is() { return "justifi-business-representative"; }
29
26
  static get originalStyleUrls() {
@@ -1,4 +1,6 @@
1
1
  import { Host, h } from "@stencil/core";
2
+ import StateOptions from "../../../../utils/state-options";
3
+ import { filterPostalInput } from "../../../form/utils";
2
4
  /**
3
5
  * @exportedPart label: Label for inputs
4
6
  * @exportedPart input: The input fields
@@ -19,9 +21,9 @@ export class LegalAddressForm {
19
21
  this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { legal_address: Object.assign(Object.assign({}, this.formController.values.getValue().legal_address), { [name]: value }) }));
20
22
  }
21
23
  render() {
22
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
23
25
  const legalAddressDefaultValue = this.formController.getInitialValues().legal_address;
24
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "Business Legal Address"), h("hr", null), h("div", { class: "row gx-2 gy-2" }, h("div", { class: "col-12" }, h("form-control-text", { name: "line1", label: "Legal Address", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.line1, error: (_b = (_a = this.errors) === null || _a === void 0 ? void 0 : _a.legal_address) === null || _b === void 0 ? void 0 : _b.line1 })), h("div", { class: "col-12" }, h("form-control-text", { name: "line2", label: "Address Line 2", inputHandler: (name, value) => this.inputHandler(name, value), defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.line2 })), h("div", { class: "col-12" }, h("form-control-text", { name: "city", label: "City", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.city, error: (_d = (_c = this.errors) === null || _c === void 0 ? void 0 : _c.legal_address) === null || _d === void 0 ? void 0 : _d.city })), h("div", { class: "col-12" }, h("form-control-text", { name: "state", label: "State", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.state, error: (_f = (_e = this.errors) === null || _e === void 0 ? void 0 : _e.legal_address) === null || _f === void 0 ? void 0 : _f.state })), h("div", { class: "col-12" }, h("form-control-number", { name: "postal_code", label: "Postal Code", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.postal_code, error: (_h = (_g = this.errors) === null || _g === void 0 ? void 0 : _g.legal_address) === null || _h === void 0 ? void 0 : _h.postal_code })), h("div", { class: "col-12" }, h("form-control-select", { name: "country", label: "Country", options: [{ label: 'United States', value: 'USA' }], inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.country, error: (_k = (_j = this.errors) === null || _j === void 0 ? void 0 : _j.legal_address) === null || _k === void 0 ? void 0 : _k.country,
26
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "Business Legal Address"), h("hr", null), h("div", { class: "row gx-2 gy-2" }, h("div", { class: "col-12" }, h("form-control-text", { name: "line1", label: "Legal Address", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.line1, error: (_b = (_a = this.errors) === null || _a === void 0 ? void 0 : _a.legal_address) === null || _b === void 0 ? void 0 : _b.line1 })), h("div", { class: "col-12" }, h("form-control-text", { name: "line2", label: "Address Line 2", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.line2, error: (_d = (_c = this.errors) === null || _c === void 0 ? void 0 : _c.legal_address) === null || _d === void 0 ? void 0 : _d.line2 })), h("div", { class: "col-12" }, h("form-control-text", { name: "city", label: "City", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.city, error: (_f = (_e = this.errors) === null || _e === void 0 ? void 0 : _e.legal_address) === null || _f === void 0 ? void 0 : _f.city })), h("div", { class: "col-12" }, h("form-control-select", { name: "state", label: "State", options: StateOptions, inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.state, error: (_h = (_g = this.errors) === null || _g === void 0 ? void 0 : _g.legal_address) === null || _h === void 0 ? void 0 : _h.state })), h("div", { class: "col-12" }, h("form-control-text", { name: "postal_code", label: "Postal Code", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.postal_code, error: (_k = (_j = this.errors) === null || _j === void 0 ? void 0 : _j.legal_address) === null || _k === void 0 ? void 0 : _k.postal_code, maxLength: 5, keyDownHandler: filterPostalInput })), h("div", { class: "col-12" }, h("form-control-select", { name: "country", label: "Country", options: [{ label: 'United States', value: 'USA' }], inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.country, error: (_m = (_l = this.errors) === null || _l === void 0 ? void 0 : _l.legal_address) === null || _m === void 0 ? void 0 : _m.country,
25
27
  // just for now so we skip handling country specificities
26
28
  disabled: true }))))));
27
29
  }