@justifi/webcomponents 5.7.6 → 6.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (717) hide show
  1. package/dist/cjs/{Api-p2pK86Zd.js → Api-CPuq_15r.js} +1 -1
  2. package/dist/cjs/{ComponentError-C4MdBBMe.js → ComponentError-D4OLnOkg.js} +10 -0
  3. package/dist/cjs/{Refund-h6MCxFEE.js → Refund-CqWNG8sx.js} +245 -1
  4. package/dist/cjs/additional-questions-details_5.cjs.entry.js +2 -1
  5. package/dist/cjs/bank-account-document-form-inputs_4.cjs.entry.js +8 -9
  6. package/dist/cjs/bank-account-form.cjs.entry.js +63 -0
  7. package/dist/cjs/{business.service-OxMVnZMF.js → business.service-C3BdUPlm.js} +3 -5
  8. package/dist/cjs/card-form.cjs.entry.js +71 -0
  9. package/dist/cjs/{check-pkg-version-Co_IKlwj.js → check-pkg-version-D_lazhBQ.js} +4 -6
  10. package/dist/cjs/{checkout.service-GgFXq7Ux.js → checkout.service-B0ZmvWwI.js} +3 -5
  11. package/dist/cjs/checkout.store-CV_fuGQw.js +39 -0
  12. package/dist/cjs/checkouts-list-core.cjs.entry.js +6 -7
  13. package/dist/cjs/{checkouts-table-DJoMGwVG.js → checkouts-table-UN5gPpQ_.js} +1 -1
  14. package/dist/cjs/{custom-popper.cjs.entry.js → custom-popper_2.cjs.entry.js} +22 -2
  15. package/dist/cjs/dinero-BwNN_k7x.js +1657 -0
  16. package/dist/cjs/{dispute.service-XdB1KbMS.js → dispute.service-DsPEAcDn.js} +3 -5
  17. package/dist/cjs/form-alert_5.cjs.entry.js +4 -4
  18. package/dist/cjs/form-control-checkbox.cjs.entry.js +2 -2
  19. package/dist/cjs/form-control-date.cjs.entry.js +2 -2
  20. package/dist/cjs/form-control-file-v2_2.cjs.entry.js +3 -3
  21. package/dist/cjs/form-control-monetary-provisioning.cjs.entry.js +2 -2
  22. package/dist/cjs/form-control-monetary.cjs.entry.js +4 -3
  23. package/dist/cjs/form-control-number-masked_2.cjs.entry.js +3 -3
  24. package/dist/cjs/form-control-number.cjs.entry.js +2 -2
  25. package/dist/cjs/form-control-radio.cjs.entry.js +2 -2
  26. package/dist/cjs/{form-control-select_3.cjs.entry.js → form-control-select_2.cjs.entry.js} +4 -23
  27. package/dist/cjs/{get-business-BJrtsomz.js → get-business-o5jPq_ME.js} +2 -2
  28. package/dist/cjs/{get-payment-details-Ccd7IWqM.js → get-payment-details-DtCXaIMx.js} +5 -7
  29. package/dist/cjs/{get-payout-csv-CXEQkjDm.js → get-payout-csv-DE_D9y08.js} +2 -2
  30. package/dist/cjs/{get-subaccounts-C4HDfc3o.js → get-subaccounts-CwCH5rC8.js} +5 -7
  31. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +3 -2
  32. package/dist/cjs/{iframe-input_4.cjs.entry.js → hidden-input_2.cjs.entry.js} +111 -153
  33. package/dist/cjs/{insurance-state-qT_hkvZV.js → insurance-state-Cyva9u6S.js} +18 -0
  34. package/dist/cjs/justifi-additional-questions-form-step-core_6.cjs.entry.js +4 -5
  35. package/dist/cjs/justifi-additional-questions-form-step_9.cjs.entry.js +17 -18
  36. package/dist/cjs/justifi-additional-statement_8.cjs.entry.js +8 -8
  37. package/dist/cjs/justifi-bank-account-billing-form-simple_9.cjs.entry.js +372 -0
  38. package/dist/cjs/justifi-business-details.cjs.entry.js +11 -12
  39. package/dist/cjs/justifi-business-form.cjs.entry.js +10 -11
  40. package/dist/cjs/justifi-business-representative-form-inputs.cjs.entry.js +1 -1
  41. package/dist/cjs/justifi-checkout-summary_6.cjs.entry.js +698 -0
  42. package/dist/cjs/justifi-checkout.cjs.entry.js +88 -96
  43. package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +11 -12
  44. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +13 -14
  45. package/dist/cjs/justifi-dispute-management-core.cjs.entry.js +1 -1
  46. package/dist/cjs/justifi-dispute-management.cjs.entry.js +10 -11
  47. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +13 -14
  48. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +8 -9
  49. package/dist/cjs/justifi-order-terminals.cjs.entry.js +12 -13
  50. package/dist/cjs/justifi-owner-form_3.cjs.entry.js +12 -13
  51. package/dist/cjs/justifi-payment-details.cjs.entry.js +11 -12
  52. package/dist/cjs/justifi-payment-provisioning-core.cjs.entry.js +2 -2
  53. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +11 -12
  54. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +10 -11
  55. package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +4 -3
  56. package/dist/cjs/justifi-payments-list.cjs.entry.js +12 -13
  57. package/dist/cjs/justifi-payout-details.cjs.entry.js +10 -11
  58. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +10 -11
  59. package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +4 -3
  60. package/dist/cjs/justifi-payouts-list.cjs.entry.js +13 -14
  61. package/dist/cjs/justifi-refund-payment.cjs.entry.js +10 -11
  62. package/dist/cjs/justifi-saved-payment-method.cjs.entry.js +31 -0
  63. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +115 -18
  64. package/dist/cjs/justifi-skeleton.cjs.entry.js +17 -0
  65. package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +6 -7
  66. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +10 -11
  67. package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +5 -6
  68. package/dist/cjs/justifi-terminals-list.cjs.entry.js +12 -13
  69. package/dist/cjs/loader.cjs.js +1 -1
  70. package/dist/cjs/{package-B7_ed3oS.js → package-Cp_7Ls2E.js} +1 -1
  71. package/dist/cjs/payment-details-core.cjs.entry.js +10 -9
  72. package/dist/cjs/payment-method-option-utils-WYHIHy-l.js +15 -0
  73. package/dist/cjs/payment-method-option.cjs.entry.js +17 -0
  74. package/dist/cjs/{payment-provisioning-actions-BkWSDJQQ.js → payment-provisioning-actions-CZVlnRA0.js} +2 -2
  75. package/dist/cjs/{payment.service-BU1Mwwnv.js → payment.service-1H0VC3LV.js} +3 -5
  76. package/dist/cjs/payments-list-core.cjs.entry.js +6 -7
  77. package/dist/cjs/{payments-table-uouQ4x2Y.js → payments-table-quF0NnsS.js} +1 -1
  78. package/dist/cjs/payout-details-core.cjs.entry.js +5 -4
  79. package/dist/cjs/{payout.service-BjB-B6CX.js → payout.service-CIZFU-hV.js} +3 -5
  80. package/dist/cjs/payouts-list-core.cjs.entry.js +6 -7
  81. package/dist/cjs/{payouts-table-Bo61u5ZZ.js → payouts-table-D_CCTR_k.js} +1 -1
  82. package/dist/cjs/table-filters-menu.cjs.entry.js +1 -1
  83. package/dist/cjs/terminal-orders-list-core.cjs.entry.js +6 -7
  84. package/dist/cjs/{terminal-orders-table-FtFQqd0s.js → terminal-orders-table-0O5jtzYj.js} +3 -5
  85. package/dist/cjs/terminal-quantity-selector.cjs.entry.js +1 -1
  86. package/dist/cjs/{terminal.service-De-0eGdM.js → terminal.service-DUlyMTrX.js} +3 -5
  87. package/dist/cjs/terminals-list-core.cjs.entry.js +6 -7
  88. package/dist/cjs/{terminals-table-CGG9EhiI.js → terminals-table-C2BNRUS5.js} +1 -1
  89. package/dist/cjs/{utils-Dka3MplB.js → utils-BaGF9XIe.js} +3 -1661
  90. package/dist/cjs/{utils-l0veqT9y.js → utils-DvUQQLmR.js} +1 -1
  91. package/dist/cjs/webcomponents.cjs.js +1 -1
  92. package/dist/collection/actions/checkout/checkout-actions.js +2 -1
  93. package/dist/collection/api/BillingInformation.js +1 -0
  94. package/dist/collection/api/Checkout.js +1 -3
  95. package/dist/collection/api/ComponentError.js +10 -0
  96. package/dist/collection/api/PaymentMethod.js +1 -0
  97. package/dist/collection/collection-manifest.json +15 -9
  98. package/dist/collection/components/business-forms/business-form/additional-questions/additional-questions.js +1 -1
  99. package/dist/collection/components/business-forms/business-form/business-core-info/business-core-info.js +1 -1
  100. package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +1 -1
  101. package/dist/collection/components/business-forms/business-form/legal-address-form/legal-address-form.js +1 -1
  102. package/dist/collection/components/business-forms/owner-form/identity-address/identity-address-form.js +1 -1
  103. package/dist/collection/components/business-forms/owner-form/owner-form-core.js +1 -1
  104. package/dist/collection/components/business-forms/owner-form/owner-form-inputs.js +1 -1
  105. package/dist/collection/components/business-forms/owner-form/owner-form.js +1 -1
  106. package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +1 -1
  107. package/dist/collection/components/business-forms/payment-provisioning/bank-account/bank-account-document-inputs.js +1 -1
  108. package/dist/collection/components/business-forms/payment-provisioning/bank-account/bank-account-form-inputs.js +1 -1
  109. package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-bank-account-form-step.js +1 -1
  110. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +1 -1
  111. package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step.js +1 -1
  112. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-inputs.js +1 -1
  113. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +1 -1
  114. package/dist/collection/components/business-forms/payment-provisioning/form-control-monetary-provisioning.js +2 -2
  115. package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step.js +1 -1
  116. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-core.js +1 -1
  117. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-form-buttons.js +1 -1
  118. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-form-steps.js +1 -1
  119. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning.js +1 -1
  120. package/dist/collection/components/business-forms/payment-provisioning/terms-and-conditions/business-terms-conditions-form-step.js +1 -1
  121. package/dist/collection/components/checkout/billing-form/billing-form-schema.js +3 -3
  122. package/dist/collection/components/checkout/card-form/card-form.js +2 -2
  123. package/dist/collection/components/checkout/checkout.js +156 -51
  124. package/dist/collection/components/checkout/payment-method-option-utils.js +0 -1
  125. package/dist/collection/components/checkout/save-new-payment-method.js +9 -5
  126. package/dist/collection/components/checkout/saved-payment-method.js +1 -1
  127. package/dist/collection/components/checkouts-list/checkouts-list-core.js +1 -1
  128. package/dist/collection/components/checkouts-list/checkouts-list-filters.js +1 -1
  129. package/dist/collection/components/checkouts-list/checkouts-list.js +1 -1
  130. package/dist/collection/components/dispute-management/dispute-management-core.js +1 -1
  131. package/dist/collection/components/dispute-management/dispute-management.js +1 -1
  132. package/dist/collection/components/dispute-management/dispute-notification.js +1 -1
  133. package/dist/collection/components/dispute-management/dispute-response/additional-statement.js +1 -1
  134. package/dist/collection/components/dispute-management/dispute-response/cancellation-policy.js +1 -1
  135. package/dist/collection/components/dispute-management/dispute-response/customer-details.js +1 -1
  136. package/dist/collection/components/dispute-management/dispute-response/dispute-response-core.js +1 -1
  137. package/dist/collection/components/dispute-management/dispute-response/dispute-response.js +1 -1
  138. package/dist/collection/components/dispute-management/dispute-response/duplicate-charge.js +1 -1
  139. package/dist/collection/components/dispute-management/dispute-response/electronic-evidence.js +1 -1
  140. package/dist/collection/components/dispute-management/dispute-response/product-or-service.js +1 -1
  141. package/dist/collection/components/dispute-management/dispute-response/refund-policy.js +1 -1
  142. package/dist/collection/components/dispute-management/dispute-response/shipping-details.js +1 -1
  143. package/dist/collection/components/filters/table-filters-menu.js +1 -1
  144. package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +1 -1
  145. package/dist/collection/components/insurance/insurance-state.js +18 -1
  146. package/dist/collection/components/insurance/season-interruption/season-interruption-insurance.js +114 -12
  147. package/dist/collection/components/modular-checkout/modular-checkout.js +422 -0
  148. package/dist/collection/components/{checkout/billing-form → modular-checkout/sub-components}/bank-account-billing-form-simple.js +7 -5
  149. package/dist/collection/components/modular-checkout/sub-components/bank-account-skeleton.js +10 -0
  150. package/dist/collection/components/modular-checkout/sub-components/bank-account.js +98 -0
  151. package/dist/collection/components/{checkout/billing-form → modular-checkout/sub-components}/billing-form-full.js +12 -8
  152. package/dist/collection/components/{checkout/billing-form → modular-checkout/sub-components}/card-billing-form-simple.js +7 -5
  153. package/dist/collection/components/modular-checkout/sub-components/card-form-skeleton.js +10 -0
  154. package/dist/collection/components/modular-checkout/sub-components/card-form.js +102 -0
  155. package/dist/collection/components/modular-checkout/sub-components/payment-method-option.js +113 -0
  156. package/dist/collection/components/modular-checkout/sub-components/saved-payment-methods.js +40 -0
  157. package/dist/collection/components/modular-checkout/sub-components/sezzle-payment-method.js +127 -0
  158. package/dist/collection/components/modular-checkout/sub-components/summary.js +12 -0
  159. package/dist/collection/components/order-terminals/order-terminals.js +1 -1
  160. package/dist/collection/components/order-terminals/terminal-quantity-selector/terminal-quantity-selector.js +1 -1
  161. package/dist/collection/components/payment-details/payment-details-core.js +8 -8
  162. package/dist/collection/components/payment-transactions-list/payment-transactions-list.js +1 -1
  163. package/dist/collection/components/payments-list/payments-list-core.js +1 -1
  164. package/dist/collection/components/payments-list/payments-list-filters.js +2 -2
  165. package/dist/collection/components/payments-list/payments-list.js +1 -1
  166. package/dist/collection/components/payout-details/payout-details-core.js +3 -3
  167. package/dist/collection/components/payout-transactions-list/payout-transactions-list.js +1 -1
  168. package/dist/collection/components/payouts-list/payouts-list-core.js +1 -1
  169. package/dist/collection/components/payouts-list/payouts-list-filters.js +2 -2
  170. package/dist/collection/components/payouts-list/payouts-list.js +1 -1
  171. package/dist/collection/components/terminal-orders-list/terminal-orders-list-core.js +1 -1
  172. package/dist/collection/components/terminal-orders-list/terminal-orders-list-filters.js +2 -2
  173. package/dist/collection/components/terminal-orders-list/terminal-orders-list.js +1 -1
  174. package/dist/collection/components/terminals-list/terminals-list-core.js +1 -1
  175. package/dist/collection/components/terminals-list/terminals-list-filters.js +1 -1
  176. package/dist/collection/components/terminals-list/terminals-list.js +1 -1
  177. package/dist/collection/components/tokenize-payment-method/tokenize-payment-method.js +293 -83
  178. package/dist/collection/store/checkout.store.js +34 -0
  179. package/dist/collection/ui-components/custom-popper/custom-popper.js +2 -2
  180. package/dist/collection/ui-components/form/form-control-checkbox.js +2 -2
  181. package/dist/collection/ui-components/form/form-control-date.js +2 -2
  182. package/dist/collection/ui-components/form/form-control-file-v2.js +1 -1
  183. package/dist/collection/ui-components/form/form-control-file.js +2 -2
  184. package/dist/collection/ui-components/form/form-control-monetary.js +2 -2
  185. package/dist/collection/ui-components/form/form-control-number-masked.js +2 -2
  186. package/dist/collection/ui-components/form/form-control-number.js +2 -2
  187. package/dist/collection/ui-components/form/form-control-radio.js +2 -2
  188. package/dist/collection/ui-components/form/form-control-select.js +2 -2
  189. package/dist/collection/ui-components/form/form-control-text.js +2 -2
  190. package/dist/collection/ui-components/form/form-control-textarea.js +2 -2
  191. package/dist/collection/ui-components/form/hidden-input.js +1 -1
  192. package/dist/collection/ui-components/form/iframe-input.js +10 -5
  193. package/dist/collection/ui-components/index.js +1 -0
  194. package/dist/collection/ui-components/shadow-dom-components/justifi-button.js +176 -0
  195. package/dist/collection/ui-components/shadow-dom-components/justifi-header.js +83 -0
  196. package/dist/collection/ui-components/shadow-dom-components/justifi-radio-list-item.js +155 -0
  197. package/dist/collection/ui-components/shadow-dom-components/justifi-skeleton.js +108 -0
  198. package/dist/docs.json +2690 -3204
  199. package/dist/esm/{Api-Bes3KkG6.js → Api-N_veT2p6.js} +1 -1
  200. package/dist/esm/{ComponentError-SdntD1xf.js → ComponentError-Cjcsf8ku.js} +11 -1
  201. package/dist/esm/{Dispute-7MWRbTXI.js → Dispute-BH0Xfn-F.js} +1 -1
  202. package/dist/esm/{Refund-CISeDJoW.js → Refund-Di6J0oN2.js} +244 -2
  203. package/dist/esm/additional-questions-details_5.entry.js +4 -3
  204. package/dist/esm/{badge-BRPxcFAe.js → badge-D_mzXSCQ.js} +1 -1
  205. package/dist/esm/bank-account-document-form-inputs_4.entry.js +12 -13
  206. package/dist/{module/bank-account-form2.js → esm/bank-account-form.entry.js} +10 -34
  207. package/dist/esm/business-details-core.entry.js +3 -3
  208. package/dist/esm/{business.service-Cx6MiBgY.js → business.service-Bdvhdc_d.js} +4 -6
  209. package/dist/esm/{button-B_viNpoz.js → button-CeR8qVS3.js} +1 -1
  210. package/dist/esm/card-form.entry.js +69 -0
  211. package/dist/esm/{check-pkg-version-DvajBJj9.js → check-pkg-version-Bb69ihTN.js} +5 -7
  212. package/dist/esm/{checkout.service-BQ2Z7hHe.js → checkout.service-XgGFa7H8.js} +4 -6
  213. package/dist/esm/checkout.store-B60siz2l.js +36 -0
  214. package/dist/esm/checkouts-list-core.entry.js +11 -12
  215. package/dist/esm/{checkouts-table-YyKWgXbv.js → checkouts-table-CFZYoYjn.js} +3 -3
  216. package/dist/esm/{custom-popper.entry.js → custom-popper_2.entry.js} +22 -3
  217. package/dist/esm/dinero-HXpYMWUU.js +1655 -0
  218. package/dist/esm/{dispute.service-Bmw6fgc6.js → dispute.service-CKPcmwhH.js} +4 -6
  219. package/dist/esm/form-alert_5.entry.js +5 -5
  220. package/dist/esm/form-control-checkbox.entry.js +5 -5
  221. package/dist/esm/form-control-date.entry.js +4 -4
  222. package/dist/esm/{form-control-error-text-BvjVjw2l.js → form-control-error-text-D3ZwkOv-.js} +1 -1
  223. package/dist/esm/form-control-file-v2_2.entry.js +5 -5
  224. package/dist/esm/{form-control-help-text-Dggj4lH9.js → form-control-help-text-C39ZW65w.js} +1 -1
  225. package/dist/esm/form-control-monetary-provisioning.entry.js +5 -5
  226. package/dist/esm/form-control-monetary.entry.js +7 -6
  227. package/dist/esm/form-control-number-masked_2.entry.js +5 -5
  228. package/dist/esm/form-control-number.entry.js +5 -5
  229. package/dist/esm/form-control-radio.entry.js +3 -3
  230. package/dist/esm/{form-control-select_3.entry.js → form-control-select_2.entry.js} +7 -25
  231. package/dist/esm/{get-business-GEPTefIj.js → get-business-Crb6P-iI.js} +2 -2
  232. package/dist/esm/{get-payment-details-Rww84hl5.js → get-payment-details-Dt-dr16k.js} +5 -7
  233. package/dist/esm/{get-payout-csv-D7IYYqVL.js → get-payout-csv-D-Lnooki.js} +2 -2
  234. package/dist/esm/{get-subaccounts-0PmjUDEa.js → get-subaccounts-BsoVLANw.js} +6 -8
  235. package/dist/esm/gross-payment-chart-core.entry.js +6 -5
  236. package/dist/esm/{header-1-UMqoryJI.js → header-1-E-hEi3wF.js} +1 -1
  237. package/dist/esm/{header-3-DfV3YFNS.js → header-3-Dm7M85kz.js} +1 -1
  238. package/dist/esm/{iframe-input_4.entry.js → hidden-input_2.entry.js} +106 -146
  239. package/dist/esm/insurance-state-CB4l8sOv.js +45 -0
  240. package/dist/esm/justifi-additional-questions-form-step-core_6.entry.js +8 -9
  241. package/dist/esm/justifi-additional-questions-form-step_9.entry.js +20 -21
  242. package/dist/esm/justifi-additional-statement_8.entry.js +9 -9
  243. package/dist/esm/justifi-bank-account-billing-form-simple_9.entry.js +362 -0
  244. package/dist/esm/justifi-business-details.entry.js +13 -14
  245. package/dist/esm/justifi-business-form.entry.js +15 -16
  246. package/dist/esm/justifi-business-representative-form-inputs.entry.js +2 -2
  247. package/dist/esm/justifi-checkout-summary_6.entry.js +691 -0
  248. package/dist/esm/justifi-checkout.entry.js +88 -96
  249. package/dist/esm/justifi-checkouts-list-filters.entry.js +7 -8
  250. package/dist/esm/justifi-checkouts-list.entry.js +15 -16
  251. package/dist/esm/justifi-details.entry.js +2 -2
  252. package/dist/esm/justifi-dispute-management-core.entry.js +2 -2
  253. package/dist/esm/justifi-dispute-management.entry.js +11 -12
  254. package/dist/esm/justifi-dispute-notification_3.entry.js +16 -17
  255. package/dist/esm/justifi-gross-payment-chart.entry.js +11 -12
  256. package/dist/esm/justifi-order-terminals.entry.js +15 -16
  257. package/dist/esm/justifi-owner-form_3.entry.js +14 -15
  258. package/dist/esm/justifi-payment-details.entry.js +13 -14
  259. package/dist/esm/justifi-payment-provisioning-core.entry.js +4 -4
  260. package/dist/esm/justifi-payment-provisioning.entry.js +12 -13
  261. package/dist/esm/justifi-payment-transactions-list.entry.js +14 -15
  262. package/dist/esm/justifi-payments-list-filters.entry.js +5 -4
  263. package/dist/esm/justifi-payments-list.entry.js +15 -16
  264. package/dist/esm/justifi-payout-details.entry.js +13 -14
  265. package/dist/esm/justifi-payout-transactions-list.entry.js +14 -15
  266. package/dist/esm/justifi-payouts-list-filters.entry.js +5 -4
  267. package/dist/esm/justifi-payouts-list.entry.js +17 -18
  268. package/dist/esm/justifi-refund-payment.entry.js +14 -15
  269. package/dist/esm/justifi-saved-payment-method.entry.js +29 -0
  270. package/dist/esm/justifi-season-interruption-insurance.entry.js +117 -20
  271. package/dist/esm/justifi-skeleton.entry.js +15 -0
  272. package/dist/esm/justifi-terminal-orders-list-filters.entry.js +8 -9
  273. package/dist/esm/justifi-terminal-orders-list.entry.js +13 -14
  274. package/dist/esm/justifi-terminals-list-filters.entry.js +7 -8
  275. package/dist/esm/justifi-terminals-list.entry.js +15 -16
  276. package/dist/esm/loader.js +1 -1
  277. package/dist/esm/{package-DwtqmD1M.js → package-O3LY2Da6.js} +1 -1
  278. package/dist/esm/pagination-menu.entry.js +1 -1
  279. package/dist/esm/{parts-CVGBVdVC.js → parts-CfF8KKwx.js} +1 -1
  280. package/dist/esm/payment-details-core.entry.js +15 -14
  281. package/dist/esm/payment-method-option-utils-lUHAQVFl.js +15 -0
  282. package/dist/esm/payment-method-option.entry.js +15 -0
  283. package/dist/esm/{payment-provisioning-actions-BIfyW239.js → payment-provisioning-actions-ONP8lDnV.js} +2 -2
  284. package/dist/esm/{payment.service-Ck1kdYXH.js → payment.service-BWO84KlP.js} +4 -6
  285. package/dist/esm/payments-list-core.entry.js +12 -13
  286. package/dist/esm/{payments-status-gL2bjUp9.js → payments-status-XoZrlbiZ.js} +1 -1
  287. package/dist/esm/{payments-table-DrnN-flR.js → payments-table-Dh4P9mTb.js} +3 -3
  288. package/dist/esm/payout-details-core.entry.js +11 -10
  289. package/dist/esm/{payout.service-YOny8vA1.js → payout.service-Cld6TS5W.js} +4 -6
  290. package/dist/esm/payouts-list-core.entry.js +12 -13
  291. package/dist/esm/{payouts-status-BpBVp8j1.js → payouts-status-Qm2jZG1-.js} +1 -1
  292. package/dist/esm/{payouts-table-Bt0Dhq3E.js → payouts-table-DMVAZp-r.js} +3 -3
  293. package/dist/esm/{skeleton-MHyzfkPM.js → skeleton-DrHwsgs_.js} +1 -1
  294. package/dist/esm/{spinner-CaGDuAi8.js → spinner-XBq6mVJW.js} +1 -1
  295. package/dist/esm/table-filters-menu.entry.js +3 -3
  296. package/dist/esm/{table-B-m83mFl.js → table-qqt2Ew5y.js} +2 -2
  297. package/dist/esm/terminal-orders-list-core.entry.js +11 -12
  298. package/dist/esm/{terminal-orders-table-shGx8Lcn.js → terminal-orders-table-BN4Co4T8.js} +6 -8
  299. package/dist/esm/terminal-quantity-selector.entry.js +2 -2
  300. package/dist/esm/{terminal.service-CJbnbE1S.js → terminal.service-DmYCUQcA.js} +4 -6
  301. package/dist/esm/terminals-list-core.entry.js +11 -12
  302. package/dist/esm/{terminals-table-DskXRPbS.js → terminals-table-C8LczeG_.js} +3 -3
  303. package/dist/esm/{utils-Dccsn9BY.js → utils-BeQLScSm.js} +1 -1
  304. package/dist/esm/{utils-DOW3rBEH.js → utils-kWaZhFAd.js} +1 -1
  305. package/dist/esm/{utils-DIxPWgIk.js → utils-lb8p1Exq.js} +3 -1660
  306. package/dist/esm/webcomponents.js +1 -1
  307. package/dist/module/{check-pkg-version.js → Analytics.js} +22 -24
  308. package/dist/module/Refund.js +328 -1
  309. package/dist/module/additional-questions.js +1 -1
  310. package/dist/module/additional-statement.js +2 -2
  311. package/dist/module/badge.js +1 -1
  312. package/dist/module/bank-account-billing-form-simple.js +9 -4
  313. package/dist/module/bank-account-document-inputs.js +3 -5
  314. package/dist/module/bank-account-form-inputs2.js +1 -1
  315. package/dist/module/bank-account-form.js +83 -1
  316. package/dist/module/bank-account.js +103 -0
  317. package/dist/module/billing-form-full.js +14 -11
  318. package/dist/module/billing-form-schema.js +3 -3
  319. package/dist/module/business-additional-questions-form-step.js +2 -2
  320. package/dist/module/business-bank-account-form-step-core.js +2 -4
  321. package/dist/module/business-bank-account-form-step.js +3 -5
  322. package/dist/module/business-core-info-form-step.js +2 -2
  323. package/dist/module/business-core-info.js +1 -1
  324. package/dist/module/business-details-core2.js +1 -0
  325. package/dist/module/business-documents-on-file2.js +2 -1
  326. package/dist/module/business-owners-form-step-core.js +1 -0
  327. package/dist/module/business-owners-form-step.js +2 -2
  328. package/dist/module/business-representative-form-inputs.js +1 -1
  329. package/dist/module/business-representative-form-step.js +2 -2
  330. package/dist/module/business-representative.js +1 -1
  331. package/dist/module/business-terms-conditions-form-step.js +2 -4
  332. package/dist/module/business.service.js +1 -3
  333. package/dist/module/button.js +1 -1
  334. package/dist/module/cancellation-policy.js +2 -2
  335. package/dist/module/card-billing-form-simple.js +9 -4
  336. package/dist/module/card-form.js +91 -1
  337. package/dist/module/card-form2.js +28 -10
  338. package/dist/module/checkout.service.js +1 -3
  339. package/dist/module/checkout.store.js +36 -0
  340. package/dist/module/checkouts-list-core2.js +6 -6
  341. package/dist/module/custom-popper2.js +2 -2
  342. package/dist/module/customer-details.js +2 -2
  343. package/dist/module/dinero.js +1655 -0
  344. package/dist/module/dispute-management-core.js +2 -2
  345. package/dist/module/dispute-notification.js +3 -2
  346. package/dist/module/dispute-response-actions.js +1 -3
  347. package/dist/module/dispute-response-core.js +2 -2
  348. package/dist/module/dispute-response.js +4 -3
  349. package/dist/module/duplicate-charge.js +2 -2
  350. package/dist/module/electronic-evidence.js +2 -2
  351. package/dist/module/form-alert2.js +1 -1
  352. package/dist/module/form-control-checkbox2.js +4 -3
  353. package/dist/module/form-control-date2.js +3 -2
  354. package/dist/module/form-control-file-v22.js +1 -1
  355. package/dist/module/form-control-file2.js +3 -2
  356. package/dist/module/form-control-monetary-provisioning2.js +4 -3
  357. package/dist/module/form-control-monetary2.js +4 -3
  358. package/dist/module/form-control-number-masked2.js +3 -2
  359. package/dist/module/form-control-number.js +4 -3
  360. package/dist/module/form-control-radio2.js +3 -3
  361. package/dist/module/form-control-select2.js +3 -2
  362. package/dist/module/form-control-text2.js +3 -2
  363. package/dist/module/form-control-textarea2.js +3 -3
  364. package/dist/module/get-business.js +1 -1
  365. package/dist/module/get-payment-details.js +2 -4
  366. package/dist/module/get-payout-csv.js +1 -1
  367. package/dist/module/get-subaccounts.js +2 -4
  368. package/dist/module/gross-payment-chart-core2.js +2 -2
  369. package/dist/module/header-2.js +8 -0
  370. package/dist/module/header-3.js +8 -0
  371. package/dist/module/hidden-input2.js +2 -2
  372. package/dist/module/identity-address-form.js +1 -1
  373. package/dist/module/iframe-input2.js +6 -6
  374. package/dist/module/insurance-state.js +18 -7
  375. package/dist/module/justifi-bank-account-form.d.ts +11 -0
  376. package/dist/module/justifi-bank-account-form.js +6 -0
  377. package/dist/module/justifi-business-details.js +2 -2
  378. package/dist/module/justifi-business-form.js +4 -5
  379. package/dist/module/{justifi-checkout-core.d.ts → justifi-button.d.ts} +4 -4
  380. package/dist/module/justifi-button.js +6 -0
  381. package/dist/module/justifi-button2.js +41 -0
  382. package/dist/module/justifi-card-form.d.ts +11 -0
  383. package/dist/module/justifi-card-form.js +6 -0
  384. package/dist/module/justifi-checkout-summary.d.ts +11 -0
  385. package/dist/module/justifi-checkout-summary.js +6 -0
  386. package/dist/module/justifi-checkout.js +157 -137
  387. package/dist/module/justifi-checkouts-list-filters.js +4 -5
  388. package/dist/module/justifi-checkouts-list.js +5 -6
  389. package/dist/module/justifi-dispute-management.js +3 -4
  390. package/dist/module/justifi-gross-payment-chart.js +2 -4
  391. package/dist/module/justifi-header.d.ts +11 -0
  392. package/dist/module/justifi-header.js +6 -0
  393. package/dist/module/justifi-header2.js +43 -0
  394. package/dist/module/justifi-modular-checkout.d.ts +11 -0
  395. package/dist/module/justifi-modular-checkout.js +6 -0
  396. package/dist/module/justifi-order-terminals.js +7 -7
  397. package/dist/module/justifi-payment-details.js +2 -2
  398. package/dist/module/justifi-payment-provisioning.js +3 -5
  399. package/dist/module/justifi-payment-transactions-list.js +7 -7
  400. package/dist/module/justifi-payments-list-filters.js +4 -3
  401. package/dist/module/justifi-payments-list.js +5 -6
  402. package/dist/module/justifi-payout-details.js +3 -5
  403. package/dist/module/justifi-payout-transactions-list.js +7 -7
  404. package/dist/module/justifi-payouts-list-filters.js +4 -3
  405. package/dist/module/justifi-payouts-list.js +5 -6
  406. package/dist/module/justifi-radio-list-item.d.ts +11 -0
  407. package/dist/module/justifi-radio-list-item.js +6 -0
  408. package/dist/module/justifi-radio-list-item2.js +55 -0
  409. package/dist/module/justifi-refund-payment.js +3 -4
  410. package/dist/module/justifi-saved-payment-method.js +57 -1
  411. package/dist/module/justifi-saved-payment-methods.d.ts +11 -0
  412. package/dist/module/justifi-saved-payment-methods.js +6 -0
  413. package/dist/module/justifi-season-interruption-insurance.js +120 -24
  414. package/dist/module/justifi-skeleton.d.ts +11 -0
  415. package/dist/module/justifi-skeleton.js +39 -0
  416. package/dist/module/justifi-terminal-orders-list-filters.js +5 -6
  417. package/dist/module/justifi-terminal-orders-list.js +5 -6
  418. package/dist/module/justifi-terminals-list-filters.js +4 -5
  419. package/dist/module/justifi-terminals-list.js +5 -6
  420. package/dist/module/justifi-tokenize-payment-method.js +1 -219
  421. package/dist/module/legal-address-form-step.js +2 -2
  422. package/dist/module/legal-address-form.js +1 -1
  423. package/dist/module/modular-checkout.js +328 -0
  424. package/dist/module/owner-form-core2.js +3 -2
  425. package/dist/module/owner-form-inputs2.js +1 -1
  426. package/dist/module/owner-form.js +1 -1
  427. package/dist/module/package.js +3 -3
  428. package/dist/module/pagination-menu2.js +1 -1
  429. package/dist/module/parts.js +1 -1
  430. package/dist/module/payment-details-core2.js +10 -9
  431. package/dist/module/payment-method-option-utils.js +15 -0
  432. package/dist/module/payment-method-option.d.ts +11 -0
  433. package/dist/module/payment-method-option.js +54 -0
  434. package/dist/module/payment-provisioning-actions.js +1 -1
  435. package/dist/module/payment-provisioning-core.js +3 -2
  436. package/dist/module/payment-provisioning-form-buttons.js +2 -1
  437. package/dist/module/payment-provisioning-form-steps.js +1 -1
  438. package/dist/module/payment-provisioning-loading.js +1 -0
  439. package/dist/module/payment.service.js +1 -3
  440. package/dist/module/payments-list-core2.js +6 -6
  441. package/dist/module/payout-details-core2.js +5 -4
  442. package/dist/module/payout.service.js +1 -3
  443. package/dist/module/payouts-list-core2.js +6 -6
  444. package/dist/module/product-or-service.js +2 -2
  445. package/dist/module/refund-policy.js +2 -2
  446. package/dist/module/save-new-payment-method.js +13 -6
  447. package/dist/module/saved-payment-methods.js +73 -0
  448. package/dist/module/sezzle-payment-method.js +25 -18
  449. package/dist/module/shipping-details.js +2 -2
  450. package/dist/module/spinner.js +1 -1
  451. package/dist/module/summary.js +35 -0
  452. package/dist/module/table-filters-menu2.js +1 -1
  453. package/dist/module/table.js +1 -1
  454. package/dist/module/terminal-orders-list-core2.js +6 -6
  455. package/dist/module/terminal-quantity-selector2.js +2 -2
  456. package/dist/module/terminal.service.js +1 -3
  457. package/dist/module/terminals-list-core2.js +6 -6
  458. package/dist/module/tokenize-payment-method.js +400 -0
  459. package/dist/module/utils2.js +3 -1660
  460. package/dist/module/utils4.js +1 -1
  461. package/dist/types/api/BillingInformation.d.ts +13 -0
  462. package/dist/types/api/Checkout.d.ts +15 -13
  463. package/dist/types/api/ComponentError.d.ts +10 -1
  464. package/dist/types/api/PaymentMethod.d.ts +21 -0
  465. package/dist/types/components/checkout/billing-form/billing-form-schema.d.ts +4 -4
  466. package/dist/types/components/checkout/checkout.d.ts +27 -11
  467. package/dist/types/components/checkout/save-new-payment-method.d.ts +1 -1
  468. package/dist/types/components/insurance/insurance-state.d.ts +2 -1
  469. package/dist/types/components/insurance/season-interruption/season-interruption-insurance.d.ts +9 -3
  470. package/dist/types/components/modular-checkout/modular-checkout.d.ts +34 -0
  471. package/dist/types/components/{checkout/billing-form → modular-checkout/sub-components}/bank-account-billing-form-simple.d.ts +1 -1
  472. package/dist/types/components/modular-checkout/sub-components/bank-account-skeleton.d.ts +6 -0
  473. package/dist/types/components/modular-checkout/sub-components/bank-account.d.ts +18 -0
  474. package/dist/types/components/{checkout/billing-form → modular-checkout/sub-components}/billing-form-full.d.ts +1 -2
  475. package/dist/types/components/{checkout/billing-form → modular-checkout/sub-components}/card-billing-form-simple.d.ts +1 -1
  476. package/dist/types/components/modular-checkout/sub-components/card-form-skeleton.d.ts +6 -0
  477. package/dist/types/components/modular-checkout/sub-components/card-form.d.ts +20 -0
  478. package/dist/types/components/modular-checkout/sub-components/payment-method-option.d.ts +8 -0
  479. package/dist/types/components/modular-checkout/sub-components/saved-payment-methods.d.ts +7 -0
  480. package/dist/types/components/{checkout → modular-checkout/sub-components}/sezzle-payment-method.d.ts +3 -9
  481. package/dist/types/components/modular-checkout/sub-components/summary.d.ts +3 -0
  482. package/dist/types/components/tokenize-payment-method/tokenize-payment-method.d.ts +42 -15
  483. package/dist/types/components.d.ts +303 -219
  484. package/dist/types/store/checkout.store.d.ts +27 -0
  485. package/dist/types/ui-components/form/iframe-input.d.ts +2 -1
  486. package/dist/types/ui-components/index.d.ts +1 -0
  487. package/dist/types/ui-components/shadow-dom-components/justifi-button.d.ts +13 -0
  488. package/dist/types/ui-components/shadow-dom-components/justifi-radio-list-item.d.ts +12 -0
  489. package/dist/types/ui-components/shadow-dom-components/justifi-skeleton.d.ts +10 -0
  490. package/dist/webcomponents/p-08ea8974.entry.js +1 -0
  491. package/dist/webcomponents/p-0932f6a9.entry.js +1 -0
  492. package/dist/webcomponents/p-09e768fe.entry.js +1 -0
  493. package/dist/webcomponents/p-0dcc83ac.entry.js +1 -0
  494. package/dist/webcomponents/p-131d799c.entry.js +1 -0
  495. package/dist/webcomponents/p-15777cfe.entry.js +1 -0
  496. package/dist/webcomponents/p-1bdce018.entry.js +1 -0
  497. package/dist/webcomponents/p-1d53f0b8.entry.js +1 -0
  498. package/dist/webcomponents/p-1f8cd44e.entry.js +1 -0
  499. package/dist/webcomponents/p-22be0859.entry.js +1 -0
  500. package/dist/webcomponents/p-283cd78b.entry.js +1 -0
  501. package/dist/webcomponents/{p-db9f3fcd.entry.js → p-28c7bef7.entry.js} +3 -3
  502. package/dist/webcomponents/p-2f31a4e5.entry.js +1 -0
  503. package/dist/webcomponents/p-36d72e2d.entry.js +1 -0
  504. package/dist/webcomponents/p-3a4ca4df.entry.js +1 -0
  505. package/dist/webcomponents/p-3d85d046.entry.js +1 -0
  506. package/dist/webcomponents/p-40ba49e4.entry.js +1 -0
  507. package/dist/webcomponents/p-424f491c.entry.js +1 -0
  508. package/dist/webcomponents/p-466f33d7.entry.js +1 -0
  509. package/dist/webcomponents/{p-2e734e97.entry.js → p-48bccf3b.entry.js} +1 -1
  510. package/dist/webcomponents/{p-254724c4.entry.js → p-4ba144ac.entry.js} +1 -1
  511. package/dist/webcomponents/{p-437aaa5e.entry.js → p-57143978.entry.js} +1 -1
  512. package/dist/webcomponents/p-57802e57.entry.js +1 -0
  513. package/dist/webcomponents/{p-BTS3E50C.js → p-5aA7gjr5.js} +1 -1
  514. package/dist/webcomponents/p-5rVtZ2GJ.js +1 -0
  515. package/dist/webcomponents/p-6849bf8e.entry.js +1 -0
  516. package/dist/webcomponents/p-6e18d13f.entry.js +1 -0
  517. package/dist/webcomponents/p-7322c86e.entry.js +1 -0
  518. package/dist/webcomponents/p-77515be6.entry.js +1 -0
  519. package/dist/webcomponents/p-79055216.entry.js +1 -0
  520. package/dist/webcomponents/p-7c51805a.entry.js +1 -0
  521. package/dist/webcomponents/p-818f51fd.entry.js +1 -0
  522. package/dist/webcomponents/p-828a61b9.entry.js +1 -0
  523. package/dist/webcomponents/p-89e27079.entry.js +1 -0
  524. package/dist/webcomponents/p-8f0339de.entry.js +1 -0
  525. package/dist/webcomponents/p-904a95e5.entry.js +1 -0
  526. package/dist/webcomponents/p-9106fd74.entry.js +1 -0
  527. package/dist/webcomponents/p-9b75aced.entry.js +1 -0
  528. package/dist/webcomponents/p-BC8YDY7M.js +1 -0
  529. package/dist/webcomponents/{p-7MWRbTXI.js → p-BH0Xfn-F.js} +1 -1
  530. package/dist/webcomponents/p-BNz6wy4f.js +1 -0
  531. package/dist/webcomponents/p-BTkXk7ol.js +1 -0
  532. package/dist/webcomponents/p-Bb6FBEPP.js +1 -0
  533. package/dist/webcomponents/{p-CSNli0tl.js → p-BbYVgLcf.js} +1 -1
  534. package/dist/webcomponents/{p-CvXbmLtl.js → p-BeszVz87.js} +1 -1
  535. package/dist/webcomponents/p-BisQ61nK.js +1 -0
  536. package/dist/webcomponents/p-Bpcb3SsP.js +1 -0
  537. package/dist/webcomponents/p-BySyDTv5.js +1 -0
  538. package/dist/webcomponents/{p-CA1oADw4.js → p-Bz164TKZ.js} +1 -1
  539. package/dist/webcomponents/p-C1fMfnu0.js +1 -0
  540. package/dist/webcomponents/p-CCME-fyU.js +1 -0
  541. package/dist/webcomponents/p-CLwzqWk2.js +1 -0
  542. package/dist/webcomponents/p-C_CXv7AN.js +1 -0
  543. package/dist/webcomponents/{p-CVGBVdVC.js → p-CfF8KKwx.js} +1 -1
  544. package/dist/webcomponents/p-Cjcsf8ku.js +1 -0
  545. package/dist/webcomponents/{p-QxJlhLWM.js → p-CsNubTqD.js} +1 -1
  546. package/dist/webcomponents/p-CwZKT93w.js +1 -0
  547. package/dist/webcomponents/{p-C5RuuShs.js → p-D2muobcE.js} +1 -1
  548. package/dist/webcomponents/p-D599ZMGU.js +1 -0
  549. package/dist/webcomponents/p-DD74a16D.js +1 -0
  550. package/dist/webcomponents/p-DH8F0bsw.js +1 -0
  551. package/dist/webcomponents/{p-DkaX7Taq.js → p-DO3INvI2.js} +1 -1
  552. package/dist/webcomponents/p-DWUnL_zj.js +1 -0
  553. package/dist/webcomponents/p-DYGIC0QH.js +1 -0
  554. package/dist/webcomponents/{p-PmGAGJ5K.js → p-Dvxpy_P1.js} +1 -1
  555. package/dist/webcomponents/p-HXpYMWUU.js +1 -0
  556. package/dist/webcomponents/{p-CZ8q2CPi.js → p-I8XpD1TX.js} +1 -1
  557. package/dist/webcomponents/{p-BvLgDun_.js → p-JgbsbAhz.js} +1 -1
  558. package/dist/webcomponents/p-O3LY2Da6.js +1 -0
  559. package/dist/webcomponents/p-UD2JhYS2.js +1 -0
  560. package/dist/webcomponents/p-WEguiGt1.js +1 -0
  561. package/dist/webcomponents/{p-DBhBVIU-.js → p-YND5pTuF.js} +1 -1
  562. package/dist/webcomponents/p-ZpPDShvP.js +1 -0
  563. package/dist/webcomponents/p-a4172773.entry.js +1 -0
  564. package/dist/webcomponents/p-a7d5e434.entry.js +1 -0
  565. package/dist/webcomponents/p-a8205044.entry.js +1 -0
  566. package/dist/webcomponents/p-ae4297dd.entry.js +1 -0
  567. package/dist/webcomponents/p-ae5a3c2a.entry.js +1 -0
  568. package/dist/webcomponents/{p-831337bc.entry.js → p-b0bfa20f.entry.js} +1 -1
  569. package/dist/webcomponents/p-ba8ae31f.entry.js +1 -0
  570. package/dist/webcomponents/p-be06d86a.entry.js +1 -0
  571. package/dist/webcomponents/p-bea4309d.entry.js +1 -0
  572. package/dist/webcomponents/p-c3a2c619.entry.js +1 -0
  573. package/dist/webcomponents/{p-c711551a.entry.js → p-c5b48e8d.entry.js} +1 -1
  574. package/dist/webcomponents/p-cebe360b.entry.js +1 -0
  575. package/dist/webcomponents/p-d0e24727.entry.js +1 -0
  576. package/dist/webcomponents/p-d77908ca.entry.js +1 -0
  577. package/dist/webcomponents/p-dd257e60.entry.js +1 -0
  578. package/dist/webcomponents/p-dd689b5e.entry.js +1 -0
  579. package/dist/webcomponents/p-dd6d6ddb.entry.js +1 -0
  580. package/dist/webcomponents/{p-e7b60660.entry.js → p-ded22005.entry.js} +1 -1
  581. package/dist/webcomponents/p-df199396.entry.js +1 -0
  582. package/dist/webcomponents/p-dfd7c212.entry.js +1 -0
  583. package/dist/webcomponents/p-e830a580.entry.js +1 -0
  584. package/dist/webcomponents/p-e859ece8.entry.js +1 -0
  585. package/dist/webcomponents/p-eaea7cc1.entry.js +1 -0
  586. package/dist/webcomponents/p-f01953ea.entry.js +1 -0
  587. package/dist/webcomponents/p-f3a757b2.entry.js +1 -0
  588. package/dist/webcomponents/p-f47095cd.entry.js +1 -0
  589. package/dist/webcomponents/p-fa33df9f.entry.js +1 -0
  590. package/dist/webcomponents/p-ff3377e7.entry.js +1 -0
  591. package/dist/webcomponents/p-ff869ded.entry.js +1 -0
  592. package/dist/webcomponents/p-qMrd7_Gp.js +1 -0
  593. package/dist/webcomponents/{p-BRBt7Vt-.js → p-vRhNRfmB.js} +1 -1
  594. package/dist/webcomponents/p-zdIeCUeh.js +1 -0
  595. package/dist/webcomponents/p-zrUQD0Wr.js +1 -0
  596. package/dist/webcomponents/webcomponents.esm.js +1 -1
  597. package/package.json +1 -1
  598. package/dist/cjs/Checkout-nsVtlYWD.js +0 -103
  599. package/dist/cjs/Payment-2Zmn-l6G.js +0 -151
  600. package/dist/cjs/bank-account-form_9.cjs.entry.js +0 -542
  601. package/dist/cjs/iframe-input-styles-state-CGWgxf_0.js +0 -26
  602. package/dist/cjs/justifi-checkout-core.cjs.entry.js +0 -141
  603. package/dist/cjs/justifi-season-interruption-insurance-core.cjs.entry.js +0 -124
  604. package/dist/cjs/justifi-tokenize-payment-method.cjs.entry.js +0 -80
  605. package/dist/collection/components/checkout/checkout-core.js +0 -454
  606. package/dist/collection/components/checkout/new-payment-method.js +0 -378
  607. package/dist/collection/components/checkout/payment-method-options.js +0 -440
  608. package/dist/collection/components/checkout/sezzle-payment-method.js +0 -240
  609. package/dist/collection/components/insurance/season-interruption/season-interruption-insurance-core.js +0 -447
  610. package/dist/esm/Checkout-DfRTGCdt.js +0 -101
  611. package/dist/esm/Payment-93PpwzdC.js +0 -149
  612. package/dist/esm/bank-account-form_9.entry.js +0 -532
  613. package/dist/esm/iframe-input-styles-state-2KXH-_4X.js +0 -23
  614. package/dist/esm/insurance-state-yzV5mr5o.js +0 -28
  615. package/dist/esm/justifi-checkout-core.entry.js +0 -139
  616. package/dist/esm/justifi-season-interruption-insurance-core.entry.js +0 -122
  617. package/dist/esm/justifi-tokenize-payment-method.entry.js +0 -78
  618. package/dist/module/Checkout.js +0 -121
  619. package/dist/module/Payment.js +0 -204
  620. package/dist/module/checkout-core.js +0 -292
  621. package/dist/module/justifi-checkout-core.js +0 -6
  622. package/dist/module/justifi-new-payment-method.d.ts +0 -11
  623. package/dist/module/justifi-new-payment-method.js +0 -6
  624. package/dist/module/justifi-payment-method-options.d.ts +0 -11
  625. package/dist/module/justifi-payment-method-options.js +0 -6
  626. package/dist/module/justifi-season-interruption-insurance-core.d.ts +0 -11
  627. package/dist/module/justifi-season-interruption-insurance-core.js +0 -6
  628. package/dist/module/new-payment-method.js +0 -222
  629. package/dist/module/payment-method-options.js +0 -237
  630. package/dist/module/saved-payment-method.js +0 -79
  631. package/dist/module/season-interruption-insurance-core.js +0 -168
  632. package/dist/types/components/checkout/checkout-core.d.ts +0 -49
  633. package/dist/types/components/checkout/new-payment-method.d.ts +0 -31
  634. package/dist/types/components/checkout/payment-method-options.d.ts +0 -32
  635. package/dist/types/components/insurance/season-interruption/season-interruption-insurance-core.d.ts +0 -32
  636. package/dist/webcomponents/p-08ae973e.entry.js +0 -1
  637. package/dist/webcomponents/p-0ac1bb26.entry.js +0 -1
  638. package/dist/webcomponents/p-0ced05b3.entry.js +0 -1
  639. package/dist/webcomponents/p-144f15c1.entry.js +0 -1
  640. package/dist/webcomponents/p-20a75acd.entry.js +0 -1
  641. package/dist/webcomponents/p-2634a1ee.entry.js +0 -1
  642. package/dist/webcomponents/p-28133336.entry.js +0 -1
  643. package/dist/webcomponents/p-29f81159.entry.js +0 -1
  644. package/dist/webcomponents/p-2b1090d0.entry.js +0 -1
  645. package/dist/webcomponents/p-3aafab63.entry.js +0 -1
  646. package/dist/webcomponents/p-3b98d8ca.entry.js +0 -1
  647. package/dist/webcomponents/p-3f771784.entry.js +0 -1
  648. package/dist/webcomponents/p-4114a328.entry.js +0 -1
  649. package/dist/webcomponents/p-41ab2378.entry.js +0 -1
  650. package/dist/webcomponents/p-423ad3eb.entry.js +0 -1
  651. package/dist/webcomponents/p-43752d57.entry.js +0 -1
  652. package/dist/webcomponents/p-44FkPJq7.js +0 -1
  653. package/dist/webcomponents/p-50f8e87e.entry.js +0 -1
  654. package/dist/webcomponents/p-52092407.entry.js +0 -1
  655. package/dist/webcomponents/p-52ede69d.entry.js +0 -1
  656. package/dist/webcomponents/p-540c31f2.entry.js +0 -1
  657. package/dist/webcomponents/p-5B_nojEF.js +0 -1
  658. package/dist/webcomponents/p-5dbd1b93.entry.js +0 -1
  659. package/dist/webcomponents/p-6158cf60.entry.js +0 -1
  660. package/dist/webcomponents/p-652cc155.entry.js +0 -1
  661. package/dist/webcomponents/p-66a77e7d.entry.js +0 -1
  662. package/dist/webcomponents/p-6816c021.entry.js +0 -1
  663. package/dist/webcomponents/p-69800e4a.entry.js +0 -1
  664. package/dist/webcomponents/p-6dd98d75.entry.js +0 -1
  665. package/dist/webcomponents/p-7528f993.entry.js +0 -1
  666. package/dist/webcomponents/p-7bc9d8f4.entry.js +0 -1
  667. package/dist/webcomponents/p-7be2ef8d.entry.js +0 -1
  668. package/dist/webcomponents/p-7d3a563f.entry.js +0 -1
  669. package/dist/webcomponents/p-8dfc21d5.entry.js +0 -1
  670. package/dist/webcomponents/p-96b75110.entry.js +0 -1
  671. package/dist/webcomponents/p-BEXEpjn_.js +0 -1
  672. package/dist/webcomponents/p-BGUDiFCH.js +0 -1
  673. package/dist/webcomponents/p-BZ70sqbi.js +0 -1
  674. package/dist/webcomponents/p-BiWuElbM.js +0 -1
  675. package/dist/webcomponents/p-BwRi5Eou.js +0 -1
  676. package/dist/webcomponents/p-CHB0cPw7.js +0 -1
  677. package/dist/webcomponents/p-Cs0cIpIm.js +0 -1
  678. package/dist/webcomponents/p-Cuxr_9xa.js +0 -1
  679. package/dist/webcomponents/p-D-vUkGsU.js +0 -1
  680. package/dist/webcomponents/p-D6ssxpjT.js +0 -1
  681. package/dist/webcomponents/p-DAasymX_.js +0 -1
  682. package/dist/webcomponents/p-DIxPWgIk.js +0 -1
  683. package/dist/webcomponents/p-DT-cTREr.js +0 -1
  684. package/dist/webcomponents/p-DZgAEPoo.js +0 -1
  685. package/dist/webcomponents/p-DZw7v4st.js +0 -1
  686. package/dist/webcomponents/p-Dgo6D5G7.js +0 -1
  687. package/dist/webcomponents/p-DniQ6yo6.js +0 -1
  688. package/dist/webcomponents/p-DwtqmD1M.js +0 -1
  689. package/dist/webcomponents/p-G_As8rAe.js +0 -1
  690. package/dist/webcomponents/p-SdntD1xf.js +0 -1
  691. package/dist/webcomponents/p-Y-KcAUY_.js +0 -1
  692. package/dist/webcomponents/p-a1ce996c.entry.js +0 -1
  693. package/dist/webcomponents/p-a3c5ac1c.entry.js +0 -1
  694. package/dist/webcomponents/p-af3ef542.entry.js +0 -1
  695. package/dist/webcomponents/p-b3e8e00f.entry.js +0 -1
  696. package/dist/webcomponents/p-b46bf62f.entry.js +0 -1
  697. package/dist/webcomponents/p-b8b7603c.entry.js +0 -1
  698. package/dist/webcomponents/p-be165165.entry.js +0 -1
  699. package/dist/webcomponents/p-c8ae1620.entry.js +0 -1
  700. package/dist/webcomponents/p-d47a05ba.entry.js +0 -1
  701. package/dist/webcomponents/p-d54963ce.entry.js +0 -1
  702. package/dist/webcomponents/p-d5505b45.entry.js +0 -1
  703. package/dist/webcomponents/p-d6f02807.entry.js +0 -1
  704. package/dist/webcomponents/p-d711f296.entry.js +0 -1
  705. package/dist/webcomponents/p-d9704f8c.entry.js +0 -1
  706. package/dist/webcomponents/p-da6790bb.entry.js +0 -1
  707. package/dist/webcomponents/p-da731140.entry.js +0 -1
  708. package/dist/webcomponents/p-e3197269.entry.js +0 -1
  709. package/dist/webcomponents/p-e4dbec27.entry.js +0 -1
  710. package/dist/webcomponents/p-f057b215.entry.js +0 -1
  711. package/dist/webcomponents/p-f9a18fcb.entry.js +0 -1
  712. package/dist/webcomponents/p-fa30d8bd.entry.js +0 -1
  713. package/dist/webcomponents/p-fc1e3832.entry.js +0 -1
  714. package/dist/webcomponents/p-lZ9GOnvt.js +0 -1
  715. package/dist/webcomponents/p-qnx9PpK1.js +0 -1
  716. package/dist/webcomponents/p-vi4XpHew.js +0 -1
  717. package/dist/webcomponents/p-zRPvfo_G.js +0 -1
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var dinero = require('./dinero-BwNN_k7x.js');
4
+
3
5
  var dateFns = {};
