@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
@@ -1,729 +0,0 @@
1
- 'use strict';
2
-
3
- function isFunction(value) {
4
- return typeof value === 'function';
5
- }
6
-
7
- function createErrorClass(createImpl) {
8
- const _super = (instance) => {
9
- Error.call(instance);
10
- instance.stack = new Error().stack;
11
- };
12
- const ctorFunc = createImpl(_super);
13
- ctorFunc.prototype = Object.create(Error.prototype);
14
- ctorFunc.prototype.constructor = ctorFunc;
15
- return ctorFunc;
16
- }
17
-
18
- const UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) {
19
- _super(this);
20
- this.message = errors
21
- ? `${errors.length} errors occurred during unsubscription:
22
- ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}`
23
- : '';
24
- this.name = 'UnsubscriptionError';
25
- this.errors = errors;
26
- });
27
-
28
- function arrRemove(arr, item) {
29
- if (arr) {
30
- const index = arr.indexOf(item);
31
- 0 <= index && arr.splice(index, 1);
32
- }
33
- }
34
-
35
- class Subscription {
36
- constructor(initialTeardown) {
37
- this.initialTeardown = initialTeardown;
38
- this.closed = false;
39
- this._parentage = null;
40
- this._finalizers = null;
41
- }
42
- unsubscribe() {
43
- let errors;
44
- if (!this.closed) {
45
- this.closed = true;
46
- const { _parentage } = this;
47
- if (_parentage) {
48
- this._parentage = null;
49
- if (Array.isArray(_parentage)) {
50
- for (const parent of _parentage) {
51
- parent.remove(this);
52
- }
53
- }
54
- else {
55
- _parentage.remove(this);
56
- }
57
- }
58
- const { initialTeardown: initialFinalizer } = this;
59
- if (isFunction(initialFinalizer)) {
60
- try {
61
- initialFinalizer();
62
- }
63
- catch (e) {
64
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
65
- }
66
- }
67
- const { _finalizers } = this;
68
- if (_finalizers) {
69
- this._finalizers = null;
70
- for (const finalizer of _finalizers) {
71
- try {
72
- execFinalizer(finalizer);
73
- }
74
- catch (err) {
75
- errors = errors !== null && errors !== void 0 ? errors : [];
76
- if (err instanceof UnsubscriptionError) {
77
- errors = [...errors, ...err.errors];
78
- }
79
- else {
80
- errors.push(err);
81
- }
82
- }
83
- }
84
- }
85
- if (errors) {
86
- throw new UnsubscriptionError(errors);
87
- }
88
- }
89
- }
90
- add(teardown) {
91
- var _a;
92
- if (teardown && teardown !== this) {
93
- if (this.closed) {
94
- execFinalizer(teardown);
95
- }
96
- else {
97
- if (teardown instanceof Subscription) {
98
- if (teardown.closed || teardown._hasParent(this)) {
99
- return;
100
- }
101
- teardown._addParent(this);
102
- }
103
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
104
- }
105
- }
106
- }
107
- _hasParent(parent) {
108
- const { _parentage } = this;
109
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
110
- }
111
- _addParent(parent) {
112
- const { _parentage } = this;
113
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
114
- }
115
- _removeParent(parent) {
116
- const { _parentage } = this;
117
- if (_parentage === parent) {
118
- this._parentage = null;
119
- }
120
- else if (Array.isArray(_parentage)) {
121
- arrRemove(_parentage, parent);
122
- }
123
- }
124
- remove(teardown) {
125
- const { _finalizers } = this;
126
- _finalizers && arrRemove(_finalizers, teardown);
127
- if (teardown instanceof Subscription) {
128
- teardown._removeParent(this);
129
- }
130
- }
131
- }
132
- Subscription.EMPTY = (() => {
133
- const empty = new Subscription();
134
- empty.closed = true;
135
- return empty;
136
- })();
137
- const EMPTY_SUBSCRIPTION = Subscription.EMPTY;
138
- function isSubscription(value) {
139
- return (value instanceof Subscription ||
140
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
141
- }
142
- function execFinalizer(finalizer) {
143
- if (isFunction(finalizer)) {
144
- finalizer();
145
- }
146
- else {
147
- finalizer.unsubscribe();
148
- }
149
- }
150
-
151
- const config = {
152
- onUnhandledError: null,
153
- onStoppedNotification: null,
154
- Promise: undefined,
155
- useDeprecatedSynchronousErrorHandling: false,
156
- useDeprecatedNextContext: false,
157
- };
158
-
159
- const timeoutProvider = {
160
- setTimeout(handler, timeout, ...args) {
161
- const { delegate } = timeoutProvider;
162
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
163
- return delegate.setTimeout(handler, timeout, ...args);
164
- }
165
- return setTimeout(handler, timeout, ...args);
166
- },
167
- clearTimeout(handle) {
168
- const { delegate } = timeoutProvider;
169
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
170
- },
171
- delegate: undefined,
172
- };
173
-
174
- function reportUnhandledError(err) {
175
- timeoutProvider.setTimeout(() => {
176
- const { onUnhandledError } = config;
177
- if (onUnhandledError) {
178
- onUnhandledError(err);
179
- }
180
- else {
181
- throw err;
182
- }
183
- });
184
- }
185
-
186
- function noop() { }
187
-
188
- const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();
189
- function errorNotification(error) {
190
- return createNotification('E', undefined, error);
191
- }
192
- function nextNotification(value) {
193
- return createNotification('N', value, undefined);
194
- }
195
- function createNotification(kind, value, error) {
196
- return {
197
- kind,
198
- value,
199
- error,
200
- };
201
- }
202
-
203
- function errorContext(cb) {
204
- {
205
- cb();
206
- }
207
- }
208
-
209
- class Subscriber extends Subscription {
210
- constructor(destination) {
211
- super();
212
- this.isStopped = false;
213
- if (destination) {
214
- this.destination = destination;
215
- if (isSubscription(destination)) {
216
- destination.add(this);
217
- }
218
- }
219
- else {
220
- this.destination = EMPTY_OBSERVER;
221
- }
222
- }
223
- static create(next, error, complete) {
224
- return new SafeSubscriber(next, error, complete);
225
- }
226
- next(value) {
227
- if (this.isStopped) {
228
- handleStoppedNotification(nextNotification(value), this);
229
- }
230
- else {
231
- this._next(value);
232
- }
233
- }
234
- error(err) {
235
- if (this.isStopped) {
236
- handleStoppedNotification(errorNotification(err), this);
237
- }
238
- else {
239
- this.isStopped = true;
240
- this._error(err);
241
- }
242
- }
243
- complete() {
244
- if (this.isStopped) {
245
- handleStoppedNotification(COMPLETE_NOTIFICATION, this);
246
- }
247
- else {
248
- this.isStopped = true;
249
- this._complete();
250
- }
251
- }
252
- unsubscribe() {
253
- if (!this.closed) {
254
- this.isStopped = true;
255
- super.unsubscribe();
256
- this.destination = null;
257
- }
258
- }
259
- _next(value) {
260
- this.destination.next(value);
261
- }
262
- _error(err) {
263
- try {
264
- this.destination.error(err);
265
- }
266
- finally {
267
- this.unsubscribe();
268
- }
269
- }
270
- _complete() {
271
- try {
272
- this.destination.complete();
273
- }
274
- finally {
275
- this.unsubscribe();
276
- }
277
- }
278
- }
279
- const _bind = Function.prototype.bind;
280
- function bind(fn, thisArg) {
281
- return _bind.call(fn, thisArg);
282
- }
283
- class ConsumerObserver {
284
- constructor(partialObserver) {
285
- this.partialObserver = partialObserver;
286
- }
287
- next(value) {
288
- const { partialObserver } = this;
289
- if (partialObserver.next) {
290
- try {
291
- partialObserver.next(value);
292
- }
293
- catch (error) {
294
- handleUnhandledError(error);
295
- }
296
- }
297
- }
298
- error(err) {
299
- const { partialObserver } = this;
300
- if (partialObserver.error) {
301
- try {
302
- partialObserver.error(err);
303
- }
304
- catch (error) {
305
- handleUnhandledError(error);
306
- }
307
- }
308
- else {
309
- handleUnhandledError(err);
310
- }
311
- }
312
- complete() {
313
- const { partialObserver } = this;
314
- if (partialObserver.complete) {
315
- try {
316
- partialObserver.complete();
317
- }
318
- catch (error) {
319
- handleUnhandledError(error);
320
- }
321
- }
322
- }
323
- }
324
- class SafeSubscriber extends Subscriber {
325
- constructor(observerOrNext, error, complete) {
326
- super();
327
- let partialObserver;
328
- if (isFunction(observerOrNext) || !observerOrNext) {
329
- partialObserver = {
330
- next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
331
- error: error !== null && error !== void 0 ? error : undefined,
332
- complete: complete !== null && complete !== void 0 ? complete : undefined,
333
- };
334
- }
335
- else {
336
- let context;
337
- if (this && config.useDeprecatedNextContext) {
338
- context = Object.create(observerOrNext);
339
- context.unsubscribe = () => this.unsubscribe();
340
- partialObserver = {
341
- next: observerOrNext.next && bind(observerOrNext.next, context),
342
- error: observerOrNext.error && bind(observerOrNext.error, context),
343
- complete: observerOrNext.complete && bind(observerOrNext.complete, context),
344
- };
345
- }
346
- else {
347
- partialObserver = observerOrNext;
348
- }
349
- }
350
- this.destination = new ConsumerObserver(partialObserver);
351
- }
352
- }
353
- function handleUnhandledError(error) {
354
- {
355
- reportUnhandledError(error);
356
- }
357
- }
358
- function defaultErrorHandler(err) {
359
- throw err;
360
- }
361
- function handleStoppedNotification(notification, subscriber) {
362
- const { onStoppedNotification } = config;
363
- onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));
364
- }
365
- const EMPTY_OBSERVER = {
366
- closed: true,
367
- next: noop,
368
- error: defaultErrorHandler,
369
- complete: noop,
370
- };
371
-
372
- const observable = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();
373
-
374
- function identity(x) {
375
- return x;
376
- }
377
-
378
- function pipeFromArray(fns) {
379
- if (fns.length === 0) {
380
- return identity;
381
- }
382
- if (fns.length === 1) {
383
- return fns[0];
384
- }
385
- return function piped(input) {
386
- return fns.reduce((prev, fn) => fn(prev), input);
387
- };
388
- }
389
-
390
- class Observable {
391
- constructor(subscribe) {
392
- if (subscribe) {
393
- this._subscribe = subscribe;
394
- }
395
- }
396
- lift(operator) {
397
- const observable = new Observable();
398
- observable.source = this;
399
- observable.operator = operator;
400
- return observable;
401
- }
402
- subscribe(observerOrNext, error, complete) {
403
- const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
404
- errorContext(() => {
405
- const { operator, source } = this;
406
- subscriber.add(operator
407
- ?
408
- operator.call(subscriber, source)
409
- : source
410
- ?
411
- this._subscribe(subscriber)
412
- :
413
- this._trySubscribe(subscriber));
414
- });
415
- return subscriber;
416
- }
417
- _trySubscribe(sink) {
418
- try {
419
- return this._subscribe(sink);
420
- }
421
- catch (err) {
422
- sink.error(err);
423
- }
424
- }
425
- forEach(next, promiseCtor) {
426
- promiseCtor = getPromiseCtor(promiseCtor);
427
- return new promiseCtor((resolve, reject) => {
428
- const subscriber = new SafeSubscriber({
429
- next: (value) => {
430
- try {
431
- next(value);
432
- }
433
- catch (err) {
434
- reject(err);
435
- subscriber.unsubscribe();
436
- }
437
- },
438
- error: reject,
439
- complete: resolve,
440
- });
441
- this.subscribe(subscriber);
442
- });
443
- }
444
- _subscribe(subscriber) {
445
- var _a;
446
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
447
- }
448
- [observable]() {
449
- return this;
450
- }
451
- pipe(...operations) {
452
- return pipeFromArray(operations)(this);
453
- }
454
- toPromise(promiseCtor) {
455
- promiseCtor = getPromiseCtor(promiseCtor);
456
- return new promiseCtor((resolve, reject) => {
457
- let value;
458
- this.subscribe((x) => (value = x), (err) => reject(err), () => resolve(value));
459
- });
460
- }
461
- }
462
- Observable.create = (subscribe) => {
463
- return new Observable(subscribe);
464
- };
465
- function getPromiseCtor(promiseCtor) {
466
- var _a;
467
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
468
- }
469
- function isObserver(value) {
470
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
471
- }
472
- function isSubscriber(value) {
473
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
474
- }
475
-
476
- const ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
477
- _super(this);
478
- this.name = 'ObjectUnsubscribedError';
479
- this.message = 'object unsubscribed';
480
- });
481
-
482
- class Subject extends Observable {
483
- constructor() {
484
- super();
485
- this.closed = false;
486
- this.currentObservers = null;
487
- this.observers = [];
488
- this.isStopped = false;
489
- this.hasError = false;
490
- this.thrownError = null;
491
- }
492
- lift(operator) {
493
- const subject = new AnonymousSubject(this, this);
494
- subject.operator = operator;
495
- return subject;
496
- }
497
- _throwIfClosed() {
498
- if (this.closed) {
499
- throw new ObjectUnsubscribedError();
500
- }
501
- }
502
- next(value) {
503
- errorContext(() => {
504
- this._throwIfClosed();
505
- if (!this.isStopped) {
506
- if (!this.currentObservers) {
507
- this.currentObservers = Array.from(this.observers);
508
- }
509
- for (const observer of this.currentObservers) {
510
- observer.next(value);
511
- }
512
- }
513
- });
514
- }
515
- error(err) {
516
- errorContext(() => {
517
- this._throwIfClosed();
518
- if (!this.isStopped) {
519
- this.hasError = this.isStopped = true;
520
- this.thrownError = err;
521
- const { observers } = this;
522
- while (observers.length) {
523
- observers.shift().error(err);
524
- }
525
- }
526
- });
527
- }
528
- complete() {
529
- errorContext(() => {
530
- this._throwIfClosed();
531
- if (!this.isStopped) {
532
- this.isStopped = true;
533
- const { observers } = this;
534
- while (observers.length) {
535
- observers.shift().complete();
536
- }
537
- }
538
- });
539
- }
540
- unsubscribe() {
541
- this.isStopped = this.closed = true;
542
- this.observers = this.currentObservers = null;
543
- }
544
- get observed() {
545
- var _a;
546
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
547
- }
548
- _trySubscribe(subscriber) {
549
- this._throwIfClosed();
550
- return super._trySubscribe(subscriber);
551
- }
552
- _subscribe(subscriber) {
553
- this._throwIfClosed();
554
- this._checkFinalizedStatuses(subscriber);
555
- return this._innerSubscribe(subscriber);
556
- }
557
- _innerSubscribe(subscriber) {
558
- const { hasError, isStopped, observers } = this;
559
- if (hasError || isStopped) {
560
- return EMPTY_SUBSCRIPTION;
561
- }
562
- this.currentObservers = null;
563
- observers.push(subscriber);
564
- return new Subscription(() => {
565
- this.currentObservers = null;
566
- arrRemove(observers, subscriber);
567
- });
568
- }
569
- _checkFinalizedStatuses(subscriber) {
570
- const { hasError, thrownError, isStopped } = this;
571
- if (hasError) {
572
- subscriber.error(thrownError);
573
- }
574
- else if (isStopped) {
575
- subscriber.complete();
576
- }
577
- }
578
- asObservable() {
579
- const observable = new Observable();
580
- observable.source = this;
581
- return observable;
582
- }
583
- }
584
- Subject.create = (destination, source) => {
585
- return new AnonymousSubject(destination, source);
586
- };
587
- class AnonymousSubject extends Subject {
588
- constructor(destination, source) {
589
- super();
590
- this.destination = destination;
591
- this.source = source;
592
- }
593
- next(value) {
594
- var _a, _b;
595
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
596
- }
597
- error(err) {
598
- var _a, _b;
599
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
600
- }
601
- complete() {
602
- var _a, _b;
603
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
604
- }
605
- _subscribe(subscriber) {
606
- var _a, _b;
607
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
608
- }
609
- }
610
-
611
- class BehaviorSubject extends Subject {
612
- constructor(_value) {
613
- super();
614
- this._value = _value;
615
- }
616
- get value() {
617
- return this.getValue();
618
- }
619
- _subscribe(subscriber) {
620
- const subscription = super._subscribe(subscriber);
621
- !subscription.closed && subscriber.next(this._value);
622
- return subscription;
623
- }
624
- getValue() {
625
- const { hasError, thrownError, _value } = this;
626
- if (hasError) {
627
- throw thrownError;
628
- }
629
- this._throwIfClosed();
630
- return _value;
631
- }
632
- next(value) {
633
- super.next((this._value = value));
634
- }
635
- }
636
-
637
- class FormController {
638
- constructor(schema) {
639
- this.values = new BehaviorSubject({});
640
- this.errors = new BehaviorSubject({});
641
- this._initialValues = {};
642
- this._values = {};
643
- this._errors = {};
644
- this._isValid = true;
645
- this._schema = schema;
646
- }
647
- processArrayError(obj, property, remainingProperties, message) {
648
- // Extract array name and index from the property string
649
- const [arrayName, indexStr] = property
650
- .match(/^([a-zA-Z0-9]+)\[(\d+)\]/)
651
- .slice(1);
652
- const index = parseInt(indexStr, 10);
653
- // Ensure the array exists and has an entry at the given index
654
- obj[arrayName] = obj[arrayName] || [];
655
- obj[arrayName][index] = obj[arrayName][index] || {};
656
- // Recursively set the error if there are remaining properties, else set the error message
657
- if (remainingProperties.length) {
658
- this.setNestedError(obj[arrayName][index], remainingProperties, message);
659
- }
660
- else {
661
- obj[arrayName][index] = message;
662
- }
663
- }
664
- processRegularError(obj, property, remainingProperties, message) {
665
- // Ensure the property exists
666
- obj[property] = obj[property] || {};
667
- // Recursively set the error if there are remaining properties, else set the error message
668
- if (remainingProperties.length) {
669
- this.setNestedError(obj[property], remainingProperties, message);
670
- }
671
- else {
672
- obj[property] = message;
673
- }
674
- }
675
- setNestedError(obj, properties, message) {
676
- const property = properties.shift();
677
- const isArrayError = property.includes('[');
678
- if (isArrayError) {
679
- this.processArrayError(obj, property, properties, message);
680
- }
681
- else {
682
- this.processRegularError(obj, property, properties, message);
683
- }
684
- }
685
- setError(obj, path, message) {
686
- // Convert path to properties array
687
- const properties = Array.isArray(path) ? path : path.split('.');
688
- this.setNestedError(obj, properties, message);
689
- }
690
- async validate(context) {
691
- this._isValid = true;
692
- this._errors = {};
693
- try {
694
- await this._schema.validate(this._values, { context, abortEarly: false });
695
- }
696
- catch (err) {
697
- this._isValid = false;
698
- err.inner.forEach((item) => {
699
- this.setError(this._errors, item.path, item.message);
700
- });
701
- }
702
- this.errors.next(this._errors);
703
- return this._isValid;
704
- }
705
- async validateAndSubmit(submitHandler, context) {
706
- const isValid = await this.validate(context || {});
707
- if (isValid) {
708
- submitHandler();
709
- }
710
- }
711
- setInitialValues(values) {
712
- this._initialValues = values;
713
- this._values = values;
714
- this.values.next(this._values);
715
- }
716
- setValues(values) {
717
- this._values = Object.assign(Object.assign({}, this._values), values);
718
- this.values.next(this._values);
719
- }
720
- resetValues() {
721
- this._values = this._initialValues;
722
- this.values.next(this._values);
723
- }
724
- getInitialValues() {
725
- return this._initialValues;
726
- }
727
- }
728
-
729
- exports.FormController = FormController;