@vue-storefront/next 1.0.2 → 1.1.0
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/CHANGELOG.md +26 -0
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.d.mts +8 -12
- package/dist/index.d.ts +8 -12
- package/dist/index.js +1 -0
- package/dist/index.mjs +2 -1
- package/dist/{types-m9jwrtV3.d.mts → types-C6rAwI5a.d.mts} +2 -1
- package/dist/{types-m9jwrtV3.d.ts → types-C6rAwI5a.d.ts} +2 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
- **[ADDED]** `middlewareModule` to `createSdk` params.
|
|
6
|
+
|
|
7
|
+
```diff [sdk.config.ts]
|
|
8
|
+
- import { UnifiedApiExtension } from "storefront-middleware/types"
|
|
9
|
+
+ import { UnifiedEndpoints } from "storefront-middleware/types"
|
|
10
|
+
|
|
11
|
+
export const { getSdk } = createSdk(
|
|
12
|
+
options,
|
|
13
|
+
- ({ buildModule, middlewareUrl, getRequestHeaders }) => ({
|
|
14
|
+
- commerce: buildModule(unifiedModule<UnifiedApiExtension>, {
|
|
15
|
+
- apiUrl: `${middlewareUrl}/commerce`,
|
|
16
|
+
- requestOptions: {
|
|
17
|
+
- headers: getRequestHeaders,
|
|
18
|
+
+ ({ buildModule, middlewareModule, middlewareUrl, getRequestHeaders }) => ({
|
|
19
|
+
+ commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
|
|
20
|
+
+ apiUrl: `${middlewareUrl}/commerce`,
|
|
21
|
+
+ defaultRequestConfig: {
|
|
22
|
+
+ headers: getRequestHeaders(),
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
```
|
|
28
|
+
|
|
3
29
|
## 1.0.2
|
|
4
30
|
|
|
5
31
|
- **[FIXED]** Multi-store URL calculation, now working correctly in the browser.
|
package/dist/client.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SDKApi } from '@vue-storefront/sdk';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { S as SdkProviderProps } from './types-
|
|
3
|
+
import { S as SdkProviderProps } from './types-C6rAwI5a.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates a new SDK context. This function is dedicated for the client-side usage.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SDKApi } from '@vue-storefront/sdk';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { S as SdkProviderProps } from './types-
|
|
3
|
+
import { S as SdkProviderProps } from './types-C6rAwI5a.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates a new SDK context. This function is dedicated for the client-side usage.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Config, a as CreateSdkReturn } from './types-
|
|
1
|
+
import { C as Config, a as CreateSdkReturn } from './types-C6rAwI5a.mjs';
|
|
2
2
|
import '@vue-storefront/sdk';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -34,13 +34,9 @@ interface CreateSdkOptions {
|
|
|
34
34
|
* @returns An object containing the `getSdk` function.
|
|
35
35
|
* @example
|
|
36
36
|
* ```tsx
|
|
37
|
-
* import {
|
|
38
|
-
* contentfulModule,
|
|
39
|
-
* ContentfulModuleType,
|
|
40
|
-
* } from "@vsf-enterprise/contentful-sdk";
|
|
41
|
-
* import { unifiedModule } from "@vsf-enterprise/unified-sdk";
|
|
37
|
+
* import { contentfulModule } from "@vsf-enterprise/contentful-sdk";
|
|
42
38
|
* import { CreateSdkOptions, createSdk } from "@vue-storefront/next";
|
|
43
|
-
* import type {
|
|
39
|
+
* import type { UnifiedApiEndpoints } from "../storefront-middleware/types";
|
|
44
40
|
*
|
|
45
41
|
* const options: CreateSdkOptions = {
|
|
46
42
|
* middleware: {
|
|
@@ -50,14 +46,14 @@ interface CreateSdkOptions {
|
|
|
50
46
|
*
|
|
51
47
|
* export const { getSdk, createSdkContext } = createSdk(
|
|
52
48
|
* options,
|
|
53
|
-
* ({ buildModule, middlewareUrl, getRequestHeaders }) => ({
|
|
54
|
-
* unified: buildModule(
|
|
49
|
+
* ({ buildModule, middlewareModule, middlewareUrl, getRequestHeaders }) => ({
|
|
50
|
+
* unified: buildModule(middlewareModule<UnifiedApiEndpoints>, {
|
|
55
51
|
* apiUrl: middlewareUrl + "/commerce",
|
|
56
|
-
*
|
|
57
|
-
* headers: getRequestHeaders,
|
|
52
|
+
* defaultRequestConfig: {
|
|
53
|
+
* headers: getRequestHeaders(),
|
|
58
54
|
* },
|
|
59
55
|
* }),
|
|
60
|
-
* contentful: buildModule
|
|
56
|
+
* contentful: buildModule(contentfulModule, {
|
|
61
57
|
* apiUrl: middlewareUrl + "/cntf",
|
|
62
58
|
* }),
|
|
63
59
|
* }),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Config, a as CreateSdkReturn } from './types-
|
|
1
|
+
import { C as Config, a as CreateSdkReturn } from './types-C6rAwI5a.js';
|
|
2
2
|
import '@vue-storefront/sdk';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -34,13 +34,9 @@ interface CreateSdkOptions {
|
|
|
34
34
|
* @returns An object containing the `getSdk` function.
|
|
35
35
|
* @example
|
|
36
36
|
* ```tsx
|
|
37
|
-
* import {
|
|
38
|
-
* contentfulModule,
|
|
39
|
-
* ContentfulModuleType,
|
|
40
|
-
* } from "@vsf-enterprise/contentful-sdk";
|
|
41
|
-
* import { unifiedModule } from "@vsf-enterprise/unified-sdk";
|
|
37
|
+
* import { contentfulModule } from "@vsf-enterprise/contentful-sdk";
|
|
42
38
|
* import { CreateSdkOptions, createSdk } from "@vue-storefront/next";
|
|
43
|
-
* import type {
|
|
39
|
+
* import type { UnifiedApiEndpoints } from "../storefront-middleware/types";
|
|
44
40
|
*
|
|
45
41
|
* const options: CreateSdkOptions = {
|
|
46
42
|
* middleware: {
|
|
@@ -50,14 +46,14 @@ interface CreateSdkOptions {
|
|
|
50
46
|
*
|
|
51
47
|
* export const { getSdk, createSdkContext } = createSdk(
|
|
52
48
|
* options,
|
|
53
|
-
* ({ buildModule, middlewareUrl, getRequestHeaders }) => ({
|
|
54
|
-
* unified: buildModule(
|
|
49
|
+
* ({ buildModule, middlewareModule, middlewareUrl, getRequestHeaders }) => ({
|
|
50
|
+
* unified: buildModule(middlewareModule<UnifiedApiEndpoints>, {
|
|
55
51
|
* apiUrl: middlewareUrl + "/commerce",
|
|
56
|
-
*
|
|
57
|
-
* headers: getRequestHeaders,
|
|
52
|
+
* defaultRequestConfig: {
|
|
53
|
+
* headers: getRequestHeaders(),
|
|
58
54
|
* },
|
|
59
55
|
* }),
|
|
60
|
-
* contentful: buildModule
|
|
56
|
+
* contentful: buildModule(contentfulModule, {
|
|
61
57
|
* apiUrl: middlewareUrl + "/cntf",
|
|
62
58
|
* }),
|
|
63
59
|
* }),
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -42,7 +42,7 @@ function composeMiddlewareUrl({
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// src/sdk/index.tsx
|
|
45
|
-
import { buildModule, initSDK } from "@vue-storefront/sdk";
|
|
45
|
+
import { buildModule, initSDK, middlewareModule } from "@vue-storefront/sdk";
|
|
46
46
|
|
|
47
47
|
// src/sdk/helpers/resolveDynamicContext.ts
|
|
48
48
|
var BLACKLISTED_HEADERS = /* @__PURE__ */ new Set(["host"]);
|
|
@@ -74,6 +74,7 @@ function createSdk(options, configDefinition) {
|
|
|
74
74
|
});
|
|
75
75
|
const resolvedConfig = configDefinition({
|
|
76
76
|
buildModule,
|
|
77
|
+
middlewareModule,
|
|
77
78
|
getRequestHeaders,
|
|
78
79
|
middlewareUrl
|
|
79
80
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SDKApi, buildModule } from '@vue-storefront/sdk';
|
|
1
|
+
import { SDKApi, buildModule, middlewareModule } from '@vue-storefront/sdk';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type GetSdkContext = {
|
|
@@ -12,6 +12,7 @@ type DynamicContext = {
|
|
|
12
12
|
};
|
|
13
13
|
type StaticContext = {
|
|
14
14
|
buildModule: typeof buildModule;
|
|
15
|
+
middlewareModule: typeof middlewareModule;
|
|
15
16
|
middlewareUrl: string;
|
|
16
17
|
};
|
|
17
18
|
type InjectedContext = DynamicContext & StaticContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SDKApi, buildModule } from '@vue-storefront/sdk';
|
|
1
|
+
import { SDKApi, buildModule, middlewareModule } from '@vue-storefront/sdk';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type GetSdkContext = {
|
|
@@ -12,6 +12,7 @@ type DynamicContext = {
|
|
|
12
12
|
};
|
|
13
13
|
type StaticContext = {
|
|
14
14
|
buildModule: typeof buildModule;
|
|
15
|
+
middlewareModule: typeof middlewareModule;
|
|
15
16
|
middlewareUrl: string;
|
|
16
17
|
};
|
|
17
18
|
type InjectedContext = DynamicContext & StaticContext;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@vue-storefront/next",
|
|
3
3
|
"description": "Vue Storefront dedicated features for Next.js",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.0
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"import": "./dist/index.mjs",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"dev:pages-router": "cd __tests__/apps/pages-router && yarn dev",
|
|
37
37
|
"dev:middleware": "cd ../../shared/src/__tests__/middleware && yarn dev",
|
|
38
38
|
"lint": "eslint . --ext .ts",
|
|
39
|
-
"test:app-router": "start-server-and-test dev:middleware localhost:4000/test_integration/
|
|
40
|
-
"test:pages-router": "start-server-and-test dev:middleware localhost:4000/test_integration/
|
|
39
|
+
"test:app-router": "start-server-and-test dev:middleware localhost:4000/test_integration/getSuccess dev:app-router localhost:3000 \"yarn test:e2e\"",
|
|
40
|
+
"test:pages-router": "start-server-and-test dev:middleware localhost:4000/test_integration/getSuccess dev:pages-router localhost:3000 \"yarn test:e2e\"",
|
|
41
41
|
"test": "yarn test:app-router && yarn test:pages-router",
|
|
42
42
|
"test:e2e": "cd ../../shared/ && yarn test:e2e",
|
|
43
43
|
"test:unit": "vitest run"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@vue-storefront/sdk": "^1.
|
|
46
|
+
"@vue-storefront/sdk": "^1.4.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/react": "^18.2.31",
|