arky-sdk 0.4.22 → 0.4.24

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/README.md CHANGED
@@ -310,9 +310,6 @@ const payment = arky.utils.formatPayment(paymentObject)
310
310
  // Format prices from array
311
311
  const formatted = arky.utils.formatPrice(prices) // "$9.99"
312
312
  const amount = arky.utils.getPriceAmount(prices, 'US')
313
-
314
- // Currency
315
- const symbol = arky.utils.getCurrencySymbol('USD') // "$"
316
313
  ```
317
314
 
318
315
  ### Text Utilities
package/dist/index.cjs CHANGED
@@ -1416,42 +1416,20 @@ var createPlatformApi = (apiConfig) => {
1416
1416
  },
1417
1417
  getConfigCache() {
1418
1418
  return cachedConfig;
1419
+ },
1420
+ async getCurrencies(options) {
1421
+ return apiConfig.httpClient.get("/v1/platform/currencies", options);
1419
1422
  }
1420
1423
  };
1421
1424
  };
1422
1425
 
1423
- // src/utils/currency.ts
1424
- var cachedCurrencies = null;
1425
- function setCurrenciesCache(currencies) {
1426
- cachedCurrencies = currencies;
1427
- }
1428
- function getCurrenciesCache() {
1429
- return cachedCurrencies;
1430
- }
1426
+ // src/utils/price.ts
1431
1427
  function formatCurrency(amount, currencyCode, locale = "en") {
1432
1428
  return new Intl.NumberFormat(locale, {
1433
1429
  style: "currency",
1434
1430
  currency: currencyCode.toUpperCase()
1435
1431
  }).format(amount);
1436
1432
  }
1437
- function getCurrencySymbol(currencyCode) {
1438
- const cached = cachedCurrencies?.find((c) => c.code === currencyCode.toLowerCase());
1439
- if (cached) return cached.symbol;
1440
- const parts = new Intl.NumberFormat("en", {
1441
- style: "currency",
1442
- currency: currencyCode.toUpperCase(),
1443
- currencyDisplay: "narrowSymbol"
1444
- }).formatToParts(0);
1445
- return parts.find((p) => p.type === "currency")?.value || "";
1446
- }
1447
- function getCurrencyName(currencyCode) {
1448
- const cached = cachedCurrencies?.find((c) => c.code === currencyCode.toLowerCase());
1449
- if (cached) return cached.name;
1450
- const displayNames = new Intl.DisplayNames(["en"], { type: "currency" });
1451
- return displayNames.of(currencyCode.toUpperCase()) || "";
1452
- }
1453
-
1454
- // src/utils/price.ts
1455
1433
  function convertToMajor(minorAmount) {
1456
1434
  return minorAmount / 100;
1457
1435
  }
@@ -1663,7 +1641,7 @@ function track(eventName, params) {
1663
1641
  }
1664
1642
 
1665
1643
  // src/index.ts
1666
- var SDK_VERSION = "0.4.22";
1644
+ var SDK_VERSION = "0.4.24";
1667
1645
  var SUPPORTED_FRAMEWORKS = [
1668
1646
  "astro",
1669
1647
  "react",
@@ -1694,14 +1672,8 @@ async function createArkySDK(config) {
1694
1672
  }
1695
1673
  }).catch(() => {
1696
1674
  });
1697
- if (config.fetchFullConfig) {
1698
- platformApi.getConfig({ params: { currencies: true } }).then((platformConfig) => {
1699
- if (platformConfig.currencies) {
1700
- setCurrenciesCache(platformConfig.currencies);
1701
- }
1702
- }).catch(() => {
1703
- });
1704
- }
1675
+ platformApi.getConfig().catch(() => {
1676
+ });
1705
1677
  }
1706
1678
  const sdk = {
1707
1679
  auth: authApi,
@@ -1753,10 +1725,6 @@ async function createArkySDK(config) {
1753
1725
  getPriceAmount: (prices) => getPriceAmount(prices, apiConfig.market),
1754
1726
  formatPayment,
1755
1727
  formatMinor,
1756
- formatCurrency,
1757
- getCurrencySymbol,
1758
- getCurrencyName,
1759
- getCurrenciesCache,
1760
1728
  validatePhoneNumber,
1761
1729
  tzGroups,
1762
1730
  findTimeZone,
@@ -1785,9 +1753,5 @@ exports.PaymentMethodType = PaymentMethodType;
1785
1753
  exports.SDK_VERSION = SDK_VERSION;
1786
1754
  exports.SUPPORTED_FRAMEWORKS = SUPPORTED_FRAMEWORKS;
1787
1755
  exports.createArkySDK = createArkySDK;
1788
- exports.formatCurrency = formatCurrency;
1789
- exports.getCurrenciesCache = getCurrenciesCache;
1790
- exports.getCurrencyName = getCurrencyName;
1791
- exports.getCurrencySymbol = getCurrencySymbol;
1792
1756
  //# sourceMappingURL=index.cjs.map
1793
1757
  //# sourceMappingURL=index.cjs.map