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

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 (623) hide show
  1. package/dist/cjs/{Api-c8NBCwu4.js → Api-eP0XeJLd.js} +1 -1
  2. package/dist/cjs/{Refund-Dt1CMUjx.js → Refund-08OcZkXX.js} +148 -1
  3. package/dist/cjs/additional-questions-details_5.cjs.entry.js +2 -1
  4. package/dist/cjs/bank-account-document-form-inputs_4.cjs.entry.js +7 -7
  5. package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
  6. package/dist/cjs/{business.service-W2PRAU9J.js → business.service-CZrK48lv.js} +2 -3
  7. package/dist/cjs/card-form.cjs.entry.js +2 -2
  8. package/dist/cjs/{check-pkg-version-DmONJMn1.js → check-pkg-version-DBocF2eE.js} +3 -4
  9. package/dist/cjs/{checkout.service-XwOh98gt.js → checkout.service-CllLA9W6.js} +2 -3
  10. package/dist/cjs/checkouts-list-core.cjs.entry.js +5 -5
  11. package/dist/cjs/{checkouts-table-CrpOOe_e.js → checkouts-table-Cp7rNkNd.js} +1 -1
  12. package/dist/cjs/custom-popper.cjs.entry.js +2 -2
  13. package/dist/cjs/dinero-J-SRFKIR.js +1673 -0
  14. package/dist/cjs/{dispute.service-Dh82Wru1.js → dispute.service-Chptj-DX.js} +2 -3
  15. package/dist/cjs/form-alert_5.cjs.entry.js +4 -4
  16. package/dist/cjs/form-control-checkbox.cjs.entry.js +2 -2
  17. package/dist/cjs/form-control-date.cjs.entry.js +2 -2
  18. package/dist/cjs/form-control-file-v2_2.cjs.entry.js +3 -3
  19. package/dist/cjs/form-control-monetary-provisioning.cjs.entry.js +2 -2
  20. package/dist/cjs/form-control-monetary.cjs.entry.js +4 -3
  21. package/dist/cjs/form-control-number-masked_2.cjs.entry.js +3 -3
  22. package/dist/cjs/form-control-number.cjs.entry.js +2 -2
  23. package/dist/cjs/form-control-radio.cjs.entry.js +2 -2
  24. package/dist/cjs/form-control-select_3.cjs.entry.js +4 -4
  25. package/dist/cjs/{get-payment-details-W4PgTPkL.js → get-payment-details-C3qBZVdv.js} +3 -4
  26. package/dist/cjs/{get-subaccounts-D4woaGSs.js → get-subaccounts-DKyvT-ZF.js} +3 -4
  27. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +3 -2
  28. package/dist/cjs/header-2-BXQLJn1q.js +10 -0
  29. package/dist/cjs/hidden-input_2.cjs.entry.js +5 -5
  30. package/dist/cjs/{insurance-state-BsGy_svD.js → insurance-state-kH0kuTD8.js} +3 -10
  31. package/dist/cjs/justifi-additional-questions-form-step-core_6.cjs.entry.js +3 -3
  32. package/dist/cjs/justifi-additional-questions-form-step_9.cjs.entry.js +14 -14
  33. package/dist/cjs/justifi-additional-statement_8.cjs.entry.js +8 -8
  34. package/dist/cjs/{justifi-bank-account-form_5.cjs.entry.js → justifi-bank-account-form_7.cjs.entry.js} +59 -17
  35. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +49 -0
  36. package/dist/cjs/justifi-business-details.cjs.entry.js +8 -8
  37. package/dist/cjs/justifi-business-form.cjs.entry.js +7 -7
  38. package/dist/cjs/justifi-business-representative-form-inputs.cjs.entry.js +1 -1
  39. package/dist/cjs/{justifi-button_5.cjs.entry.js → justifi-checkout-summary_5.cjs.entry.js} +126 -45
  40. package/dist/cjs/justifi-checkout.cjs.entry.js +12 -12
  41. package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +4 -4
  42. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +10 -10
  43. package/dist/cjs/justifi-dispute-management-core.cjs.entry.js +1 -1
  44. package/dist/cjs/justifi-dispute-management.cjs.entry.js +8 -8
  45. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +11 -11
  46. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +6 -6
  47. package/dist/cjs/justifi-order-terminals.cjs.entry.js +9 -9
  48. package/dist/cjs/justifi-owner-form_3.cjs.entry.js +9 -9
  49. package/dist/cjs/justifi-payment-details.cjs.entry.js +9 -9
  50. package/dist/cjs/justifi-payment-provisioning-core.cjs.entry.js +1 -1
  51. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +8 -8
  52. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +8 -8
  53. package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +4 -3
  54. package/dist/cjs/justifi-payments-list.cjs.entry.js +10 -10
  55. package/dist/cjs/justifi-payout-details.cjs.entry.js +7 -7
  56. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +8 -8
  57. package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +4 -3
  58. package/dist/cjs/justifi-payouts-list.cjs.entry.js +10 -10
  59. package/dist/cjs/justifi-refund-payment.cjs.entry.js +8 -8
  60. package/dist/cjs/justifi-saved-payment-method.cjs.entry.js +3 -3
  61. package/dist/cjs/justifi-season-interruption-insurance-core.cjs.entry.js +5 -3
  62. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +7 -7
  63. package/dist/cjs/justifi-skeleton.cjs.entry.js +1 -1
  64. package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +5 -5
  65. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +8 -8
  66. package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +4 -4
  67. package/dist/cjs/justifi-terminals-list.cjs.entry.js +10 -10
  68. package/dist/cjs/justifi-tokenize-payment-method.cjs.entry.js +188 -32
  69. package/dist/cjs/loader.cjs.js +1 -1
  70. package/dist/cjs/{package-oywezDpy.js → package-BM2FCIB8.js} +1 -1
  71. package/dist/cjs/payment-details-core.cjs.entry.js +10 -9
  72. package/dist/cjs/{payment-method-option-utils-imuSE7KV.js → payment-method-option-utils-QODgEWhU.js} +1 -11
  73. package/dist/cjs/{payment.service-BrvtS3F7.js → payment.service-C6kdaQYS.js} +2 -3
  74. package/dist/cjs/payments-list-core.cjs.entry.js +5 -5
  75. package/dist/cjs/{payments-table-BqxFc71K.js → payments-table-DaW6SvdL.js} +1 -1
  76. package/dist/cjs/payout-details-core.cjs.entry.js +5 -4
  77. package/dist/cjs/{payout.service-DNH6gRrP.js → payout.service-CLnAr59x.js} +2 -3
  78. package/dist/cjs/payouts-list-core.cjs.entry.js +5 -5
  79. package/dist/cjs/{payouts-table-iT2IauEa.js → payouts-table-D5hMHcaY.js} +1 -1
  80. package/dist/cjs/table-filters-menu.cjs.entry.js +1 -1
  81. package/dist/cjs/terminal-orders-list-core.cjs.entry.js +5 -5
  82. package/dist/cjs/{terminal-orders-table-xi_a-EnM.js → terminal-orders-table-DTZUpjkG.js} +2 -3
  83. package/dist/cjs/terminal-quantity-selector.cjs.entry.js +1 -1
  84. package/dist/cjs/{terminal.service-CdzmTRQE.js → terminal.service-CcBCXxNm.js} +2 -3
  85. package/dist/cjs/terminals-list-core.cjs.entry.js +5 -5
  86. package/dist/cjs/{terminals-table-sf-s5v6D.js → terminals-table-DOqVeHM1.js} +1 -1
  87. package/dist/cjs/{utils-qOon0GWm.js → utils-DqlrBltg.js} +2 -1676
  88. package/dist/cjs/webcomponents.cjs.js +1 -1
  89. package/dist/collection/collection-manifest.json +1 -2
  90. package/dist/collection/components/business-forms/business-form/additional-questions/additional-questions.js +1 -1
  91. package/dist/collection/components/business-forms/business-form/business-core-info/business-core-info.js +1 -1
  92. package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +1 -1
  93. package/dist/collection/components/business-forms/business-form/legal-address-form/legal-address-form.js +1 -1
  94. package/dist/collection/components/business-forms/owner-form/identity-address/identity-address-form.js +1 -1
  95. package/dist/collection/components/business-forms/owner-form/owner-form-core.js +1 -1
  96. package/dist/collection/components/business-forms/owner-form/owner-form-inputs.js +1 -1
  97. package/dist/collection/components/business-forms/owner-form/owner-form.js +1 -1
  98. package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +1 -1
  99. package/dist/collection/components/business-forms/payment-provisioning/bank-account/bank-account-document-inputs.js +1 -1
  100. package/dist/collection/components/business-forms/payment-provisioning/bank-account/bank-account-form-inputs.js +1 -1
  101. package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-bank-account-form-step.js +1 -1
  102. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +1 -1
  103. package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step.js +1 -1
  104. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-inputs.js +1 -1
  105. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +1 -1
  106. package/dist/collection/components/business-forms/payment-provisioning/form-control-monetary-provisioning.js +2 -2
  107. package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step.js +1 -1
  108. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-core.js +1 -1
  109. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-form-buttons.js +1 -1
  110. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-form-steps.js +1 -1
  111. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning.js +1 -1
  112. package/dist/collection/components/business-forms/payment-provisioning/terms-and-conditions/business-terms-conditions-form-step.js +1 -1
  113. package/dist/collection/components/checkout/bank-account-form/bank-account-form.js +2 -2
  114. package/dist/collection/components/checkout/billing-form/billing-form.js +10 -37
  115. package/dist/collection/components/checkout/card-form/card-form.js +2 -2
  116. package/dist/collection/components/checkout/checkout.js +1 -1
  117. package/dist/collection/components/checkout/payment-method-option-utils.js +0 -1
  118. package/dist/collection/components/checkout/save-new-payment-method.js +1 -1
  119. package/dist/collection/components/checkout/saved-payment-method.js +1 -1
  120. package/dist/collection/components/checkouts-list/checkouts-list-core.js +1 -1
  121. package/dist/collection/components/checkouts-list/checkouts-list-filters.js +1 -1
  122. package/dist/collection/components/checkouts-list/checkouts-list.js +1 -1
  123. package/dist/collection/components/dispute-management/dispute-management-core.js +1 -1
  124. package/dist/collection/components/dispute-management/dispute-management.js +1 -1
  125. package/dist/collection/components/dispute-management/dispute-notification.js +1 -1
  126. package/dist/collection/components/dispute-management/dispute-response/additional-statement.js +1 -1
  127. package/dist/collection/components/dispute-management/dispute-response/cancellation-policy.js +1 -1
  128. package/dist/collection/components/dispute-management/dispute-response/customer-details.js +1 -1
  129. package/dist/collection/components/dispute-management/dispute-response/dispute-response-core.js +1 -1
  130. package/dist/collection/components/dispute-management/dispute-response/dispute-response.js +1 -1
  131. package/dist/collection/components/dispute-management/dispute-response/duplicate-charge.js +1 -1
  132. package/dist/collection/components/dispute-management/dispute-response/electronic-evidence.js +1 -1
  133. package/dist/collection/components/dispute-management/dispute-response/product-or-service.js +1 -1
  134. package/dist/collection/components/dispute-management/dispute-response/refund-policy.js +1 -1
  135. package/dist/collection/components/dispute-management/dispute-response/shipping-details.js +1 -1
  136. package/dist/collection/components/filters/table-filters-menu.js +1 -1
  137. package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +1 -1
  138. package/dist/collection/components/insurance/season-interruption/season-interruption-insurance.js +1 -1
  139. package/dist/collection/components/modular-checkout/modular-checkout.js +8 -1
  140. package/dist/collection/components/modular-checkout/sub-components/bank-account.js +2 -2
  141. package/dist/collection/components/modular-checkout/sub-components/billing-information-form.js +36 -5
  142. package/dist/collection/components/modular-checkout/sub-components/card-form.js +2 -2
  143. package/dist/collection/components/modular-checkout/sub-components/payment-method-option.js +1 -1
  144. package/dist/collection/components/modular-checkout/sub-components/postal-code-form.js +5 -4
  145. package/dist/collection/components/modular-checkout/sub-components/summary.js +1 -1
  146. package/dist/collection/components/order-terminals/order-terminals.js +1 -1
  147. package/dist/collection/components/order-terminals/terminal-quantity-selector/terminal-quantity-selector.js +1 -1
  148. package/dist/collection/components/payment-details/payment-details-core.js +8 -8
  149. package/dist/collection/components/payment-transactions-list/payment-transactions-list.js +1 -1
  150. package/dist/collection/components/payments-list/payments-list-core.js +1 -1
  151. package/dist/collection/components/payments-list/payments-list-filters.js +2 -2
  152. package/dist/collection/components/payments-list/payments-list.js +1 -1
  153. package/dist/collection/components/payout-details/payout-details-core.js +3 -3
  154. package/dist/collection/components/payout-transactions-list/payout-transactions-list.js +1 -1
  155. package/dist/collection/components/payouts-list/payouts-list-core.js +1 -1
  156. package/dist/collection/components/payouts-list/payouts-list-filters.js +2 -2
  157. package/dist/collection/components/payouts-list/payouts-list.js +1 -1
  158. package/dist/collection/components/terminal-orders-list/terminal-orders-list-core.js +1 -1
  159. package/dist/collection/components/terminal-orders-list/terminal-orders-list-filters.js +2 -2
  160. package/dist/collection/components/terminal-orders-list/terminal-orders-list.js +1 -1
  161. package/dist/collection/components/terminals-list/terminals-list-core.js +1 -1
  162. package/dist/collection/components/terminals-list/terminals-list-filters.js +1 -1
  163. package/dist/collection/components/terminals-list/terminals-list.js +1 -1
  164. package/dist/collection/components/tokenize-payment-method/tokenize-payment-method.js +273 -89
  165. package/dist/collection/ui-components/custom-popper/custom-popper.js +2 -2
  166. package/dist/collection/ui-components/form/form-control-checkbox.js +2 -2
  167. package/dist/collection/ui-components/form/form-control-date.js +2 -2
  168. package/dist/collection/ui-components/form/form-control-file-v2.js +1 -1
  169. package/dist/collection/ui-components/form/form-control-file.js +2 -2
  170. package/dist/collection/ui-components/form/form-control-monetary.js +2 -2
  171. package/dist/collection/ui-components/form/form-control-number-masked.js +2 -2
  172. package/dist/collection/ui-components/form/form-control-number.js +2 -2
  173. package/dist/collection/ui-components/form/form-control-radio.js +2 -2
  174. package/dist/collection/ui-components/form/form-control-select.js +2 -2
  175. package/dist/collection/ui-components/form/form-control-text.js +2 -2
  176. package/dist/collection/ui-components/form/form-control-textarea.js +2 -2
  177. package/dist/collection/ui-components/form/hidden-input.js +1 -1
  178. package/dist/collection/ui-components/form/iframe-input.js +3 -3
  179. package/dist/collection/ui-components/index.js +1 -0
  180. package/dist/collection/ui-components/shadow-dom-components/justifi-button.js +1 -1
  181. package/dist/collection/ui-components/shadow-dom-components/justifi-header.js +1 -1
  182. package/dist/collection/ui-components/shadow-dom-components/justifi-radio-list-item.js +155 -0
  183. package/dist/collection/ui-components/shadow-dom-components/justifi-skeleton.js +1 -1
  184. package/dist/docs.json +729 -1328
  185. package/dist/esm/{Api-C3T8XYbb.js → Api-BCeKXDaf.js} +1 -1
  186. package/dist/esm/{Dispute-7MWRbTXI.js → Dispute-BH0Xfn-F.js} +1 -1
  187. package/dist/esm/{Refund-0aZtuMmz.js → Refund-DBHZkemk.js} +148 -2
  188. package/dist/esm/additional-questions-details_5.entry.js +4 -3
  189. package/dist/esm/{badge-Dr7gkD2I.js → badge-BrapPg3R.js} +1 -1
  190. package/dist/esm/bank-account-document-form-inputs_4.entry.js +11 -11
  191. package/dist/esm/bank-account-form.entry.js +4 -4
  192. package/dist/esm/business-details-core.entry.js +3 -3
  193. package/dist/esm/{business.service-C5vrjgZf.js → business.service-BPBxsb8B.js} +3 -4
  194. package/dist/esm/{button-xfPDSpPt.js → button-BB-N4vit.js} +1 -1
  195. package/dist/esm/card-form.entry.js +4 -4
  196. package/dist/esm/{check-pkg-version-DqhSXPRt.js → check-pkg-version-Cic-MeLf.js} +4 -5
  197. package/dist/esm/{checkout.service-CW2_CEte.js → checkout.service-C1WAmUiU.js} +3 -4
  198. package/dist/esm/checkouts-list-core.entry.js +10 -10
  199. package/dist/esm/{checkouts-table-BHhaS5bv.js → checkouts-table-COpCngi0.js} +3 -3
  200. package/dist/esm/custom-popper.entry.js +2 -2
  201. package/dist/esm/dinero-DizZAUMY.js +1671 -0
  202. package/dist/esm/{dispute.service-C3bmfjsZ.js → dispute.service-bQh-LG0z.js} +3 -4
  203. package/dist/esm/form-alert_5.entry.js +5 -5
  204. package/dist/esm/form-control-checkbox.entry.js +5 -5
  205. package/dist/esm/form-control-date.entry.js +4 -4
  206. package/dist/esm/{form-control-error-text-Cn0aPzHx.js → form-control-error-text-Bk3yfpFX.js} +1 -1
  207. package/dist/esm/form-control-file-v2_2.entry.js +5 -5
  208. package/dist/esm/{form-control-help-text-C91TeHXs.js → form-control-help-text-mOLCXs00.js} +1 -1
  209. package/dist/esm/form-control-monetary-provisioning.entry.js +5 -5
  210. package/dist/esm/form-control-monetary.entry.js +7 -6
  211. package/dist/esm/form-control-number-masked_2.entry.js +5 -5
  212. package/dist/esm/form-control-number.entry.js +5 -5
  213. package/dist/esm/form-control-radio.entry.js +3 -3
  214. package/dist/esm/form-control-select_3.entry.js +6 -6
  215. package/dist/esm/{get-payment-details-BdPvFl1W.js → get-payment-details-B193kh7P.js} +3 -4
  216. package/dist/esm/{get-subaccounts-BqqR44dV.js → get-subaccounts-DcgISPei.js} +4 -5
  217. package/dist/esm/gross-payment-chart-core.entry.js +6 -5
  218. package/dist/esm/{header-1-noRVFQY9.js → header-1-DYuf6mkF.js} +1 -1
  219. package/dist/esm/header-2-C4ZCdZwi.js +8 -0
  220. package/dist/esm/hidden-input_2.entry.js +7 -7
  221. package/dist/esm/{insurance-state-pL8MRpxn.js → insurance-state-DeyYNyas.js} +1 -7
  222. package/dist/esm/justifi-additional-questions-form-step-core_6.entry.js +7 -7
  223. package/dist/esm/justifi-additional-questions-form-step_9.entry.js +17 -17
  224. package/dist/esm/justifi-additional-statement_8.entry.js +9 -9
  225. package/dist/esm/{justifi-bank-account-form_5.entry.js → justifi-bank-account-form_7.entry.js} +60 -20
  226. package/dist/esm/justifi-billing-form_2.entry.js +46 -0
  227. package/dist/esm/justifi-business-details.entry.js +10 -10
  228. package/dist/esm/justifi-business-form.entry.js +12 -12
  229. package/dist/esm/justifi-business-representative-form-inputs.entry.js +2 -2
  230. package/dist/esm/{justifi-button_5.entry.js → justifi-checkout-summary_5.entry.js} +127 -46
  231. package/dist/esm/justifi-checkout.entry.js +9 -9
  232. package/dist/esm/justifi-checkouts-list-filters.entry.js +6 -6
  233. package/dist/esm/justifi-checkouts-list.entry.js +13 -13
  234. package/dist/esm/justifi-details.entry.js +2 -2
  235. package/dist/esm/justifi-dispute-management-core.entry.js +2 -2
  236. package/dist/esm/justifi-dispute-management.entry.js +9 -9
  237. package/dist/esm/justifi-dispute-notification_3.entry.js +14 -14
  238. package/dist/esm/justifi-gross-payment-chart.entry.js +9 -9
  239. package/dist/esm/justifi-order-terminals.entry.js +12 -12
  240. package/dist/esm/justifi-owner-form_3.entry.js +11 -11
  241. package/dist/esm/justifi-payment-details.entry.js +11 -11
  242. package/dist/esm/justifi-payment-provisioning-core.entry.js +3 -3
  243. package/dist/esm/justifi-payment-provisioning.entry.js +9 -9
  244. package/dist/esm/justifi-payment-transactions-list.entry.js +12 -12
  245. package/dist/esm/justifi-payments-list-filters.entry.js +5 -4
  246. package/dist/esm/justifi-payments-list.entry.js +13 -13
  247. package/dist/esm/justifi-payout-details.entry.js +10 -10
  248. package/dist/esm/justifi-payout-transactions-list.entry.js +12 -12
  249. package/dist/esm/justifi-payouts-list-filters.entry.js +5 -4
  250. package/dist/esm/justifi-payouts-list.entry.js +14 -14
  251. package/dist/esm/justifi-refund-payment.entry.js +12 -12
  252. package/dist/esm/justifi-saved-payment-method.entry.js +4 -4
  253. package/dist/esm/justifi-season-interruption-insurance-core.entry.js +6 -4
  254. package/dist/esm/justifi-season-interruption-insurance.entry.js +8 -8
  255. package/dist/esm/justifi-skeleton.entry.js +3 -3
  256. package/dist/esm/justifi-terminal-orders-list-filters.entry.js +7 -7
  257. package/dist/esm/justifi-terminal-orders-list.entry.js +11 -11
  258. package/dist/esm/justifi-terminals-list-filters.entry.js +6 -6
  259. package/dist/esm/justifi-terminals-list.entry.js +13 -13
  260. package/dist/esm/justifi-tokenize-payment-method.entry.js +190 -34
  261. package/dist/esm/loader.js +1 -1
  262. package/dist/esm/{package-DR0dQ8Fv.js → package-BRJ4FIJH.js} +1 -1
  263. package/dist/esm/pagination-menu.entry.js +1 -1
  264. package/dist/esm/{parts-D3G5aVLy.js → parts-CKg_luIy.js} +1 -1
  265. package/dist/esm/payment-details-core.entry.js +15 -14
  266. package/dist/esm/{payment-method-option-utils-8n_ALxec.js → payment-method-option-utils-zFDtQrgQ.js} +2 -10
  267. package/dist/esm/{payment.service-CnQdP32J.js → payment.service-BTVtIbcY.js} +3 -4
  268. package/dist/esm/payments-list-core.entry.js +11 -11
  269. package/dist/esm/{payments-status-DUM0WZkk.js → payments-status-CawBLR48.js} +1 -1
  270. package/dist/esm/{payments-table-DVQzx7MJ.js → payments-table-WQAD1CSz.js} +3 -3
  271. package/dist/esm/payout-details-core.entry.js +11 -10
  272. package/dist/esm/{payout.service-EJuPNpfs.js → payout.service-j8w34GsW.js} +3 -4
  273. package/dist/esm/payouts-list-core.entry.js +11 -11
  274. package/dist/esm/{payouts-status-7saoFNoA.js → payouts-status-DB_PJap6.js} +1 -1
  275. package/dist/esm/{payouts-table-dca-F2iQ.js → payouts-table-DRISll8u.js} +3 -3
  276. package/dist/esm/{skeleton-C1-JoGFC.js → skeleton-D1Z4a8af.js} +1 -1
  277. package/dist/esm/{spinner-Ca9uu5Nd.js → spinner-BlffecO5.js} +1 -1
  278. package/dist/esm/{table-fsCYq8m9.js → table-BqxKVRry.js} +2 -2
  279. package/dist/esm/table-filters-menu.entry.js +3 -3
  280. package/dist/esm/terminal-orders-list-core.entry.js +10 -10
  281. package/dist/esm/{terminal-orders-table-BNasCnjz.js → terminal-orders-table-BWf9quiN.js} +5 -6
  282. package/dist/esm/terminal-quantity-selector.entry.js +2 -2
  283. package/dist/esm/{terminal.service-Cfacmeto.js → terminal.service-BDRGcUj-.js} +3 -4
  284. package/dist/esm/terminals-list-core.entry.js +10 -10
  285. package/dist/esm/{terminals-table-DBk-eg_3.js → terminals-table-BBPQRWja.js} +3 -3
  286. package/dist/esm/{utils-BjLkBMLe.js → utils-Cu5hITuT.js} +2 -1675
  287. package/dist/esm/{utils-CNwvOLkk.js → utils-sZ_6zOKQ.js} +1 -1
  288. package/dist/esm/webcomponents.js +1 -1
  289. package/dist/module/Analytics.js +0 -1
  290. package/dist/module/Refund.js +202 -1
  291. package/dist/module/additional-questions.js +1 -1
  292. package/dist/module/additional-statement.js +1 -1
  293. package/dist/module/badge.js +1 -1
  294. package/dist/module/bank-account-document-inputs.js +2 -3
  295. package/dist/module/bank-account-form-inputs2.js +1 -1
  296. package/dist/module/bank-account-form.js +2 -2
  297. package/dist/module/bank-account.js +3 -2
  298. package/dist/module/billing-form.js +20 -57
  299. package/dist/module/billing-information-form.js +10 -3
  300. package/dist/module/business-additional-questions-form-step.js +1 -1
  301. package/dist/module/business-bank-account-form-step-core.js +2 -3
  302. package/dist/module/business-bank-account-form-step.js +2 -3
  303. package/dist/module/business-core-info-form-step.js +1 -1
  304. package/dist/module/business-core-info.js +1 -1
  305. package/dist/module/business-details-core2.js +1 -0
  306. package/dist/module/business-documents-on-file2.js +2 -1
  307. package/dist/module/business-owners-form-step-core.js +1 -0
  308. package/dist/module/business-owners-form-step.js +1 -1
  309. package/dist/module/business-representative-form-inputs.js +1 -1
  310. package/dist/module/business-representative-form-step.js +1 -1
  311. package/dist/module/business-representative.js +1 -1
  312. package/dist/module/business-terms-conditions-form-step.js +1 -2
  313. package/dist/module/business.service.js +0 -1
  314. package/dist/module/cancellation-policy.js +1 -1
  315. package/dist/module/card-form.js +2 -2
  316. package/dist/module/card-form2.js +3 -2
  317. package/dist/module/checkout.service.js +0 -1
  318. package/dist/module/checkouts-list-core2.js +5 -4
  319. package/dist/module/custom-popper2.js +2 -2
  320. package/dist/module/customer-details.js +1 -1
  321. package/dist/module/dinero.js +1671 -0
  322. package/dist/module/dispute-management-core.js +2 -2
  323. package/dist/module/dispute-notification.js +2 -1
  324. package/dist/module/dispute-response-actions.js +0 -1
  325. package/dist/module/dispute-response-core.js +1 -1
  326. package/dist/module/dispute-response.js +2 -1
  327. package/dist/module/duplicate-charge.js +1 -1
  328. package/dist/module/electronic-evidence.js +1 -1
  329. package/dist/module/form-alert2.js +1 -1
  330. package/dist/module/form-control-checkbox2.js +4 -3
  331. package/dist/module/form-control-date2.js +3 -2
  332. package/dist/module/form-control-file-v22.js +1 -1
  333. package/dist/module/form-control-file2.js +3 -2
  334. package/dist/module/form-control-monetary-provisioning2.js +4 -3
  335. package/dist/module/form-control-monetary2.js +4 -3
  336. package/dist/module/form-control-number-masked2.js +3 -2
  337. package/dist/module/form-control-number.js +4 -3
  338. package/dist/module/form-control-radio2.js +3 -3
  339. package/dist/module/form-control-select2.js +3 -2
  340. package/dist/module/form-control-text2.js +3 -2
  341. package/dist/module/form-control-textarea2.js +3 -3
  342. package/dist/module/get-payment-details.js +2 -3
  343. package/dist/module/get-subaccounts.js +1 -2
  344. package/dist/module/gross-payment-chart-core2.js +2 -2
  345. package/dist/module/hidden-input2.js +2 -2
  346. package/dist/module/identity-address-form.js +1 -1
  347. package/dist/module/iframe-input2.js +4 -4
  348. package/dist/module/justifi-business-form.js +2 -2
  349. package/dist/module/justifi-button2.js +1 -1
  350. package/dist/module/justifi-checkout.js +3 -2
  351. package/dist/module/justifi-checkouts-list-filters.js +4 -4
  352. package/dist/module/justifi-checkouts-list.js +4 -4
  353. package/dist/module/justifi-dispute-management.js +2 -3
  354. package/dist/module/justifi-gross-payment-chart.js +0 -1
  355. package/dist/module/justifi-header2.js +7 -3
  356. package/dist/module/justifi-order-terminals.js +5 -4
  357. package/dist/module/justifi-payment-provisioning.js +1 -2
  358. package/dist/module/justifi-payment-transactions-list.js +6 -5
  359. package/dist/module/justifi-payments-list-filters.js +4 -3
  360. package/dist/module/justifi-payments-list.js +4 -4
  361. package/dist/module/justifi-payout-details.js +2 -3
  362. package/dist/module/justifi-payout-transactions-list.js +6 -5
  363. package/dist/module/justifi-payouts-list-filters.js +4 -3
  364. package/dist/module/justifi-payouts-list.js +4 -4
  365. package/dist/module/justifi-radio-list-item.d.ts +11 -0
  366. package/dist/module/justifi-radio-list-item.js +6 -0
  367. package/dist/module/justifi-radio-list-item2.js +55 -0
  368. package/dist/module/justifi-refund-payment.js +2 -2
  369. package/dist/module/justifi-saved-payment-method.js +2 -2
  370. package/dist/module/justifi-season-interruption-insurance.js +1 -2
  371. package/dist/module/justifi-skeleton.js +1 -1
  372. package/dist/module/justifi-terminal-orders-list-filters.js +5 -5
  373. package/dist/module/justifi-terminal-orders-list.js +4 -4
  374. package/dist/module/justifi-terminals-list-filters.js +4 -4
  375. package/dist/module/justifi-terminals-list.js +4 -4
  376. package/dist/module/justifi-tokenize-payment-method.js +285 -47
  377. package/dist/module/legal-address-form-step.js +1 -1
  378. package/dist/module/legal-address-form.js +1 -1
  379. package/dist/module/modular-checkout.js +9 -3
  380. package/dist/module/owner-form-core2.js +3 -2
  381. package/dist/module/owner-form-inputs2.js +1 -1
  382. package/dist/module/owner-form.js +1 -1
  383. package/dist/module/package.js +1 -1
  384. package/dist/module/pagination-menu2.js +1 -1
  385. package/dist/module/parts.js +1 -1
  386. package/dist/module/payment-details-core2.js +10 -9
  387. package/dist/module/payment-method-option-utils.js +2 -10
  388. package/dist/module/payment-method-option2.js +3 -2
  389. package/dist/module/payment-provisioning-core.js +2 -1
  390. package/dist/module/payment-provisioning-form-buttons.js +2 -1
  391. package/dist/module/payment-provisioning-form-steps.js +1 -1
  392. package/dist/module/payment-provisioning-loading.js +1 -0
  393. package/dist/module/payment.service.js +0 -1
  394. package/dist/module/payments-list-core2.js +5 -4
  395. package/dist/module/payout-details-core2.js +5 -4
  396. package/dist/module/payout.service.js +0 -1
  397. package/dist/module/payouts-list-core2.js +5 -4
  398. package/dist/module/postal-code-form.js +4 -2
  399. package/dist/module/product-or-service.js +1 -1
  400. package/dist/module/refund-policy.js +1 -1
  401. package/dist/module/save-new-payment-method.js +2 -1
  402. package/dist/module/saved-payment-methods.js +2 -1
  403. package/dist/module/season-interruption-insurance-core.js +2 -1
  404. package/dist/module/sezzle-payment-method.js +2 -1
  405. package/dist/module/shipping-details.js +1 -1
  406. package/dist/module/spinner.js +1 -1
  407. package/dist/module/summary.js +2 -1
  408. package/dist/module/table-filters-menu2.js +1 -1
  409. package/dist/module/table.js +1 -1
  410. package/dist/module/terminal-orders-list-core2.js +6 -5
  411. package/dist/module/terminal-quantity-selector2.js +2 -2
  412. package/dist/module/terminal.service.js +0 -1
  413. package/dist/module/terminals-list-core2.js +5 -4
  414. package/dist/module/utils2.js +2 -1675
  415. package/dist/types/components/checkout/billing-form/billing-form.d.ts +3 -9
  416. package/dist/types/components/checkout/checkout.d.ts +1 -1
  417. package/dist/types/components/modular-checkout/modular-checkout.d.ts +1 -0
  418. package/dist/types/components/modular-checkout/sub-components/billing-information-form.d.ts +2 -0
  419. package/dist/types/components/modular-checkout/sub-components/postal-code-form.d.ts +1 -0
  420. package/dist/types/components/tokenize-payment-method/tokenize-payment-method.d.ts +37 -14
  421. package/dist/types/components.d.ts +68 -112
  422. package/dist/types/ui-components/index.d.ts +1 -0
  423. package/dist/types/ui-components/shadow-dom-components/justifi-radio-list-item.d.ts +12 -0
  424. package/dist/webcomponents/p-072d93c9.entry.js +1 -0
  425. package/dist/webcomponents/{p-ae00a6f3.entry.js → p-0dcc215b.entry.js} +1 -1
  426. package/dist/webcomponents/p-0e6797c4.entry.js +1 -0
  427. package/dist/webcomponents/p-0fc026aa.entry.js +1 -0
  428. package/dist/webcomponents/p-18aa8190.entry.js +1 -0
  429. package/dist/webcomponents/{p-7c63d61d.entry.js → p-19c07145.entry.js} +1 -1
  430. package/dist/webcomponents/p-1Or21UzV.js +1 -0
  431. package/dist/webcomponents/{p-50bfec55.entry.js → p-1b7b7210.entry.js} +1 -1
  432. package/dist/webcomponents/p-1f76ae29.entry.js +1 -0
  433. package/dist/webcomponents/p-20eb7015.entry.js +1 -0
  434. package/dist/webcomponents/{p-0e4e662b.entry.js → p-2437703b.entry.js} +1 -1
  435. package/dist/webcomponents/{p-a95741ee.entry.js → p-24f30623.entry.js} +1 -1
  436. package/dist/webcomponents/p-2a5ac7c9.entry.js +1 -0
  437. package/dist/webcomponents/p-2abae807.entry.js +1 -0
  438. package/dist/webcomponents/{p-2f482f5b.entry.js → p-351ffd2a.entry.js} +1 -1
  439. package/dist/webcomponents/p-35411771.entry.js +1 -0
  440. package/dist/webcomponents/{p-05c604d2.entry.js → p-366dba79.entry.js} +1 -1
  441. package/dist/webcomponents/p-3add112c.entry.js +1 -0
  442. package/dist/webcomponents/p-48e406f1.entry.js +1 -0
  443. package/dist/webcomponents/p-4d0373a7.entry.js +1 -0
  444. package/dist/webcomponents/p-55iuf7iW.js +1 -0
  445. package/dist/webcomponents/p-5cb87816.entry.js +1 -0
  446. package/dist/webcomponents/p-628cf20a.entry.js +1 -0
  447. package/dist/webcomponents/p-66422cbd.entry.js +1 -0
  448. package/dist/webcomponents/p-6f397c80.entry.js +1 -0
  449. package/dist/webcomponents/p-7929bdae.entry.js +1 -0
  450. package/dist/webcomponents/{p-30d3d0cd.entry.js → p-7a52bdb5.entry.js} +1 -1
  451. package/dist/webcomponents/p-7e24a1f7.entry.js +1 -0
  452. package/dist/webcomponents/p-8027e13f.entry.js +1 -0
  453. package/dist/webcomponents/p-86b166eb.entry.js +1 -0
  454. package/dist/webcomponents/p-889e8be8.entry.js +1 -0
  455. package/dist/webcomponents/p-8a1171de.entry.js +1 -0
  456. package/dist/webcomponents/{p-0890869b.entry.js → p-8aefc49f.entry.js} +4 -4
  457. package/dist/webcomponents/p-8b2f81b4.entry.js +1 -0
  458. package/dist/webcomponents/p-97429fb4.entry.js +1 -0
  459. package/dist/webcomponents/{p-a27405fb.entry.js → p-98b6943a.entry.js} +1 -1
  460. package/dist/webcomponents/{p-5d145701.entry.js → p-9bf095d2.entry.js} +1 -1
  461. package/dist/webcomponents/p-9c1e3fb8.entry.js +1 -0
  462. package/dist/webcomponents/{p-Dh6FEdp8.js → p-AbSg_vYv.js} +1 -1
  463. package/dist/webcomponents/p-B2uBb14Y.js +1 -0
  464. package/dist/webcomponents/p-BF51n3KG.js +1 -0
  465. package/dist/webcomponents/{p-7MWRbTXI.js → p-BH0Xfn-F.js} +1 -1
  466. package/dist/webcomponents/p-BJuv5Y2i.js +1 -0
  467. package/dist/webcomponents/p-BQLEjYfZ.js +1 -0
  468. package/dist/webcomponents/p-BRJ4FIJH.js +1 -0
  469. package/dist/webcomponents/p-BeNhCG1Q.js +1 -0
  470. package/dist/webcomponents/{p-BqK0rIZQ.js → p-BfEOvp9h.js} +1 -1
  471. package/dist/webcomponents/p-ButA5T4e.js +1 -0
  472. package/dist/webcomponents/p-C3e-DgwK.js +1 -0
  473. package/dist/webcomponents/{p-DAVX1-sW.js → p-CDIPkflV.js} +1 -1
  474. package/dist/webcomponents/{p-D3G5aVLy.js → p-CKg_luIy.js} +1 -1
  475. package/dist/webcomponents/{p-DDpc1huF.js → p-Ce8QXyUM.js} +1 -1
  476. package/dist/webcomponents/p-ChzWF0s3.js +1 -0
  477. package/dist/webcomponents/p-CjAMuB2J.js +1 -0
  478. package/dist/webcomponents/p-ClSZshaa.js +1 -0
  479. package/dist/webcomponents/{p-DAoffYFW.js → p-D0I-tRSs.js} +1 -1
  480. package/dist/webcomponents/p-D0Ko1H7J.js +1 -0
  481. package/dist/webcomponents/p-DC63XVwu.js +1 -0
  482. package/dist/webcomponents/p-DPfZxsq9.js +1 -0
  483. package/dist/webcomponents/{p-DHvfrLVU.js → p-DPnS0F0Y.js} +1 -1
  484. package/dist/webcomponents/p-DR0bMp9p.js +1 -0
  485. package/dist/webcomponents/p-DZR542ci.js +1 -0
  486. package/dist/webcomponents/p-Dn0KGDtq.js +1 -0
  487. package/dist/webcomponents/p-DniBAXrh.js +1 -0
  488. package/dist/webcomponents/{p-1adN6FVa.js → p-DpUqxsf5.js} +1 -1
  489. package/dist/webcomponents/p-DxEnw2tJ.js +1 -0
  490. package/dist/webcomponents/{p-fUv1jFAw.js → p-EAEmpCru.js} +1 -1
  491. package/dist/webcomponents/p-Ph6Ebeu2.js +1 -0
  492. package/dist/webcomponents/p-RXUoM7A2.js +1 -0
  493. package/dist/webcomponents/{p-683630d0.entry.js → p-a1c7c873.entry.js} +1 -1
  494. package/dist/webcomponents/{p-64a46b8a.entry.js → p-a95db9a6.entry.js} +1 -1
  495. package/dist/webcomponents/{p-ac538ffd.entry.js → p-a9ed792e.entry.js} +1 -1
  496. package/dist/webcomponents/p-acf4c099.entry.js +1 -0
  497. package/dist/webcomponents/p-b47000f7.entry.js +1 -0
  498. package/dist/webcomponents/{p-cb7c712f.entry.js → p-b860ec37.entry.js} +1 -1
  499. package/dist/webcomponents/p-b893d5fa.entry.js +1 -0
  500. package/dist/webcomponents/p-b9d1d9dd.entry.js +1 -0
  501. package/dist/webcomponents/p-baa04544.entry.js +1 -0
  502. package/dist/webcomponents/{p-1bddf354.entry.js → p-bbd0aa4e.entry.js} +1 -1
  503. package/dist/webcomponents/p-bf2ba40d.entry.js +1 -0
  504. package/dist/webcomponents/p-c06bd8ea.entry.js +1 -0
  505. package/dist/webcomponents/p-c0955693.entry.js +1 -0
  506. package/dist/webcomponents/{p-7d2de2d4.entry.js → p-c0bd6405.entry.js} +1 -1
  507. package/dist/webcomponents/p-c6473b9b.entry.js +1 -0
  508. package/dist/webcomponents/p-c70dc6bd.entry.js +1 -0
  509. package/dist/webcomponents/p-ca6d05f9.entry.js +1 -0
  510. package/dist/webcomponents/p-d1c1c642.entry.js +1 -0
  511. package/dist/webcomponents/p-d3c966f4.entry.js +1 -0
  512. package/dist/webcomponents/{p-f5d12ae3.entry.js → p-d49b80b1.entry.js} +1 -1
  513. package/dist/webcomponents/p-d69d09e6.entry.js +1 -0
  514. package/dist/webcomponents/p-dd3749ed.entry.js +1 -0
  515. package/dist/webcomponents/p-dfaf5b14.entry.js +1 -0
  516. package/dist/webcomponents/{p-e48a2d25.entry.js → p-e2ee826e.entry.js} +1 -1
  517. package/dist/webcomponents/p-eccb77fa.entry.js +1 -0
  518. package/dist/webcomponents/p-ede5eb9d.entry.js +1 -0
  519. package/dist/webcomponents/p-eefe4d71.entry.js +1 -0
  520. package/dist/webcomponents/p-f4f3bca9.entry.js +1 -0
  521. package/dist/webcomponents/{p-d7f62287.entry.js → p-f67133f0.entry.js} +1 -1
  522. package/dist/webcomponents/{p-70774a5a.entry.js → p-f6ad1d58.entry.js} +1 -1
  523. package/dist/webcomponents/{p-a02ce003.entry.js → p-f9bddc04.entry.js} +1 -1
  524. package/dist/webcomponents/p-rPeW3G6n.js +1 -0
  525. package/dist/webcomponents/p-xIyLUOJ6.js +1 -0
  526. package/dist/webcomponents/webcomponents.esm.js +1 -1
  527. package/package.json +1 -1
  528. package/dist/cjs/Payment-D5UynU2f.js +0 -151
  529. package/dist/cjs/header-3-BnKbOjvz.js +0 -10
  530. package/dist/cjs/justifi-billing-form.cjs.entry.js +0 -76
  531. package/dist/cjs/justifi-new-payment-method.cjs.entry.js +0 -99
  532. package/dist/cjs/justifi-payment-method-options.cjs.entry.js +0 -76
  533. package/dist/cjs/justifi-saved-payment-methods_2.cjs.entry.js +0 -117
  534. package/dist/collection/components/checkout/new-payment-method.js +0 -378
  535. package/dist/collection/components/checkout/payment-method-options.js +0 -421
  536. package/dist/esm/Payment-00TwhwCx.js +0 -149
  537. package/dist/esm/header-3-Bsi4loU1.js +0 -8
  538. package/dist/esm/justifi-billing-form.entry.js +0 -74
  539. package/dist/esm/justifi-new-payment-method.entry.js +0 -97
  540. package/dist/esm/justifi-payment-method-options.entry.js +0 -74
  541. package/dist/esm/justifi-saved-payment-methods_2.entry.js +0 -114
  542. package/dist/module/Payment.js +0 -204
  543. package/dist/module/header-3.js +0 -8
  544. package/dist/module/justifi-new-payment-method.d.ts +0 -11
  545. package/dist/module/justifi-new-payment-method.js +0 -219
  546. package/dist/module/justifi-payment-method-options.d.ts +0 -11
  547. package/dist/module/justifi-payment-method-options.js +0 -6
  548. package/dist/module/payment-method-options.js +0 -129
  549. package/dist/types/components/checkout/new-payment-method.d.ts +0 -31
  550. package/dist/types/components/checkout/payment-method-options.d.ts +0 -32
  551. package/dist/webcomponents/p-00d7c2e6.entry.js +0 -1
  552. package/dist/webcomponents/p-03e9a98c.entry.js +0 -1
  553. package/dist/webcomponents/p-05fc864a.entry.js +0 -1
  554. package/dist/webcomponents/p-09c24135.entry.js +0 -1
  555. package/dist/webcomponents/p-0f511cc1.entry.js +0 -1
  556. package/dist/webcomponents/p-100008fa.entry.js +0 -1
  557. package/dist/webcomponents/p-17825dfb.entry.js +0 -1
  558. package/dist/webcomponents/p-18b941d3.entry.js +0 -1
  559. package/dist/webcomponents/p-19308a1b.entry.js +0 -1
  560. package/dist/webcomponents/p-1a7942f7.entry.js +0 -1
  561. package/dist/webcomponents/p-1d1d956b.entry.js +0 -1
  562. package/dist/webcomponents/p-26bf2fda.entry.js +0 -1
  563. package/dist/webcomponents/p-2d3949f7.entry.js +0 -1
  564. package/dist/webcomponents/p-326f4860.entry.js +0 -1
  565. package/dist/webcomponents/p-359b8f54.entry.js +0 -1
  566. package/dist/webcomponents/p-37aeeeee.entry.js +0 -1
  567. package/dist/webcomponents/p-4887bcb3.entry.js +0 -1
  568. package/dist/webcomponents/p-54406229.entry.js +0 -1
  569. package/dist/webcomponents/p-56af4fd0.entry.js +0 -1
  570. package/dist/webcomponents/p-59656e08.entry.js +0 -1
  571. package/dist/webcomponents/p-5e813b93.entry.js +0 -1
  572. package/dist/webcomponents/p-66861ea5.entry.js +0 -1
  573. package/dist/webcomponents/p-6bd83369.entry.js +0 -1
  574. package/dist/webcomponents/p-6ee2b118.entry.js +0 -1
  575. package/dist/webcomponents/p-73afde1b.entry.js +0 -1
  576. package/dist/webcomponents/p-73bbd71c.entry.js +0 -1
  577. package/dist/webcomponents/p-74f78a4e.entry.js +0 -1
  578. package/dist/webcomponents/p-755a8d9b.entry.js +0 -1
  579. package/dist/webcomponents/p-7c456c10.entry.js +0 -1
  580. package/dist/webcomponents/p-7c6d7283.entry.js +0 -1
  581. package/dist/webcomponents/p-7e9832b3.entry.js +0 -1
  582. package/dist/webcomponents/p-810cad17.entry.js +0 -1
  583. package/dist/webcomponents/p-81478598.entry.js +0 -1
  584. package/dist/webcomponents/p-91a2707a.entry.js +0 -1
  585. package/dist/webcomponents/p-9348a7c8.entry.js +0 -1
  586. package/dist/webcomponents/p-967c3374.entry.js +0 -1
  587. package/dist/webcomponents/p-9REosSLu.js +0 -1
  588. package/dist/webcomponents/p-9c27f87f.entry.js +0 -1
  589. package/dist/webcomponents/p-B9ROmZzw.js +0 -1
  590. package/dist/webcomponents/p-BCPBc18Y.js +0 -1
  591. package/dist/webcomponents/p-BQ5bL1Y5.js +0 -1
  592. package/dist/webcomponents/p-BSW9VS7r.js +0 -1
  593. package/dist/webcomponents/p-BSexQ2qc.js +0 -1
  594. package/dist/webcomponents/p-Bc5u1WjM.js +0 -1
  595. package/dist/webcomponents/p-BjQrbohd.js +0 -1
  596. package/dist/webcomponents/p-BxWsrx5h.js +0 -1
  597. package/dist/webcomponents/p-By9Lz2e0.js +0 -1
  598. package/dist/webcomponents/p-CEp46FZK.js +0 -1
  599. package/dist/webcomponents/p-CMNxLEJP.js +0 -1
  600. package/dist/webcomponents/p-CZItg0Yo.js +0 -1
  601. package/dist/webcomponents/p-D7WGjeDy.js +0 -1
  602. package/dist/webcomponents/p-DIDbcp63.js +0 -1
  603. package/dist/webcomponents/p-DR0dQ8Fv.js +0 -1
  604. package/dist/webcomponents/p-DUqRxn4Y.js +0 -1
  605. package/dist/webcomponents/p-DbcOhajT.js +0 -1
  606. package/dist/webcomponents/p-DhAmsAOH.js +0 -1
  607. package/dist/webcomponents/p-DoEkFs2i.js +0 -1
  608. package/dist/webcomponents/p-DvXSA0b0.js +0 -1
  609. package/dist/webcomponents/p-a05062d8.entry.js +0 -1
  610. package/dist/webcomponents/p-a2f0d61c.entry.js +0 -1
  611. package/dist/webcomponents/p-b193bf46.entry.js +0 -1
  612. package/dist/webcomponents/p-b398856f.entry.js +0 -1
  613. package/dist/webcomponents/p-d33baab9.entry.js +0 -1
  614. package/dist/webcomponents/p-d3f438ca.entry.js +0 -1
  615. package/dist/webcomponents/p-d5b3c65c.entry.js +0 -1
  616. package/dist/webcomponents/p-d62e6c16.entry.js +0 -1
  617. package/dist/webcomponents/p-eba620cd.entry.js +0 -1
  618. package/dist/webcomponents/p-ecdda6e6.entry.js +0 -1
  619. package/dist/webcomponents/p-f24e201f.entry.js +0 -1
  620. package/dist/webcomponents/p-m2jmX-Hz.js +0 -1
  621. package/dist/webcomponents/p-sT4o5vru.js +0 -1
  622. package/dist/webcomponents/p-ys9CWfNG.js +0 -1
  623. package/dist/webcomponents/p-zucQG3cz.js +0 -1