4
6
 
5
7
  var add = {};
@@ -22140,1667 +22142,13 @@ function requireDateFns () {
22140
22142
 
22141
22143
  var dateFnsExports = /*@__PURE__*/ requireDateFns();
22142
22144
 
22143
- /**
22144
- * Default values for all Dinero objects.
22145
- *
22146
- * You can override default values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.
22147
- * Existing instances won't be affected.
22148
- *
22149
- * @property {Number} defaultAmount - The default amount for new Dinero objects (see {@link module:Dinero Dinero} for format).
22150
- * @property {String} defaultCurrency - The default currency for new Dinero objects (see {@link module:Dinero Dinero} for format).
22151
- * @property {Number} defaultPrecision - The default precision for new Dinero objects (see {@link module:Dinero Dinero} for format).
22152
- *
22153
- * @example
22154
- * // Will set currency to 'EUR' for all Dinero objects.
22155
- * Dinero.defaultCurrency = 'EUR'
22156
- *
22157
- * @type {Object}
22158
- */
22159
- var Defaults = {
22160
- defaultAmount: 0,
22161
- defaultCurrency: 'USD',
22162
- defaultPrecision: 2
22163
- };
22164
- /**
22165
- * Global settings for all Dinero objects.
22166
- *
22167
- * You can override global values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.
22168
- * Existing instances won't be affected.
22169
- *
22170
- * @property {String} globalLocale - The global locale for new Dinero objects (see {@link module:Dinero~setLocale setLocale} for format).
22171
- * @property {String} globalFormat - The global format for new Dinero objects (see {@link module:Dinero~toFormat toFormat} for format).
22172
- * @property {String} globalRoundingMode - The global rounding mode for new Dinero objects (see {@link module:Dinero~multiply multiply} or {@link module:Dinero~divide divide} for format).
22173
- * @property {String} globalFormatRoundingMode - The global rounding mode to format new Dinero objects (see {@link module:Dinero~toFormat toFormat} or {@link module:Dinero~toRoundedUnit toRoundedUnit} for format).
22174
- * @property {(String|Promise)} globalExchangeRatesApi.endpoint - The global exchange rate API endpoint for new Dinero objects, or the global promise that resolves to the exchanges rates (see {@link module:Dinero~convert convert} for format).
22175
- * @property {String} globalExchangeRatesApi.propertyPath - The global exchange rate API property path for new Dinero objects (see {@link module:Dinero~convert convert} for format).
22176
- * @property {Object} globalExchangeRatesApi.headers - The global exchange rate API headers for new Dinero objects (see {@link module:Dinero~convert convert} for format).
22177
- *
22178
- * @example
22179
- * // Will set locale to 'fr-FR' for all Dinero objects.
22180
- * Dinero.globalLocale = 'fr-FR'
22181
- * @example
22182
- * // Will set global exchange rate API parameters for all Dinero objects.
22183
- * Dinero.globalExchangeRatesApi = {
22184
- * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',
22185
- * propertyPath: 'data.rates.{{to}}',
22186
- * headers: {
22187
- * 'user-key': 'xxxxxxxxx'
22188
- * }
22189
- * }
22190
- *
22191
- * @type {Object}
22192
- */
22193
-
22194
- var Globals = {
22195
- globalLocale: 'en-US',
22196
- globalFormat: '$0,0.00',
22197
- globalRoundingMode: 'HALF_EVEN',
22198
- globalFormatRoundingMode: 'HALF_AWAY_FROM_ZERO',
22199
- globalExchangeRatesApi: {
22200
- endpoint: undefined,
22201
- headers: undefined,
22202
- propertyPath: undefined
22203
- }
22204
- };
22205
-
22206
- function _typeof(obj) {
22207
- "@babel/helpers - typeof";
22208
-
22209
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
22210
- _typeof = function (obj) {
22211
- return typeof obj;
22212
- };
22213
- } else {
22214
- _typeof = function (obj) {
22215
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
22216
- };
22217
- }
22218
-
22219
- return _typeof(obj);
22220
- }
22221
-
22222
- function _toArray(arr) {
22223
- return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
22224
- }
22225
-
22226
- function _arrayWithHoles(arr) {
22227
- if (Array.isArray(arr)) return arr;
22228
- }
22229
-
22230
- function _iterableToArray(iter) {
22231
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
22232
- }
22233
-
22234
- function _unsupportedIterableToArray(o, minLen) {
22235
- if (!o) return;
22236
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
22237
- var n = Object.prototype.toString.call(o).slice(8, -1);
22238
- if (n === "Object" && o.constructor) n = o.constructor.name;
22239
- if (n === "Map" || n === "Set") return Array.from(o);
22240
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
22241
- }
22242
-
22243
- function _arrayLikeToArray(arr, len) {
22244
- if (len == null || len > arr.length) len = arr.length;
22245
-
22246
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
22247
-
22248
- return arr2;
22249
- }
22250
-
22251
- function _nonIterableRest() {
22252
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22253
- }
22254
-
22255
- /**
22256
- * Static methods for Dinero.
22257
- * @ignore
22258
- *
22259
- * @type {Object}
22260
- */
22261
- var Static = {
22262
- /**
22263
- * Returns an array of Dinero objects, normalized to the same precision (the highest).
22264
- *
22265
- * @memberof module:Dinero
22266
- * @method
22267
- *
22268
- * @param {Dinero[]} objects - An array of Dinero objects
22269
- *
22270
- * @example
22271
- * // returns an array of Dinero objects
22272
- * // both with a precision of 3
22273
- * // and an amount of 1000
22274
- * Dinero.normalizePrecision([
22275
- * Dinero({ amount: 100, precision: 2 }),
22276
- * Dinero({ amount: 1000, precision: 3 })
22277
- * ])
22278
- *
22279
- * @return {Dinero[]}
22280
- */
22281
- normalizePrecision: function normalizePrecision(objects) {
22282
- var highestPrecision = objects.reduce(function (a, b) {
22283
- return Math.max(a.getPrecision(), b.getPrecision());
22284
- });
22285
- return objects.map(function (object) {
22286
- return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;
22287
- });
22288
- },
22289
-
22290
- /**
22291
- * Returns the smallest Dinero object from an array of Dinero objects
22292
- *
22293
- * @memberof module:Dinero
22294
- * @method
22295
- *
22296
- * @param {Dinero[]} objects - An array of Dinero objects
22297
- *
22298
- * @example
22299
- * // returns the smallest Dinero object with amount of 500 from an array of Dinero objects with different precisions
22300
- * Dinero.minimum([
22301
- * Dinero({ amount: 500, precision: 3 }),
22302
- * Dinero({ amount: 100, precision: 2 })
22303
- * ])
22304
- * @example
22305
- * // returns the smallest Dinero object with amount of 50 from an array of Dinero objects
22306
- * Dinero.minimum([
22307
- * Dinero({ amount: 50 }),
22308
- * Dinero({ amount: 100 })
22309
- * ])
22310
- *
22311
- * @return {Dinero[]}
22312
- */
22313
- minimum: function minimum(objects) {
22314
- var _objects = _toArray(objects),
22315
- firstObject = _objects[0],
22316
- tailObjects = _objects.slice(1);
22317
-
22318
- var currentMinimum = firstObject;
22319
- tailObjects.forEach(function (obj) {
22320
- currentMinimum = currentMinimum.lessThan(obj) ? currentMinimum : obj;
22321
- });
22322
- return currentMinimum;
22323
- },
22324
-
22325
- /**
22326
- * Returns the biggest Dinero object from an array of Dinero objects
22327
- *
22328
- * @memberof module:Dinero
22329
- * @method
22330
- *
22331
- * @param {Dinero[]} objects - An array of Dinero objects
22332
- *
22333
- * @example
22334
- * // returns the biggest Dinero object with amount of 20, from an array of Dinero objects with different precisions
22335
- * Dinero.maximum([
22336
- * Dinero({ amount: 20, precision: 2 }),
22337
- * Dinero({ amount: 150, precision: 3 })
22338
- * ])
22339
- * @example
22340
- * // returns the biggest Dinero object with amount of 100, from an array of Dinero objects
22341
- * Dinero.maximum([
22342
- * Dinero({ amount: 100 }),
22343
- * Dinero({ amount: 50 })
22344
- * ])
22345
- *
22346
- * @return {Dinero[]}
22347
- */
22348
- maximum: function maximum(objects) {
22349
- var _objects2 = _toArray(objects),
22350
- firstObject = _objects2[0],
22351
- tailObjects = _objects2.slice(1);
22352
-
22353
- var currentMaximum = firstObject;
22354
- tailObjects.forEach(function (obj) {
22355
- currentMaximum = currentMaximum.greaterThan(obj) ? currentMaximum : obj;
22356
- });
22357
- return currentMaximum;
22358
- }
22359
- };
22360
-
22361
- /**
22362
- * Returns whether a value is numeric.
22363
- * @ignore
22364
- *
22365
- * @param {} value - The value to test.
22366
- *
22367
- * @return {Boolean}
22368
- */
22369
- function isNumeric(value) {
22370
- return !isNaN(parseInt(value)) && isFinite(value);
22371
- }
22372
- /**
22373
- * Returns whether a value is a percentage.
22374
- * @ignore
22375
- *
22376
- * @param {} percentage - The percentage to test.
22377
- *
22378
- * @return {Boolean}
22379
- */
22380
-
22381
- function isPercentage(percentage) {
22382
- return isNumeric(percentage) && percentage <= 100 && percentage >= 0;
22383
- }
22384
- /**
22385
- * Returns whether an array of ratios is valid.
22386
- * @ignore
22387
- *
22388
- * @param {} ratios - The ratios to test.
22389
- *
22390
- * @return {Boolean}
22391
- */
22392
-
22393
- function areValidRatios(ratios) {
22394
- return ratios.length > 0 && ratios.every(function (ratio) {
22395
- return ratio >= 0;
22396
- }) && ratios.some(function (ratio) {
22397
- return ratio > 0;
22398
- });
22399
- }
22400
- /**
22401
- * Returns whether a value is even.
22402
- * @ignore
22403
- *
22404
- * @param {Number} value - The value to test.
22405
- *
22406
- * @return {Boolean}
22407
- */
22408
-
22409
- function isEven(value) {
22410
- return value % 2 === 0;
22411
- }
22412
- /**
22413
- * Returns whether a value is a float.
22414
- * @ignore
22415
- *
22416
- * @param {} value - The value to test.
22417
- *
22418
- * @return {Boolean}
22419
- */
22420
-
22421
- function isFloat(value) {
22422
- return isNumeric(value) && !Number.isInteger(value);
22423
- }
22424
- /**
22425
- * Returns how many fraction digits a number has.
22426
- * @ignore
22427
- *
22428
- * @param {Number} [number=0] - The number to test.
22429
- *
22430
- * @return {Number}
22431
- */
22432
-
22433
- function countFractionDigits() {
22434
- var number = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
22435
- var stringRepresentation = number.toString();
22436
-
22437
- if (stringRepresentation.indexOf('e-') > 0) {
22438
- // It's too small for a normal string representation, e.g. 1e-7 instead of 0.00000001
22439
- return parseInt(stringRepresentation.split('e-')[1]);
22440
- } else {
22441
- var fractionDigits = stringRepresentation.split('.')[1];
22442
- return fractionDigits ? fractionDigits.length : 0;
22443
- }
22444
- }
22445
- /**
22446
- * Returns whether a number is half.
22447
- * @ignore
22448
- *
22449
- * @param {Number} number - The number to test.
22450
- *
22451
- * @return {Number}
22452
- */
22453
-
22454
- function isHalf(number) {
22455
- return Math.abs(number) % 1 === 0.5;
22456
- }
22457
- /**
22458
- * Fetches a JSON resource.
22459
- * @ignore
22460
- *
22461
- * @param {String} url - The resource to fetch.
22462
- * @param {Object} [options.headers] - The headers to pass.
22463
- *
22464
- * @throws {Error} If `request.status` is lesser than 200 or greater or equal to 400.
22465
- * @throws {Error} If network fails.
22466
- *
22467
- * @return {JSON}
22468
- */
22469
-
22470
- function getJSON(url) {
22471
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22472
- return new Promise(function (resolve, reject) {
22473
- var request = Object.assign(new XMLHttpRequest(), {
22474
- onreadystatechange: function onreadystatechange() {
22475
- if (request.readyState === 4) {
22476
- if (request.status >= 200 && request.status < 400) resolve(JSON.parse(request.responseText));else reject(new Error(request.statusText));
22477
- }
22478
- },
22479
- onerror: function onerror() {
22480
- reject(new Error('Network error'));
22481
- }
22482
- });
22483
- request.open('GET', url, true);
22484
- setXHRHeaders(request, options.headers);
22485
- request.send();
22486
- });
22487
- }
22488
- /**
22489
- * Returns an XHR object with attached headers.
22490
- * @ignore
22491
- *
22492
- * @param {XMLHttpRequest} xhr - The XHR request to set headers to.
22493
- * @param {Object} headers - The headers to set.
22494
- *
22495
- * @return {XMLHttpRequest}
22496
- */
22497
-
22498
- function setXHRHeaders(xhr) {
22499
- var headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22500
-
22501
- for (var header in headers) {
22502
- xhr.setRequestHeader(header, headers[header]);
22503
- }
22504
-
22505
- return xhr;
22506
- }
22507
- /**
22508
- * Returns whether a value is undefined.
22509
- * @ignore
22510
- *
22511
- * @param {} value - The value to test.
22512
- *
22513
- * @return {Boolean}
22514
- */
22515
-
22516
- function isUndefined(value) {
22517
- return typeof value === 'undefined';
22518
- }
22519
- /**
22520
- * Returns an object flattened to one level deep.
22521
- * @ignore
22522
- *
22523
- * @param {Object} object - The object to flatten.
22524
- * @param {String} separator - The separator to use between flattened nodes.
22525
- *
22526
- * @return {Object}
22527
- */
22528
-
22529
- function flattenObject(object) {
22530
- var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.';
22531
- var finalObject = {};
22532
- Object.entries(object).forEach(function (item) {
22533
- if (_typeof(item[1]) === 'object') {
22534
- var flatObject = flattenObject(item[1]);
22535
- Object.entries(flatObject).forEach(function (node) {
22536
- finalObject[item[0] + separator + node[0]] = node[1];
22537
- });
22538
- } else {
22539
- finalObject[item[0]] = item[1];
22540
- }
22541
- });
22542
- return finalObject;
22543
- }
22544
- /**
22545
- * Returns whether a value is thenable.
22546
- * @ignore
22547
- *
22548
- * @param {} value - The value to test.
22549
- *
22550
- * @return {Boolean}
22551
- */
22552
-
22553
- function isThenable(value) {
22554
- return Boolean(value) && (_typeof(value) === 'object' || typeof value === 'function') && typeof value.then === 'function';
22555
- }
22556
-
22557
- function Calculator() {
22558
- var floatMultiply = function floatMultiply(a, b) {
22559
- var getFactor = function getFactor(number) {
22560
- return Math.pow(10, countFractionDigits(number));
22561
- };
22562
-
22563
- var factor = Math.max(getFactor(a), getFactor(b));
22564
- return Math.round(a * factor) * Math.round(b * factor) / (factor * factor);
22565
- };
22566
-
22567
- var roundingModes = {
22568
- HALF_ODD: function HALF_ODD(number) {
22569
- var rounded = Math.round(number);
22570
- return isHalf(number) ? isEven(rounded) ? rounded - 1 : rounded : rounded;
22571
- },
22572
- HALF_EVEN: function HALF_EVEN(number) {
22573
- var rounded = Math.round(number);
22574
- return isHalf(number) ? isEven(rounded) ? rounded : rounded - 1 : rounded;
22575
- },
22576
- HALF_UP: function HALF_UP(number) {
22577
- return Math.round(number);
22578
- },
22579
- HALF_DOWN: function HALF_DOWN(number) {
22580
- return isHalf(number) ? Math.floor(number) : Math.round(number);
22581
- },
22582
- HALF_TOWARDS_ZERO: function HALF_TOWARDS_ZERO(number) {
22583
- return isHalf(number) ? Math.sign(number) * Math.floor(Math.abs(number)) : Math.round(number);
22584
- },
22585
- HALF_AWAY_FROM_ZERO: function HALF_AWAY_FROM_ZERO(number) {
22586
- return isHalf(number) ? Math.sign(number) * Math.ceil(Math.abs(number)) : Math.round(number);
22587
- },
22588
- DOWN: function DOWN(number) {
22589
- return Math.floor(number);
22590
- }
22591
- };
22592
- return {
22593
- /**
22594
- * Returns the sum of two numbers.
22595
- * @ignore
22596
- *
22597
- * @param {Number} a - The first number to add.
22598
- * @param {Number} b - The second number to add.
22599
- *
22600
- * @return {Number}
22601
- */
22602
- add: function add(a, b) {
22603
- return a + b;
22604
- },
22605
-
22606
- /**
22607
- * Returns the difference of two numbers.
22608
- * @ignore
22609
- *
22610
- * @param {Number} a - The first number to subtract.
22611
- * @param {Number} b - The second number to subtract.
22612
- *
22613
- * @return {Number}
22614
- */
22615
- subtract: function subtract(a, b) {
22616
- return a - b;
22617
- },
22618
-
22619
- /**
22620
- * Returns the product of two numbers.
22621
- * @ignore
22622
- *
22623
- * @param {Number} a - The first number to multiply.
22624
- * @param {Number} b - The second number to multiply.
22625
- *
22626
- * @return {Number}
22627
- */
22628
- multiply: function multiply(a, b) {
22629
- return isFloat(a) || isFloat(b) ? floatMultiply(a, b) : a * b;
22630
- },
22631
-
22632
- /**
22633
- * Returns the quotient of two numbers.
22634
- * @ignore
22635
- *
22636
- * @param {Number} a - The first number to divide.
22637
- * @param {Number} b - The second number to divide.
22638
- *
22639
- * @return {Number}
22640
- */
22641
- divide: function divide(a, b) {
22642
- return a / b;
22643
- },
22644
-
22645
- /**
22646
- * Returns the remainder of two numbers.
22647
- * @ignore
22648
- *
22649
- * @param {Number} a - The first number to divide.
22650
- * @param {Number} b - The second number to divide.
22651
- *
22652
- * @return {Number}
22653
- */
22654
- modulo: function modulo(a, b) {
22655
- return a % b;
22656
- },
22657
-
22658
- /**
22659
- * Returns a rounded number based off a specific rounding mode.
22660
- * @ignore
22661
- *
22662
- * @param {Number} number - The number to round.
22663
- * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use.
22664
- *
22665
- * @returns {Number}
22666
- */
22667
- round: function round(number) {
22668
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'HALF_EVEN';
22669
- return roundingModes[roundingMode](number);
22670
- }
22671
- };
22672
- }
22673
-
22674
- var calculator = Calculator();
22675
- function Format(format) {
22676
- var matches = /^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(format);
22677
- return {
22678
- /**
22679
- * Returns the matches.
22680
- * @ignore
22681
- *
22682
- * @return {Array}
22683
- */
22684
- getMatches: function getMatches() {
22685
- return matches !== null ? matches.slice(1).filter(function (match) {
22686
- return !isUndefined(match);
22687
- }) : [];
22688
- },
22689
-
22690
- /**
22691
- * Returns the amount of fraction digits to display.
22692
- * @ignore
22693
- *
22694
- * @return {Number}
22695
- */
22696
- getMinimumFractionDigits: function getMinimumFractionDigits() {
22697
- var decimalPosition = function decimalPosition(match) {
22698
- return match === '.';
22699
- };
22700
-
22701
- return !isUndefined(this.getMatches().find(decimalPosition)) ? this.getMatches()[calculator.add(this.getMatches().findIndex(decimalPosition), 1)].split('').length : 0;
22702
- },
22703
-
22704
- /**
22705
- * Returns the currency display mode.
22706
- * @ignore
22707
- *
22708
- * @return {String}
22709
- */
22710
- getCurrencyDisplay: function getCurrencyDisplay() {
22711
- var modes = {
22712
- USD: 'code',
22713
- dollar: 'name',
22714
- $: 'symbol'
22715
- };
22716
- return modes[this.getMatches().find(function (match) {
22717
- return match === 'USD' || match === 'dollar' || match === '$';
22718
- })];
22719
- },
22720
-
22721
- /**
22722
- * Returns the formatting style.
22723
- * @ignore
22724
- *
22725
- * @return {String}
22726
- */
22727
- getStyle: function getStyle() {
22728
- return !isUndefined(this.getCurrencyDisplay(this.getMatches())) ? 'currency' : 'decimal';
22729
- },
22730
-
22731
- /**
22732
- * Returns whether grouping should be used or not.
22733
- * @ignore
22734
- *
22735
- * @return {Boolean}
22736
- */
22737
- getUseGrouping: function getUseGrouping() {
22738
- return !isUndefined(this.getMatches().find(function (match) {
22739
- return match === ',';
22740
- }));
22741
- }
22742
- };
22743
- }
22744
-
22745
- function CurrencyConverter(options) {
22746
- /* istanbul ignore next */
22747
- var mergeTags = function mergeTags() {
22748
- var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
22749
- var tags = arguments.length > 1 ? arguments[1] : undefined;
22750
-
22751
- for (var tag in tags) {
22752
- string = string.replace("{{".concat(tag, "}}"), tags[tag]);
22753
- }
22754
-
22755
- return string;
22756
- };
22757
- /* istanbul ignore next */
22758
-
22759
-
22760
- var getRatesFromRestApi = function getRatesFromRestApi(from, to) {
22761
- return getJSON(mergeTags(options.endpoint, {
22762
- from: from,
22763
- to: to
22764
- }), {
22765
- headers: options.headers
22766
- });
22767
- };
22768
-
22769
- return {
22770
- /**
22771
- * Returns the exchange rate.
22772
- * @ignore
22773
- *
22774
- * @param {String} from - The base currency.
22775
- * @param {String} to - The destination currency.
22776
- *
22777
- * @return {Promise}
22778
- */
22779
- getExchangeRate: function getExchangeRate(from, to) {
22780
- return (isThenable(options.endpoint) ? options.endpoint : getRatesFromRestApi(from, to)).then(function (data) {
22781
- return flattenObject(data)[mergeTags(options.propertyPath, {
22782
- from: from,
22783
- to: to
22784
- })];
22785
- });
22786
- }
22787
- };
22788
- }
22789
-
22790
- /**
22791
- * Performs an assertion.
22792
- * @ignore
22793
- *
22794
- * @param {Boolean} condition - The expression to assert.
22795
- * @param {String} errorMessage - The message to throw if the assertion fails
22796
- * @param {ErrorConstructor} [ErrorType=Error] - The error to throw if the assertion fails.
22797
- *
22798
- * @throws {Error} If `condition` returns `false`.
22799
- */
22800
-
22801
- function assert(condition, errorMessage) {
22802
- var ErrorType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Error;
22803
- if (!condition) throw new ErrorType(errorMessage);
22804
- }
22805
- /**
22806
- * Asserts a value is a percentage.
22807
- * @ignore
22808
- *
22809
- * @param {} percentage - The percentage to test.
22810
- *
22811
- * @throws {RangeError} If `percentage` is out of range.
22812
- */
22813
-
22814
- function assertPercentage(percentage) {
22815
- assert(isPercentage(percentage), 'You must provide a numeric value between 0 and 100.', RangeError);
22816
- }
22817
- /**
22818
- * Asserts an array of ratios is valid.
22819
- * @ignore
22820
- *
22821
- * @param {} ratios - The ratios to test.
22822
- *
22823
- * @throws {TypeError} If `ratios` are invalid.
22824
- */
22825
-
22826
- function assertValidRatios(ratios) {
22827
- assert(areValidRatios(ratios), 'You must provide a non-empty array of numeric values greater than 0.', TypeError);
22828
- }
22829
- /**
22830
- * Asserts a value is an integer.
22831
- * @ignore
22832
- *
22833
- * @param {} number - The value to test.
22834
- *
22835
- * @throws {TypeError}
22836
- */
22837
-
22838
- function assertInteger(number) {
22839
- assert(Number.isInteger(number), 'You must provide an integer.', TypeError);
22840
- }
22841
-
22842
- var calculator$1 = Calculator();
22843
- /**
22844
- * A Dinero object is an immutable data structure representing a specific monetary value.
22845
- * It comes with methods for creating, parsing, manipulating, testing, transforming and formatting them.
22846
- *
22847
- * A Dinero object has:
22848
- *
22849
- * * An `amount`, expressed in minor currency units, as an integer.
22850
- * * A `currency`, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.
22851
- * * A `precision`, expressed as an integer, to represent the number of decimal places in the `amount`.
22852
- * This is helpful when you want to represent fractional minor currency units (e.g.: $10.4545).
22853
- * You can also use it to represent a currency with a different [exponent](https://en.wikipedia.org/wiki/ISO_4217#Treatment_of_minor_currency_units_.28the_.22exponent.22.29) than `2` (e.g.: Iraqi dinar with 1000 fils in 1 dinar (exponent of `3`), Japanese yen with no sub-units (exponent of `0`)).
22854
- * * An optional `locale` property that affects how output strings are formatted.
22855
- *
22856
- * Here's an overview of the public API:
22857
- *
22858
- * * **Access:** {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~getCurrency getCurrency}, {@link module:Dinero~getLocale getLocale} and {@link module:Dinero~getPrecision getPrecision}.
22859
- * * **Manipulation:** {@link module:Dinero~add add}, {@link module:Dinero~subtract subtract}, {@link module:Dinero~multiply multiply}, {@link module:Dinero~divide divide}, {@link module:Dinero~percentage percentage}, {@link module:Dinero~allocate allocate} and {@link module:Dinero~convert convert}.
22860
- * * **Testing:** {@link module:Dinero~equalsTo equalsTo}, {@link module:Dinero~lessThan lessThan}, {@link module:Dinero~lessThanOrEqual lessThanOrEqual}, {@link module:Dinero~greaterThan greaterThan}, {@link module:Dinero~greaterThanOrEqual greaterThanOrEqual}, {@link module:Dinero~isZero isZero}, {@link module:Dinero~isPositive isPositive}, {@link module:Dinero~isNegative isNegative}, {@link module:Dinero~hasSubUnits hasSubUnits}, {@link module:Dinero~hasSameCurrency hasSameCurrency} and {@link module:Dinero~hasSameAmount hasSameAmount}.
22861
- * * **Configuration:** {@link module:Dinero~setLocale setLocale}.
22862
- * * **Conversion & formatting:** {@link module:Dinero~toFormat toFormat}, {@link module:Dinero~toUnit toUnit}, {@link module:Dinero~toRoundedUnit toRoundedUnit}, {@link module:Dinero~toObject toObject}, {@link module:Dinero~toJSON toJSON}, {@link module:Dinero~convertPrecision convertPrecision} and {@link module:Dinero.normalizePrecision normalizePrecision}.
22863
- *
22864
- * Dinero.js uses `number`s under the hood, so it's constrained by the [double-precision floating-point format](https://en.wikipedia.org/wiki/Double-precision_floating-point_format). Using values over [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MAX_SAFE_INTEGER) or below [`Number.MIN_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MIN_SAFE_INTEGER) will yield unpredictable results.
22865
- * Same goes with performing calculations: once the internal `amount` value exceeds those limits, precision is no longer guaranteed.
22866
- *
22867
- * @module Dinero
22868
- * @param {Number} [options.amount=0] - The amount in minor currency units (as an integer).
22869
- * @param {String} [options.currency='USD'] - An ISO 4217 currency code.
22870
- * @param {String} [options.precision=2] - The number of decimal places to represent.
22871
- *
22872
- * @throws {TypeError} If `amount` or `precision` is invalid. Integers over [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MAX_SAFE_INTEGER) or below [`Number.MIN_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MIN_SAFE_INTEGER) are considered valid, even though they can lead to imprecise amounts.
22873
- *
22874
- * @return {Object}
22875
- */
22876
-
22877
- var Dinero = function Dinero(options) {
22878
- var _Object$assign = Object.assign({}, {
22879
- amount: Dinero.defaultAmount,
22880
- currency: Dinero.defaultCurrency,
22881
- precision: Dinero.defaultPrecision
22882
- }, options),
22883
- amount = _Object$assign.amount,
22884
- currency = _Object$assign.currency,
22885
- precision = _Object$assign.precision;
22886
-
22887
- assertInteger(amount);
22888
- assertInteger(precision);
22889
- var globalLocale = Dinero.globalLocale,
22890
- globalFormat = Dinero.globalFormat,
22891
- globalRoundingMode = Dinero.globalRoundingMode,
22892
- globalFormatRoundingMode = Dinero.globalFormatRoundingMode;
22893
- var globalExchangeRatesApi = Object.assign({}, Dinero.globalExchangeRatesApi);
22894
- /**
22895
- * Uses ES5 function notation so `this` can be passed through call, apply and bind
22896
- * @ignore
22897
- */
22898
-
22899
- var create = function create(options) {
22900
- var obj = Object.assign({}, Object.assign({}, {
22901
- amount: amount,
22902
- currency: currency,
22903
- precision: precision
22904
- }, options), Object.assign({}, {
22905
- locale: this.locale
22906
- }, options));
22907
- return Object.assign(Dinero({
22908
- amount: obj.amount,
22909
- currency: obj.currency,
22910
- precision: obj.precision
22911
- }), {
22912
- locale: obj.locale
22913
- });
22914
- };
22915
- /**
22916
- * Uses ES5 function notation so `this` can be passed through call, apply and bind
22917
- * @ignore
22918
- */
22919
-
22920
-
22921
- var assertSameCurrency = function assertSameCurrency(comparator) {
22922
- assert(this.hasSameCurrency(comparator), 'You must provide a Dinero instance with the same currency.', TypeError);
22923
- };
22924
-
22925
- return {
22926
- /**
22927
- * Returns the amount.
22928
- *
22929
- * @example
22930
- * // returns 500
22931
- * Dinero({ amount: 500 }).getAmount()
22932
- *
22933
- * @return {Number}
22934
- */
22935
- getAmount: function getAmount() {
22936
- return amount;
22937
- },
22938
-
22939
- /**
22940
- * Returns the currency.
22941
- *
22942
- * @example
22943
- * // returns 'EUR'
22944
- * Dinero({ currency: 'EUR' }).getCurrency()
22945
- *
22946
- * @return {String}
22947
- */
22948
- getCurrency: function getCurrency() {
22949
- return currency;
22950
- },
22951
-
22952
- /**
22953
- * Returns the locale.
22954
- *
22955
- * @example
22956
- * // returns 'fr-FR'
22957
- * Dinero().setLocale('fr-FR').getLocale()
22958
- *
22959
- * @return {String}
22960
- */
22961
- getLocale: function getLocale() {
22962
- return this.locale || globalLocale;
22963
- },
22964
-
22965
- /**
22966
- * Returns a new Dinero object with an embedded locale.
22967
- *
22968
- * @param {String} newLocale - The new locale as an {@link http://tools.ietf.org/html/rfc5646 BCP 47 language tag}.
22969
- *
22970
- * @example
22971
- * // Returns a Dinero object with locale 'ja-JP'
22972
- * Dinero().setLocale('ja-JP')
22973
- *
22974
- * @return {Dinero}
22975
- */
22976
- setLocale: function setLocale(newLocale) {
22977
- return create.call(this, {
22978
- locale: newLocale
22979
- });
22980
- },
22981
-
22982
- /**
22983
- * Returns the precision.
22984
- *
22985
- * @example
22986
- * // returns 3
22987
- * Dinero({ precision: 3 }).getPrecision()
22988
- *
22989
- * @return {Number}
22990
- */
22991
- getPrecision: function getPrecision() {
22992
- return precision;
22993
- },
22994
-
22995
- /**
22996
- * Returns a new Dinero object with a new precision and a converted amount.
22997
- *
22998
- * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
22999
- * This can be necessary when you need to convert objects to a smaller precision.
23000
- *
23001
- * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent conversions for safer results.
23002
- * You can also specify a different `roundingMode` to better fit your needs.
23003
- *
23004
- * @param {Number} newPrecision - The new precision.
23005
- * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
23006
- *
23007
- * @example
23008
- * // Returns a Dinero object with precision 3 and amount 1000
23009
- * Dinero({ amount: 100, precision: 2 }).convertPrecision(3)
23010
- *
23011
- * @throws {TypeError} If `newPrecision` is invalid.
23012
- *
23013
- * @return {Dinero}
23014
- */
23015
- convertPrecision: function convertPrecision(newPrecision) {
23016
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
23017
- assertInteger(newPrecision);
23018
- var precision = this.getPrecision();
23019
- var isNewPrecisionLarger = newPrecision > precision;
23020
- var operation = isNewPrecisionLarger ? calculator$1.multiply : calculator$1.divide;
23021
- var terms = isNewPrecisionLarger ? [newPrecision, precision] : [precision, newPrecision];
23022
- var factor = Math.pow(10, calculator$1.subtract.apply(calculator$1, terms));
23023
- return create.call(this, {
23024
- amount: calculator$1.round(operation(this.getAmount(), factor), roundingMode),
23025
- precision: newPrecision
23026
- });
23027
- },
23028
-
23029
- /**
23030
- * Returns a new Dinero object that represents the sum of this and an other Dinero object.
23031
- *
23032
- * If Dinero objects have a different `precision`, they will be first converted to the highest.
23033
- *
23034
- * @param {Dinero} addend - The Dinero object to add.
23035
- *
23036
- * @example
23037
- * // returns a Dinero object with amount 600
23038
- * Dinero({ amount: 400 }).add(Dinero({ amount: 200 }))
23039
- * @example
23040
- * // returns a Dinero object with amount 144545 and precision 4
23041
- * Dinero({ amount: 400 }).add(Dinero({ amount: 104545, precision: 4 }))
23042
- *
23043
- * @throws {TypeError} If `addend` has a different currency.
23044
- *
23045
- * @return {Dinero}
23046
- */
23047
- add: function add(addend) {
23048
- assertSameCurrency.call(this, addend);
23049
- var addends = Dinero.normalizePrecision([this, addend]);
23050
- return create.call(this, {
23051
- amount: calculator$1.add(addends[0].getAmount(), addends[1].getAmount()),
23052
- precision: addends[0].getPrecision()
23053
- });
23054
- },
23055
-
23056
- /**
23057
- * Returns a new Dinero object that represents the difference of this and an other Dinero object.
23058
- *
23059
- * If Dinero objects have a different `precision`, they will be first converted to the highest.
23060
- *
23061
- * @param {Dinero} subtrahend - The Dinero object to subtract.
23062
- *
23063
- * @example
23064
- * // returns a Dinero object with amount 200
23065
- * Dinero({ amount: 400 }).subtract(Dinero({ amount: 200 }))
23066
- * @example
23067
- * // returns a Dinero object with amount 64545 and precision 4
23068
- * Dinero({ amount: 104545, precision: 4 }).subtract(Dinero({ amount: 400 }))
23069
- *
23070
- * @throws {TypeError} If `subtrahend` has a different currency.
23071
- *
23072
- * @return {Dinero}
23073
- */
23074
- subtract: function subtract(subtrahend) {
23075
- assertSameCurrency.call(this, subtrahend);
23076
- var subtrahends = Dinero.normalizePrecision([this, subtrahend]);
23077
- return create.call(this, {
23078
- amount: calculator$1.subtract(subtrahends[0].getAmount(), subtrahends[1].getAmount()),
23079
- precision: subtrahends[0].getPrecision()
23080
- });
23081
- },
23082
-
23083
- /**
23084
- * Returns a new Dinero object that represents the multiplied value by the given factor.
23085
- *
23086
- * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
23087
- *
23088
- * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
23089
- * You can also specify a different `roundingMode` to better fit your needs.
23090
- *
23091
- * @param {Number} multiplier - The factor to multiply by.
23092
- * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
23093
- *
23094
- * @example
23095
- * // returns a Dinero object with amount 1600
23096
- * Dinero({ amount: 400 }).multiply(4)
23097
- * @example
23098
- * // returns a Dinero object with amount 800
23099
- * Dinero({ amount: 400 }).multiply(2.001)
23100
- * @example
23101
- * // returns a Dinero object with amount 801
23102
- * Dinero({ amount: 400 }).multiply(2.00125, 'HALF_UP')
23103
- *
23104
- * @return {Dinero}
23105
- */
23106
- multiply: function multiply(multiplier) {
23107
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
23108
- return create.call(this, {
23109
- amount: calculator$1.round(calculator$1.multiply(this.getAmount(), multiplier), roundingMode)
23110
- });
23111
- },
23112
-
23113
- /**
23114
- * Returns a new Dinero object that represents the divided value by the given factor.
23115
- *
23116
- * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
23117
- *
23118
- * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
23119
- * You can also specify a different `roundingMode` to better fit your needs.
23120
- *
23121
- * As rounding is applied, precision may be lost in the process. If you want to accurately split a Dinero object, use {@link module:Dinero~allocate allocate} instead.
23122
- *
23123
- * @param {Number} divisor - The factor to divide by.
23124
- * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
23125
- *
23126
- * @example
23127
- * // returns a Dinero object with amount 100
23128
- * Dinero({ amount: 400 }).divide(4)
23129
- * @example
23130
- * // returns a Dinero object with amount 52
23131
- * Dinero({ amount: 105 }).divide(2)
23132
- * @example
23133
- * // returns a Dinero object with amount 53
23134
- * Dinero({ amount: 105 }).divide(2, 'HALF_UP')
23135
- *
23136
- * @return {Dinero}
23137
- */
23138
- divide: function divide(divisor) {
23139
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
23140
- return create.call(this, {
23141
- amount: calculator$1.round(calculator$1.divide(this.getAmount(), divisor), roundingMode)
23142
- });
23143
- },
23144
-
23145
- /**
23146
- * Returns a new Dinero object that represents a percentage of this.
23147
- *
23148
- * As rounding is applied, precision may be lost in the process. If you want to accurately split a Dinero object, use {@link module:Dinero~allocate allocate} instead.
23149
- *
23150
- * @param {Number} percentage - The percentage to extract (between 0 and 100).
23151
- * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
23152
- *
23153
- * @example
23154
- * // returns a Dinero object with amount 5000
23155
- * Dinero({ amount: 10000 }).percentage(50)
23156
- * @example
23157
- * // returns a Dinero object with amount 29
23158
- * Dinero({ amount: 57 }).percentage(50, "HALF_ODD")
23159
- *
23160
- * @throws {RangeError} If `percentage` is out of range.
23161
- *
23162
- * @return {Dinero}
23163
- */
23164
- percentage: function percentage(_percentage) {
23165
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
23166
- assertPercentage(_percentage);
23167
- return this.multiply(calculator$1.divide(_percentage, 100), roundingMode);
23168
- },
23169
-
23170
- /**
23171
- * Allocates the amount of a Dinero object according to a list of ratios.
23172
- *
23173
- * Sometimes you need to split monetary values but percentages can't cut it without adding or losing pennies.
23174
- * A good example is invoicing: let's say you need to bill $1,000.03 and you want a 50% downpayment.
23175
- * If you use {@link module:Dinero~percentage percentage}, you'll get an accurate Dinero object but the amount won't be billable: you can't split a penny.
23176
- * If you round it, you'll bill a penny extra.
23177
- * With {@link module:Dinero~allocate allocate}, you can split a monetary amount then distribute the remainder as evenly as possible.
23178
- *
23179
- * You can use percentage style or ratio style for `ratios`: `[25, 75]` and `[1, 3]` will do the same thing.
23180
- *
23181
- * Since v1.8.0, you can use zero ratios (such as [0, 50, 50]). If there's a remainder to distribute, zero ratios are skipped and return a Dinero object with amount zero.
23182
- *
23183
- * @param {Number[]} ratios - The ratios to allocate the money to.
23184
- *
23185
- * @example
23186
- * // returns an array of two Dinero objects
23187
- * // the first one with an amount of 502
23188
- * // the second one with an amount of 501
23189
- * Dinero({ amount: 1003 }).allocate([50, 50])
23190
- * @example
23191
- * // returns an array of two Dinero objects
23192
- * // the first one with an amount of 25
23193
- * // the second one with an amount of 75
23194
- * Dinero({ amount: 100 }).allocate([1, 3])
23195
- * @example
23196
- * // since version 1.8.0
23197
- * // returns an array of three Dinero objects
23198
- * // the first one with an amount of 0
23199
- * // the second one with an amount of 502
23200
- * // the third one with an amount of 501
23201
- * Dinero({ amount: 1003 }).allocate([0, 50, 50])
23202
- *
23203
- * @throws {TypeError} If ratios are invalid.
23204
- *
23205
- * @return {Dinero[]}
23206
- */
23207
- allocate: function allocate(ratios) {
23208
- var _this = this;
23209
-
23210
- assertValidRatios(ratios);
23211
- var total = ratios.reduce(function (a, b) {
23212
- return calculator$1.add(a, b);
23213
- });
23214
- var remainder = this.getAmount();
23215
- var shares = ratios.map(function (ratio) {
23216
- var share = Math.floor(calculator$1.divide(calculator$1.multiply(_this.getAmount(), ratio), total));
23217
- remainder = calculator$1.subtract(remainder, share);
23218
- return create.call(_this, {
23219
- amount: share
23220
- });
23221
- });
23222
- var i = 0;
23223
-
23224
- while (remainder > 0) {
23225
- if (ratios[i] > 0) {
23226
- shares[i] = shares[i].add(create.call(this, {
23227
- amount: 1
23228
- }));
23229
- remainder = calculator$1.subtract(remainder, 1);
23230
- }
23231
-
23232
- i += 1;
23233
- }
23234
-
23235
- return shares;
23236
- },
23237
-
23238
- /**
23239
- * Returns a Promise containing a new Dinero object converted to another currency.
23240
- *
23241
- * You have two options to provide the exchange rates:
23242
- *
23243
- * 1. **Use an exchange rate REST API, and let Dinero handle the fetching and conversion.**
23244
- * This is a simple option if you have access to an exchange rate REST API and want Dinero to do the rest.
23245
- * 2. **Fetch the exchange rates on your own and provide them directly.**
23246
- * This is useful if you're fetching your rates from somewhere else (a file, a database), use a different protocol or query language than REST (SOAP, GraphQL) or want to fetch rates once and cache them instead of making new requests every time.
23247
- *
23248
- * **If you want to use a REST API**, you must provide a third-party endpoint yourself. Dinero doesn't come bundled with an exchange rates endpoint.
23249
- *
23250
- * Here are some exchange rate APIs you can use:
23251
- *
23252
- * * [Fixer](https://fixer.io)
23253
- * * [Open Exchange Rates](https://openexchangerates.org)
23254
- * * [Coinbase](https://api.coinbase.com/v2/exchange-rates)
23255
- * * More [foreign](https://github.com/toddmotto/public-apis#currency-exchange) and [crypto](https://github.com/toddmotto/public-apis#cryptocurrency) exchange rate APIs.
23256
- *
23257
- * **If you want to fetch your own rates and provide them directly**, you need to pass a promise that resolves to the exchanges rates.
23258
- *
23259
- * In both cases, you need to specify at least:
23260
- *
23261
- * * a **destination currency**: the currency in which you want to convert your Dinero object. You can specify it with `currency`.
23262
- * * an **endpoint**: the API URL to query exchange rates, with parameters, or a promise that resolves to the exchange rates. You can specify it with `options.endpoint`.
23263
- * * a **property path**: the path to access the wanted rate in your API's JSON response (or the custom promise's payload). For example, with a response of:
23264
- * ```json
23265
- * {
23266
- * "data": {
23267
- * "base": "USD",
23268
- * "destination": "EUR",
23269
- * "rate": "0.827728919"
23270
- * }
23271
- * }
23272
- * ```
23273
- * Then the property path is `'data.rate'`. You can specify it with `options.propertyPath`.
23274
- *
23275
- * The base currency (the one of your Dinero object) and the destination currency can be used as "merge tags" with the mustache syntax, respectively `{{from}}` and `{{to}}`.
23276
- * You can use these tags to refer to these values in `options.endpoint` and `options.propertyPath`.
23277
- *
23278
- * For example, if you need to specify the base currency as a query parameter, you can do the following:
23279
- *
23280
- * ```js
23281
- * {
23282
- * endpoint: 'https://yourexchangerates.api/latest?base={{from}}'
23283
- * }
23284
- * ```
23285
- *
23286
- * @param {String} currency - The destination currency, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.
23287
- * @param {(String|Promise)} options.endpoint - The API endpoint to retrieve exchange rates. You can substitute this with a promise that resolves to the exchanges rates if you already have them.
23288
- * @param {String} [options.propertyPath='rates.{{to}}'] - The property path to the rate.
23289
- * @param {Object} [options.headers] - The HTTP headers to provide, if needed.
23290
- * @param {String} [options.roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
23291
- *
23292
- * @example
23293
- * // your global API parameters
23294
- * Dinero.globalExchangeRatesApi = { ... }
23295
- *
23296
- * // returns a Promise containing a Dinero object with the destination currency
23297
- * // and the initial amount converted to the new currency.
23298
- * Dinero({ amount: 500 }).convert('EUR')
23299
- * @example
23300
- * // returns a Promise containing a Dinero object,
23301
- * // with specific API parameters and rounding mode for this specific instance.
23302
- * Dinero({ amount: 500 })
23303
- * .convert('XBT', {
23304
- * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',
23305
- * propertyPath: 'data.rates.{{to}}',
23306
- * headers: {
23307
- * 'user-key': 'xxxxxxxxx'
23308
- * },
23309
- * roundingMode: 'HALF_UP'
23310
- * })
23311
- * @example
23312
- * // usage with exchange rates provided as a custom promise
23313
- * // using the default `propertyPath` format (so it doesn't have to be specified)
23314
- * const rates = {
23315
- * rates: {
23316
- * EUR: 0.81162
23317
- * }
23318
- * }
23319
- *
23320
- * Dinero({ amount: 500 })
23321
- * .convert('EUR', {
23322
- * endpoint: new Promise(resolve => resolve(rates))
23323
- * })
23324
- * @example
23325
- * // usage with Promise.prototype.then and Promise.prototype.catch
23326
- * Dinero({ amount: 500 })
23327
- * .convert('EUR')
23328
- * .then(dinero => {
23329
- * dinero.getCurrency() // returns 'EUR'
23330
- * })
23331
- * .catch(err => {
23332
- * // handle errors
23333
- * })
23334
- * @example
23335
- * // usage with async/await
23336
- * (async () => {
23337
- * const price = await Dinero({ amount: 500 }).convert('EUR')
23338
- * price.getCurrency() // returns 'EUR'
23339
- * })()
23340
- *
23341
- * @return {Promise}
23342
- */
23343
- convert: function convert(currency) {
23344
- var _this2 = this;
23345
-
23346
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
23347
- _ref$endpoint = _ref.endpoint,
23348
- endpoint = _ref$endpoint === void 0 ? globalExchangeRatesApi.endpoint : _ref$endpoint,
23349
- _ref$propertyPath = _ref.propertyPath,
23350
- propertyPath = _ref$propertyPath === void 0 ? globalExchangeRatesApi.propertyPath || 'rates.{{to}}' : _ref$propertyPath,
23351
- _ref$headers = _ref.headers,
23352
- headers = _ref$headers === void 0 ? globalExchangeRatesApi.headers : _ref$headers,
23353
- _ref$roundingMode = _ref.roundingMode,
23354
- roundingMode = _ref$roundingMode === void 0 ? globalRoundingMode : _ref$roundingMode;
23355
-
23356
- var options = Object.assign({}, {
23357
- endpoint: endpoint,
23358
- propertyPath: propertyPath,
23359
- headers: headers,
23360
- roundingMode: roundingMode
23361
- });
23362
- return CurrencyConverter(options).getExchangeRate(this.getCurrency(), currency).then(function (rate) {
23363
- assert(!isUndefined(rate), "No rate was found for the destination currency \"".concat(currency, "\"."), TypeError);
23364
- return create.call(_this2, {
23365
- amount: calculator$1.round(calculator$1.multiply(_this2.getAmount(), parseFloat(rate)), options.roundingMode),
23366
- currency: currency
23367
- });
23368
- });
23369
- },
23370
-
23371
- /**
23372
- * Checks whether the value represented by this object equals to the other.
23373
- *
23374
- * @param {Dinero} comparator - The Dinero object to compare to.
23375
- *
23376
- * @example
23377
- * // returns true
23378
- * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))
23379
- * @example
23380
- * // returns false
23381
- * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))
23382
- * @example
23383
- * // returns false
23384
- * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))
23385
- * @example
23386
- * // returns false
23387
- * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))
23388
- * @example
23389
- * // returns true
23390
- * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))
23391
- * @example
23392
- * // returns false
23393
- * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))
23394
- *
23395
- * @return {Boolean}
23396
- */
23397
- equalsTo: function equalsTo(comparator) {
23398
- return this.hasSameAmount(comparator) && this.hasSameCurrency(comparator);
23399
- },
23400
-
23401
- /**
23402
- * Checks whether the value represented by this object is less than the other.
23403
- *
23404
- * @param {Dinero} comparator - The Dinero object to compare to.
23405
- *
23406
- * @example
23407
- * // returns true
23408
- * Dinero({ amount: 500 }).lessThan(Dinero({ amount: 800 }))
23409
- * @example
23410
- * // returns false
23411
- * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 500 }))
23412
- * @example
23413
- * // returns true
23414
- * Dinero({ amount: 5000, precision: 3 }).lessThan(Dinero({ amount: 800 }))
23415
- * @example
23416
- * // returns false
23417
- * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 5000, precision: 3 }))
23418
- *
23419
- * @throws {TypeError} If `comparator` has a different currency.
23420
- *
23421
- * @return {Boolean}
23422
- */
23423
- lessThan: function lessThan(comparator) {
23424
- assertSameCurrency.call(this, comparator);
23425
- var comparators = Dinero.normalizePrecision([this, comparator]);
23426
- return comparators[0].getAmount() < comparators[1].getAmount();
23427
- },
23428
-
23429
- /**
23430
- * Checks whether the value represented by this object is less than or equal to the other.
23431
- *
23432
- * @param {Dinero} comparator - The Dinero object to compare to.
23433
- *
23434
- * @example
23435
- * // returns true
23436
- * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 800 }))
23437
- * @example
23438
- * // returns true
23439
- * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 500 }))
23440
- * @example
23441
- * // returns false
23442
- * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 300 }))
23443
- * @example
23444
- * // returns true
23445
- * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 800 }))
23446
- * @example
23447
- * // returns true
23448
- * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 500 }))
23449
- * @example
23450
- * // returns false
23451
- * Dinero({ amount: 800 }).lessThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
23452
- *
23453
- * @throws {TypeError} If `comparator` has a different currency.
23454
- *
23455
- * @return {Boolean}
23456
- */
23457
- lessThanOrEqual: function lessThanOrEqual(comparator) {
23458
- assertSameCurrency.call(this, comparator);
23459
- var comparators = Dinero.normalizePrecision([this, comparator]);
23460
- return comparators[0].getAmount() <= comparators[1].getAmount();
23461
- },
23462
-
23463
- /**
23464
- * Checks whether the value represented by this object is greater than the other.
23465
- *
23466
- * @param {Dinero} comparator - The Dinero object to compare to.
23467
- *
23468
- * @example
23469
- * // returns false
23470
- * Dinero({ amount: 500 }).greaterThan(Dinero({ amount: 800 }))
23471
- * @example
23472
- * // returns true
23473
- * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 500 }))
23474
- * @example
23475
- * // returns true
23476
- * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 5000, precision: 3 }))
23477
- * @example
23478
- * // returns false
23479
- * Dinero({ amount: 5000, precision: 3 }).greaterThan(Dinero({ amount: 800 }))
23480
- *
23481
- * @throws {TypeError} If `comparator` has a different currency.
23482
- *
23483
- * @return {Boolean}
23484
- */
23485
- greaterThan: function greaterThan(comparator) {
23486
- assertSameCurrency.call(this, comparator);
23487
- var comparators = Dinero.normalizePrecision([this, comparator]);
23488
- return comparators[0].getAmount() > comparators[1].getAmount();
23489
- },
23490
-
23491
- /**
23492
- * Checks whether the value represented by this object is greater than or equal to the other.
23493
- *
23494
- * @param {Dinero} comparator - The Dinero object to compare to.
23495
- *
23496
- * @example
23497
- * // returns true
23498
- * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 300 }))
23499
- * @example
23500
- * // returns true
23501
- * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 500 }))
23502
- * @example
23503
- * // returns false
23504
- * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 800 }))
23505
- * @example
23506
- * // returns true
23507
- * Dinero({ amount: 800 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
23508
- * @example
23509
- * // returns true
23510
- * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
23511
- * @example
23512
- * // returns false
23513
- * Dinero({ amount: 5000, precision: 3 }).greaterThanOrEqual(Dinero({ amount: 800 }))
23514
- *
23515
- * @throws {TypeError} If `comparator` has a different currency.
23516
- *
23517
- * @return {Boolean}
23518
- */
23519
- greaterThanOrEqual: function greaterThanOrEqual(comparator) {
23520
- assertSameCurrency.call(this, comparator);
23521
- var comparators = Dinero.normalizePrecision([this, comparator]);
23522
- return comparators[0].getAmount() >= comparators[1].getAmount();
23523
- },
23524
-
23525
- /**
23526
- * Checks if the value represented by this object is zero.
23527
- *
23528
- * @example
23529
- * // returns true
23530
- * Dinero({ amount: 0 }).isZero()
23531
- * @example
23532
- * // returns false
23533
- * Dinero({ amount: 100 }).isZero()
23534
- *
23535
- * @return {Boolean}
23536
- */
23537
- isZero: function isZero() {
23538
- return this.getAmount() === 0;
23539
- },
23540
-
23541
- /**
23542
- * Checks if the value represented by this object is positive.
23543
- *
23544
- * @example
23545
- * // returns false
23546
- * Dinero({ amount: -10 }).isPositive()
23547
- * @example
23548
- * // returns true
23549
- * Dinero({ amount: 10 }).isPositive()
23550
- * @example
23551
- * // returns true
23552
- * Dinero({ amount: 0 }).isPositive()
23553
- *
23554
- * @return {Boolean}
23555
- */
23556
- isPositive: function isPositive() {
23557
- return this.getAmount() >= 0;
23558
- },
23559
-
23560
- /**
23561
- * Checks if the value represented by this object is negative.
23562
- *
23563
- * @example
23564
- * // returns true
23565
- * Dinero({ amount: -10 }).isNegative()
23566
- * @example
23567
- * // returns false
23568
- * Dinero({ amount: 10 }).isNegative()
23569
- * @example
23570
- * // returns false
23571
- * Dinero({ amount: 0 }).isNegative()
23572
- *
23573
- * @return {Boolean}
23574
- */
23575
- isNegative: function isNegative() {
23576
- return this.getAmount() < 0;
23577
- },
23578
-
23579
- /**
23580
- * Checks if this has minor currency units.
23581
- * Deprecates {@link module:Dinero~hasCents hasCents}.
23582
- *
23583
- * @example
23584
- * // returns false
23585
- * Dinero({ amount: 1100 }).hasSubUnits()
23586
- * @example
23587
- * // returns true
23588
- * Dinero({ amount: 1150 }).hasSubUnits()
23589
- *
23590
- * @return {Boolean}
23591
- */
23592
- hasSubUnits: function hasSubUnits() {
23593
- return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;
23594
- },
23595
-
23596
- /**
23597
- * Checks if this has minor currency units.
23598
- *
23599
- * @deprecated since version 1.4.0, will be removed in 2.0.0
23600
- * Use {@link module:Dinero~hasSubUnits hasSubUnits} instead.
23601
- *
23602
- * @example
23603
- * // returns false
23604
- * Dinero({ amount: 1100 }).hasCents()
23605
- * @example
23606
- * // returns true
23607
- * Dinero({ amount: 1150 }).hasCents()
23608
- *
23609
- * @return {Boolean}
23610
- */
23611
- hasCents: function hasCents() {
23612
- return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;
23613
- },
23614
-
23615
- /**
23616
- * Checks whether the currency represented by this object equals to the other.
23617
- *
23618
- * @param {Dinero} comparator - The Dinero object to compare to.
23619
- *
23620
- * @example
23621
- * // returns true
23622
- * Dinero({ amount: 2000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'EUR' }))
23623
- * @example
23624
- * // returns false
23625
- * Dinero({ amount: 1000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'USD' }))
23626
- *
23627
- * @return {Boolean}
23628
- */
23629
- hasSameCurrency: function hasSameCurrency(comparator) {
23630
- return this.getCurrency() === comparator.getCurrency();
23631
- },
23632
-
23633
- /**
23634
- * Checks whether the amount represented by this object equals to the other.
23635
- *
23636
- * @param {Dinero} comparator - The Dinero object to compare to.
23637
- *
23638
- * @example
23639
- * // returns true
23640
- * Dinero({ amount: 1000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000 }))
23641
- * @example
23642
- * // returns false
23643
- * Dinero({ amount: 2000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000, currency: 'EUR' }))
23644
- * @example
23645
- * // returns true
23646
- * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))
23647
- * @example
23648
- * // returns false
23649
- * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))
23650
- *
23651
- * @return {Boolean}
23652
- */
23653
- hasSameAmount: function hasSameAmount(comparator) {
23654
- var comparators = Dinero.normalizePrecision([this, comparator]);
23655
- return comparators[0].getAmount() === comparators[1].getAmount();
23656
- },
23657
-
23658
- /**
23659
- * Returns this object formatted as a string.
23660
- *
23661
- * The format is a mask which defines how the output string will be formatted.
23662
- * It defines whether to display a currency, in what format, how many fraction digits to display and whether to use grouping separators.
23663
- * The output is formatted according to the applying locale.
23664
- *
23665
- * Object | Format | String
23666
- * :--------------------------- | :---------------- | :---
23667
- * `Dinero({ amount: 500050 })` | `'$0,0.00'` | $5,000.50
23668
- * `Dinero({ amount: 500050 })` | `'$0,0'` | $5,001
23669
- * `Dinero({ amount: 500050 })` | `'$0'` | $5001
23670
- * `Dinero({ amount: 500050 })` | `'$0.0'` | $5000.5
23671
- * `Dinero({ amount: 500050 })` | `'USD0,0.0'` | USD5,000.5
23672
- * `Dinero({ amount: 500050 })` | `'0,0.0 dollar'` | 5,000.5 dollars
23673
- *
23674
- * Don't try to substitute the `$` sign or the `USD` code with your target currency, nor adapt the format string to the exact format you want.
23675
- * The format is a mask which defines a pattern and returns a valid, localized currency string.
23676
- * If you want to display the object in a custom way, either use {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~toUnit toUnit} or {@link module:Dinero~toRoundedUnit toRoundedUnit} and manipulate the output string as you wish.
23677
- *
23678
- * {@link module:Dinero~toFormat toFormat} wraps around `Number.prototype.toLocaleString`. For that reason, **format will vary depending on how it's implemented in the end user's environment**.
23679
- *
23680
- * You can also use `toLocaleString` directly:
23681
- * `Dinero().toRoundedUnit(digits, roundingMode).toLocaleString(locale, options)`.
23682
- *
23683
- * By default, amounts are rounded using the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).
23684
- * You can also specify a different `roundingMode` to better fit your needs.
23685
- *
23686
- * @param {String} [format='$0,0.00'] - The format mask to format to.
23687
- * @param {String} [roundingMode='HALF_AWAY_FROM_ZERO'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
23688
- *
23689
- * @example
23690
- * // returns $2,000
23691
- * Dinero({ amount: 200000 }).toFormat('$0,0')
23692
- * @example
23693
- * // returns €50.5
23694
- * Dinero({ amount: 5050, currency: 'EUR' }).toFormat('$0,0.0')
23695
- * @example
23696
- * // returns 100 euros
23697
- * Dinero({ amount: 10000, currency: 'EUR' }).setLocale('fr-FR').toFormat('0,0 dollar')
23698
- * @example
23699
- * // returns 2000
23700
- * Dinero({ amount: 200000, currency: 'EUR' }).toFormat()
23701
- * @example
23702
- * // returns $10
23703
- * Dinero({ amount: 1050 }).toFormat('$0', 'HALF_EVEN')
23704
- *
23705
- * @return {String}
23706
- */
23707
- toFormat: function toFormat() {
23708
- var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalFormat;
23709
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
23710
- var formatter = Format(format);
23711
- return this.toRoundedUnit(formatter.getMinimumFractionDigits(), roundingMode).toLocaleString(this.getLocale(), {
23712
- currencyDisplay: formatter.getCurrencyDisplay(),
23713
- useGrouping: formatter.getUseGrouping(),
23714
- minimumFractionDigits: formatter.getMinimumFractionDigits(),
23715
- style: formatter.getStyle(),
23716
- currency: this.getCurrency()
23717
- });
23718
- },
23719
-
23720
- /**
23721
- * Returns the amount represented by this object in units.
23722
- *
23723
- * @example
23724
- * // returns 10.5
23725
- * Dinero({ amount: 1050 }).toUnit()
23726
- * @example
23727
- * // returns 10.545
23728
- * Dinero({ amount: 10545, precision: 3 }).toUnit()
23729
- *
23730
- * @return {Number}
23731
- */
23732
- toUnit: function toUnit() {
23733
- return calculator$1.divide(this.getAmount(), Math.pow(10, precision));
23734
- },
23735
-
23736
- /**
23737
- * Returns the amount represented by this object in rounded units.
23738
- *
23739
- * By default, the method uses the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).
23740
- * You can also specify a different `roundingMode` to better fit your needs.
23741
- *
23742
- * @example
23743
- * // returns 10.6
23744
- * Dinero({ amount: 1055 }).toRoundedUnit(1)
23745
- * @example
23746
- * // returns 10
23747
- * Dinero({ amount: 1050 }).toRoundedUnit(0, 'HALF_EVEN')
23748
- *
23749
- * @param {Number} digits - The number of fraction digits to round to.
23750
- * @param {String} [roundingMode='HALF_AWAY_FROM_ZERO'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.
23751
- *
23752
- * @return {Number}
23753
- */
23754
- toRoundedUnit: function toRoundedUnit(digits) {
23755
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
23756
- var factor = Math.pow(10, digits);
23757
- return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);
23758
- },
23759
-
23760
- /**
23761
- * Returns the object's data as an object literal.
23762
- *
23763
- * @example
23764
- * // returns { amount: 500, currency: 'EUR', precision: 2 }
23765
- * Dinero({ amount: 500, currency: 'EUR', precision: 2 }).toObject()
23766
- *
23767
- * @return {Object}
23768
- */
23769
- toObject: function toObject() {
23770
- return {
23771
- amount: amount,
23772
- currency: currency,
23773
- precision: precision
23774
- };
23775
- },
23776
-
23777
- /**
23778
- * Returns the object's data as an object literal.
23779
- *
23780
- * Alias of {@link module:Dinero~toObject toObject}.
23781
- * It is defined so that calling `JSON.stringify` on a Dinero object will automatically extract the relevant data.
23782
- *
23783
- * @example
23784
- * // returns '{"amount":500,"currency":"EUR","precision":2}'
23785
- * JSON.stringify(Dinero({ amount: 500, currency: 'EUR', precision: 2 }))
23786
- *
23787
- * @return {Object}
23788
- */
23789
- toJSON: function toJSON() {
23790
- return this.toObject();
23791
- }
23792
- };
23793
- };
23794
-
23795
- var dinero = Object.assign(Dinero, Defaults, Globals, Static);
23796
-
23797
22145
  // Currency Formatting
