@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/README.md CHANGED
@@ -466,8 +466,8 @@ This will prompt you to:
466
466
  #### Available Scripts
467
467
 
468
468
  - `pnpm changeset` - Create a new changeset
469
- - `pnpm version` - Consume changesets and bump version
470
- - `pnpm release` - Build and publish to npm
469
+ - `pnpm run version` - Consume changesets and bump version
470
+ - `pnpm run release` - Build and publish to npm
471
471
 
472
472
  The changeset workflow ensures proper semantic versioning, comprehensive changelogs, and coordinated releases.
473
473
 
package/dist/index.cjs CHANGED
@@ -279,22 +279,22 @@ var NextJSTokenStorage = class {
279
279
  };
280
280
  }
281
281
  async getAccessToken() {
282
- return this.getCookie(this.accessTokenKey);
282
+ return await this.getCookie(this.accessTokenKey);
283
283
  }
284
284
  async setAccessToken(token) {
285
- this.setCookie(this.accessTokenKey, token);
285
+ await this.setCookie(this.accessTokenKey, token);
286
286
  }
287
287
  async getRefreshToken() {
288
- return this.getCookie(this.refreshTokenKey);
288
+ return await this.getCookie(this.refreshTokenKey);
289
289
  }
290
290
  async setRefreshToken(token) {
291
- this.setCookie(this.refreshTokenKey, token);
291
+ await this.setCookie(this.refreshTokenKey, token);
292
292
  }
293
293
  async clearTokens() {
294
- this.deleteCookie(this.accessTokenKey);
295
- this.deleteCookie(this.refreshTokenKey);
294
+ await this.deleteCookie(this.accessTokenKey);
295
+ await this.deleteCookie(this.refreshTokenKey);
296
296
  }
297
- getCookie(name) {
297
+ async getCookie(name) {
298
298
  if (typeof window !== "undefined") {
299
299
  const value = `; ${document.cookie}`;
300
300
  const parts = value.split(`; ${name}=`);
@@ -306,14 +306,14 @@ var NextJSTokenStorage = class {
306
306
  } else {
307
307
  try {
308
308
  const { cookies } = require("next/headers");
309
- const cookieStore = cookies();
309
+ const cookieStore = await cookies();
310
310
  return cookieStore.get(name)?.value || null;
311
311
  } catch {
312
312
  return null;
313
313
  }
314
314
  }
315
315
  }
316
- setCookie(name, value) {
316
+ async setCookie(name, value) {
317
317
  if (typeof window !== "undefined") {
318
318
  const encodedValue = encodeURIComponent(value);
319
319
  let cookieString = `${name}=${encodedValue}`;
@@ -336,7 +336,7 @@ var NextJSTokenStorage = class {
336
336
  } else {
337
337
  try {
338
338
  const { cookies } = require("next/headers");
339
- const cookieStore = cookies();
339
+ const cookieStore = await cookies();
340
340
  cookieStore.set(name, value, {
341
341
  maxAge: this.options.maxAge,
342
342
  path: this.options.path,
@@ -349,7 +349,7 @@ var NextJSTokenStorage = class {
349
349
  }
350
350
  }
351
351
  }
352
- deleteCookie(name) {
352
+ async deleteCookie(name) {
353
353
  if (typeof window !== "undefined") {
354
354
  let cookieString = `${name}=; Max-Age=0`;
355
355
  if (this.options.path) {
@@ -362,7 +362,7 @@ var NextJSTokenStorage = class {
362
362
  } else {
363
363
  try {
364
364
  const { cookies } = require("next/headers");
365
- const cookieStore = cookies();
365
+ const cookieStore = await cookies();
366
366
  cookieStore.delete(name);
367
367
  } catch {
368
368
  console.warn(`Could not remove cookie ${name} on server side`);