arky-sdk 0.3.1 → 0.3.3

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/dist/index.cjs CHANGED
@@ -1643,20 +1643,14 @@ function createHttpClient(cfg) {
1643
1643
  cfg.setTokens(data2);
1644
1644
  accessToken = data2.accessToken;
1645
1645
  } else {
1646
- cfg.onAuthFailure();
1647
- if (cfg.loginFallbackPath) {
1648
- cfg.navigate?.(cfg.loginFallbackPath);
1649
- }
1646
+ cfg.logout();
1650
1647
  const err = new Error("Error refreshing token");
1651
1648
  err.name = "ApiError";
1652
1649
  err.statusCode = 401;
1653
1650
  throw err;
1654
1651
  }
1655
1652
  } else {
1656
- cfg.onAuthFailure();
1657
- if (cfg.loginFallbackPath) {
1658
- cfg.navigate?.(cfg.loginFallbackPath);
1659
- }
1653
+ cfg.logout();
1660
1654
  const err = new Error("No refresh token");
1661
1655
  err.name = "ApiError";
1662
1656
  err.statusCode = 401;
@@ -1675,7 +1669,6 @@ function createHttpClient(cfg) {
1675
1669
  let data;
1676
1670
  try {
1677
1671
  const fullUrl = `${cfg.baseUrl}${finalPath}`;
1678
- console.log("[SDK] Fetching:", method, fullUrl, fetchOpts);
1679
1672
  res = await fetch(fullUrl, fetchOpts);
1680
1673
  data = await res.json();
1681
1674
  } catch (error) {
@@ -1710,7 +1703,7 @@ function createHttpClient(cfg) {
1710
1703
  }
1711
1704
 
1712
1705
  // src/index.ts
1713
- var SDK_VERSION = "0.3.1";
1706
+ var SDK_VERSION = "0.3.3";
1714
1707
  var SUPPORTED_FRAMEWORKS = ["astro", "react", "vue", "svelte", "vanilla"];
1715
1708
  function createArkySDK(config) {
1716
1709
  const httpClient = createHttpClient(config);
@@ -1743,12 +1736,9 @@ function createArkySDK(config) {
1743
1736
  apiConfig.businessId = businessId;
1744
1737
  },
1745
1738
  getBusinessId: () => apiConfig.businessId,
1746
- auth: {
1747
- isAuthenticated: config.isAuthenticated || (() => false),
1748
- logout: config.logout || config.onAuthFailure,
1749
- setUserToken: config.setUserToken || (() => {
1750
- })
1751
- },
1739
+ isAuthenticated: config.isAuthenticated || (() => false),
1740
+ logout: config.logout,
1741
+ setTokens: config.setTokens,
1752
1742
  utils: {
1753
1743
  getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock, storageUrl),
1754
1744
  thumbnailUrl: (service) => thumbnailUrl(service, storageUrl),