@commercengine/storefront-sdk-nextjs 0.1.7 → 0.1.9
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.d.ts +1 -1
- package/dist/client.js +2 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{sdk-manager-Bj21OVWT.js → sdk-manager-BBryFtrW.js} +4 -10
- package/dist/{sdk-manager-B9xDQQuv.d.ts → sdk-manager-Bu8ZnY97.d.ts} +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClientTokenStorage,
|
|
1
|
+
import { a as ClientTokenStorage, i as initializeStorefrontSDK, n as StorefrontRuntimeConfig, o as NextJSTokenStorageOptions, r as getStorefrontSDK, t as NextJSSDKConfig } from "./sdk-manager-Bu8ZnY97.js";
|
|
2
2
|
import { AuthClient, BrowserTokenStorage, CartClient, CatalogClient, CookieTokenStorage, CustomerClient, Environment, HelpersClient, MemoryTokenStorage, OrderClient, ResponseUtils, ShippingClient, StoreConfigClient, StorefrontAPIClient, StorefrontSDK, StorefrontSDKOptions, TokenStorage } from "@commercengine/storefront-sdk";
|
|
3
3
|
|
|
4
4
|
//#region src/init-client.d.ts
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { ClientTokenStorage,
|
|
4
|
+
import { i as ClientTokenStorage, n as initializeStorefrontSDK, t as getStorefrontSDK } from "./sdk-manager-BBryFtrW.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.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StorefrontRuntimeConfig } from "./sdk-manager-
|
|
1
|
+
import { n as StorefrontRuntimeConfig } from "./sdk-manager-Bu8ZnY97.js";
|
|
2
2
|
import { AuthClient, BrowserTokenStorage, CartClient, CatalogClient, CookieTokenStorage, CustomerClient, Environment, HelpersClient, MemoryTokenStorage, OrderClient, ResponseUtils, ShippingClient, StoreConfigClient, StorefrontAPIClient, StorefrontSDK, StorefrontSDK as StorefrontSDK$1 } from "@commercengine/storefront-sdk";
|
|
3
3
|
export * from "@commercengine/storefront-sdk";
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as setGlobalStorefrontConfig, t as getStorefrontSDK } from "./sdk-manager-BBryFtrW.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,11 +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) {
|
|
290
|
-
const cacheKey = `${config.storeId}:${config.environment || "production"}`;
|
|
291
|
-
return new BuildCachingMemoryTokenStorage(cacheKey);
|
|
292
|
-
}
|
|
286
|
+
if (process.env.NEXT_BUILD_CACHE_TOKENS === "true" && config) return new BuildCachingMemoryTokenStorage(`${config.storeId}:${config.environment || "production"}`);
|
|
293
287
|
return new MemoryTokenStorage();
|
|
294
288
|
}
|
|
295
289
|
/**
|
|
@@ -346,4 +340,4 @@ function initializeStorefrontSDK() {
|
|
|
346
340
|
}
|
|
347
341
|
|
|
348
342
|
//#endregion
|
|
349
|
-
export {
|
|
343
|
+
export { ServerTokenStorage as a, ClientTokenStorage as i, initializeStorefrontSDK as n, setGlobalStorefrontConfig as r, getStorefrontSDK as t };
|
|
@@ -137,4 +137,4 @@ declare function getStorefrontSDK(cookieStore: NextCookieStore): StorefrontSDK;
|
|
|
137
137
|
*/
|
|
138
138
|
declare function initializeStorefrontSDK(): void;
|
|
139
139
|
//#endregion
|
|
140
|
-
export { ClientTokenStorage
|
|
140
|
+
export { ClientTokenStorage as a, initializeStorefrontSDK as i, StorefrontRuntimeConfig as n, NextJSTokenStorageOptions as o, getStorefrontSDK as r, ServerTokenStorage as s, NextJSSDKConfig as t };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as initializeStorefrontSDK, o as NextJSTokenStorageOptions, r as getStorefrontSDK, s as ServerTokenStorage, t as NextJSSDKConfig } from "./sdk-manager-Bu8ZnY97.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
|
export * from "@commercengine/storefront-sdk";
|
|
4
4
|
export { AuthClient, BrowserTokenStorage, CartClient, CatalogClient, CookieTokenStorage, CustomerClient, Environment, HelpersClient, MemoryTokenStorage, type NextJSSDKConfig, type NextJSTokenStorageOptions, OrderClient, ResponseUtils, ServerTokenStorage, ShippingClient, StoreConfigClient, StorefrontAPIClient, StorefrontSDK, getStorefrontSDK, initializeStorefrontSDK };
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServerTokenStorage,
|
|
1
|
+
import { a as ServerTokenStorage, n as initializeStorefrontSDK, t as getStorefrontSDK } from "./sdk-manager-BBryFtrW.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.9",
|
|
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.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^24.3.0",
|