23798
22146
  const formatCurrency = (amount, currency, omitSymbols = false) => {
23799
22147
  if (!amount)
23800
22148
  amount = 0;
23801
22149
  const formattedString = omitSymbols ? '0,0.00' : '$0,0.00';
23802
22150
  const formattedCurrency = currency === null || currency === void 0 ? void 0 : currency.toUpperCase();
23803
- const formattedAmount = dinero({ amount: amount }).toFormat(formattedString);
22151
+ const formattedAmount = dinero.dinero({ amount: amount }).toFormat(formattedString);
23804
22152
  return currency ? `${formattedAmount} ${formattedCurrency}` : formattedAmount;
23805
22153
  };
23806
22154
  // Date Formatting and Conversion
@@ -23898,11 +22246,6 @@ function snakeCaseToHumanReadable(snakeCaseStr) {
23898
22246
  .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
23899
22247
  .join(' ');
23900
22248
  }
23901
- function snakeToCamel(str) {
23902
- if (!str)
23903
- return '';
23904
- return str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', '').replace('_', ''));
23905
- }
23906
22249
  // Object Utilities
23907
22250
  function isEmptyObject(obj) {
23908
22251
  if (obj === null) {
@@ -23971,4 +22314,3 @@ exports.isEmptyObject = isEmptyObject;
23971
22314
  exports.processHTML = processHTML;
23972
22315
  exports.removeAttribute = removeAttribute;
23973
22316
  exports.snakeCaseToHumanReadable = snakeCaseToHumanReadable;
23974
- exports.snakeToCamel = snakeToCamel;