@lightsparkdev/core 1.0.21 → 1.0.22
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 +6 -0
- package/dist/{chunk-Y3FWNVYS.js → chunk-RC2KOZKZ.js} +129 -122
- package/dist/{index-9e41ffe5.d.ts → index-9ecb1570.d.ts} +29 -74
- package/dist/index.cjs +130 -123
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/utils/index.cjs +130 -123
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +1 -1
- package/src/utils/currency.ts +46 -88
package/dist/index.cjs
CHANGED
|
@@ -67,7 +67,6 @@ __export(src_exports, {
|
|
|
67
67
|
getLocalStorageConfigItem: () => getLocalStorageConfigItem,
|
|
68
68
|
hexToBytes: () => hexToBytes,
|
|
69
69
|
isBrowser: () => isBrowser,
|
|
70
|
-
isCurrencyAmount: () => isCurrencyAmount,
|
|
71
70
|
isCurrencyAmountObj: () => isCurrencyAmountObj,
|
|
72
71
|
isCurrencyMap: () => isCurrencyMap,
|
|
73
72
|
isError: () => isError,
|
|
@@ -75,6 +74,7 @@ __export(src_exports, {
|
|
|
75
74
|
isErrorWithMessage: () => isErrorWithMessage,
|
|
76
75
|
isNode: () => isNode,
|
|
77
76
|
isNumber: () => isNumber,
|
|
77
|
+
isSDKCurrencyAmount: () => isSDKCurrencyAmount,
|
|
78
78
|
isTest: () => isTest,
|
|
79
79
|
isType: () => isType,
|
|
80
80
|
isUint8Array: () => isUint8Array,
|
|
@@ -836,102 +836,108 @@ function isNumber(value) {
|
|
|
836
836
|
|
|
837
837
|
// src/utils/currency.ts
|
|
838
838
|
var defaultCurrencyCode = "USD";
|
|
839
|
-
var CurrencyUnit =
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
839
|
+
var CurrencyUnit = {
|
|
840
|
+
FUTURE_VALUE: "FUTURE_VALUE",
|
|
841
|
+
BITCOIN: "BITCOIN",
|
|
842
|
+
SATOSHI: "SATOSHI",
|
|
843
|
+
MILLISATOSHI: "MILLISATOSHI",
|
|
844
|
+
USD: "USD",
|
|
845
|
+
NANOBITCOIN: "NANOBITCOIN",
|
|
846
|
+
MICROBITCOIN: "MICROBITCOIN",
|
|
847
|
+
MILLIBITCOIN: "MILLIBITCOIN",
|
|
848
|
+
Bitcoin: "BITCOIN",
|
|
849
|
+
Microbitcoin: "MICROBITCOIN",
|
|
850
|
+
Millibitcoin: "MILLIBITCOIN",
|
|
851
|
+
Millisatoshi: "MILLISATOSHI",
|
|
852
|
+
Nanobitcoin: "NANOBITCOIN",
|
|
853
|
+
Satoshi: "SATOSHI",
|
|
854
|
+
Usd: "USD"
|
|
855
|
+
};
|
|
850
856
|
var CONVERSION_MAP = {
|
|
851
|
-
[
|
|
852
|
-
[
|
|
853
|
-
[
|
|
854
|
-
[
|
|
855
|
-
[
|
|
856
|
-
[
|
|
857
|
-
[
|
|
858
|
-
[
|
|
857
|
+
[CurrencyUnit.BITCOIN]: {
|
|
858
|
+
[CurrencyUnit.BITCOIN]: (v) => v,
|
|
859
|
+
[CurrencyUnit.MICROBITCOIN]: (v) => v * 1e6,
|
|
860
|
+
[CurrencyUnit.MILLIBITCOIN]: (v) => v * 1e3,
|
|
861
|
+
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e11,
|
|
862
|
+
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e9,
|
|
863
|
+
[CurrencyUnit.SATOSHI]: (v) => v * 1e8,
|
|
864
|
+
[CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
|
|
859
865
|
/* Round without decimals since we're returning cents: */
|
|
860
866
|
round(v * centsPerBtc, 2)
|
|
861
867
|
)
|
|
862
868
|
},
|
|
863
|
-
[
|
|
864
|
-
[
|
|
865
|
-
[
|
|
866
|
-
[
|
|
867
|
-
[
|
|
868
|
-
[
|
|
869
|
-
[
|
|
870
|
-
[
|
|
869
|
+
[CurrencyUnit.MICROBITCOIN]: {
|
|
870
|
+
[CurrencyUnit.BITCOIN]: (v) => v / 1e6,
|
|
871
|
+
[CurrencyUnit.MICROBITCOIN]: (v) => v,
|
|
872
|
+
[CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e3,
|
|
873
|
+
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e5,
|
|
874
|
+
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e3,
|
|
875
|
+
[CurrencyUnit.SATOSHI]: (v) => v * 100,
|
|
876
|
+
[CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
|
|
871
877
|
/* Round without decimals since we're returning cents: */
|
|
872
878
|
round(v / 1e6 * centsPerBtc)
|
|
873
879
|
)
|
|
874
880
|
},
|
|
875
|
-
[
|
|
876
|
-
[
|
|
877
|
-
[
|
|
878
|
-
[
|
|
879
|
-
[
|
|
880
|
-
[
|
|
881
|
-
[
|
|
882
|
-
[
|
|
881
|
+
[CurrencyUnit.MILLIBITCOIN]: {
|
|
882
|
+
[CurrencyUnit.BITCOIN]: (v) => v / 1e3,
|
|
883
|
+
[CurrencyUnit.MICROBITCOIN]: (v) => v * 1e3,
|
|
884
|
+
[CurrencyUnit.MILLIBITCOIN]: (v) => v,
|
|
885
|
+
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e8,
|
|
886
|
+
[CurrencyUnit.NANOBITCOIN]: (v) => v * 1e6,
|
|
887
|
+
[CurrencyUnit.SATOSHI]: (v) => v * 1e5,
|
|
888
|
+
[CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
|
|
883
889
|
/* Round without decimals since we're returning cents: */
|
|
884
890
|
round(v / 1e3 * centsPerBtc)
|
|
885
891
|
)
|
|
886
892
|
},
|
|
887
|
-
[
|
|
888
|
-
[
|
|
889
|
-
[
|
|
890
|
-
[
|
|
891
|
-
[
|
|
892
|
-
[
|
|
893
|
-
[
|
|
894
|
-
[
|
|
893
|
+
[CurrencyUnit.MILLISATOSHI]: {
|
|
894
|
+
[CurrencyUnit.BITCOIN]: (v) => v / 1e11,
|
|
895
|
+
[CurrencyUnit.MICROBITCOIN]: (v) => v / 1e5,
|
|
896
|
+
[CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e8,
|
|
897
|
+
[CurrencyUnit.MILLISATOSHI]: (v) => v,
|
|
898
|
+
[CurrencyUnit.NANOBITCOIN]: (v) => v / 100,
|
|
899
|
+
[CurrencyUnit.SATOSHI]: (v) => v / 1e3,
|
|
900
|
+
[CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
|
|
895
901
|
/* Round without decimals since we're returning cents: */
|
|
896
902
|
round(v / 1e11 * centsPerBtc)
|
|
897
903
|
)
|
|
898
904
|
},
|
|
899
|
-
[
|
|
900
|
-
[
|
|
901
|
-
[
|
|
902
|
-
[
|
|
903
|
-
[
|
|
904
|
-
[
|
|
905
|
-
[
|
|
906
|
-
[
|
|
905
|
+
[CurrencyUnit.NANOBITCOIN]: {
|
|
906
|
+
[CurrencyUnit.BITCOIN]: (v) => v / 1e9,
|
|
907
|
+
[CurrencyUnit.MICROBITCOIN]: (v) => v / 1e3,
|
|
908
|
+
[CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e6,
|
|
909
|
+
[CurrencyUnit.MILLISATOSHI]: (v) => v * 100,
|
|
910
|
+
[CurrencyUnit.NANOBITCOIN]: (v) => v,
|
|
911
|
+
[CurrencyUnit.SATOSHI]: (v) => v / 10,
|
|
912
|
+
[CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
|
|
907
913
|
/* Round without decimals since we're returning cents: */
|
|
908
914
|
round(v / 1e9 * centsPerBtc)
|
|
909
915
|
)
|
|
910
916
|
},
|
|
911
|
-
[
|
|
912
|
-
[
|
|
913
|
-
[
|
|
914
|
-
[
|
|
915
|
-
[
|
|
916
|
-
[
|
|
917
|
-
[
|
|
918
|
-
[
|
|
917
|
+
[CurrencyUnit.SATOSHI]: {
|
|
918
|
+
[CurrencyUnit.BITCOIN]: (v) => v / 1e8,
|
|
919
|
+
[CurrencyUnit.MICROBITCOIN]: (v) => v / 100,
|
|
920
|
+
[CurrencyUnit.MILLIBITCOIN]: (v) => v / 1e5,
|
|
921
|
+
[CurrencyUnit.MILLISATOSHI]: (v) => v * 1e3,
|
|
922
|
+
[CurrencyUnit.NANOBITCOIN]: (v) => v * 10,
|
|
923
|
+
[CurrencyUnit.SATOSHI]: (v) => v,
|
|
924
|
+
[CurrencyUnit.USD]: (v, centsPerBtc = 1) => (
|
|
919
925
|
/* Round without decimals since we're returning cents: */
|
|
920
926
|
round(v / 1e8 * centsPerBtc)
|
|
921
927
|
)
|
|
922
928
|
},
|
|
923
|
-
[
|
|
924
|
-
[
|
|
925
|
-
[
|
|
926
|
-
[
|
|
927
|
-
[
|
|
928
|
-
[
|
|
929
|
-
[
|
|
930
|
-
[
|
|
929
|
+
[CurrencyUnit.USD]: {
|
|
930
|
+
[CurrencyUnit.BITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc,
|
|
931
|
+
[CurrencyUnit.MICROBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e6,
|
|
932
|
+
[CurrencyUnit.MILLIBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e3,
|
|
933
|
+
[CurrencyUnit.MILLISATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e11,
|
|
934
|
+
[CurrencyUnit.NANOBITCOIN]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e9,
|
|
935
|
+
[CurrencyUnit.SATOSHI]: (v, centsPerBtc = 1) => v / centsPerBtc * 1e8,
|
|
936
|
+
[CurrencyUnit.USD]: (v) => v
|
|
931
937
|
}
|
|
932
938
|
};
|
|
933
939
|
function convertCurrencyAmountValue(fromUnit, toUnit, amount, centsPerBtc = 1) {
|
|
934
|
-
if (fromUnit ===
|
|
940
|
+
if (fromUnit === CurrencyUnit.FUTURE_VALUE || toUnit === CurrencyUnit.FUTURE_VALUE) {
|
|
935
941
|
throw new LightsparkException_default("CurrencyError", `Unsupported CurrencyUnit.`);
|
|
936
942
|
}
|
|
937
943
|
if (fromUnit === toUnit) {
|
|
@@ -962,8 +968,9 @@ var convertCurrencyAmount = (from, toUnit) => {
|
|
|
962
968
|
function isCurrencyAmountObj(arg) {
|
|
963
969
|
return typeof arg === "object" && arg !== null && "value" in arg && "unit" in arg;
|
|
964
970
|
}
|
|
965
|
-
function
|
|
966
|
-
return typeof arg === "object" && arg !== null &&
|
|
971
|
+
function isSDKCurrencyAmount(arg) {
|
|
972
|
+
return typeof arg === "object" && arg !== null && /* We can expect all SDK CurrencyAmount types to always have these exact properties: */
|
|
973
|
+
"originalValue" in arg && "originalUnit" in arg && "preferredCurrencyUnit" in arg && "preferredCurrencyValueRounded" in arg && "preferredCurrencyValueApprox" in arg;
|
|
967
974
|
}
|
|
968
975
|
function asNumber(value) {
|
|
969
976
|
if (typeof value === "string") {
|
|
@@ -974,67 +981,67 @@ function asNumber(value) {
|
|
|
974
981
|
function getCurrencyAmount(currencyAmountArg) {
|
|
975
982
|
let value = 0;
|
|
976
983
|
let unit = void 0;
|
|
977
|
-
if (
|
|
978
|
-
value = asNumber(currencyAmountArg.value);
|
|
979
|
-
unit = currencyAmountArg.unit;
|
|
980
|
-
} else if (isCurrencyAmount(currencyAmountArg)) {
|
|
984
|
+
if (isSDKCurrencyAmount(currencyAmountArg)) {
|
|
981
985
|
value = currencyAmountArg.originalValue;
|
|
982
986
|
unit = currencyAmountArg.originalUnit;
|
|
987
|
+
} else if (isCurrencyAmountObj(currencyAmountArg)) {
|
|
988
|
+
value = asNumber(currencyAmountArg.value);
|
|
989
|
+
unit = currencyAmountArg.unit;
|
|
983
990
|
}
|
|
984
991
|
return {
|
|
985
992
|
value: asNumber(value),
|
|
986
|
-
unit: unit ||
|
|
993
|
+
unit: unit || CurrencyUnit.SATOSHI
|
|
987
994
|
};
|
|
988
995
|
}
|
|
989
996
|
function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
|
|
990
997
|
const { value, unit } = getCurrencyAmount(currencyAmountArg);
|
|
991
998
|
const convert = convertCurrencyAmountValue;
|
|
992
|
-
const sats = convert(unit,
|
|
993
|
-
const btc = convert(unit,
|
|
994
|
-
const msats = convert(unit,
|
|
995
|
-
const usd = convert(unit,
|
|
996
|
-
const mibtc = convert(unit,
|
|
997
|
-
const mlbtc = convert(unit,
|
|
998
|
-
const nbtc = convert(unit,
|
|
999
|
+
const sats = convert(unit, CurrencyUnit.SATOSHI, value, centsPerBtc);
|
|
1000
|
+
const btc = convert(unit, CurrencyUnit.BITCOIN, value, centsPerBtc);
|
|
1001
|
+
const msats = convert(unit, CurrencyUnit.MILLISATOSHI, value, centsPerBtc);
|
|
1002
|
+
const usd = convert(unit, CurrencyUnit.USD, value, centsPerBtc);
|
|
1003
|
+
const mibtc = convert(unit, CurrencyUnit.MICROBITCOIN, value, centsPerBtc);
|
|
1004
|
+
const mlbtc = convert(unit, CurrencyUnit.MILLIBITCOIN, value, centsPerBtc);
|
|
1005
|
+
const nbtc = convert(unit, CurrencyUnit.NANOBITCOIN, value, centsPerBtc);
|
|
999
1006
|
const mapWithCurrencyUnits = {
|
|
1000
|
-
[
|
|
1001
|
-
[
|
|
1002
|
-
[
|
|
1003
|
-
[
|
|
1004
|
-
[
|
|
1005
|
-
[
|
|
1006
|
-
[
|
|
1007
|
-
[
|
|
1007
|
+
[CurrencyUnit.BITCOIN]: btc,
|
|
1008
|
+
[CurrencyUnit.SATOSHI]: sats,
|
|
1009
|
+
[CurrencyUnit.MILLISATOSHI]: msats,
|
|
1010
|
+
[CurrencyUnit.USD]: usd,
|
|
1011
|
+
[CurrencyUnit.MICROBITCOIN]: mibtc,
|
|
1012
|
+
[CurrencyUnit.MILLIBITCOIN]: mlbtc,
|
|
1013
|
+
[CurrencyUnit.NANOBITCOIN]: nbtc,
|
|
1014
|
+
[CurrencyUnit.FUTURE_VALUE]: NaN,
|
|
1008
1015
|
formatted: {
|
|
1009
|
-
[
|
|
1016
|
+
[CurrencyUnit.BITCOIN]: formatCurrencyStr({
|
|
1010
1017
|
value: btc,
|
|
1011
|
-
unit:
|
|
1018
|
+
unit: CurrencyUnit.BITCOIN
|
|
1012
1019
|
}),
|
|
1013
|
-
[
|
|
1020
|
+
[CurrencyUnit.SATOSHI]: formatCurrencyStr({
|
|
1014
1021
|
value: sats,
|
|
1015
|
-
unit:
|
|
1022
|
+
unit: CurrencyUnit.SATOSHI
|
|
1016
1023
|
}),
|
|
1017
|
-
[
|
|
1024
|
+
[CurrencyUnit.MILLISATOSHI]: formatCurrencyStr({
|
|
1018
1025
|
value: msats,
|
|
1019
|
-
unit:
|
|
1026
|
+
unit: CurrencyUnit.MILLISATOSHI
|
|
1020
1027
|
}),
|
|
1021
|
-
[
|
|
1028
|
+
[CurrencyUnit.MICROBITCOIN]: formatCurrencyStr({
|
|
1022
1029
|
value: mibtc,
|
|
1023
|
-
unit:
|
|
1030
|
+
unit: CurrencyUnit.MICROBITCOIN
|
|
1024
1031
|
}),
|
|
1025
|
-
[
|
|
1032
|
+
[CurrencyUnit.MILLIBITCOIN]: formatCurrencyStr({
|
|
1026
1033
|
value: mlbtc,
|
|
1027
|
-
unit:
|
|
1034
|
+
unit: CurrencyUnit.MILLIBITCOIN
|
|
1028
1035
|
}),
|
|
1029
|
-
[
|
|
1036
|
+
[CurrencyUnit.NANOBITCOIN]: formatCurrencyStr({
|
|
1030
1037
|
value: nbtc,
|
|
1031
|
-
unit:
|
|
1038
|
+
unit: CurrencyUnit.NANOBITCOIN
|
|
1032
1039
|
}),
|
|
1033
|
-
[
|
|
1040
|
+
[CurrencyUnit.USD]: formatCurrencyStr({
|
|
1034
1041
|
value: usd,
|
|
1035
|
-
unit:
|
|
1042
|
+
unit: CurrencyUnit.USD
|
|
1036
1043
|
}),
|
|
1037
|
-
[
|
|
1044
|
+
[CurrencyUnit.FUTURE_VALUE]: "-"
|
|
1038
1045
|
}
|
|
1039
1046
|
};
|
|
1040
1047
|
return {
|
|
@@ -1072,9 +1079,9 @@ function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
|
|
|
1072
1079
|
},
|
|
1073
1080
|
formatted: {
|
|
1074
1081
|
...mapWithCurrencyUnits.formatted,
|
|
1075
|
-
btc: mapWithCurrencyUnits.formatted[
|
|
1076
|
-
sats: mapWithCurrencyUnits.formatted[
|
|
1077
|
-
msats: mapWithCurrencyUnits.formatted[
|
|
1082
|
+
btc: mapWithCurrencyUnits.formatted[CurrencyUnit.BITCOIN],
|
|
1083
|
+
sats: mapWithCurrencyUnits.formatted[CurrencyUnit.SATOSHI],
|
|
1084
|
+
msats: mapWithCurrencyUnits.formatted[CurrencyUnit.MILLISATOSHI]
|
|
1078
1085
|
},
|
|
1079
1086
|
type: "CurrencyMap"
|
|
1080
1087
|
};
|
|
@@ -1082,13 +1089,13 @@ function mapCurrencyAmount(currencyAmountArg, centsPerBtc = 1) {
|
|
|
1082
1089
|
var isCurrencyMap = (currencyMap) => typeof currencyMap === "object" && currencyMap !== null && "type" in currencyMap && typeof currencyMap.type === "string" && currencyMap.type === "CurrencyMap";
|
|
1083
1090
|
var abbrCurrencyUnit = (unit) => {
|
|
1084
1091
|
switch (unit) {
|
|
1085
|
-
case
|
|
1092
|
+
case CurrencyUnit.BITCOIN:
|
|
1086
1093
|
return "BTC";
|
|
1087
|
-
case
|
|
1094
|
+
case CurrencyUnit.SATOSHI:
|
|
1088
1095
|
return "SAT";
|
|
1089
|
-
case
|
|
1096
|
+
case CurrencyUnit.MILLISATOSHI:
|
|
1090
1097
|
return "MSAT";
|
|
1091
|
-
case
|
|
1098
|
+
case CurrencyUnit.USD:
|
|
1092
1099
|
return "USD";
|
|
1093
1100
|
}
|
|
1094
1101
|
return "Unsupported CurrencyUnit";
|
|
@@ -1097,33 +1104,33 @@ function formatCurrencyStr(amount, maxFractionDigits, compact, showBtcSymbol = f
|
|
|
1097
1104
|
const currencyAmount = getCurrencyAmount(amount);
|
|
1098
1105
|
let { value: num } = currencyAmount;
|
|
1099
1106
|
const { unit } = currencyAmount;
|
|
1100
|
-
if (unit ===
|
|
1107
|
+
if (unit === CurrencyUnit.USD) {
|
|
1101
1108
|
num = num / 100;
|
|
1102
1109
|
}
|
|
1103
1110
|
function getDefaultMaxFractionDigits(defaultDigits) {
|
|
1104
1111
|
return typeof maxFractionDigits === "undefined" ? compact ? 1 : defaultDigits : maxFractionDigits;
|
|
1105
1112
|
}
|
|
1106
|
-
const symbol = !showBtcSymbol ? "" : unit ===
|
|
1113
|
+
const symbol = !showBtcSymbol ? "" : unit === CurrencyUnit.BITCOIN ? "\uE903" : unit === CurrencyUnit.SATOSHI ? "\uE902" : "";
|
|
1107
1114
|
const currentLocale = getCurrentLocale();
|
|
1108
1115
|
switch (unit) {
|
|
1109
|
-
case
|
|
1116
|
+
case CurrencyUnit.BITCOIN:
|
|
1110
1117
|
return `${symbol}${num.toLocaleString(currentLocale, {
|
|
1111
1118
|
notation: compact ? "compact" : void 0,
|
|
1112
1119
|
maximumFractionDigits: getDefaultMaxFractionDigits(4),
|
|
1113
1120
|
...options
|
|
1114
1121
|
})}`;
|
|
1115
|
-
case
|
|
1116
|
-
case
|
|
1117
|
-
case
|
|
1118
|
-
case
|
|
1119
|
-
case
|
|
1122
|
+
case CurrencyUnit.MILLISATOSHI:
|
|
1123
|
+
case CurrencyUnit.SATOSHI:
|
|
1124
|
+
case CurrencyUnit.MICROBITCOIN:
|
|
1125
|
+
case CurrencyUnit.MILLIBITCOIN:
|
|
1126
|
+
case CurrencyUnit.NANOBITCOIN:
|
|
1120
1127
|
default:
|
|
1121
1128
|
return `${symbol}${num.toLocaleString(currentLocale, {
|
|
1122
1129
|
notation: compact ? "compact" : void 0,
|
|
1123
1130
|
maximumFractionDigits: getDefaultMaxFractionDigits(0),
|
|
1124
1131
|
...options
|
|
1125
1132
|
})}`;
|
|
1126
|
-
case
|
|
1133
|
+
case CurrencyUnit.USD:
|
|
1127
1134
|
return num.toLocaleString(currentLocale, {
|
|
1128
1135
|
style: "currency",
|
|
1129
1136
|
currency: defaultCurrencyCode,
|
|
@@ -1678,7 +1685,6 @@ var Requester_default = Requester;
|
|
|
1678
1685
|
getLocalStorageConfigItem,
|
|
1679
1686
|
hexToBytes,
|
|
1680
1687
|
isBrowser,
|
|
1681
|
-
isCurrencyAmount,
|
|
1682
1688
|
isCurrencyAmountObj,
|
|
1683
1689
|
isCurrencyMap,
|
|
1684
1690
|
isError,
|
|
@@ -1686,6 +1692,7 @@ var Requester_default = Requester;
|
|
|
1686
1692
|
isErrorWithMessage,
|
|
1687
1693
|
isNode,
|
|
1688
1694
|
isNumber,
|
|
1695
|
+
isSDKCurrencyAmount,
|
|
1689
1696
|
isTest,
|
|
1690
1697
|
isType,
|
|
1691
1698
|
isUint8Array,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Z as ById, C as ConfigKeys, k as CurrencyAmountArg, j as CurrencyAmountObj, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, f as CurrencyUnitType, a0 as DeepPartial, Y as ExpandRecursively, a1 as JSONLiteral, a3 as JSONObject, a2 as JSONType, X as Maybe, a4 as NN, _ as OmitTypename, S as SDKCurrencyAmountType, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, m as isSDKCurrencyAmount, w as isTest, $ as isType, W as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, V as lsidToUUID, n as mapCurrencyAmount, a5 as notNullUndefined, T as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, U as sleep, u as urlsafe_b64decode } from './index-9ecb1570.js';
|
|
2
2
|
import { Observable } from 'zen-observable-ts';
|
|
3
3
|
|
|
4
4
|
declare class LightsparkException extends Error {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Z as ById, C as ConfigKeys, k as CurrencyAmountArg, j as CurrencyAmountObj, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, f as CurrencyUnitType, a0 as DeepPartial, Y as ExpandRecursively, a1 as JSONLiteral, a3 as JSONObject, a2 as JSONType, X as Maybe, a4 as NN, _ as OmitTypename, S as SDKCurrencyAmountType, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, m as isSDKCurrencyAmount, w as isTest, $ as isType, W as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, V as lsidToUUID, n as mapCurrencyAmount, a5 as notNullUndefined, T as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, U as sleep, u as urlsafe_b64decode } from './index-9ecb1570.js';
|
|
2
2
|
import { Observable } from 'zen-observable-ts';
|
|
3
3
|
|
|
4
4
|
declare class LightsparkException extends Error {
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
getLocalStorageConfigItem,
|
|
21
21
|
hexToBytes,
|
|
22
22
|
isBrowser,
|
|
23
|
-
isCurrencyAmount,
|
|
24
23
|
isCurrencyAmountObj,
|
|
25
24
|
isCurrencyMap,
|
|
26
25
|
isError,
|
|
@@ -28,6 +27,7 @@ import {
|
|
|
28
27
|
isErrorWithMessage,
|
|
29
28
|
isNode,
|
|
30
29
|
isNumber,
|
|
30
|
+
isSDKCurrencyAmount,
|
|
31
31
|
isTest,
|
|
32
32
|
isType,
|
|
33
33
|
isUint8Array,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
setLocalStorageBoolean,
|
|
44
44
|
sleep,
|
|
45
45
|
urlsafe_b64decode
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-RC2KOZKZ.js";
|
|
47
47
|
|
|
48
48
|
// src/Logger.ts
|
|
49
49
|
var LoggingLevel = /* @__PURE__ */ ((LoggingLevel2) => {
|
|
@@ -718,7 +718,6 @@ export {
|
|
|
718
718
|
getLocalStorageConfigItem,
|
|
719
719
|
hexToBytes,
|
|
720
720
|
isBrowser,
|
|
721
|
-
isCurrencyAmount,
|
|
722
721
|
isCurrencyAmountObj,
|
|
723
722
|
isCurrencyMap,
|
|
724
723
|
isError,
|
|
@@ -726,6 +725,7 @@ export {
|
|
|
726
725
|
isErrorWithMessage,
|
|
727
726
|
isNode,
|
|
728
727
|
isNumber,
|
|
728
|
+
isSDKCurrencyAmount,
|
|
729
729
|
isTest,
|
|
730
730
|
isType,
|
|
731
731
|
isUint8Array,
|