@justifi/webcomponents 4.13.0 → 4.15.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 (263) hide show
  1. package/dist/cjs/{Api-ab34a402.js → Api-3bc6e43f.js} +7 -2
  2. package/dist/cjs/{Payment-eceed10f.js → Payment-24f22eca.js} +2 -1
  3. package/dist/cjs/{SubAccount-b3902202.js → SubAccount-f1eda5da.js} +1 -1
  4. package/dist/cjs/additional-questions-details_5.cjs.entry.js +1 -1
  5. package/dist/cjs/business-additional-questions-schema-e7dd7bc3.js +57 -0
  6. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +1 -1
  7. package/dist/cjs/{index.esm-d25bd7bf.js → index.esm-a32e1831.js} +727 -0
  8. package/dist/cjs/justifi-additional-questions-form-step_5.cjs.entry.js +20 -17
  9. package/dist/cjs/justifi-additional-questions_4.cjs.entry.js +4 -1
  10. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +1796 -0
  11. package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
  12. package/dist/cjs/justifi-business-form.cjs.entry.js +8 -8
  13. package/dist/cjs/justifi-business-list.cjs.entry.js +4 -4
  14. package/dist/cjs/justifi-checkout-core.cjs.entry.js +7 -3
  15. package/dist/cjs/justifi-checkout.cjs.entry.js +12 -6
  16. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
  17. package/dist/cjs/justifi-new-payment-method_4.cjs.entry.js +13 -11
  18. package/dist/cjs/justifi-owner-form.cjs.entry.js +12 -8
  19. package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +4 -4
  20. package/dist/cjs/justifi-payment-details.cjs.entry.js +3 -3
  21. package/dist/cjs/justifi-payment-form.cjs.entry.js +39 -5
  22. package/dist/cjs/justifi-payment-method-selector.cjs.entry.js +1 -1
  23. package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -3
  24. package/dist/cjs/justifi-payout-details.cjs.entry.js +3 -3
  25. package/dist/cjs/justifi-payouts-list.cjs.entry.js +3 -3
  26. package/dist/cjs/justifi-proceeds-list.cjs.entry.js +4 -4
  27. package/dist/cjs/justifi-refund-form.cjs.entry.js +5 -6
  28. package/dist/cjs/justifi-subaccount-details.cjs.entry.js +6 -6
  29. package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +5 -5
  30. package/dist/cjs/loader.cjs.js +1 -1
  31. package/dist/cjs/payload-parsers-c2df4b29.js +95 -0
  32. package/dist/cjs/payment-details-core.cjs.entry.js +1 -1
  33. package/dist/cjs/{payment.service-336189d3.js → payment.service-35298e95.js} +4 -4
  34. package/dist/cjs/payments-list-core.cjs.entry.js +2 -2
  35. package/dist/cjs/payout-details-core.cjs.entry.js +1 -1
  36. package/dist/cjs/{payout.service-6012d576.js → payout.service-eec372aa.js} +4 -4
  37. package/dist/cjs/payouts-list-core.cjs.entry.js +2 -2
  38. package/dist/cjs/{payload-parsers-6c4b5323.js → schema-validations-3c70335c.js} +15 -89
  39. package/dist/cjs/select-input.cjs.entry.js +31 -0
  40. package/dist/cjs/subaccount-account-details_4.cjs.entry.js +1 -1
  41. package/dist/cjs/text-input.cjs.entry.js +30 -0
  42. package/dist/cjs/{utils-6f62f7a1.js → utils-e58fe016.js} +0 -2
  43. package/dist/cjs/webcomponents.cjs.js +1 -1
  44. package/dist/collection/api/Api.js +7 -2
  45. package/dist/collection/api/Payment.js +2 -1
  46. package/dist/collection/api/services/business.service.js +1 -1
  47. package/dist/collection/api/services/checkout.service.js +5 -3
  48. package/dist/collection/api/services/payment.service.js +2 -2
  49. package/dist/collection/api/services/payout.service.js +2 -2
  50. package/dist/collection/api/services/reports.service.js +1 -1
  51. package/dist/collection/collection-manifest.json +1 -1
  52. package/dist/collection/components/billing-form/billing-form-schema.js +8 -8
  53. package/dist/collection/components/billing-form/billing-form.js +49 -89
  54. package/dist/collection/components/billing-form/test/billing-form.spec.js +2 -1
  55. package/dist/collection/components/business-forms/business-form/business-form.js +1 -1
  56. package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +4 -1
  57. package/dist/collection/components/business-forms/owner-form/owner-form.js +6 -2
  58. package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +1 -1
  59. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +1 -1
  60. package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step.js +1 -1
  61. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +5 -2
  62. package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step.js +1 -1
  63. package/dist/collection/components/business-forms/schemas/business-identity-schema.js +4 -2
  64. package/dist/collection/components/business-forms/schemas/schema-validations.js +5 -0
  65. package/dist/collection/components/business-list/business-list.js +1 -1
  66. package/dist/collection/components/checkout/checkout-core.js +74 -2
  67. package/dist/collection/components/checkout/checkout.js +73 -1
  68. package/dist/collection/components/checkout/payment-method-options.css +6 -6
  69. package/dist/collection/components/checkout/payment-method-options.js +42 -6
  70. package/dist/collection/components/checkout/{sezzel-payment-method.js → sezzle-payment-method.js} +2 -2
  71. package/dist/collection/components/checkout/test/checkout-core.spec.js +1 -1
  72. package/dist/collection/components/payment-balance-transactions/payment-balance-transactions.js +1 -1
  73. package/dist/collection/components/payment-form/payment-form.js +56 -6
  74. package/dist/collection/components/payment-form/payment-method-selector.js +1 -1
  75. package/dist/collection/components/payment-form/test/payment-form.spec.js +18 -35
  76. package/dist/collection/components/payment-method-form/payment-method-form.js +1 -1
  77. package/dist/collection/components/proceeds-list/proceeds-list.js +1 -1
  78. package/dist/collection/components/refund-form/refund-form.js +1 -1
  79. package/dist/collection/components/subaccount-details/subaccount-details.js +2 -2
  80. package/dist/collection/components/subaccounts-list/subaccounts-list.js +1 -1
  81. package/dist/docs.json +287 -81
  82. package/dist/esm/{Api-e9d568c7.js → Api-b09a2f6a.js} +7 -2
  83. package/dist/esm/{Payment-ef9fc1ae.js → Payment-3e94da9c.js} +2 -1
  84. package/dist/esm/{SubAccount-f4ae9809.js → SubAccount-80d46814.js} +1 -1
  85. package/dist/esm/additional-questions-details_5.entry.js +1 -1
  86. package/dist/esm/{business-additional-questions-schema-e96b0509.js → business-additional-questions-schema-1fdc5c40.js} +2 -2
  87. package/dist/esm/gross-payment-chart-core.entry.js +1 -1
  88. package/dist/esm/{index.esm-22b47398.js → index.esm-d98bc080.js} +727 -1
  89. package/dist/esm/justifi-additional-questions-form-step_5.entry.js +16 -13
  90. package/dist/esm/justifi-additional-questions_4.entry.js +4 -1
  91. package/dist/esm/justifi-billing-form_2.entry.js +1791 -0
  92. package/dist/esm/justifi-business-details.entry.js +2 -2
  93. package/dist/esm/justifi-business-form.entry.js +7 -7
  94. package/dist/esm/justifi-business-list.entry.js +4 -4
  95. package/dist/esm/justifi-checkout-core.entry.js +7 -3
  96. package/dist/esm/justifi-checkout.entry.js +12 -6
  97. package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
  98. package/dist/esm/justifi-new-payment-method_4.entry.js +13 -11
  99. package/dist/esm/justifi-owner-form.entry.js +11 -7
  100. package/dist/esm/justifi-payment-balance-transactions.entry.js +4 -4
  101. package/dist/esm/justifi-payment-details.entry.js +3 -3
  102. package/dist/esm/justifi-payment-form.entry.js +39 -5
  103. package/dist/esm/justifi-payment-method-selector.entry.js +1 -1
  104. package/dist/esm/justifi-payments-list.entry.js +3 -3
  105. package/dist/esm/justifi-payout-details.entry.js +3 -3
  106. package/dist/esm/justifi-payouts-list.entry.js +3 -3
  107. package/dist/esm/justifi-proceeds-list.entry.js +4 -4
  108. package/dist/esm/justifi-refund-form.entry.js +4 -5
  109. package/dist/esm/justifi-subaccount-details.entry.js +6 -6
  110. package/dist/esm/justifi-subaccounts-list.entry.js +5 -5
  111. package/dist/esm/loader.js +1 -1
  112. package/dist/esm/payload-parsers-fd35eeca.js +88 -0
  113. package/dist/esm/payment-details-core.entry.js +1 -1
  114. package/dist/esm/{payment.service-2fdc5018.js → payment.service-c62d82d3.js} +4 -4
  115. package/dist/esm/payments-list-core.entry.js +2 -2
  116. package/dist/esm/payout-details-core.entry.js +1 -1
  117. package/dist/esm/{payout.service-15064bcc.js → payout.service-28b9594f.js} +4 -4
  118. package/dist/esm/payouts-list-core.entry.js +2 -2
  119. package/dist/esm/{payload-parsers-32028700.js → schema-validations-31feaa53.js} +7 -84
  120. package/dist/{module/select-input2.js → esm/select-input.entry.js} +7 -30
  121. package/dist/esm/subaccount-account-details_4.entry.js +1 -1
  122. package/dist/{module/text-input2.js → esm/text-input.entry.js} +7 -29
  123. package/dist/esm/{utils-243abdb4.js → utils-37533368.js} +1 -2
  124. package/dist/esm/webcomponents.js +1 -1
  125. package/dist/module/Api.js +7 -2
  126. package/dist/module/Payment.js +2 -1
  127. package/dist/module/billing-form.js +41 -62
  128. package/dist/module/business-additional-questions-form-step.js +2 -2
  129. package/dist/module/business-additional-questions-schema.js +1 -1
  130. package/dist/module/business-address-schema.js +1 -1
  131. package/dist/module/business-core-info-form-step.js +2 -2
  132. package/dist/module/business-core-info-schema.js +1 -1
  133. package/dist/module/business-form-types.js +1 -154
  134. package/dist/module/business-identity-schema.js +5 -3
  135. package/dist/module/business-owners-form-step.js +1 -1
  136. package/dist/module/business-representative-form-step.js +6 -3
  137. package/dist/module/business-representative.js +4 -1
  138. package/dist/module/checkout-core.js +27 -19
  139. package/dist/module/identity-address-form.js +1 -1
  140. package/dist/module/index.esm.js +727 -1
  141. package/dist/module/justifi-business-details.js +2 -2
  142. package/dist/module/justifi-business-form.js +4 -5
  143. package/dist/module/justifi-business-list.js +1 -1
  144. package/dist/module/justifi-checkout.js +34 -24
  145. package/dist/module/justifi-gross-payment-chart.js +2 -2
  146. package/dist/module/justifi-payment-balance-transactions.js +1 -1
  147. package/dist/module/justifi-payment-details.js +1 -1
  148. package/dist/module/justifi-payment-form.js +50 -15
  149. package/dist/module/justifi-payment-provisioning.js +2 -2
  150. package/dist/module/justifi-payments-list.js +1 -1
  151. package/dist/module/justifi-payout-details.js +1 -1
  152. package/dist/module/justifi-payouts-list.js +1 -1
  153. package/dist/module/justifi-proceeds-list.js +1 -1
  154. package/dist/module/justifi-refund-form.js +2 -3
  155. package/dist/module/justifi-sezzle-payment-method.d.ts +11 -0
  156. package/dist/module/justifi-sezzle-payment-method.js +6 -0
  157. package/dist/module/justifi-subaccount-details.js +2 -2
  158. package/dist/module/justifi-subaccounts-list.js +1 -1
  159. package/dist/module/legal-address-form-step.js +3 -3
  160. package/dist/module/legal-address-form.js +1 -1
  161. package/dist/module/new-payment-method.js +9 -9
  162. package/dist/module/owner-form.js +9 -5
  163. package/dist/module/payment-method-form.js +1 -1
  164. package/dist/module/payment-method-options.js +26 -22
  165. package/dist/module/payment.service.js +2 -2
  166. package/dist/module/payout.service.js +2 -2
  167. package/dist/module/schema-validations.js +159 -0
  168. package/dist/module/select-input.js +48 -1
  169. package/dist/module/{sezzel-payment-method.js → sezzle-payment-method.js} +6 -6
  170. package/dist/module/text-input.js +46 -1
  171. package/dist/module/utils2.js +1 -2
  172. package/dist/module/utils3.js +12 -21
  173. package/dist/module/utils4.js +21 -12
  174. package/dist/types/api/Api.d.ts +5 -1
  175. package/dist/types/api/Payment.d.ts +2 -1
  176. package/dist/types/components/billing-form/billing-form.d.ts +8 -15
  177. package/dist/types/components/business-forms/business-form/business-representative/business-representative.d.ts +1 -0
  178. package/dist/types/components/business-forms/owner-form/owner-form.d.ts +1 -0
  179. package/dist/types/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.d.ts +1 -0
  180. package/dist/types/components/business-forms/schemas/business-form-schema.d.ts +3 -1
  181. package/dist/types/components/business-forms/schemas/business-identity-schema.d.ts +2 -0
  182. package/dist/types/components/checkout/checkout-core.d.ts +4 -0
  183. package/dist/types/components/checkout/checkout.d.ts +4 -0
  184. package/dist/types/components/checkout/payment-method-options.d.ts +2 -0
  185. package/dist/types/components/checkout/{sezzel-payment-method.d.ts → sezzle-payment-method.d.ts} +1 -1
  186. package/dist/types/components/payment-form/payment-form.d.ts +7 -1
  187. package/dist/types/components.d.ts +38 -29
  188. package/dist/webcomponents/p-0603a526.entry.js +1 -0
  189. package/dist/webcomponents/{p-3917edbf.entry.js → p-09a6df17.entry.js} +1 -1
  190. package/dist/webcomponents/{p-7da249b8.entry.js → p-1367c4c7.entry.js} +1 -1
  191. package/dist/webcomponents/p-1b959678.entry.js +1 -0
  192. package/dist/webcomponents/{p-a6f170ba.entry.js → p-1f23c9d5.entry.js} +1 -1
  193. package/dist/webcomponents/p-21f301a0.entry.js +1 -0
  194. package/dist/webcomponents/p-243caf7c.entry.js +1 -0
  195. package/dist/webcomponents/{p-c6e207f6.entry.js → p-27ea1f3f.entry.js} +1 -1
  196. package/dist/webcomponents/{p-13e2f667.js → p-29c0b182.js} +1 -1
  197. package/dist/webcomponents/{p-28b38699.js → p-3cd675e7.js} +1 -1
  198. package/dist/webcomponents/p-3d70b0f1.entry.js +1 -0
  199. package/dist/webcomponents/{p-41bdee27.entry.js → p-55d37253.entry.js} +1 -1
  200. package/dist/webcomponents/{p-02b18979.entry.js → p-60ea8fd1.entry.js} +1 -1
  201. package/dist/webcomponents/p-624ed594.entry.js +1 -0
  202. package/dist/webcomponents/p-62bbcdfb.entry.js +1 -0
  203. package/dist/webcomponents/p-76e74f01.js +1 -0
  204. package/dist/webcomponents/p-7ca334d6.entry.js +1 -0
  205. package/dist/webcomponents/p-7d6c67bb.js +1 -0
  206. package/dist/webcomponents/{p-78b32fb9.entry.js → p-7ea5b11c.entry.js} +1 -1
  207. package/dist/webcomponents/p-83ae34bf.js +1 -0
  208. package/dist/webcomponents/p-84aea66c.entry.js +1 -0
  209. package/dist/webcomponents/p-8960e936.entry.js +1 -0
  210. package/dist/webcomponents/p-8d53f1de.entry.js +1 -0
  211. package/dist/webcomponents/p-969572f2.entry.js +1 -0
  212. package/dist/webcomponents/{p-fce2b224.entry.js → p-9a36fca6.entry.js} +1 -1
  213. package/dist/webcomponents/p-a38fdda7.entry.js +1 -0
  214. package/dist/webcomponents/{p-1334f776.entry.js → p-adc9ae0f.entry.js} +1 -1
  215. package/dist/webcomponents/p-b53d7b7f.js +1 -0
  216. package/dist/webcomponents/p-b8d70349.entry.js +1 -0
  217. package/dist/webcomponents/p-b9db1c52.entry.js +1 -0
  218. package/dist/webcomponents/p-ca39c89f.js +1 -0
  219. package/dist/webcomponents/p-d6b980a3.entry.js +1 -0
  220. package/dist/webcomponents/p-dd609661.js +1 -0
  221. package/dist/webcomponents/{p-9ba31a6a.entry.js → p-de4ffaa1.entry.js} +1 -1
  222. package/dist/webcomponents/{p-9f529959.entry.js → p-e1a3a670.entry.js} +1 -1
  223. package/dist/webcomponents/p-e4be71ee.entry.js +1 -0
  224. package/dist/webcomponents/p-e8706cc4.js +1 -0
  225. package/dist/webcomponents/{p-65510838.js → p-f4dec164.js} +1 -1
  226. package/dist/webcomponents/p-f942f90b.entry.js +1 -0
  227. package/dist/webcomponents/p-fea93cb9.entry.js +1 -0
  228. package/dist/webcomponents/{p-f76283a5.entry.js → p-fee64d38.entry.js} +1 -1
  229. package/dist/webcomponents/webcomponents.css +1 -1
  230. package/dist/webcomponents/webcomponents.esm.js +1 -1
  231. package/package.json +1 -1
  232. package/dist/cjs/business-additional-questions-schema-0a35f597.js +0 -57
  233. package/dist/cjs/form-2ad3d374.js +0 -729
  234. package/dist/cjs/justifi-billing-form_4.cjs.entry.js +0 -1864
  235. package/dist/esm/form-5279c05a.js +0 -727
  236. package/dist/esm/justifi-billing-form_4.entry.js +0 -1857
  237. package/dist/module/form.js +0 -727
  238. package/dist/module/justifi-sezzel-payment-method.d.ts +0 -11
  239. package/dist/module/justifi-sezzel-payment-method.js +0 -6
  240. package/dist/webcomponents/p-02fa533c.js +0 -1
  241. package/dist/webcomponents/p-101b2648.entry.js +0 -1
  242. package/dist/webcomponents/p-132ba228.js +0 -1
  243. package/dist/webcomponents/p-1885c478.entry.js +0 -1
  244. package/dist/webcomponents/p-23099f1f.entry.js +0 -1
  245. package/dist/webcomponents/p-230b96df.entry.js +0 -1
  246. package/dist/webcomponents/p-3da23f21.js +0 -1
  247. package/dist/webcomponents/p-4c84952f.entry.js +0 -1
  248. package/dist/webcomponents/p-64710363.entry.js +0 -1
  249. package/dist/webcomponents/p-731085e3.js +0 -1
  250. package/dist/webcomponents/p-7e334dce.entry.js +0 -1
  251. package/dist/webcomponents/p-7faacb1e.entry.js +0 -1
  252. package/dist/webcomponents/p-9b4b91ba.js +0 -1
  253. package/dist/webcomponents/p-a9af8f40.entry.js +0 -1
  254. package/dist/webcomponents/p-ade12f56.js +0 -1
  255. package/dist/webcomponents/p-b81afd51.entry.js +0 -1
  256. package/dist/webcomponents/p-bb58e656.entry.js +0 -1
  257. package/dist/webcomponents/p-bc12b8b9.js +0 -1
  258. package/dist/webcomponents/p-bfe7c55c.entry.js +0 -1
  259. package/dist/webcomponents/p-c1be3378.entry.js +0 -1
  260. package/dist/webcomponents/p-cb31488b.entry.js +0 -1
  261. package/dist/webcomponents/p-d0a8c631.entry.js +0 -1
  262. package/dist/webcomponents/p-d7d40d26.entry.js +0 -1
  263. package/dist/webcomponents/p-efbc8ffc.entry.js +0 -1
