@justifi/webcomponents 4.10.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 (299) hide show
  1. package/dist/cjs/{Business-663db337.js → Business-7ae04d4f.js} +46 -1
  2. package/dist/cjs/business-additional-questions-schema-18a82d19.js +47 -0
  3. package/dist/cjs/business-details-core.cjs.entry.js +7 -2
  4. package/dist/cjs/{business-form-types-3cdd5447.js → business-form-types-29b2bad9.js} +7 -0
  5. package/dist/cjs/{form-control-datepart_3.cjs.entry.js → form-control-datepart_4.cjs.entry.js} +59 -12
  6. package/dist/cjs/{form-control-number_3.cjs.entry.js → form-control-select_2.cjs.entry.js} +3 -45
  7. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +7 -1
  8. package/dist/cjs/justifi-additional-questions-form-step_5.cjs.entry.js +24 -20
  9. package/dist/cjs/justifi-additional-questions_4.cjs.entry.js +6 -8
  10. package/dist/cjs/justifi-billing-form_4.cjs.entry.js +1 -1
  11. package/dist/cjs/justifi-business-details.cjs.entry.js +21 -4
  12. package/dist/cjs/justifi-business-form.cjs.entry.js +60 -51
  13. package/dist/cjs/justifi-business-list.cjs.entry.js +1 -1
  14. package/dist/cjs/justifi-checkout.cjs.entry.js +1 -1
  15. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +29 -5
  16. package/dist/cjs/justifi-owner-form.cjs.entry.js +20 -12
  17. package/dist/cjs/justifi-payment-details.cjs.entry.js +25 -4
  18. package/dist/cjs/justifi-payment-form.cjs.entry.js +16 -3
  19. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +16 -16
  20. package/dist/cjs/justifi-payments-list.cjs.entry.js +25 -5
  21. package/dist/cjs/justifi-payout-details.cjs.entry.js +27 -7
  22. package/dist/cjs/justifi-payouts-list.cjs.entry.js +26 -6
  23. package/dist/cjs/loader.cjs.js +1 -1
  24. package/dist/cjs/payload-parsers-f437272e.js +132 -0
  25. package/dist/cjs/payment-details-core.cjs.entry.js +7 -1
  26. package/dist/cjs/payments-list-core.cjs.entry.js +8 -2
  27. package/dist/cjs/payout-details-core.cjs.entry.js +8 -3
  28. package/dist/cjs/payouts-list-core.cjs.entry.js +8 -2
  29. package/dist/cjs/{utils-df5167a8.js → utils-87435719.js} +7 -0
  30. package/dist/cjs/utils-f8079741.js +41 -0
  31. package/dist/cjs/webcomponents.cjs.js +1 -1
  32. package/dist/collection/api/Business.js +2 -1
  33. package/dist/collection/api/ComponentError.js +14 -0
  34. package/dist/collection/api/services/utils.js +11 -0
  35. package/dist/collection/api/shared.js +11 -1
  36. package/dist/collection/collection-manifest.json +1 -2
  37. package/dist/collection/components/business-details/additional-questions-details/test/additional-questions.spec.js +1 -1
  38. package/dist/collection/components/business-details/business-details-core.js +30 -2
  39. package/dist/collection/components/business-details/business-details.js +30 -0
  40. package/dist/collection/components/business-details/generic-info-details/test/generic-info-details.spec.js +1 -1
  41. package/dist/collection/components/business-details/get-business.js +15 -3
  42. package/dist/collection/components/business-details/legal-address-details/test/legal-address-details.spec.js +1 -1
  43. package/dist/collection/components/business-details/owner-details/test/owner-details.spec.js +1 -1
  44. package/dist/collection/components/business-details/representative-details/test/representative-details.spec.js +1 -1
  45. package/dist/collection/components/business-details/test/busines-details-core.spec.js +56 -16
  46. package/dist/collection/components/business-details/test/business-details.spec.js +20 -4
  47. package/dist/collection/components/business-details/test/get-business.spec.js +13 -6
  48. package/dist/collection/components/business-forms/business-form/business-form.js +79 -50
  49. package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +1 -4
  50. package/dist/collection/components/business-forms/business-form/legal-address-form/legal-address-form.js +4 -2
  51. package/dist/collection/components/business-forms/{business-form/business-address/business-address-form.js → owner-form/identity-address/identity-address-form.js} +13 -10
  52. package/dist/collection/components/business-forms/owner-form/identity-address/test/identity-address.e2e.js +9 -0
  53. 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
  54. package/dist/collection/components/business-forms/owner-form/owner-form.js +54 -8
  55. package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +20 -2
  56. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +19 -1
  57. package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step.js +44 -4
  58. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +21 -6
  59. package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step.js +23 -4
  60. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning.js +32 -14
  61. package/dist/collection/components/business-forms/schemas/business-additional-questions-schema.js +15 -6
  62. package/dist/collection/components/business-forms/schemas/business-address-schema.js +47 -12
  63. package/dist/collection/components/business-forms/schemas/business-core-info-schema.js +24 -12
  64. package/dist/collection/components/business-forms/schemas/business-form-schema.js +4 -4
  65. package/dist/collection/components/business-forms/schemas/business-identity-schema.js +29 -34
  66. package/dist/collection/components/business-forms/utils/business-form-types.js +7 -0
  67. package/dist/collection/components/business-forms/utils/helpers.js +2 -0
  68. package/dist/collection/components/form/form-control-text.js +35 -1
  69. package/dist/collection/components/form/utils.js +6 -0
  70. package/dist/collection/components/gross-payment-chart/get-gross-payment-chart-data.js +17 -2
  71. package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +30 -1
  72. package/dist/collection/components/gross-payment-chart/gross-payment-chart.js +35 -1
  73. package/dist/collection/components/gross-payment-chart/test/get-gross-payment-chart-data.spec.js +26 -8
  74. package/dist/collection/components/gross-payment-chart/test/gross-payment-chart-core.spec.js +51 -11
  75. package/dist/collection/components/gross-payment-chart/test/gross-payment-chart.spec.js +55 -3
  76. package/dist/collection/components/payment-details/get-payment-details.js +15 -3
  77. package/dist/collection/components/payment-details/payment-details-core.js +30 -1
  78. package/dist/collection/components/payment-details/payment-details.js +35 -1
  79. package/dist/collection/components/payment-details/test/get-payment-details.spec.js +11 -3
  80. package/dist/collection/components/payment-details/test/payment-details-core.spec.js +55 -12
  81. package/dist/collection/components/payment-details/test/payment-details.spec.js +69 -3
  82. package/dist/collection/components/payment-form/payment-form.js +54 -3
  83. package/dist/collection/components/payment-form/test/payment-form.spec.js +60 -1
  84. package/dist/collection/components/payments-list/get-payments.js +15 -4
  85. package/dist/collection/components/payments-list/payments-list-core.js +28 -2
  86. package/dist/collection/components/payments-list/payments-list.js +35 -1
  87. package/dist/collection/components/payments-list/test/get-payments.spec.js +11 -3
  88. package/dist/collection/components/payments-list/test/payments-list-core.spec.js +43 -28
  89. package/dist/collection/components/payments-list/test/payments-list.spec.js +31 -3
  90. package/dist/collection/components/payout-details/get-payout-details.js +17 -6
  91. package/dist/collection/components/payout-details/payout-details-core.js +31 -3
  92. package/dist/collection/components/payout-details/payout-details.js +35 -1
  93. package/dist/collection/components/payout-details/test/get-payout-details.spec.js +15 -5
  94. package/dist/collection/components/payout-details/test/payout-details-core.spec.js +54 -16
  95. package/dist/collection/components/payout-details/test/payout-details.spec.js +50 -1
  96. package/dist/collection/components/payouts-list/get-payouts.js +17 -5
  97. package/dist/collection/components/payouts-list/payouts-list-core.js +28 -2
  98. package/dist/collection/components/payouts-list/payouts-list.js +34 -1
  99. package/dist/collection/components/payouts-list/test/get-payouts.spec.js +11 -3
  100. package/dist/collection/components/payouts-list/test/payouts-list-core.spec.js +42 -29
  101. package/dist/collection/components/payouts-list/test/payouts-list.spec.js +33 -0
  102. package/dist/docs.json +753 -354
  103. package/dist/esm/{Business-6cc4e473.js → Business-91caaccb.js} +45 -2
  104. package/dist/esm/business-additional-questions-schema-b642a2b7.js +44 -0
  105. package/dist/esm/business-details-core.entry.js +8 -3
  106. package/dist/esm/{business-form-types-de9f38cd.js → business-form-types-0d76133c.js} +8 -1
  107. package/dist/esm/{form-control-datepart_3.entry.js → form-control-datepart_4.entry.js} +59 -13
  108. package/dist/esm/{form-control-number_3.entry.js → form-control-select_2.entry.js} +4 -45
  109. package/dist/esm/gross-payment-chart-core.entry.js +8 -2
  110. package/dist/esm/justifi-additional-questions-form-step_5.entry.js +22 -18
  111. package/dist/esm/justifi-additional-questions_4.entry.js +6 -8
  112. package/dist/esm/justifi-billing-form_4.entry.js +1 -1
  113. package/dist/esm/justifi-business-details.entry.js +22 -5
  114. package/dist/esm/justifi-business-form.entry.js +60 -51
  115. package/dist/esm/justifi-business-list.entry.js +1 -1
  116. package/dist/esm/justifi-checkout.entry.js +1 -1
  117. package/dist/esm/justifi-gross-payment-chart.entry.js +28 -4
  118. package/dist/esm/justifi-owner-form.entry.js +19 -11
  119. package/dist/esm/justifi-payment-details.entry.js +26 -5
  120. package/dist/esm/justifi-payment-form.entry.js +16 -3
  121. package/dist/esm/justifi-payment-provisioning.entry.js +16 -16
  122. package/dist/esm/justifi-payments-list.entry.js +26 -6
  123. package/dist/esm/justifi-payout-details.entry.js +28 -8
  124. package/dist/esm/justifi-payouts-list.entry.js +27 -7
  125. package/dist/esm/loader.js +1 -1
  126. package/dist/esm/payload-parsers-920f49dd.js +123 -0
  127. package/dist/esm/payment-details-core.entry.js +8 -2
  128. package/dist/esm/payments-list-core.entry.js +8 -2
  129. package/dist/esm/payout-details-core.entry.js +9 -4
  130. package/dist/esm/payouts-list-core.entry.js +8 -2
  131. package/dist/esm/utils-4609f32c.js +38 -0
  132. package/dist/esm/{utils-2828201a.js → utils-684d2e47.js} +7 -1
  133. package/dist/esm/webcomponents.js +1 -1
  134. package/dist/module/Business.js +45 -2
  135. package/dist/module/business-additional-questions-form-step.js +4 -2
  136. package/dist/module/business-additional-questions-schema.js +16 -7
  137. package/dist/module/business-address-schema.js +49 -14
  138. package/dist/module/business-core-info-form-step.js +3 -1
  139. package/dist/module/business-core-info-schema.js +24 -12
  140. package/dist/module/business-details-core2.js +8 -3
  141. package/dist/module/business-form-types.js +8 -1
  142. package/dist/module/business-identity-schema.js +30 -35
  143. package/dist/module/business-owners-form-step.js +12 -8
  144. package/dist/module/business-representative-form-step.js +9 -10
  145. package/dist/module/business-representative.js +4 -7
  146. package/dist/module/form-control-text2.js +5 -1
  147. package/dist/module/gross-payment-chart-core2.js +8 -2
  148. package/dist/module/helpers.js +4 -0
  149. package/dist/module/{business-address-form.js → identity-address-form.js} +17 -20
  150. package/dist/module/justifi-business-details.js +21 -4
  151. package/dist/module/justifi-business-form.js +65 -56
  152. package/dist/module/justifi-gross-payment-chart.js +28 -4
  153. package/dist/module/justifi-identity-address-form.d.ts +11 -0
  154. package/dist/module/justifi-identity-address-form.js +6 -0
  155. package/dist/module/justifi-payment-details.js +26 -5
  156. package/dist/module/justifi-payment-form.js +18 -4
  157. package/dist/module/justifi-payment-provisioning.js +24 -23
  158. package/dist/module/justifi-payments-list.js +26 -6
  159. package/dist/module/justifi-payout-details.js +28 -8
  160. package/dist/module/justifi-payouts-list.js +27 -7
  161. package/dist/module/legal-address-form-step.js +8 -11
  162. package/dist/module/legal-address-form.js +5 -9
  163. package/dist/module/owner-form.js +22 -12
  164. package/dist/module/payment-details-core2.js +8 -2
  165. package/dist/module/payment-method-form.js +1 -1
  166. package/dist/module/payments-list-core2.js +8 -2
  167. package/dist/module/payout-details-core2.js +9 -4
  168. package/dist/module/payouts-list-core2.js +8 -2
  169. package/dist/module/utils3.js +31 -1
  170. package/dist/module/utils4.js +7 -1
  171. package/dist/types/api/ComponentError.d.ts +18 -0
  172. package/dist/types/api/services/utils.d.ts +2 -0
  173. package/dist/types/api/shared.d.ts +9 -0
  174. package/dist/types/components/business-details/business-details-core.d.ts +3 -0
  175. package/dist/types/components/business-details/business-details.d.ts +3 -0
  176. package/dist/types/components/business-forms/business-form/business-form.d.ts +4 -2
  177. package/dist/types/components/business-forms/owner-form/identity-address/identity-address-form.d.ts +10 -0
  178. package/dist/types/components/business-forms/owner-form/owner-form.d.ts +5 -1
  179. package/dist/types/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.d.ts +1 -0
  180. package/dist/types/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.d.ts +1 -0
  181. package/dist/types/components/business-forms/payment-provisioning/business-owners/business-owners-form-step.d.ts +3 -1
  182. package/dist/types/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.d.ts +1 -0
  183. package/dist/types/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step.d.ts +1 -0
  184. package/dist/types/components/business-forms/payment-provisioning/payment-provisioning.d.ts +3 -2
  185. package/dist/types/components/business-forms/schemas/business-additional-questions-schema.d.ts +1 -1
  186. package/dist/types/components/business-forms/schemas/business-address-schema.d.ts +1 -12
  187. package/dist/types/components/business-forms/schemas/business-core-info-schema.d.ts +1 -1
  188. package/dist/types/components/business-forms/schemas/business-form-schema.d.ts +7 -3
  189. package/dist/types/components/business-forms/schemas/business-identity-schema.d.ts +5 -31
  190. package/dist/types/components/business-forms/utils/business-form-types.d.ts +10 -0
  191. package/dist/types/components/business-forms/utils/helpers.d.ts +2 -0
  192. package/dist/types/components/form/form-control-text.d.ts +2 -0
  193. package/dist/types/components/form/utils.d.ts +1 -0
  194. package/dist/types/components/gross-payment-chart/get-gross-payment-chart-data.d.ts +5 -8
  195. package/dist/types/components/gross-payment-chart/gross-payment-chart-core.d.ts +3 -0
  196. package/dist/types/components/gross-payment-chart/gross-payment-chart.d.ts +4 -0
  197. package/dist/types/components/payment-details/payment-details-core.d.ts +3 -0
  198. package/dist/types/components/payment-details/payment-details.d.ts +4 -0
  199. package/dist/types/components/payment-form/payment-form.d.ts +4 -1
  200. package/dist/types/components/payments-list/payments-list-core.d.ts +2 -0
  201. package/dist/types/components/payments-list/payments-list.d.ts +4 -0
  202. package/dist/types/components/payout-details/payout-details-core.d.ts +3 -0
  203. package/dist/types/components/payout-details/payout-details.d.ts +4 -0
  204. package/dist/types/components/payouts-list/payouts-list-core.d.ts +2 -0
  205. package/dist/types/components/payouts-list/payouts-list.d.ts +4 -0
  206. package/dist/types/components.d.ts +217 -43
  207. package/dist/webcomponents/p-091f9732.entry.js +1 -0
  208. package/dist/webcomponents/p-0b76c770.entry.js +1 -0
  209. package/dist/webcomponents/p-0d81883d.entry.js +1 -0
  210. package/dist/webcomponents/{p-cb8f9cb8.entry.js → p-102b593a.entry.js} +1 -1
  211. package/dist/webcomponents/p-28cd23c8.entry.js +1 -0
  212. package/dist/webcomponents/p-2b8368d2.js +1 -0
  213. package/dist/webcomponents/p-436d27b9.entry.js +1 -0
  214. package/dist/webcomponents/p-448063ba.entry.js +1 -0
  215. package/dist/webcomponents/p-5341321d.entry.js +1 -0
  216. package/dist/webcomponents/p-5b262705.entry.js +1 -0
  217. package/dist/webcomponents/p-5e503d7d.entry.js +1 -0
  218. package/dist/webcomponents/p-6047b960.entry.js +1 -0
  219. package/dist/webcomponents/p-6f294d5d.js +1 -0
  220. package/dist/webcomponents/p-7294eb89.entry.js +1 -0
  221. package/dist/webcomponents/p-746bfba6.entry.js +1 -0
  222. package/dist/webcomponents/p-7c6a355f.entry.js +1 -0
  223. package/dist/webcomponents/p-935d6f55.js +1 -0
  224. package/dist/webcomponents/{p-e924f2e1.entry.js → p-959250e3.entry.js} +1 -1
  225. package/dist/webcomponents/{p-b37d6888.entry.js → p-a130a884.entry.js} +1 -1
  226. package/dist/webcomponents/p-ac670a3e.js +1 -0
  227. package/dist/webcomponents/p-ae21ed6f.entry.js +19 -0
  228. package/dist/webcomponents/p-c071d8c1.entry.js +1 -0
  229. package/dist/webcomponents/p-c340b60f.js +1 -0
  230. package/dist/webcomponents/p-d5aab6b5.entry.js +1 -0
  231. package/dist/webcomponents/p-d5c80489.entry.js +1 -0
  232. package/dist/webcomponents/p-d776fe10.entry.js +1 -0
  233. package/dist/webcomponents/p-d8679fad.entry.js +1 -0
  234. package/dist/webcomponents/p-e84b3616.entry.js +1 -0
  235. package/dist/webcomponents/p-ea2cca2a.js +1 -0
  236. package/dist/webcomponents/webcomponents.esm.js +1 -1
  237. package/package.json +1 -1
  238. package/dist/cjs/Identity-1c4528b8.js +0 -49
  239. package/dist/cjs/business-additional-questions-schema-cbac27f2.js +0 -26
  240. package/dist/cjs/justifi-business-address-form-step.cjs.entry.js +0 -35
  241. package/dist/cjs/payload-parsers-9e72e80f.js +0 -99
  242. package/dist/cjs/utils-f5d82f21.js +0 -10
  243. package/dist/collection/api/mockData/MockOnboardingData.js +0 -117
  244. package/dist/collection/api/mockData/MockPayments.js +0 -243
  245. package/dist/collection/api/mockData/MockSubAccount.js +0 -102
  246. package/dist/collection/api/mockData/mockGrossVolumeReport.js +0 -125
  247. package/dist/collection/components/business-forms/business-form/business-address/test/business-address.e2e.js +0 -9
  248. package/dist/collection/components/business-forms/payment-provisioning/business-address/business-address-form-step.css +0 -2536
  249. package/dist/collection/components/business-forms/payment-provisioning/business-address/business-address-form-step.js +0 -97
  250. package/dist/collection/components/business-forms/payment-provisioning/business-address/test/business-address-form-step.spec.js +0 -97
  251. package/dist/collection/components/business-forms/schemas/business-owners-schema.js +0 -16
  252. package/dist/collection/components/card-form/test/card-form.e2e.js +0 -13
  253. package/dist/esm/Identity-5f8f916f.js +0 -46
  254. package/dist/esm/business-additional-questions-schema-2cb80f70.js +0 -23
  255. package/dist/esm/justifi-business-address-form-step.entry.js +0 -31
  256. package/dist/esm/payload-parsers-caea809d.js +0 -91
  257. package/dist/esm/utils-546ca6aa.js +0 -8
  258. package/dist/module/Identity.js +0 -46
  259. package/dist/module/justifi-business-address-form-step.d.ts +0 -11
  260. package/dist/module/justifi-business-address-form-step.js +0 -75
  261. package/dist/module/justifi-business-address-form.d.ts +0 -11
  262. package/dist/module/justifi-business-address-form.js +0 -6
  263. package/dist/types/api/mockData/MockOnboardingData.d.ts +0 -8
  264. package/dist/types/api/mockData/MockPayments.d.ts +0 -3
  265. package/dist/types/api/mockData/MockSubAccount.d.ts +0 -3
  266. package/dist/types/components/business-forms/business-form/business-address/business-address-form.d.ts +0 -9
  267. package/dist/types/components/business-forms/payment-provisioning/business-address/business-address-form-step.d.ts +0 -9
  268. package/dist/types/components/business-forms/schemas/business-owners-schema.d.ts +0 -33
  269. package/dist/webcomponents/p-03b1d0d5.entry.js +0 -1
  270. package/dist/webcomponents/p-0e189d6a.entry.js +0 -1
  271. package/dist/webcomponents/p-16dcf053.entry.js +0 -1
  272. package/dist/webcomponents/p-17d72f4a.js +0 -1
  273. package/dist/webcomponents/p-38ba2848.entry.js +0 -1
  274. package/dist/webcomponents/p-41870765.entry.js +0 -1
  275. package/dist/webcomponents/p-461f42b8.entry.js +0 -1
  276. package/dist/webcomponents/p-48c2400e.js +0 -1
  277. package/dist/webcomponents/p-491ca87f.js +0 -1
  278. package/dist/webcomponents/p-5be4e217.entry.js +0 -1
  279. package/dist/webcomponents/p-60714f2a.entry.js +0 -1
  280. package/dist/webcomponents/p-65500b31.entry.js +0 -19
  281. package/dist/webcomponents/p-6ed680e9.js +0 -1
  282. package/dist/webcomponents/p-7ec301b5.entry.js +0 -1
  283. package/dist/webcomponents/p-9207ccb2.entry.js +0 -1
  284. package/dist/webcomponents/p-9e4b81ad.entry.js +0 -1
  285. package/dist/webcomponents/p-a141c531.js +0 -1
  286. package/dist/webcomponents/p-a2dbe90f.entry.js +0 -1
  287. package/dist/webcomponents/p-a68519e5.entry.js +0 -1
  288. package/dist/webcomponents/p-af8363a1.entry.js +0 -1
  289. package/dist/webcomponents/p-b1bc23af.entry.js +0 -1
  290. package/dist/webcomponents/p-b5a3bf86.entry.js +0 -1
  291. package/dist/webcomponents/p-b8f22856.js +0 -1
  292. package/dist/webcomponents/p-d0761829.entry.js +0 -1
  293. package/dist/webcomponents/p-dbe32e75.entry.js +0 -1
  294. package/dist/webcomponents/p-e0c1cba8.js +0 -1
  295. package/dist/webcomponents/p-eed5f4ad.entry.js +0 -1
  296. package/dist/webcomponents/p-fe8a94c1.entry.js +0 -1
  297. /package/dist/collection/components/business-forms/{business-form/business-address/business-address-form.css → owner-form/identity-address/identity-address-form.css} +0 -0
  298. /package/dist/types/{api → home/runner/work/web-component-library/web-component-library/packages/webcomponents/.stencil}/mockData/mockGrossVolumeReport.d.ts +0 -0
  299. /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
