@commercengine/storefront-sdk-nextjs 0.1.7 → 0.1.8
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/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { ClientTokenStorage, getStorefrontSDK, initializeStorefrontSDK } from "./sdk-manager-
|
|
4
|
+
import { ClientTokenStorage, getStorefrontSDK, initializeStorefrontSDK } from "./sdk-manager-BTDodUFt.js";
|
|
5
5
|
import { useEffect } from "react";
|
|
6
6
|
import { AuthClient, BrowserTokenStorage, CartClient, CatalogClient, CookieTokenStorage, CustomerClient, Environment, HelpersClient, MemoryTokenStorage, OrderClient, ResponseUtils, ShippingClient, StoreConfigClient, StorefrontAPIClient, StorefrontSDK } from "@commercengine/storefront-sdk";
|
|
7
7
|
|
|
@@ -28,8 +28,7 @@ import { AuthClient, BrowserTokenStorage, CartClient, CatalogClient, CookieToken
|
|
|
28
28
|
*/
|
|
29
29
|
async function bootstrapTokens() {
|
|
30
30
|
const sdk = getStorefrontSDK();
|
|
31
|
-
|
|
32
|
-
if (!accessToken) await sdk.auth.getAnonymousToken();
|
|
31
|
+
if (!await sdk.getAccessToken()) await sdk.auth.getAnonymousToken();
|
|
33
32
|
}
|
|
34
33
|
function StorefrontSDKInitializer({ runtimeConfig } = {}) {
|
|
35
34
|
useEffect(() => {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getStorefrontSDK, setGlobalStorefrontConfig } from "./sdk-manager-
|
|
1
|
+
import { getStorefrontSDK, setGlobalStorefrontConfig } from "./sdk-manager-BTDodUFt.js";
|
|
2
2
|
import { AuthClient, BrowserTokenStorage, CartClient, CatalogClient, CookieTokenStorage, CustomerClient, Environment, HelpersClient, MemoryTokenStorage, OrderClient, ResponseUtils, ShippingClient, StoreConfigClient, StorefrontAPIClient, StorefrontSDK } from "@commercengine/storefront-sdk";
|
|
3
3
|
|
|
4
4
|
//#region src/create-storefront.ts
|
|
@@ -39,8 +39,7 @@ var ClientTokenStorage = class {
|
|
|
39
39
|
}
|
|
40
40
|
getCookie(name) {
|
|
41
41
|
if (typeof document === "undefined") return null;
|
|
42
|
-
const
|
|
43
|
-
const parts = value.split(`; ${name}=`);
|
|
42
|
+
const parts = `; ${document.cookie}`.split(`; ${name}=`);
|
|
44
43
|
if (parts.length === 2) {
|
|
45
44
|
const cookieValue = parts.pop()?.split(";").shift();
|
|
46
45
|
return cookieValue ? decodeURIComponent(cookieValue) : null;
|
|
@@ -49,8 +48,7 @@ var ClientTokenStorage = class {
|
|
|
49
48
|
}
|
|
50
49
|
setCookie(name, value) {
|
|
51
50
|
if (typeof document === "undefined") return;
|
|
52
|
-
|
|
53
|
-
let cookieString = `${name}=${encodedValue}`;
|
|
51
|
+
let cookieString = `${name}=${encodeURIComponent(value)}`;
|
|
54
52
|
if (this.options.maxAge) cookieString += `; Max-Age=${this.options.maxAge}`;
|
|
55
53
|
if (this.options.path) cookieString += `; Path=${this.options.path}`;
|
|
56
54
|
if (this.options.domain) cookieString += `; Domain=${this.options.domain}`;
|
|
@@ -285,8 +283,7 @@ let clientSDK = null;
|
|
|
285
283
|
function createTokenStorage(cookieStore, options, config) {
|
|
286
284
|
if (typeof window !== "undefined") return new ClientTokenStorage(options);
|
|
287
285
|
if (cookieStore) return new ServerTokenStorage(cookieStore, options);
|
|
288
|
-
|
|
289
|
-
if (shouldCache && config) {
|
|
286
|
+
if (process.env.NEXT_BUILD_CACHE_TOKENS === "true" && config) {
|
|
290
287
|
const cacheKey = `${config.storeId}:${config.environment || "production"}`;
|
|
291
288
|
return new BuildCachingMemoryTokenStorage(cacheKey);
|
|
292
289
|
}
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerTokenStorage, getStorefrontSDK, initializeStorefrontSDK } from "./sdk-manager-
|
|
1
|
+
import { ServerTokenStorage, getStorefrontSDK, initializeStorefrontSDK } from "./sdk-manager-BTDodUFt.js";
|
|
2
2
|
import { AuthClient, BrowserTokenStorage, CartClient, CatalogClient, CookieTokenStorage, CustomerClient, Environment, HelpersClient, MemoryTokenStorage, OrderClient, ResponseUtils, ShippingClient, StoreConfigClient, StorefrontAPIClient, StorefrontSDK } from "@commercengine/storefront-sdk";
|
|
3
3
|
|
|
4
4
|
export * from "@commercengine/storefront-sdk"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercengine/storefront-sdk-nextjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Next.js wrapper for the Commerce Engine Storefront SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react-dom": ">=19.0.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@commercengine/storefront-sdk": "0.10.
|
|
46
|
+
"@commercengine/storefront-sdk": "0.10.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^24.3.0",
|