@@ -63,6 +63,9 @@ export class BusinessRepresentativeFormStep {
63
63
  get businessEndpoint() {
64
64
  return `entities/business/${this.businessId}`;
65
65
  }
66
+ get identificationNumberLabel() {
67
+ return this.representative.ssn_last4 ? 'Update SSN (optional)' : 'SSN';
68
+ }
66
69
  handleResponse(response, onSuccess) {
67
70
  if (response.error) {
68
71
  this.serverError.emit({ data: response.error, message: BusinessFormServerErrors.patchData });
@@ -84,7 +87,7 @@ export class BusinessRepresentativeFormStep {
84
87
  if (!this.businessId)
85
88
  console.error(missingBusinessIdMessage);
86
89
  this.formController = new FormController(identitySchema('representative', this.allowOptionalFields));
87
- this.api = Api(this.authToken, config.proxyApiOrigin);
90
+ this.api = Api({ authToken: this.authToken, apiOrigin: config.proxyApiOrigin });
88
91
  this.fetchData();
89
92
  }
90
93
  componentDidLoad() {
@@ -93,7 +96,7 @@ export class BusinessRepresentativeFormStep {
93
96
  }
94
97
  render() {
95
98
  const representativeDefaultValue = this.formController.getInitialValues();
96
- return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", null, h("fieldset", null, h("legend", null, "Representative"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-8" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-4" }, h("form-control-text", { name: "title", label: "Title", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.title, error: this.errors.title, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.email, error: this.errors.email, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-number-masked", { name: "phone", label: "Phone Number", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { class: "col-12 col-md-4" }, h("form-control-date", { name: "dob_full", label: "Birth Date", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_full, error: this.errors.dob_full, inputHandler: this.inputHandler, onFormControlInput: this.onDateOfBirthUpdate })), h("div", { class: "col-12 col-md-8" }, h("form-control-number-masked", { name: "identification_number", label: "SSN", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.identification_number, error: this.errors.identification_number, inputHandler: this.inputHandler, mask: SSN_MASK })), h("div", { class: "col-12" }, h("justifi-identity-address-form", { errors: this.errors.address, defaultValues: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate })))))));
99
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", null, h("fieldset", null, h("legend", null, "Representative"), h("hr", null), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-8" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.name, error: this.errors.name, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-4" }, h("form-control-text", { name: "title", label: "Title", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.title, error: this.errors.title, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email Address", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.email, error: this.errors.email, inputHandler: this.inputHandler })), h("div", { class: "col-12 col-md-6" }, h("form-control-number-masked", { name: "phone", label: "Phone Number", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.phone, error: this.errors.phone, inputHandler: this.inputHandler, mask: PHONE_MASKS.US })), h("div", { class: "col-12 col-md-4" }, h("form-control-date", { name: "dob_full", label: "Birth Date", defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.dob_full, error: this.errors.dob_full, inputHandler: this.inputHandler, onFormControlInput: this.onDateOfBirthUpdate })), h("div", { class: "col-12 col-md-8" }, h("form-control-number-masked", { name: "identification_number", label: this.identificationNumberLabel, defaultValue: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.identification_number, error: this.errors.identification_number, inputHandler: this.inputHandler, mask: SSN_MASK })), h("div", { class: "col-12" }, h("justifi-identity-address-form", { errors: this.errors.address, defaultValues: representativeDefaultValue === null || representativeDefaultValue === void 0 ? void 0 : representativeDefaultValue.address, handleFormUpdate: this.onAddressFormUpdate })))))));
97
100
  }