@@ -1,7 +1,16 @@
1
1
  import { object, string } from "yup";
2
- export const additionQuestionsSchema = object({
3
- business_revenue: string().required('Enter business revenue'),
4
- business_payment_volume: string().required('Enter business payment volume'),
5
- business_dispute_volume: string().required('Enter business dispute volume'),
6
- business_receivable_volume: string().required('Enter business receivable volume'),
7
- });
2
+ export const additionalQuestionsSchema = (allowOptionalFields) => {
3
+ const schema = object({
4
+ business_revenue: string().required('Enter business revenue'),
5
+ business_payment_volume: string().required('Enter business payment volume'),
6
+ business_dispute_volume: string().required('Enter business dispute volume'),
7
+ business_receivable_volume: string().required('Enter business receivable volume'),
8
+ });
9
+ const easySchema = object({
10
+ business_revenue: string().nullable(),
11
+ business_payment_volume: string().nullable(),
12
+ business_dispute_volume: string().nullable(),
13
+ business_receivable_volume: string().nullable()
14
+ });
15
+ return allowOptionalFields ? easySchema : schema;
16
+ };
@@ -1,16 +1,51 @@
1
1
  import { object, string } from "yup";
2
2
  import StateOptions from "../../../utils/state-options";
3
- export const legalAddressSchema = object({
4
- line1: string().required('Enter street address'),
5
- line2: string().nullable(),
6
- city: string().required('Enter city'),
7
- state: string().required('Select state').oneOf(StateOptions.map((option) => option.value), 'Select state'),
8
- postal_code: string().required('Enter postal code'),
9
- country: string().required('Select country'),
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;
10
9
  });
