@lightsparkdev/core 1.4.0 → 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 +13 -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 -2
- package/src/utils/currency.ts +22 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/zipcodeToState.ts +1120 -0
|
@@ -27,6 +27,7 @@ declare const CurrencyUnit: {
|
|
|
27
27
|
readonly MXN: "MXN";
|
|
28
28
|
readonly PHP: "PHP";
|
|
29
29
|
readonly EUR: "EUR";
|
|
30
|
+
readonly GBP: "GBP";
|
|
30
31
|
readonly Bitcoin: "BITCOIN";
|
|
31
32
|
readonly Microbitcoin: "MICROBITCOIN";
|
|
32
33
|
readonly Millibitcoin: "MILLIBITCOIN";
|
|
@@ -36,6 +37,7 @@ declare const CurrencyUnit: {
|
|
|
36
37
|
readonly Usd: "USD";
|
|
37
38
|
readonly Mxn: "MXN";
|
|
38
39
|
readonly Php: "PHP";
|
|
40
|
+
readonly Gbp: "GBP";
|
|
39
41
|
};
|
|
40
42
|
type CurrencyUnitType = (typeof CurrencyUnit)[keyof typeof CurrencyUnit];
|
|
41
43
|
type SDKCurrencyAmountType = {
|
|
@@ -61,6 +63,7 @@ type CurrencyMap = {
|
|
|
61
63
|
[CurrencyUnit.MXN]: number;
|
|
62
64
|
[CurrencyUnit.PHP]: number;
|
|
63
65
|
[CurrencyUnit.EUR]: number;
|
|
66
|
+
[CurrencyUnit.GBP]: number;
|
|
64
67
|
[CurrencyUnit.FUTURE_VALUE]: number;
|
|
65
68
|
formatted: {
|
|
66
69
|
sats: string;
|
|
@@ -76,6 +79,7 @@ type CurrencyMap = {
|
|
|
76
79
|
[CurrencyUnit.MXN]: string;
|
|
77
80
|
[CurrencyUnit.PHP]: string;
|
|
78
81
|
[CurrencyUnit.EUR]: string;
|
|
82
|
+
[CurrencyUnit.GBP]: string;
|
|
79
83
|
[CurrencyUnit.FUTURE_VALUE]: string;
|
|
80
84
|
};
|
|
81
85
|
isZero: boolean;
|
|
@@ -131,7 +135,7 @@ declare function getCurrencyAmount(currencyAmountArg: CurrencyAmountArg): {
|
|
|
131
135
|
};
|
|
132
136
|
declare function mapCurrencyAmount(currencyAmountArg: CurrencyAmountArg, unitsPerBtc?: number): CurrencyMap;
|
|
133
137
|
declare const isCurrencyMap: (currencyMap: unknown) => currencyMap is CurrencyMap;
|
|
134
|
-
declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "MXN" | "PHP" | "BTC" | "SAT" | "MSAT" | "mBTC" | "μBTC" | "Unsupported CurrencyUnit";
|
|
138
|
+
declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "GBP" | "MXN" | "PHP" | "BTC" | "SAT" | "MSAT" | "mBTC" | "μBTC" | "Unsupported CurrencyUnit";
|
|
135
139
|
type AppendUnitsOptions = {
|
|
136
140
|
plural?: boolean | undefined;
|
|
137
141
|
lowercase?: boolean | undefined;
|
|
@@ -308,4 +312,13 @@ declare function isUint8Array(value: unknown): value is Uint8Array;
|
|
|
308
312
|
declare function isObject(value: unknown): value is object;
|
|
309
313
|
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
310
314
|
|
|
311
|
-
|
|
315
|
+
type StateCode = "AK" | "AL" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DE" | "FL" | "GA" | "HI" | "IA" | "ID" | "IL" | "IN" | "KS" | "KY" | "LA" | "MA" | "MD" | "ME" | "MI" | "MN" | "MO" | "MS" | "MT" | "NC" | "ND" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "OH" | "OK" | "OR" | "PA" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VA" | "VT" | "WA" | "WI" | "WV" | "WY" | "DC" | "GU" | "PR" | "VI" | "AE" | "AA" | "AP" | "AS" | "PW" | "FM" | "MP" | "MH";
|
|
316
|
+
declare const zipcodeToStateCode: Record<string, StateCode>;
|
|
317
|
+
/**
|
|
318
|
+
* Converts a US zipcode to its corresponding state code
|
|
319
|
+
* @param zipcode The zipcode to convert
|
|
320
|
+
* @returns The state code or null if not found
|
|
321
|
+
*/
|
|
322
|
+
declare function zipcodeToState(zipcode: string): StateCode | null;
|
|
323
|
+
|
|
324
|
+
export { clamp as $, type AppendUnitsOptions as A, formatCurrencyStr as B, ConfigKeys as C, type DeprecatedCurrencyAmountObj as D, separateCurrencyStrParts as E, localeToCurrencySymbol as F, isBrowser as G, isNode as H, isTest as I, isError as J, isErrorWithMessage as K, getErrorMsg as L, isErrorMsg as M, errorToJSON as N, bytesToHex as O, hexToBytes as P, getCurrentLocale as Q, countryCodesToCurrencyCodes as R, type SDKCurrencyAmountType as S, type CurrencyLocales as T, type UmaCurrency as U, type CurrencyCodes as V, localeToCurrencyCode as W, getLocalStorageConfigItem as X, getLocalStorageBoolean as Y, setLocalStorageBoolean as Z, deleteLocalStorageItem as _, b64encode as a, linearInterpolate as a0, round as a1, isNumber as a2, pollUntil as a3, sleep as a4, lsidToUUID as a5, isUint8Array as a6, isObject as a7, isRecord as a8, type Maybe as a9, type ExpandRecursively as aa, type ById as ab, type OmitTypename as ac, isType as ad, type ExtractByTypename as ae, type DeepPartial as af, type JSONLiteral as ag, type JSONType as ah, type JSONObject as ai, type NN as aj, notNullUndefined as ak, type PartialBy as al, type Complete as am, type RequiredKeys as an, type StateCode as ao, zipcodeToStateCode as ap, zipcodeToState as aq, b64decode as b, createSha256Hash as c, defaultCurrencyCode as d, ensureArray as e, CurrencyUnit as f, type CurrencyUnitType as g, convertCurrencyAmountValue as h, convertCurrencyAmount as i, type CurrencyMap as j, type CurrencyAmountInputObj as k, type UmaCurrencyAmount as l, type CurrencyAmountObj as m, type CurrencyAmountPreferenceObj as n, type CurrencyAmountArg as o, isCurrencyAmountInputObj as p, isUmaCurrencyAmount as q, isDeprecatedCurrencyAmountObj as r, isCurrencyAmountObj as s, isCurrencyAmountPreferenceObj as t, urlsafe_b64decode as u, isSDKCurrencyAmount as v, getCurrencyAmount as w, mapCurrencyAmount as x, isCurrencyMap as y, abbrCurrencyUnit as z };
|
|
@@ -27,6 +27,7 @@ declare const CurrencyUnit: {
|
|
|
27
27
|
readonly MXN: "MXN";
|
|
28
28
|
readonly PHP: "PHP";
|
|
29
29
|
readonly EUR: "EUR";
|
|
30
|
+
readonly GBP: "GBP";
|
|
30
31
|
readonly Bitcoin: "BITCOIN";
|
|
31
32
|
readonly Microbitcoin: "MICROBITCOIN";
|
|
32
33
|
readonly Millibitcoin: "MILLIBITCOIN";
|
|
@@ -36,6 +37,7 @@ declare const CurrencyUnit: {
|
|
|
36
37
|
readonly Usd: "USD";
|
|
37
38
|
readonly Mxn: "MXN";
|
|
38
39
|
readonly Php: "PHP";
|
|
40
|
+
readonly Gbp: "GBP";
|
|
39
41
|
};
|
|
40
42
|
type CurrencyUnitType = (typeof CurrencyUnit)[keyof typeof CurrencyUnit];
|
|
41
43
|
type SDKCurrencyAmountType = {
|
|
@@ -61,6 +63,7 @@ type CurrencyMap = {
|
|
|
61
63
|
[CurrencyUnit.MXN]: number;
|
|
62
64
|
[CurrencyUnit.PHP]: number;
|
|
63
65
|
[CurrencyUnit.EUR]: number;
|
|
66
|
+
[CurrencyUnit.GBP]: number;
|
|
64
67
|
[CurrencyUnit.FUTURE_VALUE]: number;
|
|
65
68
|
formatted: {
|
|
66
69
|
sats: string;
|
|
@@ -76,6 +79,7 @@ type CurrencyMap = {
|
|
|
76
79
|
[CurrencyUnit.MXN]: string;
|
|
77
80
|
[CurrencyUnit.PHP]: string;
|
|
78
81
|
[CurrencyUnit.EUR]: string;
|
|
82
|
+
[CurrencyUnit.GBP]: string;
|
|
79
83
|
[CurrencyUnit.FUTURE_VALUE]: string;
|
|
80
84
|
};
|
|
81
85
|
isZero: boolean;
|
|
@@ -131,7 +135,7 @@ declare function getCurrencyAmount(currencyAmountArg: CurrencyAmountArg): {
|
|
|
131
135
|
};
|
|
132
136
|
declare function mapCurrencyAmount(currencyAmountArg: CurrencyAmountArg, unitsPerBtc?: number): CurrencyMap;
|
|
133
137
|
declare const isCurrencyMap: (currencyMap: unknown) => currencyMap is CurrencyMap;
|
|
134
|
-
declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "MXN" | "PHP" | "BTC" | "SAT" | "MSAT" | "mBTC" | "μBTC" | "Unsupported CurrencyUnit";
|
|
138
|
+
declare const abbrCurrencyUnit: (unit: CurrencyUnitType) => "EUR" | "USD" | "GBP" | "MXN" | "PHP" | "BTC" | "SAT" | "MSAT" | "mBTC" | "μBTC" | "Unsupported CurrencyUnit";
|
|
135
139
|
type AppendUnitsOptions = {
|
|
136
140
|
plural?: boolean | undefined;
|
|
137
141
|
lowercase?: boolean | undefined;
|
|
@@ -308,4 +312,13 @@ declare function isUint8Array(value: unknown): value is Uint8Array;
|
|
|
308
312
|
declare function isObject(value: unknown): value is object;
|
|
309
313
|
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
310
314
|
|
|
311
|
-
|
|
315
|
+
type StateCode = "AK" | "AL" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DE" | "FL" | "GA" | "HI" | "IA" | "ID" | "IL" | "IN" | "KS" | "KY" | "LA" | "MA" | "MD" | "ME" | "MI" | "MN" | "MO" | "MS" | "MT" | "NC" | "ND" | "NE" | "NV" | "NH" | "NJ" | "NM" | "NY" | "OH" | "OK" | "OR" | "PA" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VA" | "VT" | "WA" | "WI" | "WV" | "WY" | "DC" | "GU" | "PR" | "VI" | "AE" | "AA" | "AP" | "AS" | "PW" | "FM" | "MP" | "MH";
|
|
316
|
+
declare const zipcodeToStateCode: Record<string, StateCode>;
|
|
317
|
+
/**
|
|
318
|
+
* Converts a US zipcode to its corresponding state code
|
|
319
|
+
* @param zipcode The zipcode to convert
|
|
320
|
+
* @returns The state code or null if not found
|
|
321
|
+
*/
|
|
322
|
+
declare function zipcodeToState(zipcode: string): StateCode | null;
|
|
323
|
+
|
|
324
|
+
export { clamp as $, type AppendUnitsOptions as A, formatCurrencyStr as B, ConfigKeys as C, type DeprecatedCurrencyAmountObj as D, separateCurrencyStrParts as E, localeToCurrencySymbol as F, isBrowser as G, isNode as H, isTest as I, isError as J, isErrorWithMessage as K, getErrorMsg as L, isErrorMsg as M, errorToJSON as N, bytesToHex as O, hexToBytes as P, getCurrentLocale as Q, countryCodesToCurrencyCodes as R, type SDKCurrencyAmountType as S, type CurrencyLocales as T, type UmaCurrency as U, type CurrencyCodes as V, localeToCurrencyCode as W, getLocalStorageConfigItem as X, getLocalStorageBoolean as Y, setLocalStorageBoolean as Z, deleteLocalStorageItem as _, b64encode as a, linearInterpolate as a0, round as a1, isNumber as a2, pollUntil as a3, sleep as a4, lsidToUUID as a5, isUint8Array as a6, isObject as a7, isRecord as a8, type Maybe as a9, type ExpandRecursively as aa, type ById as ab, type OmitTypename as ac, isType as ad, type ExtractByTypename as ae, type DeepPartial as af, type JSONLiteral as ag, type JSONType as ah, type JSONObject as ai, type NN as aj, notNullUndefined as ak, type PartialBy as al, type Complete as am, type RequiredKeys as an, type StateCode as ao, zipcodeToStateCode as ap, zipcodeToState as aq, b64decode as b, createSha256Hash as c, defaultCurrencyCode as d, ensureArray as e, CurrencyUnit as f, type CurrencyUnitType as g, convertCurrencyAmountValue as h, convertCurrencyAmount as i, type CurrencyMap as j, type CurrencyAmountInputObj as k, type UmaCurrencyAmount as l, type CurrencyAmountObj as m, type CurrencyAmountPreferenceObj as n, type CurrencyAmountArg as o, isCurrencyAmountInputObj as p, isUmaCurrencyAmount as q, isDeprecatedCurrencyAmountObj as r, isCurrencyAmountObj as s, isCurrencyAmountPreferenceObj as t, urlsafe_b64decode as u, isSDKCurrencyAmount as v, getCurrencyAmount as w, mapCurrencyAmount as x, isCurrencyMap as y, abbrCurrencyUnit as z };
|