@justifi/webcomponents 5.7.6-rc-02 → 5.7.6-rc-04

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 (661) hide show
  1. package/dist/cjs/{Api-c8NBCwu4.js → Api-eP0XeJLd.js} +1 -1
  2. package/dist/cjs/{ComponentError-CEv9ltwy.js → ComponentError-D4OLnOkg.js} +8 -0
  3. package/dist/cjs/{Refund-Dt1CMUjx.js → Refund-08OcZkXX.js} +148 -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 -8
  6. package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
  7. package/dist/cjs/{business.service-W2PRAU9J.js → business.service--Zv-Xtu4.js} +3 -4
  8. package/dist/cjs/card-form.cjs.entry.js +2 -2
  9. package/dist/cjs/{check-pkg-version-DmONJMn1.js → check-pkg-version-Bp51QhAR.js} +4 -5
  10. package/dist/cjs/{checkout.service-XwOh98gt.js → checkout.service-BBD6v0cl.js} +3 -4
  11. package/dist/cjs/{checkout.store--pVCO0L1.js → checkout.store-B58bewb_.js} +2 -1
  12. package/dist/cjs/checkouts-list-core.cjs.entry.js +6 -6
  13. package/dist/cjs/{checkouts-table-CrpOOe_e.js → checkouts-table-Cp7rNkNd.js} +1 -1
  14. package/dist/cjs/custom-popper.cjs.entry.js +2 -2
  15. package/dist/cjs/dinero-J-SRFKIR.js +1673 -0
  16. package/dist/cjs/{dispute.service-Dh82Wru1.js → dispute.service-BHApwZdH.js} +3 -4
  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 +4 -4
  27. package/dist/cjs/{get-business-BiEc-jdH.js → get-business-o5jPq_ME.js} +2 -2
  28. package/dist/cjs/{get-payment-details-W4PgTPkL.js → get-payment-details-7PreAOdF.js} +5 -6
  29. package/dist/cjs/{get-payout-csv-CdNRRH0t.js → get-payout-csv-DE_D9y08.js} +2 -2
  30. package/dist/cjs/{get-subaccounts-D4woaGSs.js → get-subaccounts-CtelAONX.js} +5 -6
  31. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +3 -2
  32. package/dist/cjs/header-2-BXQLJn1q.js +10 -0
  33. package/dist/cjs/hidden-input_2.cjs.entry.js +5 -5
  34. package/dist/cjs/insurance-state-B3CYpJWi.js +45 -0
  35. package/dist/cjs/justifi-additional-questions-form-step-core_6.cjs.entry.js +4 -4
  36. package/dist/cjs/justifi-additional-questions-form-step_9.cjs.entry.js +17 -17
  37. package/dist/cjs/justifi-additional-statement_8.cjs.entry.js +8 -8
  38. package/dist/cjs/{justifi-bank-account-form_5.cjs.entry.js → justifi-bank-account-form_7.cjs.entry.js} +66 -23
  39. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +52 -0
  40. package/dist/cjs/justifi-business-details.cjs.entry.js +11 -11
  41. package/dist/cjs/justifi-business-form.cjs.entry.js +10 -10
  42. package/dist/cjs/justifi-business-representative-form-inputs.cjs.entry.js +1 -1
  43. package/dist/cjs/{justifi-button_5.cjs.entry.js → justifi-checkout-summary_5.cjs.entry.js} +162 -56
  44. package/dist/cjs/justifi-checkout.cjs.entry.js +14 -14
  45. package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +5 -5
  46. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +12 -12
  47. package/dist/cjs/justifi-dispute-management-core.cjs.entry.js +1 -1
  48. package/dist/cjs/justifi-dispute-management.cjs.entry.js +10 -10
  49. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +13 -13
  50. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +8 -8
  51. package/dist/cjs/justifi-order-terminals.cjs.entry.js +12 -12
  52. package/dist/cjs/justifi-owner-form_3.cjs.entry.js +12 -12
  53. package/dist/cjs/justifi-payment-details.cjs.entry.js +11 -11
  54. package/dist/cjs/justifi-payment-provisioning-core.cjs.entry.js +2 -2
  55. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +11 -11
  56. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +10 -10
  57. package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +4 -3
  58. package/dist/cjs/justifi-payments-list.cjs.entry.js +12 -12
  59. package/dist/cjs/justifi-payout-details.cjs.entry.js +10 -10
  60. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +10 -10
  61. package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +4 -3
  62. package/dist/cjs/justifi-payouts-list.cjs.entry.js +13 -13
  63. package/dist/cjs/justifi-refund-payment.cjs.entry.js +10 -10
  64. package/dist/cjs/justifi-saved-payment-method.cjs.entry.js +3 -3
  65. package/dist/cjs/justifi-season-interruption-insurance-core.cjs.entry.js +5 -3
  66. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +10 -10
  67. package/dist/cjs/justifi-skeleton.cjs.entry.js +1 -1
  68. package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +6 -6
  69. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +10 -10
  70. package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +5 -5
  71. package/dist/cjs/justifi-terminals-list.cjs.entry.js +12 -12
  72. package/dist/cjs/justifi-tokenize-payment-method.cjs.entry.js +216 -34
  73. package/dist/cjs/loader.cjs.js +1 -1
  74. package/dist/cjs/{package-oywezDpy.js → package-BMSb1ui9.js} +1 -1
  75. package/dist/cjs/payment-details-core.cjs.entry.js +10 -9
  76. package/dist/cjs/{payment-method-option-utils-imuSE7KV.js → payment-method-option-utils-QODgEWhU.js} +1 -11
  77. package/dist/cjs/{payment-provisioning-actions-SNMCdsyF.js → payment-provisioning-actions-CZVlnRA0.js} +2 -2
  78. package/dist/cjs/{payment.service-BrvtS3F7.js → payment.service-C9qxqaJk.js} +3 -4
  79. package/dist/cjs/payments-list-core.cjs.entry.js +6 -6
  80. package/dist/cjs/{payments-table-BqxFc71K.js → payments-table-DaW6SvdL.js} +1 -1
  81. package/dist/cjs/payout-details-core.cjs.entry.js +5 -4
  82. package/dist/cjs/{payout.service-DNH6gRrP.js → payout.service-DiSYeR_q.js} +3 -4
  83. package/dist/cjs/payouts-list-core.cjs.entry.js +6 -6
  84. package/dist/cjs/{payouts-table-iT2IauEa.js → payouts-table-D5hMHcaY.js} +1 -1
  85. package/dist/cjs/table-filters-menu.cjs.entry.js +1 -1
  86. package/dist/cjs/terminal-orders-list-core.cjs.entry.js +6 -6
  87. package/dist/cjs/{terminal-orders-table-xi_a-EnM.js → terminal-orders-table-DnZjcbSQ.js} +3 -4
  88. package/dist/cjs/terminal-quantity-selector.cjs.entry.js +1 -1
  89. package/dist/cjs/{terminal.service-CdzmTRQE.js → terminal.service-DEIY9toR.js} +3 -4
  90. package/dist/cjs/terminals-list-core.cjs.entry.js +6 -6
  91. package/dist/cjs/{terminals-table-sf-s5v6D.js → terminals-table-DOqVeHM1.js} +1 -1
  92. package/dist/cjs/{utils-qOon0GWm.js → utils-DqlrBltg.js} +2 -1676
  93. package/dist/cjs/{utils-IGCnjtqc.js → utils-DvUQQLmR.js} +1 -1
  94. package/dist/cjs/webcomponents.cjs.js +1 -1
  95. package/dist/collection/actions/checkout/checkout-actions.js +2 -1
  96. package/dist/collection/api/ComponentError.js +8 -0
  97. package/dist/collection/collection-manifest.json +7 -8
  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/bank-account-form/bank-account-form.js +2 -2
  122. package/dist/collection/components/checkout/billing-form/billing-form.js +13 -37
  123. package/dist/collection/components/checkout/card-form/card-form.js +2 -2
  124. package/dist/collection/components/checkout/checkout.js +1 -1
  125. package/dist/collection/components/checkout/payment-method-option-utils.js +0 -1
  126. package/dist/collection/components/checkout/save-new-payment-method.js +7 -5
  127. package/dist/collection/components/checkout/saved-payment-method.js +1 -1
  128. package/dist/collection/components/checkouts-list/checkouts-list-core.js +1 -1
  129. package/dist/collection/components/checkouts-list/checkouts-list-filters.js +1 -1
  130. package/dist/collection/components/checkouts-list/checkouts-list.js +1 -1
  131. package/dist/collection/components/dispute-management/dispute-management-core.js +1 -1
  132. package/dist/collection/components/dispute-management/dispute-management.js +1 -1
  133. package/dist/collection/components/dispute-management/dispute-notification.js +1 -1
  134. package/dist/collection/components/dispute-management/dispute-response/additional-statement.js +1 -1
  135. package/dist/collection/components/dispute-management/dispute-response/cancellation-policy.js +1 -1
  136. package/dist/collection/components/dispute-management/dispute-response/customer-details.js +1 -1
  137. package/dist/collection/components/dispute-management/dispute-response/dispute-response-core.js +1 -1
  138. package/dist/collection/components/dispute-management/dispute-response/dispute-response.js +1 -1
  139. package/dist/collection/components/dispute-management/dispute-response/duplicate-charge.js +1 -1
  140. package/dist/collection/components/dispute-management/dispute-response/electronic-evidence.js +1 -1
  141. package/dist/collection/components/dispute-management/dispute-response/product-or-service.js +1 -1
  142. package/dist/collection/components/dispute-management/dispute-response/refund-policy.js +1 -1
  143. package/dist/collection/components/dispute-management/dispute-response/shipping-details.js +1 -1
  144. package/dist/collection/components/filters/table-filters-menu.js +1 -1
  145. package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +1 -1
  146. package/dist/collection/components/insurance/insurance-state.js +18 -1
  147. package/dist/collection/components/insurance/season-interruption/season-interruption-insurance.js +1 -1
  148. package/dist/collection/components/modular-checkout/modular-checkout.js +43 -9
  149. package/dist/collection/components/modular-checkout/sub-components/bank-account.js +2 -2
  150. package/dist/collection/components/modular-checkout/sub-components/billing-information-form.js +36 -5
  151. package/dist/collection/components/modular-checkout/sub-components/card-form.js +2 -2
  152. package/dist/collection/components/modular-checkout/sub-components/payment-method-option.js +1 -1
  153. package/dist/collection/components/modular-checkout/sub-components/postal-code-form.js +5 -4
  154. package/dist/collection/components/modular-checkout/sub-components/summary.js +1 -1
  155. package/dist/collection/components/order-terminals/order-terminals.js +1 -1
  156. package/dist/collection/components/order-terminals/terminal-quantity-selector/terminal-quantity-selector.js +1 -1
  157. package/dist/collection/components/payment-details/payment-details-core.js +8 -8
  158. package/dist/collection/components/payment-transactions-list/payment-transactions-list.js +1 -1
  159. package/dist/collection/components/payments-list/payments-list-core.js +1 -1
  160. package/dist/collection/components/payments-list/payments-list-filters.js +2 -2
  161. package/dist/collection/components/payments-list/payments-list.js +1 -1
  162. package/dist/collection/components/payout-details/payout-details-core.js +3 -3
  163. package/dist/collection/components/payout-transactions-list/payout-transactions-list.js +1 -1
  164. package/dist/collection/components/payouts-list/payouts-list-core.js +1 -1
  165. package/dist/collection/components/payouts-list/payouts-list-filters.js +2 -2
  166. package/dist/collection/components/payouts-list/payouts-list.js +1 -1
  167. package/dist/collection/components/terminal-orders-list/terminal-orders-list-core.js +1 -1
  168. package/dist/collection/components/terminal-orders-list/terminal-orders-list-filters.js +2 -2
  169. package/dist/collection/components/terminal-orders-list/terminal-orders-list.js +1 -1
  170. package/dist/collection/components/terminals-list/terminals-list-core.js +1 -1
  171. package/dist/collection/components/terminals-list/terminals-list-filters.js +1 -1
  172. package/dist/collection/components/terminals-list/terminals-list.js +1 -1
  173. package/dist/collection/components/tokenize-payment-method/tokenize-payment-method.js +291 -87
  174. package/dist/collection/store/checkout.store.js +2 -1
  175. package/dist/collection/ui-components/custom-popper/custom-popper.js +2 -2
  176. package/dist/collection/ui-components/form/form-control-checkbox.js +2 -2
  177. package/dist/collection/ui-components/form/form-control-date.js +2 -2
  178. package/dist/collection/ui-components/form/form-control-file-v2.js +1 -1
  179. package/dist/collection/ui-components/form/form-control-file.js +2 -2
  180. package/dist/collection/ui-components/form/form-control-monetary.js +2 -2
  181. package/dist/collection/ui-components/form/form-control-number-masked.js +2 -2
  182. package/dist/collection/ui-components/form/form-control-number.js +2 -2
  183. package/dist/collection/ui-components/form/form-control-radio.js +2 -2
  184. package/dist/collection/ui-components/form/form-control-select.js +2 -2
  185. package/dist/collection/ui-components/form/form-control-text.js +2 -2
  186. package/dist/collection/ui-components/form/form-control-textarea.js +2 -2
  187. package/dist/collection/ui-components/form/hidden-input.js +1 -1
  188. package/dist/collection/ui-components/form/iframe-input.js +3 -3
  189. package/dist/collection/ui-components/index.js +1 -0
  190. package/dist/collection/ui-components/shadow-dom-components/justifi-button.js +1 -1
  191. package/dist/collection/ui-components/shadow-dom-components/justifi-header.js +1 -1
  192. package/dist/collection/ui-components/shadow-dom-components/justifi-radio-list-item.js +155 -0
  193. package/dist/collection/ui-components/shadow-dom-components/justifi-skeleton.js +1 -1
  194. package/dist/docs.json +727 -1331
  195. package/dist/esm/{Api-C3T8XYbb.js → Api-BCeKXDaf.js} +1 -1
  196. package/dist/esm/{ComponentError-BhrFjjAs.js → ComponentError-Cjcsf8ku.js} +9 -1
  197. package/dist/esm/{Dispute-7MWRbTXI.js → Dispute-BH0Xfn-F.js} +1 -1
  198. package/dist/esm/{Refund-0aZtuMmz.js → Refund-DBHZkemk.js} +148 -2
  199. package/dist/esm/additional-questions-details_5.entry.js +4 -3
  200. package/dist/esm/{badge-Dr7gkD2I.js → badge-BrapPg3R.js} +1 -1
  201. package/dist/esm/bank-account-document-form-inputs_4.entry.js +12 -12
  202. package/dist/esm/bank-account-form.entry.js +4 -4
  203. package/dist/esm/business-details-core.entry.js +3 -3
  204. package/dist/esm/{business.service-C5vrjgZf.js → business.service-ArD_uRLb.js} +4 -5
  205. package/dist/esm/{button-xfPDSpPt.js → button-BB-N4vit.js} +1 -1
  206. package/dist/esm/card-form.entry.js +4 -4
  207. package/dist/esm/{check-pkg-version-DqhSXPRt.js → check-pkg-version-CwPXpnQZ.js} +5 -6
  208. package/dist/esm/{checkout.service-CW2_CEte.js → checkout.service-BgDCPjQU.js} +4 -5
  209. package/dist/esm/{checkout.store-GXtlf5-4.js → checkout.store-td03RV8y.js} +2 -1
  210. package/dist/esm/checkouts-list-core.entry.js +11 -11
  211. package/dist/esm/{checkouts-table-BHhaS5bv.js → checkouts-table-COpCngi0.js} +3 -3
  212. package/dist/esm/custom-popper.entry.js +2 -2
  213. package/dist/esm/dinero-DizZAUMY.js +1671 -0
  214. package/dist/esm/{dispute.service-C3bmfjsZ.js → dispute.service-C2dMLW9w.js} +4 -5
  215. package/dist/esm/form-alert_5.entry.js +5 -5
  216. package/dist/esm/form-control-checkbox.entry.js +5 -5
  217. package/dist/esm/form-control-date.entry.js +4 -4
  218. package/dist/esm/{form-control-error-text-Cn0aPzHx.js → form-control-error-text-Bk3yfpFX.js} +1 -1
  219. package/dist/esm/form-control-file-v2_2.entry.js +5 -5
  220. package/dist/esm/{form-control-help-text-C91TeHXs.js → form-control-help-text-mOLCXs00.js} +1 -1
  221. package/dist/esm/form-control-monetary-provisioning.entry.js +5 -5
  222. package/dist/esm/form-control-monetary.entry.js +7 -6
  223. package/dist/esm/form-control-number-masked_2.entry.js +5 -5
  224. package/dist/esm/form-control-number.entry.js +5 -5
  225. package/dist/esm/form-control-radio.entry.js +3 -3
  226. package/dist/esm/form-control-select_3.entry.js +6 -6
  227. package/dist/esm/{get-business-BSRtbTh7.js → get-business-Crb6P-iI.js} +2 -2
  228. package/dist/esm/{get-payment-details-BdPvFl1W.js → get-payment-details-BN-K_5Ry.js} +5 -6
  229. package/dist/esm/{get-payout-csv-U_pgdPpb.js → get-payout-csv-D-Lnooki.js} +2 -2
  230. package/dist/esm/{get-subaccounts-BqqR44dV.js → get-subaccounts-DrFpGKDV.js} +6 -7
  231. package/dist/esm/gross-payment-chart-core.entry.js +6 -5
  232. package/dist/esm/{header-1-noRVFQY9.js → header-1-DYuf6mkF.js} +1 -1
  233. package/dist/esm/header-2-C4ZCdZwi.js +8 -0
  234. package/dist/esm/hidden-input_2.entry.js +7 -7
  235. package/dist/esm/insurance-state-BQks6cMA.js +39 -0
  236. package/dist/esm/justifi-additional-questions-form-step-core_6.entry.js +8 -8
  237. package/dist/esm/justifi-additional-questions-form-step_9.entry.js +20 -20
  238. package/dist/esm/justifi-additional-statement_8.entry.js +9 -9
  239. package/dist/esm/{justifi-bank-account-form_5.entry.js → justifi-bank-account-form_7.entry.js} +67 -26
  240. package/dist/esm/justifi-billing-form_2.entry.js +49 -0
  241. package/dist/esm/justifi-business-details.entry.js +13 -13
  242. package/dist/esm/justifi-business-form.entry.js +15 -15
  243. package/dist/esm/justifi-business-representative-form-inputs.entry.js +2 -2
  244. package/dist/esm/{justifi-button_5.entry.js → justifi-checkout-summary_5.entry.js} +161 -55
  245. package/dist/esm/justifi-checkout.entry.js +11 -11
  246. package/dist/esm/justifi-checkouts-list-filters.entry.js +7 -7
  247. package/dist/esm/justifi-checkouts-list.entry.js +15 -15
  248. package/dist/esm/justifi-details.entry.js +2 -2
  249. package/dist/esm/justifi-dispute-management-core.entry.js +2 -2
  250. package/dist/esm/justifi-dispute-management.entry.js +11 -11
  251. package/dist/esm/justifi-dispute-notification_3.entry.js +16 -16
  252. package/dist/esm/justifi-gross-payment-chart.entry.js +11 -11
  253. package/dist/esm/justifi-order-terminals.entry.js +15 -15
  254. package/dist/esm/justifi-owner-form_3.entry.js +14 -14
  255. package/dist/esm/justifi-payment-details.entry.js +13 -13
  256. package/dist/esm/justifi-payment-provisioning-core.entry.js +4 -4
  257. package/dist/esm/justifi-payment-provisioning.entry.js +12 -12
  258. package/dist/esm/justifi-payment-transactions-list.entry.js +14 -14
  259. package/dist/esm/justifi-payments-list-filters.entry.js +5 -4
  260. package/dist/esm/justifi-payments-list.entry.js +15 -15
  261. package/dist/esm/justifi-payout-details.entry.js +13 -13
  262. package/dist/esm/justifi-payout-transactions-list.entry.js +14 -14
  263. package/dist/esm/justifi-payouts-list-filters.entry.js +5 -4
  264. package/dist/esm/justifi-payouts-list.entry.js +17 -17
  265. package/dist/esm/justifi-refund-payment.entry.js +14 -14
  266. package/dist/esm/justifi-saved-payment-method.entry.js +4 -4
  267. package/dist/esm/justifi-season-interruption-insurance-core.entry.js +6 -4
  268. package/dist/esm/justifi-season-interruption-insurance.entry.js +11 -11
  269. package/dist/esm/justifi-skeleton.entry.js +3 -3
  270. package/dist/esm/justifi-terminal-orders-list-filters.entry.js +8 -8
  271. package/dist/esm/justifi-terminal-orders-list.entry.js +13 -13
  272. package/dist/esm/justifi-terminals-list-filters.entry.js +7 -7
  273. package/dist/esm/justifi-terminals-list.entry.js +15 -15
  274. package/dist/esm/justifi-tokenize-payment-method.entry.js +218 -36
  275. package/dist/esm/loader.js +1 -1
  276. package/dist/esm/{package-DR0dQ8Fv.js → package-HlNEzyiZ.js} +1 -1
  277. package/dist/esm/pagination-menu.entry.js +1 -1
  278. package/dist/esm/{parts-D3G5aVLy.js → parts-CKg_luIy.js} +1 -1
  279. package/dist/esm/payment-details-core.entry.js +15 -14
  280. package/dist/esm/{payment-method-option-utils-8n_ALxec.js → payment-method-option-utils-zFDtQrgQ.js} +2 -10
  281. package/dist/esm/{payment-provisioning-actions-2qP7AtHj.js → payment-provisioning-actions-ONP8lDnV.js} +2 -2
  282. package/dist/esm/{payment.service-CnQdP32J.js → payment.service-DPsRcwWM.js} +4 -5
  283. package/dist/esm/payments-list-core.entry.js +12 -12
  284. package/dist/esm/{payments-status-DUM0WZkk.js → payments-status-CawBLR48.js} +1 -1
  285. package/dist/esm/{payments-table-DVQzx7MJ.js → payments-table-WQAD1CSz.js} +3 -3
  286. package/dist/esm/payout-details-core.entry.js +11 -10
  287. package/dist/esm/{payout.service-EJuPNpfs.js → payout.service-CoVFefK5.js} +4 -5
  288. package/dist/esm/payouts-list-core.entry.js +12 -12
  289. package/dist/esm/{payouts-status-7saoFNoA.js → payouts-status-DB_PJap6.js} +1 -1
  290. package/dist/esm/{payouts-table-dca-F2iQ.js → payouts-table-DRISll8u.js} +3 -3
  291. package/dist/esm/{skeleton-C1-JoGFC.js → skeleton-D1Z4a8af.js} +1 -1
  292. package/dist/esm/{spinner-Ca9uu5Nd.js → spinner-BlffecO5.js} +1 -1
  293. package/dist/esm/{table-fsCYq8m9.js → table-BqxKVRry.js} +2 -2
  294. package/dist/esm/table-filters-menu.entry.js +3 -3
  295. package/dist/esm/terminal-orders-list-core.entry.js +11 -11
  296. package/dist/esm/{terminal-orders-table-BNasCnjz.js → terminal-orders-table-Da4IvBtB.js} +6 -7
  297. package/dist/esm/terminal-quantity-selector.entry.js +2 -2
  298. package/dist/esm/{terminal.service-Cfacmeto.js → terminal.service-CnPV1i9J.js} +4 -5
  299. package/dist/esm/terminals-list-core.entry.js +11 -11
  300. package/dist/esm/{terminals-table-DBk-eg_3.js → terminals-table-BBPQRWja.js} +3 -3
  301. package/dist/esm/{utils-BZvep88z.js → utils-BeQLScSm.js} +1 -1
  302. package/dist/esm/{utils-BjLkBMLe.js → utils-Cu5hITuT.js} +2 -1675
  303. package/dist/esm/{utils-CNwvOLkk.js → utils-sZ_6zOKQ.js} +1 -1
  304. package/dist/esm/webcomponents.js +1 -1
  305. package/dist/module/Analytics.js +0 -1
  306. package/dist/module/Refund.js +210 -1
  307. package/dist/module/additional-questions.js +1 -1
  308. package/dist/module/additional-statement.js +1 -1
  309. package/dist/module/badge.js +1 -1
  310. package/dist/module/bank-account-document-inputs.js +2 -3
  311. package/dist/module/bank-account-form-inputs2.js +1 -1
  312. package/dist/module/bank-account-form.js +2 -2
  313. package/dist/module/bank-account.js +3 -2
  314. package/dist/module/billing-form.js +23 -57
  315. package/dist/module/billing-information-form.js +10 -3
  316. package/dist/module/business-additional-questions-form-step.js +1 -1
  317. package/dist/module/business-bank-account-form-step-core.js +2 -3
  318. package/dist/module/business-bank-account-form-step.js +2 -3
  319. package/dist/module/business-core-info-form-step.js +1 -1
  320. package/dist/module/business-core-info.js +1 -1
  321. package/dist/module/business-details-core2.js +1 -0
  322. package/dist/module/business-documents-on-file2.js +2 -1
  323. package/dist/module/business-owners-form-step-core.js +1 -0
  324. package/dist/module/business-owners-form-step.js +1 -1
  325. package/dist/module/business-representative-form-inputs.js +1 -1
  326. package/dist/module/business-representative-form-step.js +1 -1
  327. package/dist/module/business-representative.js +1 -1
  328. package/dist/module/business-terms-conditions-form-step.js +1 -2
  329. package/dist/module/business.service.js +0 -1
  330. package/dist/module/cancellation-policy.js +1 -1
  331. package/dist/module/card-form.js +2 -2
  332. package/dist/module/card-form2.js +3 -2
  333. package/dist/module/checkout.service.js +0 -1
  334. package/dist/module/checkout.store.js +2 -1
  335. package/dist/module/checkouts-list-core2.js +5 -4
  336. package/dist/module/custom-popper2.js +2 -2
  337. package/dist/module/customer-details.js +1 -1
  338. package/dist/module/dinero.js +1671 -0
  339. package/dist/module/dispute-management-core.js +2 -2
  340. package/dist/module/dispute-notification.js +2 -1
  341. package/dist/module/dispute-response-actions.js +0 -1
  342. package/dist/module/dispute-response-core.js +1 -1
  343. package/dist/module/dispute-response.js +2 -1
  344. package/dist/module/duplicate-charge.js +1 -1
  345. package/dist/module/electronic-evidence.js +1 -1
  346. package/dist/module/form-alert2.js +1 -1
  347. package/dist/module/form-control-checkbox2.js +4 -3
  348. package/dist/module/form-control-date2.js +3 -2
  349. package/dist/module/form-control-file-v22.js +1 -1
  350. package/dist/module/form-control-file2.js +3 -2
  351. package/dist/module/form-control-monetary-provisioning2.js +4 -3
  352. package/dist/module/form-control-monetary2.js +4 -3
  353. package/dist/module/form-control-number-masked2.js +3 -2
  354. package/dist/module/form-control-number.js +4 -3
  355. package/dist/module/form-control-radio2.js +3 -3
  356. package/dist/module/form-control-select2.js +3 -2
  357. package/dist/module/form-control-text2.js +3 -2
  358. package/dist/module/form-control-textarea2.js +3 -3
  359. package/dist/module/get-payment-details.js +2 -3
  360. package/dist/module/get-subaccounts.js +1 -2
  361. package/dist/module/gross-payment-chart-core2.js +2 -2
  362. package/dist/module/hidden-input2.js +2 -2
  363. package/dist/module/identity-address-form.js +1 -1
  364. package/dist/module/iframe-input2.js +4 -4
  365. package/dist/module/insurance-state.js +18 -1
  366. package/dist/module/justifi-business-form.js +2 -2
  367. package/dist/module/justifi-button2.js +1 -1
  368. package/dist/module/justifi-checkout.js +3 -2
  369. package/dist/module/justifi-checkouts-list-filters.js +4 -4
  370. package/dist/module/justifi-checkouts-list.js +4 -4
  371. package/dist/module/justifi-dispute-management.js +2 -3
  372. package/dist/module/justifi-gross-payment-chart.js +0 -1
  373. package/dist/module/justifi-header2.js +7 -3
  374. package/dist/module/justifi-modular-checkout.js +2 -2
  375. package/dist/module/justifi-order-terminals.js +5 -4
  376. package/dist/module/justifi-payment-provisioning.js +1 -2
  377. package/dist/module/justifi-payment-transactions-list.js +6 -5
  378. package/dist/module/justifi-payments-list-filters.js +4 -3
  379. package/dist/module/justifi-payments-list.js +4 -4
  380. package/dist/module/justifi-payout-details.js +2 -3
  381. package/dist/module/justifi-payout-transactions-list.js +6 -5
  382. package/dist/module/justifi-payouts-list-filters.js +4 -3
  383. package/dist/module/justifi-payouts-list.js +4 -4
  384. package/dist/module/justifi-radio-list-item.d.ts +11 -0
  385. package/dist/module/justifi-radio-list-item.js +6 -0
  386. package/dist/module/justifi-radio-list-item2.js +55 -0
  387. package/dist/module/justifi-refund-payment.js +2 -2
  388. package/dist/module/justifi-saved-payment-method.js +2 -2
  389. package/dist/module/justifi-season-interruption-insurance.js +1 -2
  390. package/dist/module/justifi-skeleton.js +1 -1
  391. package/dist/module/justifi-terminal-orders-list-filters.js +5 -5
  392. package/dist/module/justifi-terminal-orders-list.js +4 -4
  393. package/dist/module/justifi-terminals-list-filters.js +4 -4
  394. package/dist/module/justifi-terminals-list.js +4 -4
  395. package/dist/module/justifi-tokenize-payment-method.js +311 -47
  396. package/dist/module/legal-address-form-step.js +1 -1
  397. package/dist/module/legal-address-form.js +1 -1
  398. package/dist/module/modular-checkout.js +47 -14
  399. package/dist/module/owner-form-core2.js +3 -2
  400. package/dist/module/owner-form-inputs2.js +1 -1
  401. package/dist/module/owner-form.js +1 -1
  402. package/dist/module/package.js +1 -1
  403. package/dist/module/pagination-menu2.js +1 -1
  404. package/dist/module/parts.js +1 -1
  405. package/dist/module/payment-details-core2.js +10 -9
  406. package/dist/module/payment-method-option-utils.js +2 -10
  407. package/dist/module/payment-method-option2.js +3 -2
  408. package/dist/module/payment-provisioning-core.js +2 -1
  409. package/dist/module/payment-provisioning-form-buttons.js +2 -1
  410. package/dist/module/payment-provisioning-form-steps.js +1 -1
  411. package/dist/module/payment-provisioning-loading.js +1 -0
  412. package/dist/module/payment.service.js +0 -1
  413. package/dist/module/payments-list-core2.js +5 -4
  414. package/dist/module/payout-details-core2.js +5 -4
  415. package/dist/module/payout.service.js +0 -1
  416. package/dist/module/payouts-list-core2.js +5 -4
  417. package/dist/module/postal-code-form.js +4 -2
  418. package/dist/module/product-or-service.js +1 -1
  419. package/dist/module/refund-policy.js +1 -1
  420. package/dist/module/save-new-payment-method.js +8 -5
  421. package/dist/module/saved-payment-methods.js +2 -1
  422. package/dist/module/season-interruption-insurance-core.js +2 -1
  423. package/dist/module/sezzle-payment-method.js +2 -1
  424. package/dist/module/shipping-details.js +1 -1
  425. package/dist/module/spinner.js +1 -1
  426. package/dist/module/summary.js +2 -1
  427. package/dist/module/table-filters-menu2.js +1 -1
  428. package/dist/module/table.js +1 -1
  429. package/dist/module/terminal-orders-list-core2.js +6 -5
  430. package/dist/module/terminal-quantity-selector2.js +2 -2
  431. package/dist/module/terminal.service.js +0 -1
  432. package/dist/module/terminals-list-core2.js +5 -4
  433. package/dist/module/utils2.js +2 -1675
  434. package/dist/types/api/ComponentError.d.ts +7 -0
  435. package/dist/types/components/checkout/billing-form/billing-form.d.ts +3 -9
  436. package/dist/types/components/checkout/checkout.d.ts +1 -1
  437. package/dist/types/components/checkout/save-new-payment-method.d.ts +1 -1
  438. package/dist/types/components/insurance/insurance-state.d.ts +2 -1
  439. package/dist/types/components/modular-checkout/modular-checkout.d.ts +2 -1
  440. package/dist/types/components/modular-checkout/sub-components/billing-information-form.d.ts +2 -0
  441. package/dist/types/components/modular-checkout/sub-components/postal-code-form.d.ts +1 -0
  442. package/dist/types/components/tokenize-payment-method/tokenize-payment-method.d.ts +41 -14
  443. package/dist/types/components.d.ts +70 -114
  444. package/dist/types/store/checkout.store.d.ts +2 -1
  445. package/dist/types/ui-components/index.d.ts +1 -0
  446. package/dist/types/ui-components/shadow-dom-components/justifi-radio-list-item.d.ts +12 -0
  447. package/dist/webcomponents/p-00c2f5d5.entry.js +1 -0
  448. package/dist/webcomponents/{p-d7f62287.entry.js → p-046fee8c.entry.js} +1 -1
  449. package/dist/webcomponents/{p-30d3d0cd.entry.js → p-0a0ed7a4.entry.js} +1 -1
  450. package/dist/webcomponents/p-0cb64945.entry.js +1 -0
  451. package/dist/webcomponents/{p-70774a5a.entry.js → p-0e44afa7.entry.js} +1 -1
  452. package/dist/webcomponents/p-0e6797c4.entry.js +1 -0
  453. package/dist/webcomponents/p-0fc026aa.entry.js +1 -0
  454. package/dist/webcomponents/p-16583f91.entry.js +1 -0
  455. package/dist/webcomponents/p-195cf5cc.entry.js +1 -0
  456. package/dist/webcomponents/{p-7d2de2d4.entry.js → p-1b1fe3de.entry.js} +1 -1
  457. package/dist/webcomponents/{p-50bfec55.entry.js → p-1b7b7210.entry.js} +1 -1
  458. package/dist/webcomponents/p-1c7d9b90.entry.js +1 -0
  459. package/dist/webcomponents/p-1ce1df1e.entry.js +1 -0
  460. package/dist/webcomponents/p-24e1a686.entry.js +1 -0
  461. package/dist/webcomponents/p-2a5ac7c9.entry.js +1 -0
  462. package/dist/webcomponents/p-2abf1785.entry.js +1 -0
  463. package/dist/webcomponents/p-2dcf196f.entry.js +1 -0
  464. package/dist/webcomponents/{p-7c63d61d.entry.js → p-302f7632.entry.js} +1 -1
  465. package/dist/webcomponents/{p-2f482f5b.entry.js → p-351ffd2a.entry.js} +1 -1
  466. package/dist/webcomponents/{p-cb7c712f.entry.js → p-39ca43e0.entry.js} +1 -1
  467. package/dist/webcomponents/p-3eb5f196.entry.js +1 -0
  468. package/dist/webcomponents/p-4045631f.entry.js +1 -0
  469. package/dist/webcomponents/{p-05c604d2.entry.js → p-429618a4.entry.js} +1 -1
  470. package/dist/webcomponents/{p-a02ce003.entry.js → p-444fb5a6.entry.js} +1 -1
  471. package/dist/webcomponents/{p-ac538ffd.entry.js → p-45b0a91c.entry.js} +1 -1
  472. package/dist/webcomponents/p-4907e95b.entry.js +1 -0
  473. package/dist/webcomponents/p-4a0a4314.entry.js +1 -0
  474. package/dist/webcomponents/p-4aaaa44e.entry.js +1 -0
  475. package/dist/webcomponents/p-4b34b9af.entry.js +1 -0
  476. package/dist/webcomponents/p-55iuf7iW.js +1 -0
  477. package/dist/webcomponents/{p-BxfUcCXo.js → p-5aA7gjr5.js} +1 -1
  478. package/dist/webcomponents/p-5e71f4d4.entry.js +1 -0
  479. package/dist/webcomponents/{p-0e4e662b.entry.js → p-6a06da8a.entry.js} +1 -1
  480. package/dist/webcomponents/p-6bafb4b5.entry.js +1 -0
  481. package/dist/webcomponents/p-6d1f2d57.entry.js +1 -0
  482. package/dist/webcomponents/p-6f397c80.entry.js +1 -0
  483. package/dist/webcomponents/p-75545aec.entry.js +1 -0
  484. package/dist/webcomponents/p-7b07255f.entry.js +1 -0
  485. package/dist/webcomponents/p-7b925204.entry.js +1 -0
  486. package/dist/webcomponents/p-831857dc.entry.js +1 -0
  487. package/dist/webcomponents/p-85c0953d.entry.js +1 -0
  488. package/dist/webcomponents/p-85ebdce5.entry.js +1 -0
  489. package/dist/webcomponents/p-86b166eb.entry.js +1 -0
  490. package/dist/webcomponents/{p-1bddf354.entry.js → p-880718b9.entry.js} +1 -1
  491. package/dist/webcomponents/p-88b6dbdd.entry.js +1 -0
  492. package/dist/webcomponents/p-8e0c6f60.entry.js +1 -0
  493. package/dist/webcomponents/{p-66861ea5.entry.js → p-90edbaa3.entry.js} +1 -1
  494. package/dist/webcomponents/p-97c0d873.entry.js +1 -0
  495. package/dist/webcomponents/p-9e48a264.entry.js +1 -0
  496. package/dist/webcomponents/{p-Dh6FEdp8.js → p-AbSg_vYv.js} +1 -1
  497. package/dist/webcomponents/p-B2uBb14Y.js +1 -0
  498. package/dist/webcomponents/{p-BtT7kqMw.js → p-B3qJZUMy.js} +1 -1
  499. package/dist/webcomponents/p-BF51n3KG.js +1 -0
  500. package/dist/webcomponents/{p-7MWRbTXI.js → p-BH0Xfn-F.js} +1 -1
  501. package/dist/webcomponents/p-BNd9xVOU.js +1 -0
  502. package/dist/webcomponents/p-BQLEjYfZ.js +1 -0
  503. package/dist/webcomponents/p-BZ9YQ3FA.js +1 -0
  504. package/dist/webcomponents/{p-BqK0rIZQ.js → p-BfEOvp9h.js} +1 -1
  505. package/dist/webcomponents/p-Bka75aL-.js +1 -0
  506. package/dist/webcomponents/p-C3e-DgwK.js +1 -0
  507. package/dist/webcomponents/{p-DAVX1-sW.js → p-CDIPkflV.js} +1 -1
  508. package/dist/webcomponents/{p-D3G5aVLy.js → p-CKg_luIy.js} +1 -1
  509. package/dist/webcomponents/{p-DDpc1huF.js → p-Ce8QXyUM.js} +1 -1
  510. package/dist/webcomponents/p-ChzWF0s3.js +1 -0
  511. package/dist/webcomponents/p-CjAMuB2J.js +1 -0
  512. package/dist/webcomponents/p-Cjcsf8ku.js +1 -0
  513. package/dist/webcomponents/{p-DAoffYFW.js → p-D0I-tRSs.js} +1 -1
  514. package/dist/webcomponents/p-D2muobcE.js +1 -0
  515. package/dist/webcomponents/p-DC63XVwu.js +1 -0
  516. package/dist/webcomponents/p-DH8F0bsw.js +1 -0
  517. package/dist/webcomponents/p-DMuY7Dka.js +1 -0
  518. package/dist/webcomponents/p-DPfZxsq9.js +1 -0
  519. package/dist/webcomponents/{p-DHvfrLVU.js → p-DPnS0F0Y.js} +1 -1
  520. package/dist/webcomponents/p-DR0bMp9p.js +1 -0
  521. package/dist/webcomponents/p-DYGIC0QH.js +1 -0
  522. package/dist/webcomponents/p-DgxD9dbc.js +1 -0
  523. package/dist/webcomponents/p-DniBAXrh.js +1 -0
  524. package/dist/webcomponents/p-Do0fsKZk.js +1 -0
  525. package/dist/webcomponents/{p-1adN6FVa.js → p-DpUqxsf5.js} +1 -1
  526. package/dist/webcomponents/p-DxEnw2tJ.js +1 -0
  527. package/dist/webcomponents/{p-fUv1jFAw.js → p-EAEmpCru.js} +1 -1
  528. package/dist/webcomponents/p-HlNEzyiZ.js +1 -0
  529. package/dist/webcomponents/p-O50LiN_p.js +1 -0
  530. package/dist/webcomponents/p-S_UV9-px.js +1 -0
  531. package/dist/webcomponents/p-X2PeOHf5.js +1 -0
  532. package/dist/webcomponents/p-_WsRuUBr.js +1 -0
  533. package/dist/webcomponents/{p-683630d0.entry.js → p-a1c7c873.entry.js} +1 -1
  534. package/dist/webcomponents/p-a3c6c55e.entry.js +1 -0
  535. package/dist/webcomponents/p-af935779.entry.js +1 -0
  536. package/dist/webcomponents/p-b01801a6.entry.js +1 -0
  537. package/dist/webcomponents/p-b47000f7.entry.js +1 -0
  538. package/dist/webcomponents/p-b58fb1b1.entry.js +1 -0
  539. package/dist/webcomponents/{p-f5d12ae3.entry.js → p-b8906c49.entry.js} +1 -1
  540. package/dist/webcomponents/p-c1bf875b.entry.js +1 -0
  541. package/dist/webcomponents/p-c26ef276.entry.js +1 -0
  542. package/dist/webcomponents/p-c5331724.entry.js +1 -0
  543. package/dist/webcomponents/p-c6bd05ef.entry.js +1 -0
  544. package/dist/webcomponents/{p-0890869b.entry.js → p-d5e4e888.entry.js} +4 -4
  545. package/dist/webcomponents/{p-e48a2d25.entry.js → p-e2ee826e.entry.js} +1 -1
  546. package/dist/webcomponents/{p-ae00a6f3.entry.js → p-e9c44dc2.entry.js} +1 -1
  547. package/dist/webcomponents/p-edf9128c.entry.js +1 -0
  548. package/dist/webcomponents/p-f3c2de89.entry.js +1 -0
  549. package/dist/webcomponents/p-f6ff7255.entry.js +1 -0
  550. package/dist/webcomponents/p-f8a0821d.entry.js +1 -0
  551. package/dist/webcomponents/p-fcb6c171.entry.js +1 -0
  552. package/dist/webcomponents/p-fd4d7c7e.entry.js +1 -0
  553. package/dist/webcomponents/p-pMAKJWDL.js +1 -0
  554. package/dist/webcomponents/p-rPeW3G6n.js +1 -0
  555. package/dist/webcomponents/webcomponents.esm.js +1 -1
  556. package/package.json +1 -1
  557. package/dist/cjs/Payment-D5UynU2f.js +0 -151
  558. package/dist/cjs/header-3-BnKbOjvz.js +0 -10
  559. package/dist/cjs/insurance-state-BsGy_svD.js +0 -34
  560. package/dist/cjs/justifi-billing-form.cjs.entry.js +0 -76
  561. package/dist/cjs/justifi-new-payment-method.cjs.entry.js +0 -99
  562. package/dist/cjs/justifi-payment-method-options.cjs.entry.js +0 -76
  563. package/dist/cjs/justifi-saved-payment-methods_2.cjs.entry.js +0 -117
  564. package/dist/collection/components/checkout/new-payment-method.js +0 -378
  565. package/dist/collection/components/checkout/payment-method-options.js +0 -421
  566. package/dist/esm/Payment-00TwhwCx.js +0 -149
  567. package/dist/esm/header-3-Bsi4loU1.js +0 -8
  568. package/dist/esm/insurance-state-pL8MRpxn.js +0 -28
  569. package/dist/esm/justifi-billing-form.entry.js +0 -74
  570. package/dist/esm/justifi-new-payment-method.entry.js +0 -97
  571. package/dist/esm/justifi-payment-method-options.entry.js +0 -74
  572. package/dist/esm/justifi-saved-payment-methods_2.entry.js +0 -114
  573. package/dist/module/Payment.js +0 -204
  574. package/dist/module/header-3.js +0 -8
  575. package/dist/module/justifi-new-payment-method.d.ts +0 -11
  576. package/dist/module/justifi-new-payment-method.js +0 -219
  577. package/dist/module/justifi-payment-method-options.d.ts +0 -11
  578. package/dist/module/justifi-payment-method-options.js +0 -6
  579. package/dist/module/payment-method-options.js +0 -129
  580. package/dist/types/components/checkout/new-payment-method.d.ts +0 -31
  581. package/dist/types/components/checkout/payment-method-options.d.ts +0 -32
  582. package/dist/webcomponents/p-00d7c2e6.entry.js +0 -1
  583. package/dist/webcomponents/p-03e9a98c.entry.js +0 -1
  584. package/dist/webcomponents/p-05fc864a.entry.js +0 -1
  585. package/dist/webcomponents/p-09c24135.entry.js +0 -1
  586. package/dist/webcomponents/p-0f511cc1.entry.js +0 -1
  587. package/dist/webcomponents/p-100008fa.entry.js +0 -1
  588. package/dist/webcomponents/p-17825dfb.entry.js +0 -1
  589. package/dist/webcomponents/p-18b941d3.entry.js +0 -1
  590. package/dist/webcomponents/p-19308a1b.entry.js +0 -1
  591. package/dist/webcomponents/p-1a7942f7.entry.js +0 -1
  592. package/dist/webcomponents/p-1d1d956b.entry.js +0 -1
  593. package/dist/webcomponents/p-26bf2fda.entry.js +0 -1
  594. package/dist/webcomponents/p-2d3949f7.entry.js +0 -1
  595. package/dist/webcomponents/p-326f4860.entry.js +0 -1
  596. package/dist/webcomponents/p-359b8f54.entry.js +0 -1
  597. package/dist/webcomponents/p-37aeeeee.entry.js +0 -1
  598. package/dist/webcomponents/p-4887bcb3.entry.js +0 -1
  599. package/dist/webcomponents/p-54406229.entry.js +0 -1
  600. package/dist/webcomponents/p-56af4fd0.entry.js +0 -1
  601. package/dist/webcomponents/p-59656e08.entry.js +0 -1
  602. package/dist/webcomponents/p-5d145701.entry.js +0 -1
  603. package/dist/webcomponents/p-5e813b93.entry.js +0 -1
  604. package/dist/webcomponents/p-64a46b8a.entry.js +0 -1
  605. package/dist/webcomponents/p-6bd83369.entry.js +0 -1
  606. package/dist/webcomponents/p-6ee2b118.entry.js +0 -1
  607. package/dist/webcomponents/p-73afde1b.entry.js +0 -1
  608. package/dist/webcomponents/p-73bbd71c.entry.js +0 -1
  609. package/dist/webcomponents/p-74f78a4e.entry.js +0 -1
  610. package/dist/webcomponents/p-755a8d9b.entry.js +0 -1
  611. package/dist/webcomponents/p-7c456c10.entry.js +0 -1
  612. package/dist/webcomponents/p-7c6d7283.entry.js +0 -1
  613. package/dist/webcomponents/p-7e9832b3.entry.js +0 -1
  614. package/dist/webcomponents/p-810cad17.entry.js +0 -1
  615. package/dist/webcomponents/p-81478598.entry.js +0 -1
  616. package/dist/webcomponents/p-91a2707a.entry.js +0 -1
  617. package/dist/webcomponents/p-9348a7c8.entry.js +0 -1
  618. package/dist/webcomponents/p-967c3374.entry.js +0 -1
  619. package/dist/webcomponents/p-9REosSLu.js +0 -1
  620. package/dist/webcomponents/p-9c27f87f.entry.js +0 -1
  621. package/dist/webcomponents/p-B9ROmZzw.js +0 -1
  622. package/dist/webcomponents/p-BCPBc18Y.js +0 -1
  623. package/dist/webcomponents/p-BQ5bL1Y5.js +0 -1
  624. package/dist/webcomponents/p-BSW9VS7r.js +0 -1
  625. package/dist/webcomponents/p-BSexQ2qc.js +0 -1
  626. package/dist/webcomponents/p-Bc5u1WjM.js +0 -1
  627. package/dist/webcomponents/p-BhrFjjAs.js +0 -1
  628. package/dist/webcomponents/p-BjQrbohd.js +0 -1
  629. package/dist/webcomponents/p-BxWsrx5h.js +0 -1
  630. package/dist/webcomponents/p-By9Lz2e0.js +0 -1
  631. package/dist/webcomponents/p-CEp46FZK.js +0 -1
  632. package/dist/webcomponents/p-CMNxLEJP.js +0 -1
  633. package/dist/webcomponents/p-CZItg0Yo.js +0 -1
  634. package/dist/webcomponents/p-D7WGjeDy.js +0 -1
  635. package/dist/webcomponents/p-DIDbcp63.js +0 -1
  636. package/dist/webcomponents/p-DKClunJd.js +0 -1
  637. package/dist/webcomponents/p-DR0dQ8Fv.js +0 -1
  638. package/dist/webcomponents/p-DUqRxn4Y.js +0 -1
  639. package/dist/webcomponents/p-DbcOhajT.js +0 -1
  640. package/dist/webcomponents/p-DhAmsAOH.js +0 -1
  641. package/dist/webcomponents/p-DoEkFs2i.js +0 -1
  642. package/dist/webcomponents/p-DvXSA0b0.js +0 -1
  643. package/dist/webcomponents/p-NqdaxjDT.js +0 -1
  644. package/dist/webcomponents/p-a05062d8.entry.js +0 -1
  645. package/dist/webcomponents/p-a27405fb.entry.js +0 -1
  646. package/dist/webcomponents/p-a2f0d61c.entry.js +0 -1
  647. package/dist/webcomponents/p-a95741ee.entry.js +0 -1
  648. package/dist/webcomponents/p-b193bf46.entry.js +0 -1
  649. package/dist/webcomponents/p-b398856f.entry.js +0 -1
  650. package/dist/webcomponents/p-d33baab9.entry.js +0 -1
  651. package/dist/webcomponents/p-d3f438ca.entry.js +0 -1
  652. package/dist/webcomponents/p-d5b3c65c.entry.js +0 -1
  653. package/dist/webcomponents/p-d62e6c16.entry.js +0 -1
  654. package/dist/webcomponents/p-eba620cd.entry.js +0 -1
  655. package/dist/webcomponents/p-ecdda6e6.entry.js +0 -1
  656. package/dist/webcomponents/p-f24e201f.entry.js +0 -1
  657. package/dist/webcomponents/p-m2jmX-Hz.js +0 -1
  658. package/dist/webcomponents/p-pGzabKc7.js +0 -1
  659. package/dist/webcomponents/p-sT4o5vru.js +0 -1
  660. package/dist/webcomponents/p-ys9CWfNG.js +0 -1
  661. package/dist/webcomponents/p-zucQG3cz.js +0 -1
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from './_commonjsHelpers-BFTU3MAI.js';
1
+ import { D as Dinero } from './dinero-DizZAUMY.js';
2
2
 