11
- export const identityAddressSchema = object({
12
- line1: string().required('Enter street address'),
13
- city: string().required('Enter city'),
14
- state: string().required('Select state').oneOf(StateOptions.map((option) => option.value), 'Select state'),
15
- postal_code: string().required('Enter postal code'),
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;
16
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
+ });
33
+ export const addressSchema = (allowOptionalFields) => {
34
+ const schema = object({
35
+ line1: lineOneValidation.required('Enter street address'),
36
+ line2: lineTwoValidation.nullable(),
37
+ city: cityValidation.required('Enter city'),
38
+ state: stateValidation.required('Select state'),
39
+ postal_code: postalValidation.required('Enter postal code'),
40
+ country: string().required('Select country')
41
+ });
42
+ const easySchema = object({
43
+ line1: lineOneValidation.nullable(),
44
+ line2: lineTwoValidation.nullable(),
45
+ city: cityValidation.nullable(),
46
+ state: stateValidation.nullable(),
47
+ postal_code: postalValidation.nullable(),
48
+ country: string().required('Select country')
49
+ });
50
+ return allowOptionalFields ? easySchema : schema;
51
+ };
@@ -1,13 +1,25 @@
1
1
  import { object, string } from "yup";
2
- export const businessCoreInfoSchema = object({
3
- legal_name: string().required('Enter legal name'),
4
- website_url: string()
5
- .url('Enter valid website url')
6
- .required('Enter website url'),
7
- email: string().email('Enter valid email').required('Enter email'),
8
- phone: string().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'),
13
- });
2
+ import { phoneRegex, urlRegex } from "../utils/helpers";
3
+ export const businessCoreInfoSchema = (allowOptionalFields) => {
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'),
13
+ });
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(),
23
+ });
24
+ return allowOptionalFields ? easySchema : schema;
25
+ };
@@ -1,6 +1,6 @@
1
1
  import { object } from "yup";