98
101
  static get is() { return "justifi-business-representative-form-step"; }
99
102
  static get originalStyleUrls() {
@@ -77,7 +77,7 @@ export class LegalAddressFormStep {
77
77
  if (!this.businessId)
78
78
  console.error(missingBusinessIdMessage);
79
79
  this.formController = new FormController(addressSchema(this.allowOptionalFields));
80
- this.api = Api(this.authToken, config.proxyApiOrigin);
80
+ this.api = Api({ authToken: this.authToken, apiOrigin: config.proxyApiOrigin });
81
81
  this.fetchData();
82
82
  }
83
83
  componentDidLoad() {
@@ -1,4 +1,4 @@
1
- import { object } from "yup";
1
+ import { object, string } from "yup";
2
2
  import { addressSchema } from "./business-address-schema";
3
3
  import { dobValidation, emailValidation, identityNameValidation, identityTitleValidation, phoneValidation, ssnValidation } from "./schema-validations";
4
4
  export const identitySchema = (role, allowOptionalFields) => {
@@ -8,7 +8,8 @@ export const identitySchema = (role, allowOptionalFields) => {
8
8
  email: emailValidation.required(`Enter ${role} email`),
9
9
  phone: phoneValidation.required('Enter phone number'),
10
10
  dob_full: dobValidation(role).required('Enter date of birth'),
11
- identification_number: ssnValidation.required('Enter SSN'),
11
+ ssn_last4: string().nullable(),
12
+ identification_number: ssnValidation,
12
13
  address: addressSchema(allowOptionalFields),
13
14
  });
14
15
  const easySchema = object({
@@ -17,6 +18,7 @@ export const identitySchema = (role, allowOptionalFields) => {
17
18
  email: emailValidation.nullable(),
18
19
  phone: phoneValidation.nullable(),
19
20
  dob_full: dobValidation(role).nullable(),
21
+ ssn_last4: string().nullable(),
20
22
  identification_number: ssnValidation.nullable(),
21
23
  address: addressSchema(allowOptionalFields),
22
24
  });
@@ -78,6 +78,11 @@ export const dobValidation = (role) => {
78
78
  };
79
79
  export const ssnValidation = string()
80
80
  .matches(ssnRegex, 'Enter valid SSN')
81
+ .when('ssn_last4', {
82
+ is: (val) => !val || val.length === 0,
83
+ then: (schema) => schema.required('Enter SSN'),
84
+ otherwise: (schema) => schema.nullable(),
85
+ })
81
86
  .test('not-repeat', 'Enter valid SSN', (value) => {
82
87
  return !/^(\d)\1+$/.test(value);
83
88
  })
@@ -60,7 +60,7 @@ export class BusinessList {
60
60
  this.loading = true;
61
61
  const endpoint = `entities/business`;
62
62
  let accountIDParam = { account_id: this.accountId };
63
- const response = await Api(this.authToken, config.proxyApiOrigin)
63
+ const response = await Api({ authToken: this.authToken, apiOrigin: config.proxyApiOrigin })
64
64
  .get(endpoint, Object.assign(Object.assign({}, accountIDParam), this.params));
65
65
  if (!response.error) {
66
66
  this.paging = Object.assign(Object.assign({}, this.paging), response.page_info);
@@ -23,6 +23,10 @@ export class CheckoutCore {
23
23
  this.getCheckout = undefined;
24
24
  this.complete = undefined;
25
25
  this.checkoutId = undefined;
26
+ this.disableCreditCard = undefined;
27
+ this.disableBankAccount = undefined;
28
+ this.disableBnpl = undefined;
29
+ this.disablePaymentMethodGroup = undefined;
26
30
  this.hasLoadedFonts = false;
27
31
  this.isLoading = false;
28
32
  this.checkout = undefined;
@@ -101,8 +105,8 @@ export class CheckoutCore {
101
105
  }
102
106
  }
103
107
  render() {
104
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
105
- return (h(Host, null, h("div", { class: "row gy-3 jfi-checkout-core" }, h("div", { class: "col-12 mb-4" }, h("h2", { class: "fs-5 fw-bold pb-3 jfi-header" }, "Summary"), this.checkout && (h("div", null, h("div", { class: "jfi-payment-description" }, (_a = this.checkout) === null || _a === void 0 ? void 0 : _a.payment_description), h("div", { class: "jfi-payment-total" }, h("span", { class: "jfi-payment-total-label" }, "Total"), "\u00A0", h("span", { class: "jfi-payment-total-amount" }, formatCurrency(+this.checkout.payment_amount)))))), h("div", { class: "col-12" }, h("h2", { class: "fs-5 fw-bold pb-3 jfi-header" }, "Payment"), h("h3", { class: "fs-6 fw-bold lh-lg" }, "Select payment type"), h("div", { class: "d-flex flex-column" }, h("justifi-payment-method-options", { ref: (el) => (this.paymentMethodOptionsRef = el), "show-card": ((_c = (_b = this.checkout) === null || _b === void 0 ? void 0 : _b.payment_settings) === null || _c === void 0 ? void 0 : _c.credit_card_payments) || true, "show-ach": ((_e = (_d = this.checkout) === null || _d === void 0 ? void 0 : _d.payment_settings) === null || _e === void 0 ? void 0 : _e.ach_payments) || true, bnpl: (_f = this.checkout) === null || _f === void 0 ? void 0 : _f.bnpl, "client-id": (_g = this.checkout) === null || _g === void 0 ? void 0 : _g.payment_client_id, "account-id": (_h = this.checkout) === null || _h === void 0 ? void 0 : _h.account_id, savedPaymentMethods: ((_j = this.checkout) === null || _j === void 0 ? void 0 : _j.payment_methods) || [], paymentAmount: (_k = this.checkout) === null || _k === void 0 ? void 0 : _k.payment_amount }))), h("div", { class: "col-12" }, h("div", { class: "d-flex justify-content-end" }, h("button", { type: "submit", onClick: event => this.submit(event), disabled: this.isLoading, part: "pay-button", class: `btn btn-primary jfi-submit-button ${this.isLoading ? 'jfi-submit-button-loading' : ''}` }, this.isLoading ? this.loadingSpinner : 'Pay'))))));
108
+ var _a, _b, _c, _d, _e, _f;
109
+ return (h(Host, null, h("div", { class: "row gy-3 jfi-checkout-core" }, h("div", { class: "col-12 mb-4" }, h("h2", { class: "fs-5 fw-bold pb-3 jfi-header" }, "Summary"), this.checkout && (h("div", null, h("div", { class: "jfi-payment-description" }, (_a = this.checkout) === null || _a === void 0 ? void 0 : _a.payment_description), h("div", { class: "jfi-payment-total" }, h("span", { class: "jfi-payment-total-label" }, "Total"), "\u00A0", h("span", { class: "jfi-payment-total-amount" }, formatCurrency(+this.checkout.payment_amount)))))), h("div", { class: "col-12" }, h("h2", { class: "fs-5 fw-bold pb-3 jfi-header" }, "Payment"), h("h3", { class: "fs-6 fw-bold lh-lg" }, "Select payment type"), h("div", { class: "d-flex flex-column" }, h("justifi-payment-method-options", { ref: (el) => (this.paymentMethodOptionsRef = el), "show-card": !this.disableCreditCard, "show-ach": !this.disableBankAccount, "show-bnpl": !this.disableBnpl, "show-saved-payment-methods": !this.disablePaymentMethodGroup, bnpl: (_b = this.checkout) === null || _b === void 0 ? void 0 : _b.bnpl, "client-id": (_c = this.checkout) === null || _c === void 0 ? void 0 : _c.payment_client_id, "account-id": (_d = this.checkout) === null || _d === void 0 ? void 0 : _d.account_id, savedPaymentMethods: ((_e = this.checkout) === null || _e === void 0 ? void 0 : _e.payment_methods) || [], paymentAmount: (_f = this.checkout) === null || _f === void 0 ? void 0 : _f.payment_amount }))), h("div", { class: "col-12" }, h("div", { class: "d-flex justify-content-end" }, h("button", { type: "submit", onClick: event => this.submit(event), disabled: this.isLoading, part: "pay-button", class: `btn btn-primary jfi-submit-button ${this.isLoading ? 'jfi-submit-button-loading' : ''}` }, this.isLoading ? this.loadingSpinner : 'Pay'))))));
106
110
  }
107
111
  static get is() { return "justifi-checkout-core"; }
108
112
  static get encapsulation() { return "shadow"; }
@@ -209,6 +213,74 @@ export class CheckoutCore {
209
213
  },
210
214
  "attribute": "checkout-id",
211
215
  "reflect": false
216
+ },
217
+ "disableCreditCard": {
218
+ "type": "boolean",
219
+ "mutable": false,
220
+ "complexType": {
221
+ "original": "boolean",
222
+ "resolved": "boolean",
223
+ "references": {}
224
+ },
225
+ "required": false,
226
+ "optional": true,
227
+ "docs": {
228
+ "tags": [],
229
+ "text": ""
230
+ },
231
+ "attribute": "disable-credit-card",
232
+ "reflect": false
233
+ },
234
+ "disableBankAccount": {
235
+ "type": "boolean",
236
+ "mutable": false,
237
+ "complexType": {
238
+ "original": "boolean",
239
+ "resolved": "boolean",
240
+ "references": {}
241
+ },
242
+ "required": false,
243
+ "optional": true,
244
+ "docs": {
245
+ "tags": [],
246
+ "text": ""
247
+ },
248
+ "attribute": "disable-bank-account",
249
+ "reflect": false
250
+ },
251
+ "disableBnpl": {
252
+ "type": "boolean",
253
+ "mutable": false,
254
+ "complexType": {
255
+ "original": "boolean",
256
+ "resolved": "boolean",
257
+ "references": {}
258
+ },
259
+ "required": false,
260
+ "optional": true,
261
+ "docs": {
262
+ "tags": [],
263
+ "text": ""
264
+ },
265
+ "attribute": "disable-bnpl",
266
+ "reflect": false
267
+ },
268
+ "disablePaymentMethodGroup": {
269
+ "type": "boolean",
270
+ "mutable": false,
271
+ "complexType": {
272
+ "original": "boolean",
273
+ "resolved": "boolean",
274
+ "references": {}
275
+ },
276
+ "required": false,
277
+ "optional": true,
278
+ "docs": {
279
+ "tags": [],
280
+ "text": ""
281
+ },
282
+ "attribute": "disable-payment-method-group",
283
+ "reflect": false
212
284
  }
213
285
  };
214
286
  }
@@ -7,6 +7,10 @@ export class Checkout {
7
7
  this.iframeOrigin = undefined;
8
8
  this.authToken = undefined;
9
9
  this.checkoutId = undefined;
10
+ this.disableCreditCard = undefined;
11
+ this.disableBankAccount = undefined;
12
+ this.disableBnpl = undefined;
13
+ this.disablePaymentMethodGroup = undefined;
10
14
  this.getCheckout = undefined;
11
15
  this.complete = undefined;
12
16
  this.errorMessage = '';
@@ -39,7 +43,7 @@ export class Checkout {
39
43
  this.initializeGetCheckout();
40
44
  }
41
45
  render() {
42
- return (h("justifi-checkout-core", { getCheckout: this.getCheckout, complete: this.complete }));
46
+ return (h("justifi-checkout-core", { getCheckout: this.getCheckout, complete: this.complete, disableCreditCard: this.disableCreditCard, disableBankAccount: this.disableBankAccount, disableBnpl: this.disableBnpl, disablePaymentMethodGroup: this.disablePaymentMethodGroup }));
43
47
  }
44
48
  static get is() { return "justifi-checkout"; }
45
49
  static get properties() {
@@ -94,6 +98,74 @@ export class Checkout {
94
98
  },
95
99
  "attribute": "checkout-id",
96
100
  "reflect": false
101
+ },
102
+ "disableCreditCard": {
103
+ "type": "boolean",
104
+ "mutable": false,
105
+ "complexType": {
106
+ "original": "boolean",
107
+ "resolved": "boolean",
108
+ "references": {}
109
+ },
110
+ "required": false,
111
+ "optional": true,
112
+ "docs": {
113
+ "tags": [],
114
+ "text": ""
115
+ },
116
+ "attribute": "disable-credit-card",
117
+ "reflect": false
118
+ },
119
+ "disableBankAccount": {
120
+ "type": "boolean",
121
+ "mutable": false,
122
+ "complexType": {
123
+ "original": "boolean",
124
+ "resolved": "boolean",
125
+ "references": {}
126
+ },
127
+ "required": false,
128
+ "optional": true,
129
+ "docs": {
130
+ "tags": [],
131
+ "text": ""
132
+ },
133
+ "attribute": "disable-bank-account",
134
+ "reflect": false
135
+ },
136
+ "disableBnpl": {
137
+ "type": "boolean",
138
+ "mutable": false,
139
+ "complexType": {
140
+ "original": "boolean",
141
+ "resolved": "boolean",
142
+ "references": {}
143
+ },
144
+ "required": false,
145
+ "optional": true,
146
+ "docs": {
147
+ "tags": [],
148
+ "text": ""
149
+ },
150
+ "attribute": "disable-bnpl",
151
+ "reflect": false
152
+ },
153
+ "disablePaymentMethodGroup": {
154
+ "type": "boolean",
155
+ "mutable": false,
156
+ "complexType": {
157
+ "original": "boolean",
158
+ "resolved": "boolean",
159
+ "references": {}
160
+ },
161
+ "required": false,
162
+ "optional": true,
163
+ "docs": {
164
+ "tags": [],
165
+ "text": ""
166
+ },
167
+ "attribute": "disable-payment-method-group",
168
+ "reflect": false
97
169
  }
98
170
  };
99
171
  }
@@ -7072,16 +7072,16 @@ textarea.form-control-lg {
7072
7072
  cursor: pointer;
7073
7073
  }
7074
7074
  .payment-method-header input[type=radio] {
7075
- background-color: var(--jfi-radio-button-background-color);
7076
- border-color: var(--jfi-radio-button-border-color);
7075
+ background-color: var(--jfi-radio-input-background-color);
7076
+ border-color: var(--jfi-radio-input-border-color);
7077
7077
  }
7078
7078
  .payment-method-header input[type=radio]:checked, .payment-method-header input[type=radio]:checked:focus {
7079
- background-color: var(--jfi-radio-button-background-color-selected);
7080
- border-color: var(--jfi-radio-button-border-color-selected);
7079
+ background-color: var(--jfi-radio-input-background-color-selected);
7080
+ border-color: var(--jfi-radio-input-border-color-selected);
7081
7081
  }
7082
7082
  .payment-method-header input[type=radio]:focus {
7083
- border-color: var(--jfi-radio-button-border-color-focus);
7084
- box-shadow: var(--jfi-radio-button-box-shadow-focus);
7083
+ border-color: var(--jfi-radio-input-border-color-focus);
7084
+ box-shadow: var(--jfi-radio-input-box-shadow-focus);
7085
7085
  }
7086
7086
  .payment-method-header:hover {
7087
7087
  color: var(--jfi-radio-button-group-color-hover);
@@ -6,6 +6,8 @@ export class PaymentMethodOptions {
6
6
  constructor() {
7
7
  this.showCard = undefined;
8
8
  this.showAch = undefined;
9
+ this.showBnpl = undefined;
10
+ this.showSavedPaymentMethods = undefined;
9
11
  this.bnpl = undefined;
10
12
  this.clientId = undefined;
11
13
  this.accountId = undefined;
@@ -24,8 +26,8 @@ export class PaymentMethodOptions {
24
26
  if (this.showAch) {
25
27
  this.paymentMethodOptions.push(new PaymentMethodOption({ id: PaymentMethodTypes.bankAccount }));
26
28
  }
27
- if (((_a = this.bnpl) === null || _a === void 0 ? void 0 : _a.provider) === 'sezzle') {
28
- this.paymentMethodOptions.push(new PaymentMethodOption({ id: PaymentMethodTypes.sezzel }));
29
+ if (this.showBnpl && ((_a = this.bnpl) === null || _a === void 0 ? void 0 : _a.provider) === 'sezzle') {
30
+ this.paymentMethodOptions.push(new PaymentMethodOption({ id: PaymentMethodTypes.sezzle }));
29
31
  }
30
32
  this.selectedPaymentMethodId = this.paymentMethodOptions[0].id;
31
33
  }
@@ -42,7 +44,7 @@ export class PaymentMethodOptions {
42
44
  const newCard = paymentMethodOption.id === PaymentMethodTypes.card;
43
45
  const newBankAccount = paymentMethodOption.id === PaymentMethodTypes.bankAccount;
44
46
  const isSelected = this.selectedPaymentMethodId === paymentMethodOption.id;
45
- const sezzel = paymentMethodOption.id === PaymentMethodTypes.sezzel;
47
+ const sezzle = paymentMethodOption.id === PaymentMethodTypes.sezzle;
46
48
  if (newCard || newBankAccount) {
47
49
  return (h("justifi-new-payment-method", { paymentMethodOption: paymentMethodOption, "client-id": this.clientId, "account-id": this.accountId, "is-selected": isSelected, ref: (el) => {
48
50
  if (isSelected) {
@@ -50,14 +52,14 @@ export class PaymentMethodOptions {
50
52
  }
51
53
  } }));
52
54
  }
53
- else if (sezzel) {
54
- return (h("justifi-sezzel-payment-method", { paymentMethodOption: paymentMethodOption, "is-selected": isSelected, paymentAmount: this.paymentAmount, bnpl: this.bnpl, ref: (el) => {
55
+ else if (sezzle) {
56
+ return (h("justifi-sezzle-payment-method", { paymentMethodOption: paymentMethodOption, "is-selected": isSelected, paymentAmount: this.paymentAmount, bnpl: this.bnpl, ref: (el) => {
55
57
  if (isSelected) {
56
58
  this.selectedPaymentMethodOptionRef = el;
57
59
  }
58
60
  } }));
59
61
  }
60
- else {
62
+ else if (this.showSavedPaymentMethods) {
61
63
  return (h("justifi-saved-payment-method", { paymentMethodOption: paymentMethodOption, "is-selected": isSelected, ref: (el) => {
62
64
  if (isSelected) {
63
65
  this.selectedPaymentMethodOptionRef = el;
@@ -113,6 +115,40 @@ export class PaymentMethodOptions {
113
115
  "attribute": "show-ach",
114
116
  "reflect": false
115
117
  },
118
+ "showBnpl": {
119
+ "type": "boolean",
120
+ "mutable": false,
121
+ "complexType": {
122
+ "original": "boolean",
123
+ "resolved": "boolean",
124
+ "references": {}
125
+ },
126
+ "required": false,
127
+ "optional": false,
128
+ "docs": {
129
+ "tags": [],
130
+ "text": ""
131
+ },
132
+ "attribute": "show-bnpl",
133
+ "reflect": false
134
+ },
135
+ "showSavedPaymentMethods": {
136
+ "type": "boolean",
137
+ "mutable": false,
138
+ "complexType": {
139
+ "original": "boolean",
140
+ "resolved": "boolean",
141
+ "references": {}
142
+ },
143
+ "required": false,
144
+ "optional": false,
145
+ "docs": {
146
+ "tags": [],
147
+ "text": ""
148
+ },
149
+ "attribute": "show-saved-payment-methods",
150
+ "reflect": false
151
+ },
116
152
  "bnpl": {
117
153
  "type": "unknown",
118
154
  "mutable": false,
@@ -7,7 +7,7 @@ const sezzleLogo = (h("img", { class: "sezzle-smart-button-logo-img", src: "http
7
7
  marginLeft: '5px',
8
8
  marginTop: '-5px',
9
9
  } }));
10
- export class SezzelPaymentMethod {
10
+ export class SezzlePaymentMethod {
11
11
  constructor() {
12
12
  this.onPaymentMethodOptionClick = () => {
13
13
  this.paymentMethodOptionSelected.emit(this.paymentMethodOption);
@@ -64,7 +64,7 @@ export class SezzelPaymentMethod {
64
64
  var _a, _b, _c, _d, _e;
65
65
  return (h("div", { class: "payment-method" }, h("script", { src: "https://checkout-sdk.sezzle.com/checkout.min.js", async: true, ref: (el) => (this.scriptRef = el) }), h("div", { class: `payment-method-header p-3`, onClick: () => this.onPaymentMethodOptionClick() }, h("input", { type: "radio", name: "paymentMethodType", id: (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id, value: (_b = this.paymentMethodOption) === null || _b === void 0 ? void 0 : _b.id, onClick: (event) => event.preventDefault(), checked: this.isSelected, class: "form-check-input me-2" }), h("label", { htmlFor: (_c = this.paymentMethodOption) === null || _c === void 0 ? void 0 : _c.id, class: "form-check-label" }, h("div", null, "Buy now, pay later with ", sezzleLogo), this.installmentPlan && (h("small", null, h("span", null, (_d = this.installmentPlan) === null || _d === void 0 ? void 0 : _d.installments.length), "\u00A0", h("span", null, this.installmentPlan.schedule, " payments of"), "\u00A0", h("span", { class: "fw-bold" }, formatCurrency((_e = this.installmentPlan) === null || _e === void 0 ? void 0 : _e.installments[0].amountInCents))))))));
66
66
  }
67
- static get is() { return "justifi-sezzel-payment-method"; }
67
+ static get is() { return "justifi-sezzle-payment-method"; }
68
68
  static get properties() {
69
69
  return {
70
70
  "iframeOrigin": {
@@ -8,7 +8,7 @@ import mockGetCheckoutSuccess from "./../../../../../../mockData/mockGetCheckout
8
8
  import mockPostCheckoutSuccess from "./../../../../../../mockData/mockPostCheckoutSuccess.json";
9
9
  import { PaymentMethodOptions } from "../payment-method-options";
10
10
  describe('justifi-checkout-core', () => {
11
- it('should display loading state correclty', async () => {
11
+ it('should display loading state correctly', async () => {
12
12
  const page = await newSpecPage({
13
13
  components: [CheckoutCore],
14
14
  template: () => h("justifi-checkout-core", null),
@@ -37,7 +37,7 @@ export class PaymentBalanceTransactions {
37
37
  return;
38
38
  }
39
39
  const endpoint = `account/${this.accountId}/payments/${this.paymentId}/payment_balance_transactions`;
40
- const response = await Api(this.authToken, config.proxyApiOrigin).get(endpoint, this.params);
40
+ const response = await Api({ authToken: this.authToken, apiOrigin: config.proxyApiOrigin }).get(endpoint, this.params);
41
41
  if (!response.error) {
42
42
  this.paging = Object.assign(Object.assign({}, this.paging), response.page_info);
43
43
  this.balanceTransactions = response.data.map(dataItem => new PaymentBalanceTransaction(dataItem));
@@ -7,15 +7,26 @@ import { getErrorMessage } from "../../api/services/utils";
7
7
  export class PaymentForm {
8
8
  constructor() {
9
9
  this.bankAccount = undefined;
10
- this.card = true;
10
+ this.card = undefined;
11
11
  this.email = undefined;
12
12
  this.clientId = undefined;
13
+ this.authToken = undefined;
13
14
  this.accountId = undefined;
14
15
  this.submitButtonText = undefined;
15
16
  this.submitButtonEnabled = true;
16
17
  this.isLoading = false;
17
18
  this.selectedPaymentMethodType = PaymentMethodTypes.card;
18
19
  }
20
+ componentWillLoad() {
21
+ if (!this.validateProps()) {
22
+ this.errorEvent.emit({
23
+ errorCode: ComponentErrorCodes.MISSING_PROPS,
24
+ message: 'clientId or authToken is required',
25
+ severity: ComponentErrorSeverity.ERROR
26
+ });
27
+ this.submitButtonEnabled = false;
28
+ }
29
+ }
19
30
  connectedCallback() {
20
31
  loadFontsOnParent();
21
32
  }
@@ -28,10 +39,33 @@ export class PaymentForm {
28
39
  async disableSubmitButton() {
29
40
  this.submitButtonEnabled = false;
30
41
  }
42
+ showPaymentMethodTypeSelector() {
43
+ return this.card && this.bankAccount;
44
+ }
45
+ getSelectedPaymentMethodType() {
46
+ if (this.showPaymentMethodTypeSelector()) {
47
+ return this.selectedPaymentMethodType;
48
+ }
49
+ else if (this.card) {
50
+ return PaymentMethodTypes.card;
51
+ }
52
+ else if (this.bankAccount) {
53
+ return PaymentMethodTypes.bankAccount;
54
+ }
55
+ else {
56
+ return PaymentMethodTypes.card;
57
+ }
58
+ }
31
59
  paymentMethodSelectedHandler(event) {
32
60
  const paymentMethodType = event.detail;
33
61
  this.selectedPaymentMethodType = paymentMethodType;
34
62
  }
63
+ validateProps() {
64
+ return !!(this.clientId || this.authToken);
65
+ }
66
+ getToken() {
67
+ return this.authToken || this.clientId;
68
+ }
35
69
  async submit(event) {
36
70
  event.preventDefault();
37
71
  if (!this.paymentMethodFormRef || !this.billingFormRef)
@@ -44,7 +78,7 @@ export class PaymentForm {
44
78
  try {
45
79
  const billingFormFieldValues = await this.billingFormRef.getValues();
46
80
  const paymentMethodData = Object.assign({ email: this.email }, billingFormFieldValues);
47
- const tokenizeResponse = await this.paymentMethodFormRef.tokenize(this.clientId, paymentMethodData, this.accountId);
81
+ const tokenizeResponse = await this.paymentMethodFormRef.tokenize(this.getToken(), paymentMethodData, this.accountId);
48
82
  if (tokenizeResponse.error) {
49
83
  this.errorEvent.emit({
50
84
  errorCode: ComponentErrorCodes.TOKENIZE_ERROR,
@@ -66,7 +100,7 @@ export class PaymentForm {
66
100
  }
67
101
  }
68
102
  render() {
69
- return (h(Host, null, h("form", { class: "row gy-3" }, this.card && this.bankAccount && (h("div", { class: "col-12" }, h("justifi-payment-method-selector", { selectedPaymentMethodType: this.selectedPaymentMethodType, onPaymentMethodSelected: event => this.paymentMethodSelectedHandler(event) }))), h("div", { class: "col-12" }, h("justifi-payment-method-form", { "payment-method-form-type": this.selectedPaymentMethodType, iframeOrigin: config.iframeOrigin, ref: el => {
103
+ return (h(Host, null, h("form", { class: "row gy-3" }, this.showPaymentMethodTypeSelector() && (h("div", { class: "col-12" }, h("justifi-payment-method-selector", { selectedPaymentMethodType: this.getSelectedPaymentMethodType(), onPaymentMethodSelected: event => this.paymentMethodSelectedHandler(event) }))), h("div", { class: "col-12" }, h("justifi-payment-method-form", { "payment-method-form-type": this.getSelectedPaymentMethodType(), iframeOrigin: config.iframeOrigin, ref: el => {
70
104
  if (el) {
71
105
  this.paymentMethodFormRef = el;
72
106
  }
@@ -124,8 +158,7 @@ export class PaymentForm {
124
158
  "text": ""
125
159
  },
126
160
  "attribute": "card",
127
- "reflect": false,
128
- "defaultValue": "true"
161
+ "reflect": false
129
162
  },
130
163
  "email": {
131
164
  "type": "string",
@@ -153,7 +186,7 @@ export class PaymentForm {
153
186
  "references": {}
154
187
  },
155
188
  "required": false,
156
- "optional": false,
189
+ "optional": true,
157
190
  "docs": {
158
191
  "tags": [],
159
192
  "text": ""
@@ -161,6 +194,23 @@ export class PaymentForm {
161
194
  "attribute": "client-id",
162
195
  "reflect": false
163
196
  },
197
+ "authToken": {
198
+ "type": "string",
199
+ "mutable": false,
200
+ "complexType": {
201
+ "original": "string",
202
+ "resolved": "string",
203
+ "references": {}
204
+ },
205
+ "required": false,
206
+ "optional": true,
207
+ "docs": {
208
+ "tags": [],
209
+ "text": ""
210
+ },
211
+ "attribute": "auth-token",
212
+ "reflect": false
213
+ },
164
214
  "accountId": {
165
215
  "type": "string",
166
216
  "mutable": false,
@@ -34,7 +34,7 @@ export class PaymentMethodSelector {
34
34
  "mutable": false,
35
35
  "complexType": {
36
36
  "original": "PaymentMethodTypes",
37
- "resolved": "PaymentMethodTypes.bankAccount | PaymentMethodTypes.card | PaymentMethodTypes.sezzel",
37
+ "resolved": "PaymentMethodTypes.bankAccount | PaymentMethodTypes.card | PaymentMethodTypes.saved | PaymentMethodTypes.sezzle",
38
38
  "references": {
39
39
  "PaymentMethodTypes": {
40
40
  "location": "import",