arky-sdk 0.3.3 → 0.3.4

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
@@ -1629,7 +1629,7 @@ function createHttpClient(cfg) {
1629
1629
  "Content-Type": "application/json",
1630
1630
  ...options?.headers || {}
1631
1631
  };
1632
- let { accessToken, refreshToken, provider, expiresAt } = await cfg.getTokens();
1632
+ let { accessToken, refreshToken, provider, expiresAt } = await cfg.getToken();
1633
1633
  const nowSec = Date.now() / 1e3;
1634
1634
  if (expiresAt && nowSec > expiresAt) {
1635
1635
  if (refreshToken) {
@@ -1640,7 +1640,7 @@ function createHttpClient(cfg) {
1640
1640
  });
1641
1641
  if (refRes.ok) {
1642
1642
  const data2 = await refRes.json();
1643
- cfg.setTokens(data2);
1643
+ cfg.setToken(data2);
1644
1644
  accessToken = data2.accessToken;
1645
1645
  } else {
1646
1646
  cfg.logout();
@@ -1703,7 +1703,7 @@ function createHttpClient(cfg) {
1703
1703
  }
1704
1704
 
1705
1705
  // src/index.ts
1706
- var SDK_VERSION = "0.3.3";
1706
+ var SDK_VERSION = "0.3.4";
1707
1707
  var SUPPORTED_FRAMEWORKS = ["astro", "react", "vue", "svelte", "vanilla"];
1708
1708
  function createArkySDK(config) {
1709
1709
  const httpClient = createHttpClient(config);
@@ -1714,8 +1714,8 @@ function createArkySDK(config) {
1714
1714
  storageUrl,
1715
1715
  baseUrl: config.baseUrl,
1716
1716
  market: config.market || "US",
1717
- setTokens: config.setTokens,
1718
- getTokens: config.getTokens
1717
+ setTokens: config.setToken,
1718
+ getTokens: config.getToken
1719
1719
  };
1720
1720
  const userApi = createUserApi(apiConfig);
1721
1721
  const autoGuest = config.autoGuest !== void 0 ? config.autoGuest : true;
@@ -1738,7 +1738,7 @@ function createArkySDK(config) {
1738
1738
  getBusinessId: () => apiConfig.businessId,
1739
1739
  isAuthenticated: config.isAuthenticated || (() => false),
1740
1740
  logout: config.logout,
1741
- setTokens: config.setTokens,
1741
+ setToken: config.setToken,
1742
1742
  utils: {
1743
1743
  getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock, storageUrl),
1744
1744
  thumbnailUrl: (service) => thumbnailUrl(service, storageUrl),
@@ -1757,7 +1757,7 @@ function createArkySDK(config) {
1757
1757
  if (autoGuest) {
1758
1758
  Promise.resolve().then(async () => {
1759
1759
  try {
1760
- const tokens = await config.getTokens();
1760
+ const tokens = await config.getToken();
1761
1761
  if (!tokens.accessToken && !tokens.refreshToken) {
1762
1762
  const guestToken = await userApi.getGuestToken({});
1763
1763
  console.log("[SDK Init] Created guest token:", guestToken ? "Success" : "Failed");