2
2
  import { businessCoreInfoSchema } from "./business-core-info-schema";
3
- import { additionQuestionsSchema } from "./business-additional-questions-schema";
4
- import { representativeSchema } from "./business-identity-schema";
5
- import { legalAddressSchema } from "./business-address-schema";
6
- export const businessFormSchema = object(Object.assign(Object.assign({}, businessCoreInfoSchema.fields), { legal_address: legalAddressSchema, additional_questions: additionQuestionsSchema, representative: representativeSchema }));
3
+ import { additionalQuestionsSchema } from "./business-additional-questions-schema";
4
+ import { identitySchema } from "./business-identity-schema";
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') }));
@@ -1,35 +1,30 @@
1
1
  import { object, string } from "yup";
2
- import { identityAddressSchema } from "./business-address-schema";
3
- export const phoneRegex = /^[0-9]+$/;
4
- export const representativeSchema = object({
5
- name: string().required('Enter representative name'),
6
- email: string()
7
- .email('Enter valid representative email')
8
- .required('Enter representative email'),
9
- phone: string()
10
- .required('Enter representative phone number')
11
- .matches(phoneRegex, 'Phone number must contain only numbers')
12
- .min(10, 'Phone number must contain 10 digits')
13
- .max(10, 'Phone number must contain 10 digits'),
14
- dob_day: string().required('Enter representative birth day'),
15
- dob_month: string().required('Enter representative birth month'),
16
- dob_year: string().required('Enter representative birth year'),
17
- identification_number: string(),
18
- address: identityAddressSchema,
19
- });
20
- export const ownerSchema = object({
21
- name: string().required('Enter owner name'),
22
- email: string()
23
- .email('Enter valid owner email')
24
- .required('Enter owner email'),
25
- phone: string()
26
- .required('Enter owner phone number')
27
- .matches(phoneRegex, 'Phone number must contain only numbers')
28
- .min(10, 'Phone number must contain 10 digits')
29
- .max(10, 'Phone number must contain 10 digits'),
30
- dob_day: string().required('Enter owner birth day'),
31
- dob_month: string().required('Enter owner birth month'),
32
- dob_year: string().required('Enter owner birth year'),
33
- identification_number: string(),
34
- address: identityAddressSchema,
35
- });
2
+ import { addressSchema } from "./business-address-schema";
3
+ import { phoneRegex } from "../utils/helpers";
4
+ export const identitySchema = (title, allowOptionalFields) => {
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(),
15
+ address: addressSchema(allowOptionalFields),
16
+ });
17
+ 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(),
27
+ address: addressSchema(allowOptionalFields),
28
+ });
29
+ return allowOptionalFields ? easySchema : schema;
30
+ };
@@ -15,3 +15,10 @@ export var OwnerFormServerErrors;
15
15
  OwnerFormServerErrors["patchData"] = "Error updating owner data";
