@commercengine/storefront-sdk 0.6.0 → 0.6.1

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.js CHANGED
@@ -234,22 +234,22 @@ var NextJSTokenStorage = class {
234
234
  };
235
235
  }
236
236
  async getAccessToken() {
237
- return this.getCookie(this.accessTokenKey);
237
+ return await this.getCookie(this.accessTokenKey);
238
238
  }
239
239
  async setAccessToken(token) {
240
- this.setCookie(this.accessTokenKey, token);
240
+ await this.setCookie(this.accessTokenKey, token);
241
241
  }
242
242
  async getRefreshToken() {
243
- return this.getCookie(this.refreshTokenKey);
243
+ return await this.getCookie(this.refreshTokenKey);
244
244
  }
245
245
  async setRefreshToken(token) {
246
- this.setCookie(this.refreshTokenKey, token);
246
+ await this.setCookie(this.refreshTokenKey, token);
247
247
  }
248
248
  async clearTokens() {
249
- this.deleteCookie(this.accessTokenKey);
250
- this.deleteCookie(this.refreshTokenKey);
249
+ await this.deleteCookie(this.accessTokenKey);
250
+ await this.deleteCookie(this.refreshTokenKey);
251
251
  }
252
- getCookie(name) {
252
+ async getCookie(name) {
253
253
  if (typeof window !== "undefined") {
254
254
  const value = `; ${document.cookie}`;
255
255
  const parts = value.split(`; ${name}=`);
@@ -261,14 +261,14 @@ var NextJSTokenStorage = class {
261
261
  } else {
262
262
  try {
263
263
  const { cookies } = __require("next/headers");
264
- const cookieStore = cookies();
264
+ const cookieStore = await cookies();
265
265
  return cookieStore.get(name)?.value || null;
266
266
  } catch {
267
267
  return null;
268
268
  }
269
269
  }
270
270
  }
271
- setCookie(name, value) {
271
+ async setCookie(name, value) {
272
272
  if (typeof window !== "undefined") {
273
273
  const encodedValue = encodeURIComponent(value);
274
274
  let cookieString = `${name}=${encodedValue}`;
@@ -291,7 +291,7 @@ var NextJSTokenStorage = class {
291
291
  } else {
292
292
  try {
293
293
  const { cookies } = __require("next/headers");
294
- const cookieStore = cookies();
294
+ const cookieStore = await cookies();
295
295
  cookieStore.set(name, value, {
296
296
  maxAge: this.options.maxAge,
297
297
  path: this.options.path,
@@ -304,7 +304,7 @@ var NextJSTokenStorage = class {
304
304
  }
305
305
  }
306
306
  }
307
- deleteCookie(name) {
307
+ async deleteCookie(name) {
308
308
  if (typeof window !== "undefined") {
309
309
  let cookieString = `${name}=; Max-Age=0`;
310
310
  if (this.options.path) {
@@ -317,7 +317,7 @@ var NextJSTokenStorage = class {
317
317
  } else {
318
318
  try {
319
319
  const { cookies } = __require("next/headers");
320
- const cookieStore = cookies();
320
+ const cookieStore = await cookies();
321
321
  cookieStore.delete(name);
322
322
  } catch {
323
323
  console.warn(`Could not remove cookie ${name} on server side`);