@lightsparkdev/core 1.2.6 → 1.2.7
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.
- package/CHANGELOG.md +8 -0
- package/dist/{chunk-CKJUUY2Z.js → chunk-NY4EJZNK.js} +121 -35
- package/dist/{index-COxEW2dD.d.cts → index-r0bUxDu_.d.cts} +31 -10
- package/dist/{index-COxEW2dD.d.ts → index-r0bUxDu_.d.ts} +31 -10
- package/dist/index.cjs +123 -35
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -1
- package/dist/utils/index.cjs +123 -35
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +5 -1
- package/package.json +1 -1
- package/src/utils/currency.ts +195 -42
- package/src/utils/locale.ts +2 -0
- package/src/utils/tests/currency.test.ts +183 -1
package/dist/utils/index.cjs
CHANGED
|
@@ -45,12 +45,14 @@ __export(utils_exports, {
|
|
|
45
45
|
ensureArray: () => ensureArray,
|
|
46
46
|
errorToJSON: () => errorToJSON,
|
|
47
47
|
formatCurrencyStr: () => formatCurrencyStr,
|
|
48
|
+
getCurrencyAmount: () => getCurrencyAmount,
|
|
48
49
|
getCurrentLocale: () => getCurrentLocale,
|
|
49
50
|
getErrorMsg: () => getErrorMsg,
|
|
50
51
|
getLocalStorageBoolean: () => getLocalStorageBoolean,
|
|
51
52
|
getLocalStorageConfigItem: () => getLocalStorageConfigItem,
|
|
52
53
|
hexToBytes: () => hexToBytes,
|
|
53
54
|
isBrowser: () => isBrowser,
|
|
55
|
+
isCurrencyAmountInputObj: () => isCurrencyAmountInputObj,
|
|
54
56
|
isCurrencyAmountObj: () => isCurrencyAmountObj,
|
|
55
57
|
isCurrencyAmountPreferenceObj: () => isCurrencyAmountPreferenceObj,
|
|
56
58
|
isCurrencyMap: () => isCurrencyMap,
|
|
@@ -489,6 +491,7 @@ var CurrencyUnit = {
|
|
|
489
491
|
MILLIBITCOIN: "MILLIBITCOIN",
|
|
490
492
|
USD: "USD",
|
|
491
493
|
MXN: "MXN",
|
|
494
|
+
PHP: "PHP",
|
|
492
495
|
Bitcoin: "BITCOIN",
|
|
493
496
|
Microbitcoin: "MICROBITCOIN",
|
|
494
497
|
Millibitcoin: "MILLIBITCOIN",
|
|
@@ -496,7 +499,8 @@ var CurrencyUnit = {
|
|
|
496
499
|
Nanobitcoin: "NANOBITCOIN",
|
|
497
500
|
Satoshi: "SATOSHI",
|
|
498
501
|
Usd: "USD",
|
|
499
|
-
Mxn: "MXN"
|
|
502
|
+
Mxn: "MXN",
|
|
503
|
+
Php: "PHP"
|
|
500
504
|
};
|
|
501
505
|
var standardUnitConversionObj = {
|
|
502
506
|
[CurrencyUnit.BITCOIN]: (v, unitsPerBtc = 1) => v / unitsPerBtc,
|
|
@@ -507,7 +511,8 @@ var standardUnitConversionObj = {
|
|
|
507
511
|
[CurrencyUnit.SATOSHI]: (v, unitsPerBtc = 1) => v / unitsPerBtc * 1e8,
|
|
508
512
|
/* Converting between two different fiat types is not currently supported */
|
|
509
513
|
[CurrencyUnit.USD]: (v) => v,
|
|
510
|
-
[CurrencyUnit.MXN]: (v) => v
|
|
514
|
+
[CurrencyUnit.MXN]: (v) => v,
|
|
515
|
+
[CurrencyUnit.PHP]: (v) => v
|
|
511
516
|
};
|
|
512
517
|
var toBitcoinConversion = (v, unitsPerBtc = 1) => round(v * unitsPerBtc);
|
|
513
518
|
var toMicrobitcoinConversion = (v, unitsPerBtc = 1) => round(v / 1e6 * unitsPerBtc);
|
|
@@ -524,7 +529,8 @@ var CONVERSION_MAP = {
|
|
|
524
529
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e9,
|
|
525
530
|
[CurrencyUnit.SATOSHI]: (v) => v * 1e8,
|
|
526
531
|
[CurrencyUnit.USD]: toBitcoinConversion,
|
|
527
|
-
[CurrencyUnit.MXN]: toBitcoinConversion
|
|
532
|
+
[CurrencyUnit.MXN]: toBitcoinConversion,
|
|
533
|
+
[CurrencyUnit.PHP]: toBitcoinConversion
|
|
528
534
|
},
|
|
529
535
|
[CurrencyUnit.MICROBITCOIN]: {
|
|
530
536
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e6,
|
|
@@ -534,7 +540,8 @@ var CONVERSION_MAP = {
|
|
|
534
540
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e3,
|
|
535
541
|
[CurrencyUnit.SATOSHI]: (v) => v * 100,
|
|
536
542
|
[CurrencyUnit.USD]: toMicrobitcoinConversion,
|
|
537
|
-
[CurrencyUnit.MXN]: toMicrobitcoinConversion
|
|
543
|
+
[CurrencyUnit.MXN]: toMicrobitcoinConversion,
|
|
544
|
+
[CurrencyUnit.PHP]: toMicrobitcoinConversion
|
|
538
545
|
},
|
|
539
546
|
[CurrencyUnit.MILLIBITCOIN]: {
|
|
540
547
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e3,
|
|
@@ -544,7 +551,8 @@ var CONVERSION_MAP = {
|
|
|
544
551
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e6,
|
|
545
552
|
[CurrencyUnit.SATOSHI]: (v) => v * 1e5,
|
|
546
553
|
[CurrencyUnit.USD]: toMillibitcoinConversion,
|
|
547
|
-
[CurrencyUnit.MXN]: toMillibitcoinConversion
|
|
554
|
+
[CurrencyUnit.MXN]: toMillibitcoinConversion,
|
|
555
|
+
[CurrencyUnit.PHP]: toMillibitcoinConversion
|
|
548
556
|
},
|
|
549
557
|
[CurrencyUnit.MILLISATOSHI]: {
|
|
550
558
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e11,
|
|
@@ -554,7 +562,8 @@ var CONVERSION_MAP = {
|
|
|
554
562
|
[CurrencyUnit.NANOBITCOIN]: (v) => v / 100,
|
|
555
563
|
[CurrencyUnit.SATOSHI]: (v) => v / 1e3,
|
|
556
564
|
[CurrencyUnit.USD]: toMillisatoshiConversion,
|
|
557
|
-
[CurrencyUnit.MXN]: toMillisatoshiConversion
|
|
565
|
+
[CurrencyUnit.MXN]: toMillisatoshiConversion,
|
|
566
|
+
[CurrencyUnit.PHP]: toMillisatoshiConversion
|
|
558
567
|
},
|
|
559
568
|
[CurrencyUnit.NANOBITCOIN]: {
|
|
560
569
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e9,
|
|
@@ -564,7 +573,8 @@ var CONVERSION_MAP = {
|
|
|
564
573
|
[CurrencyUnit.NANOBITCOIN]: (v) => v,
|
|
565
574
|
[CurrencyUnit.SATOSHI]: (v) => v / 10,
|
|
566
575
|
[CurrencyUnit.USD]: toNanobitcoinConversion,
|
|
567
|
-
[CurrencyUnit.MXN]: toNanobitcoinConversion
|
|
576
|
+
[CurrencyUnit.MXN]: toNanobitcoinConversion,
|
|
577
|
+
[CurrencyUnit.PHP]: toNanobitcoinConversion
|
|
568
578
|
},
|
|
569
579
|
[CurrencyUnit.SATOSHI]: {
|
|
570
580
|
[CurrencyUnit.BITCOIN]: (v) => v / 1e8,
|
|
@@ -574,10 +584,12 @@ var CONVERSION_MAP = {
|
|
|
574
584
|
[CurrencyUnit.NANOBITCOIN]: (v) => v * 10,
|
|
575
585
|
[CurrencyUnit.SATOSHI]: (v) => v,
|
|
576
586
|
[CurrencyUnit.USD]: toSatoshiConversion,
|
|
577
|
-
[CurrencyUnit.MXN]: toSatoshiConversion
|
|
587
|
+
[CurrencyUnit.MXN]: toSatoshiConversion,
|
|
588
|
+
[CurrencyUnit.PHP]: toSatoshiConversion
|
|
578
589
|
},
|
|
579
590
|
[CurrencyUnit.USD]: standardUnitConversionObj,
|
|
580
|
-
[CurrencyUnit.MXN]: standardUnitConversionObj
|
|
591
|
+
[CurrencyUnit.MXN]: standardUnitConversionObj,
|
|
592
|
+
[CurrencyUnit.PHP]: standardUnitConversionObj
|
|
581
593
|
};
|
|
582
594
|
function convertCurrencyAmountValue(fromUnit, toUnit, amount, unitsPerBtc = 1) {
|
|
583
595
|
if (fromUnit === CurrencyUnit.FUTURE_VALUE || toUnit === CurrencyUnit.FUTURE_VALUE) {
|
|
@@ -608,6 +620,9 @@ var convertCurrencyAmount = (from, toUnit) => {
|
|
|
608
620
|
preferredCurrencyValueRounded: value
|
|
609
621
|
};
|
|
610
622
|
};
|
|
623
|
+
function isCurrencyAmountInputObj(arg) {
|
|
624
|
+
return typeof arg === "object" && arg !== null && "value" in arg && (typeof arg.value === "number" || typeof arg.value === "string" || arg.value === null) && "unit" in arg && typeof arg.unit === "string";
|
|
625
|
+
}
|
|
611
626
|
function isDeprecatedCurrencyAmountObj(arg) {
|
|
612
627
|
return typeof arg === "object" && arg !== null && "value" in arg && "unit" in arg;
|
|
613
628
|
}
|
|
@@ -615,7 +630,7 @@ function isCurrencyAmountObj(arg) {
|
|
|
615
630
|
return typeof arg === "object" && arg !== null && "original_value" in arg && "original_unit" in arg;
|
|
616
631
|
}
|
|
617
632
|
function isCurrencyAmountPreferenceObj(arg) {
|
|
618
|
-
return typeof arg === "object" && arg !== null && "preferred_currency_unit" in arg && "
|
|
633
|
+
return typeof arg === "object" && arg !== null && "original_unit" in arg && typeof arg.original_unit === "string" && "original_value" in arg && typeof arg.original_value === "number" && "preferred_currency_unit" in arg && typeof arg.preferred_currency_unit === "string" && "preferred_currency_value_approx" in arg && typeof arg.preferred_currency_value_approx === "number";
|
|
619
634
|
}
|
|
620
635
|
function isSDKCurrencyAmount(arg) {
|
|
621
636
|
return typeof arg === "object" && arg !== null && /* We can expect all SDK CurrencyAmount types to always have these exact properties: */
|
|
@@ -633,13 +648,10 @@ function getCurrencyAmount(currencyAmountArg) {
|
|
|
633
648
|
if (isSDKCurrencyAmount(currencyAmountArg)) {
|
|
634
649
|
value = currencyAmountArg.originalValue;
|
|
635
650
|
unit = currencyAmountArg.originalUnit;
|
|
636
|
-
} else if (isCurrencyAmountPreferenceObj(currencyAmountArg)) {
|
|
637
|
-
value = asNumber(currencyAmountArg.preferred_currency_value_rounded);
|
|
638
|
-
unit = currencyAmountArg.preferred_currency_unit;
|
|
639
651
|
} else if (isCurrencyAmountObj(currencyAmountArg)) {
|
|
640
652
|
value = asNumber(currencyAmountArg.original_value);
|
|
641
653
|
unit = currencyAmountArg.original_unit;
|
|
642
|
-
} else if (isDeprecatedCurrencyAmountObj(currencyAmountArg)) {
|
|
654
|
+
} else if (isCurrencyAmountInputObj(currencyAmountArg) || isDeprecatedCurrencyAmountObj(currencyAmountArg)) {
|
|
643
655
|
value = asNumber(currencyAmountArg.value);
|
|
644
656
|
unit = currencyAmountArg.unit;
|
|
645
657
|
}
|
|
@@ -648,23 +660,61 @@ function getCurrencyAmount(currencyAmountArg) {
|
|
|
648
660
|
unit: unit || CurrencyUnit.SATOSHI
|
|
649
661
|
};
|
|
650
662
|
}
|
|
663
|
+
function convertCurrencyAmountValues(fromUnit, amount, unitsPerBtc = 1, conversionOverride) {
|
|
664
|
+
const convert = convertCurrencyAmountValue;
|
|
665
|
+
const namesToUnits = {
|
|
666
|
+
sats: CurrencyUnit.SATOSHI,
|
|
667
|
+
btc: CurrencyUnit.BITCOIN,
|
|
668
|
+
msats: CurrencyUnit.MILLISATOSHI,
|
|
669
|
+
usd: CurrencyUnit.USD,
|
|
670
|
+
mxn: CurrencyUnit.MXN,
|
|
671
|
+
php: CurrencyUnit.PHP,
|
|
672
|
+
mibtc: CurrencyUnit.MICROBITCOIN,
|
|
673
|
+
mlbtc: CurrencyUnit.MILLIBITCOIN,
|
|
674
|
+
nbtc: CurrencyUnit.NANOBITCOIN
|
|
675
|
+
};
|
|
676
|
+
return Object.entries(namesToUnits).reduce(
|
|
677
|
+
(acc, [name, unit]) => {
|
|
678
|
+
if (conversionOverride && unit === conversionOverride.unit) {
|
|
679
|
+
acc[name] = conversionOverride.convertedValue;
|
|
680
|
+
} else {
|
|
681
|
+
acc[name] = convert(
|
|
682
|
+
fromUnit,
|
|
683
|
+
unit,
|
|
684
|
+
amount,
|
|
685
|
+
unitsPerBtc
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
return acc;
|
|
689
|
+
},
|
|
690
|
+
{}
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
function getPreferredConversionOverride(currencyAmountArg) {
|
|
694
|
+
if (isCurrencyAmountPreferenceObj(currencyAmountArg)) {
|
|
695
|
+
return {
|
|
696
|
+
unit: currencyAmountArg.preferred_currency_unit,
|
|
697
|
+
convertedValue: currencyAmountArg.preferred_currency_value_approx
|
|
698
|
+
};
|
|
699
|
+
} else if (isSDKCurrencyAmount(currencyAmountArg)) {
|
|
700
|
+
return {
|
|
701
|
+
unit: currencyAmountArg.preferredCurrencyUnit,
|
|
702
|
+
convertedValue: currencyAmountArg.preferredCurrencyValueApprox
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
return void 0;
|
|
706
|
+
}
|
|
651
707
|
function mapCurrencyAmount(currencyAmountArg, unitsPerBtc = 1) {
|
|
652
708
|
const { value, unit } = getCurrencyAmount(currencyAmountArg);
|
|
653
|
-
const
|
|
654
|
-
const sats =
|
|
655
|
-
const btc = convert(unit, CurrencyUnit.BITCOIN, value, unitsPerBtc);
|
|
656
|
-
const msats = convert(unit, CurrencyUnit.MILLISATOSHI, value, unitsPerBtc);
|
|
657
|
-
const usd = convert(unit, CurrencyUnit.USD, value, unitsPerBtc);
|
|
658
|
-
const mxn = convert(unit, CurrencyUnit.MXN, value, unitsPerBtc);
|
|
659
|
-
const mibtc = convert(unit, CurrencyUnit.MICROBITCOIN, value, unitsPerBtc);
|
|
660
|
-
const mlbtc = convert(unit, CurrencyUnit.MILLIBITCOIN, value, unitsPerBtc);
|
|
661
|
-
const nbtc = convert(unit, CurrencyUnit.NANOBITCOIN, value, unitsPerBtc);
|
|
709
|
+
const conversionOverride = getPreferredConversionOverride(currencyAmountArg);
|
|
710
|
+
const { sats, msats, btc, usd, mxn, php, mibtc, mlbtc, nbtc } = convertCurrencyAmountValues(unit, value, unitsPerBtc, conversionOverride);
|
|
662
711
|
const mapWithCurrencyUnits = {
|
|
663
712
|
[CurrencyUnit.BITCOIN]: btc,
|
|
664
713
|
[CurrencyUnit.SATOSHI]: sats,
|
|
665
714
|
[CurrencyUnit.MILLISATOSHI]: msats,
|
|
666
715
|
[CurrencyUnit.USD]: usd,
|
|
667
716
|
[CurrencyUnit.MXN]: mxn,
|
|
717
|
+
[CurrencyUnit.PHP]: php,
|
|
668
718
|
[CurrencyUnit.MICROBITCOIN]: mibtc,
|
|
669
719
|
[CurrencyUnit.MILLIBITCOIN]: mlbtc,
|
|
670
720
|
[CurrencyUnit.NANOBITCOIN]: nbtc,
|
|
@@ -702,6 +752,10 @@ function mapCurrencyAmount(currencyAmountArg, unitsPerBtc = 1) {
|
|
|
702
752
|
value: mxn,
|
|
703
753
|
unit: CurrencyUnit.MXN
|
|
704
754
|
}),
|
|
755
|
+
[CurrencyUnit.PHP]: formatCurrencyStr({
|
|
756
|
+
value: php,
|
|
757
|
+
unit: CurrencyUnit.PHP
|
|
758
|
+
}),
|
|
705
759
|
[CurrencyUnit.FUTURE_VALUE]: "-"
|
|
706
760
|
}
|
|
707
761
|
};
|
|
@@ -756,8 +810,16 @@ var abbrCurrencyUnit = (unit) => {
|
|
|
756
810
|
return "SAT";
|
|
757
811
|
case CurrencyUnit.MILLISATOSHI:
|
|
758
812
|
return "MSAT";
|
|
813
|
+
case CurrencyUnit.MILLIBITCOIN:
|
|
814
|
+
return "mBTC";
|
|
815
|
+
case CurrencyUnit.MICROBITCOIN:
|
|
816
|
+
return "\u03BCBTC";
|
|
759
817
|
case CurrencyUnit.USD:
|
|
760
818
|
return "USD";
|
|
819
|
+
case CurrencyUnit.MXN:
|
|
820
|
+
return "MXN";
|
|
821
|
+
case CurrencyUnit.PHP:
|
|
822
|
+
return "PHP";
|
|
761
823
|
}
|
|
762
824
|
return "Unsupported CurrencyUnit";
|
|
763
825
|
};
|
|
@@ -765,7 +827,8 @@ var defaultOptions = {
|
|
|
765
827
|
/* undefined indicates to use default precision for unit defined below */
|
|
766
828
|
precision: void 0,
|
|
767
829
|
compact: false,
|
|
768
|
-
showBtcSymbol: false
|
|
830
|
+
showBtcSymbol: false,
|
|
831
|
+
append: void 0
|
|
769
832
|
};
|
|
770
833
|
function formatCurrencyStr(amount, options) {
|
|
771
834
|
const { precision, compact, showBtcSymbol } = {
|
|
@@ -775,7 +838,12 @@ function formatCurrencyStr(amount, options) {
|
|
|
775
838
|
const currencyAmount = getCurrencyAmount(amount);
|
|
776
839
|
let { value: num } = currencyAmount;
|
|
777
840
|
const { unit } = currencyAmount;
|
|
778
|
-
|
|
841
|
+
const centCurrencies = [
|
|
842
|
+
CurrencyUnit.USD,
|
|
843
|
+
CurrencyUnit.MXN,
|
|
844
|
+
CurrencyUnit.PHP
|
|
845
|
+
];
|
|
846
|
+
if (centCurrencies.includes(unit)) {
|
|
779
847
|
num = num / 100;
|
|
780
848
|
}
|
|
781
849
|
function getDefaultMaxFractionDigits(defaultDigits, fullPrecisionDigits) {
|
|
@@ -791,34 +859,52 @@ function formatCurrencyStr(amount, options) {
|
|
|
791
859
|
}
|
|
792
860
|
const symbol = !showBtcSymbol ? "" : unit === CurrencyUnit.BITCOIN ? "\uE903" : unit === CurrencyUnit.SATOSHI ? "\uE902" : "";
|
|
793
861
|
const currentLocale = getCurrentLocale();
|
|
862
|
+
let formattedStr = "";
|
|
794
863
|
switch (unit) {
|
|
864
|
+
case CurrencyUnit.MXN:
|
|
865
|
+
case CurrencyUnit.USD:
|
|
866
|
+
case CurrencyUnit.PHP:
|
|
867
|
+
formattedStr = num.toLocaleString(currentLocale, {
|
|
868
|
+
style: "currency",
|
|
869
|
+
currency: unit,
|
|
870
|
+
currencyDisplay: "narrowSymbol",
|
|
871
|
+
notation: compact ? "compact" : void 0,
|
|
872
|
+
maximumFractionDigits: getDefaultMaxFractionDigits(2, 2)
|
|
873
|
+
});
|
|
874
|
+
break;
|
|
795
875
|
case CurrencyUnit.BITCOIN:
|
|
796
|
-
|
|
876
|
+
formattedStr = `${symbol}${num.toLocaleString(currentLocale, {
|
|
797
877
|
notation: compact ? "compact" : void 0,
|
|
798
878
|
maximumFractionDigits: getDefaultMaxFractionDigits(4, 8)
|
|
799
879
|
})}`;
|
|
880
|
+
break;
|
|
800
881
|
case CurrencyUnit.SATOSHI:
|
|
801
|
-
|
|
882
|
+
formattedStr = `${symbol}${num.toLocaleString(currentLocale, {
|
|
802
883
|
notation: compact ? "compact" : void 0,
|
|
803
884
|
maximumFractionDigits: getDefaultMaxFractionDigits(0, 3)
|
|
804
885
|
})}`;
|
|
886
|
+
break;
|
|
805
887
|
case CurrencyUnit.MILLISATOSHI:
|
|
806
888
|
case CurrencyUnit.MICROBITCOIN:
|
|
807
889
|
case CurrencyUnit.MILLIBITCOIN:
|
|
808
890
|
case CurrencyUnit.NANOBITCOIN:
|
|
809
891
|
default:
|
|
810
|
-
|
|
892
|
+
formattedStr = `${symbol}${num.toLocaleString(currentLocale, {
|
|
811
893
|
notation: compact ? "compact" : void 0,
|
|
812
894
|
maximumFractionDigits: getDefaultMaxFractionDigits(0, 0)
|
|
813
895
|
})}`;
|
|
814
|
-
case CurrencyUnit.USD:
|
|
815
|
-
return num.toLocaleString(currentLocale, {
|
|
816
|
-
style: "currency",
|
|
817
|
-
currency: defaultCurrencyCode,
|
|
818
|
-
notation: compact ? "compact" : void 0,
|
|
819
|
-
maximumFractionDigits: getDefaultMaxFractionDigits(2, 2)
|
|
820
|
-
});
|
|
821
896
|
}
|
|
897
|
+
if (options?.appendUnits) {
|
|
898
|
+
const localeCurrencyCode = localeToCurrencyCode(currentLocale);
|
|
899
|
+
if (unit === localeCurrencyCode && !options.appendUnits.showForCurrentLocaleUnit) {
|
|
900
|
+
return formattedStr;
|
|
901
|
+
}
|
|
902
|
+
const unitStr = abbrCurrencyUnit(unit);
|
|
903
|
+
const unitSuffix = options.appendUnits.plural && num > 1 ? "s" : "";
|
|
904
|
+
const unitStrWithSuffix = `${unitStr}${unitSuffix}`;
|
|
905
|
+
formattedStr += ` ${options.appendUnits.lowercase ? unitStrWithSuffix.toLowerCase() : unitStrWithSuffix}`;
|
|
906
|
+
}
|
|
907
|
+
return formattedStr;
|
|
822
908
|
}
|
|
823
909
|
function separateCurrencyStrParts(currencyStr) {
|
|
824
910
|
const symbol = currencyStr.replace(/[0-9\s\u00a0.,]/g, "");
|
|
@@ -1058,12 +1144,14 @@ function notNullUndefined(value) {
|
|
|
1058
1144
|
ensureArray,
|
|
1059
1145
|
errorToJSON,
|
|
1060
1146
|
formatCurrencyStr,
|
|
1147
|
+
getCurrencyAmount,
|
|
1061
1148
|
getCurrentLocale,
|
|
1062
1149
|
getErrorMsg,
|
|
1063
1150
|
getLocalStorageBoolean,
|
|
1064
1151
|
getLocalStorageConfigItem,
|
|
1065
1152
|
hexToBytes,
|
|
1066
1153
|
isBrowser,
|
|
1154
|
+
isCurrencyAmountInputObj,
|
|
1067
1155
|
isCurrencyAmountObj,
|
|
1068
1156
|
isCurrencyAmountPreferenceObj,
|
|
1069
1157
|
isCurrencyMap,
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A as AppendUnitsOptions, a7 as ById, ah as Complete, n as CurrencyAmountArg, k as CurrencyAmountInputObj, l as CurrencyAmountObj, m as CurrencyAmountPreferenceObj, R as CurrencyCodes, Q as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, aa as DeepPartial, D as DeprecatedCurrencyAmountObj, a6 as ExpandRecursively, ab as JSONLiteral, ad as JSONObject, ac as JSONType, a5 as Maybe, ae as NN, a8 as OmitTypename, ag as PartialBy, ai as RequiredKeys, S as SDKCurrencyAmountType, x as abbrCurrencyUnit, b as b64decode, a as b64encode, M as bytesToHex, Y as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, P as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, X as deleteLocalStorageItem, e as ensureArray, L as errorToJSON, y as formatCurrencyStr, t as getCurrencyAmount, O as getCurrentLocale, J as getErrorMsg, V as getLocalStorageBoolean, U as getLocalStorageConfigItem, N as hexToBytes, E as isBrowser, o as isCurrencyAmountInputObj, q as isCurrencyAmountObj, r as isCurrencyAmountPreferenceObj, w as isCurrencyMap, p as isDeprecatedCurrencyAmountObj, H as isError, K as isErrorMsg, I as isErrorWithMessage, F as isNode, $ as isNumber, a4 as isObject, s as isSDKCurrencyAmount, G as isTest, a9 as isType, a3 as isUint8Array, Z as linearInterpolate, T as localeToCurrencyCode, B as localeToCurrencySymbol, a2 as lsidToUUID, v as mapCurrencyAmount, af as notNullUndefined, a0 as pollUntil, _ as round, z as separateCurrencyStrParts, W as setLocalStorageBoolean, a1 as sleep, u as urlsafe_b64decode } from '../index-r0bUxDu_.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A as AppendUnitsOptions, a7 as ById, ah as Complete, n as CurrencyAmountArg, k as CurrencyAmountInputObj, l as CurrencyAmountObj, m as CurrencyAmountPreferenceObj, R as CurrencyCodes, Q as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, aa as DeepPartial, D as DeprecatedCurrencyAmountObj, a6 as ExpandRecursively, ab as JSONLiteral, ad as JSONObject, ac as JSONType, a5 as Maybe, ae as NN, a8 as OmitTypename, ag as PartialBy, ai as RequiredKeys, S as SDKCurrencyAmountType, x as abbrCurrencyUnit, b as b64decode, a as b64encode, M as bytesToHex, Y as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, P as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, X as deleteLocalStorageItem, e as ensureArray, L as errorToJSON, y as formatCurrencyStr, t as getCurrencyAmount, O as getCurrentLocale, J as getErrorMsg, V as getLocalStorageBoolean, U as getLocalStorageConfigItem, N as hexToBytes, E as isBrowser, o as isCurrencyAmountInputObj, q as isCurrencyAmountObj, r as isCurrencyAmountPreferenceObj, w as isCurrencyMap, p as isDeprecatedCurrencyAmountObj, H as isError, K as isErrorMsg, I as isErrorWithMessage, F as isNode, $ as isNumber, a4 as isObject, s as isSDKCurrencyAmount, G as isTest, a9 as isType, a3 as isUint8Array, Z as linearInterpolate, T as localeToCurrencyCode, B as localeToCurrencySymbol, a2 as lsidToUUID, v as mapCurrencyAmount, af as notNullUndefined, a0 as pollUntil, _ as round, z as separateCurrencyStrParts, W as setLocalStorageBoolean, a1 as sleep, u as urlsafe_b64decode } from '../index-r0bUxDu_.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -14,12 +14,14 @@ import {
|
|
|
14
14
|
ensureArray,
|
|
15
15
|
errorToJSON,
|
|
16
16
|
formatCurrencyStr,
|
|
17
|
+
getCurrencyAmount,
|
|
17
18
|
getCurrentLocale,
|
|
18
19
|
getErrorMsg,
|
|
19
20
|
getLocalStorageBoolean,
|
|
20
21
|
getLocalStorageConfigItem,
|
|
21
22
|
hexToBytes,
|
|
22
23
|
isBrowser,
|
|
24
|
+
isCurrencyAmountInputObj,
|
|
23
25
|
isCurrencyAmountObj,
|
|
24
26
|
isCurrencyAmountPreferenceObj,
|
|
25
27
|
isCurrencyMap,
|
|
@@ -46,7 +48,7 @@ import {
|
|
|
46
48
|
setLocalStorageBoolean,
|
|
47
49
|
sleep,
|
|
48
50
|
urlsafe_b64decode
|
|
49
|
-
} from "../chunk-
|
|
51
|
+
} from "../chunk-NY4EJZNK.js";
|
|
50
52
|
export {
|
|
51
53
|
CurrencyUnit,
|
|
52
54
|
abbrCurrencyUnit,
|
|
@@ -63,12 +65,14 @@ export {
|
|
|
63
65
|
ensureArray,
|
|
64
66
|
errorToJSON,
|
|
65
67
|
formatCurrencyStr,
|
|
68
|
+
getCurrencyAmount,
|
|
66
69
|
getCurrentLocale,
|
|
67
70
|
getErrorMsg,
|
|
68
71
|
getLocalStorageBoolean,
|
|
69
72
|
getLocalStorageConfigItem,
|
|
70
73
|
hexToBytes,
|
|
71
74
|
isBrowser,
|
|
75
|
+
isCurrencyAmountInputObj,
|
|
72
76
|
isCurrencyAmountObj,
|
|
73
77
|
isCurrencyAmountPreferenceObj,
|
|
74
78
|
isCurrencyMap,
|