3
3
  var dateFns = {};
4
4
 
@@ -22140,1674 +22140,6 @@ function requireDateFns () {
22140
22140
 
22141
22141
  var dateFnsExports = /*@__PURE__*/ requireDateFns();
22142
22142
 
22143
- var dinero_1;
22144
- var hasRequiredDinero;
22145
-
22146
- function requireDinero () {
22147
- if (hasRequiredDinero) return dinero_1;
22148
- hasRequiredDinero = 1;
22149
-
22150
- /**
22151
- * Default values for all Dinero objects.
22152
- *
22153
- * You can override default values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.
22154
- * Existing instances won't be affected.
22155
- *
22156
- * @property {Number} defaultAmount - The default amount for new Dinero objects (see {@link module:Dinero Dinero} for format).
22157
- * @property {String} defaultCurrency - The default currency for new Dinero objects (see {@link module:Dinero Dinero} for format).
22158
- * @property {Number} defaultPrecision - The default precision for new Dinero objects (see {@link module:Dinero Dinero} for format).
22159
- *
22160
- * @example
22161
- * // Will set currency to 'EUR' for all Dinero objects.
22162
- * Dinero.defaultCurrency = 'EUR'
22163
- *
22164
- * @type {Object}
22165
- */
22166
- var Defaults = {
22167
- defaultAmount: 0,
22168
- defaultCurrency: 'USD',
22169
- defaultPrecision: 2
22170
- };
22171
- /**
22172
- * Global settings for all Dinero objects.
22173
- *
22174
- * You can override global values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.
22175
- * Existing instances won't be affected.
22176
- *
22177
- * @property {String} globalLocale - The global locale for new Dinero objects (see {@link module:Dinero~setLocale setLocale} for format).
22178
- * @property {String} globalFormat - The global format for new Dinero objects (see {@link module:Dinero~toFormat toFormat} for format).
22179
- * @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).
22180
- * @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).
22181
- * @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).
22182
- * @property {String} globalExchangeRatesApi.propertyPath - The global exchange rate API property path for new Dinero objects (see {@link module:Dinero~convert convert} for format).
22183
- * @property {Object} globalExchangeRatesApi.headers - The global exchange rate API headers for new Dinero objects (see {@link module:Dinero~convert convert} for format).
22184
- *
22185
- * @example
22186
- * // Will set locale to 'fr-FR' for all Dinero objects.
22187
- * Dinero.globalLocale = 'fr-FR'
22188
- * @example
22189
- * // Will set global exchange rate API parameters for all Dinero objects.
22190
- * Dinero.globalExchangeRatesApi = {
22191
- * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',
22192
- * propertyPath: 'data.rates.{{to}}',
22193
- * headers: {
22194
- * 'user-key': 'xxxxxxxxx'
22195
- * }
22196
- * }
22197
- *
22198
- * @type {Object}
22199
- */
22200
-
22201
- var Globals = {
22202
- globalLocale: 'en-US',
22203
- globalFormat: '$0,0.00',
22204
- globalRoundingMode: 'HALF_EVEN',
22205
- globalFormatRoundingMode: 'HALF_AWAY_FROM_ZERO',
22206
- globalExchangeRatesApi: {
22207
- endpoint: undefined,
22208
- headers: undefined,
22209
- propertyPath: undefined
22210
- }
22211
- };
22212
-
22213
- function _typeof(obj) {
22214
- "@babel/helpers - typeof";
22215
-
22216
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
22217
- _typeof = function (obj) {
22218
- return typeof obj;
22219
- };
22220
- } else {
22221
- _typeof = function (obj) {
22222
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
22223
- };
22224
- }
22225
-
22226
- return _typeof(obj);
22227
- }
22228
-
22229
- function _toArray(arr) {
22230
- return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
22231
- }
22232
-
22233
- function _arrayWithHoles(arr) {
22234
- if (Array.isArray(arr)) return arr;
22235
- }
22236
-
22237
- function _iterableToArray(iter) {
22238
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
22239
- }
22240
-
22241
- function _unsupportedIterableToArray(o, minLen) {
22242
- if (!o) return;
22243
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
22244
- var n = Object.prototype.toString.call(o).slice(8, -1);
22245
- if (n === "Object" && o.constructor) n = o.constructor.name;
22246
- if (n === "Map" || n === "Set") return Array.from(o);
22247
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
22248
- }
22249
-
22250
- function _arrayLikeToArray(arr, len) {
22251
- if (len == null || len > arr.length) len = arr.length;
22252
-
22253
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
22254
-
22255
- return arr2;
22256
- }
22257
-
22258
- function _nonIterableRest() {
22259
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22260
- }
22261
-
22262
- /**
22263
- * Static methods for Dinero.
22264
- * @ignore
22265
- *
22266
- * @type {Object}
22267
- */
22268
- var Static = {
22269
- /**
22270
- * Returns an array of Dinero objects, normalized to the same precision (the highest).
22271
- *
22272
- * @memberof module:Dinero
22273
- * @method
22274
- *
22275
- * @param {Dinero[]} objects - An array of Dinero objects
22276
- *
22277
- * @example
22278
- * // returns an array of Dinero objects
22279
- * // both with a precision of 3
22280
- * // and an amount of 1000
22281
- * Dinero.normalizePrecision([
22282
- * Dinero({ amount: 100, precision: 2 }),
22283
- * Dinero({ amount: 1000, precision: 3 })
22284
- * ])
22285
- *
22286
- * @return {Dinero[]}
22287
- */
22288
- normalizePrecision: function normalizePrecision(objects) {
22289
- var highestPrecision = objects.reduce(function (a, b) {
22290
- return Math.max(a.getPrecision(), b.getPrecision());
22291
- });
22292
- return objects.map(function (object) {
22293
- return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;
22294
- });
22295
- },
22296
-
22297
- /**
22298
- * Returns the smallest Dinero object from an array of Dinero objects
22299
- *
22300
- * @memberof module:Dinero
22301
- * @method
22302
- *
22303
- * @param {Dinero[]} objects - An array of Dinero objects
22304
- *
22305
- * @example
22306
- * // returns the smallest Dinero object with amount of 500 from an array of Dinero objects with different precisions
22307
- * Dinero.minimum([
22308
- * Dinero({ amount: 500, precision: 3 }),
22309
- * Dinero({ amount: 100, precision: 2 })
22310
- * ])
22311
- * @example
22312
- * // returns the smallest Dinero object with amount of 50 from an array of Dinero objects
22313
- * Dinero.minimum([
22314
- * Dinero({ amount: 50 }),
22315
- * Dinero({ amount: 100 })
22316
- * ])
22317
- *
22318
- * @return {Dinero[]}
22319
- */
22320
- minimum: function minimum(objects) {
22321
- var _objects = _toArray(objects),
22322
- firstObject = _objects[0],
22323
- tailObjects = _objects.slice(1);
22324
-
22325
- var currentMinimum = firstObject;
22326
- tailObjects.forEach(function (obj) {
22327
- currentMinimum = currentMinimum.lessThan(obj) ? currentMinimum : obj;
22328
- });
22329
- return currentMinimum;
22330
- },
22331
-
22332
- /**
22333
- * Returns the biggest Dinero object from an array of Dinero objects
22334
- *
22335
- * @memberof module:Dinero
22336
- * @method
22337
- *
22338
- * @param {Dinero[]} objects - An array of Dinero objects
22339
- *
22340
- * @example
22341
- * // returns the biggest Dinero object with amount of 20, from an array of Dinero objects with different precisions
22342
- * Dinero.maximum([
22343
- * Dinero({ amount: 20, precision: 2 }),
22344
- * Dinero({ amount: 150, precision: 3 })
22345
- * ])
22346
- * @example
22347
- * // returns the biggest Dinero object with amount of 100, from an array of Dinero objects
22348
- * Dinero.maximum([
22349
- * Dinero({ amount: 100 }),
22350
- * Dinero({ amount: 50 })
22351
- * ])
22352
- *
22353
- * @return {Dinero[]}
22354
- */
22355
- maximum: function maximum(objects) {
22356
- var _objects2 = _toArray(objects),
22357
- firstObject = _objects2[0],
22358
- tailObjects = _objects2.slice(1);
22359
-
22360
- var currentMaximum = firstObject;
22361
- tailObjects.forEach(function (obj) {
22362
- currentMaximum = currentMaximum.greaterThan(obj) ? currentMaximum : obj;
22363
- });
22364
- return currentMaximum;
22365
- }
22366
- };
22367
-
22368
- /**
22369
- * Returns whether a value is numeric.
22370
- * @ignore
22371
- *
22372
- * @param {} value - The value to test.
22373
- *
22374
- * @return {Boolean}
22375
- */
22376
- function isNumeric(value) {
22377
- return !isNaN(parseInt(value)) && isFinite(value);
22378
- }
22379
- /**
22380
- * Returns whether a value is a percentage.
22381
- * @ignore
22382
- *
22383
- * @param {} percentage - The percentage to test.
22384
- *
22385
- * @return {Boolean}
22386
- */
22387
-
22388
- function isPercentage(percentage) {
22389
- return isNumeric(percentage) && percentage <= 100 && percentage >= 0;
22390
- }
22391
- /**
22392
- * Returns whether an array of ratios is valid.
22393
- * @ignore
22394
- *
22395
- * @param {} ratios - The ratios to test.
22396
- *
22397
- * @return {Boolean}
22398
- */
22399
-
22400
- function areValidRatios(ratios) {
22401
- return ratios.length > 0 && ratios.every(function (ratio) {
22402
- return ratio >= 0;
22403
- }) && ratios.some(function (ratio) {
22404
- return ratio > 0;
22405
- });
22406
- }
22407
- /**
22408
- * Returns whether a value is even.
22409
- * @ignore
22410
- *
22411
- * @param {Number} value - The value to test.
22412
- *
22413
- * @return {Boolean}
22414
- */
22415
-
22416
- function isEven(value) {
22417
- return value % 2 === 0;
22418
- }
22419
- /**
22420
- * Returns whether a value is a float.
22421
- * @ignore
22422
- *
22423
- * @param {} value - The value to test.
22424
- *
22425
- * @return {Boolean}
22426
- */
22427
-
22428
- function isFloat(value) {
22429
- return isNumeric(value) && !Number.isInteger(value);
22430
- }
22431
- /**
22432
- * Returns how many fraction digits a number has.
22433
- * @ignore
22434
- *
22435
- * @param {Number} [number=0] - The number to test.
22436
- *
22437
- * @return {Number}
22438
- */
22439
-
22440
- function countFractionDigits() {
22441
- var number = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
22442
- var stringRepresentation = number.toString();
22443
-
22444
- if (stringRepresentation.indexOf('e-') > 0) {
22445
- // It's too small for a normal string representation, e.g. 1e-7 instead of 0.00000001
22446
- return parseInt(stringRepresentation.split('e-')[1]);
22447
- } else {
22448
- var fractionDigits = stringRepresentation.split('.')[1];
22449
- return fractionDigits ? fractionDigits.length : 0;
22450
- }
22451
- }
22452
- /**
22453
- * Returns whether a number is half.
22454
- * @ignore
22455
- *
22456
- * @param {Number} number - The number to test.
22457
- *
22458
- * @return {Number}
22459
- */
22460
-
22461
- function isHalf(number) {
22462
- return Math.abs(number) % 1 === 0.5;
22463
- }
22464
- /**
22465
- * Fetches a JSON resource.
22466
- * @ignore
22467
- *
22468
- * @param {String} url - The resource to fetch.
22469
- * @param {Object} [options.headers] - The headers to pass.
22470
- *
22471
- * @throws {Error} If `request.status` is lesser than 200 or greater or equal to 400.
22472
- * @throws {Error} If network fails.
22473
- *
22474
- * @return {JSON}
22475
- */
22476
-
22477
- function getJSON(url) {
22478
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22479
- return new Promise(function (resolve, reject) {
22480
- var request = Object.assign(new XMLHttpRequest(), {
22481
- onreadystatechange: function onreadystatechange() {
22482
- if (request.readyState === 4) {
22483
- if (request.status >= 200 && request.status < 400) resolve(JSON.parse(request.responseText));else reject(new Error(request.statusText));
22484
- }
22485
- },
22486
- onerror: function onerror() {
22487
- reject(new Error('Network error'));
22488
- }
22489
- });
22490
- request.open('GET', url, true);
22491
- setXHRHeaders(request, options.headers);
22492
- request.send();
22493
- });
22494
- }
22495
- /**
22496
- * Returns an XHR object with attached headers.
22497
- * @ignore
22498
- *
22499
- * @param {XMLHttpRequest} xhr - The XHR request to set headers to.
22500
- * @param {Object} headers - The headers to set.
22501
- *
22502
- * @return {XMLHttpRequest}
22503
- */
22504
-
22505
- function setXHRHeaders(xhr) {
22506
- var headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22507
-
22508
- for (var header in headers) {
22509
- xhr.setRequestHeader(header, headers[header]);
22510
- }
22511
-
22512
- return xhr;
22513
- }
22514
- /**
22515
- * Returns whether a value is undefined.
22516
- * @ignore
22517
- *
22518
- * @param {} value - The value to test.
22519
- *
22520
- * @return {Boolean}
22521
- */
22522
-
22523
- function isUndefined(value) {
22524
- return typeof value === 'undefined';
22525
- }
22526
- /**
22527
- * Returns an object flattened to one level deep.
22528
- * @ignore
22529
- *
22530
- * @param {Object} object - The object to flatten.
22531
- * @param {String} separator - The separator to use between flattened nodes.
22532
- *
22533
- * @return {Object}
22534
- */
22535
-
22536
- function flattenObject(object) {
22537
- var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.';
22538
- var finalObject = {};
22539
- Object.entries(object).forEach(function (item) {
22540
- if (_typeof(item[1]) === 'object') {
22541
- var flatObject = flattenObject(item[1]);
22542
- Object.entries(flatObject).forEach(function (node) {
22543
- finalObject[item[0] + separator + node[0]] = node[1];
22544
- });
22545
- } else {
22546
- finalObject[item[0]] = item[1];
22547
- }
22548
- });
22549
- return finalObject;
22550
- }
22551
- /**
22552
- * Returns whether a value is thenable.
22553
- * @ignore
22554
- *
22555
- * @param {} value - The value to test.
22556
- *
22557
- * @return {Boolean}
22558
- */
22559
-
22560
- function isThenable(value) {
22561
- return Boolean(value) && (_typeof(value) === 'object' || typeof value === 'function') && typeof value.then === 'function';
22562
- }
22563
-
22564
- function Calculator() {
22565
- var floatMultiply = function floatMultiply(a, b) {
22566
- var getFactor = function getFactor(number) {
22567
- return Math.pow(10, countFractionDigits(number));
22568
- };
22569
-
22570
- var factor = Math.max(getFactor(a), getFactor(b));
22571
- return Math.round(a * factor) * Math.round(b * factor) / (factor * factor);
22572
- };
22573
-
22574
- var roundingModes = {
22575
- HALF_ODD: function HALF_ODD(number) {
22576
- var rounded = Math.round(number);
22577
- return isHalf(number) ? isEven(rounded) ? rounded - 1 : rounded : rounded;
22578
- },
22579
- HALF_EVEN: function HALF_EVEN(number) {
22580
- var rounded = Math.round(number);
22581
- return isHalf(number) ? isEven(rounded) ? rounded : rounded - 1 : rounded;
22582
- },
22583
- HALF_UP: function HALF_UP(number) {
22584
- return Math.round(number);
22585
- },
22586
- HALF_DOWN: function HALF_DOWN(number) {
22587
- return isHalf(number) ? Math.floor(number) : Math.round(number);
22588
- },
22589
- HALF_TOWARDS_ZERO: function HALF_TOWARDS_ZERO(number) {
22590
- return isHalf(number) ? Math.sign(number) * Math.floor(Math.abs(number)) : Math.round(number);
22591
- },
22592
- HALF_AWAY_FROM_ZERO: function HALF_AWAY_FROM_ZERO(number) {
22593
- return isHalf(number) ? Math.sign(number) * Math.ceil(Math.abs(number)) : Math.round(number);
22594
- },
22595
- DOWN: function DOWN(number) {
22596
- return Math.floor(number);
22597
- }
22598
- };
22599
- return {
22600
- /**
22601
- * Returns the sum of two numbers.
22602
- * @ignore
22603
- *
22604
- * @param {Number} a - The first number to add.
22605
- * @param {Number} b - The second number to add.
22606
- *
22607
- * @return {Number}
22608
- */
22609
- add: function add(a, b) {
22610
- return a + b;
22611
- },
22612
-
22613
- /**
22614
- * Returns the difference of two numbers.
22615
- * @ignore
22616
- *
22617
- * @param {Number} a - The first number to subtract.
22618
- * @param {Number} b - The second number to subtract.
22619
- *
22620
- * @return {Number}
22621
- */
22622
- subtract: function subtract(a, b) {
22623
- return a - b;
22624
- },
22625
-
22626
- /**
22627
- * Returns the product of two numbers.
22628
- * @ignore
22629
- *
22630
- * @param {Number} a - The first number to multiply.
22631
- * @param {Number} b - The second number to multiply.
22632
- *
22633
- * @return {Number}
22634
- */
22635
- multiply: function multiply(a, b) {
22636
- return isFloat(a) || isFloat(b) ? floatMultiply(a, b) : a * b;
22637
- },
22638
-
22639
- /**
22640
- * Returns the quotient of two numbers.
22641
- * @ignore
22642
- *
22643
- * @param {Number} a - The first number to divide.
22644
- * @param {Number} b - The second number to divide.
22645
- *
22646
- * @return {Number}
22647
- */
22648
- divide: function divide(a, b) {
22649
- return a / b;
22650
- },
22651
-
22652
- /**
22653
- * Returns the remainder of two numbers.
22654
- * @ignore
22655
- *
22656
- * @param {Number} a - The first number to divide.
22657
- * @param {Number} b - The second number to divide.
22658
- *
22659
- * @return {Number}
22660
- */
22661
- modulo: function modulo(a, b) {
22662
- return a % b;
22663
- },
22664
-
22665
- /**
22666
- * Returns a rounded number based off a specific rounding mode.
22667
- * @ignore
22668
- *
22669
- * @param {Number} number - The number to round.
22670
- * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use.
22671
- *
22672
- * @returns {Number}
22673
- */
22674
- round: function round(number) {
22675
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'HALF_EVEN';
22676
- return roundingModes[roundingMode](number);
22677
- }
22678
- };
22679
- }
22680
-
22681
- var calculator = Calculator();
22682
- function Format(format) {
22683
- var matches = /^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(format);
22684
- return {
22685
- /**
22686
- * Returns the matches.
22687
- * @ignore
22688
- *
22689
- * @return {Array}
22690
- */
22691
- getMatches: function getMatches() {
22692
- return matches !== null ? matches.slice(1).filter(function (match) {
22693
- return !isUndefined(match);
22694
- }) : [];
22695
- },
22696
-
22697
- /**
22698
- * Returns the amount of fraction digits to display.
22699
- * @ignore
22700
- *
22701
- * @return {Number}
22702
- */
22703
- getMinimumFractionDigits: function getMinimumFractionDigits() {
22704
- var decimalPosition = function decimalPosition(match) {
22705
- return match === '.';
22706
- };
22707
-
22708
- return !isUndefined(this.getMatches().find(decimalPosition)) ? this.getMatches()[calculator.add(this.getMatches().findIndex(decimalPosition), 1)].split('').length : 0;
22709
- },
22710
-
22711
- /**
22712
- * Returns the currency display mode.
22713
- * @ignore
22714
- *
22715
- * @return {String}
22716
- */
22717
- getCurrencyDisplay: function getCurrencyDisplay() {
22718
- var modes = {
22719
- USD: 'code',
22720
- dollar: 'name',
22721
- $: 'symbol'
22722
- };
22723
- return modes[this.getMatches().find(function (match) {
22724
- return match === 'USD' || match === 'dollar' || match === '$';
22725
- })];
22726
- },
22727
-
22728
- /**
22729
- * Returns the formatting style.
22730
- * @ignore
22731
- *
22732
- * @return {String}
22733
- */
22734
- getStyle: function getStyle() {
22735
- return !isUndefined(this.getCurrencyDisplay(this.getMatches())) ? 'currency' : 'decimal';
22736
- },
22737
-
22738
- /**
22739
- * Returns whether grouping should be used or not.
22740
- * @ignore
22741
- *
22742
- * @return {Boolean}
22743
- */
22744
- getUseGrouping: function getUseGrouping() {
22745
- return !isUndefined(this.getMatches().find(function (match) {
22746
- return match === ',';
22747
- }));
22748
- }
22749
- };
22750
- }
22751
-
22752
- function CurrencyConverter(options) {
22753
- /* istanbul ignore next */
22754
- var mergeTags = function mergeTags() {
22755
- var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
22756
- var tags = arguments.length > 1 ? arguments[1] : undefined;
22757
-
22758
- for (var tag in tags) {
22759
- string = string.replace("{{".concat(tag, "}}"), tags[tag]);
22760
- }
22761
-
22762
- return string;
22763
- };
22764
- /* istanbul ignore next */
22765
-
22766
-
22767
- var getRatesFromRestApi = function getRatesFromRestApi(from, to) {
22768
- return getJSON(mergeTags(options.endpoint, {
22769
- from: from,
22770
- to: to
22771
- }), {
22772
- headers: options.headers
22773
- });
22774
- };
22775
-
22776
- return {
22777
- /**
22778
- * Returns the exchange rate.
22779
- * @ignore
22780
- *
22781
- * @param {String} from - The base currency.
22782
- * @param {String} to - The destination currency.
22783
- *
22784
- * @return {Promise}
22785
- */
22786
- getExchangeRate: function getExchangeRate(from, to) {
22787
- return (isThenable(options.endpoint) ? options.endpoint : getRatesFromRestApi(from, to)).then(function (data) {
22788
- return flattenObject(data)[mergeTags(options.propertyPath, {
22789
- from: from,
22790
- to: to
22791
- })];
22792
- });
22793
- }
22794
- };
22795
- }
22796
-
22797
- /**
22798
- * Performs an assertion.
22799
- * @ignore
22800
- *
22801
- * @param {Boolean} condition - The expression to assert.
22802
- * @param {String} errorMessage - The message to throw if the assertion fails
22803
- * @param {ErrorConstructor} [ErrorType=Error] - The error to throw if the assertion fails.
22804
- *
22805
- * @throws {Error} If `condition` returns `false`.
22806
- */
22807
-
22808
- function assert(condition, errorMessage) {
22809
- var ErrorType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Error;
22810
- if (!condition) throw new ErrorType(errorMessage);
22811
- }
22812
- /**
22813
- * Asserts a value is a percentage.
22814
- * @ignore
22815
- *
22816
- * @param {} percentage - The percentage to test.
22817
- *
22818
- * @throws {RangeError} If `percentage` is out of range.
22819
- */
22820
-
22821
- function assertPercentage(percentage) {
22822
- assert(isPercentage(percentage), 'You must provide a numeric value between 0 and 100.', RangeError);
22823
- }
22824
- /**
22825
- * Asserts an array of ratios is valid.
22826
- * @ignore
22827
- *
22828
- * @param {} ratios - The ratios to test.
22829
- *
22830
- * @throws {TypeError} If `ratios` are invalid.
22831
- */
22832
-
22833
- function assertValidRatios(ratios) {
22834
- assert(areValidRatios(ratios), 'You must provide a non-empty array of numeric values greater than 0.', TypeError);
22835
- }
22836
- /**
22837
- * Asserts a value is an integer.
22838
- * @ignore
22839
- *
22840
- * @param {} number - The value to test.
22841
- *
22842
- * @throws {TypeError}
22843
- */
22844
-
22845
- function assertInteger(number) {
22846
- assert(Number.isInteger(number), 'You must provide an integer.', TypeError);
22847
- }
22848
-
22849
- var calculator$1 = Calculator();
22850
- /**
22851
- * A Dinero object is an immutable data structure representing a specific monetary value.
22852
- * It comes with methods for creating, parsing, manipulating, testing, transforming and formatting them.
22853
- *
22854
- * A Dinero object has:
22855
- *
22856
- * * An `amount`, expressed in minor currency units, as an integer.
22857
- * * A `currency`, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.
22858
- * * A `precision`, expressed as an integer, to represent the number of decimal places in the `amount`.
22859
- * This is helpful when you want to represent fractional minor currency units (e.g.: $10.4545).
22860
- * 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`)).
22861
- * * An optional `locale` property that affects how output strings are formatted.
22862
- *
22863
- * Here's an overview of the public API:
22864
- *
22865
- * * **Access:** {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~getCurrency getCurrency}, {@link module:Dinero~getLocale getLocale} and {@link module:Dinero~getPrecision getPrecision}.
22866
- * * **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}.
22867
- * * **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}.
22868
- * * **Configuration:** {@link module:Dinero~setLocale setLocale}.
22869
- * * **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}.
22870
- *
22871
- * 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.
22872
- * Same goes with performing calculations: once the internal `amount` value exceeds those limits, precision is no longer guaranteed.
22873
- *
22874
- * @module Dinero
22875
- * @param {Number} [options.amount=0] - The amount in minor currency units (as an integer).
22876
- * @param {String} [options.currency='USD'] - An ISO 4217 currency code.
22877
- * @param {String} [options.precision=2] - The number of decimal places to represent.
22878
- *
22879
- * @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.
22880
- *
22881
- * @return {Object}
22882
- */
22883
-
22884
- var Dinero = function Dinero(options) {
22885
- var _Object$assign = Object.assign({}, {
22886
- amount: Dinero.defaultAmount,
22887
- currency: Dinero.defaultCurrency,
22888
- precision: Dinero.defaultPrecision
22889
- }, options),
22890
- amount = _Object$assign.amount,
22891
- currency = _Object$assign.currency,
22892
- precision = _Object$assign.precision;
22893
-
22894
- assertInteger(amount);
22895
- assertInteger(precision);
22896
- var globalLocale = Dinero.globalLocale,
22897
- globalFormat = Dinero.globalFormat,
22898
- globalRoundingMode = Dinero.globalRoundingMode,
22899
- globalFormatRoundingMode = Dinero.globalFormatRoundingMode;
22900
- var globalExchangeRatesApi = Object.assign({}, Dinero.globalExchangeRatesApi);
22901
- /**
22902
- * Uses ES5 function notation so `this` can be passed through call, apply and bind
22903
- * @ignore
22904
- */
22905
-
22906
- var create = function create(options) {
22907
- var obj = Object.assign({}, Object.assign({}, {
22908
- amount: amount,
22909
- currency: currency,
22910
- precision: precision
22911
- }, options), Object.assign({}, {
22912
- locale: this.locale
22913
- }, options));
22914
- return Object.assign(Dinero({
22915
- amount: obj.amount,
22916
- currency: obj.currency,
22917
- precision: obj.precision
22918
- }), {
22919
- locale: obj.locale
22920
- });
22921
- };
22922
- /**
22923
- * Uses ES5 function notation so `this` can be passed through call, apply and bind
22924
- * @ignore
22925
- */
22926
-
22927
-
22928
- var assertSameCurrency = function assertSameCurrency(comparator) {
22929
- assert(this.hasSameCurrency(comparator), 'You must provide a Dinero instance with the same currency.', TypeError);
22930
- };
22931
-
22932
- return {
22933
- /**
22934
- * Returns the amount.
22935
- *
22936
- * @example
22937
- * // returns 500
22938
- * Dinero({ amount: 500 }).getAmount()
22939
- *
22940
- * @return {Number}
22941
- */
22942
- getAmount: function getAmount() {
22943
- return amount;
22944
- },
22945
-
22946
- /**
22947
- * Returns the currency.
22948
- *
22949
- * @example
22950
- * // returns 'EUR'
22951
- * Dinero({ currency: 'EUR' }).getCurrency()
22952
- *
22953
- * @return {String}
22954
- */
22955
- getCurrency: function getCurrency() {
22956
- return currency;
22957
- },
22958
-
22959
- /**
22960
- * Returns the locale.
22961
- *
22962
- * @example
22963
- * // returns 'fr-FR'
22964
- * Dinero().setLocale('fr-FR').getLocale()
22965
- *
22966
- * @return {String}
22967
- */
22968
- getLocale: function getLocale() {
22969
- return this.locale || globalLocale;
22970
- },
22971
-
22972
- /**
22973
- * Returns a new Dinero object with an embedded locale.
22974
- *
22975
- * @param {String} newLocale - The new locale as an {@link http://tools.ietf.org/html/rfc5646 BCP 47 language tag}.
22976
- *
22977
- * @example
22978
- * // Returns a Dinero object with locale 'ja-JP'
22979
- * Dinero().setLocale('ja-JP')
22980
- *
22981
- * @return {Dinero}
22982
- */
22983
- setLocale: function setLocale(newLocale) {
22984
- return create.call(this, {
22985
- locale: newLocale
22986
- });
22987
- },
22988
-
22989
- /**
22990
- * Returns the precision.
22991
- *
22992
- * @example
22993
- * // returns 3
22994
- * Dinero({ precision: 3 }).getPrecision()
22995
- *
22996
- * @return {Number}
22997
- */
22998
- getPrecision: function getPrecision() {
22999
- return precision;
23000
- },
23001
-
23002
- /**
23003
- * Returns a new Dinero object with a new precision and a converted amount.
23004
- *
23005
- * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
23006
- * This can be necessary when you need to convert objects to a smaller precision.
23007
- *
23008
- * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent conversions for safer results.
23009
- * You can also specify a different `roundingMode` to better fit your needs.
23010
- *
23011
- * @param {Number} newPrecision - The new precision.
23012
- * @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'`.
23013
- *
23014
- * @example
23015
- * // Returns a Dinero object with precision 3 and amount 1000
23016
- * Dinero({ amount: 100, precision: 2 }).convertPrecision(3)
23017
- *
23018
- * @throws {TypeError} If `newPrecision` is invalid.
23019
- *
23020
- * @return {Dinero}
23021
- */
23022
- convertPrecision: function convertPrecision(newPrecision) {
23023
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
23024
- assertInteger(newPrecision);
23025
- var precision = this.getPrecision();
23026
- var isNewPrecisionLarger = newPrecision > precision;
23027
- var operation = isNewPrecisionLarger ? calculator$1.multiply : calculator$1.divide;
23028
- var terms = isNewPrecisionLarger ? [newPrecision, precision] : [precision, newPrecision];
23029
- var factor = Math.pow(10, calculator$1.subtract.apply(calculator$1, terms));
23030
- return create.call(this, {
23031
- amount: calculator$1.round(operation(this.getAmount(), factor), roundingMode),
23032
- precision: newPrecision
23033
- });
23034
- },
23035
-
23036
- /**
23037
- * Returns a new Dinero object that represents the sum of this and an other Dinero object.
23038
- *
23039
- * If Dinero objects have a different `precision`, they will be first converted to the highest.
23040
- *
23041
- * @param {Dinero} addend - The Dinero object to add.
23042
- *
23043
- * @example
23044
- * // returns a Dinero object with amount 600
23045
- * Dinero({ amount: 400 }).add(Dinero({ amount: 200 }))
23046
- * @example
23047
- * // returns a Dinero object with amount 144545 and precision 4
23048
- * Dinero({ amount: 400 }).add(Dinero({ amount: 104545, precision: 4 }))
23049
- *
23050
- * @throws {TypeError} If `addend` has a different currency.
23051
- *
23052
- * @return {Dinero}
23053
- */
23054
- add: function add(addend) {
23055
- assertSameCurrency.call(this, addend);
23056
- var addends = Dinero.normalizePrecision([this, addend]);
23057
- return create.call(this, {
23058
- amount: calculator$1.add(addends[0].getAmount(), addends[1].getAmount()),
23059
- precision: addends[0].getPrecision()
23060
- });
23061
- },
23062
-
23063
- /**
23064
- * Returns a new Dinero object that represents the difference of this and an other Dinero object.
23065
- *
23066
- * If Dinero objects have a different `precision`, they will be first converted to the highest.
23067
- *
23068
- * @param {Dinero} subtrahend - The Dinero object to subtract.
23069
- *
23070
- * @example
23071
- * // returns a Dinero object with amount 200
23072
- * Dinero({ amount: 400 }).subtract(Dinero({ amount: 200 }))
23073
- * @example
23074
- * // returns a Dinero object with amount 64545 and precision 4
23075
- * Dinero({ amount: 104545, precision: 4 }).subtract(Dinero({ amount: 400 }))
23076
- *
23077
- * @throws {TypeError} If `subtrahend` has a different currency.
23078
- *
23079
- * @return {Dinero}
23080
- */
23081
- subtract: function subtract(subtrahend) {
23082
- assertSameCurrency.call(this, subtrahend);
23083
- var subtrahends = Dinero.normalizePrecision([this, subtrahend]);
23084
- return create.call(this, {
23085
- amount: calculator$1.subtract(subtrahends[0].getAmount(), subtrahends[1].getAmount()),
23086
- precision: subtrahends[0].getPrecision()
23087
- });
23088
- },
23089
-
23090
- /**
23091
- * Returns a new Dinero object that represents the multiplied value by the given factor.
23092
- *
23093
- * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
23094
- *
23095
- * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
23096
- * You can also specify a different `roundingMode` to better fit your needs.
23097
- *
23098
- * @param {Number} multiplier - The factor to multiply by.
23099
- * @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'`.
23100
- *
23101
- * @example
23102
- * // returns a Dinero object with amount 1600
23103
- * Dinero({ amount: 400 }).multiply(4)
23104
- * @example
23105
- * // returns a Dinero object with amount 800
23106
- * Dinero({ amount: 400 }).multiply(2.001)
23107
- * @example
23108
- * // returns a Dinero object with amount 801
23109
- * Dinero({ amount: 400 }).multiply(2.00125, 'HALF_UP')
23110
- *
23111
- * @return {Dinero}
23112
- */
23113
- multiply: function multiply(multiplier) {
23114
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
23115
- return create.call(this, {
23116
- amount: calculator$1.round(calculator$1.multiply(this.getAmount(), multiplier), roundingMode)
23117
- });
23118
- },
23119
-
23120
- /**
23121
- * Returns a new Dinero object that represents the divided value by the given factor.
23122
- *
23123
- * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
23124
- *
23125
- * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
23126
- * You can also specify a different `roundingMode` to better fit your needs.
23127
- *
23128
- * 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.
23129
- *
23130
- * @param {Number} divisor - The factor to divide by.
23131
- * @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'`.
23132
- *
23133
- * @example
23134
- * // returns a Dinero object with amount 100
23135
- * Dinero({ amount: 400 }).divide(4)
23136
- * @example
23137
- * // returns a Dinero object with amount 52
23138
- * Dinero({ amount: 105 }).divide(2)
23139
- * @example
23140
- * // returns a Dinero object with amount 53
23141
- * Dinero({ amount: 105 }).divide(2, 'HALF_UP')
23142
- *
23143
- * @return {Dinero}
23144
- */
23145
- divide: function divide(divisor) {
23146
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
23147
- return create.call(this, {
23148
- amount: calculator$1.round(calculator$1.divide(this.getAmount(), divisor), roundingMode)
23149
- });
23150
- },
23151
-
23152
- /**
23153
- * Returns a new Dinero object that represents a percentage of this.
23154
- *
23155
- * 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.
23156
- *
23157
- * @param {Number} percentage - The percentage to extract (between 0 and 100).
23158
- * @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'`.
23159
- *
23160
- * @example
23161
- * // returns a Dinero object with amount 5000
23162
- * Dinero({ amount: 10000 }).percentage(50)
23163
- * @example
23164
- * // returns a Dinero object with amount 29
23165
- * Dinero({ amount: 57 }).percentage(50, "HALF_ODD")
23166
- *
23167
- * @throws {RangeError} If `percentage` is out of range.
23168
- *
23169
- * @return {Dinero}
23170
- */
23171
- percentage: function percentage(_percentage) {
23172
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
23173
- assertPercentage(_percentage);
23174
- return this.multiply(calculator$1.divide(_percentage, 100), roundingMode);
23175
- },
23176
-
23177
- /**
23178
- * Allocates the amount of a Dinero object according to a list of ratios.
23179
- *
23180
- * Sometimes you need to split monetary values but percentages can't cut it without adding or losing pennies.
23181
- * A good example is invoicing: let's say you need to bill $1,000.03 and you want a 50% downpayment.
23182
- * 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.
23183
- * If you round it, you'll bill a penny extra.
23184
- * With {@link module:Dinero~allocate allocate}, you can split a monetary amount then distribute the remainder as evenly as possible.
23185
- *
23186
- * You can use percentage style or ratio style for `ratios`: `[25, 75]` and `[1, 3]` will do the same thing.
23187
- *
23188
- * 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.
23189
- *
23190
- * @param {Number[]} ratios - The ratios to allocate the money to.
23191
- *
23192
- * @example
23193
- * // returns an array of two Dinero objects
23194
- * // the first one with an amount of 502
23195
- * // the second one with an amount of 501
23196
- * Dinero({ amount: 1003 }).allocate([50, 50])
23197
- * @example
23198
- * // returns an array of two Dinero objects
23199
- * // the first one with an amount of 25
23200
- * // the second one with an amount of 75
23201
- * Dinero({ amount: 100 }).allocate([1, 3])
23202
- * @example
23203
- * // since version 1.8.0
23204
- * // returns an array of three Dinero objects
23205
- * // the first one with an amount of 0
23206
- * // the second one with an amount of 502
23207
- * // the third one with an amount of 501
23208
- * Dinero({ amount: 1003 }).allocate([0, 50, 50])
23209
- *
23210
- * @throws {TypeError} If ratios are invalid.
23211
- *
23212
- * @return {Dinero[]}
23213
- */
23214
- allocate: function allocate(ratios) {
23215
- var _this = this;
23216
-
23217
- assertValidRatios(ratios);
23218
- var total = ratios.reduce(function (a, b) {
23219
- return calculator$1.add(a, b);
23220
- });
23221
- var remainder = this.getAmount();
23222
- var shares = ratios.map(function (ratio) {
23223
- var share = Math.floor(calculator$1.divide(calculator$1.multiply(_this.getAmount(), ratio), total));
23224
- remainder = calculator$1.subtract(remainder, share);
23225
- return create.call(_this, {
23226
- amount: share
23227
- });
23228
- });
23229
- var i = 0;
23230
-
23231
- while (remainder > 0) {
23232
- if (ratios[i] > 0) {
23233
- shares[i] = shares[i].add(create.call(this, {
23234
- amount: 1
23235
- }));
23236
- remainder = calculator$1.subtract(remainder, 1);
23237
- }
23238
-
23239
- i += 1;
23240
- }
23241
-
23242
- return shares;
23243
- },
23244
-
23245
- /**
23246
- * Returns a Promise containing a new Dinero object converted to another currency.
23247
- *
23248
- * You have two options to provide the exchange rates:
23249
- *
23250
- * 1. **Use an exchange rate REST API, and let Dinero handle the fetching and conversion.**
23251
- * This is a simple option if you have access to an exchange rate REST API and want Dinero to do the rest.
23252
- * 2. **Fetch the exchange rates on your own and provide them directly.**
23253
- * 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.
23254
- *
23255
- * **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.
23256
- *
23257
- * Here are some exchange rate APIs you can use:
23258
- *
23259
- * * [Fixer](https://fixer.io)
23260
- * * [Open Exchange Rates](https://openexchangerates.org)
23261
- * * [Coinbase](https://api.coinbase.com/v2/exchange-rates)
23262
- * * More [foreign](https://github.com/toddmotto/public-apis#currency-exchange) and [crypto](https://github.com/toddmotto/public-apis#cryptocurrency) exchange rate APIs.
23263
- *
23264
- * **If you want to fetch your own rates and provide them directly**, you need to pass a promise that resolves to the exchanges rates.
23265
- *
23266
- * In both cases, you need to specify at least:
23267
- *
23268
- * * a **destination currency**: the currency in which you want to convert your Dinero object. You can specify it with `currency`.
23269
- * * 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`.
23270
- * * 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:
23271
- * ```json
23272
- * {
23273
- * "data": {
23274
- * "base": "USD",
23275
- * "destination": "EUR",
23276
- * "rate": "0.827728919"
23277
- * }
23278
- * }
23279
- * ```
23280
- * Then the property path is `'data.rate'`. You can specify it with `options.propertyPath`.
23281
- *
23282
- * 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}}`.
23283
- * You can use these tags to refer to these values in `options.endpoint` and `options.propertyPath`.
23284
- *
23285
- * For example, if you need to specify the base currency as a query parameter, you can do the following:
23286
- *
23287
- * ```js
23288
- * {
23289
- * endpoint: 'https://yourexchangerates.api/latest?base={{from}}'
23290
- * }
23291
- * ```
23292
- *
23293
- * @param {String} currency - The destination currency, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.
23294
- * @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.
23295
- * @param {String} [options.propertyPath='rates.{{to}}'] - The property path to the rate.
23296
- * @param {Object} [options.headers] - The HTTP headers to provide, if needed.
23297
- * @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'`.
23298
- *
23299
- * @example
23300
- * // your global API parameters
23301
- * Dinero.globalExchangeRatesApi = { ... }
23302
- *
23303
- * // returns a Promise containing a Dinero object with the destination currency
23304
- * // and the initial amount converted to the new currency.
23305
- * Dinero({ amount: 500 }).convert('EUR')
23306
- * @example
23307
- * // returns a Promise containing a Dinero object,
23308
- * // with specific API parameters and rounding mode for this specific instance.
23309
- * Dinero({ amount: 500 })
23310
- * .convert('XBT', {
23311
- * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',
23312
- * propertyPath: 'data.rates.{{to}}',
23313
- * headers: {
23314
- * 'user-key': 'xxxxxxxxx'
23315
- * },
23316
- * roundingMode: 'HALF_UP'
23317
- * })
23318
- * @example
23319
- * // usage with exchange rates provided as a custom promise
23320
- * // using the default `propertyPath` format (so it doesn't have to be specified)
23321
- * const rates = {
23322
- * rates: {
23323
- * EUR: 0.81162
23324
- * }
23325
- * }
23326
- *
23327
- * Dinero({ amount: 500 })
23328
- * .convert('EUR', {
23329
- * endpoint: new Promise(resolve => resolve(rates))
23330
- * })
23331
- * @example
23332
- * // usage with Promise.prototype.then and Promise.prototype.catch
23333
- * Dinero({ amount: 500 })
23334
- * .convert('EUR')
23335
- * .then(dinero => {
23336
- * dinero.getCurrency() // returns 'EUR'
23337
- * })
23338
- * .catch(err => {
23339
- * // handle errors
23340
- * })
23341
- * @example
23342
- * // usage with async/await
23343
- * (async () => {
23344
- * const price = await Dinero({ amount: 500 }).convert('EUR')
23345
- * price.getCurrency() // returns 'EUR'
23346
- * })()
23347
- *
23348
- * @return {Promise}
23349
- */
23350
- convert: function convert(currency) {
23351
- var _this2 = this;
23352
-
23353
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
23354
- _ref$endpoint = _ref.endpoint,
23355
- endpoint = _ref$endpoint === void 0 ? globalExchangeRatesApi.endpoint : _ref$endpoint,
23356
- _ref$propertyPath = _ref.propertyPath,
23357
- propertyPath = _ref$propertyPath === void 0 ? globalExchangeRatesApi.propertyPath || 'rates.{{to}}' : _ref$propertyPath,
23358
- _ref$headers = _ref.headers,
23359
- headers = _ref$headers === void 0 ? globalExchangeRatesApi.headers : _ref$headers,
23360
- _ref$roundingMode = _ref.roundingMode,
23361
- roundingMode = _ref$roundingMode === void 0 ? globalRoundingMode : _ref$roundingMode;
23362
-
23363
- var options = Object.assign({}, {
23364
- endpoint: endpoint,
23365
- propertyPath: propertyPath,
23366
- headers: headers,
23367
- roundingMode: roundingMode
23368
- });
23369
- return CurrencyConverter(options).getExchangeRate(this.getCurrency(), currency).then(function (rate) {
23370
- assert(!isUndefined(rate), "No rate was found for the destination currency \"".concat(currency, "\"."), TypeError);
23371
- return create.call(_this2, {
23372
- amount: calculator$1.round(calculator$1.multiply(_this2.getAmount(), parseFloat(rate)), options.roundingMode),
23373
- currency: currency
23374
- });
23375
- });
23376
- },
23377
-
23378
- /**
23379
- * Checks whether the value represented by this object equals to the other.
23380
- *
23381
- * @param {Dinero} comparator - The Dinero object to compare to.
23382
- *
23383
- * @example
23384
- * // returns true
23385
- * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))
23386
- * @example
23387
- * // returns false
23388
- * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))
23389
- * @example
23390
- * // returns false
23391
- * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))
23392
- * @example
23393
- * // returns false
23394
- * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))
23395
- * @example
23396
- * // returns true
23397
- * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))
23398
- * @example
23399
- * // returns false
23400
- * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))
23401
- *
23402
- * @return {Boolean}
23403
- */
23404
- equalsTo: function equalsTo(comparator) {
23405
- return this.hasSameAmount(comparator) && this.hasSameCurrency(comparator);
23406
- },
23407
-
23408
- /**
23409
- * Checks whether the value represented by this object is less than the other.
23410
- *
23411
- * @param {Dinero} comparator - The Dinero object to compare to.
23412
- *
23413
- * @example
23414
- * // returns true
23415
- * Dinero({ amount: 500 }).lessThan(Dinero({ amount: 800 }))
23416
- * @example
23417
- * // returns false
23418
- * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 500 }))
23419
- * @example
23420
- * // returns true
23421
- * Dinero({ amount: 5000, precision: 3 }).lessThan(Dinero({ amount: 800 }))
23422
- * @example
23423
- * // returns false
23424
- * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 5000, precision: 3 }))
23425
- *
23426
- * @throws {TypeError} If `comparator` has a different currency.
23427
- *
23428
- * @return {Boolean}
23429
- */
23430
- lessThan: function lessThan(comparator) {
23431
- assertSameCurrency.call(this, comparator);
23432
- var comparators = Dinero.normalizePrecision([this, comparator]);
23433
- return comparators[0].getAmount() < comparators[1].getAmount();
23434
- },
23435
-
23436
- /**
23437
- * Checks whether the value represented by this object is less than or equal to the other.
23438
- *
23439
- * @param {Dinero} comparator - The Dinero object to compare to.
23440
- *
23441
- * @example
23442
- * // returns true
23443
- * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 800 }))
23444
- * @example
23445
- * // returns true
23446
- * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 500 }))
23447
- * @example
23448
- * // returns false
23449
- * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 300 }))
23450
- * @example
23451
- * // returns true
23452
- * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 800 }))
23453
- * @example
23454
- * // returns true
23455
- * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 500 }))
23456
- * @example
23457
- * // returns false
23458
- * Dinero({ amount: 800 }).lessThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
23459
- *
23460
- * @throws {TypeError} If `comparator` has a different currency.
23461
- *
23462
- * @return {Boolean}
23463
- */
23464
- lessThanOrEqual: function lessThanOrEqual(comparator) {
23465
- assertSameCurrency.call(this, comparator);
23466
- var comparators = Dinero.normalizePrecision([this, comparator]);
23467
- return comparators[0].getAmount() <= comparators[1].getAmount();
23468
- },
23469
-
23470
- /**
23471
- * Checks whether the value represented by this object is greater than the other.
23472
- *
23473
- * @param {Dinero} comparator - The Dinero object to compare to.
23474
- *
23475
- * @example
23476
- * // returns false
23477
- * Dinero({ amount: 500 }).greaterThan(Dinero({ amount: 800 }))
23478
- * @example
23479
- * // returns true
23480
- * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 500 }))
23481
- * @example
23482
- * // returns true
23483
- * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 5000, precision: 3 }))
23484
- * @example
23485
- * // returns false
23486
- * Dinero({ amount: 5000, precision: 3 }).greaterThan(Dinero({ amount: 800 }))
23487
- *
23488
- * @throws {TypeError} If `comparator` has a different currency.
23489
- *
23490
- * @return {Boolean}
23491
- */
23492
- greaterThan: function greaterThan(comparator) {
23493
- assertSameCurrency.call(this, comparator);
23494
- var comparators = Dinero.normalizePrecision([this, comparator]);
23495
- return comparators[0].getAmount() > comparators[1].getAmount();
23496
- },
23497
-
23498
- /**
23499
- * Checks whether the value represented by this object is greater than or equal to the other.
23500
- *
23501
- * @param {Dinero} comparator - The Dinero object to compare to.
23502
- *
23503
- * @example
23504
- * // returns true
23505
- * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 300 }))
23506
- * @example
23507
- * // returns true
23508
- * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 500 }))
23509
- * @example
23510
- * // returns false
23511
- * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 800 }))
23512
- * @example
23513
- * // returns true
23514
- * Dinero({ amount: 800 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
23515
- * @example
23516
- * // returns true
23517
- * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
23518
- * @example
23519
- * // returns false
23520
- * Dinero({ amount: 5000, precision: 3 }).greaterThanOrEqual(Dinero({ amount: 800 }))
23521
- *
23522
- * @throws {TypeError} If `comparator` has a different currency.
23523
- *
23524
- * @return {Boolean}
23525
- */
23526
- greaterThanOrEqual: function greaterThanOrEqual(comparator) {
23527
- assertSameCurrency.call(this, comparator);
23528
- var comparators = Dinero.normalizePrecision([this, comparator]);
23529
- return comparators[0].getAmount() >= comparators[1].getAmount();
23530
- },
23531
-
23532
- /**
23533
- * Checks if the value represented by this object is zero.
23534
- *
23535
- * @example
23536
- * // returns true
23537
- * Dinero({ amount: 0 }).isZero()
23538
- * @example
23539
- * // returns false
23540
- * Dinero({ amount: 100 }).isZero()
23541
- *
23542
- * @return {Boolean}
23543
- */
23544
- isZero: function isZero() {
23545
- return this.getAmount() === 0;
23546
- },
23547
-
23548
- /**
23549
- * Checks if the value represented by this object is positive.
23550
- *
23551
- * @example
23552
- * // returns false
23553
- * Dinero({ amount: -10 }).isPositive()
23554
- * @example
23555
- * // returns true
23556
- * Dinero({ amount: 10 }).isPositive()
23557
- * @example
23558
- * // returns true
23559
- * Dinero({ amount: 0 }).isPositive()
23560
- *
23561
- * @return {Boolean}
23562
- */
23563
- isPositive: function isPositive() {
23564
- return this.getAmount() >= 0;
23565
- },
23566
-
23567
- /**
23568
- * Checks if the value represented by this object is negative.
23569
- *
23570
- * @example
23571
- * // returns true
23572
- * Dinero({ amount: -10 }).isNegative()
23573
- * @example
23574
- * // returns false
23575
- * Dinero({ amount: 10 }).isNegative()
23576
- * @example
23577
- * // returns false
23578
- * Dinero({ amount: 0 }).isNegative()
23579
- *
23580
- * @return {Boolean}
23581
- */
23582
- isNegative: function isNegative() {
23583
- return this.getAmount() < 0;
23584
- },
23585
-
23586
- /**
23587
- * Checks if this has minor currency units.
23588
- * Deprecates {@link module:Dinero~hasCents hasCents}.
23589
- *
23590
- * @example
23591
- * // returns false
23592
- * Dinero({ amount: 1100 }).hasSubUnits()
23593
- * @example
23594
- * // returns true
23595
- * Dinero({ amount: 1150 }).hasSubUnits()
23596
- *
23597
- * @return {Boolean}
23598
- */
23599
- hasSubUnits: function hasSubUnits() {
23600
- return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;
23601
- },
23602
-
23603
- /**
23604
- * Checks if this has minor currency units.
23605
- *
23606
- * @deprecated since version 1.4.0, will be removed in 2.0.0
23607
- * Use {@link module:Dinero~hasSubUnits hasSubUnits} instead.
23608
- *
23609
- * @example
23610
- * // returns false
23611
- * Dinero({ amount: 1100 }).hasCents()
23612
- * @example
23613
- * // returns true
23614
- * Dinero({ amount: 1150 }).hasCents()
23615
- *
23616
- * @return {Boolean}
23617
- */
23618
- hasCents: function hasCents() {
23619
- return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;
23620
- },
23621
-
23622
- /**
23623
- * Checks whether the currency represented by this object equals to the other.
23624
- *
23625
- * @param {Dinero} comparator - The Dinero object to compare to.
23626
- *
23627
- * @example
23628
- * // returns true
23629
- * Dinero({ amount: 2000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'EUR' }))
23630
- * @example
23631
- * // returns false
23632
- * Dinero({ amount: 1000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'USD' }))
23633
- *
23634
- * @return {Boolean}
23635
- */
23636
- hasSameCurrency: function hasSameCurrency(comparator) {
23637
- return this.getCurrency() === comparator.getCurrency();
23638
- },
23639
-
23640
- /**
23641
- * Checks whether the amount represented by this object equals to the other.
23642
- *
23643
- * @param {Dinero} comparator - The Dinero object to compare to.
23644
- *
23645
- * @example
23646
- * // returns true
23647
- * Dinero({ amount: 1000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000 }))
23648
- * @example
23649
- * // returns false
23650
- * Dinero({ amount: 2000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000, currency: 'EUR' }))
23651
- * @example
23652
- * // returns true
23653
- * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))
23654
- * @example
23655
- * // returns false
23656
- * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))
23657
- *
23658
- * @return {Boolean}
23659
- */
23660
- hasSameAmount: function hasSameAmount(comparator) {
23661
- var comparators = Dinero.normalizePrecision([this, comparator]);
23662
- return comparators[0].getAmount() === comparators[1].getAmount();
23663
- },
23664
-
23665
- /**
23666
- * Returns this object formatted as a string.
23667
- *
23668
- * The format is a mask which defines how the output string will be formatted.
23669
- * It defines whether to display a currency, in what format, how many fraction digits to display and whether to use grouping separators.
23670
- * The output is formatted according to the applying locale.
23671
- *
23672
- * Object | Format | String
23673
- * :--------------------------- | :---------------- | :---
23674
- * `Dinero({ amount: 500050 })` | `'$0,0.00'` | $5,000.50
23675
- * `Dinero({ amount: 500050 })` | `'$0,0'` | $5,001
23676
- * `Dinero({ amount: 500050 })` | `'$0'` | $5001
23677
- * `Dinero({ amount: 500050 })` | `'$0.0'` | $5000.5
23678
- * `Dinero({ amount: 500050 })` | `'USD0,0.0'` | USD5,000.5
23679
- * `Dinero({ amount: 500050 })` | `'0,0.0 dollar'` | 5,000.5 dollars
23680
- *
23681
- * 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.
23682
- * The format is a mask which defines a pattern and returns a valid, localized currency string.
23683
- * 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.
23684
- *
23685
- * {@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**.
23686
- *
23687
- * You can also use `toLocaleString` directly:
23688
- * `Dinero().toRoundedUnit(digits, roundingMode).toLocaleString(locale, options)`.
23689
- *
23690
- * 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)).
23691
- * You can also specify a different `roundingMode` to better fit your needs.
23692
- *
23693
- * @param {String} [format='$0,0.00'] - The format mask to format to.
23694
- * @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'`.
23695
- *
23696
- * @example
23697
- * // returns $2,000
23698
- * Dinero({ amount: 200000 }).toFormat('$0,0')
23699
- * @example
23700
- * // returns €50.5
23701
- * Dinero({ amount: 5050, currency: 'EUR' }).toFormat('$0,0.0')
23702
- * @example
23703
- * // returns 100 euros
23704
- * Dinero({ amount: 10000, currency: 'EUR' }).setLocale('fr-FR').toFormat('0,0 dollar')
23705
- * @example
23706
- * // returns 2000
23707
- * Dinero({ amount: 200000, currency: 'EUR' }).toFormat()
23708
- * @example
23709
- * // returns $10
23710
- * Dinero({ amount: 1050 }).toFormat('$0', 'HALF_EVEN')
23711
- *
23712
- * @return {String}
23713
- */
23714
- toFormat: function toFormat() {
23715
- var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalFormat;
23716
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
23717
- var formatter = Format(format);
23718
- return this.toRoundedUnit(formatter.getMinimumFractionDigits(), roundingMode).toLocaleString(this.getLocale(), {
23719
- currencyDisplay: formatter.getCurrencyDisplay(),
23720
- useGrouping: formatter.getUseGrouping(),
23721
- minimumFractionDigits: formatter.getMinimumFractionDigits(),
23722
- style: formatter.getStyle(),
23723
- currency: this.getCurrency()
23724
- });
23725
- },
23726
-
23727
- /**
23728
- * Returns the amount represented by this object in units.
23729
- *
23730
- * @example
23731
- * // returns 10.5
23732
- * Dinero({ amount: 1050 }).toUnit()
23733
- * @example
23734
- * // returns 10.545
23735
- * Dinero({ amount: 10545, precision: 3 }).toUnit()
23736
- *
23737
- * @return {Number}
23738
- */
23739
- toUnit: function toUnit() {
23740
- return calculator$1.divide(this.getAmount(), Math.pow(10, precision));
23741
- },
23742
-
23743
- /**
23744
- * Returns the amount represented by this object in rounded units.
23745
- *
23746
- * By default, the method uses the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).
23747
- * You can also specify a different `roundingMode` to better fit your needs.
23748
- *
23749
- * @example
23750
- * // returns 10.6
23751
- * Dinero({ amount: 1055 }).toRoundedUnit(1)
23752
- * @example
23753
- * // returns 10
23754
- * Dinero({ amount: 1050 }).toRoundedUnit(0, 'HALF_EVEN')
23755
- *
23756
- * @param {Number} digits - The number of fraction digits to round to.
23757
- * @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'`.
23758
- *
23759
- * @return {Number}
23760
- */
23761
- toRoundedUnit: function toRoundedUnit(digits) {
23762
- var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
23763
- var factor = Math.pow(10, digits);
23764
- return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);
23765
- },
23766
-
23767
- /**
23768
- * Returns the object's data as an object literal.
23769
- *
23770
- * @example
23771
- * // returns { amount: 500, currency: 'EUR', precision: 2 }
23772
- * Dinero({ amount: 500, currency: 'EUR', precision: 2 }).toObject()
23773
- *
23774
- * @return {Object}
23775
- */
23776
- toObject: function toObject() {
23777
- return {
23778
- amount: amount,
23779
- currency: currency,
23780
- precision: precision
23781
- };
23782
- },
23783
-
23784
- /**
23785
- * Returns the object's data as an object literal.
23786
- *
23787
- * Alias of {@link module:Dinero~toObject toObject}.
23788
- * It is defined so that calling `JSON.stringify` on a Dinero object will automatically extract the relevant data.
23789
- *
23790
- * @example
23791
- * // returns '{"amount":500,"currency":"EUR","precision":2}'
23792
- * JSON.stringify(Dinero({ amount: 500, currency: 'EUR', precision: 2 }))
23793
- *
23794
- * @return {Object}
23795
- */
23796
- toJSON: function toJSON() {
23797
- return this.toObject();
23798
- }
23799
- };
23800
- };
23801
-
23802
- var dinero = Object.assign(Dinero, Defaults, Globals, Static);
23803
-
23804
- dinero_1 = dinero;
23805
- return dinero_1;
23806
- }
23807
-
23808
- var dineroExports = requireDinero();
23809
- var Dinero = /*@__PURE__*/getDefaultExportFromCjs(dineroExports);
23810
-
23811
22143
  // Currency Formatting