16
16
  OwnerFormServerErrors["postData"] = "Error adding owner data";
17
17
  })(OwnerFormServerErrors || (OwnerFormServerErrors = {}));
18
+ export var OwnerFormClickActions;
19
+ (function (OwnerFormClickActions) {
20
+ OwnerFormClickActions["removeOwner"] = "removeOwner";
21
+ OwnerFormClickActions["addOwner"] = "addOwner";
22
+ OwnerFormClickActions["addOwnerForm"] = "addOwnerForm";
23
+ OwnerFormClickActions["updateOwner"] = "updateOwner";
24
+ })(OwnerFormClickActions || (OwnerFormClickActions = {}));
@@ -0,0 +1,2 @@
1
+ export const phoneRegex = /^\d{10}$/;
2
+ export const urlRegex = /^(?:http(s)?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
@@ -5,6 +5,8 @@ export class TextInput {
5
5
  this.name = undefined;
6
6
  this.error = undefined;
7
7
  this.defaultValue = undefined;
8
+ this.keyDownHandler = undefined;
9
+ this.maxLength = undefined;
8
10
  this.disabled = undefined;
9
11
  this.inputHandler = undefined;
10
12
  this.input = undefined;
@@ -28,7 +30,7 @@ export class TextInput {
28
30
  this.updateInput(this.defaultValue);
29
31
  }
30
32
  render() {
31
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("label", { part: "label", class: "form-label", htmlFor: this.name }, this.label), h("input", { id: this.name, name: this.name, onInput: (event) => this.handleFormControlInput(event), onBlur: () => this.formControlBlur.emit(), part: `input ${this.error ? 'input-invalid ' : ''}${this.disabled ? ' input-disabled' : ''}`, class: this.error ? 'form-control is-invalid' : 'form-control', type: "text", disabled: this.disabled }), this.error && h("div", { class: "invalid-feedback" }, this.error)));
33
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("label", { part: "label", class: "form-label", htmlFor: this.name }, this.label), h("input", { id: this.name, name: this.name, onInput: (event) => this.handleFormControlInput(event), onBlur: () => this.formControlBlur.emit(), onKeyDown: (event) => this.keyDownHandler && this.keyDownHandler(event), maxLength: this.maxLength, part: `input ${this.error ? 'input-invalid ' : ''}${this.disabled ? ' input-disabled' : ''}`, class: this.error ? 'form-control is-invalid' : 'form-control', type: "text", disabled: this.disabled }), this.error && h("div", { class: "invalid-feedback" }, this.error)));
32
34
  }