@@ -0,0 +1,1673 @@
1
+ 'use strict';
2
+
3
+ var _commonjsHelpers = require('./_commonjsHelpers-BJu3ubxk.js');
4
+
5
+ var dinero_1;
6
+ var hasRequiredDinero;
7
+
8
+ function requireDinero () {
9
+ if (hasRequiredDinero) return dinero_1;
10
+ hasRequiredDinero = 1;
11
+
12
+ /**
13
+ * Default values for all Dinero objects.
14
+ *
15
+ * You can override default values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.
16
+ * Existing instances won't be affected.
17
+ *
18
+ * @property {Number} defaultAmount - The default amount for new Dinero objects (see {@link module:Dinero Dinero} for format).
19
+ * @property {String} defaultCurrency - The default currency for new Dinero objects (see {@link module:Dinero Dinero} for format).
20
+ * @property {Number} defaultPrecision - The default precision for new Dinero objects (see {@link module:Dinero Dinero} for format).
21
+ *
22
+ * @example
23
+ * // Will set currency to 'EUR' for all Dinero objects.
24
+ * Dinero.defaultCurrency = 'EUR'
25
+ *
26
+ * @type {Object}
27
+ */
28
+ var Defaults = {
29
+ defaultAmount: 0,
30
+ defaultCurrency: 'USD',
31
+ defaultPrecision: 2
32
+ };
33
+ /**
34
+ * Global settings for all Dinero objects.
35
+ *
36
+ * You can override global values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.
37
+ * Existing instances won't be affected.
38
+ *
39
+ * @property {String} globalLocale - The global locale for new Dinero objects (see {@link module:Dinero~setLocale setLocale} for format).
40
+ * @property {String} globalFormat - The global format for new Dinero objects (see {@link module:Dinero~toFormat toFormat} for format).
41
+ * @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).
42
+ * @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).
43
+ * @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).
44
+ * @property {String} globalExchangeRatesApi.propertyPath - The global exchange rate API property path for new Dinero objects (see {@link module:Dinero~convert convert} for format).
45
+ * @property {Object} globalExchangeRatesApi.headers - The global exchange rate API headers for new Dinero objects (see {@link module:Dinero~convert convert} for format).
46
+ *
47
+ * @example
48
+ * // Will set locale to 'fr-FR' for all Dinero objects.
49
+ * Dinero.globalLocale = 'fr-FR'
50
+ * @example
51
+ * // Will set global exchange rate API parameters for all Dinero objects.
52
+ * Dinero.globalExchangeRatesApi = {
53
+ * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',
54
+ * propertyPath: 'data.rates.{{to}}',
55
+ * headers: {
56
+ * 'user-key': 'xxxxxxxxx'
57
+ * }
58
+ * }
59
+ *
60
+ * @type {Object}
61
+ */
62
+
63
+ var Globals = {
64
+ globalLocale: 'en-US',
65
+ globalFormat: '$0,0.00',
66
+ globalRoundingMode: 'HALF_EVEN',
67
+ globalFormatRoundingMode: 'HALF_AWAY_FROM_ZERO',
68
+ globalExchangeRatesApi: {
69
+ endpoint: undefined,
70
+ headers: undefined,
71
+ propertyPath: undefined
72
+ }
73
+ };
74
+
75
+ function _typeof(obj) {
76
+ "@babel/helpers - typeof";
77
+
78
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
79
+ _typeof = function (obj) {
80
+ return typeof obj;
81
+ };
82
+ } else {
83
+ _typeof = function (obj) {
84
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
85
+ };
86
+ }
87
+
88
+ return _typeof(obj);
89
+ }
90
+
91
+ function _toArray(arr) {
92
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
93
+ }
94
+
95
+ function _arrayWithHoles(arr) {
96
+ if (Array.isArray(arr)) return arr;
97
+ }
98
+
99
+ function _iterableToArray(iter) {
100
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
101
+ }
102
+
103
+ function _unsupportedIterableToArray(o, minLen) {
104
+ if (!o) return;
105
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
106
+ var n = Object.prototype.toString.call(o).slice(8, -1);
107
+ if (n === "Object" && o.constructor) n = o.constructor.name;
108
+ if (n === "Map" || n === "Set") return Array.from(o);
109
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
110
+ }
111
+
112
+ function _arrayLikeToArray(arr, len) {
113
+ if (len == null || len > arr.length) len = arr.length;
114
+
115
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
116
+
117
+ return arr2;
118
+ }
119
+
120
+ function _nonIterableRest() {
121
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
122
+ }
123
+
124
+ /**
125
+ * Static methods for Dinero.
126
+ * @ignore
127
+ *
128
+ * @type {Object}
129
+ */
130
+ var Static = {
131
+ /**
132
+ * Returns an array of Dinero objects, normalized to the same precision (the highest).
133
+ *
134
+ * @memberof module:Dinero
135
+ * @method
136
+ *
137
+ * @param {Dinero[]} objects - An array of Dinero objects
138
+ *
139
+ * @example
140
+ * // returns an array of Dinero objects
141
+ * // both with a precision of 3
142
+ * // and an amount of 1000
143
+ * Dinero.normalizePrecision([
144
+ * Dinero({ amount: 100, precision: 2 }),
145
+ * Dinero({ amount: 1000, precision: 3 })
146
+ * ])
147
+ *
148
+ * @return {Dinero[]}
149
+ */
150
+ normalizePrecision: function normalizePrecision(objects) {
151
+ var highestPrecision = objects.reduce(function (a, b) {
152
+ return Math.max(a.getPrecision(), b.getPrecision());
153
+ });
154
+ return objects.map(function (object) {
155
+ return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;
156
+ });
157
+ },
158
+
159
+ /**
160
+ * Returns the smallest Dinero object from an array of Dinero objects
161
+ *
162
+ * @memberof module:Dinero
163
+ * @method
164
+ *
165
+ * @param {Dinero[]} objects - An array of Dinero objects
166
+ *
167
+ * @example
168
+ * // returns the smallest Dinero object with amount of 500 from an array of Dinero objects with different precisions
169
+ * Dinero.minimum([
170
+ * Dinero({ amount: 500, precision: 3 }),
171
+ * Dinero({ amount: 100, precision: 2 })
172
+ * ])
173
+ * @example
174
+ * // returns the smallest Dinero object with amount of 50 from an array of Dinero objects
175
+ * Dinero.minimum([
176
+ * Dinero({ amount: 50 }),
177
+ * Dinero({ amount: 100 })
178
+ * ])
179
+ *
180
+ * @return {Dinero[]}
181
+ */
182
+ minimum: function minimum(objects) {
183
+ var _objects = _toArray(objects),
184
+ firstObject = _objects[0],
185
+ tailObjects = _objects.slice(1);
186
+
187
+ var currentMinimum = firstObject;
188
+ tailObjects.forEach(function (obj) {
189
+ currentMinimum = currentMinimum.lessThan(obj) ? currentMinimum : obj;
190
+ });
191
+ return currentMinimum;
192
+ },
193
+
194
+ /**
195
+ * Returns the biggest Dinero object from an array of Dinero objects
196
+ *
197
+ * @memberof module:Dinero
198
+ * @method
199
+ *
200
+ * @param {Dinero[]} objects - An array of Dinero objects
201
+ *
202
+ * @example
203
+ * // returns the biggest Dinero object with amount of 20, from an array of Dinero objects with different precisions
204
+ * Dinero.maximum([
205
+ * Dinero({ amount: 20, precision: 2 }),
206
+ * Dinero({ amount: 150, precision: 3 })
207
+ * ])
208
+ * @example
209
+ * // returns the biggest Dinero object with amount of 100, from an array of Dinero objects
210
+ * Dinero.maximum([
211
+ * Dinero({ amount: 100 }),
212
+ * Dinero({ amount: 50 })
213
+ * ])
214
+ *
215
+ * @return {Dinero[]}
216
+ */
217
+ maximum: function maximum(objects) {
218
+ var _objects2 = _toArray(objects),
219
+ firstObject = _objects2[0],
220
+ tailObjects = _objects2.slice(1);
221
+
222
+ var currentMaximum = firstObject;
223
+ tailObjects.forEach(function (obj) {
224
+ currentMaximum = currentMaximum.greaterThan(obj) ? currentMaximum : obj;
225
+ });
226
+ return currentMaximum;
227
+ }
228
+ };
229
+
230
+ /**
231
+ * Returns whether a value is numeric.
232
+ * @ignore
233
+ *
234
+ * @param {} value - The value to test.
235
+ *
236
+ * @return {Boolean}
237
+ */
238
+ function isNumeric(value) {
239
+ return !isNaN(parseInt(value)) && isFinite(value);
240
+ }
241
+ /**
242
+ * Returns whether a value is a percentage.
243
+ * @ignore
244
+ *
245
+ * @param {} percentage - The percentage to test.
246
+ *
247
+ * @return {Boolean}
248
+ */
249
+
250
+ function isPercentage(percentage) {
251
+ return isNumeric(percentage) && percentage <= 100 && percentage >= 0;
252
+ }
253
+ /**
254
+ * Returns whether an array of ratios is valid.
255
+ * @ignore
256
+ *
257
+ * @param {} ratios - The ratios to test.
258
+ *
259
+ * @return {Boolean}
260
+ */
261
+
262
+ function areValidRatios(ratios) {
263
+ return ratios.length > 0 && ratios.every(function (ratio) {
264
+ return ratio >= 0;
265
+ }) && ratios.some(function (ratio) {
266
+ return ratio > 0;
267
+ });
268
+ }
269
+ /**
270
+ * Returns whether a value is even.
271
+ * @ignore
272
+ *
273
+ * @param {Number} value - The value to test.
274
+ *
275
+ * @return {Boolean}
276
+ */
277
+
278
+ function isEven(value) {
279
+ return value % 2 === 0;
280
+ }
281
+ /**
282
+ * Returns whether a value is a float.
283
+ * @ignore
284
+ *
285
+ * @param {} value - The value to test.
286
+ *
287
+ * @return {Boolean}
288
+ */
289
+
290
+ function isFloat(value) {
291
+ return isNumeric(value) && !Number.isInteger(value);
292
+ }
293
+ /**
294
+ * Returns how many fraction digits a number has.
295
+ * @ignore
296
+ *
297
+ * @param {Number} [number=0] - The number to test.
298
+ *
299
+ * @return {Number}
300
+ */
301
+
302
+ function countFractionDigits() {
303
+ var number = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
304
+ var stringRepresentation = number.toString();
305
+
306
+ if (stringRepresentation.indexOf('e-') > 0) {
307
+ // It's too small for a normal string representation, e.g. 1e-7 instead of 0.00000001
308
+ return parseInt(stringRepresentation.split('e-')[1]);
309
+ } else {
310
+ var fractionDigits = stringRepresentation.split('.')[1];
311
+ return fractionDigits ? fractionDigits.length : 0;
312
+ }
313
+ }
314
+ /**
315
+ * Returns whether a number is half.
316
+ * @ignore
317
+ *
318
+ * @param {Number} number - The number to test.
319
+ *
320
+ * @return {Number}
321
+ */
322
+
323
+ function isHalf(number) {
324
+ return Math.abs(number) % 1 === 0.5;
325
+ }
326
+ /**
327
+ * Fetches a JSON resource.
328
+ * @ignore
329
+ *
330
+ * @param {String} url - The resource to fetch.
331
+ * @param {Object} [options.headers] - The headers to pass.
332
+ *
333
+ * @throws {Error} If `request.status` is lesser than 200 or greater or equal to 400.
334
+ * @throws {Error} If network fails.
335
+ *
336
+ * @return {JSON}
337
+ */
338
+
339
+ function getJSON(url) {
340
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
341
+ return new Promise(function (resolve, reject) {
342
+ var request = Object.assign(new XMLHttpRequest(), {
343
+ onreadystatechange: function onreadystatechange() {
344
+ if (request.readyState === 4) {
345
+ if (request.status >= 200 && request.status < 400) resolve(JSON.parse(request.responseText));else reject(new Error(request.statusText));
346
+ }
347
+ },
348
+ onerror: function onerror() {
349
+ reject(new Error('Network error'));
350
+ }
351
+ });
352
+ request.open('GET', url, true);
353
+ setXHRHeaders(request, options.headers);
354
+ request.send();
355
+ });
356
+ }
357
+ /**
358
+ * Returns an XHR object with attached headers.
359
+ * @ignore
360
+ *
361
+ * @param {XMLHttpRequest} xhr - The XHR request to set headers to.
362
+ * @param {Object} headers - The headers to set.
363
+ *
364
+ * @return {XMLHttpRequest}
365
+ */
366
+
367
+ function setXHRHeaders(xhr) {
368
+ var headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
369
+
370
+ for (var header in headers) {
371
+ xhr.setRequestHeader(header, headers[header]);
372
+ }
373
+
374
+ return xhr;
375
+ }
376
+ /**
377
+ * Returns whether a value is undefined.
378
+ * @ignore
379
+ *
380
+ * @param {} value - The value to test.
381
+ *
382
+ * @return {Boolean}
383
+ */
384
+
385
+ function isUndefined(value) {
386
+ return typeof value === 'undefined';
387
+ }
388
+ /**
389
+ * Returns an object flattened to one level deep.
390
+ * @ignore
391
+ *
392
+ * @param {Object} object - The object to flatten.
393
+ * @param {String} separator - The separator to use between flattened nodes.
394
+ *
395
+ * @return {Object}
396
+ */
397
+
398
+ function flattenObject(object) {
399
+ var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.';
400
+ var finalObject = {};
401
+ Object.entries(object).forEach(function (item) {
402
+ if (_typeof(item[1]) === 'object') {
403
+ var flatObject = flattenObject(item[1]);
404
+ Object.entries(flatObject).forEach(function (node) {
405
+ finalObject[item[0] + separator + node[0]] = node[1];
406
+ });
407
+ } else {
408
+ finalObject[item[0]] = item[1];
409
+ }
410
+ });
411
+ return finalObject;
412
+ }
413
+ /**
414
+ * Returns whether a value is thenable.
415
+ * @ignore
416
+ *
417
+ * @param {} value - The value to test.
418
+ *
419
+ * @return {Boolean}
420
+ */
421
+
422
+ function isThenable(value) {
423
+ return Boolean(value) && (_typeof(value) === 'object' || typeof value === 'function') && typeof value.then === 'function';
424
+ }
425
+
426
+ function Calculator() {
427
+ var floatMultiply = function floatMultiply(a, b) {
428
+ var getFactor = function getFactor(number) {
429
+ return Math.pow(10, countFractionDigits(number));
430
+ };
431
+
432
+ var factor = Math.max(getFactor(a), getFactor(b));
433
+ return Math.round(a * factor) * Math.round(b * factor) / (factor * factor);
434
+ };
435
+
436
+ var roundingModes = {
437
+ HALF_ODD: function HALF_ODD(number) {
438
+ var rounded = Math.round(number);
439
+ return isHalf(number) ? isEven(rounded) ? rounded - 1 : rounded : rounded;
440
+ },
441
+ HALF_EVEN: function HALF_EVEN(number) {
442
+ var rounded = Math.round(number);
443
+ return isHalf(number) ? isEven(rounded) ? rounded : rounded - 1 : rounded;
444
+ },
445
+ HALF_UP: function HALF_UP(number) {
446
+ return Math.round(number);
447
+ },
448
+ HALF_DOWN: function HALF_DOWN(number) {
449
+ return isHalf(number) ? Math.floor(number) : Math.round(number);
450
+ },
451
+ HALF_TOWARDS_ZERO: function HALF_TOWARDS_ZERO(number) {
452
+ return isHalf(number) ? Math.sign(number) * Math.floor(Math.abs(number)) : Math.round(number);
453
+ },
454
+ HALF_AWAY_FROM_ZERO: function HALF_AWAY_FROM_ZERO(number) {
455
+ return isHalf(number) ? Math.sign(number) * Math.ceil(Math.abs(number)) : Math.round(number);
456
+ },
457
+ DOWN: function DOWN(number) {
458
+ return Math.floor(number);
459
+ }
460
+ };
461
+ return {
462
+ /**
463
+ * Returns the sum of two numbers.
464
+ * @ignore
465
+ *
466
+ * @param {Number} a - The first number to add.
467
+ * @param {Number} b - The second number to add.
468
+ *
469
+ * @return {Number}
470
+ */
471
+ add: function add(a, b) {
472
+ return a + b;
473
+ },
474
+
475
+ /**
476
+ * Returns the difference of two numbers.
477
+ * @ignore
478
+ *
479
+ * @param {Number} a - The first number to subtract.
480
+ * @param {Number} b - The second number to subtract.
481
+ *
482
+ * @return {Number}
483
+ */
484
+ subtract: function subtract(a, b) {
485
+ return a - b;
486
+ },
487
+
488
+ /**
489
+ * Returns the product of two numbers.
490
+ * @ignore
491
+ *
492
+ * @param {Number} a - The first number to multiply.
493
+ * @param {Number} b - The second number to multiply.
494
+ *
495
+ * @return {Number}
496
+ */
497
+ multiply: function multiply(a, b) {
498
+ return isFloat(a) || isFloat(b) ? floatMultiply(a, b) : a * b;
499
+ },
500
+
501
+ /**
502
+ * Returns the quotient of two numbers.
503
+ * @ignore
504
+ *
505
+ * @param {Number} a - The first number to divide.
506
+ * @param {Number} b - The second number to divide.
507
+ *
508
+ * @return {Number}
509
+ */
510
+ divide: function divide(a, b) {
511
+ return a / b;
512
+ },
513
+
514
+ /**
515
+ * Returns the remainder of two numbers.
516
+ * @ignore
517
+ *
518
+ * @param {Number} a - The first number to divide.
519
+ * @param {Number} b - The second number to divide.
520
+ *
521
+ * @return {Number}
522
+ */
523
+ modulo: function modulo(a, b) {
524
+ return a % b;
525
+ },
526
+
527
+ /**
528
+ * Returns a rounded number based off a specific rounding mode.
529
+ * @ignore
530
+ *
531
+ * @param {Number} number - The number to round.
532
+ * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use.
533
+ *
534
+ * @returns {Number}
535
+ */
536
+ round: function round(number) {
537
+ var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'HALF_EVEN';
538
+ return roundingModes[roundingMode](number);
539
+ }
540
+ };
541
+ }
542
+
543
+ var calculator = Calculator();
544
+ function Format(format) {
545
+ var matches = /^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(format);
546
+ return {
547
+ /**
548
+ * Returns the matches.
549
+ * @ignore
550
+ *
551
+ * @return {Array}
552
+ */
553
+ getMatches: function getMatches() {
554
+ return matches !== null ? matches.slice(1).filter(function (match) {
555
+ return !isUndefined(match);
556
+ }) : [];
557
+ },
558
+
559
+ /**
560
+ * Returns the amount of fraction digits to display.
561
+ * @ignore
562
+ *
563
+ * @return {Number}
564
+ */
565
+ getMinimumFractionDigits: function getMinimumFractionDigits() {
566
+ var decimalPosition = function decimalPosition(match) {
567
+ return match === '.';
568
+ };
569
+
570
+ return !isUndefined(this.getMatches().find(decimalPosition)) ? this.getMatches()[calculator.add(this.getMatches().findIndex(decimalPosition), 1)].split('').length : 0;
571
+ },
572
+
573
+ /**
574
+ * Returns the currency display mode.
575
+ * @ignore
576
+ *
577
+ * @return {String}
578
+ */
579
+ getCurrencyDisplay: function getCurrencyDisplay() {
580
+ var modes = {
581
+ USD: 'code',
582
+ dollar: 'name',
583
+ $: 'symbol'
584
+ };
585
+ return modes[this.getMatches().find(function (match) {
586
+ return match === 'USD' || match === 'dollar' || match === '$';
587
+ })];
588
+ },
589
+
590
+ /**
591
+ * Returns the formatting style.
592
+ * @ignore
593
+ *
594
+ * @return {String}
595
+ */
596
+ getStyle: function getStyle() {
597
+ return !isUndefined(this.getCurrencyDisplay(this.getMatches())) ? 'currency' : 'decimal';
598
+ },
599
+
600
+ /**
601
+ * Returns whether grouping should be used or not.
602
+ * @ignore
603
+ *
604
+ * @return {Boolean}
605
+ */
606
+ getUseGrouping: function getUseGrouping() {
607
+ return !isUndefined(this.getMatches().find(function (match) {
608
+ return match === ',';
609
+ }));
610
+ }
611
+ };
612
+ }
613
+
614
+ function CurrencyConverter(options) {
615
+ /* istanbul ignore next */
616
+ var mergeTags = function mergeTags() {
617
+ var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
618
+ var tags = arguments.length > 1 ? arguments[1] : undefined;
619
+
620
+ for (var tag in tags) {
621
+ string = string.replace("{{".concat(tag, "}}"), tags[tag]);
622
+ }
623
+
624
+ return string;
625
+ };
626
+ /* istanbul ignore next */
627
+
628
+
629
+ var getRatesFromRestApi = function getRatesFromRestApi(from, to) {
630
+ return getJSON(mergeTags(options.endpoint, {
631
+ from: from,
632
+ to: to
633
+ }), {
634
+ headers: options.headers
635
+ });
636
+ };
637
+
638
+ return {
639
+ /**
640
+ * Returns the exchange rate.
641
+ * @ignore
642
+ *
643
+ * @param {String} from - The base currency.
644
+ * @param {String} to - The destination currency.
645
+ *
646
+ * @return {Promise}
647
+ */
648
+ getExchangeRate: function getExchangeRate(from, to) {
649
+ return (isThenable(options.endpoint) ? options.endpoint : getRatesFromRestApi(from, to)).then(function (data) {
650
+ return flattenObject(data)[mergeTags(options.propertyPath, {
651
+ from: from,
652
+ to: to
653
+ })];
654
+ });
655
+ }
656
+ };
657
+ }
658
+
659
+ /**
660
+ * Performs an assertion.
661
+ * @ignore
662
+ *
663
+ * @param {Boolean} condition - The expression to assert.
664
+ * @param {String} errorMessage - The message to throw if the assertion fails
665
+ * @param {ErrorConstructor} [ErrorType=Error] - The error to throw if the assertion fails.
666
+ *
667
+ * @throws {Error} If `condition` returns `false`.
668
+ */
669
+
670
+ function assert(condition, errorMessage) {
671
+ var ErrorType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Error;
672
+ if (!condition) throw new ErrorType(errorMessage);
673
+ }
674
+ /**
675
+ * Asserts a value is a percentage.
676
+ * @ignore
677
+ *
678
+ * @param {} percentage - The percentage to test.
679
+ *
680
+ * @throws {RangeError} If `percentage` is out of range.
681
+ */
682
+
683
+ function assertPercentage(percentage) {
684
+ assert(isPercentage(percentage), 'You must provide a numeric value between 0 and 100.', RangeError);
685
+ }
686
+ /**
687
+ * Asserts an array of ratios is valid.
688
+ * @ignore
689
+ *
690
+ * @param {} ratios - The ratios to test.
691
+ *
692
+ * @throws {TypeError} If `ratios` are invalid.
693
+ */
694
+
695
+ function assertValidRatios(ratios) {
696
+ assert(areValidRatios(ratios), 'You must provide a non-empty array of numeric values greater than 0.', TypeError);
697
+ }
698
+ /**
699
+ * Asserts a value is an integer.
700
+ * @ignore
701
+ *
702
+ * @param {} number - The value to test.
703
+ *
704
+ * @throws {TypeError}
705
+ */
706
+
707
+ function assertInteger(number) {
708
+ assert(Number.isInteger(number), 'You must provide an integer.', TypeError);
709
+ }
710
+
711
+ var calculator$1 = Calculator();
712
+ /**
713
+ * A Dinero object is an immutable data structure representing a specific monetary value.
714
+ * It comes with methods for creating, parsing, manipulating, testing, transforming and formatting them.
715
+ *
716
+ * A Dinero object has:
717
+ *
718
+ * * An `amount`, expressed in minor currency units, as an integer.
719
+ * * A `currency`, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.
720
+ * * A `precision`, expressed as an integer, to represent the number of decimal places in the `amount`.
721
+ * This is helpful when you want to represent fractional minor currency units (e.g.: $10.4545).
722
+ * 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`)).
723
+ * * An optional `locale` property that affects how output strings are formatted.
724
+ *
725
+ * Here's an overview of the public API:
726
+ *
727
+ * * **Access:** {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~getCurrency getCurrency}, {@link module:Dinero~getLocale getLocale} and {@link module:Dinero~getPrecision getPrecision}.
728
+ * * **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}.
729
+ * * **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}.
730
+ * * **Configuration:** {@link module:Dinero~setLocale setLocale}.
731
+ * * **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}.
732
+ *
733
+ * 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.
734
+ * Same goes with performing calculations: once the internal `amount` value exceeds those limits, precision is no longer guaranteed.
735
+ *
736
+ * @module Dinero
737
+ * @param {Number} [options.amount=0] - The amount in minor currency units (as an integer).
738
+ * @param {String} [options.currency='USD'] - An ISO 4217 currency code.
739
+ * @param {String} [options.precision=2] - The number of decimal places to represent.
740
+ *
741
+ * @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.
742
+ *
743
+ * @return {Object}
744
+ */
745
+
746
+ var Dinero = function Dinero(options) {
747
+ var _Object$assign = Object.assign({}, {
748
+ amount: Dinero.defaultAmount,
749
+ currency: Dinero.defaultCurrency,
750
+ precision: Dinero.defaultPrecision
751
+ }, options),
752
+ amount = _Object$assign.amount,
753
+ currency = _Object$assign.currency,
754
+ precision = _Object$assign.precision;
755
+
756
+ assertInteger(amount);
757
+ assertInteger(precision);
758
+ var globalLocale = Dinero.globalLocale,
759
+ globalFormat = Dinero.globalFormat,
760
+ globalRoundingMode = Dinero.globalRoundingMode,
761
+ globalFormatRoundingMode = Dinero.globalFormatRoundingMode;
762
+ var globalExchangeRatesApi = Object.assign({}, Dinero.globalExchangeRatesApi);
763
+ /**
764
+ * Uses ES5 function notation so `this` can be passed through call, apply and bind
765
+ * @ignore
766
+ */
767
+
768
+ var create = function create(options) {
769
+ var obj = Object.assign({}, Object.assign({}, {
770
+ amount: amount,
771
+ currency: currency,
772
+ precision: precision
773
+ }, options), Object.assign({}, {
774
+ locale: this.locale
775
+ }, options));
776
+ return Object.assign(Dinero({
777
+ amount: obj.amount,
778
+ currency: obj.currency,
779
+ precision: obj.precision
780
+ }), {
781
+ locale: obj.locale
782
+ });
783
+ };
784
+ /**
785
+ * Uses ES5 function notation so `this` can be passed through call, apply and bind
786
+ * @ignore
787
+ */
788
+
789
+
790
+ var assertSameCurrency = function assertSameCurrency(comparator) {
791
+ assert(this.hasSameCurrency(comparator), 'You must provide a Dinero instance with the same currency.', TypeError);
792
+ };
793
+
794
+ return {
795
+ /**
796
+ * Returns the amount.
797
+ *
798
+ * @example
799
+ * // returns 500
800
+ * Dinero({ amount: 500 }).getAmount()
801
+ *
802
+ * @return {Number}
803
+ */
804
+ getAmount: function getAmount() {
805
+ return amount;
806
+ },
807
+
808
+ /**
809
+ * Returns the currency.
810
+ *
811
+ * @example
812
+ * // returns 'EUR'
813
+ * Dinero({ currency: 'EUR' }).getCurrency()
814
+ *
815
+ * @return {String}
816
+ */
817
+ getCurrency: function getCurrency() {
818
+ return currency;
819
+ },
820
+
821
+ /**
822
+ * Returns the locale.
823
+ *
824
+ * @example
825
+ * // returns 'fr-FR'
826
+ * Dinero().setLocale('fr-FR').getLocale()
827
+ *
828
+ * @return {String}
829
+ */
830
+ getLocale: function getLocale() {
831
+ return this.locale || globalLocale;
832
+ },
833
+
834
+ /**
835
+ * Returns a new Dinero object with an embedded locale.
836
+ *
837
+ * @param {String} newLocale - The new locale as an {@link http://tools.ietf.org/html/rfc5646 BCP 47 language tag}.
838
+ *
839
+ * @example
840
+ * // Returns a Dinero object with locale 'ja-JP'
841
+ * Dinero().setLocale('ja-JP')
842
+ *
843
+ * @return {Dinero}
844
+ */
845
+ setLocale: function setLocale(newLocale) {
846
+ return create.call(this, {
847
+ locale: newLocale
848
+ });
849
+ },
850
+
851
+ /**
852
+ * Returns the precision.
853
+ *
854
+ * @example
855
+ * // returns 3
856
+ * Dinero({ precision: 3 }).getPrecision()
857
+ *
858
+ * @return {Number}
859
+ */
860
+ getPrecision: function getPrecision() {
861
+ return precision;
862
+ },
863
+
864
+ /**
865
+ * Returns a new Dinero object with a new precision and a converted amount.
866
+ *
867
+ * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
868
+ * This can be necessary when you need to convert objects to a smaller precision.
869
+ *
870
+ * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent conversions for safer results.
871
+ * You can also specify a different `roundingMode` to better fit your needs.
872
+ *
873
+ * @param {Number} newPrecision - The new precision.
874
+ * @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'`.
875
+ *
876
+ * @example
877
+ * // Returns a Dinero object with precision 3 and amount 1000
878
+ * Dinero({ amount: 100, precision: 2 }).convertPrecision(3)
879
+ *
880
+ * @throws {TypeError} If `newPrecision` is invalid.
881
+ *
882
+ * @return {Dinero}
883
+ */
884
+ convertPrecision: function convertPrecision(newPrecision) {
885
+ var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
886
+ assertInteger(newPrecision);
887
+ var precision = this.getPrecision();
888
+ var isNewPrecisionLarger = newPrecision > precision;
889
+ var operation = isNewPrecisionLarger ? calculator$1.multiply : calculator$1.divide;
890
+ var terms = isNewPrecisionLarger ? [newPrecision, precision] : [precision, newPrecision];
891
+ var factor = Math.pow(10, calculator$1.subtract.apply(calculator$1, terms));
892
+ return create.call(this, {
893
+ amount: calculator$1.round(operation(this.getAmount(), factor), roundingMode),
894
+ precision: newPrecision
895
+ });
896
+ },
897
+
898
+ /**
899
+ * Returns a new Dinero object that represents the sum of this and an other Dinero object.
900
+ *
901
+ * If Dinero objects have a different `precision`, they will be first converted to the highest.
902
+ *
903
+ * @param {Dinero} addend - The Dinero object to add.
904
+ *
905
+ * @example
906
+ * // returns a Dinero object with amount 600
907
+ * Dinero({ amount: 400 }).add(Dinero({ amount: 200 }))
908
+ * @example
909
+ * // returns a Dinero object with amount 144545 and precision 4
910
+ * Dinero({ amount: 400 }).add(Dinero({ amount: 104545, precision: 4 }))
911
+ *
912
+ * @throws {TypeError} If `addend` has a different currency.
913
+ *
914
+ * @return {Dinero}
915
+ */
916
+ add: function add(addend) {
917
+ assertSameCurrency.call(this, addend);
918
+ var addends = Dinero.normalizePrecision([this, addend]);
919
+ return create.call(this, {
920
+ amount: calculator$1.add(addends[0].getAmount(), addends[1].getAmount()),
921
+ precision: addends[0].getPrecision()
922
+ });
923
+ },
924
+
925
+ /**
926
+ * Returns a new Dinero object that represents the difference of this and an other Dinero object.
927
+ *
928
+ * If Dinero objects have a different `precision`, they will be first converted to the highest.
929
+ *
930
+ * @param {Dinero} subtrahend - The Dinero object to subtract.
931
+ *
932
+ * @example
933
+ * // returns a Dinero object with amount 200
934
+ * Dinero({ amount: 400 }).subtract(Dinero({ amount: 200 }))
935
+ * @example
936
+ * // returns a Dinero object with amount 64545 and precision 4
937
+ * Dinero({ amount: 104545, precision: 4 }).subtract(Dinero({ amount: 400 }))
938
+ *
939
+ * @throws {TypeError} If `subtrahend` has a different currency.
940
+ *
941
+ * @return {Dinero}
942
+ */
943
+ subtract: function subtract(subtrahend) {
944
+ assertSameCurrency.call(this, subtrahend);
945
+ var subtrahends = Dinero.normalizePrecision([this, subtrahend]);
946
+ return create.call(this, {
947
+ amount: calculator$1.subtract(subtrahends[0].getAmount(), subtrahends[1].getAmount()),
948
+ precision: subtrahends[0].getPrecision()
949
+ });
950
+ },
951
+
952
+ /**
953
+ * Returns a new Dinero object that represents the multiplied value by the given factor.
954
+ *
955
+ * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
956
+ *
957
+ * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
958
+ * You can also specify a different `roundingMode` to better fit your needs.
959
+ *
960
+ * @param {Number} multiplier - The factor to multiply by.
961
+ * @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'`.
962
+ *
963
+ * @example
964
+ * // returns a Dinero object with amount 1600
965
+ * Dinero({ amount: 400 }).multiply(4)
966
+ * @example
967
+ * // returns a Dinero object with amount 800
968
+ * Dinero({ amount: 400 }).multiply(2.001)
969
+ * @example
970
+ * // returns a Dinero object with amount 801
971
+ * Dinero({ amount: 400 }).multiply(2.00125, 'HALF_UP')
972
+ *
973
+ * @return {Dinero}
974
+ */
975
+ multiply: function multiply(multiplier) {
976
+ var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
977
+ return create.call(this, {
978
+ amount: calculator$1.round(calculator$1.multiply(this.getAmount(), multiplier), roundingMode)
979
+ });
980
+ },
981
+
982
+ /**
983
+ * Returns a new Dinero object that represents the divided value by the given factor.
984
+ *
985
+ * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).
986
+ *
987
+ * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.
988
+ * You can also specify a different `roundingMode` to better fit your needs.
989
+ *
990
+ * 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.
991
+ *
992
+ * @param {Number} divisor - The factor to divide by.
993
+ * @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'`.
994
+ *
995
+ * @example
996
+ * // returns a Dinero object with amount 100
997
+ * Dinero({ amount: 400 }).divide(4)
998
+ * @example
999
+ * // returns a Dinero object with amount 52
1000
+ * Dinero({ amount: 105 }).divide(2)
1001
+ * @example
1002
+ * // returns a Dinero object with amount 53
1003
+ * Dinero({ amount: 105 }).divide(2, 'HALF_UP')
1004
+ *
1005
+ * @return {Dinero}
1006
+ */
1007
+ divide: function divide(divisor) {
1008
+ var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
1009
+ return create.call(this, {
1010
+ amount: calculator$1.round(calculator$1.divide(this.getAmount(), divisor), roundingMode)
1011
+ });
1012
+ },
1013
+
1014
+ /**
1015
+ * Returns a new Dinero object that represents a percentage of this.
1016
+ *
1017
+ * 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.
1018
+ *
1019
+ * @param {Number} percentage - The percentage to extract (between 0 and 100).
1020
+ * @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'`.
1021
+ *
1022
+ * @example
1023
+ * // returns a Dinero object with amount 5000
1024
+ * Dinero({ amount: 10000 }).percentage(50)
1025
+ * @example
1026
+ * // returns a Dinero object with amount 29
1027
+ * Dinero({ amount: 57 }).percentage(50, "HALF_ODD")
1028
+ *
1029
+ * @throws {RangeError} If `percentage` is out of range.
1030
+ *
1031
+ * @return {Dinero}
1032
+ */
1033
+ percentage: function percentage(_percentage) {
1034
+ var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;
1035
+ assertPercentage(_percentage);
1036
+ return this.multiply(calculator$1.divide(_percentage, 100), roundingMode);
1037
+ },
1038
+
1039
+ /**
1040
+ * Allocates the amount of a Dinero object according to a list of ratios.
1041
+ *
1042
+ * Sometimes you need to split monetary values but percentages can't cut it without adding or losing pennies.
1043
+ * A good example is invoicing: let's say you need to bill $1,000.03 and you want a 50% downpayment.
1044
+ * 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.
1045
+ * If you round it, you'll bill a penny extra.
1046
+ * With {@link module:Dinero~allocate allocate}, you can split a monetary amount then distribute the remainder as evenly as possible.
1047
+ *
1048
+ * You can use percentage style or ratio style for `ratios`: `[25, 75]` and `[1, 3]` will do the same thing.
1049
+ *
1050
+ * 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.
1051
+ *
1052
+ * @param {Number[]} ratios - The ratios to allocate the money to.
1053
+ *
1054
+ * @example
1055
+ * // returns an array of two Dinero objects
1056
+ * // the first one with an amount of 502
1057
+ * // the second one with an amount of 501
1058
+ * Dinero({ amount: 1003 }).allocate([50, 50])
1059
+ * @example
1060
+ * // returns an array of two Dinero objects
1061
+ * // the first one with an amount of 25
1062
+ * // the second one with an amount of 75
1063
+ * Dinero({ amount: 100 }).allocate([1, 3])
1064
+ * @example
1065
+ * // since version 1.8.0
1066
+ * // returns an array of three Dinero objects
1067
+ * // the first one with an amount of 0
1068
+ * // the second one with an amount of 502
1069
+ * // the third one with an amount of 501
1070
+ * Dinero({ amount: 1003 }).allocate([0, 50, 50])
1071
+ *
1072
+ * @throws {TypeError} If ratios are invalid.
1073
+ *
1074
+ * @return {Dinero[]}
1075
+ */
1076
+ allocate: function allocate(ratios) {
1077
+ var _this = this;
1078
+
1079
+ assertValidRatios(ratios);
1080
+ var total = ratios.reduce(function (a, b) {
1081
+ return calculator$1.add(a, b);
1082
+ });
1083
+ var remainder = this.getAmount();
1084
+ var shares = ratios.map(function (ratio) {
1085
+ var share = Math.floor(calculator$1.divide(calculator$1.multiply(_this.getAmount(), ratio), total));
1086
+ remainder = calculator$1.subtract(remainder, share);
1087
+ return create.call(_this, {
1088
+ amount: share
1089
+ });
1090
+ });
1091
+ var i = 0;
1092
+
1093
+ while (remainder > 0) {
1094
+ if (ratios[i] > 0) {
1095
+ shares[i] = shares[i].add(create.call(this, {
1096
+ amount: 1
1097
+ }));
1098
+ remainder = calculator$1.subtract(remainder, 1);
1099
+ }
1100
+
1101
+ i += 1;
1102
+ }
1103
+
1104
+ return shares;
1105
+ },
1106
+
1107
+ /**
1108
+ * Returns a Promise containing a new Dinero object converted to another currency.
1109
+ *
1110
+ * You have two options to provide the exchange rates:
1111
+ *
1112
+ * 1. **Use an exchange rate REST API, and let Dinero handle the fetching and conversion.**
1113
+ * This is a simple option if you have access to an exchange rate REST API and want Dinero to do the rest.
1114
+ * 2. **Fetch the exchange rates on your own and provide them directly.**
1115
+ * 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.
1116
+ *
1117
+ * **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.
1118
+ *
1119
+ * Here are some exchange rate APIs you can use:
1120
+ *
1121
+ * * [Fixer](https://fixer.io)
1122
+ * * [Open Exchange Rates](https://openexchangerates.org)
1123
+ * * [Coinbase](https://api.coinbase.com/v2/exchange-rates)
1124
+ * * More [foreign](https://github.com/toddmotto/public-apis#currency-exchange) and [crypto](https://github.com/toddmotto/public-apis#cryptocurrency) exchange rate APIs.
1125
+ *
1126
+ * **If you want to fetch your own rates and provide them directly**, you need to pass a promise that resolves to the exchanges rates.
1127
+ *
1128
+ * In both cases, you need to specify at least:
1129
+ *
1130
+ * * a **destination currency**: the currency in which you want to convert your Dinero object. You can specify it with `currency`.
1131
+ * * 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`.
1132
+ * * 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:
1133
+ * ```json
1134
+ * {
1135
+ * "data": {
1136
+ * "base": "USD",
1137
+ * "destination": "EUR",
1138
+ * "rate": "0.827728919"
1139
+ * }
1140
+ * }
1141
+ * ```
1142
+ * Then the property path is `'data.rate'`. You can specify it with `options.propertyPath`.
1143
+ *
1144
+ * 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}}`.
1145
+ * You can use these tags to refer to these values in `options.endpoint` and `options.propertyPath`.
1146
+ *
1147
+ * For example, if you need to specify the base currency as a query parameter, you can do the following:
1148
+ *
1149
+ * ```js
1150
+ * {
1151
+ * endpoint: 'https://yourexchangerates.api/latest?base={{from}}'
1152
+ * }
1153
+ * ```
1154
+ *
1155
+ * @param {String} currency - The destination currency, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.
1156
+ * @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.
1157
+ * @param {String} [options.propertyPath='rates.{{to}}'] - The property path to the rate.
1158
+ * @param {Object} [options.headers] - The HTTP headers to provide, if needed.
1159
+ * @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'`.
1160
+ *
1161
+ * @example
1162
+ * // your global API parameters
1163
+ * Dinero.globalExchangeRatesApi = { ... }
1164
+ *
1165
+ * // returns a Promise containing a Dinero object with the destination currency
1166
+ * // and the initial amount converted to the new currency.
1167
+ * Dinero({ amount: 500 }).convert('EUR')
1168
+ * @example
1169
+ * // returns a Promise containing a Dinero object,
1170
+ * // with specific API parameters and rounding mode for this specific instance.
1171
+ * Dinero({ amount: 500 })
1172
+ * .convert('XBT', {
1173
+ * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',
1174
+ * propertyPath: 'data.rates.{{to}}',
1175
+ * headers: {
1176
+ * 'user-key': 'xxxxxxxxx'
1177
+ * },
1178
+ * roundingMode: 'HALF_UP'
1179
+ * })
1180
+ * @example
1181
+ * // usage with exchange rates provided as a custom promise
1182
+ * // using the default `propertyPath` format (so it doesn't have to be specified)
1183
+ * const rates = {
1184
+ * rates: {
1185
+ * EUR: 0.81162
1186
+ * }
1187
+ * }
1188
+ *
1189
+ * Dinero({ amount: 500 })
1190
+ * .convert('EUR', {
1191
+ * endpoint: new Promise(resolve => resolve(rates))
1192
+ * })
1193
+ * @example
1194
+ * // usage with Promise.prototype.then and Promise.prototype.catch
1195
+ * Dinero({ amount: 500 })
1196
+ * .convert('EUR')
1197
+ * .then(dinero => {
1198
+ * dinero.getCurrency() // returns 'EUR'
1199
+ * })
1200
+ * .catch(err => {
1201
+ * // handle errors
1202
+ * })
1203
+ * @example
1204
+ * // usage with async/await
1205
+ * (async () => {
1206
+ * const price = await Dinero({ amount: 500 }).convert('EUR')
1207
+ * price.getCurrency() // returns 'EUR'
1208
+ * })()
1209
+ *
1210
+ * @return {Promise}
1211
+ */
1212
+ convert: function convert(currency) {
1213
+ var _this2 = this;
1214
+
1215
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1216
+ _ref$endpoint = _ref.endpoint,
1217
+ endpoint = _ref$endpoint === void 0 ? globalExchangeRatesApi.endpoint : _ref$endpoint,
1218
+ _ref$propertyPath = _ref.propertyPath,
1219
+ propertyPath = _ref$propertyPath === void 0 ? globalExchangeRatesApi.propertyPath || 'rates.{{to}}' : _ref$propertyPath,
1220
+ _ref$headers = _ref.headers,
1221
+ headers = _ref$headers === void 0 ? globalExchangeRatesApi.headers : _ref$headers,
1222
+ _ref$roundingMode = _ref.roundingMode,
1223
+ roundingMode = _ref$roundingMode === void 0 ? globalRoundingMode : _ref$roundingMode;
1224
+
1225
+ var options = Object.assign({}, {
1226
+ endpoint: endpoint,
1227
+ propertyPath: propertyPath,
1228
+ headers: headers,
1229
+ roundingMode: roundingMode
1230
+ });
1231
+ return CurrencyConverter(options).getExchangeRate(this.getCurrency(), currency).then(function (rate) {
1232
+ assert(!isUndefined(rate), "No rate was found for the destination currency \"".concat(currency, "\"."), TypeError);
1233
+ return create.call(_this2, {
1234
+ amount: calculator$1.round(calculator$1.multiply(_this2.getAmount(), parseFloat(rate)), options.roundingMode),
1235
+ currency: currency
1236
+ });
1237
+ });
1238
+ },
1239
+
1240
+ /**
1241
+ * Checks whether the value represented by this object equals to the other.
1242
+ *
1243
+ * @param {Dinero} comparator - The Dinero object to compare to.
1244
+ *
1245
+ * @example
1246
+ * // returns true
1247
+ * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))
1248
+ * @example
1249
+ * // returns false
1250
+ * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))
1251
+ * @example
1252
+ * // returns false
1253
+ * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))
1254
+ * @example
1255
+ * // returns false
1256
+ * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))
1257
+ * @example
1258
+ * // returns true
1259
+ * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))
1260
+ * @example
1261
+ * // returns false
1262
+ * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))
1263
+ *
1264
+ * @return {Boolean}
1265
+ */
1266
+ equalsTo: function equalsTo(comparator) {
1267
+ return this.hasSameAmount(comparator) && this.hasSameCurrency(comparator);
1268
+ },
1269
+
1270
+ /**
1271
+ * Checks whether the value represented by this object is less than the other.
1272
+ *
1273
+ * @param {Dinero} comparator - The Dinero object to compare to.
1274
+ *
1275
+ * @example
1276
+ * // returns true
1277
+ * Dinero({ amount: 500 }).lessThan(Dinero({ amount: 800 }))
1278
+ * @example
1279
+ * // returns false
1280
+ * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 500 }))
1281
+ * @example
1282
+ * // returns true
1283
+ * Dinero({ amount: 5000, precision: 3 }).lessThan(Dinero({ amount: 800 }))
1284
+ * @example
1285
+ * // returns false
1286
+ * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 5000, precision: 3 }))
1287
+ *
1288
+ * @throws {TypeError} If `comparator` has a different currency.
1289
+ *
1290
+ * @return {Boolean}
1291
+ */
1292
+ lessThan: function lessThan(comparator) {
1293
+ assertSameCurrency.call(this, comparator);
1294
+ var comparators = Dinero.normalizePrecision([this, comparator]);
1295
+ return comparators[0].getAmount() < comparators[1].getAmount();
1296
+ },
1297
+
1298
+ /**
1299
+ * Checks whether the value represented by this object is less than or equal to the other.
1300
+ *
1301
+ * @param {Dinero} comparator - The Dinero object to compare to.
1302
+ *
1303
+ * @example
1304
+ * // returns true
1305
+ * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 800 }))
1306
+ * @example
1307
+ * // returns true
1308
+ * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 500 }))
1309
+ * @example
1310
+ * // returns false
1311
+ * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 300 }))
1312
+ * @example
1313
+ * // returns true
1314
+ * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 800 }))
1315
+ * @example
1316
+ * // returns true
1317
+ * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 500 }))
1318
+ * @example
1319
+ * // returns false
1320
+ * Dinero({ amount: 800 }).lessThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
1321
+ *
1322
+ * @throws {TypeError} If `comparator` has a different currency.
1323
+ *
1324
+ * @return {Boolean}
1325
+ */
1326
+ lessThanOrEqual: function lessThanOrEqual(comparator) {
1327
+ assertSameCurrency.call(this, comparator);
1328
+ var comparators = Dinero.normalizePrecision([this, comparator]);
1329
+ return comparators[0].getAmount() <= comparators[1].getAmount();
1330
+ },
1331
+
1332
+ /**
1333
+ * Checks whether the value represented by this object is greater than the other.
1334
+ *
1335
+ * @param {Dinero} comparator - The Dinero object to compare to.
1336
+ *
1337
+ * @example
1338
+ * // returns false
1339
+ * Dinero({ amount: 500 }).greaterThan(Dinero({ amount: 800 }))
1340
+ * @example
1341
+ * // returns true
1342
+ * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 500 }))
1343
+ * @example
1344
+ * // returns true
1345
+ * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 5000, precision: 3 }))
1346
+ * @example
1347
+ * // returns false
1348
+ * Dinero({ amount: 5000, precision: 3 }).greaterThan(Dinero({ amount: 800 }))
1349
+ *
1350
+ * @throws {TypeError} If `comparator` has a different currency.
1351
+ *
1352
+ * @return {Boolean}
1353
+ */
1354
+ greaterThan: function greaterThan(comparator) {
1355
+ assertSameCurrency.call(this, comparator);
1356
+ var comparators = Dinero.normalizePrecision([this, comparator]);
1357
+ return comparators[0].getAmount() > comparators[1].getAmount();
1358
+ },
1359
+
1360
+ /**
1361
+ * Checks whether the value represented by this object is greater than or equal to the other.
1362
+ *
1363
+ * @param {Dinero} comparator - The Dinero object to compare to.
1364
+ *
1365
+ * @example
1366
+ * // returns true
1367
+ * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 300 }))
1368
+ * @example
1369
+ * // returns true
1370
+ * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 500 }))
1371
+ * @example
1372
+ * // returns false
1373
+ * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 800 }))
1374
+ * @example
1375
+ * // returns true
1376
+ * Dinero({ amount: 800 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
1377
+ * @example
1378
+ * // returns true
1379
+ * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))
1380
+ * @example
1381
+ * // returns false
1382
+ * Dinero({ amount: 5000, precision: 3 }).greaterThanOrEqual(Dinero({ amount: 800 }))
1383
+ *
1384
+ * @throws {TypeError} If `comparator` has a different currency.
1385
+ *
1386
+ * @return {Boolean}
1387
+ */
1388
+ greaterThanOrEqual: function greaterThanOrEqual(comparator) {
1389
+ assertSameCurrency.call(this, comparator);
1390
+ var comparators = Dinero.normalizePrecision([this, comparator]);
1391
+ return comparators[0].getAmount() >= comparators[1].getAmount();
1392
+ },
1393
+
1394
+ /**
1395
+ * Checks if the value represented by this object is zero.
1396
+ *
1397
+ * @example
1398
+ * // returns true
1399
+ * Dinero({ amount: 0 }).isZero()
1400
+ * @example
1401
+ * // returns false
1402
+ * Dinero({ amount: 100 }).isZero()
1403
+ *
1404
+ * @return {Boolean}
1405
+ */
1406
+ isZero: function isZero() {
1407
+ return this.getAmount() === 0;
1408
+ },
1409
+
1410
+ /**
1411
+ * Checks if the value represented by this object is positive.
1412
+ *
1413
+ * @example
1414
+ * // returns false
1415
+ * Dinero({ amount: -10 }).isPositive()
1416
+ * @example
1417
+ * // returns true
1418
+ * Dinero({ amount: 10 }).isPositive()
1419
+ * @example
1420
+ * // returns true
1421
+ * Dinero({ amount: 0 }).isPositive()
1422
+ *
1423
+ * @return {Boolean}
1424
+ */
1425
+ isPositive: function isPositive() {
1426
+ return this.getAmount() >= 0;
1427
+ },
1428
+
1429
+ /**
1430
+ * Checks if the value represented by this object is negative.
1431
+ *
1432
+ * @example
1433
+ * // returns true
1434
+ * Dinero({ amount: -10 }).isNegative()
1435
+ * @example
1436
+ * // returns false
1437
+ * Dinero({ amount: 10 }).isNegative()
1438
+ * @example
1439
+ * // returns false
1440
+ * Dinero({ amount: 0 }).isNegative()
1441
+ *
1442
+ * @return {Boolean}
1443
+ */
1444
+ isNegative: function isNegative() {
1445
+ return this.getAmount() < 0;
1446
+ },
1447
+
1448
+ /**
1449
+ * Checks if this has minor currency units.
1450
+ * Deprecates {@link module:Dinero~hasCents hasCents}.
1451
+ *
1452
+ * @example
1453
+ * // returns false
1454
+ * Dinero({ amount: 1100 }).hasSubUnits()
1455
+ * @example
1456
+ * // returns true
1457
+ * Dinero({ amount: 1150 }).hasSubUnits()
1458
+ *
1459
+ * @return {Boolean}
1460
+ */
1461
+ hasSubUnits: function hasSubUnits() {
1462
+ return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;
1463
+ },
1464
+
1465
+ /**
1466
+ * Checks if this has minor currency units.
1467
+ *
1468
+ * @deprecated since version 1.4.0, will be removed in 2.0.0
1469
+ * Use {@link module:Dinero~hasSubUnits hasSubUnits} instead.
1470
+ *
1471
+ * @example
1472
+ * // returns false
1473
+ * Dinero({ amount: 1100 }).hasCents()
1474
+ * @example
1475
+ * // returns true
1476
+ * Dinero({ amount: 1150 }).hasCents()
1477
+ *
1478
+ * @return {Boolean}
1479
+ */
1480
+ hasCents: function hasCents() {
1481
+ return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;
1482
+ },
1483
+
1484
+ /**
1485
+ * Checks whether the currency represented by this object equals to the other.
1486
+ *
1487
+ * @param {Dinero} comparator - The Dinero object to compare to.
1488
+ *
1489
+ * @example
1490
+ * // returns true
1491
+ * Dinero({ amount: 2000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'EUR' }))
1492
+ * @example
1493
+ * // returns false
1494
+ * Dinero({ amount: 1000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'USD' }))
1495
+ *
1496
+ * @return {Boolean}
1497
+ */
1498
+ hasSameCurrency: function hasSameCurrency(comparator) {
1499
+ return this.getCurrency() === comparator.getCurrency();
1500
+ },
1501
+
1502
+ /**
1503
+ * Checks whether the amount represented by this object equals to the other.
1504
+ *
1505
+ * @param {Dinero} comparator - The Dinero object to compare to.
1506
+ *
1507
+ * @example
1508
+ * // returns true
1509
+ * Dinero({ amount: 1000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000 }))
1510
+ * @example
1511
+ * // returns false
1512
+ * Dinero({ amount: 2000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000, currency: 'EUR' }))
1513
+ * @example
1514
+ * // returns true
1515
+ * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))
1516
+ * @example
1517
+ * // returns false
1518
+ * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))
1519
+ *
1520
+ * @return {Boolean}
1521
+ */
1522
+ hasSameAmount: function hasSameAmount(comparator) {
1523
+ var comparators = Dinero.normalizePrecision([this, comparator]);
1524
+ return comparators[0].getAmount() === comparators[1].getAmount();
1525
+ },
1526
+
1527
+ /**
1528
+ * Returns this object formatted as a string.
1529
+ *
1530
+ * The format is a mask which defines how the output string will be formatted.
1531
+ * It defines whether to display a currency, in what format, how many fraction digits to display and whether to use grouping separators.
1532
+ * The output is formatted according to the applying locale.
1533
+ *
1534
+ * Object | Format | String
1535
+ * :--------------------------- | :---------------- | :---
1536
+ * `Dinero({ amount: 500050 })` | `'$0,0.00'` | $5,000.50
1537
+ * `Dinero({ amount: 500050 })` | `'$0,0'` | $5,001
1538
+ * `Dinero({ amount: 500050 })` | `'$0'` | $5001
1539
+ * `Dinero({ amount: 500050 })` | `'$0.0'` | $5000.5
1540
+ * `Dinero({ amount: 500050 })` | `'USD0,0.0'` | USD5,000.5
1541
+ * `Dinero({ amount: 500050 })` | `'0,0.0 dollar'` | 5,000.5 dollars
1542
+ *
1543
+ * 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.
1544
+ * The format is a mask which defines a pattern and returns a valid, localized currency string.
1545
+ * 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.
1546
+ *
1547
+ * {@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**.
1548
+ *
1549
+ * You can also use `toLocaleString` directly:
1550
+ * `Dinero().toRoundedUnit(digits, roundingMode).toLocaleString(locale, options)`.
1551
+ *
1552
+ * 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)).
1553
+ * You can also specify a different `roundingMode` to better fit your needs.
1554
+ *
1555
+ * @param {String} [format='$0,0.00'] - The format mask to format to.
1556
+ * @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'`.
1557
+ *
1558
+ * @example
1559
+ * // returns $2,000
1560
+ * Dinero({ amount: 200000 }).toFormat('$0,0')
1561
+ * @example
1562
+ * // returns €50.5
1563
+ * Dinero({ amount: 5050, currency: 'EUR' }).toFormat('$0,0.0')
1564
+ * @example
1565
+ * // returns 100 euros
1566
+ * Dinero({ amount: 10000, currency: 'EUR' }).setLocale('fr-FR').toFormat('0,0 dollar')
1567
+ * @example
1568
+ * // returns 2000
1569
+ * Dinero({ amount: 200000, currency: 'EUR' }).toFormat()
1570
+ * @example
1571
+ * // returns $10
1572
+ * Dinero({ amount: 1050 }).toFormat('$0', 'HALF_EVEN')
1573
+ *
1574
+ * @return {String}
1575
+ */
1576
+ toFormat: function toFormat() {
1577
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalFormat;
1578
+ var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
1579
+ var formatter = Format(format);
1580
+ return this.toRoundedUnit(formatter.getMinimumFractionDigits(), roundingMode).toLocaleString(this.getLocale(), {
1581
+ currencyDisplay: formatter.getCurrencyDisplay(),
1582
+ useGrouping: formatter.getUseGrouping(),
1583
+ minimumFractionDigits: formatter.getMinimumFractionDigits(),
1584
+ style: formatter.getStyle(),
1585
+ currency: this.getCurrency()
1586
+ });
1587
+ },
1588
+
1589
+ /**
1590
+ * Returns the amount represented by this object in units.
1591
+ *
1592
+ * @example
1593
+ * // returns 10.5
1594
+ * Dinero({ amount: 1050 }).toUnit()
1595
+ * @example
1596
+ * // returns 10.545
1597
+ * Dinero({ amount: 10545, precision: 3 }).toUnit()
1598
+ *
1599
+ * @return {Number}
1600
+ */
1601
+ toUnit: function toUnit() {
1602
+ return calculator$1.divide(this.getAmount(), Math.pow(10, precision));
1603
+ },
1604
+
1605
+ /**
1606
+ * Returns the amount represented by this object in rounded units.
1607
+ *
1608
+ * By default, the method uses the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).
1609
+ * You can also specify a different `roundingMode` to better fit your needs.
1610
+ *
1611
+ * @example
1612
+ * // returns 10.6
1613
+ * Dinero({ amount: 1055 }).toRoundedUnit(1)
1614
+ * @example
1615
+ * // returns 10
1616
+ * Dinero({ amount: 1050 }).toRoundedUnit(0, 'HALF_EVEN')
1617
+ *
1618
+ * @param {Number} digits - The number of fraction digits to round to.
1619
+ * @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'`.
1620
+ *
1621
+ * @return {Number}
1622
+ */
1623
+ toRoundedUnit: function toRoundedUnit(digits) {
1624
+ var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;
1625
+ var factor = Math.pow(10, digits);
1626
+ return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);
1627
+ },
1628
+
1629
+ /**
1630
+ * Returns the object's data as an object literal.
1631
+ *
1632
+ * @example
1633
+ * // returns { amount: 500, currency: 'EUR', precision: 2 }
1634
+ * Dinero({ amount: 500, currency: 'EUR', precision: 2 }).toObject()
1635
+ *
1636
+ * @return {Object}
1637
+ */
1638
+ toObject: function toObject() {
1639
+ return {
1640
+ amount: amount,
1641
+ currency: currency,
1642
+ precision: precision
1643
+ };
1644
+ },
1645
+
1646
+ /**
1647
+ * Returns the object's data as an object literal.
1648
+ *
1649
+ * Alias of {@link module:Dinero~toObject toObject}.
1650
+ * It is defined so that calling `JSON.stringify` on a Dinero object will automatically extract the relevant data.
1651
+ *
1652
+ * @example
1653
+ * // returns '{"amount":500,"currency":"EUR","precision":2}'
1654
+ * JSON.stringify(Dinero({ amount: 500, currency: 'EUR', precision: 2 }))
1655
+ *
1656
+ * @return {Object}
1657
+ */
1658
+ toJSON: function toJSON() {
1659
+ return this.toObject();
1660
+ }
1661
+ };
1662
+ };
1663
+
1664
+ var dinero = Object.assign(Dinero, Defaults, Globals, Static);
1665
+
1666
+ dinero_1 = dinero;
1667
+ return dinero_1;
1668
+ }
1669
+
1670
+ var dineroExports = requireDinero();
1671
+ var Dinero = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(dineroExports);
1672
+
1673
+ exports.Dinero = Dinero;