23812
22144
  const formatCurrency = (amount, currency, omitSymbols = false) => {
23813
22145
  if (!amount)
@@ -23912,11 +22244,6 @@ function snakeCaseToHumanReadable(snakeCaseStr) {
23912
22244
  .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
23913
22245
  .join(' ');
23914
22246
  }
23915
- function snakeToCamel(str) {
23916
- if (!str)
23917
- return '';
23918
- return str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', '').replace('_', ''));
23919
- }
23920
22247
  // Object Utilities
23921
22248
  function isEmptyObject(obj) {
23922
22249
  if (obj === null) {
@@ -23969,4 +22296,4 @@ function generateId(length = 10) {
23969
22296
  return result;
23970
22297
  }
23971
22298
 
23972
- export { convertToLocal as a, formatTime as b, convertToUTC as c, formatDate as d, capitalFirstLetter as e, formatCurrency as f, generateId as g, addAttribute as h, snakeCaseToHumanReadable as i, formatTimeSeconds as j, formatPhoneNumber as k, formatDisplayDate as l, isEmptyObject as m, formatMediumDate as n, processHTML as p, removeAttribute as r, snakeToCamel as s };
22299
+ export { convertToLocal as a, formatTime as b, convertToUTC as c, formatDate as d, capitalFirstLetter as e, formatCurrency as f, generateId as g, addAttribute as h, formatTimeSeconds as i, formatPhoneNumber as j, formatDisplayDate as k, isEmptyObject as l, formatMediumDate as m, processHTML as p, removeAttribute as r, snakeCaseToHumanReadable as s };