@lightsparkdev/core 1.4.1 → 1.4.2
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 +7 -0
- package/dist/{chunk-NV53XYAS.js → chunk-CP4LQTTD.js} +1076 -12
- package/dist/{index-DZbfPQqd.d.cts → index-BCTAeaWD.d.cts} +15 -2
- package/dist/{index-DZbfPQqd.d.ts → index-BCTAeaWD.d.ts} +15 -2
- package/dist/index.cjs +1079 -13
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -3
- package/dist/utils/index.cjs +1079 -13
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +7 -3
- package/package.json +1 -1
- package/src/utils/currency.ts +22 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/zipcodeToState.ts +1120 -0
package/dist/utils/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AppendUnitsOptions, ab as ById, am as Complete, o as CurrencyAmountArg, k as CurrencyAmountInputObj, m as CurrencyAmountObj, n as CurrencyAmountPreferenceObj, V as CurrencyCodes, T as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, af as DeepPartial, D as DeprecatedCurrencyAmountObj, aa as ExpandRecursively, ae as ExtractByTypename, ag as JSONLiteral, ai as JSONObject, ah as JSONType, a9 as Maybe, aj as NN, ac as OmitTypename, al as PartialBy, an as RequiredKeys, S as SDKCurrencyAmountType, U as UmaCurrency, l as UmaCurrencyAmount, z as abbrCurrencyUnit, b as b64decode, a as b64encode, O as bytesToHex, $ as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, R as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, _ as deleteLocalStorageItem, e as ensureArray, N as errorToJSON, B as formatCurrencyStr, w as getCurrencyAmount, Q as getCurrentLocale, L as getErrorMsg, Y as getLocalStorageBoolean, X as getLocalStorageConfigItem, P as hexToBytes, G as isBrowser, p as isCurrencyAmountInputObj, s as isCurrencyAmountObj, t as isCurrencyAmountPreferenceObj, y as isCurrencyMap, r as isDeprecatedCurrencyAmountObj, J as isError, M as isErrorMsg, K as isErrorWithMessage, H as isNode, a2 as isNumber, a7 as isObject, a8 as isRecord, v as isSDKCurrencyAmount, I as isTest, ad as isType, a6 as isUint8Array, q as isUmaCurrencyAmount, a0 as linearInterpolate, W as localeToCurrencyCode, F as localeToCurrencySymbol, a5 as lsidToUUID, x as mapCurrencyAmount, ak as notNullUndefined, a3 as pollUntil, a1 as round, E as separateCurrencyStrParts, Z as setLocalStorageBoolean, a4 as sleep, u as urlsafe_b64decode } from '../index-
|
|
1
|
+
export { A as AppendUnitsOptions, ab as ById, am as Complete, o as CurrencyAmountArg, k as CurrencyAmountInputObj, m as CurrencyAmountObj, n as CurrencyAmountPreferenceObj, V as CurrencyCodes, T as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, af as DeepPartial, D as DeprecatedCurrencyAmountObj, aa as ExpandRecursively, ae as ExtractByTypename, ag as JSONLiteral, ai as JSONObject, ah as JSONType, a9 as Maybe, aj as NN, ac as OmitTypename, al as PartialBy, an as RequiredKeys, S as SDKCurrencyAmountType, ao as StateCode, U as UmaCurrency, l as UmaCurrencyAmount, z as abbrCurrencyUnit, b as b64decode, a as b64encode, O as bytesToHex, $ as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, R as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, _ as deleteLocalStorageItem, e as ensureArray, N as errorToJSON, B as formatCurrencyStr, w as getCurrencyAmount, Q as getCurrentLocale, L as getErrorMsg, Y as getLocalStorageBoolean, X as getLocalStorageConfigItem, P as hexToBytes, G as isBrowser, p as isCurrencyAmountInputObj, s as isCurrencyAmountObj, t as isCurrencyAmountPreferenceObj, y as isCurrencyMap, r as isDeprecatedCurrencyAmountObj, J as isError, M as isErrorMsg, K as isErrorWithMessage, H as isNode, a2 as isNumber, a7 as isObject, a8 as isRecord, v as isSDKCurrencyAmount, I as isTest, ad as isType, a6 as isUint8Array, q as isUmaCurrencyAmount, a0 as linearInterpolate, W as localeToCurrencyCode, F as localeToCurrencySymbol, a5 as lsidToUUID, x as mapCurrencyAmount, ak as notNullUndefined, a3 as pollUntil, a1 as round, E as separateCurrencyStrParts, Z as setLocalStorageBoolean, a4 as sleep, u as urlsafe_b64decode, aq as zipcodeToState, ap as zipcodeToStateCode } from '../index-BCTAeaWD.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AppendUnitsOptions, ab as ById, am as Complete, o as CurrencyAmountArg, k as CurrencyAmountInputObj, m as CurrencyAmountObj, n as CurrencyAmountPreferenceObj, V as CurrencyCodes, T as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, af as DeepPartial, D as DeprecatedCurrencyAmountObj, aa as ExpandRecursively, ae as ExtractByTypename, ag as JSONLiteral, ai as JSONObject, ah as JSONType, a9 as Maybe, aj as NN, ac as OmitTypename, al as PartialBy, an as RequiredKeys, S as SDKCurrencyAmountType, U as UmaCurrency, l as UmaCurrencyAmount, z as abbrCurrencyUnit, b as b64decode, a as b64encode, O as bytesToHex, $ as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, R as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, _ as deleteLocalStorageItem, e as ensureArray, N as errorToJSON, B as formatCurrencyStr, w as getCurrencyAmount, Q as getCurrentLocale, L as getErrorMsg, Y as getLocalStorageBoolean, X as getLocalStorageConfigItem, P as hexToBytes, G as isBrowser, p as isCurrencyAmountInputObj, s as isCurrencyAmountObj, t as isCurrencyAmountPreferenceObj, y as isCurrencyMap, r as isDeprecatedCurrencyAmountObj, J as isError, M as isErrorMsg, K as isErrorWithMessage, H as isNode, a2 as isNumber, a7 as isObject, a8 as isRecord, v as isSDKCurrencyAmount, I as isTest, ad as isType, a6 as isUint8Array, q as isUmaCurrencyAmount, a0 as linearInterpolate, W as localeToCurrencyCode, F as localeToCurrencySymbol, a5 as lsidToUUID, x as mapCurrencyAmount, ak as notNullUndefined, a3 as pollUntil, a1 as round, E as separateCurrencyStrParts, Z as setLocalStorageBoolean, a4 as sleep, u as urlsafe_b64decode } from '../index-
|
|
1
|
+
export { A as AppendUnitsOptions, ab as ById, am as Complete, o as CurrencyAmountArg, k as CurrencyAmountInputObj, m as CurrencyAmountObj, n as CurrencyAmountPreferenceObj, V as CurrencyCodes, T as CurrencyLocales, j as CurrencyMap, f as CurrencyUnit, g as CurrencyUnitType, af as DeepPartial, D as DeprecatedCurrencyAmountObj, aa as ExpandRecursively, ae as ExtractByTypename, ag as JSONLiteral, ai as JSONObject, ah as JSONType, a9 as Maybe, aj as NN, ac as OmitTypename, al as PartialBy, an as RequiredKeys, S as SDKCurrencyAmountType, ao as StateCode, U as UmaCurrency, l as UmaCurrencyAmount, z as abbrCurrencyUnit, b as b64decode, a as b64encode, O as bytesToHex, $ as clamp, i as convertCurrencyAmount, h as convertCurrencyAmountValue, R as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, _ as deleteLocalStorageItem, e as ensureArray, N as errorToJSON, B as formatCurrencyStr, w as getCurrencyAmount, Q as getCurrentLocale, L as getErrorMsg, Y as getLocalStorageBoolean, X as getLocalStorageConfigItem, P as hexToBytes, G as isBrowser, p as isCurrencyAmountInputObj, s as isCurrencyAmountObj, t as isCurrencyAmountPreferenceObj, y as isCurrencyMap, r as isDeprecatedCurrencyAmountObj, J as isError, M as isErrorMsg, K as isErrorWithMessage, H as isNode, a2 as isNumber, a7 as isObject, a8 as isRecord, v as isSDKCurrencyAmount, I as isTest, ad as isType, a6 as isUint8Array, q as isUmaCurrencyAmount, a0 as linearInterpolate, W as localeToCurrencyCode, F as localeToCurrencySymbol, a5 as lsidToUUID, x as mapCurrencyAmount, ak as notNullUndefined, a3 as pollUntil, a1 as round, E as separateCurrencyStrParts, Z as setLocalStorageBoolean, a4 as sleep, u as urlsafe_b64decode, aq as zipcodeToState, ap as zipcodeToStateCode } from '../index-BCTAeaWD.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -49,8 +49,10 @@ import {
|
|
|
49
49
|
separateCurrencyStrParts,
|
|
50
50
|
setLocalStorageBoolean,
|
|
51
51
|
sleep,
|
|
52
|
-
urlsafe_b64decode
|
|
53
|
-
|
|
52
|
+
urlsafe_b64decode,
|
|
53
|
+
zipcodeToState,
|
|
54
|
+
zipcodeToStateCode
|
|
55
|
+
} from "../chunk-CP4LQTTD.js";
|
|
54
56
|
export {
|
|
55
57
|
CurrencyUnit,
|
|
56
58
|
abbrCurrencyUnit,
|
|
@@ -102,5 +104,7 @@ export {
|
|
|
102
104
|
separateCurrencyStrParts,
|
|
103
105
|
setLocalStorageBoolean,
|
|
104
106
|
sleep,
|
|
105
|
-
urlsafe_b64decode
|
|
107
|
+
urlsafe_b64decode,
|
|
108
|
+
zipcodeToState,
|
|
109
|
+
zipcodeToStateCode
|
|
106
110
|
};
|
package/package.json
CHANGED
package/src/utils/currency.ts
CHANGED
|
@@ -22,6 +22,7 @@ export const CurrencyUnit = {
|
|
|
22
22
|
MXN: "MXN",
|
|
23
23
|
PHP: "PHP",
|
|
24
24
|
EUR: "EUR",
|
|
25
|
+
GBP: "GBP",
|
|
25
26
|
|
|
26
27
|
Bitcoin: "BITCOIN",
|
|
27
28
|
Microbitcoin: "MICROBITCOIN",
|
|
@@ -32,6 +33,7 @@ export const CurrencyUnit = {
|
|
|
32
33
|
Usd: "USD",
|
|
33
34
|
Mxn: "MXN",
|
|
34
35
|
Php: "PHP",
|
|
36
|
+
Gbp: "GBP",
|
|
35
37
|
} as const;
|
|
36
38
|
|
|
37
39
|
export type CurrencyUnitType = (typeof CurrencyUnit)[keyof typeof CurrencyUnit];
|
|
@@ -61,6 +63,7 @@ const standardUnitConversionObj = {
|
|
|
61
63
|
[CurrencyUnit.MXN]: (v: number) => v,
|
|
62
64
|
[CurrencyUnit.PHP]: (v: number) => v,
|
|
63
65
|
[CurrencyUnit.EUR]: (v: number) => v,
|
|
66
|
+
[CurrencyUnit.GBP]: (v: number) => v,
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
/* Round without decimals since we're returning cents: */
|
|
@@ -89,6 +92,7 @@ const CONVERSION_MAP = {
|
|
|
89
92
|
[CurrencyUnit.MXN]: toBitcoinConversion,
|
|
90
93
|
[CurrencyUnit.PHP]: toBitcoinConversion,
|
|
91
94
|
[CurrencyUnit.EUR]: toBitcoinConversion,
|
|
95
|
+
[CurrencyUnit.GBP]: toBitcoinConversion,
|
|
92
96
|
},
|
|
93
97
|
[CurrencyUnit.MICROBITCOIN]: {
|
|
94
98
|
[CurrencyUnit.BITCOIN]: (v: number) => v / 1_000_000,
|
|
@@ -101,6 +105,7 @@ const CONVERSION_MAP = {
|
|
|
101
105
|
[CurrencyUnit.MXN]: toMicrobitcoinConversion,
|
|
102
106
|
[CurrencyUnit.PHP]: toMicrobitcoinConversion,
|
|
103
107
|
[CurrencyUnit.EUR]: toMicrobitcoinConversion,
|
|
108
|
+
[CurrencyUnit.GBP]: toMicrobitcoinConversion,
|
|
104
109
|
},
|
|
105
110
|
[CurrencyUnit.MILLIBITCOIN]: {
|
|
106
111
|
[CurrencyUnit.BITCOIN]: (v: number) => v / 1_000,
|
|
@@ -113,6 +118,7 @@ const CONVERSION_MAP = {
|
|
|
113
118
|
[CurrencyUnit.MXN]: toMillibitcoinConversion,
|
|
114
119
|
[CurrencyUnit.PHP]: toMillibitcoinConversion,
|
|
115
120
|
[CurrencyUnit.EUR]: toMillibitcoinConversion,
|
|
121
|
+
[CurrencyUnit.GBP]: toMillibitcoinConversion,
|
|
116
122
|
},
|
|
117
123
|
[CurrencyUnit.MILLISATOSHI]: {
|
|
118
124
|
[CurrencyUnit.BITCOIN]: (v: number) => v / 100_000_000_000,
|
|
@@ -125,6 +131,7 @@ const CONVERSION_MAP = {
|
|
|
125
131
|
[CurrencyUnit.MXN]: toMillisatoshiConversion,
|
|
126
132
|
[CurrencyUnit.PHP]: toMillisatoshiConversion,
|
|
127
133
|
[CurrencyUnit.EUR]: toMillisatoshiConversion,
|
|
134
|
+
[CurrencyUnit.GBP]: toMillisatoshiConversion,
|
|
128
135
|
},
|
|
129
136
|
[CurrencyUnit.NANOBITCOIN]: {
|
|
130
137
|
[CurrencyUnit.BITCOIN]: (v: number) => v / 1_000_000_000,
|
|
@@ -137,6 +144,7 @@ const CONVERSION_MAP = {
|
|
|
137
144
|
[CurrencyUnit.MXN]: toNanobitcoinConversion,
|
|
138
145
|
[CurrencyUnit.PHP]: toNanobitcoinConversion,
|
|
139
146
|
[CurrencyUnit.EUR]: toNanobitcoinConversion,
|
|
147
|
+
[CurrencyUnit.GBP]: toNanobitcoinConversion,
|
|
140
148
|
},
|
|
141
149
|
[CurrencyUnit.SATOSHI]: {
|
|
142
150
|
[CurrencyUnit.BITCOIN]: (v: number) => v / 100_000_000,
|
|
@@ -149,11 +157,13 @@ const CONVERSION_MAP = {
|
|
|
149
157
|
[CurrencyUnit.MXN]: toSatoshiConversion,
|
|
150
158
|
[CurrencyUnit.PHP]: toSatoshiConversion,
|
|
151
159
|
[CurrencyUnit.EUR]: toSatoshiConversion,
|
|
160
|
+
[CurrencyUnit.GBP]: toSatoshiConversion,
|
|
152
161
|
},
|
|
153
162
|
[CurrencyUnit.USD]: standardUnitConversionObj,
|
|
154
163
|
[CurrencyUnit.MXN]: standardUnitConversionObj,
|
|
155
164
|
[CurrencyUnit.PHP]: standardUnitConversionObj,
|
|
156
165
|
[CurrencyUnit.EUR]: standardUnitConversionObj,
|
|
166
|
+
[CurrencyUnit.GBP]: standardUnitConversionObj,
|
|
157
167
|
};
|
|
158
168
|
|
|
159
169
|
export function convertCurrencyAmountValue(
|
|
@@ -219,6 +229,7 @@ export type CurrencyMap = {
|
|
|
219
229
|
[CurrencyUnit.MXN]: number;
|
|
220
230
|
[CurrencyUnit.PHP]: number;
|
|
221
231
|
[CurrencyUnit.EUR]: number;
|
|
232
|
+
[CurrencyUnit.GBP]: number;
|
|
222
233
|
[CurrencyUnit.FUTURE_VALUE]: number;
|
|
223
234
|
formatted: {
|
|
224
235
|
sats: string;
|
|
@@ -234,6 +245,7 @@ export type CurrencyMap = {
|
|
|
234
245
|
[CurrencyUnit.MXN]: string;
|
|
235
246
|
[CurrencyUnit.PHP]: string;
|
|
236
247
|
[CurrencyUnit.EUR]: string;
|
|
248
|
+
[CurrencyUnit.GBP]: string;
|
|
237
249
|
[CurrencyUnit.FUTURE_VALUE]: string;
|
|
238
250
|
};
|
|
239
251
|
isZero: boolean;
|
|
@@ -430,6 +442,7 @@ function convertCurrencyAmountValues(
|
|
|
430
442
|
mxn: CurrencyUnit.MXN,
|
|
431
443
|
php: CurrencyUnit.PHP,
|
|
432
444
|
eur: CurrencyUnit.EUR,
|
|
445
|
+
gbp: CurrencyUnit.GBP,
|
|
433
446
|
mibtc: CurrencyUnit.MICROBITCOIN,
|
|
434
447
|
mlbtc: CurrencyUnit.MILLIBITCOIN,
|
|
435
448
|
nbtc: CurrencyUnit.NANOBITCOIN,
|
|
@@ -479,7 +492,7 @@ export function mapCurrencyAmount(
|
|
|
479
492
|
* preferred_currency_unit on CurrencyAmount types: */
|
|
480
493
|
const conversionOverride = getPreferredConversionOverride(currencyAmountArg);
|
|
481
494
|
|
|
482
|
-
const { sats, msats, btc, usd, mxn, php, mibtc, mlbtc, nbtc, eur } =
|
|
495
|
+
const { sats, msats, btc, usd, mxn, php, mibtc, mlbtc, nbtc, eur, gbp } =
|
|
483
496
|
convertCurrencyAmountValues(unit, value, unitsPerBtc, conversionOverride);
|
|
484
497
|
|
|
485
498
|
const mapWithCurrencyUnits = {
|
|
@@ -490,6 +503,7 @@ export function mapCurrencyAmount(
|
|
|
490
503
|
[CurrencyUnit.MXN]: mxn,
|
|
491
504
|
[CurrencyUnit.PHP]: php,
|
|
492
505
|
[CurrencyUnit.EUR]: eur,
|
|
506
|
+
[CurrencyUnit.GBP]: gbp,
|
|
493
507
|
[CurrencyUnit.MICROBITCOIN]: mibtc,
|
|
494
508
|
[CurrencyUnit.MILLIBITCOIN]: mlbtc,
|
|
495
509
|
[CurrencyUnit.NANOBITCOIN]: nbtc,
|
|
@@ -535,6 +549,10 @@ export function mapCurrencyAmount(
|
|
|
535
549
|
value: eur,
|
|
536
550
|
unit: CurrencyUnit.EUR,
|
|
537
551
|
}),
|
|
552
|
+
[CurrencyUnit.GBP]: formatCurrencyStr({
|
|
553
|
+
value: gbp,
|
|
554
|
+
unit: CurrencyUnit.GBP,
|
|
555
|
+
}),
|
|
538
556
|
[CurrencyUnit.FUTURE_VALUE]: "-",
|
|
539
557
|
},
|
|
540
558
|
};
|
|
@@ -611,6 +629,8 @@ export const abbrCurrencyUnit = (unit: CurrencyUnitType) => {
|
|
|
611
629
|
return "PHP";
|
|
612
630
|
case CurrencyUnit.EUR:
|
|
613
631
|
return "EUR";
|
|
632
|
+
case CurrencyUnit.GBP:
|
|
633
|
+
return "GBP";
|
|
614
634
|
}
|
|
615
635
|
return "Unsupported CurrencyUnit";
|
|
616
636
|
};
|
|
@@ -665,6 +685,7 @@ export function formatCurrencyStr(
|
|
|
665
685
|
CurrencyUnit.MXN,
|
|
666
686
|
CurrencyUnit.PHP,
|
|
667
687
|
CurrencyUnit.EUR,
|
|
688
|
+
CurrencyUnit.GBP,
|
|
668
689
|
] as string[];
|
|
669
690
|
/* centCurrencies are always provided in the smallest unit, e.g. cents for USD. These should be
|
|
670
691
|
* divided by 100 for proper display format: */
|
package/src/utils/index.ts
CHANGED