@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 +2 -2
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +12 -12
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -6
package/dist/index.iife.js
CHANGED
|
@@ -831,22 +831,22 @@ var CE_SDK = (() => {
|
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
833
|
async getAccessToken() {
|
|
834
|
-
return this.getCookie(this.accessTokenKey);
|
|
834
|
+
return await this.getCookie(this.accessTokenKey);
|
|
835
835
|
}
|
|
836
836
|
async setAccessToken(token) {
|
|
837
|
-
this.setCookie(this.accessTokenKey, token);
|
|
837
|
+
await this.setCookie(this.accessTokenKey, token);
|
|
838
838
|
}
|
|
839
839
|
async getRefreshToken() {
|
|
840
|
-
return this.getCookie(this.refreshTokenKey);
|
|
840
|
+
return await this.getCookie(this.refreshTokenKey);
|
|
841
841
|
}
|
|
842
842
|
async setRefreshToken(token) {
|
|
843
|
-
this.setCookie(this.refreshTokenKey, token);
|
|
843
|
+
await this.setCookie(this.refreshTokenKey, token);
|
|
844
844
|
}
|
|
845
845
|
async clearTokens() {
|
|
846
|
-
this.deleteCookie(this.accessTokenKey);
|
|
847
|
-
this.deleteCookie(this.refreshTokenKey);
|
|
846
|
+
await this.deleteCookie(this.accessTokenKey);
|
|
847
|
+
await this.deleteCookie(this.refreshTokenKey);
|
|
848
848
|
}
|
|
849
|
-
getCookie(name) {
|
|
849
|
+
async getCookie(name) {
|
|
850
850
|
if (typeof window !== "undefined") {
|
|
851
851
|
const value = `; ${document.cookie}`;
|
|
852
852
|
const parts = value.split(`; ${name}=`);
|
|
@@ -858,14 +858,14 @@ var CE_SDK = (() => {
|
|
|
858
858
|
} else {
|
|
859
859
|
try {
|
|
860
860
|
const { cookies } = __require("next/headers");
|
|
861
|
-
const cookieStore = cookies();
|
|
861
|
+
const cookieStore = await cookies();
|
|
862
862
|
return cookieStore.get(name)?.value || null;
|
|
863
863
|
} catch {
|
|
864
864
|
return null;
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
|
-
setCookie(name, value) {
|
|
868
|
+
async setCookie(name, value) {
|
|
869
869
|
if (typeof window !== "undefined") {
|
|
870
870
|
const encodedValue = encodeURIComponent(value);
|
|
871
871
|
let cookieString = `${name}=${encodedValue}`;
|
|
@@ -888,7 +888,7 @@ var CE_SDK = (() => {
|
|
|
888
888
|
} else {
|
|
889
889
|
try {
|
|
890
890
|
const { cookies } = __require("next/headers");
|
|
891
|
-
const cookieStore = cookies();
|
|
891
|
+
const cookieStore = await cookies();
|
|
892
892
|
cookieStore.set(name, value, {
|
|
893
893
|
maxAge: this.options.maxAge,
|
|
894
894
|
path: this.options.path,
|
|
@@ -901,7 +901,7 @@ var CE_SDK = (() => {
|
|
|
901
901
|
}
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
|
-
deleteCookie(name) {
|
|
904
|
+
async deleteCookie(name) {
|
|
905
905
|
if (typeof window !== "undefined") {
|
|
906
906
|
let cookieString = `${name}=; Max-Age=0`;
|
|
907
907
|
if (this.options.path) {
|
|
@@ -914,7 +914,7 @@ var CE_SDK = (() => {
|
|
|
914
914
|
} else {
|
|
915
915
|
try {
|
|
916
916
|
const { cookies } = __require("next/headers");
|
|
917
|
-
const cookieStore = cookies();
|
|
917
|
+
const cookieStore = await cookies();
|
|
918
918
|
cookieStore.delete(name);
|
|
919
919
|
} catch {
|
|
920
920
|
console.warn(`Could not remove cookie ${name} on server side`);
|