33
35
  static get is() { return "form-control-text"; }
34
36
  static get encapsulation() { return "shadow"; }
@@ -112,6 +114,38 @@ export class TextInput {
112
114
  "attribute": "default-value",
113
115
  "reflect": false
114
116
  },
117
+ "keyDownHandler": {
118
+ "type": "unknown",
119
+ "mutable": false,
120
+ "complexType": {
121
+ "original": "(event: any) => void",
122
+ "resolved": "(event: any) => void",
123
+ "references": {}
124
+ },
125
+ "required": false,
126
+ "optional": true,
127
+ "docs": {
128
+ "tags": [],
129
+ "text": ""
130
+ }
131
+ },
132
+ "maxLength": {
133
+ "type": "number",
134
+ "mutable": false,
135
+ "complexType": {
136
+ "original": "number",
137
+ "resolved": "number",
138
+ "references": {}
139
+ },
140
+ "required": false,
141
+ "optional": true,
142
+ "docs": {
143
+ "tags": [],
144
+ "text": ""
145
+ },
146
+ "attribute": "max-length",
147
+ "reflect": false
148
+ },
115
149
  "disabled": {
116
150
  "type": "boolean",
117
151
  "mutable": false,
@@ -1,3 +1,9 @@
1
1
  import { h } from "@stencil/core";
2
2
  export const FormAlert = (message) => (h("div", { class: 'alert alert-danger d-flex align-items-center', role: 'alert' }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "currentColor", class: "bi bi-exclamation-triangle-fill flex-shrink-0 me-2", viewBox: "0 0 16 16", role: "img", "aria-label": "Warning:" }, h("path", { d: "M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" })), h("div", null, message)));
3
3
  export const LoadingSpinner = () => (h("div", { class: "spinner-border spinner-border-sm", role: "status" }, h("span", { class: "visually-hidden" }, "Loading...")));
4
+ export const filterPostalInput = (e) => {
5
+ const specialKeys = ['Backspace', 'Tab', 'Enter'];
6
+ if (!/^\d$/.test(e.key) && !specialKeys.includes(e.key)) {
7
+ e.preventDefault();
8
+ }
9
+ };
@@ -1,14 +1,29 @@
1
+ import { ComponentErrorSeverity } from "../../api/ComponentError";
2
+ import { getErrorCode, getErrorMessage } from "../../api/services/utils";
1
3
  export const makeGetGrossPaymentChartData = ({ id, authToken, service }) => async ({ onSuccess, onError }) => {
4
+ var _a;
2
5
  try {
3
6
  const response = await service.fetchGrossVolumeChartData(id, authToken);
4
7
  if (!response.error) {
5
8
  onSuccess(response.data);
6
9
  }
7
10
  else {
8
- onError(`Error trying to fetch data : ${response.error}`);
11
+ const errorMessage = getErrorMessage(response.error);
12
+ const code = getErrorCode((_a = response.error) === null || _a === void 0 ? void 0 : _a.code);
13
+ onError({
14
+ error: errorMessage,
15
+ code,
16
+ severity: ComponentErrorSeverity.ERROR,
17
+ });
9
18
  }
10
19
  }
11
20
  catch (error) {
12
- onError(`Error trying to fetch data : ${error}`);
21
+ const code = getErrorCode(error === null || error === void 0 ? void 0 : error.code);
22
+ const errorMessage = getErrorMessage(error);
23
+ onError({
24
+ error: errorMessage,
25
+ code,
26
+ severity: ComponentErrorSeverity.ERROR,
27
+ });
13
28
  }
14
29
  };
@@ -37,9 +37,14 @@ export class GrossPaymentChartCore {
37
37
  this.loading = false;
38
38
  this.grossVolumeReport = data;
39
39
  },
40
- onError: (error) => {
40
+ onError: ({ error, code, severity }) => {
41
41
  this.loading = false;
42
42
  this.errorMessage = error;
43
+ this.errorEvent.emit({
44
+ errorCode: code,
45
+ message: error,
46
+ severity,
47
+ });
43
48
  }
44
49
  });
45
50
  }
@@ -107,6 +112,30 @@ export class GrossPaymentChartCore {
107
112
  "errorMessage": {}
108
113
  };
109
114
  }
115
+ static get events() {
116
+ return [{
117
+ "method": "errorEvent",
118
+ "name": "error-event",
119
+ "bubbles": true,
120
+ "cancelable": true,
121
+ "composed": true,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": ""
125
+ },
126
+ "complexType": {
127
+ "original": "ComponentError",
128
+ "resolved": "ComponentError",
129
+ "references": {
130
+ "ComponentError": {
131
+ "location": "import",
132
+ "path": "../../api/ComponentError",
133
+ "id": "src/api/ComponentError.ts::ComponentError"
134
+ }
135
+ }
136
+ }
137
+ }];
138
+ }
110
139
  static get watchers() {
111
140
  return [{
112
141
  "propName": "getGrossPayment",
@@ -2,8 +2,13 @@ import { h } from "@stencil/core";
2
2
  import { ReportsService } from "../../api/services/reports.service";
3
3
  import { makeGetGrossPaymentChartData } from "./get-gross-payment-chart-data";
4
4
  import { ErrorState } from "../details/utils";
5
+ import { ComponentErrorCodes, ComponentErrorSeverity } from "../../api/ComponentError";
5
6
  export class GrossPaymentChart {
6
7
  constructor() {
8
+ this.handleErrorEvent = (event) => {
9
+ this.errorMessage = event.detail.message;
10
+ this.errorEvent.emit(event.detail);
11
+ };
7
12
  this.accountId = undefined;
8
13
  this.authToken = undefined;
9
14
  this.getGrossPayment = undefined;
@@ -25,13 +30,18 @@ export class GrossPaymentChart {
25
30
  }
26
31
  else {
27
32
  this.errorMessage = 'Account ID and Auth Token are required';
33
+ this.errorEvent.emit({
34
+ errorCode: ComponentErrorCodes.MISSING_PROPS,
35
+ message: this.errorMessage,
36
+ severity: ComponentErrorSeverity.ERROR,
37
+ });
28
38
  }
29
39
  }
30
40
  render() {
31
41
  if (this.errorMessage) {
32
42
  return ErrorState(this.errorMessage);
33
43
  }
34
- return (h("gross-payment-chart-core", { getGrossPayment: this.getGrossPayment }));
44
+ return (h("gross-payment-chart-core", { getGrossPayment: this.getGrossPayment, "onError-event": this.handleErrorEvent }));
35
45
  }
36
46
  static get is() { return "justifi-gross-payment-chart"; }
37
47
  static get encapsulation() { return "shadow"; }
@@ -79,6 +89,30 @@ export class GrossPaymentChart {
79
89
  "errorMessage": {}
80
90
  };
81
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
+ }
82
116
  static get watchers() {
83
117
  return [{
84
118
  "propName": "accountId",
@@ -1,6 +1,7 @@
1
1
  import { makeGetGrossPaymentChartData } from "../get-gross-payment-chart-data";
2
2
  import { ReportsService } from "../../../api/services/reports.service";
3
- import { mockGrossVolumeReport } from "../../../api/mockData/mockGrossVolumeReport";
3
+ import { mockGrossVolumeReport } from "../../../../../../mockData/mockGrossVolumeReport";
4
+ import { API_NOT_AUTHENTICATED_ERROR } from "../../../api/shared";
4
5
  const mockFetchGrossVolumeChartData = jest.fn().mockResolvedValue({
5
6
  data: mockGrossVolumeReport,
6
7
  error: null,
@@ -36,11 +37,7 @@ describe('makeGetGrossPaymentChartData', () => {
36
37
  expect(onError).not.toHaveBeenCalled();
37
38
  });
38
39
  it('calls onError with message on API error', async () => {
39
- const mockError = 'API error';
40
- mockFetchGrossVolumeChartData.mockResolvedValue({
41
- error: mockError,
42
- data: null,
43
- });
40
+ mockFetchGrossVolumeChartData.mockResolvedValue(API_NOT_AUTHENTICATED_ERROR);
44
41
  const onSuccess = jest.fn();
45
42
  const onError = jest.fn();
46
43
  const getGrossPaymentChartData = makeGetGrossPaymentChartData({
@@ -49,7 +46,11 @@ describe('makeGetGrossPaymentChartData', () => {
49
46
  service: mockService,
50
47
  });
51
48
  await getGrossPaymentChartData({ onSuccess, onError });
52
- expect(onError).toHaveBeenCalledWith(`Error trying to fetch data : ${mockError}`);
49
+ expect(onError).toHaveBeenCalledWith({
50
+ code: 'not-authenticated',
51
+ error: 'Not Authenticated',
52
+ severity: 'error',
53
+ });
53
54
  expect(onSuccess).not.toHaveBeenCalled();
54
55
  });
55
56
  it('calls onError with message on exception', async () => {
@@ -63,7 +64,24 @@ describe('makeGetGrossPaymentChartData', () => {
63
64
  service: mockService,
64
65
  });
65
66
  await getGrossPaymentChartData({ onSuccess, onError });
66
- expect(onError).toHaveBeenCalledWith(`Error trying to fetch data : ${mockError}`);
67
+ expect(onError).toHaveBeenCalledWith(expect.objectContaining({ error: 'Network error' }));
68
+ expect(onSuccess).not.toHaveBeenCalled();
69
+ });
70
+ it('calls onError with message on error returned', async () => {
71
+ mockFetchGrossVolumeChartData.mockResolvedValue(API_NOT_AUTHENTICATED_ERROR);
72
+ const onSuccess = jest.fn();
73
+ const onError = jest.fn();
74
+ const getGrossPaymentChartData = makeGetGrossPaymentChartData({
75
+ id: mockId,
76
+ authToken: mockAuthToken,
77
+ service: mockService,
78
+ });
79
+ await getGrossPaymentChartData({ onSuccess, onError });
80
+ expect(onError).toHaveBeenCalledWith({
81
+ code: 'not-authenticated',
82
+ error: 'Not Authenticated',
83
+ severity: 'error',
84
+ });
67
85
  expect(onSuccess).not.toHaveBeenCalled();
68
86
  });
69
87
  });
@@ -1,7 +1,9 @@
1
+ import { h } from "@stencil/core";
1
2
  import { newSpecPage } from "@stencil/core/testing";
2
3
  import { GrossPaymentChartCore } from "../gross-payment-chart-core";
3
- import mockSuccessResponse from "../../../api/mockResponses/mockGrossVolumeReportSuccess.json";
4
+ import mockSuccessResponse from "../../../../../../mockData/mockGrossVolumeReportSuccess.json";
4
5
  import { makeGetGrossPaymentChartData } from "../get-gross-payment-chart-data";
6
+ import { API_NOT_AUTHENTICATED_ERROR } from "../../../api/shared";
5
7
  const mockDataResponse = mockSuccessResponse;
6
8
  // To prevent this error https://github.com/reactchartjs/react-chartjs-2/issues/155
7
9
  jest.mock('chart.js', () => ({
@@ -11,7 +13,7 @@ describe('gross-payment-chart', () => {
11
13
  it('should initialize with default states', async () => {
12
14
  const page = await newSpecPage({
13
15
  components: [GrossPaymentChartCore],
14
- html: `<gross-payment-chart-core />`,
16
+ template: () => h("gross-payment-chart-core", null),
15
17
  });
16
18
  expect(page.rootInstance.loading).toBeTruthy();
17
19
  expect(page.rootInstance.errorMessage).toBe('');
@@ -27,18 +29,15 @@ describe('gross-payment-chart', () => {
27
29
  });
28
30
  const page = await newSpecPage({
29
31
  components: [GrossPaymentChartCore],
30
- html: `<gross-payment-chart-core />`,
32
+ template: () => h("gross-payment-chart-core", { getGrossPayment: getGrossPayment }),
31
33
  });
32
- page.rootInstance.componentWillLoad = () => { };
33
- page.rootInstance.getGrossPayment = getGrossPayment;
34
- page.rootInstance.fetchData();
35
34
  await page.waitForChanges();
36
35
  expect(page.rootInstance.grossVolumeReport).toEqual(mockDataResponse.data);
37
36
  });
38
37
  it('matches the snapshot when in loading state', async () => {
39
38
  const page = await newSpecPage({
40
39
  components: [GrossPaymentChartCore],
41
- html: `<gross-payment-chart-core></gross-payment-chart-core>`,
40
+ template: () => h("gross-payment-chart-core", null),
42
41
  });
43
42
  expect(page.root).toMatchSnapshot();
44
43
  });
@@ -53,12 +52,53 @@ describe('gross-payment-chart', () => {
53
52
  });
54
53
  const page = await newSpecPage({
55
54
  components: [GrossPaymentChartCore],
56
- html: `<gross-payment-chart-core></gross-payment-chart-core>`,
55
+ template: () => h("gross-payment-chart-core", { getGrossPayment: getGrossPayment }),
57
56
  });
58
- page.rootInstance.componentWillLoad = () => { };
59
- page.rootInstance.getGrossPayment = getGrossPayment;
60
- page.rootInstance.fetchData();
61
57
  await page.waitForChanges();
62
58
  expect(page.root).toMatchSnapshot();
63
59
  });
60
+ it('emits an error event when error occurs', async () => {
61
+ const getGrossPayment = makeGetGrossPaymentChartData({
62
+ id: 'my-account-id',
63
+ authToken: 'my-token',
64
+ service: {
65
+ fetchGrossVolumeChartData: jest.fn().mockRejectedValue('Error message')
66
+ }
67
+ });
68
+ const eventSpy = jest.fn();
69
+ const page = await newSpecPage({
70
+ components: [GrossPaymentChartCore],
71
+ template: () => h("gross-payment-chart-core", { getGrossPayment: getGrossPayment, "onError-event": eventSpy }),
72
+ });
73
+ await page.waitForChanges();
74
+ expect(eventSpy).toHaveBeenCalledWith(expect.objectContaining({
75
+ detail: {
76
+ errorCode: 'fetch-error',
77
+ message: 'Error message',
78
+ severity: 'error',
79
+ }
80
+ }));
81
+ });
82
+ it('emits an error event when API return error', async () => {
83
+ const getGrossPayment = makeGetGrossPaymentChartData({
84
+ id: 'my-account-id',
85
+ authToken: 'my-token',
86
+ service: {
87
+ fetchGrossVolumeChartData: jest.fn().mockResolvedValue(API_NOT_AUTHENTICATED_ERROR)
88
+ }
89
+ });
90
+ const eventSpy = jest.fn();
91
+ const page = await newSpecPage({
92
+ components: [GrossPaymentChartCore],
93
+ template: () => h("gross-payment-chart-core", { getGrossPayment: getGrossPayment, "onError-event": eventSpy }),
94
+ });
95
+ await page.waitForChanges();
96
+ expect(eventSpy).toHaveBeenCalledWith(expect.objectContaining({
97
+ detail: {
98
+ errorCode: 'not-authenticated',
99
+ message: 'Not Authenticated',
100
+ severity: 'error',
101
+ }
102
+ }));
103
+ });
64
104
  });